diff --git a/packages/frontend/src/boot/common.ts b/packages/frontend/src/boot/common.ts index d09c6d39d2..e84b6672ae 100644 --- a/packages/frontend/src/boot/common.ts +++ b/packages/frontend/src/boot/common.ts @@ -180,12 +180,12 @@ export async function common(createVue: () => App) { //#region Sync dark mode if (prefer.s.syncDeviceDarkMode) { - store.set('darkMode', isDeviceDarkmode()); + store.commit('darkMode', isDeviceDarkmode()); } window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', (mql) => { if (prefer.s.syncDeviceDarkMode) { - store.set('darkMode', mql.matches); + store.commit('darkMode', mql.matches); } }); //#endregion @@ -198,8 +198,8 @@ export async function common(createVue: () => App) { fetchInstanceMetaPromise.then(() => { // TODO: instance.defaultLightTheme/instance.defaultDarkThemeが不正な形式だった場合のケア - if (prefer.s.lightTheme == null && instance.defaultLightTheme != null) prefer.set('lightTheme', JSON.parse(instance.defaultLightTheme)); - if (prefer.s.darkTheme == null && instance.defaultDarkTheme != null) prefer.set('darkTheme', JSON.parse(instance.defaultDarkTheme)); + if (prefer.s.lightTheme == null && instance.defaultLightTheme != null) prefer.commit('lightTheme', JSON.parse(instance.defaultLightTheme)); + if (prefer.s.darkTheme == null && instance.defaultDarkTheme != null) prefer.commit('darkTheme', JSON.parse(instance.defaultDarkTheme)); }); watch(prefer.r.overridedDeviceKind, (kind) => { diff --git a/packages/frontend/src/boot/main-boot.ts b/packages/frontend/src/boot/main-boot.ts index 411cf3f672..e36ba30c80 100644 --- a/packages/frontend/src/boot/main-boot.ts +++ b/packages/frontend/src/boot/main-boot.ts @@ -141,92 +141,92 @@ export async function mainBoot() { if (store.s.menu.length > 0) { const themes = await misskeyApi('i/registry/get', { scope: ['client'], key: 'themes' }).catch(() => []); if (themes.length > 0) { - prefer.set('themes', themes); + prefer.commit('themes', themes); } const plugins = ColdDeviceStorage.get('plugins'); - prefer.set('plugins', plugins.map(p => ({ + prefer.commit('plugins', plugins.map(p => ({ ...p, installId: (p as any).id, id: undefined, }))); - prefer.set('lightTheme', ColdDeviceStorage.get('lightTheme')); - prefer.set('darkTheme', ColdDeviceStorage.get('darkTheme')); - prefer.set('syncDeviceDarkMode', ColdDeviceStorage.get('syncDeviceDarkMode')); - prefer.set('overridedDeviceKind', store.s.overridedDeviceKind); - prefer.set('widgets', store.s.widgets); - prefer.set('keepCw', store.s.keepCw); - prefer.set('collapseRenotes', store.s.collapseRenotes); - prefer.set('rememberNoteVisibility', store.s.rememberNoteVisibility); - prefer.set('uploadFolder', store.s.uploadFolder); - prefer.set('keepOriginalUploading', store.s.keepOriginalUploading); - prefer.set('menu', store.s.menu); - prefer.set('statusbars', store.s.statusbars); - prefer.set('pinnedUserLists', store.s.pinnedUserLists); - prefer.set('serverDisconnectedBehavior', store.s.serverDisconnectedBehavior); - prefer.set('nsfw', store.s.nsfw); - prefer.set('highlightSensitiveMedia', store.s.highlightSensitiveMedia); - prefer.set('animation', store.s.animation); - prefer.set('animatedMfm', store.s.animatedMfm); - prefer.set('advancedMfm', store.s.advancedMfm); - prefer.set('showReactionsCount', store.s.showReactionsCount); - prefer.set('enableQuickAddMfmFunction', store.s.enableQuickAddMfmFunction); - prefer.set('loadRawImages', store.s.loadRawImages); - prefer.set('imageNewTab', store.s.imageNewTab); - prefer.set('disableShowingAnimatedImages', store.s.disableShowingAnimatedImages); - prefer.set('emojiStyle', store.s.emojiStyle); - prefer.set('menuStyle', store.s.menuStyle); - prefer.set('useBlurEffectForModal', store.s.useBlurEffectForModal); - prefer.set('useBlurEffect', store.s.useBlurEffect); - prefer.set('showFixedPostForm', store.s.showFixedPostForm); - prefer.set('showFixedPostFormInChannel', store.s.showFixedPostFormInChannel); - prefer.set('enableInfiniteScroll', store.s.enableInfiniteScroll); - prefer.set('useReactionPickerForContextMenu', store.s.useReactionPickerForContextMenu); - prefer.set('showGapBetweenNotesInTimeline', store.s.showGapBetweenNotesInTimeline); - prefer.set('instanceTicker', store.s.instanceTicker); - prefer.set('emojiPickerScale', store.s.emojiPickerScale); - prefer.set('emojiPickerWidth', store.s.emojiPickerWidth); - prefer.set('emojiPickerHeight', store.s.emojiPickerHeight); - prefer.set('emojiPickerStyle', store.s.emojiPickerStyle); - prefer.set('reportError', store.s.reportError); - prefer.set('squareAvatars', store.s.squareAvatars); - prefer.set('showAvatarDecorations', store.s.showAvatarDecorations); - prefer.set('numberOfPageCache', store.s.numberOfPageCache); - prefer.set('showNoteActionsOnlyHover', store.s.showNoteActionsOnlyHover); - prefer.set('showClipButtonInNoteFooter', store.s.showClipButtonInNoteFooter); - prefer.set('reactionsDisplaySize', store.s.reactionsDisplaySize); - prefer.set('limitWidthOfReaction', store.s.limitWidthOfReaction); - prefer.set('forceShowAds', store.s.forceShowAds); - prefer.set('aiChanMode', store.s.aiChanMode); - prefer.set('devMode', store.s.devMode); - prefer.set('mediaListWithOneImageAppearance', store.s.mediaListWithOneImageAppearance); - prefer.set('notificationPosition', store.s.notificationPosition); - prefer.set('notificationStackAxis', store.s.notificationStackAxis); - prefer.set('enableCondensedLine', store.s.enableCondensedLine); - prefer.set('keepScreenOn', store.s.keepScreenOn); - prefer.set('disableStreamingTimeline', store.s.disableStreamingTimeline); - prefer.set('useGroupedNotifications', store.s.useGroupedNotifications); - prefer.set('dataSaver', store.s.dataSaver); - prefer.set('enableSeasonalScreenEffect', store.s.enableSeasonalScreenEffect); - prefer.set('enableHorizontalSwipe', store.s.enableHorizontalSwipe); - prefer.set('useNativeUiForVideoAudioPlayer', store.s.useNativeUIForVideoAudioPlayer); - prefer.set('keepOriginalFilename', store.s.keepOriginalFilename); - prefer.set('alwaysConfirmFollow', store.s.alwaysConfirmFollow); - prefer.set('confirmWhenRevealingSensitiveMedia', store.s.confirmWhenRevealingSensitiveMedia); - prefer.set('contextMenu', store.s.contextMenu); - prefer.set('skipNoteRender', store.s.skipNoteRender); - prefer.set('showSoftWordMutedWord', store.s.showSoftWordMutedWord); - prefer.set('confirmOnReact', store.s.confirmOnReact); - prefer.set('sound.masterVolume', store.s.sound_masterVolume); - prefer.set('sound.notUseSound', store.s.sound_notUseSound); - prefer.set('sound.useSoundOnlyWhenActive', store.s.sound_useSoundOnlyWhenActive); - prefer.set('sound.on.note', store.s.sound_note as any); - prefer.set('sound.on.noteMy', store.s.sound_noteMy as any); - prefer.set('sound.on.notification', store.s.sound_notification as any); - prefer.set('sound.on.reaction', store.s.sound_reaction as any); - store.set('deck.profile', deckStore.state.profile); - store.set('deck.columns', deckStore.state.columns); - store.set('deck.layout', deckStore.state.layout); - store.set('menu', []); + prefer.commit('lightTheme', ColdDeviceStorage.get('lightTheme')); + prefer.commit('darkTheme', ColdDeviceStorage.get('darkTheme')); + prefer.commit('syncDeviceDarkMode', ColdDeviceStorage.get('syncDeviceDarkMode')); + prefer.commit('overridedDeviceKind', store.s.overridedDeviceKind); + prefer.commit('widgets', store.s.widgets); + prefer.commit('keepCw', store.s.keepCw); + prefer.commit('collapseRenotes', store.s.collapseRenotes); + prefer.commit('rememberNoteVisibility', store.s.rememberNoteVisibility); + prefer.commit('uploadFolder', store.s.uploadFolder); + prefer.commit('keepOriginalUploading', store.s.keepOriginalUploading); + prefer.commit('menu', store.s.menu); + prefer.commit('statusbars', store.s.statusbars); + prefer.commit('pinnedUserLists', store.s.pinnedUserLists); + prefer.commit('serverDisconnectedBehavior', store.s.serverDisconnectedBehavior); + prefer.commit('nsfw', store.s.nsfw); + prefer.commit('highlightSensitiveMedia', store.s.highlightSensitiveMedia); + prefer.commit('animation', store.s.animation); + prefer.commit('animatedMfm', store.s.animatedMfm); + prefer.commit('advancedMfm', store.s.advancedMfm); + prefer.commit('showReactionsCount', store.s.showReactionsCount); + prefer.commit('enableQuickAddMfmFunction', store.s.enableQuickAddMfmFunction); + prefer.commit('loadRawImages', store.s.loadRawImages); + prefer.commit('imageNewTab', store.s.imageNewTab); + prefer.commit('disableShowingAnimatedImages', store.s.disableShowingAnimatedImages); + prefer.commit('emojiStyle', store.s.emojiStyle); + prefer.commit('menuStyle', store.s.menuStyle); + prefer.commit('useBlurEffectForModal', store.s.useBlurEffectForModal); + prefer.commit('useBlurEffect', store.s.useBlurEffect); + prefer.commit('showFixedPostForm', store.s.showFixedPostForm); + prefer.commit('showFixedPostFormInChannel', store.s.showFixedPostFormInChannel); + prefer.commit('enableInfiniteScroll', store.s.enableInfiniteScroll); + prefer.commit('useReactionPickerForContextMenu', store.s.useReactionPickerForContextMenu); + prefer.commit('showGapBetweenNotesInTimeline', store.s.showGapBetweenNotesInTimeline); + prefer.commit('instanceTicker', store.s.instanceTicker); + prefer.commit('emojiPickerScale', store.s.emojiPickerScale); + prefer.commit('emojiPickerWidth', store.s.emojiPickerWidth); + prefer.commit('emojiPickerHeight', store.s.emojiPickerHeight); + prefer.commit('emojiPickerStyle', store.s.emojiPickerStyle); + prefer.commit('reportError', store.s.reportError); + prefer.commit('squareAvatars', store.s.squareAvatars); + prefer.commit('showAvatarDecorations', store.s.showAvatarDecorations); + prefer.commit('numberOfPageCache', store.s.numberOfPageCache); + prefer.commit('showNoteActionsOnlyHover', store.s.showNoteActionsOnlyHover); + prefer.commit('showClipButtonInNoteFooter', store.s.showClipButtonInNoteFooter); + prefer.commit('reactionsDisplaySize', store.s.reactionsDisplaySize); + prefer.commit('limitWidthOfReaction', store.s.limitWidthOfReaction); + prefer.commit('forceShowAds', store.s.forceShowAds); + prefer.commit('aiChanMode', store.s.aiChanMode); + prefer.commit('devMode', store.s.devMode); + prefer.commit('mediaListWithOneImageAppearance', store.s.mediaListWithOneImageAppearance); + prefer.commit('notificationPosition', store.s.notificationPosition); + prefer.commit('notificationStackAxis', store.s.notificationStackAxis); + prefer.commit('enableCondensedLine', store.s.enableCondensedLine); + prefer.commit('keepScreenOn', store.s.keepScreenOn); + prefer.commit('disableStreamingTimeline', store.s.disableStreamingTimeline); + prefer.commit('useGroupedNotifications', store.s.useGroupedNotifications); + prefer.commit('dataSaver', store.s.dataSaver); + prefer.commit('enableSeasonalScreenEffect', store.s.enableSeasonalScreenEffect); + prefer.commit('enableHorizontalSwipe', store.s.enableHorizontalSwipe); + prefer.commit('useNativeUiForVideoAudioPlayer', store.s.useNativeUIForVideoAudioPlayer); + prefer.commit('keepOriginalFilename', store.s.keepOriginalFilename); + prefer.commit('alwaysConfirmFollow', store.s.alwaysConfirmFollow); + prefer.commit('confirmWhenRevealingSensitiveMedia', store.s.confirmWhenRevealingSensitiveMedia); + prefer.commit('contextMenu', store.s.contextMenu); + prefer.commit('skipNoteRender', store.s.skipNoteRender); + prefer.commit('showSoftWordMutedWord', store.s.showSoftWordMutedWord); + prefer.commit('confirmOnReact', store.s.confirmOnReact); + prefer.commit('sound.masterVolume', store.s.sound_masterVolume); + prefer.commit('sound.notUseSound', store.s.sound_notUseSound); + prefer.commit('sound.useSoundOnlyWhenActive', store.s.sound_useSoundOnlyWhenActive); + prefer.commit('sound.on.note', store.s.sound_note as any); + prefer.commit('sound.on.noteMy', store.s.sound_noteMy as any); + prefer.commit('sound.on.notification', store.s.sound_notification as any); + prefer.commit('sound.on.reaction', store.s.sound_reaction as any); + store.commit('deck.profile', deckStore.state.profile); + store.commit('deck.columns', deckStore.state.columns); + store.commit('deck.layout', deckStore.state.layout); + store.commit('menu', []); } if (store.s.accountSetupWizard !== -1) { @@ -502,7 +502,7 @@ export async function mainBoot() { post(); }, 'd': () => { - store.set('darkMode', !store.s.darkMode); + store.commit('darkMode', !store.s.darkMode); }, 's': () => { mainRouter.push('/search'); diff --git a/packages/frontend/src/components/MkAutocomplete.vue b/packages/frontend/src/components/MkAutocomplete.vue index 7436d4f1b2..2c661ccff7 100644 --- a/packages/frontend/src/components/MkAutocomplete.vue +++ b/packages/frontend/src/components/MkAutocomplete.vue @@ -158,7 +158,7 @@ function complete(type: string, value: any) { let recents = store.s.recentlyUsedEmojis; recents = recents.filter((emoji: any) => emoji !== value); recents.unshift(value); - store.set('recentlyUsedEmojis', recents.splice(0, 32)); + store.commit('recentlyUsedEmojis', recents.splice(0, 32)); } } diff --git a/packages/frontend/src/components/MkDrive.folder.vue b/packages/frontend/src/components/MkDrive.folder.vue index 7b8d81f7f0..3bcd934f8a 100644 --- a/packages/frontend/src/components/MkDrive.folder.vue +++ b/packages/frontend/src/components/MkDrive.folder.vue @@ -245,7 +245,7 @@ function deleteFolder() { folderId: props.folder.id, }).then(() => { if (prefer.s.uploadFolder === props.folder.id) { - prefer.set('uploadFolder', null); + prefer.commit('uploadFolder', null); } }).catch(err => { switch (err.id) { @@ -266,7 +266,7 @@ function deleteFolder() { } function setAsUploadFolder() { - prefer.set('uploadFolder', props.folder.id); + prefer.commit('uploadFolder', props.folder.id); } function onContextmenu(ev: MouseEvent) { diff --git a/packages/frontend/src/components/MkEmojiPicker.vue b/packages/frontend/src/components/MkEmojiPicker.vue index 384682277e..e9239780df 100644 --- a/packages/frontend/src/components/MkEmojiPicker.vue +++ b/packages/frontend/src/components/MkEmojiPicker.vue @@ -432,7 +432,7 @@ function chosen(emoji: string | Misskey.entities.EmojiSimple | UnicodeEmojiDef, let recents = store.s.recentlyUsedEmojis; recents = recents.filter((emoji) => emoji !== key); recents.unshift(key); - store.set('recentlyUsedEmojis', recents.splice(0, 32)); + store.commit('recentlyUsedEmojis', recents.splice(0, 32)); } } diff --git a/packages/frontend/src/components/MkPostForm.vue b/packages/frontend/src/components/MkPostForm.vue index aa2fe59578..6a94024a21 100644 --- a/packages/frontend/src/components/MkPostForm.vue +++ b/packages/frontend/src/components/MkPostForm.vue @@ -177,9 +177,9 @@ const files = ref(props.initialFiles ?? []); const poll = ref(null); const useCw = ref(!!props.initialCw); const showPreview = ref(store.s.showPreview); -watch(showPreview, () => store.set('showPreview', showPreview.value)); +watch(showPreview, () => store.commit('showPreview', showPreview.value)); const showAddMfmFunction = ref(prefer.s.enableQuickAddMfmFunction); -watch(showAddMfmFunction, () => prefer.set('enableQuickAddMfmFunction', showAddMfmFunction.value)); +watch(showAddMfmFunction, () => prefer.commit('enableQuickAddMfmFunction', showAddMfmFunction.value)); const cw = ref(props.initialCw ?? null); const localOnly = ref(props.initialLocalOnly ?? (prefer.s.rememberNoteVisibility ? store.s.localOnly : prefer.s.defaultNoteLocalOnly)); const visibility = ref(props.initialVisibility ?? (prefer.s.rememberNoteVisibility ? store.s.visibility : prefer.s.defaultNoteVisibility)); @@ -480,7 +480,7 @@ function setVisibility() { changeVisibility: v => { visibility.value = v; if (prefer.s.rememberNoteVisibility) { - store.set('visibility', visibility.value); + store.commit('visibility', visibility.value); } }, closed: () => dispose(), @@ -528,7 +528,7 @@ async function toggleLocalOnly() { localOnly.value = !localOnly.value; if (prefer.s.rememberNoteVisibility) { - store.set('localOnly', localOnly.value); + store.commit('localOnly', localOnly.value); } } diff --git a/packages/frontend/src/components/MkUserSelectDialog.vue b/packages/frontend/src/components/MkUserSelectDialog.vue index e5c6df267b..2f0e529d24 100644 --- a/packages/frontend/src/components/MkUserSelectDialog.vue +++ b/packages/frontend/src/components/MkUserSelectDialog.vue @@ -131,7 +131,7 @@ async function ok() { let recents = store.s.recentlyUsedUsers; recents = recents.filter(x => x !== selected.value?.id); recents.unshift(selected.value.id); - store.set('recentlyUsedUsers', recents.splice(0, 16)); + store.commit('recentlyUsedUsers', recents.splice(0, 16)); } function cancel() { diff --git a/packages/frontend/src/components/MkUserSetupDialog.vue b/packages/frontend/src/components/MkUserSetupDialog.vue index eb3a69217e..0eb9717ec4 100644 --- a/packages/frontend/src/components/MkUserSetupDialog.vue +++ b/packages/frontend/src/components/MkUserSetupDialog.vue @@ -152,7 +152,7 @@ const dialog = shallowRef>(); const page = ref(store.s.accountSetupWizard); watch(page, () => { - store.set('accountSetupWizard', page.value); + store.commit('accountSetupWizard', page.value); }); async function close(skip: boolean) { @@ -165,11 +165,11 @@ async function close(skip: boolean) { } dialog.value?.close(); - store.set('accountSetupWizard', -1); + store.commit('accountSetupWizard', -1); } function setupComplete() { - store.set('accountSetupWizard', -1); + store.commit('accountSetupWizard', -1); dialog.value?.close(); } @@ -194,7 +194,7 @@ async function later(later: boolean) { } dialog.value?.close(); - store.set('accountSetupWizard', 0); + store.commit('accountSetupWizard', 0); } diff --git a/packages/frontend/src/deck.ts b/packages/frontend/src/deck.ts index f158db2f85..38eed71c2e 100644 --- a/packages/frontend/src/deck.ts +++ b/packages/frontend/src/deck.ts @@ -69,15 +69,15 @@ export const loadDeck = async () => { return; } - store.set('deck.columns', []); - store.set('deck.layout', []); + store.commit('deck.columns', []); + store.commit('deck.layout', []); return; } throw err; } - store.set('deck.columns', deck.columns); - store.set('deck.layout', deck.layout); + store.commit('deck.columns', deck.columns); + store.commit('deck.layout', deck.layout); }; export async function forceSaveDeck() { @@ -117,8 +117,8 @@ export function addColumn(column: Column) { } export function removeColumn(id: Column['id']) { - store.set('deck.columns', store.s['deck.columns'].filter(c => c.id !== id)); - store.set('deck.layout', store.s['deck.layout'] + store.commit('deck.columns', store.s['deck.columns'].filter(c => c.id !== id)); + store.commit('deck.layout', store.s['deck.layout'] .map(ids => ids.filter(_id => _id !== id)) .filter(ids => ids.length > 0)); saveDeck(); @@ -132,7 +132,7 @@ export function swapColumn(a: Column['id'], b: Column['id']) { const layout = deepClone(store.s['deck.layout']); layout[aX][aY] = b; layout[bX][bY] = a; - store.set('deck.layout', layout); + store.commit('deck.layout', layout); saveDeck(); } @@ -144,7 +144,7 @@ export function swapLeftColumn(id: Column['id']) { if (left) { layout[i - 1] = store.s['deck.layout'][i]; layout[i] = left; - store.set('deck.layout', layout); + store.commit('deck.layout', layout); } return true; } @@ -161,7 +161,7 @@ export function swapRightColumn(id: Column['id']) { if (right) { layout[i + 1] = store.s['deck.layout'][i]; layout[i] = right; - store.set('deck.layout', layout); + store.commit('deck.layout', layout); } return true; } @@ -182,7 +182,7 @@ export function swapUpColumn(id: Column['id']) { ids[i] = up; layout[idsIndex] = ids; - store.set('deck.layout', layout); + store.commit('deck.layout', layout); } return true; } @@ -203,7 +203,7 @@ export function swapDownColumn(id: Column['id']) { ids[i] = down; layout[idsIndex] = ids; - store.set('deck.layout', layout); + store.commit('deck.layout', layout); } return true; } @@ -218,7 +218,7 @@ export function stackLeftColumn(id: Column['id']) { layout = layout.map(ids => ids.filter(_id => _id !== id)); layout[i - 1].push(id); layout = layout.filter(ids => ids.length > 0); - store.set('deck.layout', layout); + store.commit('deck.layout', layout); saveDeck(); } @@ -229,7 +229,7 @@ export function popRightColumn(id: Column['id']) { layout = layout.map(ids => ids.filter(_id => _id !== id)); layout.splice(i + 1, 0, [id]); layout = layout.filter(ids => ids.length > 0); - store.set('deck.layout', layout); + store.commit('deck.layout', layout); const columns = deepClone(store.s['deck.columns']); for (const column of columns) { @@ -237,7 +237,7 @@ export function popRightColumn(id: Column['id']) { column.active = true; } } - store.set('deck.columns', columns); + store.commit('deck.columns', columns); saveDeck(); } @@ -250,7 +250,7 @@ export function addColumnWidget(id: Column['id'], widget: ColumnWidget) { if (column.widgets == null) column.widgets = []; column.widgets.unshift(widget); columns[columnIndex] = column; - store.set('deck.columns', columns); + store.commit('deck.columns', columns); saveDeck(); } @@ -262,7 +262,7 @@ export function removeColumnWidget(id: Column['id'], widget: ColumnWidget) { if (column.widgets == null) column.widgets = []; column.widgets = column.widgets.filter(w => w.id !== widget.id); columns[columnIndex] = column; - store.set('deck.columns', columns); + store.commit('deck.columns', columns); saveDeck(); } @@ -273,7 +273,7 @@ export function setColumnWidgets(id: Column['id'], widgets: ColumnWidget[]) { if (column == null) return; column.widgets = widgets; columns[columnIndex] = column; - store.set('deck.columns', columns); + store.commit('deck.columns', columns); saveDeck(); } @@ -288,7 +288,7 @@ export function updateColumnWidget(id: Column['id'], widgetId: string, widgetDat data: widgetData, } : w); columns[columnIndex] = column; - store.set('deck.columns', columns); + store.commit('deck.columns', columns); saveDeck(); } @@ -301,6 +301,6 @@ export function updateColumn(id: Column['id'], column: Partial) { currentColumn[k] = v; } columns[columnIndex] = currentColumn; - store.set('deck.columns', columns); + store.commit('deck.columns', columns); saveDeck(); } diff --git a/packages/frontend/src/pages/admin/abuses.vue b/packages/frontend/src/pages/admin/abuses.vue index 8b396c1821..0de81056ce 100644 --- a/packages/frontend/src/pages/admin/abuses.vue +++ b/packages/frontend/src/pages/admin/abuses.vue @@ -93,7 +93,7 @@ function resolved(reportId) { } function closeTutorial() { - store.set('abusesTutorial', false); + store.commit('abusesTutorial', false); } const headerActions = computed(() => []); diff --git a/packages/frontend/src/pages/drop-and-fusion.game.vue b/packages/frontend/src/pages/drop-and-fusion.game.vue index 6a48cde290..d34702fd07 100644 --- a/packages/frontend/src/pages/drop-and-fusion.game.vue +++ b/packages/frontend/src/pages/drop-and-fusion.game.vue @@ -858,7 +858,7 @@ function updateSettings< >(key: K, value: V) { const changes: { [P in K]?: V } = {}; changes[key] = value; - prefer.set('game.dropAndFusion', { + prefer.commit('game.dropAndFusion', { ...prefer.s['game.dropAndFusion'], ...changes, }); diff --git a/packages/frontend/src/pages/settings/drive.vue b/packages/frontend/src/pages/settings/drive.vue index aab04ebc9c..8e7c7e82df 100644 --- a/packages/frontend/src/pages/settings/drive.vue +++ b/packages/frontend/src/pages/settings/drive.vue @@ -144,7 +144,7 @@ if (prefer.s.uploadFolder) { function chooseUploadFolder() { os.selectDriveFolder(false).then(async folder => { - prefer.set('uploadFolder', folder[0] ? folder[0].id : null); + prefer.commit('uploadFolder', folder[0] ? folder[0].id : null); os.success(); if (prefer.s.uploadFolder) { uploadFolder.value = await misskeyApi('drive/folders/show', { diff --git a/packages/frontend/src/pages/settings/emoji-picker.vue b/packages/frontend/src/pages/settings/emoji-picker.vue index 36cebb05dc..b833180083 100644 --- a/packages/frontend/src/pages/settings/emoji-picker.vue +++ b/packages/frontend/src/pages/settings/emoji-picker.vue @@ -240,13 +240,13 @@ function getHTMLElement(ev: MouseEvent): HTMLElement { } watch(pinnedEmojisForReaction, () => { - store.set('reactions', pinnedEmojisForReaction.value); + store.commit('reactions', pinnedEmojisForReaction.value); }, { deep: true, }); watch(pinnedEmojis, () => { - store.set('pinnedEmojis', pinnedEmojis.value); + store.commit('pinnedEmojis', pinnedEmojis.value); }, { deep: true, }); diff --git a/packages/frontend/src/pages/settings/index.vue b/packages/frontend/src/pages/settings/index.vue index b782a575c7..d72b336616 100644 --- a/packages/frontend/src/pages/settings/index.vue +++ b/packages/frontend/src/pages/settings/index.vue @@ -72,7 +72,7 @@ const ro = new ResizeObserver((entries, observer) => { }); function skipAutoBackup() { - store.set('showPreferencesAutoCloudBackupSuggestion', false); + store.commit('showPreferencesAutoCloudBackupSuggestion', false); } const menuDef = computed(() => [{ diff --git a/packages/frontend/src/pages/settings/navbar.vue b/packages/frontend/src/pages/settings/navbar.vue index d8afbcdb27..db7f4dac3c 100644 --- a/packages/frontend/src/pages/settings/navbar.vue +++ b/packages/frontend/src/pages/settings/navbar.vue @@ -91,7 +91,7 @@ function removeItem(index: number) { } async function save() { - prefer.set('menu', items.value.map(x => x.type)); + prefer.commit('menu', items.value.map(x => x.type)); await reloadAsk({ reason: i18n.ts.reloadToApplySetting, unison: true }); } diff --git a/packages/frontend/src/pages/settings/preferences.vue b/packages/frontend/src/pages/settings/preferences.vue index bf762d8aeb..f92539e02b 100644 --- a/packages/frontend/src/pages/settings/preferences.vue +++ b/packages/frontend/src/pages/settings/preferences.vue @@ -461,7 +461,7 @@ function downloadEmojiIndex(lang: typeof emojiIndexLangs[number]) { } currentIndexes[lang] = await download(); - await store.set('additionalUnicodeEmojiIndexes', currentIndexes); + await store.commit('additionalUnicodeEmojiIndexes', currentIndexes); } os.promiseDialog(main()); @@ -471,7 +471,7 @@ function removeEmojiIndex(lang: string) { async function main() { const currentIndexes = store.s.additionalUnicodeEmojiIndexes; delete currentIndexes[lang]; - await store.set('additionalUnicodeEmojiIndexes', currentIndexes); + await store.commit('additionalUnicodeEmojiIndexes', currentIndexes); } os.promiseDialog(main()); @@ -488,11 +488,11 @@ async function setPinnedList() { if (canceled) return; if (list == null) return; - prefer.set('pinnedUserLists', [list]); + prefer.commit('pinnedUserLists', [list]); } function removePinnedList() { - prefer.set('pinnedUserLists', []); + prefer.commit('pinnedUserLists', []); } function enableAllDataSaver() { @@ -512,7 +512,7 @@ function disableAllDataSaver() { } watch(dataSaver, (to) => { - prefer.set('dataSaver', to); + prefer.commit('dataSaver', to); }, { deep: true, }); diff --git a/packages/frontend/src/pages/settings/sounds.vue b/packages/frontend/src/pages/settings/sounds.vue index 7d800a8a37..ea634646f6 100644 --- a/packages/frontend/src/pages/settings/sounds.vue +++ b/packages/frontend/src/pages/settings/sounds.vue @@ -101,14 +101,14 @@ async function updated(type: keyof typeof sounds.value, sound) { volume: sound.volume, }; - prefer.set(`sound.on.${type}`, v); + prefer.commit(`sound.on.${type}`, v); sounds.value[type] = v; } function reset() { for (const sound of Object.keys(sounds.value) as Array) { const v = PREF_DEF[`sound.on.${sound}`].default; - prefer.set(`sound.on.${sound}`, v); + prefer.commit(`sound.on.${sound}`, v); sounds.value[sound] = v; } } diff --git a/packages/frontend/src/pages/settings/statusbar.statusbar.vue b/packages/frontend/src/pages/settings/statusbar.statusbar.vue index 55d976295a..dbb640123a 100644 --- a/packages/frontend/src/pages/settings/statusbar.statusbar.vue +++ b/packages/frontend/src/pages/settings/statusbar.statusbar.vue @@ -137,10 +137,10 @@ async function save() { const i = prefer.s.statusbars.findIndex(x => x.id === props._id); const statusbars = deepClone(prefer.s.statusbars); statusbars[i] = deepClone(statusbar); - prefer.set('statusbars', statusbars); + prefer.commit('statusbars', statusbars); } function del() { - prefer.set('statusbars', prefer.s.statusbars.filter(x => x.id !== props._id)); + prefer.commit('statusbars', prefer.s.statusbars.filter(x => x.id !== props._id)); } diff --git a/packages/frontend/src/pages/settings/statusbar.vue b/packages/frontend/src/pages/settings/statusbar.vue index 2737af3aa4..7b09093c85 100644 --- a/packages/frontend/src/pages/settings/statusbar.vue +++ b/packages/frontend/src/pages/settings/statusbar.vue @@ -37,7 +37,7 @@ onMounted(() => { }); async function add() { - prefer.set('statusbars', [...statusbars.value, { + prefer.commit('statusbars', [...statusbars.value, { id: uuid(), type: null, black: false, diff --git a/packages/frontend/src/pages/settings/theme.vue b/packages/frontend/src/pages/settings/theme.vue index bb61f25c61..27165e0e51 100644 --- a/packages/frontend/src/pages/settings/theme.vue +++ b/packages/frontend/src/pages/settings/theme.vue @@ -179,7 +179,7 @@ const darkThemeId = computed({ set(id) { const t = themes.value.find(x => x.id === id); if (t) { // テーマエディタでテーマを作成したときなどは、themesに反映されないため undefined になる - prefer.set('darkTheme', t); + prefer.commit('darkTheme', t); } }, }); @@ -191,7 +191,7 @@ const lightThemeId = computed({ set(id) { const t = themes.value.find(x => x.id === id); if (t) { // テーマエディタでテーマを作成したときなどは、themesに反映されないため undefined になる - prefer.set('lightTheme', t); + prefer.commit('lightTheme', t); } }, }); @@ -203,7 +203,7 @@ const themesCount = installedThemes.value.length; watch(syncDeviceDarkMode, () => { if (syncDeviceDarkMode.value) { - store.set('darkMode', isDeviceDarkmode()); + store.commit('darkMode', isDeviceDarkmode()); } }); diff --git a/packages/frontend/src/pages/tag.vue b/packages/frontend/src/pages/tag.vue index f7e0302ca7..582bf3ee38 100644 --- a/packages/frontend/src/pages/tag.vue +++ b/packages/frontend/src/pages/tag.vue @@ -44,11 +44,11 @@ const pagination = { const notes = ref>(); async function post() { - store.set('postFormHashtags', props.tag); - store.set('postFormWithHashtags', true); + store.commit('postFormHashtags', props.tag); + store.commit('postFormWithHashtags', true); await os.post(); - store.set('postFormHashtags', ''); - store.set('postFormWithHashtags', false); + store.commit('postFormHashtags', ''); + store.commit('postFormWithHashtags', false); notes.value?.pagingComponent?.reload(); } diff --git a/packages/frontend/src/pages/theme-editor.vue b/packages/frontend/src/pages/theme-editor.vue index 64e16987a9..43ac5f38d7 100644 --- a/packages/frontend/src/pages/theme-editor.vue +++ b/packages/frontend/src/pages/theme-editor.vue @@ -201,9 +201,9 @@ async function saveAs() { await addTheme(theme.value); applyTheme(theme.value); if (store.s.darkMode) { - prefer.set('darkTheme', theme.value); + prefer.commit('darkTheme', theme.value); } else { - prefer.set('lightTheme', theme.value); + prefer.commit('lightTheme', theme.value); } changed.value = false; os.alert({ diff --git a/packages/frontend/src/pages/timeline.vue b/packages/frontend/src/pages/timeline.vue index 8d64b0a974..808100cf76 100644 --- a/packages/frontend/src/pages/timeline.vue +++ b/packages/frontend/src/pages/timeline.vue @@ -203,7 +203,7 @@ function saveSrc(newSrc: TimelinePageSrc): void { out.userList = prefer.r.pinnedUserLists.value.find(l => l.id === id) ?? null; } - store.set('tl', out); + store.commit('tl', out); if (['local', 'global'].includes(newSrc)) { srcWhenNotSignin.value = newSrc as 'local' | 'global'; } @@ -212,7 +212,7 @@ function saveSrc(newSrc: TimelinePageSrc): void { function saveTlFilter(key: keyof typeof store.s.tl.filter, newValue: boolean) { if (key !== 'withReplies' || $i) { const out = deepMerge({ filter: { [key]: newValue } }, store.s.tl); - store.set('tl', out); + store.commit('tl', out); } } @@ -233,7 +233,7 @@ function closeTutorial(): void { if (!isBasicTimeline(src.value)) return; const before = store.s.timelineTutorials; before[src.value] = true; - store.set('timelineTutorials', before); + store.commit('timelineTutorials', before); } function switchTlIfNeeded() { diff --git a/packages/frontend/src/pizzax.ts b/packages/frontend/src/pizzax.ts index 6908b87596..8609b4b5cc 100644 --- a/packages/frontend/src/pizzax.ts +++ b/packages/frontend/src/pizzax.ts @@ -44,7 +44,7 @@ export class Pizzax> extends EventEmitter(key: K, value: Data[K]) { + public commit(key: K, value: Data[K]) { this.r[key].value = this.s[key] = value; this.emit('updated', { key, value }); } @@ -84,7 +84,7 @@ export class Pizzax> extends EventEmitter { const val = setter ? setter(value) : value; - this.set(key, val); + this.commit(key, val); valueRef.value = val; }, }); diff --git a/packages/frontend/src/plugin.ts b/packages/frontend/src/plugin.ts index 25d69cd727..35781a64fe 100644 --- a/packages/frontend/src/plugin.ts +++ b/packages/frontend/src/plugin.ts @@ -115,7 +115,7 @@ export async function authorizePlugin(plugin: Plugin) { }); }); - store.set('pluginTokens', { + store.commit('pluginTokens', { ...store.s.pluginTokens, [plugin.installId]: token, }); @@ -145,7 +145,7 @@ export async function installPlugin(code: string, meta?: AiScriptPluginMeta) { src: code, }; - prefer.set('plugins', prefer.s.plugins.concat(plugin)); + prefer.commit('plugins', prefer.s.plugins.concat(plugin)); await authorizePlugin(plugin); @@ -154,14 +154,14 @@ export async function installPlugin(code: string, meta?: AiScriptPluginMeta) { export async function uninstallPlugin(plugin: Plugin) { abortPlugin(plugin); - prefer.set('plugins', prefer.s.plugins.filter(x => x.installId !== plugin.installId)); + prefer.commit('plugins', prefer.s.plugins.filter(x => x.installId !== plugin.installId)); if (Object.hasOwn(store.s.pluginTokens, plugin.installId)) { await os.apiWithDialog('i/revoke-token', { token: store.s.pluginTokens[plugin.installId], }); const pluginTokens = { ...store.s.pluginTokens }; delete pluginTokens[plugin.installId]; - store.set('pluginTokens', pluginTokens); + store.commit('pluginTokens', pluginTokens); } } @@ -311,13 +311,13 @@ export async function configPlugin(plugin: Plugin) { const { canceled, result } = await os.form(plugin.name, config); if (canceled) return; - prefer.set('plugins', prefer.s.plugins.map(x => x.installId === plugin.installId ? { ...x, configData: result } : x)); + prefer.commit('plugins', prefer.s.plugins.map(x => x.installId === plugin.installId ? { ...x, configData: result } : x)); reloadPlugin(plugin); } export function changePluginActive(plugin: Plugin, active: boolean) { - prefer.set('plugins', prefer.s.plugins.map(x => x.installId === plugin.installId ? { ...x, active } : x)); + prefer.commit('plugins', prefer.s.plugins.map(x => x.installId === plugin.installId ? { ...x, active } : x)); if (active) { launchPlugin(plugin.installId); diff --git a/packages/frontend/src/preferences/profile.ts b/packages/frontend/src/preferences/profile.ts index 146373039c..c693112937 100644 --- a/packages/frontend/src/preferences/profile.ts +++ b/packages/frontend/src/preferences/profile.ts @@ -222,7 +222,7 @@ export class ProfileManager extends EventEmitter<{ text: i18n.ts.resetToDefaultValue, danger: true, action: () => { - this.store.set(key, PREF_DEF[key].default); + this.store.commit(key, PREF_DEF[key].default); }, }, { type: 'divider', diff --git a/packages/frontend/src/preferences/utility.ts b/packages/frontend/src/preferences/utility.ts index 64b2bde4de..064eb0e8cf 100644 --- a/packages/frontend/src/preferences/utility.ts +++ b/packages/frontend/src/preferences/utility.ts @@ -34,9 +34,9 @@ export function getPreferencesProfileMenu(): MenuItem[] { return; } - store.set('enablePreferencesAutoCloudBackup', true); + store.commit('enablePreferencesAutoCloudBackup', true); } else { - store.set('enablePreferencesAutoCloudBackup', false); + store.commit('enablePreferencesAutoCloudBackup', false); } }); @@ -183,7 +183,7 @@ export async function restoreFromCloudBackup() { miLocalStorage.setItem('preferences', JSON.stringify(profile)); miLocalStorage.setItem('hidePreferencesRestoreSuggestion', 'true'); - store.set('enablePreferencesAutoCloudBackup', true); + store.commit('enablePreferencesAutoCloudBackup', true); shouldSuggestRestoreBackup.value = false; unisonReload(); } @@ -197,7 +197,7 @@ export async function enableAutoBackup() { return; } - store.set('enablePreferencesAutoCloudBackup', true); + store.commit('enablePreferencesAutoCloudBackup', true); } export const shouldSuggestRestoreBackup = ref(false); diff --git a/packages/frontend/src/theme-store.ts b/packages/frontend/src/theme-store.ts index c02005a15c..5d09ec27f9 100644 --- a/packages/frontend/src/theme-store.ts +++ b/packages/frontend/src/theme-store.ts @@ -23,11 +23,11 @@ export async function addTheme(theme: Theme): Promise { if (themes.some(t => t.id === theme.id)) { throw new Error('already exists'); } - prefer.set('themes', [...themes, theme]); + prefer.commit('themes', [...themes, theme]); } export async function removeTheme(theme: Theme): Promise { if ($i == null) return; const themes = getThemes().filter(t => t.id !== theme.id); - prefer.set('themes', themes); + prefer.commit('themes', themes); } diff --git a/packages/frontend/src/ui/_common_/navbar.vue b/packages/frontend/src/ui/_common_/navbar.vue index bd5e0bba8a..753fde5ea9 100644 --- a/packages/frontend/src/ui/_common_/navbar.vue +++ b/packages/frontend/src/ui/_common_/navbar.vue @@ -128,7 +128,7 @@ watch(store.r.menuDisplay, () => { }); function toggleIconOnly() { - store.set('menuDisplay', iconOnly.value ? 'sideFull' : 'sideIcon'); + store.commit('menuDisplay', iconOnly.value ? 'sideFull' : 'sideIcon'); } function openAccountMenu(ev: MouseEvent) { diff --git a/packages/frontend/src/ui/classic.vue b/packages/frontend/src/ui/classic.vue index 3d4e8ed19d..3faacc5125 100644 --- a/packages/frontend/src/ui/classic.vue +++ b/packages/frontend/src/ui/classic.vue @@ -144,7 +144,7 @@ if (window.innerWidth < 1024) { document.documentElement.style.overflowY = 'scroll'; if (prefer.s.widgets.length === 0) { - prefer.set('widgets', [{ + prefer.commit('widgets', [{ name: 'calendar', id: 'a', place: null, data: {}, }, { diff --git a/packages/frontend/src/ui/deck.vue b/packages/frontend/src/ui/deck.vue index 08f8ca4f65..d7a336b775 100644 --- a/packages/frontend/src/ui/deck.vue +++ b/packages/frontend/src/ui/deck.vue @@ -222,7 +222,7 @@ function changeProfile(ev: MouseEvent) { items.push(...(profiles.filter(k => k !== store.s['deck.profile']).map(k => ({ text: k, action: () => { - store.set('deck.profile', k); + store.commit('deck.profile', k); unisonReload(); }, }))), { type: 'divider' as const }, { @@ -237,7 +237,7 @@ function changeProfile(ev: MouseEvent) { if (canceled || name == null) return; os.promiseDialog((async () => { - await store.set('deck.profile', name); + await store.commit('deck.profile', name); await forceSaveDeck(); })(), () => { unisonReload(); @@ -258,13 +258,13 @@ async function deleteProfile() { os.promiseDialog((async () => { if (store.s['deck.profile'] === 'default') { - await store.set('deck.columns', []); - await store.set('deck.layout', []); + await store.commit('deck.columns', []); + await store.commit('deck.layout', []); await forceSaveDeck(); } else { await deleteProfile_(store.s['deck.profile']); } - await store.set('deck.profile', 'default'); + await store.commit('deck.profile', 'default'); })(), () => { unisonReload(); }); diff --git a/packages/frontend/src/ui/universal.vue b/packages/frontend/src/ui/universal.vue index 633eca7542..8d0015a046 100644 --- a/packages/frontend/src/ui/universal.vue +++ b/packages/frontend/src/ui/universal.vue @@ -178,7 +178,7 @@ if (window.innerWidth > 1024) { } if (prefer.s.widgets.length === 0) { - prefer.set('widgets', [{ + prefer.commit('widgets', [{ name: 'calendar', id: 'a', place: 'right', data: {}, }, { diff --git a/packages/frontend/src/ui/universal.widgets.vue b/packages/frontend/src/ui/universal.widgets.vue index ea2b7f2cf2..1a6d62e19b 100644 --- a/packages/frontend/src/ui/universal.widgets.vue +++ b/packages/frontend/src/ui/universal.widgets.vue @@ -37,18 +37,18 @@ const widgets = computed(() => { }); function addWidget(widget) { - prefer.set('widgets', [{ + prefer.commit('widgets', [{ ...widget, place: props.place, }, ...prefer.s.widgets]); } function removeWidget(widget) { - prefer.set('widgets', prefer.s.widgets.filter(w => w.id !== widget.id)); + prefer.commit('widgets', prefer.s.widgets.filter(w => w.id !== widget.id)); } function updateWidget({ id, data }) { - prefer.set('widgets', prefer.s.widgets.map(w => w.id === id ? { + prefer.commit('widgets', prefer.s.widgets.map(w => w.id === id ? { ...w, data, place: props.place, @@ -57,17 +57,17 @@ function updateWidget({ id, data }) { function updateWidgets(thisWidgets) { if (props.place === null) { - prefer.set('widgets', thisWidgets); + prefer.commit('widgets', thisWidgets); return; } if (props.place === 'left') { - prefer.set('widgets', [ + prefer.commit('widgets', [ ...thisWidgets.map(w => ({ ...w, place: 'left' })), ...prefer.s.widgets.filter(w => w.place !== 'left' && !thisWidgets.some(t => w.id === t.id)), ]); return; } - prefer.set('widgets', [ + prefer.commit('widgets', [ ...prefer.s.widgets.filter(w => w.place === 'left' && !thisWidgets.some(t => w.id === t.id)), ...thisWidgets.map(w => ({ ...w, place: 'right' })), ]); diff --git a/packages/frontend/src/widgets/WidgetMemo.vue b/packages/frontend/src/widgets/WidgetMemo.vue index 3df5c5bfd7..b92ac6fdd8 100644 --- a/packages/frontend/src/widgets/WidgetMemo.vue +++ b/packages/frontend/src/widgets/WidgetMemo.vue @@ -53,7 +53,7 @@ const changed = ref(false); let timeoutId; const saveMemo = () => { - store.set('memo', text.value); + store.commit('memo', text.value); changed.value = false; };