From 28249f9d7c88dc7501bdd4be4c8633b474bae414 Mon Sep 17 00:00:00 2001 From: BTJ <2407356083@qq.com> Date: Fri, 2 Feb 2024 13:03:05 +0800 Subject: [PATCH] =?UTF-8?q?ref.=20=E4=BC=98=E5=8C=96Updater=E4=BD=93?= =?UTF-8?q?=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 15 ++++++++++-- package-lock.json | 16 ++++++------- package.json | 2 +- src-tauri/tauri.conf.json | 14 ++++++------ src/index.html | 9 +++++++- src/scripts/renderer.js | 5 +++- src/scripts/updater.ts | 48 +++++++++++++++++++++++++++++++++++++++ vite.config.ts | 5 +++- 8 files changed, 93 insertions(+), 21 deletions(-) create mode 100644 src/scripts/updater.ts diff --git a/README.md b/README.md index 25fa12a..142a1f6 100644 --- a/README.md +++ b/README.md @@ -12,12 +12,13 @@ - 获取大会员/付费资源 - 风控验证 - `WBI / _uuid / buvid3/4 / bili_ticket / 极验行为验证` +- 多线程下载 / 断点续传 - `aria2` - 音视频下载 - `视频 / 合集 / 互动视频 / 课程 / 番剧 (AV + BV + SS + EP)` - 画质最高支持:`8K + HDR + 杜比视界` - 伴音音质最高支持:`192K + HiRes无损(48kHz) + 杜比全景声(384K)` - 帧率最高支持:`120FPS` - 编码支持:`AVC (H.264) + HEVC (H.265) + AV1` - - 互动视频支持:`回溯 / 控制剧情走向 + 下载每一个剧情对应的资源` + - 互动视频支持:`回溯 / 控制剧情图 + 下载剧情分P` - 音乐下载 - `AU` - 音质最高支持:`320K + 无损SQ FLAC` - 弹幕获取 - `实时弹幕 / 历史弹幕(Json)` @@ -35,4 +36,14 @@ # 更多信息 -可转至 [Blog](https://blog.btjawa.top/posts/bilitools) \ No newline at end of file +可转至 [Blog](https://blog.btjawa.top/posts/bilitools) + +# 感谢 + +[Tauri](https://github.com/tauri-apps/tauri) + +[哔哩哔哩-API收集整理](https://github.com/SocialSisterYi/bilibili-API-collect) + +[FFmpeg](https://github.com/FFmpeg/FFmpeg) + +[aria2](https://github.com/aria2/aria2) \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 3a57ee9..1cad48b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16,7 +16,7 @@ "md5": "^2.3.0", "protobufjs": "^7.2.6", "qrcode": "^1.5.3", - "sweetalert2": "^11.10.4" + "sweetalert2": "^11.6.13" }, "devDependencies": { "@actions/github": "^6.0.0", @@ -641,7 +641,7 @@ "node_modules/@protobufjs/path": { "version": "1.1.2", "resolved": "https://mirrors.cloud.tencent.com/npm/@protobufjs/path/-/path-1.1.2.tgz", - "integrity": "sha1-bMKyDFya1q0NzP0hynZz2Nf79o0=" + "integrity": "sha512-6JOcJ5Tm08dOHAbdR3GrvP+yUUfkjG5ePsHYczMFLq3ZmMkAD98cDgcT2iA1lJ9NVwFd4tH/iSSoe44YWkltEA==" }, "node_modules/@protobufjs/pool": { "version": "1.1.0", @@ -1046,9 +1046,9 @@ "dev": true }, "node_modules/@types/node": { - "version": "20.11.10", - "resolved": "https://mirrors.cloud.tencent.com/npm/@types/node/-/node-20.11.10.tgz", - "integrity": "sha512-rZEfe/hJSGYmdfX9tvcPMYeYPW2sNl50nsw4jZmRcaG0HIAb0WYEpsB05GOb53vjqpyE9GUhlDQ4jLSoB5q9kg==", + "version": "20.11.16", + "resolved": "https://mirrors.cloud.tencent.com/npm/@types/node/-/node-20.11.16.tgz", + "integrity": "sha512-gKb0enTmRCzXSSUJDq6/sPcqrfCv2mkkG6Jt/clpn5eiCbKTY+SgZUxo+p8ZKMof5dCp9vHQUAB7wOUTod22wQ==", "dependencies": { "undici-types": "~5.26.4" } @@ -1519,9 +1519,9 @@ "integrity": "sha512-lcHwpNoggQTObv5apGNCTdJrO69eHOZMi4BNC+rTLER8iHAqGrUVeLh/irVIM7zTw2bOXA8T6uNPeujwOLg/2Q==" }, "node_modules/magic-string": { - "version": "0.30.5", - "resolved": "https://mirrors.cloud.tencent.com/npm/magic-string/-/magic-string-0.30.5.tgz", - "integrity": "sha512-7xlpfBaQaP/T6Vh8MO/EqXSW5En6INHEvEXQiuff7Gku0PWjU3uf6w/j9o7O+SpB5fOAkrI5HeoNgwjEO0pFsA==", + "version": "0.30.6", + "resolved": "https://mirrors.cloud.tencent.com/npm/magic-string/-/magic-string-0.30.6.tgz", + "integrity": "sha512-n62qCLbPjNjyo+owKtveQxZFZTBm+Ms6YoGD23Wew6Vw337PElFNifQpknPruVRQV57kVShPnLGo9vWxVhpPvA==", "dev": true, "dependencies": { "@jridgewell/sourcemap-codec": "^1.4.15" diff --git a/package.json b/package.json index 8b7c668..7a55e60 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,7 @@ "md5": "^2.3.0", "protobufjs": "^7.2.6", "qrcode": "^1.5.3", - "sweetalert2": "^11.10.4" + "sweetalert2": "^11.6.13" }, "devDependencies": { "@actions/github": "^6.0.0", diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index 0c5b8ab..e6577ec 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -6,7 +6,7 @@ }, "package": { "productName": "BiliTools", - "version": "1.0.3" + "version": "1.0.2" }, "tauri": { "allowlist": { @@ -76,14 +76,14 @@ }, "updater": { "active": true, - "dialog": true, + "dialog": false, "pubkey": "dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IEVFQTUzQTQ3NDY3RUZEMjgKUldRby9YNUdSenFsN3JJYklTL0g5RUd2QkhUWklqQUxydVZXdFA4c25ZazI0YjJIbTFFM0JiNjkK", "endpoints": [ - "https://gh.con.sh/https://github.com/btjawa/BiliTools/blob/master/install.json" - ], - "windows": { - "installMode": "passive" - } + "https://gh.con.sh/https://raw.githubusercontent.com/btjawa/BiliTools/master/install.json", + "https://mirror.ghproxy.com/https://raw.githubusercontent.com/btjawa/BiliTools/master/install.json", + "https://raw.fgit.cf/btjawa/BiliTools/master/install.json", + "https://raw.githubusercontent.com/btjawa/BiliTools/master/install.json" + ] }, "security": { "csp": null diff --git a/src/index.html b/src/index.html index 900b893..3e86cb3 100644 --- a/src/index.html +++ b/src/index.html @@ -205,7 +205,13 @@

