From 3a87ae7bf710fc0a04ac6cf88f455e56cf52889b Mon Sep 17 00:00:00 2001 From: naskya Date: Tue, 2 Jan 2024 06:11:33 +0900 Subject: [PATCH] feat: show changelog on updates --- .dockerignore | 3 ++ README.md | 2 + docker-compose.example.yml | 1 + locales/en-US.yml | 1 + locales/ja-JP.yml | 1 + locales/zh-CN.yml | 1 + locales/zh-TW.yml | 1 + neko/messages/add_volume_to_docker_compose | 15 ++++++++ neko/volume/.gitignore | 4 ++ .../backend/src/server/api/endpoints/meta.ts | 2 +- .../src/server/api/endpoints/patrons.ts | 2 +- .../src/server/api/endpoints/release.ts | 29 +++++++------- .../src/components/MkReleaseNotesWindow.vue | 38 +++++++++++++++++++ packages/client/src/components/MkUpdated.vue | 35 +++++++++++------ packages/client/src/init.ts | 2 +- update.sh | 8 +++- 16 files changed, 116 insertions(+), 29 deletions(-) create mode 100644 neko/messages/add_volume_to_docker_compose create mode 100644 neko/volume/.gitignore create mode 100644 packages/client/src/components/MkReleaseNotesWindow.vue diff --git a/.dockerignore b/.dockerignore index ad6ad169a..bb28ac152 100644 --- a/.dockerignore +++ b/.dockerignore @@ -42,3 +42,6 @@ packages/backend/assets/instance.css .git Dockerfile docker-compose.yml + +# Auto-generated files +/neko/volume diff --git a/README.md b/README.md index 6e5e833dd..f6eb1cb10 100644 --- a/README.md +++ b/README.md @@ -38,6 +38,8 @@ ## 細かい変更点 +- アップデート時に更新内容を確認できる機能を追加 + - 英語のメッセージしか出ないけど、日本語に翻訳する機能も欲しいですか? - 依存ライブラリを最新版にアップデート - ちゃんと動くか本家に push する前に実験したいという意図もあります - 中国語の猫モードでは 0.1 の確率で投稿の末尾に「喵」を追加するように diff --git a/docker-compose.example.yml b/docker-compose.example.yml index a3901a0f7..7f27d9ba6 100644 --- a/docker-compose.example.yml +++ b/docker-compose.example.yml @@ -19,6 +19,7 @@ services: - ./assets:/firefish/custom/assets - ./files:/firefish/files - ./.config:/firefish/.config:ro + - ./neko/volume:/firefish/neko/volume:ro redis: restart: unless-stopped diff --git a/locales/en-US.yml b/locales/en-US.yml index 40a273837..6c3734d74 100644 --- a/locales/en-US.yml +++ b/locales/en-US.yml @@ -917,6 +917,7 @@ useBlurEffect: "Use blur effects in the UI" learnMore: "Learn more" misskeyUpdated: "Firefish has been updated!" whatIsNew: "Show changes" +releaseNotes: "Changes" translate: "Translate" translatedFrom: "Translated from {x}" accountDeletionInProgress: "Account deletion is currently in progress" diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index 01a9614da..26bdad6c6 100644 --- a/locales/ja-JP.yml +++ b/locales/ja-JP.yml @@ -831,6 +831,7 @@ useBlurEffect: "UIにぼかし効果を使用" learnMore: "詳しく" misskeyUpdated: "Firefishが更新されました!" whatIsNew: "更新情報を見る" +releaseNotes: "更新情報" translate: "翻訳" translatedFrom: "{x}から翻訳" accountDeletionInProgress: "アカウントの削除が進行中です" diff --git a/locales/zh-CN.yml b/locales/zh-CN.yml index 83c8ac8ae..23cdcc02d 100644 --- a/locales/zh-CN.yml +++ b/locales/zh-CN.yml @@ -801,6 +801,7 @@ useBlurEffect: "在 UI 上使用模糊效果" learnMore: "更多信息" misskeyUpdated: "Firefish 更新完成!" whatIsNew: "显示更新信息" +releaseNotes: "更新信息" translate: "翻译" translatedFrom: "从 {x} 翻译" accountDeletionInProgress: "正在删除账号" diff --git a/locales/zh-TW.yml b/locales/zh-TW.yml index de06444c8..4b01e73b5 100644 --- a/locales/zh-TW.yml +++ b/locales/zh-TW.yml @@ -797,6 +797,7 @@ useBlurEffect: "在 UI 上使用模糊效果" learnMore: "更多資訊" misskeyUpdated: "Firefish 更新完成!" whatIsNew: "顯示更新資訊" +releaseNotes: "更新資訊" translate: "翻譯" translatedFrom: "從 {x} 翻譯" accountDeletionInProgress: "正在刪除帳戶" diff --git a/neko/messages/add_volume_to_docker_compose b/neko/messages/add_volume_to_docker_compose new file mode 100644 index 000000000..6b61ed253 --- /dev/null +++ b/neko/messages/add_volume_to_docker_compose @@ -0,0 +1,15 @@ + ------------------------------------------------------------------- +| For Docker users: | +| Please add ./neko/volume:/firefish/neko/volume:ro to | +| services.web.volumes in your docker-compose.yml before upgrading! | +| | +| After editing, services.web.volumes should look like this: | +| volumes: | +| - ./assets:/firefish/custom/assets | +| - ./files:/firefish/files | +| - ./.config:/firefish/.config:ro | +| - ./neko/volume:/firefish/neko/volume:ro <-- add this line | +| | +| For the detailed explanation, see: | +| https://post.naskya.net/notes/9nywqr2nkh0rjoum | + ------------------------------------------------------------------- diff --git a/neko/volume/.gitignore b/neko/volume/.gitignore new file mode 100644 index 000000000..5e7d2734c --- /dev/null +++ b/neko/volume/.gitignore @@ -0,0 +1,4 @@ +# Ignore everything in this directory +* +# Except this file +!.gitignore diff --git a/packages/backend/src/server/api/endpoints/meta.ts b/packages/backend/src/server/api/endpoints/meta.ts index 27fa3dff9..16e046e06 100644 --- a/packages/backend/src/server/api/endpoints/meta.ts +++ b/packages/backend/src/server/api/endpoints/meta.ts @@ -507,7 +507,7 @@ export default define(meta, paramDef, async (ps, me) => { recommendedTimeline: !instance.disableRecommendedTimeline, globalTimeLine: !instance.disableGlobalTimeline, emailRequiredForSignup: instance.emailRequiredForSignup, - searchFilters: config.meilisearch ? true : false, + searchFilters: false, // TODO: implement search filters hcaptcha: instance.enableHcaptcha, recaptcha: instance.enableRecaptcha, objectStorage: instance.useObjectStorage, diff --git a/packages/backend/src/server/api/endpoints/patrons.ts b/packages/backend/src/server/api/endpoints/patrons.ts index d0c8e725b..6bb8451ac 100644 --- a/packages/backend/src/server/api/endpoints/patrons.ts +++ b/packages/backend/src/server/api/endpoints/patrons.ts @@ -1,5 +1,5 @@ import define from "@/server/api/define.js"; -import { redisClient } from "@/db/redis.js"; +// import { redisClient } from "@/db/redis.js"; import * as fs from "node:fs"; import { fileURLToPath } from "node:url"; import { dirname } from "node:path"; diff --git a/packages/backend/src/server/api/endpoints/release.ts b/packages/backend/src/server/api/endpoints/release.ts index 1314e9036..e04598915 100644 --- a/packages/backend/src/server/api/endpoints/release.ts +++ b/packages/backend/src/server/api/endpoints/release.ts @@ -1,8 +1,15 @@ +import * as fs from "node:fs/promises"; +import { dirname } from "node:path"; +import { fileURLToPath } from "node:url"; import define from "@/server/api/define.js"; +import config from "@/config/index.js"; + +const _filename = fileURLToPath(import.meta.url); +const _dirname = dirname(_filename); export const meta = { tags: ["meta"], - description: "Get release notes from Codeberg", + description: "Get changelog", requireCredential: false, requireCredentialPrivateMode: false, @@ -14,15 +21,11 @@ export const paramDef = { required: [], } as const; -export default define(meta, paramDef, async () => { - let release; - - await fetch( - "https://git.joinfirefish.org/firefish/firefish/-/raw/develop/release.json", - ) - .then((response) => response.json()) - .then((data) => { - release = data; - }); - return release; -}); +export default define(meta, paramDef, async () => ({ + version: config.version, + notes: await fs.readFile( + `${_dirname}/../../../../../../neko/volume/CHANGELOG`, + "utf-8", + ), + screenshots: [], +})); diff --git a/packages/client/src/components/MkReleaseNotesWindow.vue b/packages/client/src/components/MkReleaseNotesWindow.vue new file mode 100644 index 000000000..112be23d9 --- /dev/null +++ b/packages/client/src/components/MkReleaseNotesWindow.vue @@ -0,0 +1,38 @@ + + + + + diff --git a/packages/client/src/components/MkUpdated.vue b/packages/client/src/components/MkUpdated.vue index 7004be11c..f6120bbaf 100644 --- a/packages/client/src/components/MkUpdated.vue +++ b/packages/client/src/components/MkUpdated.vue @@ -10,7 +10,7 @@ {{ i18n.ts.misskeyUpdated }}
✨ {{ version }} 🚀
-
+ + {{ i18n.ts.whatIsNew }}