Compare commits
No commits in common. "94570af748a34364e8f1f2ade323e9ef2013cdaf" and "bb0656c5055dea396db049b362aacb200e3d4e0b" have entirely different histories.
94570af748
...
bb0656c505
72 changed files with 559 additions and 703 deletions
26
src/App.js
26
src/App.js
|
|
@ -26,8 +26,8 @@ import { useI18nStore } from 'src/stores/i18n.js'
|
|||
import { useInstanceStore } from 'src/stores/instance.js'
|
||||
import { useInstanceCapabilitiesStore } from 'src/stores/instance_capabilities.js'
|
||||
import { useInterfaceStore } from 'src/stores/interface.js'
|
||||
import { useMergedConfigStore } from 'src/stores/merged_config.js'
|
||||
import { useShoutStore } from 'src/stores/shout.js'
|
||||
import { useSyncConfigStore } from 'src/stores/sync_config.js'
|
||||
|
||||
import messages from 'src/i18n/messages'
|
||||
import localeService from 'src/services/locale/locale.service.js'
|
||||
|
|
@ -80,7 +80,7 @@ export default {
|
|||
},
|
||||
created() {
|
||||
// Load the locale from the storage
|
||||
const value = useMergedConfigStore().mergedConfig.interfaceLanguage
|
||||
const value = useSyncConfigStore().mergedConfig.interfaceLanguage
|
||||
useI18nStore().setLanguage(value)
|
||||
useEmojiStore().loadUnicodeEmojiData(value)
|
||||
|
||||
|
|
@ -132,7 +132,7 @@ export default {
|
|||
]
|
||||
},
|
||||
navClasses() {
|
||||
const { navbarColumnStretch } = useMergedConfigStore().mergedConfig
|
||||
const { navbarColumnStretch } = useSyncConfigStore().mergedConfig
|
||||
return [
|
||||
'-' + this.layoutType,
|
||||
...(navbarColumnStretch ? ['-column-stretch'] : []),
|
||||
|
|
@ -145,7 +145,7 @@ export default {
|
|||
return this.currentUser.background_image
|
||||
},
|
||||
instanceBackground() {
|
||||
return useMergedConfigStore().mergedConfig.hideInstanceWallpaper
|
||||
return useSyncConfigStore().mergedConfig.hideInstanceWallpaper
|
||||
? null
|
||||
: this.instanceBackgroundUrl
|
||||
},
|
||||
|
|
@ -172,21 +172,19 @@ export default {
|
|||
if (this.isChats) return false
|
||||
if (this.isListEdit) return false
|
||||
return (
|
||||
useMergedConfigStore().mergedConfig.alwaysShowNewPostButton ||
|
||||
useSyncConfigStore().mergedConfig.alwaysShowNewPostButton ||
|
||||
this.layoutType === 'mobile'
|
||||
)
|
||||
},
|
||||
shoutboxPosition() {
|
||||
return (
|
||||
useMergedConfigStore().mergedConfig.alwaysShowNewPostButton || false
|
||||
)
|
||||
return useSyncConfigStore().mergedConfig.alwaysShowNewPostButton || false
|
||||
},
|
||||
hideShoutbox() {
|
||||
return useMergedConfigStore().mergedConfig.hideShoutbox
|
||||
return useSyncConfigStore().mergedConfig.hideShoutbox
|
||||
},
|
||||
reverseLayout() {
|
||||
const { thirdColumnMode, sidebarRight: reverseSetting } =
|
||||
useMergedConfigStore().mergedConfig
|
||||
useSyncConfigStore().mergedConfig
|
||||
if (this.layoutType !== 'wide') {
|
||||
return reverseSetting
|
||||
} else {
|
||||
|
|
@ -196,10 +194,10 @@ export default {
|
|||
}
|
||||
},
|
||||
noSticky() {
|
||||
return useMergedConfigStore().mergedConfig.disableStickyHeaders
|
||||
return useSyncConfigStore().mergedConfig.disableStickyHeaders
|
||||
},
|
||||
showScrollbars() {
|
||||
return useMergedConfigStore().mergedConfig.showScrollbars
|
||||
return useSyncConfigStore().mergedConfig.showScrollbars
|
||||
},
|
||||
scrollParent() {
|
||||
return window /* this.$refs.appContentRef */
|
||||
|
|
@ -207,10 +205,10 @@ export default {
|
|||
showInstanceSpecificPanel() {
|
||||
return (
|
||||
this.instanceSpecificPanelPresent &&
|
||||
!useMergedConfigStore().mergedConfig.hideISP
|
||||
!useSyncConfigStore().mergedConfig.hideISP
|
||||
)
|
||||
},
|
||||
...mapState(useMergedConfigStore, ['mergedConfig']),
|
||||
...mapState(useSyncConfigStore, ['mergedConfig']),
|
||||
...mapState(useInterfaceStore, [
|
||||
'themeApplied',
|
||||
'styleDataUsed',
|
||||
|
|
|
|||
|
|
@ -33,15 +33,14 @@ import { useInstanceStore } from 'src/stores/instance.js'
|
|||
import { useInstanceCapabilitiesStore } from 'src/stores/instance_capabilities.js'
|
||||
import { useInterfaceStore } from 'src/stores/interface.js'
|
||||
import { useLocalConfigStore } from 'src/stores/local_config.js'
|
||||
import { useMergedConfigStore } from 'src/stores/merged_config.js'
|
||||
import { useOAuthStore } from 'src/stores/oauth'
|
||||
import { useSyncConfigStore } from 'src/stores/sync_config.js'
|
||||
import { useUserHighlightStore } from 'src/stores/user_highlight.js'
|
||||
|
||||
import VBodyScrollLock from 'src/directives/body_scroll_lock'
|
||||
import {
|
||||
INSTANCE_DEFAULT_CONFIG_DEFINITIONS,
|
||||
INSTANCE_IDENTITY_DEFAULT_DEFINITIONS,
|
||||
instanceDefaultConfigDefinitions,
|
||||
instanceIdentityDefaultDefinitions,
|
||||
} from 'src/modules/default_config_state.js'
|
||||
|
||||
let staticInitialResults = null
|
||||
|
|
@ -84,7 +83,7 @@ const getInstanceConfig = async ({ store }) => {
|
|||
const res = await preloadFetch('/api/v1/instance')
|
||||
if (res.ok) {
|
||||
const data = await res.json()
|
||||
const textLimit = data.max_toot_chars
|
||||
const textlimit = data.max_toot_chars
|
||||
const vapidPublicKey = data.pleroma.vapid_public_key
|
||||
|
||||
useInstanceCapabilitiesStore().set(
|
||||
|
|
@ -92,8 +91,8 @@ const getInstanceConfig = async ({ store }) => {
|
|||
data.pleroma,
|
||||
)
|
||||
useInstanceStore().set({
|
||||
path: 'limits.textLimit',
|
||||
value: textLimit,
|
||||
path: 'textlimit',
|
||||
value: textlimit,
|
||||
})
|
||||
useInstanceStore().set({
|
||||
path: 'accountApprovalRequired',
|
||||
|
|
@ -170,19 +169,22 @@ const setSettings = async ({ apiConfig, staticConfig, store }) => {
|
|||
config = Object.assign({}, staticConfig, apiConfig)
|
||||
}
|
||||
|
||||
Object.keys(INSTANCE_IDENTITY_DEFAULT_DEFINITIONS).forEach((source) =>
|
||||
useInstanceStore().set({
|
||||
value: config[source],
|
||||
path: `instanceIdentity.${source}`,
|
||||
}),
|
||||
)
|
||||
const copyInstanceOption = ({ source, definition = { required: true }, destination }) => {
|
||||
const value = config[source]
|
||||
let { required, type, default: defaultValue } = definition
|
||||
if (type == null && defaultValue != null) type = typeof defaultValue
|
||||
if (required && value == null) return
|
||||
if (type != null && typeof value !== type) return
|
||||
|
||||
Object.keys(INSTANCE_DEFAULT_CONFIG_DEFINITIONS).forEach((source) =>
|
||||
useInstanceStore().set({
|
||||
value: config[source],
|
||||
path: `prefsStorage.${source}`,
|
||||
}),
|
||||
)
|
||||
useInstanceStore().set({ path: destination, value })
|
||||
}
|
||||
|
||||
Object.entries(instanceIdentityDefaultDefinitions)
|
||||
.map(([source, definition]) => ({ source, definition, destination: `instanceIdentity.${source}` }))
|
||||
.forEach(copyInstanceOption)
|
||||
Object.keys(instanceDefaultConfigDefinitions)
|
||||
.map(([source, definition]) => ({ source, definition, destination: `prefsStorage.${source}` }))
|
||||
.forEach(copyInstanceOption)
|
||||
|
||||
useAuthFlowStore().setInitialStrategy(config.loginMethod)
|
||||
}
|
||||
|
|
@ -192,7 +194,7 @@ const getTOS = async ({ store }) => {
|
|||
const res = await window.fetch('/static/terms-of-service.html')
|
||||
if (res.ok) {
|
||||
const html = await res.text()
|
||||
useInstanceStore().set({ path: 'instanceIdentity.tos', value: html })
|
||||
useInstanceStore().set({ name: 'instanceIdentity.tos', value: html })
|
||||
} else {
|
||||
throw res
|
||||
}
|
||||
|
|
@ -528,7 +530,6 @@ const afterStoreSetup = async ({ pinia, store, storageError, i18n }) => {
|
|||
useInterfaceStore().setLayoutWidth(windowWidth())
|
||||
useInterfaceStore().setLayoutHeight(windowHeight())
|
||||
window.syncConfig = useSyncConfigStore()
|
||||
window.mergedConfig = useMergedConfigStore()
|
||||
window.localConfig = useLocalConfigStore()
|
||||
window.highlightConfig = useUserHighlightStore()
|
||||
|
||||
|
|
@ -542,7 +543,7 @@ const afterStoreSetup = async ({ pinia, store, storageError, i18n }) => {
|
|||
typeof overrides.target !== 'undefined'
|
||||
? overrides.target
|
||||
: window.location.origin
|
||||
useInstanceStore().set({ path: 'server', value: server })
|
||||
useInstanceStore().set({ name: 'server', value: server })
|
||||
|
||||
await setConfig({ store })
|
||||
try {
|
||||
|
|
@ -556,7 +557,7 @@ const afterStoreSetup = async ({ pinia, store, storageError, i18n }) => {
|
|||
return Promise.reject(e)
|
||||
}
|
||||
|
||||
applyStyleConfig(useMergedConfigStore().mergedConfig, i18n.global)
|
||||
applyStyleConfig(useSyncConfigStore().mergedConfig, i18n.global)
|
||||
|
||||
// Now we can try getting the server settings and logging in
|
||||
// Most of these are preloaded into the index.html so blocking is minimized
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import StaffPanel from '../staff_panel/staff_panel.vue'
|
|||
import TermsOfServicePanel from '../terms_of_service_panel/terms_of_service_panel.vue'
|
||||
|
||||
import { useInstanceStore } from 'src/stores/instance.js'
|
||||
import { useMergedConfigStore } from 'src/stores/merged_config.js'
|
||||
import { useSyncConfigStore } from 'src/stores/sync_config.js'
|
||||
|
||||
const About = {
|
||||
components: {
|
||||
|
|
@ -22,7 +22,7 @@ const About = {
|
|||
showInstanceSpecificPanel() {
|
||||
return (
|
||||
useInstanceStore().instanceIdentity.showInstanceSpecificPanel &&
|
||||
!useMergedConfigStore().mergedConfig.hideISP &&
|
||||
!useSyncConfigStore().mergedConfig.hideISP &&
|
||||
useInstanceStore().instanceIdentity.instanceSpecificPanelContent
|
||||
)
|
||||
},
|
||||
|
|
|
|||
|
|
@ -7,8 +7,8 @@ import Popover from '../popover/popover.vue'
|
|||
import ProgressButton from '../progress_button/progress_button.vue'
|
||||
|
||||
import { useInstanceCapabilitiesStore } from 'src/stores/instance_capabilities.js'
|
||||
import { useMergedConfigStore } from 'src/stores/merged_config.js'
|
||||
import { useReportsStore } from 'src/stores/reports'
|
||||
import { useSyncConfigStore } from 'src/stores/sync_config.js'
|
||||
|
||||
import { library } from '@fortawesome/fontawesome-svg-core'
|
||||
import { faEllipsisV } from '@fortawesome/free-solid-svg-icons'
|
||||
|
|
@ -90,10 +90,10 @@ const AccountActions = {
|
|||
},
|
||||
computed: {
|
||||
shouldConfirmBlock() {
|
||||
return useMergedConfigStore().mergedConfig.modalOnBlock
|
||||
return useSyncConfigStore().mergedConfig.modalOnBlock
|
||||
},
|
||||
shouldConfirmRemoveUserFromFollowers() {
|
||||
return useMergedConfigStore().mergedConfig.modalOnRemoveUserFromFollowers
|
||||
return useSyncConfigStore().mergedConfig.modalOnRemoveUserFromFollowers
|
||||
},
|
||||
...mapState(useInstanceCapabilitiesStore, [
|
||||
'blockExpiration',
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import VideoAttachment from '../video_attachment/video_attachment.vue'
|
|||
import { useInstanceStore } from 'src/stores/instance.js'
|
||||
import { useInstanceCapabilitiesStore } from 'src/stores/instance_capabilities.js'
|
||||
import { useMediaViewerStore } from 'src/stores/media_viewer'
|
||||
import { useMergedConfigStore } from 'src/stores/merged_config.js'
|
||||
import { useSyncConfigStore } from 'src/stores/sync_config.js'
|
||||
|
||||
import { library } from '@fortawesome/fontawesome-svg-core'
|
||||
import {
|
||||
|
|
@ -58,8 +58,8 @@ const Attachment = {
|
|||
localDescription: this.description || this.attachment.description,
|
||||
nsfwImage:
|
||||
useInstanceStore().instanceIdentity.nsfwCensorImage || nsfwImage,
|
||||
hideNsfwLocal: useMergedConfigStore().mergedConfig.hideNsfw,
|
||||
preloadImage: useMergedConfigStore().mergedConfig.preloadImage,
|
||||
hideNsfwLocal: useSyncConfigStore().mergedConfig.hideNsfw,
|
||||
preloadImage: useSyncConfigStore().mergedConfig.preloadImage,
|
||||
loading: false,
|
||||
img: this.attachment.type === 'image' && document.createElement('img'),
|
||||
modalOpen: false,
|
||||
|
|
@ -91,7 +91,7 @@ const Attachment = {
|
|||
return this.size === 'hide'
|
||||
},
|
||||
useContainFit() {
|
||||
return this.mergedConfig.useContainFit
|
||||
return useSyncConfigStore().mergedConfig.useContainFit
|
||||
},
|
||||
placeholderName() {
|
||||
if (this.attachment.description === '' || !this.attachment.description) {
|
||||
|
|
@ -134,7 +134,7 @@ const Attachment = {
|
|||
videoTag() {
|
||||
return this.useModal ? 'button' : 'span'
|
||||
},
|
||||
...mapState(useMergedConfigStore, ['mergedConfig']),
|
||||
...mapState(useSyncConfigStore, ['mergedConfig']),
|
||||
},
|
||||
watch: {
|
||||
'attachment.description'(newVal) {
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ import UserAvatar from '../user_avatar/user_avatar.vue'
|
|||
|
||||
import { useInstanceStore } from 'src/stores/instance.js'
|
||||
import { useInterfaceStore } from 'src/stores/interface'
|
||||
import { useMergedConfigStore } from 'src/stores/merged_config.js'
|
||||
import { useSyncConfigStore } from 'src/stores/sync_config.js'
|
||||
|
||||
import { library } from '@fortawesome/fontawesome-svg-core'
|
||||
import { faEllipsisH, faTimes } from '@fortawesome/free-solid-svg-icons'
|
||||
|
|
@ -86,7 +86,7 @@ const ChatMessage = {
|
|||
return { left: 50 }
|
||||
}
|
||||
},
|
||||
...mapPiniaState(useMergedConfigStore, ['mergedConfig', 'findUser']),
|
||||
...mapPiniaState(useSyncConfigStore, ['mergedConfig', 'findUser']),
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import { mapState } from 'pinia'
|
|||
import Select from 'src/components/select/select.vue'
|
||||
import ConfirmModal from './confirm_modal.vue'
|
||||
|
||||
import { useMergedConfigStore } from 'src/stores/merged_config.js'
|
||||
import { useSyncConfigStore } from 'src/stores/sync_config.js'
|
||||
|
||||
export default {
|
||||
props: ['type', 'user', 'status'],
|
||||
|
|
@ -45,7 +45,7 @@ export default {
|
|||
}
|
||||
}
|
||||
},
|
||||
...mapState(useMergedConfigStore, ['mergedConfig']),
|
||||
...mapState(useSyncConfigStore, ['mergedConfig']),
|
||||
},
|
||||
methods: {
|
||||
optionallyPrompt() {
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ import Status from '../status/status.vue'
|
|||
import ThreadTree from '../thread_tree/thread_tree.vue'
|
||||
|
||||
import { useInterfaceStore } from 'src/stores/interface'
|
||||
import { useMergedConfigStore } from 'src/stores/merged_config.js'
|
||||
import { useSyncConfigStore } from 'src/stores/sync_config.js'
|
||||
|
||||
import { library } from '@fortawesome/fontawesome-svg-core'
|
||||
import {
|
||||
|
|
@ -82,7 +82,7 @@ const conversation = {
|
|||
// maxDepthInThread = max number of depths that is *visible*
|
||||
// since our depth starts with 0 and "showing" means "showing children"
|
||||
// there is a -2 here
|
||||
const maxDepth = this.mergedConfig.maxDepthInThread - 2
|
||||
const maxDepth = useSyncConfigStore().mergedConfig.maxDepthInThread - 2
|
||||
return maxDepth >= 1 ? maxDepth : 1
|
||||
},
|
||||
streamingEnabled() {
|
||||
|
|
@ -92,22 +92,22 @@ const conversation = {
|
|||
)
|
||||
},
|
||||
displayStyle() {
|
||||
return this.mergedConfig.conversationDisplay
|
||||
return useSyncConfigStore().mergedConfig.conversationDisplay
|
||||
},
|
||||
isTreeView() {
|
||||
return !this.isLinearView
|
||||
},
|
||||
treeViewIsSimple() {
|
||||
return !this.mergedConfig.conversationTreeAdvanced
|
||||
return !useSyncConfigStore().mergedConfig.conversationTreeAdvanced
|
||||
},
|
||||
isLinearView() {
|
||||
return this.displayStyle === 'linear'
|
||||
},
|
||||
shouldFadeAncestors() {
|
||||
return this.mergedConfig.conversationTreeFadeAncestors
|
||||
return useSyncConfigStore().mergedConfig.conversationTreeFadeAncestors
|
||||
},
|
||||
otherRepliesButtonPosition() {
|
||||
return this.mergedConfig.conversationOtherRepliesButton
|
||||
return useSyncConfigStore().mergedConfig.conversationOtherRepliesButton
|
||||
},
|
||||
showOtherRepliesButtonBelowStatus() {
|
||||
return this.otherRepliesButtonPosition === 'below'
|
||||
|
|
@ -393,7 +393,7 @@ const conversation = {
|
|||
maybeHighlight() {
|
||||
return this.isExpanded ? this.highlight : null
|
||||
},
|
||||
...mapPiniaState(useMergedConfigStore, ['mergedConfig']),
|
||||
...mapPiniaState(useSyncConfigStore, ['mergedConfig']),
|
||||
...mapState({
|
||||
mastoUserSocketStatus: (state) => state.api.mastoUserSocketStatus,
|
||||
}),
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import ConfirmModal from '../confirm_modal/confirm_modal.vue'
|
|||
|
||||
import { useInstanceStore } from 'src/stores/instance.js'
|
||||
import { useInterfaceStore } from 'src/stores/interface'
|
||||
import { useMergedConfigStore } from 'src/stores/merged_config.js'
|
||||
import { useSyncConfigStore } from 'src/stores/sync_config.js'
|
||||
|
||||
import { library } from '@fortawesome/fontawesome-svg-core'
|
||||
import {
|
||||
|
|
@ -97,7 +97,7 @@ export default {
|
|||
return this.$store.state.users.currentUser
|
||||
},
|
||||
shouldConfirmLogout() {
|
||||
return useMergedConfigStore().mergedConfig.modalOnLogout
|
||||
return useSyncConfigStore().mergedConfig.modalOnLogout
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { useMergedConfigStore } from 'src/stores/merged_config.js'
|
||||
import { useSyncConfigStore } from 'src/stores/sync_config.js'
|
||||
|
||||
const DialogModal = {
|
||||
props: {
|
||||
|
|
@ -15,7 +15,7 @@ const DialogModal = {
|
|||
},
|
||||
computed: {
|
||||
mobileCenter() {
|
||||
return useMergedConfigStore().mergedConfig.modalMobileCenter
|
||||
return useSyncConfigStore().mergedConfig.modalMobileCenter
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ import Gallery from 'src/components/gallery/gallery.vue'
|
|||
import PostStatusForm from 'src/components/post_status_form/post_status_form.vue'
|
||||
import StatusContent from 'src/components/status_content/status_content.vue'
|
||||
|
||||
import { useMergedConfigStore } from 'src/stores/merged_config.js'
|
||||
import { useSyncConfigStore } from 'src/stores/sync_config.js'
|
||||
|
||||
import { library } from '@fortawesome/fontawesome-svg-core'
|
||||
import { faPollH } from '@fortawesome/free-solid-svg-icons'
|
||||
|
|
@ -59,7 +59,7 @@ const Draft = {
|
|||
: undefined
|
||||
},
|
||||
localCollapseSubjectDefault() {
|
||||
return useMergedConfigStore().mergedConfig.collapseMessageWithSubject
|
||||
return useSyncConfigStore().mergedConfig.collapseMessageWithSubject
|
||||
},
|
||||
nsfwClickthrough() {
|
||||
if (!this.draft.nsfw) {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import DialogModal from 'src/components/dialog_modal/dialog_modal.vue'
|
||||
|
||||
import { useMergedConfigStore } from 'src/stores/merged_config.js'
|
||||
import { useSyncConfigStore } from 'src/stores/sync_config.js'
|
||||
|
||||
const DraftCloser = {
|
||||
data() {
|
||||
|
|
@ -14,10 +14,10 @@ const DraftCloser = {
|
|||
emits: ['save', 'discard'],
|
||||
computed: {
|
||||
action() {
|
||||
if (useMergedConfigStore().mergedConfig.autoSaveDraft) {
|
||||
if (useSyncConfigStore().mergedConfig.autoSaveDraft) {
|
||||
return 'save'
|
||||
} else {
|
||||
return useMergedConfigStore().mergedConfig.unsavedPostAction
|
||||
return useSyncConfigStore().mergedConfig.unsavedPostAction
|
||||
}
|
||||
},
|
||||
shouldConfirm() {
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ import genRandomSeed from '../../services/random_seed/random_seed.service.js'
|
|||
import EmojiPicker from '../emoji_picker/emoji_picker.vue'
|
||||
import UnicodeDomainIndicator from '../unicode_domain_indicator/unicode_domain_indicator.vue'
|
||||
|
||||
import { useMergedConfigStore } from 'src/stores/merged_config.js'
|
||||
import { useSyncConfigStore } from 'src/stores/sync_config.js'
|
||||
|
||||
import { library } from '@fortawesome/fontawesome-svg-core'
|
||||
import { faSmileBeam } from '@fortawesome/free-regular-svg-icons'
|
||||
|
|
@ -133,10 +133,10 @@ const EmojiInput = {
|
|||
},
|
||||
computed: {
|
||||
padEmoji() {
|
||||
return useMergedConfigStore().mergedConfig.padEmoji
|
||||
return useSyncConfigStore().mergedConfig.padEmoji
|
||||
},
|
||||
defaultCandidateIndex() {
|
||||
return useMergedConfigStore().mergedConfig.autocompleteSelect ? 0 : -1
|
||||
return useSyncConfigStore().mergedConfig.autocompleteSelect ? 0 : -1
|
||||
},
|
||||
preText() {
|
||||
return this.modelValue.slice(0, this.caret)
|
||||
|
|
@ -165,7 +165,7 @@ const EmojiInput = {
|
|||
},
|
||||
languages() {
|
||||
return ensureFinalFallback(
|
||||
useMergedConfigStore().mergedConfig.interfaceLanguage,
|
||||
useSyncConfigStore().mergedConfig.interfaceLanguage,
|
||||
)
|
||||
},
|
||||
maybeLocalizedEmojiNamesAndKeywords() {
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import StillImage from '../still-image/still-image.vue'
|
|||
|
||||
import { useEmojiStore } from 'src/stores/emoji.js'
|
||||
import { useInstanceStore } from 'src/stores/instance.js'
|
||||
import { useMergedConfigStore } from 'src/stores/merged_config.js'
|
||||
import { useSyncConfigStore } from 'src/stores/sync_config.js'
|
||||
|
||||
import { library } from '@fortawesome/fontawesome-svg-core'
|
||||
import {
|
||||
|
|
@ -341,7 +341,7 @@ const EmojiPicker = {
|
|||
this.$nextTick(() => {
|
||||
this.updateEmojiSize()
|
||||
})
|
||||
return useMergedConfigStore().mergedConfig.fontSize
|
||||
return useSyncConfigStore().mergedConfig.fontSize
|
||||
},
|
||||
emojiHeight() {
|
||||
return this.emojiSize
|
||||
|
|
@ -406,7 +406,7 @@ const EmojiPicker = {
|
|||
},
|
||||
languages() {
|
||||
return ensureFinalFallback(
|
||||
useMergedConfigStore().mergedConfig.interfaceLanguage,
|
||||
useSyncConfigStore().mergedConfig.interfaceLanguage,
|
||||
)
|
||||
},
|
||||
maybeLocalizedEmojiName() {
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import { mapGetters } from 'vuex'
|
|||
|
||||
import { useAnnouncementsStore } from 'src/stores/announcements.js'
|
||||
import { useInterfaceStore } from 'src/stores/interface.js'
|
||||
import { useMergedConfigStore } from 'src/stores/merged_config.js'
|
||||
import { useSyncConfigStore } from 'src/stores/sync_config.js'
|
||||
|
||||
import { library } from '@fortawesome/fontawesome-svg-core'
|
||||
import {
|
||||
|
|
@ -52,11 +52,10 @@ const ExtraNotifications = {
|
|||
currentUser() {
|
||||
return this.$store.state.users.currentUser
|
||||
},
|
||||
...mapGetters(['unreadChatCount', 'followRequestCount']),
|
||||
...mapGetters(['unreadChatCount', 'followRequestCount', 'mergedConfig']),
|
||||
...mapPiniaState(useAnnouncementsStore, {
|
||||
unreadAnnouncementCount: 'unreadAnnouncementCount',
|
||||
}),
|
||||
...mapPiniaState(useMergedConfigStore, ['mergedConfig']),
|
||||
},
|
||||
methods: {
|
||||
openNotificationSettings() {
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ const FeaturesPanel = {
|
|||
'mediaProxyAvailable',
|
||||
]),
|
||||
...mapState(useInstanceStore, {
|
||||
textLimit: (store) => store.limits.textLimit,
|
||||
textlimit: (store) => store.limits.textlimit,
|
||||
uploadlimit: (store) =>
|
||||
fileSizeFormatService.fileSizeFormat(store.limits.uploadlimit),
|
||||
}),
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
{{ $t('features_panel.media_proxy') }}
|
||||
</li>
|
||||
<li>{{ $t('features_panel.scope_options') }}</li>
|
||||
<li>{{ $t('features_panel.text_limit') }} = {{ textLimit }}</li>
|
||||
<li>{{ $t('features_panel.text_limit') }} = {{ textlimit }}</li>
|
||||
<li>{{ $t('features_panel.upload_limit') }} = {{ uploadlimit.num }} {{ $t('upload.file_size_units.' + uploadlimit.unit) }}</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import {
|
|||
} from '../../services/follow_manipulate/follow_manipulate'
|
||||
import ConfirmModal from '../confirm_modal/confirm_modal.vue'
|
||||
|
||||
import { useMergedConfigStore } from 'src/stores/merged_config.js'
|
||||
import { useSyncConfigStore } from 'src/stores/sync_config.js'
|
||||
export default {
|
||||
props: ['relationship', 'user', 'labelFollowing', 'buttonClass'],
|
||||
components: {
|
||||
|
|
@ -18,7 +18,7 @@ export default {
|
|||
},
|
||||
computed: {
|
||||
shouldConfirmUnfollow() {
|
||||
return useMergedConfigStore().mergedConfig.modalOnUnfollow
|
||||
return useSyncConfigStore().mergedConfig.modalOnUnfollow
|
||||
},
|
||||
isPressed() {
|
||||
return this.inProgress || this.relationship.following
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import { notificationsFromStore } from '../../services/notification_utils/notifi
|
|||
import BasicUserCard from '../basic_user_card/basic_user_card.vue'
|
||||
import ConfirmModal from '../confirm_modal/confirm_modal.vue'
|
||||
|
||||
import { useMergedConfigStore } from 'src/stores/merged_config.js'
|
||||
import { useSyncConfigStore } from 'src/stores/sync_config.js'
|
||||
|
||||
const FollowRequestCard = {
|
||||
props: ['user'],
|
||||
|
|
@ -78,7 +78,7 @@ const FollowRequestCard = {
|
|||
},
|
||||
computed: {
|
||||
mergedConfig() {
|
||||
return useMergedConfigStore().mergedConfig
|
||||
return useSyncConfigStore().mergedConfig
|
||||
},
|
||||
shouldConfirmApprove() {
|
||||
return this.mergedConfig.modalOnApproveFollow
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { mapState } from 'pinia'
|
||||
|
||||
import { useMergedConfigStore } from 'src/stores/merged_config.js'
|
||||
import { useSyncConfigStore } from 'src/stores/sync_config.js'
|
||||
|
||||
const LinkPreview = {
|
||||
name: 'LinkPreview',
|
||||
|
|
@ -26,7 +26,7 @@ const LinkPreview = {
|
|||
hideNsfwConfig() {
|
||||
return this.mergedConfig.hideNsfw
|
||||
},
|
||||
...mapState(useMergedConfigStore, ['mergedConfig']),
|
||||
...mapState(useSyncConfigStore, ['mergedConfig']),
|
||||
},
|
||||
created() {
|
||||
if (this.useImage) {
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import fileSizeFormatService from '../../services/file_size_format/file_size_for
|
|||
import statusPosterService from '../../services/status_poster/status_poster.service.js'
|
||||
|
||||
import { useInstanceStore } from 'src/stores/instance.js'
|
||||
import { useMergedConfigStore } from 'src/stores/merged_config.js'
|
||||
import { useSyncConfigStore } from 'src/stores/sync_config.js'
|
||||
|
||||
import { library } from '@fortawesome/fontawesome-svg-core'
|
||||
import { faCircleNotch, faUpload } from '@fortawesome/free-solid-svg-icons'
|
||||
|
|
@ -34,7 +34,7 @@ const mediaUpload = {
|
|||
}
|
||||
|
||||
// Skip if image compression is disabled
|
||||
if (!useMergedConfigStore().mergedConfig.imageCompression) {
|
||||
if (!useSyncConfigStore().mergedConfig.imageCompression) {
|
||||
return file
|
||||
}
|
||||
|
||||
|
|
@ -79,7 +79,7 @@ const mediaUpload = {
|
|||
|
||||
// Convert to WebP if supported and alwaysUseJpeg is false, otherwise JPEG
|
||||
const type =
|
||||
!useMergedConfigStore().mergedConfig.alwaysUseJpeg && supportsWebP
|
||||
!useSyncConfigStore().mergedConfig.alwaysUseJpeg && supportsWebP
|
||||
? 'image/webp'
|
||||
: 'image/jpeg'
|
||||
const extension = type === 'image/webp' ? '.webp' : '.jpg'
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ import {
|
|||
import UnicodeDomainIndicator from '../unicode_domain_indicator/unicode_domain_indicator.vue'
|
||||
import UserAvatar from '../user_avatar/user_avatar.vue'
|
||||
|
||||
import { useMergedConfigStore } from 'src/stores/merged_config.js'
|
||||
import { useSyncConfigStore } from 'src/stores/sync_config.js'
|
||||
import { useUserHighlightStore } from 'src/stores/user_highlight.js'
|
||||
|
||||
import generateProfileLink from 'src/services/user_profile_link_generator/user_profile_link_generator'
|
||||
|
|
@ -160,7 +160,7 @@ const MentionLink = {
|
|||
shouldFadeDomain() {
|
||||
return this.mergedConfig.mentionLinkFadeDomain
|
||||
},
|
||||
...mapPiniaState(useMergedConfigStore, ['mergedConfig']),
|
||||
...mapPiniaState(useSyncConfigStore, ['mergedConfig']),
|
||||
...mapPiniaState(useUserHighlightStore, ['highlight']),
|
||||
...mapState({
|
||||
currentUser: (state) => state.users.currentUser,
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import { mapState } from 'pinia'
|
|||
|
||||
import MentionLink from 'src/components/mention_link/mention_link.vue'
|
||||
|
||||
import { useMergedConfigStore } from 'src/stores/merged_config.js'
|
||||
import { useSyncConfigStore } from 'src/stores/sync_config.js'
|
||||
|
||||
export const MENTIONS_LIMIT = 5
|
||||
|
||||
|
|
@ -28,7 +28,7 @@ const MentionsLine = {
|
|||
manyMentions() {
|
||||
return this.extraMentions.length > 0
|
||||
},
|
||||
...mapState(useMergedConfigStore, ['mergedConfig']),
|
||||
...mapState(useSyncConfigStore, ['mergedConfig']),
|
||||
},
|
||||
methods: {
|
||||
toggleShowMore() {
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ import SideDrawer from '../side_drawer/side_drawer.vue'
|
|||
|
||||
import { useAnnouncementsStore } from 'src/stores/announcements.js'
|
||||
import { useInstanceStore } from 'src/stores/instance.js'
|
||||
import { useMergedConfigStore } from 'src/stores/merged_config.js'
|
||||
import { useSyncConfigStore } from 'src/stores/sync_config.js'
|
||||
|
||||
import { library } from '@fortawesome/fontawesome-svg-core'
|
||||
import {
|
||||
|
|
@ -54,17 +54,14 @@ const MobileNav = {
|
|||
unseenNotifications() {
|
||||
return unseenNotificationsFromStore(
|
||||
this.$store,
|
||||
useMergedConfigStore().mergedConfig.notificationVisibility,
|
||||
useMergedConfigStore().mergedConfig.ignoreInactionableSeen,
|
||||
useSyncConfigStore().mergedConfig.notificationVisibility,
|
||||
useSyncConfigStore().mergedConfig.ignoreInactionableSeen,
|
||||
)
|
||||
},
|
||||
unseenNotificationsCount() {
|
||||
return (
|
||||
this.unseenNotifications.length +
|
||||
countExtraNotifications(
|
||||
this.$store,
|
||||
useMergedConfigStore().mergedConfig,
|
||||
)
|
||||
countExtraNotifications(this.$store, useSyncConfigStore().mergedConfig)
|
||||
)
|
||||
},
|
||||
unseenCount() {
|
||||
|
|
@ -83,15 +80,15 @@ const MobileNav = {
|
|||
return this.$route.name === 'chat'
|
||||
},
|
||||
...mapState(useAnnouncementsStore, ['unreadAnnouncementCount']),
|
||||
...mapState(useMergedConfigStore, {
|
||||
...mapState(useSyncConfigStore, {
|
||||
pinnedItems: (store) =>
|
||||
new Set(store.prefsStorage.collections.pinnedNavItems).has('chats'),
|
||||
}),
|
||||
shouldConfirmLogout() {
|
||||
return useMergedConfigStore().mergedConfig.modalOnLogout
|
||||
return useSyncConfigStore().mergedConfig.modalOnLogout
|
||||
},
|
||||
closingDrawerMarksAsSeen() {
|
||||
return useMergedConfigStore().mergedConfig.closingDrawerMarksAsSeen
|
||||
return useSyncConfigStore().mergedConfig.closingDrawerMarksAsSeen
|
||||
},
|
||||
...mapGetters(['unreadChatCount']),
|
||||
},
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { debounce } from 'lodash'
|
||||
|
||||
import { useMergedConfigStore } from 'src/stores/merged_config.js'
|
||||
import { usePostStatusStore } from 'src/stores/post_status.js'
|
||||
import { useSyncConfigStore } from 'src/stores/sync_config.js'
|
||||
|
||||
import { library } from '@fortawesome/fontawesome-svg-core'
|
||||
import { faPen } from '@fortawesome/free-solid-svg-icons'
|
||||
|
|
@ -46,10 +46,10 @@ const MobilePostStatusButton = {
|
|||
)
|
||||
},
|
||||
isPersistent() {
|
||||
return !!useMergedConfigStore().mergedConfig.alwaysShowNewPostButton
|
||||
return !!useSyncConfigStore().mergedConfig.alwaysShowNewPostButton
|
||||
},
|
||||
autohideFloatingPostButton() {
|
||||
return !!useMergedConfigStore().mergedConfig.autohideFloatingPostButton
|
||||
return !!useSyncConfigStore().mergedConfig.autohideFloatingPostButton
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ import UserLink from '../user_link/user_link.vue'
|
|||
import UserPopover from '../user_popover/user_popover.vue'
|
||||
|
||||
import { useInstanceStore } from 'src/stores/instance.js'
|
||||
import { useMergedConfigStore } from 'src/stores/merged_config.js'
|
||||
import { useSyncConfigStore } from 'src/stores/sync_config.js'
|
||||
import { useUserHighlightStore } from 'src/stores/user_highlight.js'
|
||||
|
||||
import generateProfileLink from 'src/services/user_profile_link_generator/user_profile_link_generator'
|
||||
|
|
@ -210,7 +210,7 @@ const Notification = {
|
|||
return isStatusNotification(this.notification.type)
|
||||
},
|
||||
mergedConfig() {
|
||||
return useMergedConfigStore().mergedConfig
|
||||
return useSyncConfigStore().mergedConfig
|
||||
},
|
||||
shouldConfirmApprove() {
|
||||
return this.mergedConfig.modalOnApproveFollow
|
||||
|
|
|
|||
|
|
@ -108,7 +108,6 @@
|
|||
<script>
|
||||
import Popover from '../popover/popover.vue'
|
||||
|
||||
import { useMergedConfigStore } from 'src/stores/merged_config.js'
|
||||
import { useSyncConfigStore } from 'src/stores/sync_config.js'
|
||||
|
||||
import { library } from '@fortawesome/fontawesome-svg-core'
|
||||
|
|
@ -120,7 +119,7 @@ export default {
|
|||
components: { Popover },
|
||||
computed: {
|
||||
filters() {
|
||||
return useMergedConfigStore().mergedConfig.notificationVisibility
|
||||
return useSyncConfigStore().mergedConfig.notificationVisibility
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ import NotificationFilters from './notification_filters.vue'
|
|||
|
||||
import { useAnnouncementsStore } from 'src/stores/announcements.js'
|
||||
import { useInterfaceStore } from 'src/stores/interface.js'
|
||||
import { useMergedConfigStore } from 'src/stores/merged_config.js'
|
||||
import { useSyncConfigStore } from 'src/stores/sync_config.js'
|
||||
|
||||
import { library } from '@fortawesome/fontawesome-svg-core'
|
||||
import {
|
||||
|
|
@ -78,7 +78,7 @@ const Notifications = {
|
|||
unseenNotifications() {
|
||||
return unseenNotificationsFromStore(
|
||||
this.$store,
|
||||
useMergedConfigStore().mergedConfig.notificationVisibility,
|
||||
useSyncConfigStore().mergedConfig.notificationVisibility,
|
||||
)
|
||||
},
|
||||
filteredNotifications() {
|
||||
|
|
@ -86,17 +86,17 @@ const Notifications = {
|
|||
return [
|
||||
...filteredNotificationsFromStore(
|
||||
this.$store,
|
||||
useMergedConfigStore().mergedConfig.notificationVisibility,
|
||||
useSyncConfigStore().mergedConfig.notificationVisibility,
|
||||
).filter((n) => this.shouldShowUnseen(n)),
|
||||
...filteredNotificationsFromStore(
|
||||
this.$store,
|
||||
useMergedConfigStore().mergedConfig.notificationVisibility,
|
||||
useSyncConfigStore().mergedConfig.notificationVisibility,
|
||||
).filter((n) => !this.shouldShowUnseen(n)),
|
||||
]
|
||||
} else {
|
||||
return filteredNotificationsFromStore(
|
||||
this.$store,
|
||||
useMergedConfigStore().mergedConfig.notificationVisibility,
|
||||
useSyncConfigStore().mergedConfig.notificationVisibility,
|
||||
this.filterMode,
|
||||
)
|
||||
}
|
||||
|
|
@ -108,12 +108,12 @@ const Notifications = {
|
|||
return this.unseenNotifications.length
|
||||
},
|
||||
ignoreInactionableSeen() {
|
||||
return useMergedConfigStore().mergedConfig.ignoreInactionableSeen
|
||||
return useSyncConfigStore().mergedConfig.ignoreInactionableSeen
|
||||
},
|
||||
extraNotificationsCount() {
|
||||
return countExtraNotifications(
|
||||
this.$store,
|
||||
useMergedConfigStore().mergedConfig,
|
||||
useSyncConfigStore().mergedConfig,
|
||||
)
|
||||
},
|
||||
unseenCountTitle() {
|
||||
|
|
@ -149,10 +149,10 @@ const Notifications = {
|
|||
)
|
||||
},
|
||||
noSticky() {
|
||||
return useMergedConfigStore().mergedConfig.disableStickyHeaders
|
||||
return useSyncConfigStore().mergedConfig.disableStickyHeaders
|
||||
},
|
||||
unseenAtTop() {
|
||||
return useMergedConfigStore().mergedConfig.unseenAtTop
|
||||
return useSyncConfigStore().mergedConfig.unseenAtTop
|
||||
},
|
||||
showExtraNotifications() {
|
||||
return !this.noExtra
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@ import Timeago from 'components/timeago/timeago.vue'
|
|||
|
||||
import genRandomSeed from '../../services/random_seed/random_seed.service.js'
|
||||
|
||||
import { useMergedConfigStore } from 'src/stores/merged_config.js'
|
||||
import { usePollsStore } from 'src/stores/polls.js'
|
||||
import { useSyncConfigStore } from 'src/stores/sync_config.js'
|
||||
|
||||
export default {
|
||||
name: 'Poll',
|
||||
|
|
@ -49,7 +49,7 @@ export default {
|
|||
return (this.poll && this.poll.expired) || false
|
||||
},
|
||||
expirationLabel() {
|
||||
if (useMergedConfigStore().mergedConfig.useAbsoluteTimeFormat) {
|
||||
if (useSyncConfigStore().mergedConfig.useAbsoluteTimeFormat) {
|
||||
return this.expired ? 'polls.expired_at' : 'polls.expires_at'
|
||||
} else {
|
||||
return this.expired ? 'polls.expired' : 'polls.expires_in'
|
||||
|
|
|
|||
|
|
@ -24,7 +24,6 @@ import { useInstanceStore } from 'src/stores/instance.js'
|
|||
import { useInstanceCapabilitiesStore } from 'src/stores/instance_capabilities.js'
|
||||
import { useInterfaceStore } from 'src/stores/interface.js'
|
||||
import { useMediaViewerStore } from 'src/stores/media_viewer.js'
|
||||
import { useMergedConfigStore } from 'src/stores/merged_config.js'
|
||||
import { useSyncConfigStore } from 'src/stores/sync_config.js'
|
||||
|
||||
import { pollFormToMasto } from 'src/services/poll/poll.service.js'
|
||||
|
|
@ -164,7 +163,7 @@ const PostStatusForm = {
|
|||
const preset = this.$route.query.message
|
||||
let statusText = preset || ''
|
||||
|
||||
const { scopeCopy } = useMergedConfigStore().mergedConfig
|
||||
const { scopeCopy } = useSyncConfigStore().mergedConfig
|
||||
|
||||
const [statusType, refId] = typeAndRefId({
|
||||
replyTo: this.replyTo,
|
||||
|
|
@ -194,7 +193,7 @@ const PostStatusForm = {
|
|||
: this.$store.state.users.currentUser.default_scope
|
||||
|
||||
const { postContentType: contentType, sensitiveByDefault } =
|
||||
useMergedConfigStore().mergedConfig
|
||||
useSyncConfigStore().mergedConfig
|
||||
|
||||
statusParams = {
|
||||
type: statusType,
|
||||
|
|
@ -291,7 +290,7 @@ const PostStatusForm = {
|
|||
return this.newStatus.spoilerText.length
|
||||
},
|
||||
statusLengthLimit() {
|
||||
return useInstanceStore().limits.textLimit
|
||||
return useInstanceStore().textlimit
|
||||
},
|
||||
hasStatusLengthLimit() {
|
||||
return this.statusLengthLimit > 0
|
||||
|
|
@ -325,7 +324,7 @@ const PostStatusForm = {
|
|||
},
|
||||
hideScopeNotice() {
|
||||
return (
|
||||
this.disableNotice || useMergedConfigStore().mergedConfig.hideScopeNotice
|
||||
this.disableNotice || useSyncConfigStore().mergedConfig.hideScopeNotice
|
||||
)
|
||||
},
|
||||
pollContentError() {
|
||||
|
|
@ -381,7 +380,7 @@ const PostStatusForm = {
|
|||
return this.newStatus.hasPoll
|
||||
},
|
||||
shouldAutoSaveDraft() {
|
||||
return useMergedConfigStore().mergedConfig.autoSaveDraft
|
||||
return useSyncConfigStore().mergedConfig.autoSaveDraft
|
||||
},
|
||||
autoSaveState() {
|
||||
if (this.saveable) {
|
||||
|
|
@ -412,7 +411,7 @@ const PostStatusForm = {
|
|||
)
|
||||
)
|
||||
},
|
||||
...mapState(useMergedConfigStore, ['mergedConfig']),
|
||||
...mapState(useSyncConfigStore, ['mergedConfig']),
|
||||
...mapState(useInterfaceStore, {
|
||||
mobileLayout: (store) => store.mobileLayout,
|
||||
}),
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ import Popover from '../popover/popover.vue'
|
|||
|
||||
import { useInterfaceStore } from 'src/stores/interface.js'
|
||||
import { useLocalConfigStore } from 'src/stores/local_config.js'
|
||||
import { useMergedConfigStore } from 'src/stores/merged_config.js'
|
||||
import { useSyncConfigStore } from 'src/stores/sync_config.js'
|
||||
|
||||
import { library } from '@fortawesome/fontawesome-svg-core'
|
||||
|
|
@ -33,7 +32,7 @@ const QuickFilterSettings = {
|
|||
},
|
||||
},
|
||||
computed: {
|
||||
...mapState(useMergedConfigStore, ['mergedConfig']),
|
||||
...mapState(useSyncConfigStore, ['mergedConfig']),
|
||||
...mapState(useInterfaceStore, {
|
||||
mobileLayout: (state) => state.layoutType === 'mobile',
|
||||
}),
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ import Popover from 'src/components/popover/popover.vue'
|
|||
import QuickFilterSettings from 'src/components/quick_filter_settings/quick_filter_settings.vue'
|
||||
|
||||
import { useInterfaceStore } from 'src/stores/interface.js'
|
||||
import { useMergedConfigStore } from 'src/stores/merged_config.js'
|
||||
import { useSyncConfigStore } from 'src/stores/sync_config.js'
|
||||
|
||||
import { library } from '@fortawesome/fontawesome-svg-core'
|
||||
|
|
@ -31,7 +30,7 @@ const QuickViewSettings = {
|
|||
},
|
||||
},
|
||||
computed: {
|
||||
...mapState(useMergedConfigStore, ['mergedConfig']),
|
||||
...mapState(useSyncConfigStore, ['mergedConfig']),
|
||||
...mapState(useInterfaceStore, {
|
||||
mobileLayout: (state) => state.layoutType === 'mobile',
|
||||
}),
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import ConfirmModal from '../confirm_modal/confirm_modal.vue'
|
||||
|
||||
import { useMergedConfigStore } from 'src/stores/merged_config.js'
|
||||
import { useSyncConfigStore } from 'src/stores/sync_config.js'
|
||||
|
||||
export default {
|
||||
props: ['user', 'relationship'],
|
||||
|
|
@ -22,7 +22,7 @@ export default {
|
|||
}
|
||||
},
|
||||
shouldConfirmRemoveUserFromFollowers() {
|
||||
return useMergedConfigStore().mergedConfig.modalOnRemoveUserFromFollowers
|
||||
return useSyncConfigStore().mergedConfig.modalOnRemoveUserFromFollowers
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import Checkbox from 'src/components/checkbox/checkbox.vue'
|
||||
import Setting from './setting.js'
|
||||
|
||||
import { useMergedConfigStore } from 'src/stores/merged_config.js'
|
||||
import { useSyncConfigStore } from 'src/stores/sync_config.js'
|
||||
|
||||
export default {
|
||||
...Setting,
|
||||
|
|
@ -45,7 +45,7 @@ export default {
|
|||
if (this.forceNew) return true
|
||||
if (!this.allowNew) return false
|
||||
|
||||
const isExpert = useMergedConfigStore().mergedConfig.expertLevel > 0
|
||||
const isExpert = useSyncConfigStore().mergedConfig.expertLevel > 0
|
||||
const hasBuiltins = this.builtinEntries.length > 0
|
||||
|
||||
if (hasBuiltins) {
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ import ModifiedIndicator from './modified_indicator.vue'
|
|||
import { useInstanceStore } from 'src/stores/instance.js'
|
||||
import { useInterfaceStore } from 'src/stores/interface.js'
|
||||
import { useLocalConfigStore } from 'src/stores/local_config.js'
|
||||
import { useMergedConfigStore } from 'src/stores/merged_config.js'
|
||||
import { useSyncConfigStore } from 'src/stores/sync_config.js'
|
||||
|
||||
export default {
|
||||
|
|
@ -245,7 +244,7 @@ export default {
|
|||
case 'admin':
|
||||
return this.$store.state.adminSettings.config
|
||||
default:
|
||||
return useMergedConfigStore().mergedConfig
|
||||
return useSyncConfigStore().mergedConfig
|
||||
}
|
||||
},
|
||||
configSink() {
|
||||
|
|
@ -324,7 +323,7 @@ export default {
|
|||
case 'profile':
|
||||
return {}
|
||||
default: {
|
||||
return get(useMergedConfigStore().mergedConfigDefault, this.path)
|
||||
return get(useSyncConfigStore().mergedConfigDefault, this.path)
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
@ -380,7 +379,7 @@ export default {
|
|||
matchesExpertLevel() {
|
||||
const settingExpertLevel = this.expert || 0
|
||||
const userToggleExpert =
|
||||
useMergedConfigStore().mergedConfig.expertLevel || 0
|
||||
useSyncConfigStore().mergedConfig.expertLevel || 0
|
||||
|
||||
return settingExpertLevel <= userToggleExpert
|
||||
},
|
||||
|
|
@ -406,7 +405,7 @@ export default {
|
|||
this.draft = cloneDeep(this.state)
|
||||
} else {
|
||||
set(
|
||||
useMergedConfigStore().mergedConfig,
|
||||
useSyncConfigStore().mergedConfig,
|
||||
this.path,
|
||||
cloneDeep(this.defaultState),
|
||||
)
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
import { mapState as mapPiniaState } from 'pinia'
|
||||
import { mapState } from 'vuex'
|
||||
|
||||
import { useMergedConfigStore } from 'src/stores/merged_config.js'
|
||||
import { useSyncConfigStore } from 'src/stores/sync_config.js'
|
||||
|
||||
const SharedComputedObject = () => ({
|
||||
...mapPiniaState(useMergedConfigStore, ['mergedConfig']),
|
||||
...mapPiniaState(useMergedConfigStore, {
|
||||
...mapPiniaState(useSyncConfigStore, ['mergedConfig']),
|
||||
...mapPiniaState(useSyncConfigStore, {
|
||||
expertLevel: (store) => store.mergedConfig.expertLevel,
|
||||
}),
|
||||
...mapState({
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ import SecurityTab from './tabs/security_tab/security_tab.vue'
|
|||
import StyleTab from './tabs/style_tab/style_tab.vue'
|
||||
|
||||
import { useInterfaceStore } from 'src/stores/interface.js'
|
||||
import { useMergedConfigStore } from 'src/stores/merged_config.js'
|
||||
import { useSyncConfigStore } from 'src/stores/sync_config.js'
|
||||
|
||||
import { library } from '@fortawesome/fontawesome-svg-core'
|
||||
import {
|
||||
|
|
@ -84,7 +84,7 @@ const SettingsModalContent = {
|
|||
return useInterfaceStore().settingsModalState === 'visible'
|
||||
},
|
||||
expertLevel() {
|
||||
return useMergedConfigStore().mergedConfig.expertLevel
|
||||
return useSyncConfigStore().mergedConfig.expertLevel
|
||||
},
|
||||
},
|
||||
data() {
|
||||
|
|
|
|||
|
|
@ -13,7 +13,6 @@ import UnitSetting from '../helpers/unit_setting.vue'
|
|||
|
||||
import { useInstanceStore } from 'src/stores/instance.js'
|
||||
import { useInstanceCapabilitiesStore } from 'src/stores/instance_capabilities.js'
|
||||
import { useMergedConfigStore } from 'src/stores/merged_config.js'
|
||||
import { useSyncConfigStore } from 'src/stores/sync_config.js'
|
||||
|
||||
import localeService from 'src/services/locale/locale.service.js'
|
||||
|
|
@ -117,7 +116,7 @@ const ComposingTab = {
|
|||
},
|
||||
language: {
|
||||
get: function () {
|
||||
return useMergedConfigStore().mergedConfig.interfaceLanguage
|
||||
return useSyncConfigStore().mergedConfig.interfaceLanguage
|
||||
},
|
||||
set: function (val) {
|
||||
useSyncConfigStore().setSimplePrefAndSave({
|
||||
|
|
|
|||
|
|
@ -13,7 +13,6 @@ import UnitSetting from '../helpers/unit_setting.vue'
|
|||
|
||||
import { useInstanceCapabilitiesStore } from 'src/stores/instance_capabilities.js'
|
||||
import { useInterfaceStore } from 'src/stores/interface'
|
||||
import { useMergedConfigStore } from 'src/stores/merged_config.js'
|
||||
import { useSyncConfigStore } from 'src/stores/sync_config.js'
|
||||
|
||||
import {
|
||||
|
|
@ -37,7 +36,7 @@ const FilteringTab = {
|
|||
label: this.$t(`user_card.mute_block_${mode}`),
|
||||
})),
|
||||
muteFiltersDraftObject: cloneDeep(
|
||||
useMergedConfigStore().mergedConfig.muteFilters,
|
||||
useSyncConfigStore().mergedConfig.muteFilters,
|
||||
),
|
||||
muteFiltersDraftDirty: Object.fromEntries(
|
||||
Object.entries(
|
||||
|
|
@ -101,7 +100,7 @@ const FilteringTab = {
|
|||
...mapState(useInstanceCapabilitiesStore, ['blockExpiration']),
|
||||
onMuteDefaultActionLv1: {
|
||||
get() {
|
||||
const value = useMergedConfigStore().mergedConfig.onMuteDefaultAction
|
||||
const value = useSyncConfigStore().mergedConfig.onMuteDefaultAction
|
||||
if (value === 'ask' || value === 'forever') {
|
||||
return value
|
||||
} else {
|
||||
|
|
@ -121,7 +120,7 @@ const FilteringTab = {
|
|||
},
|
||||
onBlockDefaultActionLv1: {
|
||||
get() {
|
||||
const value = useMergedConfigStore().mergedConfig.onBlockDefaultAction
|
||||
const value = useSyncConfigStore().mergedConfig.onBlockDefaultAction
|
||||
if (value === 'ask' || value === 'forever') {
|
||||
return value
|
||||
} else {
|
||||
|
|
@ -264,7 +263,7 @@ const FilteringTab = {
|
|||
},
|
||||
muteFiltersObject() {
|
||||
this.muteFiltersDraftObject = cloneDeep(
|
||||
useMergedConfigStore().mergedConfig.muteFilters,
|
||||
useSyncConfigStore().mergedConfig.muteFilters,
|
||||
)
|
||||
},
|
||||
},
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@ import UnitSetting from '../helpers/unit_setting.vue'
|
|||
import { useInstanceStore } from 'src/stores/instance.js'
|
||||
import { useInstanceCapabilitiesStore } from 'src/stores/instance_capabilities.js'
|
||||
import { useLocalConfigStore } from 'src/stores/local_config.js'
|
||||
import { useMergedConfigStore } from 'src/stores/merged_config.js'
|
||||
import { useSyncConfigStore } from 'src/stores/sync_config.js'
|
||||
|
||||
import localeService from 'src/services/locale/locale.service.js'
|
||||
|
|
@ -38,7 +37,7 @@ const GeneralTab = {
|
|||
computed: {
|
||||
language: {
|
||||
get: function () {
|
||||
return useMergedConfigStore().mergedConfig.interfaceLanguage
|
||||
return useSyncConfigStore().mergedConfig.interfaceLanguage
|
||||
},
|
||||
set: function (val) {
|
||||
useSyncConfigStore().setSimplePrefAndSave({
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ import SharedComputedObject from '../helpers/shared_computed_object.js'
|
|||
import UnitSetting from '../helpers/unit_setting.vue'
|
||||
|
||||
import { useInstanceCapabilitiesStore } from 'src/stores/instance_capabilities.js'
|
||||
import { useMergedConfigStore } from 'src/stores/merged_config.js'
|
||||
import { useSyncConfigStore } from 'src/stores/sync_config.js'
|
||||
|
||||
const GeneralTab = {
|
||||
data() {
|
||||
|
|
@ -31,12 +31,12 @@ const GeneralTab = {
|
|||
'suggestionsEnabled',
|
||||
]),
|
||||
columns() {
|
||||
const mode = useMergedConfigStore().mergedConfig.thirdColumnMode
|
||||
const mode = useSyncConfigStore().mergedConfig.thirdColumnMode
|
||||
|
||||
const notif = mode === 'none' ? [] : ['notifs']
|
||||
|
||||
if (
|
||||
useMergedConfigStore().mergedConfig.sidebarRight ||
|
||||
useSyncConfigStore().mergedConfig.sidebarRight ||
|
||||
mode === 'postform'
|
||||
) {
|
||||
return [...notif, 'content', 'sidebar']
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ import Preview from './theme_preview.vue'
|
|||
|
||||
import { useInstanceStore } from 'src/stores/instance.js'
|
||||
import { useInterfaceStore } from 'src/stores/interface.js'
|
||||
import { useMergedConfigStore } from 'src/stores/merged_config.js'
|
||||
import { useSyncConfigStore } from 'src/stores/sync_config.js'
|
||||
|
||||
import {
|
||||
getContrastRatioLayers,
|
||||
|
|
@ -82,7 +82,7 @@ export default {
|
|||
}),
|
||||
availableStyles: [],
|
||||
selected: '',
|
||||
selectedTheme: useMergedConfigStore().mergedConfig.theme,
|
||||
selectedTheme: useSyncConfigStore().mergedConfig.theme,
|
||||
themeWarning: undefined,
|
||||
tempImportFile: undefined,
|
||||
engineVersion: 0,
|
||||
|
|
|
|||
|
|
@ -10,8 +10,8 @@ import { useAnnouncementsStore } from 'src/stores/announcements'
|
|||
import { useInstanceStore } from 'src/stores/instance.js'
|
||||
import { useInstanceCapabilitiesStore } from 'src/stores/instance_capabilities.js'
|
||||
import { useInterfaceStore } from 'src/stores/interface'
|
||||
import { useMergedConfigStore } from 'src/stores/merged_config.js'
|
||||
import { useShoutStore } from 'src/stores/shout'
|
||||
import { useSyncConfigStore } from 'src/stores/sync_config.js'
|
||||
|
||||
import { library } from '@fortawesome/fontawesome-svg-core'
|
||||
import {
|
||||
|
|
@ -75,7 +75,7 @@ const SideDrawer = {
|
|||
unseenNotifications() {
|
||||
return unseenNotificationsFromStore(
|
||||
this.$store,
|
||||
useMergedConfigStore().mergedConfig.notificationVisibility,
|
||||
useSyncConfigStore().mergedConfig.notificationVisibility,
|
||||
)
|
||||
},
|
||||
unseenNotificationsCount() {
|
||||
|
|
|
|||
|
|
@ -22,7 +22,6 @@ import UserPopover from '../user_popover/user_popover.vue'
|
|||
|
||||
import { useInstanceStore } from 'src/stores/instance.js'
|
||||
import { useInstanceCapabilitiesStore } from 'src/stores/instance_capabilities.js'
|
||||
import { useMergedConfigStore } from 'src/stores/merged_config.js'
|
||||
import { useSyncConfigStore } from 'src/stores/sync_config.js'
|
||||
import { useUserHighlightStore } from 'src/stores/user_highlight.js'
|
||||
|
||||
|
|
@ -478,7 +477,7 @@ const Status = {
|
|||
return this.$store.state.users.currentUser
|
||||
},
|
||||
mergedConfig() {
|
||||
return useMergedConfigStore().mergedConfig
|
||||
return useSyncConfigStore().mergedConfig
|
||||
},
|
||||
isSuspendable() {
|
||||
return !this.replying && this.mediaPlaying.length === 0
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import { useInstanceStore } from 'src/stores/instance.js'
|
|||
import { useInstanceCapabilitiesStore } from 'src/stores/instance_capabilities.js'
|
||||
import { useReportsStore } from 'src/stores/reports.js'
|
||||
import { useStatusHistoryStore } from 'src/stores/statusHistory.js'
|
||||
import { useMergedConfigStore } from 'src/stores/merged_config.js'
|
||||
import { useSyncConfigStore } from 'src/stores/sync_config.js'
|
||||
|
||||
const PRIVATE_SCOPES = new Set(['private', 'direct'])
|
||||
const PUBLIC_SCOPES = new Set(['public', 'unlisted'])
|
||||
|
|
@ -53,7 +53,7 @@ export const BUTTONS = [
|
|||
!PRIVATE_SCOPES.has(status.visibility)),
|
||||
toggleable: true,
|
||||
confirm: ({ status, getters }) =>
|
||||
!status.repeated && useMergedConfigStore().mergedConfig.modalOnRepeat,
|
||||
!status.repeated && useSyncConfigStore().mergedConfig.modalOnRepeat,
|
||||
confirmStrings: {
|
||||
title: 'status.repeat_confirm_title',
|
||||
body: 'status.repeat_confirm',
|
||||
|
|
@ -228,7 +228,7 @@ export const BUTTONS = [
|
|||
currentUser.privileges.includes('messages_delete'))
|
||||
)
|
||||
},
|
||||
confirm: ({ getters }) => useMergedConfigStore().mergedConfig.modalOnDelete,
|
||||
confirm: ({ getters }) => useSyncConfigStore().mergedConfig.modalOnDelete,
|
||||
confirmStrings: {
|
||||
title: 'status.delete_confirm_title',
|
||||
body: 'status.delete_confirm',
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import { mapState } from 'pinia'
|
|||
|
||||
import RichContent from 'src/components/rich_content/rich_content.jsx'
|
||||
|
||||
import { useMergedConfigStore } from 'src/stores/merged_config.js'
|
||||
import { useSyncConfigStore } from 'src/stores/sync_config.js'
|
||||
|
||||
import { library } from '@fortawesome/fontawesome-svg-core'
|
||||
import {
|
||||
|
|
@ -108,7 +108,7 @@ const StatusBody = {
|
|||
collapsedStatus() {
|
||||
return this.status.raw_html.replace(/(\n|<br\s?\/?>)/g, ' ')
|
||||
},
|
||||
...mapState(useMergedConfigStore, ['mergedConfig']),
|
||||
...mapState(useSyncConfigStore, ['mergedConfig']),
|
||||
},
|
||||
components: {
|
||||
RichContent,
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import LinkPreview from '../link-preview/link-preview.vue'
|
|||
import Poll from '../poll/poll.vue'
|
||||
|
||||
import { useMediaViewerStore } from 'src/stores/media_viewer.js'
|
||||
import { useMergedConfigStore } from 'src/stores/merged_config.js'
|
||||
import { useSyncConfigStore } from 'src/stores/sync_config.js'
|
||||
|
||||
import { library } from '@fortawesome/fontawesome-svg-core'
|
||||
import {
|
||||
|
|
@ -76,7 +76,7 @@ const StatusContent = {
|
|||
uncontrolledShowingLongSubject: false,
|
||||
// not as computed because it sets the initial state which will be changed later
|
||||
uncontrolledExpandingSubject:
|
||||
!useMergedConfigStore().mergedConfig.collapseMessageWithSubject,
|
||||
!useSyncConfigStore().mergedConfig.collapseMessageWithSubject,
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
|
|
@ -124,7 +124,7 @@ const StatusContent = {
|
|||
maxThumbnails() {
|
||||
return this.mergedConfig.maxThumbnails
|
||||
},
|
||||
...mapPiniaState(useMergedConfigStore, ['mergedConfig']),
|
||||
...mapPiniaState(useSyncConfigStore, ['mergedConfig']),
|
||||
...mapState({
|
||||
currentUser: (state) => state.users.currentUser,
|
||||
}),
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { useMergedConfigStore } from 'src/stores/merged_config.js'
|
||||
import { useSyncConfigStore } from 'src/stores/sync_config.js'
|
||||
|
||||
const StillImage = {
|
||||
props: [
|
||||
|
|
@ -17,7 +17,7 @@ const StillImage = {
|
|||
return {
|
||||
// for lazy loading, see loadLazy()
|
||||
realSrc: this.src,
|
||||
stopGifs: useMergedConfigStore().mergedConfig.stopGifs,
|
||||
stopGifs: useSyncConfigStore().mergedConfig.stopGifs,
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { useMergedConfigStore } from 'src/stores/merged_config.js'
|
||||
import { useSyncConfigStore } from 'src/stores/sync_config.js'
|
||||
|
||||
import * as DateUtils from 'src/services/date_utils/date_utils.js'
|
||||
import localeService from 'src/services/locale/locale.service.js'
|
||||
|
|
@ -15,17 +15,17 @@ export default {
|
|||
},
|
||||
computed: {
|
||||
shouldUseAbsoluteTimeFormat() {
|
||||
if (!useMergedConfigStore().mergedConfig.useAbsoluteTimeFormat) {
|
||||
if (!useSyncConfigStore().mergedConfig.useAbsoluteTimeFormat) {
|
||||
return false
|
||||
}
|
||||
return (
|
||||
DateUtils.durationStrToMs(
|
||||
useMergedConfigStore().mergedConfig.absoluteTimeFormatMinAge,
|
||||
useSyncConfigStore().mergedConfig.absoluteTimeFormatMinAge,
|
||||
) <= this.relativeTimeMs
|
||||
)
|
||||
},
|
||||
time12hFormat() {
|
||||
return useMergedConfigStore().mergedConfig.absoluteTimeFormat12h === '12h'
|
||||
return useSyncConfigStore().mergedConfig.absoluteTimeFormat12h === '12h'
|
||||
},
|
||||
browserLocale() {
|
||||
return localeService.internalToBrowserLocale(this.$i18n.locale)
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ import Status from '../status/status.vue'
|
|||
import TimelineMenu from '../timeline_menu/timeline_menu.vue'
|
||||
|
||||
import { useInterfaceStore } from 'src/stores/interface.js'
|
||||
import { useMergedConfigStore } from 'src/stores/merged_config.js'
|
||||
import { useSyncConfigStore } from 'src/stores/sync_config.js'
|
||||
|
||||
import timelineFetcher from 'src/services/timeline_fetcher/timeline_fetcher.service.js'
|
||||
|
||||
|
|
@ -126,7 +126,7 @@ const Timeline = {
|
|||
return this.timeline.visibleStatuses.slice(min, max).map((_) => _.id)
|
||||
},
|
||||
virtualScrollingEnabled() {
|
||||
return useMergedConfigStore().mergedConfig.virtualScrolling
|
||||
return useSyncConfigStore().mergedConfig.virtualScrolling
|
||||
},
|
||||
...mapState(useInterfaceStore, {
|
||||
mobileLayout: (store) => store.layoutType === 'mobile',
|
||||
|
|
@ -314,7 +314,7 @@ const Timeline = {
|
|||
},
|
||||
watch: {
|
||||
newStatusCount(count) {
|
||||
if (!useMergedConfigStore().mergedConfig.streaming) {
|
||||
if (!useSyncConfigStore().mergedConfig.streaming) {
|
||||
return
|
||||
}
|
||||
if (count > 0) {
|
||||
|
|
@ -325,8 +325,7 @@ const Timeline = {
|
|||
top < 15 &&
|
||||
!this.paused &&
|
||||
!(
|
||||
this.unfocused &&
|
||||
useMergedConfigStore().mergedConfig.pauseOnUnfocused
|
||||
this.unfocused && useSyncConfigStore().mergedConfig.pauseOnUnfocused
|
||||
)
|
||||
) {
|
||||
this.showNewStatuses()
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
import Modal from 'src/components/modal/modal.vue'
|
||||
|
||||
import { useInstanceStore } from 'src/stores/instance.js'
|
||||
import { useMergedConfigStore } from 'src/stores/merged_config.js'
|
||||
import { useSyncConfigStore } from 'src/stores/sync_config.js'
|
||||
|
||||
import pleromaTanFoxMask from 'src/assets/pleromatan_apology_fox_mask.png'
|
||||
|
|
@ -44,7 +43,7 @@ const UpdateNotification = {
|
|||
this.$store.state.users.currentUser &&
|
||||
useSyncConfigStore().flagStorage.updateCounter <
|
||||
CURRENT_UPDATE_COUNTER &&
|
||||
!useMergedConfigStore().mergedConfig.dontShowUpdateNotifs
|
||||
!useSyncConfigStore().mergedConfig.dontShowUpdateNotifs
|
||||
)
|
||||
},
|
||||
},
|
||||
|
|
|
|||
|
|
@ -12,6 +12,8 @@ import suggestor from 'src/components/emoji_input/suggestor.js'
|
|||
import ImageCropper from 'src/components/image_cropper/image_cropper.vue'
|
||||
import RichContent from 'src/components/rich_content/rich_content.jsx'
|
||||
import UserTimedFilterModal from 'src/components/user_timed_filter_modal/user_timed_filter_modal.vue'
|
||||
import { useInterfaceStore } from '../../stores/interface'
|
||||
import { useMediaViewerStore } from '../../stores/media_viewer'
|
||||
import AccountActions from '../account_actions/account_actions.vue'
|
||||
import FollowButton from '../follow_button/follow_button.vue'
|
||||
import ModerationTools from '../moderation_tools/moderation_tools.vue'
|
||||
|
|
@ -25,10 +27,8 @@ import UserNote from '../user_note/user_note.vue'
|
|||
import { useEmojiStore } from 'src/stores/emoji.js'
|
||||
import { useInstanceStore } from 'src/stores/instance.js'
|
||||
import { useInstanceCapabilitiesStore } from 'src/stores/instance_capabilities.js'
|
||||
import { useInterfaceStore } from 'src/stores/interface'
|
||||
import { useMediaViewerStore } from 'src/stores/media_viewer'
|
||||
import { useMergedConfigStore } from 'src/stores/merged_config.js'
|
||||
import { usePostStatusStore } from 'src/stores/post_status'
|
||||
import { useSyncConfigStore } from 'src/stores/sync_config.js'
|
||||
import { useUserHighlightStore } from 'src/stores/user_highlight.js'
|
||||
|
||||
import { propsToNative } from 'src/services/attributes_helper/attributes_helper.service.js'
|
||||
|
|
@ -385,7 +385,7 @@ export default {
|
|||
],
|
||||
})
|
||||
},
|
||||
...mapState(useMergedConfigStore, ['mergedConfig']),
|
||||
...mapState(useSyncConfigStore, ['mergedConfig']),
|
||||
},
|
||||
methods: {
|
||||
muteUser() {
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import { defineAsyncComponent } from 'vue'
|
|||
|
||||
import UserCard from '../user_card/user_card.vue'
|
||||
|
||||
import { useMergedConfigStore } from 'src/stores/merged_config.js'
|
||||
import { useSyncConfigStore } from 'src/stores/sync_config.js'
|
||||
|
||||
const UserPopover = {
|
||||
name: 'UserPopover',
|
||||
|
|
@ -12,7 +12,7 @@ const UserPopover = {
|
|||
UserCard,
|
||||
Popover: defineAsyncComponent(() => import('../popover/popover.vue')),
|
||||
},
|
||||
computed: mapState(useMergedConfigStore, {
|
||||
computed: mapState(useSyncConfigStore, {
|
||||
userPopoverAvatarAction: (state) =>
|
||||
state.mergedConfig.userPopoverAvatarAction,
|
||||
userPopoverOverlay: (state) => state.mergedConfig.userPopoverOverlay,
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ import Checkbox from 'src/components/checkbox/checkbox.vue'
|
|||
import ConfirmModal from 'src/components/confirm_modal/confirm_modal.vue'
|
||||
import Select from 'src/components/select/select.vue'
|
||||
|
||||
import { useMergedConfigStore } from 'src/stores/merged_config.js'
|
||||
import { useSyncConfigStore } from 'src/stores/sync_config.js'
|
||||
|
||||
import { durationStrToMs } from 'src/services/date_utils/date_utils.js'
|
||||
|
|
@ -10,8 +9,8 @@ import { durationStrToMs } from 'src/services/date_utils/date_utils.js'
|
|||
const UserTimedFilterModal = {
|
||||
data() {
|
||||
const action = this.isMute
|
||||
? useMergedConfigStore().mergedConfig.onMuteDefaultAction
|
||||
: useMergedConfigStore().mergedConfig.onBlockDefaultAction
|
||||
? useSyncConfigStore().mergedConfig.onMuteDefaultAction
|
||||
: useSyncConfigStore().mergedConfig.onBlockDefaultAction
|
||||
const doAsk = action === 'ask'
|
||||
const defaultValues = {}
|
||||
|
||||
|
|
@ -47,11 +46,9 @@ const UserTimedFilterModal = {
|
|||
computed: {
|
||||
shouldConfirm() {
|
||||
if (this.isMute) {
|
||||
return useMergedConfigStore().mergedConfig.onMuteDefaultAction === 'ask'
|
||||
return useSyncConfigStore().mergedConfig.onMuteDefaultAction === 'ask'
|
||||
} else {
|
||||
return (
|
||||
useMergedConfigStore().mergedConfig.onBlockDefaultAction === 'ask'
|
||||
)
|
||||
return useSyncConfigStore().mergedConfig.onBlockDefaultAction === 'ask'
|
||||
}
|
||||
},
|
||||
expiryString() {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { useMergedConfigStore } from 'src/stores/merged_config.js'
|
||||
import { useSyncConfigStore } from 'src/stores/sync_config.js'
|
||||
|
||||
const VideoAttachment = {
|
||||
props: ['attachment', 'controls'],
|
||||
|
|
@ -11,10 +11,10 @@ const VideoAttachment = {
|
|||
},
|
||||
computed: {
|
||||
loopVideo() {
|
||||
if (useMergedConfigStore().mergedConfig.loopVideoSilentOnly) {
|
||||
if (useSyncConfigStore().mergedConfig.loopVideoSilentOnly) {
|
||||
return !this.hasAudio
|
||||
}
|
||||
return useMergedConfigStore().mergedConfig.loopVideo
|
||||
return useSyncConfigStore().mergedConfig.loopVideo
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { useInstanceStore } from 'src/stores/instance.js'
|
||||
import { useInterfaceStore } from 'src/stores/interface.js'
|
||||
import { useMergedConfigStore } from 'src/stores/merged_config.js'
|
||||
import { useSyncConfigStore } from 'src/stores/sync_config.js'
|
||||
|
||||
export const piniaPushNotificationsPlugin = ({ store }) => {
|
||||
if (
|
||||
|
|
@ -20,7 +20,7 @@ export const piniaPushNotificationsPlugin = ({ store }) => {
|
|||
|
||||
// Initial state
|
||||
let vapidPublicKey = useInstanceStore().vapidPublicKey
|
||||
let enabled = useMergedConfigStore().mergedConfig.webPushNotifications
|
||||
let enabled = useSyncConfigStore().mergedConfig.webPushNotifications
|
||||
let permissionGranted =
|
||||
useInterfaceStore().notificationPermission === 'granted'
|
||||
let permissionPresent =
|
||||
|
|
@ -70,7 +70,7 @@ export const vuexPushNotificationsPlugin = (store) => {
|
|||
store.subscribe((mutation, state) => {
|
||||
// Initial state
|
||||
const vapidPublicKey = useInstanceStore().vapidPublicKey
|
||||
const enabled = useMergedConfigStore().mergedConfig.webPushNotifications
|
||||
const enabled = useSyncConfigStore().mergedConfig.webPushNotifications
|
||||
const permissionGranted =
|
||||
useInterfaceStore().notificationPermission === 'granted'
|
||||
const permissionPresent =
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { useInterfaceStore } from 'src/stores/interface.js'
|
||||
import { useMergedConfigStore } from 'src/stores/merged_config.js'
|
||||
import { useSyncConfigStore } from 'src/stores/sync_config.js'
|
||||
|
||||
import { applyStyleConfig } from 'src/services/style_setter/style_setter.js'
|
||||
|
||||
|
|
@ -44,7 +44,7 @@ export const piniaStylePlugin = ({ store, options }) => {
|
|||
if (ACTIONS.has(name)) {
|
||||
const { path } = args[0]
|
||||
if (MIXED_KEYS.has(path)) {
|
||||
after(() => applyStyleConfig(useMergedConfigStore().mergedConfig))
|
||||
after(() => applyStyleConfig(useSyncConfigStore().mergedConfig))
|
||||
}
|
||||
if (HACKS_KEYS.has(path)) {
|
||||
after(() => useInterfaceStore().applyTheme({ recompile: true }))
|
||||
|
|
|
|||
200
src/modules/config.js
Normal file
200
src/modules/config.js
Normal file
|
|
@ -0,0 +1,200 @@
|
|||
import Cookies from 'js-cookie'
|
||||
import { set } from 'lodash'
|
||||
|
||||
import messages from '../i18n/messages'
|
||||
import localeService from '../services/locale/locale.service.js'
|
||||
import { applyStyleConfig } from '../services/style_setter/style_setter.js'
|
||||
import { defaultState, instanceDefaultConfig } from './default_config_state.js'
|
||||
|
||||
import { useEmojiStore } from 'src/stores/emoji.js'
|
||||
import { useI18nStore } from 'src/stores/i18n.js'
|
||||
import { useInstanceStore } from 'src/stores/instance.js'
|
||||
import { useInterfaceStore } from 'src/stores/interface.js'
|
||||
|
||||
const BACKEND_LANGUAGE_COOKIE_NAME = 'userLanguage'
|
||||
const APPEARANCE_SETTINGS_KEYS = new Set([
|
||||
'sidebarColumnWidth',
|
||||
'contentColumnWidth',
|
||||
'notifsColumnWidth',
|
||||
'themeEditorMinWidth',
|
||||
'textSize',
|
||||
'navbarSize',
|
||||
'panelHeaderSize',
|
||||
'forcedRoundness',
|
||||
'emojiSize',
|
||||
'emojiReactionsScale',
|
||||
])
|
||||
|
||||
/* TODO this is a bit messy.
|
||||
* We need to declare settings with their types and also deal with
|
||||
* instance-default settings in some way, hopefully try to avoid copy-pasta
|
||||
* in general.
|
||||
*/
|
||||
export const multiChoiceProperties = [
|
||||
'postContentType',
|
||||
'subjectLineBehavior',
|
||||
'conversationDisplay', // tree | linear
|
||||
'conversationOtherRepliesButton', // below | inside
|
||||
'mentionLinkDisplay', // short | full_for_remote | full
|
||||
'userPopoverAvatarAction', // close | zoom | open
|
||||
'unsavedPostAction', // save | discard | confirm
|
||||
]
|
||||
|
||||
// caching the instance default properties
|
||||
export const instanceDefaultProperties = Object.keys(instanceDefaultConfig)
|
||||
|
||||
const config = {
|
||||
state: { ...defaultState },
|
||||
getters: {
|
||||
defaultConfig() {
|
||||
return {
|
||||
...defaultState,
|
||||
...Object.fromEntries(
|
||||
instanceDefaultProperties.map((key) => [
|
||||
key,
|
||||
useInstanceStore().prefsStorage[key],
|
||||
]),
|
||||
),
|
||||
}
|
||||
},
|
||||
mergedConfig(state) {
|
||||
const instancePrefs = useInstanceStore().prefsStorage
|
||||
const result = Object.fromEntries(
|
||||
Object.keys(defaultState).map((key) => [
|
||||
key,
|
||||
state[key] ?? instancePrefs[key],
|
||||
]),
|
||||
)
|
||||
return result
|
||||
},
|
||||
},
|
||||
mutations: {
|
||||
setOptionTemporarily(state, { name, value }) {
|
||||
set(state, name, value)
|
||||
applyStyleConfig(state)
|
||||
},
|
||||
setOption(state, { name, value }) {
|
||||
set(state, name, value)
|
||||
},
|
||||
setHighlight(state, { user, color, type }) {
|
||||
const data = this.state.config.highlight[user]
|
||||
if (color || type) {
|
||||
state.highlight[user] = {
|
||||
color: color || data.color,
|
||||
type: type || data.type,
|
||||
}
|
||||
} else {
|
||||
delete state.highlight[user]
|
||||
}
|
||||
},
|
||||
},
|
||||
actions: {
|
||||
loadSettings({ dispatch }, data) {
|
||||
const knownKeys = new Set(Object.keys(defaultState))
|
||||
const presentKeys = new Set(Object.keys(data))
|
||||
const intersection = new Set()
|
||||
for (const elem of presentKeys) {
|
||||
if (knownKeys.has(elem)) {
|
||||
intersection.add(elem)
|
||||
}
|
||||
}
|
||||
|
||||
intersection.forEach((name) =>
|
||||
dispatch('setOption', { name, value: data[name] }),
|
||||
)
|
||||
},
|
||||
setHighlight({ commit }, { user, color, type }) {
|
||||
commit('setHighlight', { user, color, type })
|
||||
},
|
||||
setOptionTemporarily({ commit, dispatch, state }, { name, value }) {
|
||||
if (useInterfaceStore().temporaryChangesTimeoutId !== null) {
|
||||
console.warn("Can't track more than one temporary change")
|
||||
return
|
||||
}
|
||||
const oldValue = state[name]
|
||||
|
||||
commit('setOptionTemporarily', { name, value })
|
||||
|
||||
const confirm = () => {
|
||||
dispatch('setOption', { name, value })
|
||||
useInterfaceStore().clearTemporaryChanges()
|
||||
}
|
||||
|
||||
const revert = () => {
|
||||
commit('setOptionTemporarily', { name, value: oldValue })
|
||||
useInterfaceStore().clearTemporaryChanges()
|
||||
}
|
||||
|
||||
useInterfaceStore().setTemporaryChanges({
|
||||
confirm,
|
||||
revert,
|
||||
})
|
||||
},
|
||||
setThemeV2({ commit, dispatch }, { customTheme, customThemeSource }) {
|
||||
commit('setOption', { name: 'theme', value: 'custom' })
|
||||
commit('setOption', { name: 'customTheme', value: customTheme })
|
||||
commit('setOption', {
|
||||
name: 'customThemeSource',
|
||||
value: customThemeSource,
|
||||
})
|
||||
dispatch('setTheme', { themeData: customThemeSource, recompile: true })
|
||||
},
|
||||
setOption({ commit, dispatch, state }, { name, value }) {
|
||||
const exceptions = new Set(['useStreamingApi'])
|
||||
|
||||
if (exceptions.has(name)) {
|
||||
switch (name) {
|
||||
case 'useStreamingApi': {
|
||||
const action = value ? 'enableMastoSockets' : 'disableMastoSockets'
|
||||
|
||||
dispatch(action)
|
||||
.then(() => {
|
||||
commit('setOption', { name: 'useStreamingApi', value })
|
||||
})
|
||||
.catch((e) => {
|
||||
console.error('Failed starting MastoAPI Streaming socket', e)
|
||||
dispatch('disableMastoSockets')
|
||||
dispatch('setOption', { name: 'useStreamingApi', value: false })
|
||||
})
|
||||
break
|
||||
}
|
||||
}
|
||||
} else {
|
||||
commit('setOption', { name, value })
|
||||
if (APPEARANCE_SETTINGS_KEYS.has(name)) {
|
||||
applyStyleConfig(state)
|
||||
}
|
||||
if (name.startsWith('theme3hacks')) {
|
||||
dispatch('applyTheme', { recompile: true })
|
||||
}
|
||||
switch (name) {
|
||||
case 'theme':
|
||||
if (value === 'custom') break
|
||||
dispatch('setTheme', {
|
||||
themeName: value,
|
||||
recompile: true,
|
||||
saveData: true,
|
||||
})
|
||||
break
|
||||
case 'themeDebug': {
|
||||
dispatch('setTheme', { recompile: true })
|
||||
break
|
||||
}
|
||||
case 'interfaceLanguage':
|
||||
messages.setLanguage(useI18nStore().i18n, value)
|
||||
useEmojiStore().loadUnicodeEmojiData(value)
|
||||
Cookies.set(
|
||||
BACKEND_LANGUAGE_COOKIE_NAME,
|
||||
localeService.internalToBackendLocaleMulti(value),
|
||||
)
|
||||
break
|
||||
case 'thirdColumnMode':
|
||||
useInterfaceStore().setLayoutWidth(undefined)
|
||||
break
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
export default config
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
import { useMergedConfigStore } from 'src/stores/merged_config.js'
|
||||
import { useSyncConfigStore } from 'src/stores/sync_config.js'
|
||||
|
||||
export const CONFIG_MIGRATION = 1
|
||||
|
||||
|
|
@ -24,7 +24,7 @@ export const declarations = [
|
|||
description: 'Mute filters, wordfilter/regexp/etc',
|
||||
valueType: 'complex',
|
||||
migration(serverside, rootState) {
|
||||
useMergedConfigStore().mergedConfig.muteWords.forEach((word, order) => {
|
||||
useSyncConfigStore().mergedConfig.muteWords.forEach((word, order) => {
|
||||
const uniqueId = uuidv4()
|
||||
|
||||
serverside.setPreference({
|
||||
|
|
|
|||
|
|
@ -1,19 +1,16 @@
|
|||
import { get, set } from 'lodash'
|
||||
|
||||
const browserLocale = (navigator.language || 'en').split('-')[0]
|
||||
|
||||
export const convertDefinitions = (definitions) =>
|
||||
Object.fromEntries(
|
||||
Object.entries(definitions).map(([k, v]) => {
|
||||
const defaultValue = v.default ?? null
|
||||
return [k, defaultValue]
|
||||
}),
|
||||
)
|
||||
const convertDefinitions = definitions => Object.fromEntries(
|
||||
Object.entries(definitions).map(([k, v]) => [
|
||||
k,
|
||||
v.default == null ? null : v.default,
|
||||
]),
|
||||
)
|
||||
|
||||
/// Instance config entries provided by static config or pleroma api
|
||||
/// Put settings here only if it does not make sense for a normal user
|
||||
/// to override it.
|
||||
export const INSTANCE_IDENTITY_DEFAULT_DEFINITIONS = {
|
||||
export const instanceIdentityDefaultDefinitions = {
|
||||
style: {
|
||||
description: 'Instance default style name',
|
||||
type: 'string',
|
||||
|
|
@ -113,17 +110,14 @@ export const INSTANCE_IDENTITY_DEFAULT_DEFINITIONS = {
|
|||
required: false,
|
||||
},
|
||||
}
|
||||
export const INSTANCE_IDENTITY_DEFAULT = convertDefinitions(
|
||||
INSTANCE_IDENTITY_DEFAULT_DEFINITIONS,
|
||||
)
|
||||
export const instanceIdentityDefault = convertDefinitions(instanceIdentityDefaultDefinitions)
|
||||
|
||||
/// This object contains setting entries that makes sense
|
||||
/// at the user level. The defaults can also be overriden by
|
||||
/// instance admins in the frontend_configuration endpoint or static config.
|
||||
export const INSTANCE_DEFAULT_CONFIG_DEFINITIONS = {
|
||||
export const instanceDefaultConfigDefinitions = {
|
||||
expertLevel: {
|
||||
description:
|
||||
'Used to track which settings to show and hide in settings modal',
|
||||
description: 'Used to track which settings to show and hide in settings modal',
|
||||
type: 'number', // not a boolean so we could potentially make multiple levels of expert-ness
|
||||
default: 0,
|
||||
},
|
||||
|
|
@ -139,8 +133,7 @@ export const INSTANCE_DEFAULT_CONFIG_DEFINITIONS = {
|
|||
description: 'Hide shoutbox if present',
|
||||
default: false,
|
||||
},
|
||||
hideMutedPosts: {
|
||||
// bad name
|
||||
hideMutedPosts: { // bad name
|
||||
description: 'Hide posts of muted users entirely',
|
||||
default: false,
|
||||
},
|
||||
|
|
@ -212,8 +205,7 @@ export const INSTANCE_DEFAULT_CONFIG_DEFINITIONS = {
|
|||
default: false,
|
||||
},
|
||||
autohideFloatingPostButton: {
|
||||
description:
|
||||
'Automatically hide mobile "new post" button when scrolling down',
|
||||
description: 'Automatically hide mobile "new post" button when scrolling down',
|
||||
default: false,
|
||||
},
|
||||
stopGifs: {
|
||||
|
|
@ -408,8 +400,7 @@ export const INSTANCE_DEFAULT_CONFIG_DEFINITIONS = {
|
|||
default: false,
|
||||
},
|
||||
mentionLinkFadeDomain: {
|
||||
description:
|
||||
'Mute (fade) domain name in mention links if configured to show it',
|
||||
description: 'Mute (fade) domain name in mention links if configured to show it',
|
||||
default: true,
|
||||
},
|
||||
mentionLinkShowYous: {
|
||||
|
|
@ -457,8 +448,7 @@ export const INSTANCE_DEFAULT_CONFIG_DEFINITIONS = {
|
|||
default: false,
|
||||
},
|
||||
showExtraNotifications: {
|
||||
description:
|
||||
'Show extra notifications (chats, announcements etc) in notification panel',
|
||||
description: 'Show extra notifications (chats, announcements etc) in notification panel',
|
||||
default: true,
|
||||
},
|
||||
showExtraNotificationsTip: {
|
||||
|
|
@ -517,142 +507,41 @@ export const INSTANCE_DEFAULT_CONFIG_DEFINITIONS = {
|
|||
description: 'Use 24h time format',
|
||||
default: '24h',
|
||||
},
|
||||
themeChecksum: {
|
||||
description: 'Checksum of theme used',
|
||||
type: 'string',
|
||||
required: false,
|
||||
},
|
||||
}
|
||||
export const INSTANCE_DEFAULT_CONFIG = convertDefinitions(
|
||||
INSTANCE_DEFAULT_CONFIG_DEFINITIONS,
|
||||
)
|
||||
export const instanceDefaultConfig = convertDefinitions(instanceDefaultConfigDefinitions)
|
||||
|
||||
export const LOCAL_DEFAULT_CONFIG_DEFINITIONS = {
|
||||
// TODO these two used to be separate but since separation feature got broken it doesn't matter
|
||||
hideAttachments: {
|
||||
description: 'Hide attachments in timeline',
|
||||
default: false,
|
||||
},
|
||||
hideAttachmentsInConv: {
|
||||
description: 'Hide attachments in coversation',
|
||||
default: false,
|
||||
},
|
||||
hideNsfw: {
|
||||
description: 'Hide nsfw posts',
|
||||
default: true,
|
||||
},
|
||||
useOneClickNsfw: {
|
||||
description: 'Open NSFW images directly in media modal',
|
||||
default: false,
|
||||
},
|
||||
preloadImage: {
|
||||
description: 'Preload images for NSFW',
|
||||
default: true,
|
||||
},
|
||||
postContentType: {
|
||||
description: 'Default post content type',
|
||||
default: 'text/plain',
|
||||
},
|
||||
sidebarRight: {
|
||||
description: 'Reverse order of columns',
|
||||
default: false,
|
||||
},
|
||||
sidebarColumnWidth: {
|
||||
description: 'Sidebar column width',
|
||||
default: '25rem',
|
||||
},
|
||||
contentColumnWidth: {
|
||||
description: 'Middle column width',
|
||||
default: '45rem',
|
||||
},
|
||||
notifsColumnWidth: {
|
||||
description: 'Notifications column width',
|
||||
default: '25rem',
|
||||
},
|
||||
themeEditorMinWidth: {
|
||||
description: 'Hack for theme editor on mobile',
|
||||
default: '0rem',
|
||||
},
|
||||
emojiReactionsScale: {
|
||||
description: 'Emoji reactions scale factor',
|
||||
default: 0.5,
|
||||
},
|
||||
textSize: {
|
||||
description: 'Font size',
|
||||
default: '1rem',
|
||||
},
|
||||
emojiSize: {
|
||||
description: 'Emoji size',
|
||||
default: '2.2rem',
|
||||
},
|
||||
navbarSize: {
|
||||
description: 'Navbar size',
|
||||
default: '3.5rem',
|
||||
},
|
||||
panelHeaderSize: {
|
||||
description: 'Panel header size',
|
||||
default: '3.2rem',
|
||||
},
|
||||
navbarColumnStretch: {
|
||||
description: 'Stretch navbar to match columns width',
|
||||
default: false,
|
||||
},
|
||||
mentionLinkDisplay: {
|
||||
description: 'How to display mention links',
|
||||
default: 'short',
|
||||
},
|
||||
imageCompression: {
|
||||
description: 'Image compression (WebP/JPEG)',
|
||||
default: true,
|
||||
},
|
||||
alwaysUseJpeg: {
|
||||
description: 'Compress images using JPEG only',
|
||||
default: false,
|
||||
},
|
||||
useStreamingApi: {
|
||||
description: 'Streaming API (WebSocket)',
|
||||
default: false,
|
||||
},
|
||||
underlay: {
|
||||
description: 'Underlay override',
|
||||
required: true,
|
||||
default: 'none',
|
||||
},
|
||||
fontInterface: {
|
||||
description: 'Interface font override',
|
||||
type: 'string',
|
||||
default: null,
|
||||
},
|
||||
fontInput: {
|
||||
description: 'Input font override',
|
||||
type: 'string',
|
||||
default: null,
|
||||
},
|
||||
fontPosts: {
|
||||
description: 'Post font override',
|
||||
type: 'string',
|
||||
default: null,
|
||||
},
|
||||
fontMonospace: {
|
||||
description: 'Monospace font override',
|
||||
type: 'string',
|
||||
default: null,
|
||||
},
|
||||
themeDebug: {
|
||||
description:
|
||||
'Debug mode that uses computed backgrounds instead of real ones to debug contrast functions',
|
||||
default: false,
|
||||
},
|
||||
forceThemeRecompilation: {
|
||||
description: 'Flag that forces recompilation on boot even if cache exists',
|
||||
default: false,
|
||||
},
|
||||
export const defaultConfigLocal = {
|
||||
hideAttachments: false,
|
||||
hideAttachmentsInConv: false,
|
||||
hideNsfw: true,
|
||||
useOneClickNsfw: false,
|
||||
preloadImage: true,
|
||||
postContentType: 'text/plain',
|
||||
sidebarRight: false,
|
||||
sidebarColumnWidth: '25rem',
|
||||
contentColumnWidth: '45rem',
|
||||
notifsColumnWidth: '25rem',
|
||||
themeEditorMinWidth: '0rem',
|
||||
emojiReactionsScale: 0.5,
|
||||
textSize: '1rem',
|
||||
emojiSize: '2.2rem',
|
||||
navbarSize: '3.5rem',
|
||||
panelHeaderSize: '3.2rem',
|
||||
navbarColumnStretch: false,
|
||||
mentionLinkDisplay: 'short',
|
||||
alwaysUseJpeg: false,
|
||||
imageCompression: true,
|
||||
useStreamingApi: false,
|
||||
underlay: 'none',
|
||||
fontInterface: undefined,
|
||||
fontInput: undefined,
|
||||
fontPosts: undefined,
|
||||
fontMonospace: undefined,
|
||||
themeDebug: false, // debug mode that uses computed backgrounds instead of real ones to debug contrast functions
|
||||
forceThemeRecompilation: false, // flag that forces recompilation on boot even if cache exists
|
||||
}
|
||||
export const LOCAL_DEFAULT_CONFIG = convertDefinitions(
|
||||
LOCAL_DEFAULT_CONFIG_DEFINITIONS,
|
||||
)
|
||||
|
||||
export const LOCAL_ONLY_KEYS = new Set(Object.keys(LOCAL_DEFAULT_CONFIG))
|
||||
export const LOCAL_ONLY_KEYS = new Set(Object.keys(defaultConfigLocal))
|
||||
|
||||
export const makeUndefined = (c) =>
|
||||
Object.fromEntries(Object.keys(c).map((key) => [key, undefined]))
|
||||
|
|
@ -661,8 +550,8 @@ export const makeUndefined = (c) =>
|
|||
/// make sense to be overriden on a instance-wide level.
|
||||
export const defaultState = {
|
||||
// Set these to undefined so it does not interfere with default settings check
|
||||
...makeUndefined(INSTANCE_DEFAULT_CONFIG),
|
||||
...makeUndefined(LOCAL_DEFAULT_CONFIG),
|
||||
...makeUndefined(instanceDefaultConfig),
|
||||
...makeUndefined(defaultConfigLocal),
|
||||
// If there are any configurations that does not make sense to
|
||||
// have instance-wide default, put it here and explain why.
|
||||
|
||||
|
|
@ -683,53 +572,3 @@ export const defaultState = {
|
|||
palette: null,
|
||||
paletteCustomData: null,
|
||||
}
|
||||
|
||||
export const validateSetting = ({
|
||||
value,
|
||||
path,
|
||||
definition,
|
||||
throwError,
|
||||
defaultState,
|
||||
}) => {
|
||||
if (value === undefined) return // only null is allowed as missing value
|
||||
if (get(defaultState, path) === undefined) {
|
||||
const string = `Unknown instance option ${path}, value: ${value}`
|
||||
|
||||
if (throwError) {
|
||||
throw new Error(string)
|
||||
} else {
|
||||
console.error(string)
|
||||
return value
|
||||
}
|
||||
}
|
||||
|
||||
let { required, type, default: defaultValue } = definition
|
||||
|
||||
if (type == null && defaultValue != null) {
|
||||
type = typeof defaultValue
|
||||
}
|
||||
|
||||
if (required && value == null) {
|
||||
const string = `Value required for setting ${path} but was provided nullish; defaulting`
|
||||
|
||||
if (throwError) {
|
||||
throw new Error(string)
|
||||
} else {
|
||||
console.error(string)
|
||||
return defaultValue
|
||||
}
|
||||
}
|
||||
|
||||
if (value !== null && type != null && typeof value !== type) {
|
||||
const string = `Invalid type for setting ${path}: expected type ${type}, got ${typeof value}, value ${value}; defaulting`
|
||||
|
||||
if (throwError) {
|
||||
throw new Error(string)
|
||||
} else {
|
||||
console.error(string)
|
||||
return defaultValue
|
||||
}
|
||||
}
|
||||
|
||||
return value
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import adminSettings from './adminSettings.js'
|
||||
import api from './api.js'
|
||||
import chats from './chats.js'
|
||||
import config from './config.js'
|
||||
import drafts from './drafts.js'
|
||||
import notifications from './notifications.js'
|
||||
import profileConfig from './profileConfig.js'
|
||||
|
|
@ -12,6 +13,7 @@ export default {
|
|||
notifications,
|
||||
users,
|
||||
api,
|
||||
config,
|
||||
profileConfig,
|
||||
adminSettings,
|
||||
drafts,
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ import {
|
|||
maybeShowNotification,
|
||||
} from '../services/notification_utils/notification_utils.js'
|
||||
|
||||
import { useMergedConfigStore } from 'src/stores/merged_config.js'
|
||||
import { useReportsStore } from 'src/stores/reports.js'
|
||||
import { useSyncConfigStore } from 'src/stores/sync_config.js'
|
||||
|
||||
|
|
@ -119,8 +118,8 @@ export const notifications = {
|
|||
commit('addNewNotifications', { notifications: [notification] })
|
||||
|
||||
maybeShowNotification(
|
||||
useSyncConfigStore().mergedConfig.notificationVisibility,
|
||||
store,
|
||||
useMergedConfigStore().mergedConfig.notificationVisibility,
|
||||
Object.values(useSyncConfigStore().prefsStorage.simple.muteFilters),
|
||||
notification,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -25,7 +25,6 @@ import { useEmojiStore } from 'src/stores/emoji.js'
|
|||
import { useInstanceStore } from 'src/stores/instance.js'
|
||||
import { useInstanceCapabilitiesStore } from 'src/stores/instance_capabilities.js'
|
||||
import { useInterfaceStore } from 'src/stores/interface.js'
|
||||
import { useMergedConfigStore } from 'src/stores/merged_config.js'
|
||||
import { useOAuthStore } from 'src/stores/oauth.js'
|
||||
import { useSyncConfigStore } from 'src/stores/sync_config.js'
|
||||
import { useUserHighlightStore } from 'src/stores/user_highlight.js'
|
||||
|
|
@ -555,9 +554,9 @@ const users = {
|
|||
registerPushNotifications(store) {
|
||||
const token = store.state.currentUser.credentials
|
||||
const vapidPublicKey = useInstanceStore().vapidPublicKey
|
||||
const isEnabled = useMergedConfigStore().mergedConfig.webPushNotifications
|
||||
const isEnabled = useSyncConfigStore().mergedConfig.webPushNotifications
|
||||
const notificationVisibility =
|
||||
useMergedConfigStore().mergedConfig.notificationVisibility
|
||||
useSyncConfigStore().mergedConfig.notificationVisibility
|
||||
|
||||
registerPushNotifications(
|
||||
isEnabled,
|
||||
|
|
@ -790,7 +789,7 @@ const users = {
|
|||
dispatch('startFetchingFollowRequests')
|
||||
}
|
||||
|
||||
if (useMergedConfigStore().mergedConfig.useStreamingApi) {
|
||||
if (useSyncConfigStore().mergedConfig.useStreamingApi) {
|
||||
dispatch('fetchTimeline', { timeline: 'friends', since: null })
|
||||
dispatch('fetchNotifications', { since: null })
|
||||
dispatch('enableMastoSockets', true)
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import { promiseInterval } from '../promise_interval/promise_interval.js'
|
|||
import { useInstanceStore } from 'src/stores/instance.js'
|
||||
import { useInstanceCapabilitiesStore } from 'src/stores/instance_capabilities.js'
|
||||
import { useInterfaceStore } from 'src/stores/interface.js'
|
||||
import { useMergedConfigStore } from 'src/stores/merged_config.js'
|
||||
import { useSyncConfigStore } from 'src/stores/sync_config.js'
|
||||
|
||||
const update = ({ store, notifications, older }) => {
|
||||
store.dispatch('addNewNotifications', { notifications, older })
|
||||
|
|
@ -29,7 +29,7 @@ const fetchAndUpdate = ({ store, credentials, older = false, since }) => {
|
|||
const args = { credentials }
|
||||
const rootState = store.rootState || store.state
|
||||
const timelineData = rootState.notifications
|
||||
const hideMutedPosts = useMergedConfigStore().mergedConfig.hideMutedPosts
|
||||
const hideMutedPosts = useSyncConfigStore().mergedConfig.hideMutedPosts
|
||||
|
||||
if (useInstanceCapabilitiesStore().pleromaChatMessagesAvailable) {
|
||||
mastoApiNotificationTypes.add('pleroma:chat_mention')
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ import { chunk, throttle } from 'lodash'
|
|||
import { getCssRules } from '../theme_data/css_utils.js'
|
||||
import { getEngineChecksum, init } from '../theme_data/theme_data_3.service.js'
|
||||
|
||||
import { useMergedConfigStore } from 'src/stores/merged_config.js'
|
||||
import { useSyncConfigStore } from 'src/stores/sync_config.js'
|
||||
|
||||
import { defaultState } from 'src/modules/default_config_state.js'
|
||||
|
|
@ -143,7 +142,7 @@ export const tryLoadCache = async () => {
|
|||
if (
|
||||
cache.engineChecksum === getEngineChecksum() &&
|
||||
cache.checksum !== undefined &&
|
||||
cache.checksum === useMergedConfigStore().mergedConfig.themeChecksum
|
||||
cache.checksum === useSyncConfigStore().mergedConfig.themeChecksum
|
||||
) {
|
||||
const eagerStyles = createStyleSheet(EAGER_STYLE_ID, 10)
|
||||
const lazyStyles = createStyleSheet(LAZY_STYLE_ID, 20)
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ import { promiseInterval } from '../promise_interval/promise_interval.js'
|
|||
import { useInstanceStore } from 'src/stores/instance.js'
|
||||
import { useInstanceCapabilitiesStore } from 'src/stores/instance_capabilities.js'
|
||||
import { useInterfaceStore } from 'src/stores/interface.js'
|
||||
import { useMergedConfigStore } from 'src/stores/merged_config.js'
|
||||
import { useSyncConfigStore } from 'src/stores/sync_config.js'
|
||||
|
||||
const update = ({
|
||||
store,
|
||||
|
|
@ -46,8 +46,7 @@ const fetchAndUpdate = ({
|
|||
const args = { timeline, credentials }
|
||||
const rootState = store.rootState || store.state
|
||||
const timelineData = rootState.statuses.timelines[camelCase(timeline)]
|
||||
const { hideMutedPosts, replyVisibility } =
|
||||
useMergedConfigStore().mergedConfig
|
||||
const { hideMutedPosts, replyVisibility } = useSyncConfigStore().mergedConfig
|
||||
const loggedIn = !!rootState.users.currentUser
|
||||
|
||||
if (older) {
|
||||
|
|
|
|||
|
|
@ -1,146 +1,41 @@
|
|||
import { get, set } from 'lodash'
|
||||
import { defineStore } from 'pinia'
|
||||
|
||||
import { instanceDefaultProperties } from '../modules/config.js'
|
||||
import {
|
||||
convertDefinitions,
|
||||
INSTANCE_DEFAULT_CONFIG,
|
||||
INSTANCE_DEFAULT_CONFIG_DEFINITIONS,
|
||||
INSTANCE_IDENTITY_DEFAULT,
|
||||
INSTANCE_IDENTITY_DEFAULT_DEFINITIONS,
|
||||
LOCAL_DEFAULT_CONFIG,
|
||||
LOCAL_DEFAULT_CONFIG_DEFINITIONS,
|
||||
validateSetting,
|
||||
defaultConfigLocal,
|
||||
instanceDefaultConfig,
|
||||
instanceIdentityDefault,
|
||||
} from '../modules/default_config_state.js'
|
||||
import apiService from '../services/api/api.service.js'
|
||||
|
||||
import { useInterfaceStore } from 'src/stores/interface.js'
|
||||
|
||||
import { ensureFinalFallback } from 'src/i18n/languages.js'
|
||||
|
||||
const REMOTE_INTERACTION_URL = '/main/ostatus'
|
||||
|
||||
const ROOT_STATE_DEFINITIONS = {
|
||||
name: {
|
||||
type: 'string',
|
||||
default: 'PleromaFE',
|
||||
},
|
||||
registrationOpen: {
|
||||
required: true,
|
||||
type: 'boolean',
|
||||
},
|
||||
server: {
|
||||
description: 'Server URL',
|
||||
required: true,
|
||||
type: 'string',
|
||||
},
|
||||
privateMode: {
|
||||
description: 'Private instance?',
|
||||
required: true,
|
||||
type: 'boolean',
|
||||
},
|
||||
federating: {
|
||||
description: 'Is federation enabled?',
|
||||
required: true,
|
||||
type: 'boolean',
|
||||
},
|
||||
federationPolicy: {
|
||||
description: '????',
|
||||
required: true,
|
||||
type: 'object',
|
||||
},
|
||||
|
||||
// Indexes of themes/styles/palettes
|
||||
themesIndex: {
|
||||
required: true,
|
||||
type: 'object',
|
||||
},
|
||||
stylesIndex: {
|
||||
required: true,
|
||||
type: 'object',
|
||||
},
|
||||
palettesIndex: {
|
||||
required: true,
|
||||
type: 'object',
|
||||
},
|
||||
|
||||
themeData: {
|
||||
description: 'Used for theme v2 editor',
|
||||
required: true,
|
||||
type: 'object',
|
||||
},
|
||||
vapidPublicKey: {
|
||||
description: 'Used for WebPush',
|
||||
required: true,
|
||||
type: 'string',
|
||||
},
|
||||
const defaultState = {
|
||||
name: 'Pleroma FE',
|
||||
registrationOpen: true,
|
||||
server: 'http://localhost:4040/',
|
||||
textlimit: 5000,
|
||||
privateMode: false,
|
||||
federating: true,
|
||||
federationPolicy: null,
|
||||
themesIndex: null,
|
||||
stylesIndex: null,
|
||||
palettesIndex: null,
|
||||
themeData: null, // used for theme editor v2
|
||||
vapidPublicKey: null,
|
||||
|
||||
// Stuff from static/config.json
|
||||
loginMethod: {
|
||||
description: 'Login method (token/password)',
|
||||
default: 'password',
|
||||
},
|
||||
disableUpdateNotification: {
|
||||
description: 'Disable update notification (pleroma-tan one)',
|
||||
default: false,
|
||||
},
|
||||
knownDomains: {
|
||||
description: 'List of known domains; used for domain list for domain mutes',
|
||||
default: [],
|
||||
},
|
||||
loginMethod: 'password',
|
||||
disableUpdateNotification: false,
|
||||
|
||||
// Moderation stuff
|
||||
staffAccounts: {
|
||||
description: 'List of staff accounts',
|
||||
default: [],
|
||||
},
|
||||
accountActivationRequired: {
|
||||
description:
|
||||
'Account activation (by email or admin) required after registration',
|
||||
required: true,
|
||||
type: 'boolean',
|
||||
},
|
||||
accountApprovalRequired: {
|
||||
description: 'Admin approval required after registration',
|
||||
required: true,
|
||||
type: 'boolean',
|
||||
},
|
||||
birthdayRequired: {
|
||||
description: 'Require birthday entry when registering',
|
||||
required: true,
|
||||
type: 'boolean',
|
||||
},
|
||||
birthdayMinAge: {
|
||||
description: 'Minimum age required for registration',
|
||||
default: 0,
|
||||
},
|
||||
restrictedNicknames: {
|
||||
description: 'List of nicknames that are not allowed',
|
||||
default: [],
|
||||
},
|
||||
localBubbleInstances: {
|
||||
description: "Akkoma's bubble feature, list of instances",
|
||||
default: [],
|
||||
}, // Akkoma
|
||||
|
||||
// Version Information
|
||||
backendVersion: {
|
||||
required: true,
|
||||
type: 'string',
|
||||
},
|
||||
backendRepository: {
|
||||
required: true,
|
||||
type: 'string',
|
||||
},
|
||||
frontendVersion: {
|
||||
required: true,
|
||||
type: 'string',
|
||||
},
|
||||
}
|
||||
const ROOT_STATE = convertDefinitions(ROOT_STATE_DEFINITIONS)
|
||||
|
||||
const DEFAULT_STATE = {
|
||||
...ROOT_STATE,
|
||||
// Instance-wide configurations that should not be changed by individual users
|
||||
instanceIdentity: {
|
||||
...INSTANCE_IDENTITY_DEFAULT,
|
||||
...instanceIdentityDefault,
|
||||
},
|
||||
|
||||
limits: {
|
||||
|
|
@ -149,7 +44,6 @@ const DEFAULT_STATE = {
|
|||
backgroundlimit: null,
|
||||
uploadlimit: null,
|
||||
fieldsLimits: null,
|
||||
textLimit: null,
|
||||
pollLimits: {
|
||||
max_options: 4,
|
||||
max_option_chars: 255,
|
||||
|
|
@ -160,53 +54,50 @@ const DEFAULT_STATE = {
|
|||
|
||||
// Instance admins can override default settings for the whole instance
|
||||
prefsStorage: {
|
||||
...INSTANCE_DEFAULT_CONFIG,
|
||||
...LOCAL_DEFAULT_CONFIG,
|
||||
...instanceDefaultConfig,
|
||||
...defaultConfigLocal,
|
||||
},
|
||||
|
||||
// Known domains list for user's domain-muting
|
||||
knownDomains: [],
|
||||
|
||||
// Moderation stuff
|
||||
staffAccounts: [],
|
||||
accountActivationRequired: null,
|
||||
accountApprovalRequired: null,
|
||||
birthdayRequired: false,
|
||||
birthdayMinAge: 0,
|
||||
restrictedNicknames: [],
|
||||
localBubbleInstances: [], // Akkoma
|
||||
|
||||
// Version Information
|
||||
backendVersion: '',
|
||||
backendRepository: '',
|
||||
frontendVersion: '',
|
||||
}
|
||||
console.log('===', ROOT_STATE_DEFINITIONS)
|
||||
|
||||
export const useInstanceStore = defineStore('instance', {
|
||||
state: () => ({ ...DEFAULT_STATE }),
|
||||
state: () => ({ ...defaultState }),
|
||||
getters: {
|
||||
instanceDefaultConfig(state) {
|
||||
return instanceDefaultProperties
|
||||
.map((key) => [key, state[key]])
|
||||
.reduce((acc, [key, value]) => ({ ...acc, [key]: value }), {})
|
||||
},
|
||||
instanceDomain(state) {
|
||||
return new URL(this.server).hostname
|
||||
},
|
||||
},
|
||||
actions: {
|
||||
set({ path, value }) {
|
||||
let definition
|
||||
const pathArray = path.split('.')
|
||||
const subpath = pathArray[1] ?? pathArray[0]
|
||||
set({ path, name, value }) {
|
||||
if (get(defaultState, path ?? name) === undefined)
|
||||
console.error(
|
||||
`Unknown instance option ${path ?? name}, value: ${value}`,
|
||||
)
|
||||
|
||||
if (path.startsWith('instanceIdentity.')) {
|
||||
definition = INSTANCE_IDENTITY_DEFAULT_DEFINITIONS[subpath]
|
||||
} else if (path.startsWith('prefsStorage.')) {
|
||||
definition = {
|
||||
...LOCAL_DEFAULT_CONFIG_DEFINITIONS,
|
||||
...INSTANCE_DEFAULT_CONFIG_DEFINITIONS,
|
||||
}[subpath]
|
||||
} else if (path.startsWith('limits.')) {
|
||||
definition =
|
||||
path === 'limits.pollLimits' || path === 'limits.fieldsLimits'
|
||||
? { required: true, type: 'object' }
|
||||
: { required: true, type: 'number' }
|
||||
} else {
|
||||
const definitions = ROOT_STATE_DEFINITIONS
|
||||
definition = definitions[subpath]
|
||||
}
|
||||
set(this, path ?? name, value)
|
||||
|
||||
const finalValue = validateSetting({
|
||||
path,
|
||||
value,
|
||||
definition,
|
||||
throwError: true,
|
||||
defaultState: DEFAULT_STATE,
|
||||
})
|
||||
|
||||
set(this, path, finalValue)
|
||||
|
||||
if (path === 'name') useInterfaceStore().setPageTitle()
|
||||
if ((path ?? name) === 'name') useInterfaceStore().setPageTitle()
|
||||
},
|
||||
async getKnownDomains() {
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ import {
|
|||
import { deserialize } from '../services/theme_data/iss_deserializer.js'
|
||||
|
||||
import { useInstanceStore } from 'src/stores/instance.js'
|
||||
import { useMergedConfigStore } from 'src/stores/merged_config.js'
|
||||
import { useSyncConfigStore } from 'src/stores/sync_config.js'
|
||||
|
||||
import {
|
||||
|
|
@ -187,7 +186,7 @@ export const useInterfaceStore = defineStore('interface', {
|
|||
|
||||
const mobileLayout = width <= 800
|
||||
const normalOrMobile = mobileLayout ? 'mobile' : 'normal'
|
||||
const { thirdColumnMode } = useMergedConfigStore().mergedConfig
|
||||
const { thirdColumnMode } = useSyncConfigStore().mergedConfig
|
||||
if (thirdColumnMode === 'none' || !window.vuex.state.users.currentUser) {
|
||||
this.layoutType = normalOrMobile
|
||||
} else {
|
||||
|
|
@ -426,13 +425,13 @@ export const useInterfaceStore = defineStore('interface', {
|
|||
styleCustomData: userStyleCustomData,
|
||||
palette: userPaletteName,
|
||||
paletteCustomData: userPaletteCustomData,
|
||||
} = useMergedConfigStore().mergedConfig
|
||||
} = useSyncConfigStore().mergedConfig
|
||||
|
||||
let {
|
||||
theme: userThemeV2Name,
|
||||
customTheme: userThemeV2Snapshot,
|
||||
customThemeSource: userThemeV2Source,
|
||||
} = useMergedConfigStore().mergedConfig
|
||||
} = useSyncConfigStore().mergedConfig
|
||||
|
||||
let majorVersionUsed
|
||||
|
||||
|
|
@ -597,7 +596,7 @@ export const useInterfaceStore = defineStore('interface', {
|
|||
this.themeApplied = true
|
||||
},
|
||||
async applyTheme({ recompile = false } = {}) {
|
||||
const { mergedConfig } = useMergedConfigStore()
|
||||
const { mergedConfig } = useSyncConfigStore()
|
||||
const { forceThemeRecompilation, themeDebug } = mergedConfig
|
||||
|
||||
this.themeChangeInProgress = true
|
||||
|
|
|
|||
|
|
@ -4,18 +4,14 @@ import { toRaw } from 'vue'
|
|||
|
||||
import { useInstanceStore } from 'src/stores/instance'
|
||||
|
||||
import {
|
||||
LOCAL_DEFAULT_CONFIG,
|
||||
LOCAL_DEFAULT_CONFIG_DEFINITIONS,
|
||||
validateSetting,
|
||||
} from 'src/modules/default_config_state'
|
||||
import { defaultState as configDefaultState } from 'src/modules/default_config_state'
|
||||
|
||||
export const defaultState = {
|
||||
prefsStorage: {
|
||||
...LOCAL_DEFAULT_CONFIG,
|
||||
...configDefaultState,
|
||||
},
|
||||
tempStorage: {
|
||||
...LOCAL_DEFAULT_CONFIG,
|
||||
...configDefaultState,
|
||||
},
|
||||
}
|
||||
|
||||
|
|
@ -25,17 +21,7 @@ export const useLocalConfigStore = defineStore('local_config', {
|
|||
},
|
||||
actions: {
|
||||
set({ path, value }) {
|
||||
const definition = LOCAL_DEFAULT_CONFIG_DEFINITIONS[path]
|
||||
|
||||
const finalValue = validateSetting({
|
||||
path,
|
||||
value,
|
||||
definition,
|
||||
throwError: false,
|
||||
defaultState: LOCAL_DEFAULT_CONFIG,
|
||||
})
|
||||
|
||||
set(this.prefsStorage, path, finalValue)
|
||||
set(this.prefsStorage, path, value)
|
||||
},
|
||||
setTemporarily({ path, value }) {
|
||||
set(this.tempStorage, path, value)
|
||||
|
|
@ -56,8 +42,8 @@ export const useLocalConfigStore = defineStore('local_config', {
|
|||
persist: {
|
||||
afterLoad(state) {
|
||||
return {
|
||||
prefsStorage: state.prefsStorage ?? { ...LOCAL_DEFAULT_CONFIG },
|
||||
tempStorage: { ...LOCAL_DEFAULT_CONFIG },
|
||||
prefsStorage: state.prefsStorage ?? { ...configDefaultState },
|
||||
tempStorage: { ...configDefaultState },
|
||||
}
|
||||
},
|
||||
},
|
||||
|
|
|
|||
|
|
@ -1,69 +0,0 @@
|
|||
import { defineStore } from 'pinia'
|
||||
|
||||
import { useInstanceStore } from 'src/stores/instance.js'
|
||||
import { useLocalConfigStore } from 'src/stores/local_config.js'
|
||||
import { useSyncConfigStore } from 'src/stores/sync_config.js'
|
||||
|
||||
import {
|
||||
INSTANCE_DEFAULT_CONFIG,
|
||||
LOCAL_DEFAULT_CONFIG,
|
||||
LOCAL_ONLY_KEYS,
|
||||
} from 'src/modules/default_config_state.js'
|
||||
|
||||
const ROOT_CONFIG = {
|
||||
...INSTANCE_DEFAULT_CONFIG,
|
||||
...LOCAL_DEFAULT_CONFIG,
|
||||
}
|
||||
|
||||
export const useMergedConfigStore = defineStore('merged_config', {
|
||||
getters: {
|
||||
mergedConfig: () => {
|
||||
const instancePrefs = useInstanceStore().prefsStorage
|
||||
const tempPrefs = useLocalConfigStore().tempStorage
|
||||
const localPrefs = useLocalConfigStore().prefsStorage
|
||||
const syncPrefs = useSyncConfigStore().prefsStorage
|
||||
|
||||
const getValue = (k) =>
|
||||
tempPrefs[k] ?? localPrefs[k] ?? syncPrefs.simple[k]
|
||||
const getDefault = (k) => instancePrefs[k] ?? ROOT_CONFIG[k]
|
||||
|
||||
const result = Object.fromEntries(
|
||||
Object.keys(INSTANCE_DEFAULT_CONFIG).map((k) => [
|
||||
k,
|
||||
getValue(k) ?? getDefault(k),
|
||||
]),
|
||||
)
|
||||
return result
|
||||
},
|
||||
mergedConfigDefault: () => {
|
||||
const instancePrefs = useInstanceStore().prefsStorage
|
||||
|
||||
const getDefault = (k) => instancePrefs[k] ?? ROOT_CONFIG[k]
|
||||
|
||||
const result = Object.fromEntries(
|
||||
Object.keys(INSTANCE_DEFAULT_CONFIG).map((k) => [
|
||||
k,
|
||||
getDefault(k),
|
||||
]),
|
||||
)
|
||||
return result
|
||||
},
|
||||
mergedConfigWithoutDefaults: () => {
|
||||
const instancePrefs = useInstanceStore().prefsStorage
|
||||
const tempPrefs = useLocalConfigStore().tempStorage
|
||||
const localPrefs = useLocalConfigStore().prefsStorage
|
||||
const syncPrefs = useSyncConfigStore().prefsStorage
|
||||
|
||||
const getValue = (k) =>
|
||||
tempPrefs[k] ?? localPrefs[k] ?? syncPrefs.simple[k] ?? instancePrefs[k]
|
||||
|
||||
const result = Object.fromEntries(
|
||||
Object.keys(INSTANCE_DEFAULT_CONFIG).map(([k, value]) => [
|
||||
k,
|
||||
getValue(k),
|
||||
]),
|
||||
)
|
||||
return result
|
||||
},
|
||||
},
|
||||
})
|
||||
|
|
@ -25,11 +25,9 @@ import { useLocalConfigStore } from 'src/stores/local_config.js'
|
|||
import { storage } from 'src/lib/storage.js'
|
||||
import {
|
||||
defaultState as configDefaultState,
|
||||
INSTANCE_DEFAULT_CONFIG,
|
||||
INSTANCE_DEFAULT_CONFIG_DEFINITIONS,
|
||||
LOCAL_DEFAULT_CONFIG,
|
||||
defaultConfigLocal,
|
||||
instanceDefaultConfig,
|
||||
LOCAL_ONLY_KEYS,
|
||||
validateSetting,
|
||||
} from 'src/modules/default_config_state.js'
|
||||
import { oldDefaultConfigSync } from 'src/modules/old_default_config_state.js'
|
||||
|
||||
|
|
@ -490,19 +488,7 @@ export const useSyncConfigStore = defineStore('sync_config', {
|
|||
`Calling set on depth > 3 (path: ${path}) is not allowed`,
|
||||
)
|
||||
}
|
||||
|
||||
const definition = INSTANCE_DEFAULT_CONFIG_DEFINITIONS[path.split('.')[1]]
|
||||
|
||||
const finalValue = validateSetting({
|
||||
path: path.split('.')[1],
|
||||
value,
|
||||
definition,
|
||||
throwError: false,
|
||||
defaultState: INSTANCE_DEFAULT_CONFIG,
|
||||
})
|
||||
|
||||
set(this.prefsStorage, path, finalValue)
|
||||
|
||||
set(this.prefsStorage, path, value)
|
||||
this.prefsStorage._journal = [
|
||||
...this.prefsStorage._journal,
|
||||
{ operation: 'set', path, args: [value], timestamp: Date.now() },
|
||||
|
|
@ -752,6 +738,51 @@ export const useSyncConfigStore = defineStore('sync_config', {
|
|||
window.vuex.state.api.backendInteractor.updateProfileJSON({ params })
|
||||
},
|
||||
},
|
||||
getters: {
|
||||
mergedConfig: (state) => {
|
||||
const instancePrefs = useInstanceStore().prefsStorage
|
||||
const localPrefs = useLocalConfigStore().prefsStorage
|
||||
const tempPrefs = useLocalConfigStore().tempStorage
|
||||
const result = Object.fromEntries(
|
||||
Object.entries(state.prefsStorage.simple).map(([k, value]) => [
|
||||
k,
|
||||
LOCAL_ONLY_KEYS.has(k)
|
||||
? (tempPrefs[k] ??
|
||||
localPrefs[k] ??
|
||||
instancePrefs[k] ??
|
||||
defaultConfigLocal[k])
|
||||
: (tempPrefs[k] ??
|
||||
localPrefs[k] ??
|
||||
value ??
|
||||
instancePrefs[k] ??
|
||||
instanceDefaultConfig[k]),
|
||||
]),
|
||||
)
|
||||
return result
|
||||
},
|
||||
mergedConfigDefault: (state) => {
|
||||
const instancePrefs = useInstanceStore().prefsStorage
|
||||
const result = Object.fromEntries(
|
||||
Object.entries(state.prefsStorage.simple).map(([k, value]) => [
|
||||
k,
|
||||
LOCAL_ONLY_KEYS.has(k)
|
||||
? (instancePrefs[k] ?? defaultConfigLocal[k])
|
||||
: (instancePrefs[k] ?? instanceDefaultConfig[k]),
|
||||
]),
|
||||
)
|
||||
return result
|
||||
},
|
||||
mergedConfigWithoutDefaults: (state) => {
|
||||
const localPrefs = useLocalConfigStore().prefsStorage
|
||||
const result = Object.fromEntries(
|
||||
Object.entries(state.prefsStorage.simple).map(([k, value]) => [
|
||||
k,
|
||||
LOCAL_ONLY_KEYS.has(k) ? localPrefs[k] : value,
|
||||
]),
|
||||
)
|
||||
return result
|
||||
},
|
||||
},
|
||||
persist: {
|
||||
afterLoad(state) {
|
||||
return state
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import 'virtual:pleroma-fe/service_worker_env'
|
|||
import { createI18n } from 'vue-i18n'
|
||||
|
||||
import { storage } from 'src/lib/storage.js'
|
||||
import { INSTANCE_DEFAULT_CONFIG } from 'src/modules/default_config_state.js'
|
||||
import { instanceDefaultConfig } from 'src/modules/default_config_state.js'
|
||||
import { parseNotification } from 'src/services/entity_normalizer/entity_normalizer.service.js'
|
||||
import { prepareNotificationObject } from 'src/services/notification_utils/notification_utils.js'
|
||||
import { cacheKey, emojiCacheKey, shouldCache } from 'src/services/sw/sw.js'
|
||||
|
|
@ -40,7 +40,7 @@ const setSettings = async () => {
|
|||
i18n.locale = locale
|
||||
const notificationsNativeArray = Object.entries(
|
||||
piniaState.prefsStorage.simple.notificationNative ||
|
||||
INSTANCE_DEFAULT_CONFIG.notificationNative,
|
||||
instanceDefaultConfig.notificationNative,
|
||||
)
|
||||
state.webPushAlwaysShowNotifications =
|
||||
piniaState.prefsStorage.simple.webPushAlwaysShowNotifications
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue