1
0
Fork 1
mirror of https://example.com synced 2024-11-22 12:36:40 +09:00

feat: show changelog on updates

This commit is contained in:
naskya 2024-01-02 06:11:33 +09:00
parent 03807b7815
commit 7c887421f4
Signed by: naskya
GPG key ID: 712D413B3A9FED5C
16 changed files with 116 additions and 29 deletions

View file

@ -42,3 +42,6 @@ packages/backend/assets/instance.css
.git .git
Dockerfile Dockerfile
docker-compose.yml docker-compose.yml
# Auto-generated files
/neko/volume

View file

@ -38,6 +38,8 @@
## 細かい変更点 ## 細かい変更点
- アップデート時に更新内容を確認できる機能を追加
- 英語のメッセージしか出ないけど、日本語に翻訳する機能も欲しいですか?
- 依存ライブラリを最新版にアップデート - 依存ライブラリを最新版にアップデート
- ちゃんと動くか本家に push する前に実験したいという意図もあります - ちゃんと動くか本家に push する前に実験したいという意図もあります
- 中国語の猫モードでは 0.1 の確率で投稿の末尾に「喵」を追加するように - 中国語の猫モードでは 0.1 の確率で投稿の末尾に「喵」を追加するように

View file

@ -19,6 +19,7 @@ services:
- ./assets:/firefish/custom/assets - ./assets:/firefish/custom/assets
- ./files:/firefish/files - ./files:/firefish/files
- ./.config:/firefish/.config:ro - ./.config:/firefish/.config:ro
- ./neko/volume:/firefish/neko/volume:ro
redis: redis:
restart: unless-stopped restart: unless-stopped

View file

@ -917,6 +917,7 @@ useBlurEffect: "Use blur effects in the UI"
learnMore: "Learn more" learnMore: "Learn more"
misskeyUpdated: "Firefish has been updated!" misskeyUpdated: "Firefish has been updated!"
whatIsNew: "Show changes" whatIsNew: "Show changes"
releaseNotes: "Changes"
translate: "Translate" translate: "Translate"
translatedFrom: "Translated from {x}" translatedFrom: "Translated from {x}"
accountDeletionInProgress: "Account deletion is currently in progress" accountDeletionInProgress: "Account deletion is currently in progress"

View file

@ -831,6 +831,7 @@ useBlurEffect: "UIにぼかし効果を使用"
learnMore: "詳しく" learnMore: "詳しく"
misskeyUpdated: "Firefishが更新されました" misskeyUpdated: "Firefishが更新されました"
whatIsNew: "更新情報を見る" whatIsNew: "更新情報を見る"
releaseNotes: "更新情報"
translate: "翻訳" translate: "翻訳"
translatedFrom: "{x}から翻訳" translatedFrom: "{x}から翻訳"
accountDeletionInProgress: "アカウントの削除が進行中です" accountDeletionInProgress: "アカウントの削除が進行中です"

View file

@ -801,6 +801,7 @@ useBlurEffect: "在 UI 上使用模糊效果"
learnMore: "更多信息" learnMore: "更多信息"
misskeyUpdated: "Firefish 更新完成!" misskeyUpdated: "Firefish 更新完成!"
whatIsNew: "显示更新信息" whatIsNew: "显示更新信息"
releaseNotes: "更新信息"
translate: "翻译" translate: "翻译"
translatedFrom: "从 {x} 翻译" translatedFrom: "从 {x} 翻译"
accountDeletionInProgress: "正在删除账号" accountDeletionInProgress: "正在删除账号"

View file

@ -797,6 +797,7 @@ useBlurEffect: "在 UI 上使用模糊效果"
learnMore: "更多資訊" learnMore: "更多資訊"
misskeyUpdated: "Firefish 更新完成!" misskeyUpdated: "Firefish 更新完成!"
whatIsNew: "顯示更新資訊" whatIsNew: "顯示更新資訊"
releaseNotes: "更新資訊"
translate: "翻譯" translate: "翻譯"
translatedFrom: "從 {x} 翻譯" translatedFrom: "從 {x} 翻譯"
accountDeletionInProgress: "正在刪除帳戶" accountDeletionInProgress: "正在刪除帳戶"

View file

@ -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 |
-------------------------------------------------------------------

4
neko/volume/.gitignore vendored Normal file
View file

@ -0,0 +1,4 @@
# Ignore everything in this directory
*
# Except this file
!.gitignore

View file

