1
0
Fork 1
mirror of https://example.com synced 2024-11-22 05:46:38 +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
Dockerfile
docker-compose.yml
# Auto-generated files
/neko/volume

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -797,6 +797,7 @@ useBlurEffect: "在 UI 上使用模糊效果"
learnMore: "更多資訊"
misskeyUpdated: "Firefish 更新完成!"
whatIsNew: "顯示更新資訊"
releaseNotes: "更新資訊"
translate: "翻譯"
translatedFrom: "從 {x} 翻譯"
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,
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,

View file

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

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 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: [],
}));

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

View file

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

View file

@ -8,13 +8,17 @@ br
# Pull changes
## git pull
OLD_COMMIT=$(git rev-parse HEAD)
OLD_COMMIT=$(git rev-parse --short HEAD)
say 'Pulling changes from the remote repo...'
run 'git checkout -- package.json packages/backend/assets'
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!'
br