Skip to content

Commit

Permalink
feat: クライアントのアップデート通知チャンネルを選択できる
Browse files Browse the repository at this point in the history
  • Loading branch information
noridev committed Oct 4, 2023
1 parent 6c4b2bd commit d627cdb
Show file tree
Hide file tree
Showing 11 changed files with 73 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG_CHERRYPICK.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ Misskey의 전체 변경 사항을 확인하려면, [CHANGELOG.md#2023xx](CHANGE
> 문제가 발생하면 '설정 - 캐시 비우기'를 진행하거나, 브라우저 캐시를 삭제하십시오.
### Client
- Feat: 클라이언트 업데이트 알림 채널을 선택할 수 있음
- Enhance: 그룹 대화에서 읽음 표시를 개선
- Fix: 서브 노트 기능 오류
- 서브 노트에서 더 보기 버튼을 사용할 수 없음
Expand Down
1 change: 1 addition & 0 deletions locales/en-US.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
_lang_: "English"
enableReceivePrerelease: "Get notified of pre-release versions"
youAreRunningBetaClient: "Unreleased version of CherryPick in use!"
cherrypickUpdate: "CherryPick Update"
allMediaNoteCollapse: "Collapse all media notes"
Expand Down
1 change: 1 addition & 0 deletions locales/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// Do not edit this file directly.
export interface Locale {
"_lang_": string;
"enableReceivePrerelease": string;
"youAreRunningBetaClient": string;
"cherrypickUpdate": string;
"allMediaNoteCollapse": string;
Expand Down
1 change: 1 addition & 0 deletions locales/ja-JP.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
_lang_: "日本語"

enableReceivePrerelease: "プレリリース版の通知を受け取る"
youAreRunningBetaClient: "未発売バージョンのCherryPickを利用しています!"
cherrypickUpdate: "CherryPickアップデート"
allMediaNoteCollapse: "すべてのメディアノートを省略して表示"
Expand Down
1 change: 1 addition & 0 deletions locales/ko-KR.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
_lang_: "한국어"
enableReceivePrerelease: "출시 전 버전 알림 받기"
youAreRunningBetaClient: "아직 출시되지 않은 버전의 CherryPick를 이용하고 있어요!"
cherrypickUpdate: "CherryPick 업데이트"
allMediaNoteCollapse: "모든 미디어 노트 간략화하기"
Expand Down
16 changes: 16 additions & 0 deletions packages/backend/migration/1696402675000-add-meta-options.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/*
* SPDX-FileCopyrightText: syuilo and noridev and other misskey, cherrypick contributors
* SPDX-License-Identifier: AGPL-3.0-only
*/

export class AddMetaOptions1696402675000 {
name = 'AddMetaOptions1696402675000'

async up(queryRunner) {
await queryRunner.query(`ALTER TABLE "meta" ADD "enableReceivePrerelease" boolean NOT NULL DEFAULT false`);
}

async down(queryRunner) {
await queryRunner.query(`ALTER TABLE "meta" DROP COLUMN "enableReceivePrerelease"`);
}
}
5 changes: 5 additions & 0 deletions packages/backend/src/models/Meta.ts
Original file line number Diff line number Diff line change
Expand Up @@ -589,4 +589,9 @@ export class MiMeta {
length: 1024, array: true, default: '{ "admin", "administrator", "root", "system", "maintainer", "host", "mod", "moderator", "owner", "superuser", "staff", "auth", "i", "me", "everyone", "all", "mention", "mentions", "example", "user", "users", "account", "accounts", "official", "help", "helps", "support", "supports", "info", "information", "informations", "announce", "announces", "announcement", "announcements", "notice", "notification", "notifications", "dev", "developer", "developers", "tech", "misskey", "cherrypick" }',
})
public preservedUsernames: string[];

@Column('boolean', {
default: false,
})
public enableReceivePrerelease: boolean;
}
5 changes: 5 additions & 0 deletions packages/backend/src/server/api/endpoints/admin/meta.ts
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,10 @@ export const meta = {
type: 'object',
optional: false, nullable: false,
},
enableReceivePrerelease: {
type: 'boolean',
optional: false, nullable: false,
},
},
},
} as const;
Expand Down Expand Up @@ -484,6 +488,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
emailToReceiveAbuseReport: instance.emailToReceiveAbuseReport,
policies: { ...DEFAULT_POLICIES, ...instance.policies },
manifestJsonOverride: instance.manifestJsonOverride,
enableReceivePrerelease: instance.enableReceivePrerelease,
};
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -553,6 +553,10 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
set.manifestJsonOverride = ps.manifestJsonOverride;
}

if (ps.enableReceivePrerelease !== undefined) {
set.enableReceivePrerelease = ps.enableReceivePrerelease;
}

const before = await this.metaService.fetch(true);

await this.metaService.update(set);
Expand Down
3 changes: 2 additions & 1 deletion packages/frontend/src/pages/admin/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ fetch('https://api.github.com/repos/kokonect-link/cherrypick/releases', {
method: 'GET',
}).then(res => res.json())
.then(res => {
releasesCherryPick = res;
if (meta.enableReceivePrerelease) releasesMisskey = res.filter(x => x.prerelease === true);

Check failure on line 80 in packages/frontend/src/pages/admin/index.vue

View workflow job for this annotation

GitHub Actions / lint (frontend)

'meta' is not defined

Check failure on line 80 in packages/frontend/src/pages/admin/index.vue

View workflow job for this annotation

GitHub Actions / lint (frontend)

'releasesMisskey' is not defined
else releasesMisskey = res.filter(x => x.prerelease === false);

Check failure on line 81 in packages/frontend/src/pages/admin/index.vue

View workflow job for this annotation

GitHub Actions / lint (frontend)

'releasesMisskey' is not defined
if (version < releasesCherryPick[0].tag_name) updateAvailable = true;
});

Expand Down
39 changes: 36 additions & 3 deletions packages/frontend/src/pages/admin/update.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ SPDX-License-Identifier: AGPL-3.0-only
<template #header><XHeader :actions="headerActions" :tabs="headerTabs"/></template>
<MkSpacer :contentMax="700" :marginMin="16" :marginMax="32">
<div class="_gaps_m">
<div class="_panel" style="padding: 16px;">
<MkSwitch v-model="enableReceivePrerelease">
<template #label>{{ i18n.ts.enableReceivePrerelease }}</template>
</MkSwitch>
</div>

<template>
<FormInfo v-if="version > releasesCherryPick[0].tag_name">{{ i18n.ts.youAreRunningBetaClient }}</FormInfo>
<FormInfo v-else-if="version === releasesCherryPick[0].tag_name">{{ i18n.ts.youAreRunningUpToDateClient }}</FormInfo>
Expand Down Expand Up @@ -58,7 +64,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</template>

<script lang="ts" setup>
import { onMounted } from 'vue';
import { onMounted, watch } from 'vue';
import * as os from '@/os.js';
import FormInfo from '@/components/MkInfo.vue';
import FormSection from '@/components/form/section.vue';
Expand All @@ -67,23 +73,50 @@ import { version, instanceName, basedMisskeyVersion } from '@/config.js';
import { definePageMetadata } from '@/scripts/page-metadata.js';
import { i18n } from '@/i18n.js';
import XHeader from '@/pages/admin/_header_.vue';
import MkSwitch from '@/components/MkSwitch.vue';
import { fetchInstance } from '@/instance.js';

let enableReceivePrerelease: boolean = $ref(false);

let releasesCherryPick = $ref(null);
let releasesMisskey = $ref(null);

async function init() {
const meta = await os.api('admin/meta');
enableReceivePrerelease = meta.enableReceivePrerelease;
}

function save() {
os.apiWithDialog('admin/update-meta', {
enableReceivePrerelease,
}).then(() => {
fetchInstance();
});
}

watch([
enableReceivePrerelease,
], () => {
save();
});

onMounted(() => {
init();

fetch('https://api.github.com/repos/kokonect-link/cherrypick/releases', {
method: 'GET',
}).then(res => res.json())
.then(res => {
releasesCherryPick = res;
if (enableReceivePrerelease) releasesCherryPick = res.filter(x => x.prerelease === true);
else releasesCherryPick = res.filter(x => x.prerelease === false);
});

fetch('https://api.github.com/repos/misskey-dev/misskey/releases', {
method: 'GET',
}).then(res => res.json())
.then(res => {
releasesMisskey = res;
if (enableReceivePrerelease) releasesMisskey = res.filter(x => x.prerelease === true);
else releasesMisskey = res.filter(x => x.prerelease === false);
});
});

Expand Down

0 comments on commit d627cdb

Please sign in to comment.