From b35c3114c80855e4eb5e208f088200f995460b3a Mon Sep 17 00:00:00 2001 From: syuilo Date: Wed, 6 Jul 2022 06:36:14 +0900 Subject: [PATCH 01/12] revert: feat: styled error screen (#8930) --- packages/backend/src/server/web/boot.js | 43 ++------ packages/backend/src/server/web/error.css | 98 ------------------- .../backend/src/server/web/views/base.pug | 2 +- .../backend/src/server/web/views/flush.pug | 6 -- 4 files changed, 11 insertions(+), 138 deletions(-) delete mode 100644 packages/backend/src/server/web/error.css diff --git a/packages/backend/src/server/web/boot.js b/packages/backend/src/server/web/boot.js index e82de8e14..9fc536555 100644 --- a/packages/backend/src/server/web/boot.js +++ b/packages/backend/src/server/web/boot.js @@ -106,39 +106,15 @@ function renderError(code, details) { let errorsElement = document.getElementById('errors'); if (!errorsElement) { - document.getElementsByTagName("head")[0].insertAdjacentHTML( - "beforeend", - ``); document.documentElement.innerHTML = ` - - - - - -

An error has occurred!

- -

Don't worry, it's (probably) not your fault.

-

If the problem persists after refreshing, please contact your instance's administrator.
You may also try the following options:

- - - -
- - - -
- - - -
+

⚠ An error has occurred. ⚠

+

If the problem persists, please contact the administrator. You may also try the following options:

+ +
`; @@ -146,7 +122,8 @@ } const detailsElement = document.createElement('details'); - detailsElement.innerHTML = `
ERROR CODE: ${code}${JSON.stringify(details)}`; + detailsElement.innerHTML = `ERROR CODE: ${code}${JSON.stringify(details)}`; + errorsElement.appendChild(detailsElement); } diff --git a/packages/backend/src/server/web/error.css b/packages/backend/src/server/web/error.css deleted file mode 100644 index 9f8f90501..000000000 --- a/packages/backend/src/server/web/error.css +++ /dev/null @@ -1,98 +0,0 @@ -* { - font-family: BIZ UDGothic, Roboto, HelveticaNeue, Arial, sans-serif; -} - -body, -html { - background-color: #222; - color: #dfddcc; - justify-content: center; - margin: auto; - width: 80%; - padding: 10px; - text-align: center; -} - -button { - border-radius: 999px; - padding: 0px 12px 0px 12px; - border: none; - cursor: pointer; - margin-bottom: 12px; -} - -.button-big { - background: linear-gradient(90deg, rgb(134, 179, 0), rgb(74, 179, 0)); - line-height: 50px; -} - -.button-big:hover { - background: rgb(153, 204, 0); -} - -.button-small { - background: #444; - line-height: 40px; -} - -.button-small:hover { - background: #555; -} - -.button-label-big { - color: #222; - font-weight: bold; - font-size: 20px; - padding: 12px; -} - -.button-label-small { - color: rgb(153, 204, 0); - font-size: 16px; - padding: 12px; -} - -a { - color: rgb(134, 179, 0); - text-decoration: none; -} - -p, -li { - font-size: 16px; -} - -.dont-worry, -#msg { - font-size: 18px; -} - -.icon-warning { - color: #dec340; - height: 4rem; -} - -h1 { - font-size: 32px; -} - -code { - font-family: Fira, FiraCode, monospace; -} - -details { - background: #333; - margin-bottom: 2rem; - padding: 0.5rem 1rem; - border-radius: 5px; - justify-content: center; - margin: auto; -} - -summary { - cursor: pointer; -} - -summary > * { - display: inline; -} diff --git a/packages/backend/src/server/web/views/base.pug b/packages/backend/src/server/web/views/base.pug index 32499aa45..5bb156f0f 100644 --- a/packages/backend/src/server/web/views/base.pug +++ b/packages/backend/src/server/web/views/base.pug @@ -53,7 +53,7 @@ html block meta block og - meta(property='og:title' content= title || 'Misskey') + meta(property='og:title' content= title || 'Misskey') meta(property='og:description' content= desc || '✨🌎✨ A interplanetary communication platform ✨🚀✨') meta(property='og:image' content= img) diff --git a/packages/backend/src/server/web/views/flush.pug b/packages/backend/src/server/web/views/flush.pug index b08f61c73..ec585a34d 100644 --- a/packages/backend/src/server/web/views/flush.pug +++ b/packages/backend/src/server/web/views/flush.pug @@ -1,12 +1,6 @@ doctype html html - head - meta(charset='utf-8') - meta(name='application-name' content='Misskey') - title Flushing Misskey - style - include ../error.css #msg script. const msg = document.getElementById('msg'); From efafc31c9b52b0a306736fdacd2298e1ae8b5fa0 Mon Sep 17 00:00:00 2001 From: syuilo Date: Wed, 6 Jul 2022 07:08:45 +0900 Subject: [PATCH 02/12] =?UTF-8?q?fix(client):=20=E3=83=86=E3=83=BC?= =?UTF-8?q?=E3=83=9E=E3=82=92=E4=BD=9C=E6=88=90=E3=81=99=E3=82=8B=E3=81=A8?= =?UTF-8?q?=E3=82=AF=E3=83=A9=E3=82=A4=E3=82=A2=E3=83=B3=E3=83=88=E3=81=8C?= =?UTF-8?q?=E8=B5=B7=E5=8B=95=E3=81=97=E3=81=AA=E3=81=8F=E3=81=AA=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/client/src/pages/settings/theme.vue | 10 ++++++++-- packages/client/src/pages/theme-editor.vue | 2 +- packages/client/src/store.ts | 8 ++++++++ 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/packages/client/src/pages/settings/theme.vue b/packages/client/src/pages/settings/theme.vue index 1bdad3e75..d330e1ba2 100644 --- a/packages/client/src/pages/settings/theme.vue +++ b/packages/client/src/pages/settings/theme.vue @@ -97,7 +97,10 @@ const darkThemeId = computed({ return darkTheme.value.id; }, set(id) { - ColdDeviceStorage.set('darkTheme', themes.value.find(x => x.id === id)); + const t = themes.value.find(x => x.id === id); + if (t) { // テーマエディタでテーマを作成したときなどは、themesに反映されないため undefined になる + ColdDeviceStorage.set('darkTheme', t); + } }, }); const lightTheme = ColdDeviceStorage.ref('lightTheme'); @@ -106,7 +109,10 @@ const lightThemeId = computed({ return lightTheme.value.id; }, set(id) { - ColdDeviceStorage.set('lightTheme', themes.value.find(x => x.id === id)); + const t = themes.value.find(x => x.id === id); + if (t) { // テーマエディタでテーマを作成したときなどは、themesに反映されないため undefined になる + ColdDeviceStorage.set('lightTheme', t); + } }, }); const darkMode = computed(defaultStore.makeGetterSetter('darkMode')); diff --git a/packages/client/src/pages/theme-editor.vue b/packages/client/src/pages/theme-editor.vue index 44b5a05f2..548e60614 100644 --- a/packages/client/src/pages/theme-editor.vue +++ b/packages/client/src/pages/theme-editor.vue @@ -192,7 +192,7 @@ async function saveAs() { theme.name = name; theme.author = `@${$i.username}@${toUnicode(host)}`; if (description) theme.desc = description; - addTheme(theme); + await addTheme(theme); applyTheme(theme); if (defaultStore.state.darkMode) { ColdDeviceStorage.set('darkTheme', theme); diff --git a/packages/client/src/store.ts b/packages/client/src/store.ts index d87e05a4d..503333331 100644 --- a/packages/client/src/store.ts +++ b/packages/client/src/store.ts @@ -304,6 +304,14 @@ export class ColdDeviceStorage { } public static set(key: T, value: typeof ColdDeviceStorage.default[T]): void { + // 呼び出し側のバグ等で undefined が来ることがある + // undefined を文字列として localStorage に入れると参照する際の JSON.parse でコケて不具合の元になるため無視 + // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition + if (value === undefined) { + console.error(`attempt to store undefined value for key '${key}'`); + return; + } + localStorage.setItem(PREFIX + key, JSON.stringify(value)); for (const watcher of this.watchers) { From 38d5303ccd067e67f11ae130b643713f6ca86eef Mon Sep 17 00:00:00 2001 From: syuilo Date: Wed, 6 Jul 2022 07:26:58 +0900 Subject: [PATCH 03/12] revert emoji picker changes --- .../src/components/emoji-picker.section.vue | 7 ++- .../client/src/components/emoji-picker.vue | 50 ++++++++++--------- 2 files changed, 29 insertions(+), 28 deletions(-) diff --git a/packages/client/src/components/emoji-picker.section.vue b/packages/client/src/components/emoji-picker.section.vue index e2a80d546..901bc76ac 100644 --- a/packages/client/src/components/emoji-picker.section.vue +++ b/packages/client/src/components/emoji-picker.section.vue @@ -1,17 +1,16 @@