fix: include release notes renderer in desktop build

This commit is contained in:
2026-09-15 06:02:15 +08:00
parent 3f3ce31b9c
commit 08f0d1abaa
7 changed files with 17 additions and 19 deletions

4
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{
"name": "opslog-web",
"version": "3.0.21",
"version": "3.0.22",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "opslog-web",
"version": "3.0.21",
"version": "3.0.22",
"dependencies": {
"@codemirror/language": "^6.12.4",
"@codemirror/state": "^6.7.4",

View File

@@ -1,6 +1,6 @@
{
"name": "opslog-web",
"version": "3.0.21",
"version": "3.0.22",
"private": true,
"type": "module",
"scripts": {

2
src-tauri/Cargo.lock generated
View File

@@ -2493,7 +2493,7 @@ dependencies = [
[[package]]
name = "opslog"
version = "3.0.21"
version = "3.0.22"
dependencies = [
"axum",
"chrono",

View File

@@ -1,6 +1,6 @@
[package]
name = "opslog"
version = "3.0.21"
version = "3.0.22"
description = "Portable M5/Faulu log query console"
authors = ["MuRong Technology"]
license = "Proprietary"

View File

@@ -1,7 +1,7 @@
{
"$schema": "../node_modules/@tauri-apps/cli/config.schema.json",
"productName": "OpsLog",
"version": "3.0.21",
"version": "3.0.22",
"identifier": "com.murong.opslog",
"build": {
"frontendDist": "../dist-web",

View File

@@ -63,8 +63,8 @@ export const Header = ({ environments, selected, onSelect, loading, desktopMode,
</div>
{desktopMode && <LanShareControl controller={lanShare} />}
{desktopMode
? <button className={`version-chip is-interactive${updateAvailable ? " has-update" : ""}`} disabled={updateBusy} title={updateAvailable ? "有新版本可安装" : "检查更新"} onClick={onCheckForUpdates}>APP · 3.0.21<span aria-hidden="true" /></button>
: <div className="version-chip">WEB · 3.0.21</div>}
? <button className={`version-chip is-interactive${updateAvailable ? " has-update" : ""}`} disabled={updateBusy} title={updateAvailable ? "有新版本可安装" : "检查更新"} onClick={onCheckForUpdates}>APP · 3.0.22<span aria-hidden="true" /></button>
: <div className="version-chip">WEB · 3.0.22</div>}
</div>
</header>
);

View File

@@ -1,7 +1,12 @@
import { lazy, Suspense } from "react";
import type { AppUpdateState } from "../use-app-updater";
import { parseReleaseNotes } from "../update-release-notes";
import { CloseIcon, DownloadIcon } from "./Icons";
const ReleaseNotesMarkdown = lazy(async () => {
const module = await import("./ReleaseNotesMarkdown");
return { default: module.ReleaseNotesMarkdown };
});
interface UpdateDialogProps {
state: AppUpdateState;
onInstall: () => void;
@@ -21,15 +26,6 @@ const statusCopy = (state: AppUpdateState): string => {
return `发现新版本 ${state.version ?? ""}`;
};
const ReleaseNotes = ({ notes }: { notes: string }) => <>
{parseReleaseNotes(notes).map((block, index) => {
if (block.type === "heading") return <h3 key={index} data-level={block.level}>{block.text}</h3>;
if (block.type === "list") return <ul key={index}>{block.items.map((item, itemIndex) => <li key={itemIndex}>{item}</li>)}</ul>;
if (block.type === "code") return <pre key={index}><code>{block.text}</code></pre>;
return <p key={index}>{block.text}</p>;
})}
</>;
export const UpdateDialog = ({ state, onInstall, onDismiss }: UpdateDialogProps) => {
if (!state.visible) return null;
const percentage = progress(state);
@@ -52,7 +48,9 @@ export const UpdateDialog = ({ state, onInstall, onDismiss }: UpdateDialogProps)
{showChangelog && <section className="update-changelog" aria-label="更新内容">
<header><span>CHANGELOG</span><strong></strong></header>
<div className={`update-notes${state.notes?.trim() ? "" : " is-empty"}${state.notesLoading ? " is-loading" : ""}`}>
{state.notes?.trim() ? <ReleaseNotes notes={changelog} /> : changelog}
{state.notes?.trim()
? <Suspense fallback={<span className="update-notes-rendering"></span>}><ReleaseNotesMarkdown notes={changelog} /></Suspense>
: changelog}
</div>
</section>}
{busy && <div className="update-progress"><span style={{ width: percentage == null ? "34%" : `${percentage}%` }} className={percentage == null ? "is-indeterminate" : undefined} /></div>}