名称

-
版本:()
+
版本: + + () +
+ +
项目地址:
+ diff --git a/src/scripts/renderer.js b/src/scripts/renderer.js index 0f09b5d..1e89710 100644 --- a/src/scripts/renderer.js +++ b/src/scripts/renderer.js @@ -368,7 +368,10 @@ $(document).ready(function () { tdata.set.secret(e); invoke('init', { secret: tdata.secret }); }); - app.getVersion().then(ver => $('#version').html(ver)); + app.getVersion().then(ver => { + $('#version').html(ver); + $('#version-details').attr("t", `https://github.com/btjawa/BiliTools/releases/tag/v${ver}`); + }); os.platform().then(type => $('#platform').html(type)); os.arch().then(arch => $('#arch').html(arch)); $('#year').html((new Date()).getFullYear()) diff --git a/src/scripts/updater.ts b/src/scripts/updater.ts new file mode 100644 index 0000000..50bd0c6 --- /dev/null +++ b/src/scripts/updater.ts @@ -0,0 +1,48 @@ +import { checkUpdate, installUpdate, onUpdaterEvent } from '@tauri-apps/api/updater' +import { invoke } from '@tauri-apps/api/tauri'; +import { emit } from '@tauri-apps/api/event'; +import { dialog, app } from '@tauri-apps/api'; +import { relaunch } from '@tauri-apps/api/process' + +import Swal from "sweetalert2"; +import * as data from "./data.ts"; + +const unlisten = await onUpdaterEvent(({ error, status }) => { + // This will log all updater events, including status updates and errors. + console.log('Updater event', error, status) + if (status == "DONE") { Swal.close() } // To close Swal. +}) + +try { + const { shouldUpdate, manifest } = await checkUpdate() + if (shouldUpdate) { + // You could show a dialog asking the user if they want to install the update here. + console.log("We received a update."); + console.log(manifest); + const choice = await dialog.ask(`新版本:BiliTools v${manifest?.version} 可用!当前版本:v${await app.getVersion()}。 +\n您想要现在更新吗? +\n更新发布时间:${manifest?.date} +\n更新说明:\n${manifest?.body} +\n注意:更新期间将无法使用APP。 +更新下载完成后,将会自动重启应用以完成更新。`, "更新"); + if (choice) { + Swal.fire({ + title: "正在下载更新...", + allowOutsideClick: false, + didOpen: () => { + Swal.showLoading(); + }, + }); + // Kill aria2c. + invoke("handle_aria2c", { action: "kill", secret: data.secret }) + // Install the update. This will also restart the app on Windows! + await installUpdate() + // On macOS and Linux you will need to restart the app manually. + // You could use this step to display another confirmation dialog. + await relaunch() + } + } +} catch (e) { emit("error", e) } + +// you need to call unlisten if your handler goes out of scope, for example if the component is unmounted. +unlisten() \ No newline at end of file diff --git a/vite.config.ts b/vite.config.ts index 96ac3e0..892687a 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -10,7 +10,10 @@ export default defineConfig(async () => ({ // 1. prevent vite from obscuring rust errors clearScreen: false, // 2. tauri expects a fixed port, fail if that port is not available - build: { outDir: "../dist" }, + build: { + outDir: "../dist", + target: "ESNext" + }, server: { port: 1420, strictPort: true,