From b59a19c144e9e8c5273cf188f23462370f9b7288 Mon Sep 17 00:00:00 2001 From: syuilo Date: Tue, 13 Jul 2021 23:30:12 +0900 Subject: [PATCH 01/11] Fix #7576 --- src/client/scripts/select-file.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/client/scripts/select-file.ts b/src/client/scripts/select-file.ts index b8039fb670..9d7146e215 100644 --- a/src/client/scripts/select-file.ts +++ b/src/client/scripts/select-file.ts @@ -1,5 +1,6 @@ import * as os from '@client/os'; import { i18n } from '@client/i18n'; +import { defaultStore } from '@client/store'; export function selectFile(src: any, label: string | null, multiple = false) { return new Promise((res, rej) => { @@ -8,7 +9,7 @@ export function selectFile(src: any, label: string | null, multiple = false) { input.type = 'file'; input.multiple = multiple; input.onchange = () => { - const promises = Array.from(input.files).map(file => os.upload(file)); + const promises = Array.from(input.files).map(file => os.upload(file, defaultStore.state.uploadFolder)); Promise.all(promises).then(driveFiles => { res(multiple ? driveFiles : driveFiles[0]); @@ -57,6 +58,7 @@ export function selectFile(src: any, label: string | null, multiple = false) { os.api('drive/files/upload-from-url', { url: url, + folderId: defaultStore.state.uploadFolder, marker }); From 1dbe03b210f16e105304d555b457df0bb8f38fcf Mon Sep 17 00:00:00 2001 From: syuilo Date: Tue, 13 Jul 2021 23:30:20 +0900 Subject: [PATCH 02/11] refactor --- src/client/store.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/client/store.ts b/src/client/store.ts index 1a3286554d..07ea1868a6 100644 --- a/src/client/store.ts +++ b/src/client/store.ts @@ -37,7 +37,7 @@ export const defaultStore = markRaw(new Storage('base', { }, uploadFolder: { where: 'account', - default: null + default: null as string | null }, pastedFileName: { where: 'account', From 2047860e717f1738c21dbed88546da23e8d867a3 Mon Sep 17 00:00:00 2001 From: syuilo Date: Tue, 13 Jul 2021 23:30:36 +0900 Subject: [PATCH 03/11] Use unisonReload --- src/client/pages/settings/sidebar.vue | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/client/pages/settings/sidebar.vue b/src/client/pages/settings/sidebar.vue index f0172e945f..d91cae42f4 100644 --- a/src/client/pages/settings/sidebar.vue +++ b/src/client/pages/settings/sidebar.vue @@ -29,6 +29,7 @@ import * as os from '@client/os'; import { sidebarDef } from '@client/sidebar'; import { defaultStore } from '@client/store'; import * as symbols from '@client/symbols'; +import { unisonReload } from '@client/scripts/unison-reload'; export default defineComponent({ components: { @@ -106,7 +107,7 @@ export default defineComponent({ }); if (canceled) return; - location.reload(); + unisonReload(); } }, }); From c7a2c368d41219c362c91e6a756265b33d129f44 Mon Sep 17 00:00:00 2001 From: syuilo Date: Wed, 14 Jul 2021 00:11:05 +0900 Subject: [PATCH 04/11] Custom CSS --- locales/ja-JP.yml | 3 + src/client/pages/settings/custom-css.vue | 72 ++++++++++++++++++++++++ src/client/pages/settings/general.vue | 2 + src/client/pages/settings/index.vue | 1 + src/server/web/boot.js | 7 +++ 5 files changed, 85 insertions(+) create mode 100644 src/client/pages/settings/custom-css.vue diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index 9e500f6130..a92d838388 100644 --- a/locales/ja-JP.yml +++ b/locales/ja-JP.yml @@ -761,6 +761,9 @@ middle: "中" low: "低" emailNotConfiguredWarning: "メールアドレスの設定がされていません。" ratio: "比率" +customCss: "カスタムCSS" +customCssWarn: "この設定は必ず知識のある方が行ってください。不適切な設定を行うとクライアントが正常に使用できなくなる恐れがあります。" +global: "グローバル" _ad: back: "戻る" diff --git a/src/client/pages/settings/custom-css.vue b/src/client/pages/settings/custom-css.vue new file mode 100644 index 0000000000..0781eeebd7 --- /dev/null +++ b/src/client/pages/settings/custom-css.vue @@ -0,0 +1,72 @@ + + + diff --git a/src/client/pages/settings/general.vue b/src/client/pages/settings/general.vue index fdbae0b8a1..9dbc103145 100644 --- a/src/client/pages/settings/general.vue +++ b/src/client/pages/settings/general.vue @@ -78,6 +78,8 @@ {{ $ts.deck }} + + {{ $ts.customCss }} diff --git a/src/client/pages/settings/index.vue b/src/client/pages/settings/index.vue index 3fd10fc44f..8a0171a6e8 100644 --- a/src/client/pages/settings/index.vue +++ b/src/client/pages/settings/index.vue @@ -123,6 +123,7 @@ export default defineComponent({ case 'theme/manage': return defineAsyncComponent(() => import('./theme.manage.vue')); case 'sidebar': return defineAsyncComponent(() => import('./sidebar.vue')); case 'sounds': return defineAsyncComponent(() => import('./sounds.vue')); + case 'custom-css': return defineAsyncComponent(() => import('./custom-css.vue')); case 'deck': return defineAsyncComponent(() => import('./deck.vue')); case 'plugin': return defineAsyncComponent(() => import('./plugin.vue')); case 'plugin/install': return defineAsyncComponent(() => import('./plugin.install.vue')); diff --git a/src/server/web/boot.js b/src/server/web/boot.js index 1c94e6e4f4..e2fd137f95 100644 --- a/src/server/web/boot.js +++ b/src/server/web/boot.js @@ -107,6 +107,13 @@ document.documentElement.style.backgroundImage = `url(${wallpaper})`; } + const customCss = localStorage.getItem('customCss'); + if (customCss && customCss.length > 0) { + const style = document.createElement('style'); + style.innerHTML = customCss; + head.appendChild(style); + } + // eslint-disable-next-line no-inner-declarations function renderError(code, details) { document.documentElement.innerHTML = ` From ab439d0ed6e3bc61fd7ef6087f5c73152821933d Mon Sep 17 00:00:00 2001 From: syuilo Date: Wed, 14 Jul 2021 00:12:34 +0900 Subject: [PATCH 05/11] Clean up --- src/client/init.ts | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/src/client/init.ts b/src/client/init.ts index 12bb0d58c1..d1c408bb77 100644 --- a/src/client/init.ts +++ b/src/client/init.ts @@ -34,18 +34,6 @@ console.info(`Misskey v${version}`); window.onerror = null; window.onunhandledrejection = null; -// 後方互換性のため。 -// TODO: そのうち消す -if ((typeof ColdDeviceStorage.get('lightTheme') === 'string') || (typeof ColdDeviceStorage.get('darkTheme') === 'string')) { - ColdDeviceStorage.set('lightTheme', require('@client/themes/l-light.json5')); - ColdDeviceStorage.set('darkTheme', require('@client/themes/d-dark.json5')); -} -const link = document.createElement('link'); -link.rel = 'stylesheet'; -link.href = 'https://use.fontawesome.com/releases/v5.15.3/css/all.css'; -document.head.appendChild(link); -// TODOここまで - if (_DEV_) { console.warn('Development mode!!!'); From 6812b895e7b7b68b884d35523ed92a5e9a5b98a3 Mon Sep 17 00:00:00 2001 From: syuilo Date: Wed, 14 Jul 2021 00:13:23 +0900 Subject: [PATCH 06/11] Revert "Resolve #6811" This reverts commit 558d288e7bc129fa92ee7dd1dc08d5a9f3615f8f. --- src/client/components/media-list.vue | 49 +++++++++++++++++++++++++--- 1 file changed, 45 insertions(+), 4 deletions(-) diff --git a/src/client/components/media-list.vue b/src/client/components/media-list.vue index 1b85578652..71767a0f9f 100644 --- a/src/client/components/media-list.vue +++ b/src/client/components/media-list.vue @@ -1,8 +1,8 @@