From 04b41248ce8a5ddd495f6dcb5bc6c03feeae0365 Mon Sep 17 00:00:00 2001 From: syuilo Date: Wed, 9 Feb 2022 15:08:31 +0900 Subject: [PATCH 1/6] Update CHANGELOG.md --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b60a85cf1..5476ba450 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,8 @@ You should also include the user name that made the change. ## 12.104.0 (2022/02/09) ### Note +ビルドする前に`npm run clean`を実行してください。 + このリリースはマイグレーションの規模が大きいため、インスタンスによってはマイグレーションに時間がかかる可能性があります。 マイグレーションが終わらない場合は、チャートの情報はリセットされてしまいますが`__chart__`で始まるテーブルの**レコード**を全て削除(テーブル自体は消さないでください)してから再度試す方法もあります。 From 042b0c2f1800134eeb120638f36694b746c436f4 Mon Sep 17 00:00:00 2001 From: syuilo Date: Wed, 9 Feb 2022 21:12:20 +0900 Subject: [PATCH 2/6] fix: truncate user drive chart --- .../backend/migration/1644058404077-chart-v7.js | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/packages/backend/migration/1644058404077-chart-v7.js b/packages/backend/migration/1644058404077-chart-v7.js index a462a7cd3..a982b6cb6 100644 --- a/packages/backend/migration/1644058404077-chart-v7.js +++ b/packages/backend/migration/1644058404077-chart-v7.js @@ -158,18 +158,8 @@ module.exports = class chartV71644058404077 { await queryRunner.query(`UPDATE "__chart_day__per_user_following" SET "___remote_followers_total"=2147483647 WHERE "___remote_followers_total" > 2147483647`); await queryRunner.query(`UPDATE "__chart_day__per_user_following" SET "___remote_followers_inc"=32767 WHERE "___remote_followers_inc" > 32767`); await queryRunner.query(`UPDATE "__chart_day__per_user_following" SET "___remote_followers_dec"=32767 WHERE "___remote_followers_dec" > 32767`); - await queryRunner.query(`UPDATE "__chart__per_user_drive" SET "___totalCount"=2147483647 WHERE "___totalCount" > 2147483647`); - await queryRunner.query(`UPDATE "__chart__per_user_drive" SET "___totalSize"=2147483647 WHERE "___totalSize" > 2147483647`); - await queryRunner.query(`UPDATE "__chart__per_user_drive" SET "___incCount"=32767 WHERE "___incCount" > 32767`); - await queryRunner.query(`UPDATE "__chart__per_user_drive" SET "___incSize"=2147483647 WHERE "___incSize" > 2147483647`); - await queryRunner.query(`UPDATE "__chart__per_user_drive" SET "___decCount"=32767 WHERE "___decCount" > 32767`); - await queryRunner.query(`UPDATE "__chart__per_user_drive" SET "___decSize"=2147483647 WHERE "___decSize" > 2147483647`); - await queryRunner.query(`UPDATE "__chart_day__per_user_drive" SET "___totalCount"=2147483647 WHERE "___totalCount" > 2147483647`); - await queryRunner.query(`UPDATE "__chart_day__per_user_drive" SET "___totalSize"=2147483647 WHERE "___totalSize" > 2147483647`); - await queryRunner.query(`UPDATE "__chart_day__per_user_drive" SET "___incCount"=32767 WHERE "___incCount" > 32767`); - await queryRunner.query(`UPDATE "__chart_day__per_user_drive" SET "___incSize"=2147483647 WHERE "___incSize" > 2147483647`); - await queryRunner.query(`UPDATE "__chart_day__per_user_drive" SET "___decCount"=32767 WHERE "___decCount" > 32767`); - await queryRunner.query(`UPDATE "__chart_day__per_user_drive" SET "___decSize"=2147483647 WHERE "___decSize" > 2147483647`); + await queryRunner.query(`TRUNCATE TABLE "__chart__per_user_drive"`); + await queryRunner.query(`TRUNCATE TABLE "__chart_day__per_user_drive"`); await queryRunner.query(`ALTER TABLE "__chart__federation" ALTER COLUMN "___instance_total" TYPE integer USING "___instance_total"::integer`); await queryRunner.query(`ALTER TABLE "__chart__federation" ALTER COLUMN "___instance_inc" TYPE smallint USING "___instance_inc"::smallint`); From 4ae1a659588a649f9b4f795840ac70b5be081dc6 Mon Sep 17 00:00:00 2001 From: syuilo Date: Wed, 9 Feb 2022 21:25:48 +0900 Subject: [PATCH 3/6] =?UTF-8?q?feat:=20=E3=82=A4=E3=83=B3=E3=82=B9?= =?UTF-8?q?=E3=82=BF=E3=83=B3=E3=82=B9=E3=81=AE=E3=83=86=E3=83=BC=E3=83=9E?= =?UTF-8?q?=E3=82=AB=E3=83=A9=E3=83=BC=E3=82=92=E8=A8=AD=E5=AE=9A=E3=81=A7?= =?UTF-8?q?=E3=81=8D=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 9 +++++++++ locales/ja-JP.yml | 1 + .../migration/1644395759931-instance-theme-color.js | 13 +++++++++++++ packages/backend/src/models/entities/meta.ts | 6 ++++++ .../src/server/api/endpoints/admin/update-meta.ts | 8 ++++++++ packages/backend/src/server/api/endpoints/meta.ts | 1 + packages/backend/src/server/web/index.ts | 7 +++++++ packages/backend/src/server/web/manifest.ts | 1 + packages/backend/src/server/web/views/base.pug | 4 ++-- packages/client/src/pages/admin/settings.vue | 9 +++++++++ 10 files changed, 57 insertions(+), 2 deletions(-) create mode 100644 packages/backend/migration/1644395759931-instance-theme-color.js diff --git a/CHANGELOG.md b/CHANGELOG.md index 5476ba450..b5d8cd9f3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,15 @@ You should also include the user name that made the change. --> +## 12.x.x (unreleased) + +### Improvements +- インスタンスのテーマカラーを設定できるように @syuilo + +### Bugfixes +- + + ## 12.104.0 (2022/02/09) ### Note diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index ac8d4951a..62d558704 100644 --- a/locales/ja-JP.yml +++ b/locales/ja-JP.yml @@ -828,6 +828,7 @@ overridedDeviceKind: "デバイスタイプ" smartphone: "スマートフォン" tablet: "タブレット" auto: "自動" +themeColor: "テーマカラー" _emailUnavailable: used: "既に使用されています" diff --git a/packages/backend/migration/1644395759931-instance-theme-color.js b/packages/backend/migration/1644395759931-instance-theme-color.js new file mode 100644 index 000000000..4fda26f9e --- /dev/null +++ b/packages/backend/migration/1644395759931-instance-theme-color.js @@ -0,0 +1,13 @@ +const { MigrationInterface, QueryRunner } = require("typeorm"); + +module.exports = class instanceThemeColor1644395759931 { + name = 'instanceThemeColor1644395759931' + + async up(queryRunner) { + await queryRunner.query(`ALTER TABLE "meta" ADD "themeColor" character varying(512)`); + } + + async down(queryRunner) { + await queryRunner.query(`ALTER TABLE "meta" DROP COLUMN "themeColor"`); + } +} diff --git a/packages/backend/src/models/entities/meta.ts b/packages/backend/src/models/entities/meta.ts index c462d5ade..1426c79c5 100644 --- a/packages/backend/src/models/entities/meta.ts +++ b/packages/backend/src/models/entities/meta.ts @@ -88,6 +88,12 @@ export class Meta { }) public pinnedClipId: Clip['id'] | null; + @Column('varchar', { + length: 512, + nullable: true, + }) + public themeColor: string | null; + @Column('varchar', { length: 512, nullable: true, diff --git a/packages/backend/src/server/api/endpoints/admin/update-meta.ts b/packages/backend/src/server/api/endpoints/admin/update-meta.ts index aa2d1222f..1764d230a 100644 --- a/packages/backend/src/server/api/endpoints/admin/update-meta.ts +++ b/packages/backend/src/server/api/endpoints/admin/update-meta.ts @@ -41,6 +41,10 @@ export const meta = { validator: $.optional.nullable.arr($.str), }, + themeColor: { + validator: $.optional.nullable.str, + }, + mascotImageUrl: { validator: $.optional.nullable.str, }, @@ -331,6 +335,10 @@ export default define(meta, async (ps, me) => { set.blockedHosts = ps.blockedHosts.filter(Boolean); } + if (ps.themeColor !== undefined) { + set.themeColor = ps.themeColor; + } + if (ps.mascotImageUrl !== undefined) { set.mascotImageUrl = ps.mascotImageUrl; } diff --git a/packages/backend/src/server/api/endpoints/meta.ts b/packages/backend/src/server/api/endpoints/meta.ts index 693a7a04e..16ea99af6 100644 --- a/packages/backend/src/server/api/endpoints/meta.ts +++ b/packages/backend/src/server/api/endpoints/meta.ts @@ -499,6 +499,7 @@ export default define(meta, async (ps, me) => { enableRecaptcha: instance.enableRecaptcha, recaptchaSiteKey: instance.recaptchaSiteKey, swPublickey: instance.swPublicKey, + themeColor: instance.themeColor, mascotImageUrl: instance.mascotImageUrl, bannerUrl: instance.bannerUrl, errorImageUrl: instance.errorImageUrl, diff --git a/packages/backend/src/server/web/index.ts b/packages/backend/src/server/web/index.ts index a0667f0c2..325121bba 100644 --- a/packages/backend/src/server/web/index.ts +++ b/packages/backend/src/server/web/index.ts @@ -200,6 +200,7 @@ router.get(['/@:user', '/@:user/:sub'], async (ctx, next) => { sub: ctx.params.sub, instanceName: meta.name || 'Misskey', icon: meta.iconUrl, + themeColor: meta.themeColor, }); ctx.set('Cache-Control', 'public, max-age=30'); } else { @@ -239,6 +240,7 @@ router.get('/notes/:note', async (ctx, next) => { summary: getNoteSummary(_note), instanceName: meta.name || 'Misskey', icon: meta.iconUrl, + themeColor: meta.themeColor, }); if (['public', 'home'].includes(note.visibility)) { @@ -277,6 +279,7 @@ router.get('/@:user/pages/:page', async (ctx, next) => { profile, instanceName: meta.name || 'Misskey', icon: meta.iconUrl, + themeColor: meta.themeColor, }); if (['public'].includes(page.visibility)) { @@ -307,6 +310,7 @@ router.get('/clips/:clip', async (ctx, next) => { profile, instanceName: meta.name || 'Misskey', icon: meta.iconUrl, + themeColor: meta.themeColor, }); ctx.set('Cache-Control', 'public, max-age=180'); @@ -330,6 +334,7 @@ router.get('/gallery/:post', async (ctx, next) => { profile, instanceName: meta.name || 'Misskey', icon: meta.iconUrl, + themeColor: meta.themeColor, }); ctx.set('Cache-Control', 'public, max-age=180'); @@ -353,6 +358,7 @@ router.get('/channels/:channel', async (ctx, next) => { channel: _channel, instanceName: meta.name || 'Misskey', icon: meta.iconUrl, + themeColor: meta.themeColor, }); ctx.set('Cache-Control', 'public, max-age=180'); @@ -412,6 +418,7 @@ router.get('(.*)', async ctx => { instanceName: meta.name || 'Misskey', desc: meta.description, icon: meta.iconUrl, + themeColor: meta.themeColor, }); ctx.set('Cache-Control', 'public, max-age=300'); }); diff --git a/packages/backend/src/server/web/manifest.ts b/packages/backend/src/server/web/manifest.ts index 918fe27c0..464b893d6 100644 --- a/packages/backend/src/server/web/manifest.ts +++ b/packages/backend/src/server/web/manifest.ts @@ -9,6 +9,7 @@ module.exports = async (ctx: Koa.Context) => { json.short_name = instance.name || 'Misskey'; json.name = instance.name || 'Misskey'; + if (instance.themeColor) json.theme_color = instance.themeColor; ctx.set('Cache-Control', 'max-age=300'); ctx.body = json; diff --git a/packages/backend/src/server/web/views/base.pug b/packages/backend/src/server/web/views/base.pug index b8b733dd6..e1cb2cfa9 100644 --- a/packages/backend/src/server/web/views/base.pug +++ b/packages/backend/src/server/web/views/base.pug @@ -19,8 +19,8 @@ html meta(charset='utf-8') meta(name='application-name' content='Misskey') meta(name='referrer' content='origin') - meta(name='theme-color' content='#86b300') - meta(name='theme-color-orig' content='#86b300') + meta(name='theme-color' content= themeColor || '#86b300') + meta(name='theme-color-orig' content= themeColor || '#86b300') meta(property='twitter:card' content='summary') meta(property='og:site_name' content= instanceName || 'Misskey') meta(name='viewport' content='width=device-width, initial-scale=1') diff --git a/packages/client/src/pages/admin/settings.vue b/packages/client/src/pages/admin/settings.vue index a4bac9383..81204f6e2 100644 --- a/packages/client/src/pages/admin/settings.vue +++ b/packages/client/src/pages/admin/settings.vue @@ -25,6 +25,12 @@ + + + + + + @@ -179,6 +185,7 @@ export default defineComponent({ iconUrl: null, bannerUrl: null, backgroundImageUrl: null, + themeColor: null, maxNoteTextLength: 0, enableLocalTimeline: false, enableGlobalTimeline: false, @@ -206,6 +213,7 @@ export default defineComponent({ this.iconUrl = meta.iconUrl; this.bannerUrl = meta.bannerUrl; this.backgroundImageUrl = meta.backgroundImageUrl; + this.themeColor = meta.themeColor; this.maintainerName = meta.maintainerName; this.maintainerEmail = meta.maintainerEmail; this.maxNoteTextLength = meta.maxNoteTextLength; @@ -233,6 +241,7 @@ export default defineComponent({ iconUrl: this.iconUrl, bannerUrl: this.bannerUrl, backgroundImageUrl: this.backgroundImageUrl, + themeColor: this.themeColor === '' ? null : this.themeColor, maintainerName: this.maintainerName, maintainerEmail: this.maintainerEmail, maxNoteTextLength: this.maxNoteTextLength, From 1461da309f5ab9a686a92aab43eb51c6de2b7aa9 Mon Sep 17 00:00:00 2001 From: syuilo Date: Wed, 9 Feb 2022 21:26:25 +0900 Subject: [PATCH 4/6] Update CHANGELOG.md --- CHANGELOG.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b5d8cd9f3..5f54fc015 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,8 +16,7 @@ You should also include the user name that made the change. - インスタンスのテーマカラーを設定できるように @syuilo ### Bugfixes -- - +- 一部環境でマイグレーションが失敗する問題を修正 @syuilo ## 12.104.0 (2022/02/09) From f512b2944338378f10a56f94d59f7101afa3e33a Mon Sep 17 00:00:00 2001 From: syuilo Date: Wed, 9 Feb 2022 21:27:42 +0900 Subject: [PATCH 5/6] chore(client): check textarea exists --- packages/client/src/components/post-form.vue | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/client/src/components/post-form.vue b/packages/client/src/components/post-form.vue index 64a6478f4..656689ddc 100644 --- a/packages/client/src/components/post-form.vue +++ b/packages/client/src/components/post-form.vue @@ -341,8 +341,10 @@ function addTag(tag: string) { } function focus() { - textareaEl.focus(); - textareaEl.setSelectionRange(textareaEl.value.length, textareaEl.value.length); + if (textareaEl) { + textareaEl.focus(); + textareaEl.setSelectionRange(textareaEl.value.length, textareaEl.value.length); + } } function chooseFileFrom(ev) { From 25cac33074fe20adf36f4d9d50675f88f5e92625 Mon Sep 17 00:00:00 2001 From: syuilo Date: Wed, 9 Feb 2022 21:44:32 +0900 Subject: [PATCH 6/6] 12.105.0 --- CHANGELOG.md | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5f54fc015..10a394142 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,7 +10,7 @@ You should also include the user name that made the change. --> -## 12.x.x (unreleased) +## 12.105.0 (2022/02/09) ### Improvements - インスタンスのテーマカラーを設定できるように @syuilo diff --git a/package.json b/package.json index 46dac95db..31a440da1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "misskey", - "version": "12.104.0", + "version": "12.105.0", "codename": "indigo", "repository": { "type": "git",