mirror of
https://github.com/AkiChase/scrcpy-mask
synced 2025-05-25 18:48:14 +08:00
feat(checkUpdate): use markdown to render update info
This commit is contained in:
parent
53432f0777
commit
25dd0e3c81
3
.github/ISSUE_TEMPLATE/feature_request.md
vendored
3
.github/ISSUE_TEMPLATE/feature_request.md
vendored
@ -12,8 +12,5 @@ A clear and concise description of what the problem is. Ex. I'm always frustrate
|
|||||||
**Describe the solution you'd like**
|
**Describe the solution you'd like**
|
||||||
A clear and concise description of what you want to happen.
|
A clear and concise description of what you want to happen.
|
||||||
|
|
||||||
**Describe alternatives you've considered**
|
|
||||||
A clear and concise description of any alternative solutions or features you've considered.
|
|
||||||
|
|
||||||
**Additional context**
|
**Additional context**
|
||||||
Add any other context or screenshots about the feature request here.
|
Add any other context or screenshots about the feature request here.
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
"@tauri-apps/plugin-process": "~2",
|
"@tauri-apps/plugin-process": "~2",
|
||||||
"@tauri-apps/plugin-shell": "~2",
|
"@tauri-apps/plugin-shell": "~2",
|
||||||
"@tauri-apps/plugin-store": "~2",
|
"@tauri-apps/plugin-store": "~2",
|
||||||
|
"marked": "^15.0.7",
|
||||||
"naive-ui": "^2.41.0",
|
"naive-ui": "^2.41.0",
|
||||||
"pinia": "^3.0.1",
|
"pinia": "^3.0.1",
|
||||||
"vue": "^3.5.13",
|
"vue": "^3.5.13",
|
||||||
|
@ -32,6 +32,9 @@ importers:
|
|||||||
'@tauri-apps/plugin-store':
|
'@tauri-apps/plugin-store':
|
||||||
specifier: ~2
|
specifier: ~2
|
||||||
version: 2.2.0
|
version: 2.2.0
|
||||||
|
marked:
|
||||||
|
specifier: ^15.0.7
|
||||||
|
version: 15.0.7
|
||||||
naive-ui:
|
naive-ui:
|
||||||
specifier: ^2.41.0
|
specifier: ^2.41.0
|
||||||
version: 2.41.0(vue@3.5.13(typescript@5.8.2))
|
version: 2.41.0(vue@3.5.13(typescript@5.8.2))
|
||||||
@ -1094,6 +1097,11 @@ packages:
|
|||||||
magic-string@0.30.17:
|
magic-string@0.30.17:
|
||||||
resolution: {integrity: sha512-sNPKHvyjVf7gyjwS4xGTaW/mCnF8wnjtifKBEhxfZ7E/S8tQ0rssrwGNn6q8JH/ohItJfSQp9mBtQYuTlH5QnA==}
|
resolution: {integrity: sha512-sNPKHvyjVf7gyjwS4xGTaW/mCnF8wnjtifKBEhxfZ7E/S8tQ0rssrwGNn6q8JH/ohItJfSQp9mBtQYuTlH5QnA==}
|
||||||
|
|
||||||
|
marked@15.0.7:
|
||||||
|
resolution: {integrity: sha512-dgLIeKGLx5FwziAnsk4ONoGwHwGPJzselimvlVskE9XLN4Orv9u2VA3GWw/lYUqjfA0rUT/6fqKwfZJapP9BEg==}
|
||||||
|
engines: {node: '>= 18'}
|
||||||
|
hasBin: true
|
||||||
|
|
||||||
memorystream@0.3.1:
|
memorystream@0.3.1:
|
||||||
resolution: {integrity: sha512-S3UwM3yj5mtUSEfP41UZmt/0SCoVYUcU1rkXv+BQ5Ig8ndL4sPoJNBUJERafdPb5jjHJGuMgytgKvKIf58XNBw==}
|
resolution: {integrity: sha512-S3UwM3yj5mtUSEfP41UZmt/0SCoVYUcU1rkXv+BQ5Ig8ndL4sPoJNBUJERafdPb5jjHJGuMgytgKvKIf58XNBw==}
|
||||||
engines: {node: '>= 0.10.0'}
|
engines: {node: '>= 0.10.0'}
|
||||||
@ -2388,6 +2396,8 @@ snapshots:
|
|||||||
dependencies:
|
dependencies:
|
||||||
'@jridgewell/sourcemap-codec': 1.5.0
|
'@jridgewell/sourcemap-codec': 1.5.0
|
||||||
|
|
||||||
|
marked@15.0.7: {}
|
||||||
|
|
||||||
memorystream@0.3.1: {}
|
memorystream@0.3.1: {}
|
||||||
|
|
||||||
micromatch@4.0.8:
|
micromatch@4.0.8:
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
import { getVersion } from "@tauri-apps/api/app";
|
import { getVersion } from "@tauri-apps/api/app";
|
||||||
import { useDialog, useMessage } from "naive-ui";
|
import { useDialog, useMessage } from "naive-ui";
|
||||||
import { h } from "vue";
|
|
||||||
import { useI18n } from "vue-i18n";
|
import { useI18n } from "vue-i18n";
|
||||||
import { fetch } from "@tauri-apps/plugin-http";
|
import { fetch } from "@tauri-apps/plugin-http";
|
||||||
import { compareVersion } from "./tools";
|
import { compareVersion } from "./tools";
|
||||||
@ -8,13 +7,16 @@ import { checkAdbAvailable } from "./invoke";
|
|||||||
import { NonReactiveStore } from "../store/noneReactiveStore";
|
import { NonReactiveStore } from "../store/noneReactiveStore";
|
||||||
import { getCurrentWindow, LogicalSize } from "@tauri-apps/api/window";
|
import { getCurrentWindow, LogicalSize } from "@tauri-apps/api/window";
|
||||||
import { useGlobalStore } from "../store/global";
|
import { useGlobalStore } from "../store/global";
|
||||||
|
import { h } from "vue";
|
||||||
|
import { marked } from "marked";
|
||||||
|
|
||||||
// TODO use markdown to render update info
|
const render = new marked.Renderer();
|
||||||
|
marked.setOptions({
|
||||||
function renderUpdateInfo(content: string) {
|
renderer: render,
|
||||||
const pList = content.split("\r\n").map((line: string) => h("p", line));
|
gfm: true,
|
||||||
return h("div", { style: "margin: 20px 0" }, pList);
|
pedantic: false,
|
||||||
}
|
async: false,
|
||||||
|
});
|
||||||
|
|
||||||
export function useCheckUpdate() {
|
export function useCheckUpdate() {
|
||||||
const message = useMessage();
|
const message = useMessage();
|
||||||
@ -43,7 +45,11 @@ export function useCheckUpdate() {
|
|||||||
const body = data.body as string;
|
const body = data.body as string;
|
||||||
dialog.info({
|
dialog.info({
|
||||||
title: t("pages.Mask.checkUpdate.notLatest.title", [latestVersion]),
|
title: t("pages.Mask.checkUpdate.notLatest.title", [latestVersion]),
|
||||||
content: () => renderUpdateInfo(body),
|
content: () =>
|
||||||
|
h("div", {
|
||||||
|
style: "margin: 20px 0",
|
||||||
|
innerHTML: marked.parse(body),
|
||||||
|
}),
|
||||||
positiveText: t("pages.Mask.checkUpdate.notLatest.positiveText"),
|
positiveText: t("pages.Mask.checkUpdate.notLatest.positiveText"),
|
||||||
negativeText: t("pages.Mask.checkUpdate.notLatest.negativeText"),
|
negativeText: t("pages.Mask.checkUpdate.notLatest.negativeText"),
|
||||||
onPositiveClick: () => {
|
onPositiveClick: () => {
|
||||||
|
Loading…
Reference in New Issue
Block a user