Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
syuilo committed Feb 9, 2022
2 parents 5f985ee + 25cac33 commit 08da5e9
Show file tree
Hide file tree
Showing 13 changed files with 65 additions and 17 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,19 @@
You should also include the user name that made the change.
-->

## 12.105.0 (2022/02/09)

### Improvements
- インスタンスのテーマカラーを設定できるように @syuilo

### Bugfixes
- 一部環境でマイグレーションが失敗する問題を修正 @syuilo

## 12.104.0 (2022/02/09)

### Note
ビルドする前に`npm run clean`を実行してください。

このリリースはマイグレーションの規模が大きいため、インスタンスによってはマイグレーションに時間がかかる可能性があります。
マイグレーションが終わらない場合は、チャートの情報はリセットされてしまいますが`__chart__`で始まるテーブルの**レコード**を全て削除(テーブル自体は消さないでください)してから再度試す方法もあります。

Expand Down
1 change: 1 addition & 0 deletions locales/ja-JP.yml
Original file line number Diff line number Diff line change
Expand Up @@ -828,6 +828,7 @@ overridedDeviceKind: "デバイスタイプ"
smartphone: "スマートフォン"
tablet: "タブレット"
auto: "自動"
themeColor: "テーマカラー"

_emailUnavailable:
used: "既に使用されています"
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "misskey",
"version": "12.104.0",
"version": "12.105.0",
"codename": "indigo",
"repository": {
"type": "git",
Expand Down
14 changes: 2 additions & 12 deletions packages/backend/migration/1644058404077-chart-v7.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions packages/backend/migration/1644395759931-instance-theme-color.js
Original file line number Diff line number Diff line change
@@ -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"`);
}
}
6 changes: 6 additions & 0 deletions packages/backend/src/models/entities/meta.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ export const meta = {
validator: $.optional.nullable.arr($.str),
},

themeColor: {
validator: $.optional.nullable.str,
},

mascotImageUrl: {
validator: $.optional.nullable.str,
},
Expand Down Expand Up @@ -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;
}
Expand Down
1 change: 1 addition & 0 deletions packages/backend/src/server/api/endpoints/meta.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
7 changes: 7 additions & 0 deletions packages/backend/src/server/web/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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)) {
Expand Down Expand Up @@ -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)) {
Expand Down Expand Up @@ -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');
Expand All @@ -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');
Expand All @@ -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');
Expand Down Expand Up @@ -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');
});
Expand Down
1 change: 1 addition & 0 deletions packages/backend/src/server/web/manifest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions packages/backend/src/server/web/views/base.pug
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
6 changes: 4 additions & 2 deletions packages/client/src/components/post-form.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
9 changes: 9 additions & 0 deletions packages/client/src/pages/admin/settings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@
<template #label>{{ $ts.backgroundImageUrl }}</template>
</FormInput>

<FormInput v-model="themeColor" class="_formBlock">
<template #prefix><i class="fas fa-palette"></i></template>
<template #label>{{ $ts.themeColor }}</template>
<template #caption>#RRGGBB</template>
</FormInput>

<FormInput v-model="tosUrl" class="_formBlock">
<template #prefix><i class="fas fa-link"></i></template>
<template #label>{{ $ts.tosUrl }}</template>
Expand Down Expand Up @@ -179,6 +185,7 @@ export default defineComponent({
iconUrl: null,
bannerUrl: null,
backgroundImageUrl: null,
themeColor: null,
maxNoteTextLength: 0,
enableLocalTimeline: false,
enableGlobalTimeline: false,
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 08da5e9

Please sign in to comment.