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