@ -507,7 +507,7 @@ export default define(meta, paramDef, async (ps, me) => {
recommendedTimeline: !instance.disableRecommendedTimeline, recommendedTimeline: !instance.disableRecommendedTimeline,
globalTimeLine: !instance.disableGlobalTimeline, globalTimeLine: !instance.disableGlobalTimeline,
emailRequiredForSignup: instance.emailRequiredForSignup, emailRequiredForSignup: instance.emailRequiredForSignup,
searchFilters: config.meilisearch ? true : false, searchFilters: false, // TODO: implement search filters
hcaptcha: instance.enableHcaptcha, hcaptcha: instance.enableHcaptcha,
recaptcha: instance.enableRecaptcha, recaptcha: instance.enableRecaptcha,
objectStorage: instance.useObjectStorage, objectStorage: instance.useObjectStorage,

View file

@ -1,5 +1,5 @@
import define from "@/server/api/define.js"; 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 * as fs from "node:fs";
import { fileURLToPath } from "node:url"; import { fileURLToPath } from "node:url";
import { dirname } from "node:path"; import { dirname } from "node:path";

View file

@ -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 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 = { export const meta = {
tags: ["meta"], tags: ["meta"],
description: "Get release notes from Codeberg", description: "Get changelog",
requireCredential: false, requireCredential: false,
requireCredentialPrivateMode: false, requireCredentialPrivateMode: false,
@ -14,15 +21,11 @@ export const paramDef = {
required: [], required: [],
} as const; } as const;
export default define(meta, paramDef, async () => { export default define(meta, paramDef, async () => ({
let release; version: config.version,
notes: await fs.readFile(
await fetch( `${_dirname}/../../../../../../neko/volume/CHANGELOG`,
"https://git.joinfirefish.org/firefish/firefish/-/raw/develop/release.json", "utf-8",
) ),
.then((response) => response.json()) screenshots: [],
.then((data) => { }));
release = data;
});
return release;
});

View file

@ -0,0 +1,38 @@
<template>
<XWindow
:initial-width="800"
:can-resize="true"
:front="true"
@closed="emit('closed')"
>
<template #header>
{{ i18n.ts.releaseNotes }}
</template>
<div class="asnohbod">
<ul>
<li v-for="(item, i) in notes" :key="i">{{ item }}</li>
</ul>
</div>
</XWindow>
</template>
<script lang="ts" setup>
import XWindow from "@/components/MkWindow.vue";
import { i18n } from "@/i18n";
defineProps<{
notes: string[];
}>();
const emit = defineEmits<{
(ev: "closed"): void;
}>();
</script>
<style lang="scss" scoped>
.asnohbod {
white-space: pre-wrap;
font-size: 1.2em;
padding: 5px 20px 10px;
}
</style>

View file

@ -10,7 +10,7 @@
<MkSparkle>{{ i18n.ts.misskeyUpdated }}</MkSparkle> <MkSparkle>{{ i18n.ts.misskeyUpdated }}</MkSparkle>
</div> </div>
<div :class="$style.version"> {{ version }} 🚀</div> <div :class="$style.version"> {{ version }} 🚀</div>
<div v-if="newRelease" :class="$style.releaseNotes"> <!-- <div :class="$style.releaseNotes">
<Mfm :text="data.notes" /> <Mfm :text="data.notes" />
<div v-if="data.screenshots.length > 0" style="max-width: 500"> <div v-if="data.screenshots.length > 0" style="max-width: 500">
<img <img
@ -20,7 +20,14 @@
alt="screenshot" alt="screenshot"
/> />
</div> </div>
</div> </div> -->
<MkButton
v-if="notes.length > 0"
:class="$style.gotIt"
full
@click="openReleaseNotes"
>{{ i18n.ts.whatIsNew }}</MkButton
>
<MkButton <MkButton
:class="$style.gotIt" :class="$style.gotIt"
primary primary
@ -33,7 +40,7 @@
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { ref, shallowRef } from "vue"; import { defineAsyncComponent, ref, shallowRef } from "vue";
import MkModal from "@/components/MkModal.vue"; import MkModal from "@/components/MkModal.vue";
import MkSparkle from "@/components/MkSparkle.vue"; import MkSparkle from "@/components/MkSparkle.vue";
import MkButton from "@/components/MkButton.vue"; import MkButton from "@/components/MkButton.vue";
@ -43,18 +50,24 @@ import * as os from "@/os";
const modal = shallowRef<InstanceType<typeof MkModal>>(); const modal = shallowRef<InstanceType<typeof MkModal>>();
const newRelease = ref(false); const notes = ref([] as string[]);
const data = ref(Object);
os.api("release").then((res) => { os.api("release").then((res) => {
data.value = res; notes.value = res.notes.trim().split("\n");
newRelease.value = version === data.value?.version;
}); });
console.log(`Version: ${version}`); function openReleaseNotes(): void {
console.log(`Data version: ${data.value.version}`); os.popup(
console.log(newRelease.value); defineAsyncComponent(
console.log(data.value); () => import("@/components/MkReleaseNotesWindow.vue"),
),
{
notes: notes.value,
},
{},
"closed",
);
}
</script> </script>
<style lang="scss" module> <style lang="scss" module>

View file

@ -22,7 +22,7 @@ if (accounts) {
} }
// #endregion // #endregion
import { compareVersions } from "compare-versions"; // import { compareVersions } from "compare-versions";
import { import {
computed, computed,
createApp, createApp,

View file

@ -8,13 +8,17 @@ br
# Pull changes # Pull changes
## git pull ## git pull
OLD_COMMIT=$(git rev-parse HEAD) OLD_COMMIT=$(git rev-parse --short HEAD)
say 'Pulling changes from the remote repo...' say 'Pulling changes from the remote repo...'
run 'git checkout -- package.json packages/backend/assets' run 'git checkout -- package.json packages/backend/assets'
run 'git pull --ff --no-edit --autostash --strategy-option theirs' run 'git pull --ff --no-edit --autostash --strategy-option theirs'
NEW_COMMIT=$(git rev-parse HEAD) NEW_COMMIT=$(git rev-parse --short HEAD)
if [ "${OLD_COMMIT}" != "${NEW_COMMIT}" ]; then
run "git log --reverse --format='%s (by %an)' ${OLD_COMMIT}..${NEW_COMMIT} > neko/volume/CHANGELOG"
fi
say 'Pulled successfully!' say 'Pulled successfully!'
br br