From 0e14c9a9259a43f4689663ba9ab8502d41482425 Mon Sep 17 00:00:00 2001 From: yukaidi Date: Fri, 29 May 2026 10:57:49 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E7=BB=9F=E4=B8=80=E7=89=88?= =?UTF-8?q?=E6=9C=AC=E5=8F=B7=E7=AE=A1=E7=90=86=EF=BC=8C=E6=B6=88=E9=99=A4?= =?UTF-8?q?=E7=A1=AC=E7=BC=96=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 项目版本(pom.xml revision)和parser版本(parserVersion)统一为单一来源, 前端构建时自动同步,发版只需改根pom.xml的两个属性。 --- README.md | 6 +++--- parser/README.md | 8 ++++---- parser/doc/CUSTOM_PARSER_GUIDE.md | 2 +- parser/doc/CUSTOM_PARSER_QUICKSTART.md | 2 +- parser/pom.xml | 3 +-- pom.xml | 3 ++- web-front/package.json | 4 ++-- web-front/scripts/sync-version.js | 23 +++++++++++++++++++++++ web-front/src/views/Home.vue | 5 ++++- web-front/vue.config.js | 14 +++++++++++++- 10 files changed, 54 insertions(+), 16 deletions(-) create mode 100644 web-front/scripts/sync-version.js diff --git a/README.md b/README.md index 95648e3..578f069 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@ # 一款网盘分享链接云解析快速下载服务 QQ交流群:1017480890

- + - + AtomGit @@ -419,7 +419,7 @@ docker run --rm -v /var/run/docker.sock:/var/run/docker.sock containrrr/watchtow > 注意: netdisk-fast-download.service中的ExecStart的路径改为实际路径 ```shell cd ~ -wget -O netdisk-fast-download.zip https://github.com/qaiu/netdisk-fast-download/releases/download/v0.1.9b7/netdisk-fast-download-bin.zip +wget -O netdisk-fast-download.zip https://github.com/qaiu/netdisk-fast-download/releases/download/v3.0.2/netdisk-fast-download-bin.zip unzip netdisk-fast-download-bin.zip cd netdisk-fast-download bash service-install.sh diff --git a/parser/README.md b/parser/README.md index 9b3c606..ddae166 100644 --- a/parser/README.md +++ b/parser/README.md @@ -4,26 +4,26 @@ NFD 解析器模块:聚合各类网盘/分享页解析,统一输出文件列 - 语言:Java 17 - 构建:Maven -- 模块版本:10.1.17 +- 模块版本:10.2.5 ## 依赖(Maven Central) ```xml cn.qaiu parser - 10.1.17 + 10.2.5 ``` - Gradle Groovy DSL: ```groovy dependencies { - implementation 'cn.qaiu:parser:10.1.17' + implementation 'cn.qaiu:parser:10.2.5' } ``` - Gradle Kotlin DSL: ```kotlin dependencies { - implementation("cn.qaiu:parser:10.1.17") + implementation("cn.qaiu:parser:10.2.5") } ``` diff --git a/parser/doc/CUSTOM_PARSER_GUIDE.md b/parser/doc/CUSTOM_PARSER_GUIDE.md index 9628cb2..ede1900 100644 --- a/parser/doc/CUSTOM_PARSER_GUIDE.md +++ b/parser/doc/CUSTOM_PARSER_GUIDE.md @@ -28,7 +28,7 @@ cn.qaiu parser - 10.1.17 + 10.2.5 ``` diff --git a/parser/doc/CUSTOM_PARSER_QUICKSTART.md b/parser/doc/CUSTOM_PARSER_QUICKSTART.md index 8067805..b17d297 100644 --- a/parser/doc/CUSTOM_PARSER_QUICKSTART.md +++ b/parser/doc/CUSTOM_PARSER_QUICKSTART.md @@ -11,7 +11,7 @@ cn.qaiu parser - 10.1.17 + 10.2.5 ``` diff --git a/parser/pom.xml b/parser/pom.xml index c5f93c8..2a55f4d 100644 --- a/parser/pom.xml +++ b/parser/pom.xml @@ -12,7 +12,7 @@ cn.qaiu parser - 10.2.5 + ${parserVersion} jar cn.qaiu:parser @@ -52,7 +52,6 @@ - 0.2.1 17 17 17 diff --git a/pom.xml b/pom.xml index 2774c9b..4a00f07 100644 --- a/pom.xml +++ b/pom.xml @@ -32,6 +32,7 @@ 2.0.16 3.18.0 2.0.0 + 10.2.5 2.18.6 1.5.32 @@ -74,7 +75,7 @@ cn.qaiu parser - 10.2.5 + ${parserVersion} diff --git a/web-front/package.json b/web-front/package.json index 814d708..5abfb36 100644 --- a/web-front/package.json +++ b/web-front/package.json @@ -5,8 +5,8 @@ "scripts": { "serve": "vue-cli-service serve", "dev": "vue-cli-service serve", - "build": "vue-cli-service build && node scripts/compress-vs.js", - "build:no-compress": "vue-cli-service build", + "build": "node scripts/sync-version.js && vue-cli-service build && node scripts/compress-vs.js", + "build:no-compress": "node scripts/sync-version.js && vue-cli-service build", "lint": "vue-cli-service lint" }, "dependencies": { diff --git a/web-front/scripts/sync-version.js b/web-front/scripts/sync-version.js new file mode 100644 index 0000000..cbae542 --- /dev/null +++ b/web-front/scripts/sync-version.js @@ -0,0 +1,23 @@ +const fs = require('fs'); +const path = require('path'); + +const pomPath = path.resolve(__dirname, '../../pom.xml'); +const pkgPath = path.resolve(__dirname, '../package.json'); + +const pomContent = fs.readFileSync(pomPath, 'utf-8'); +const match = pomContent.match(/([^<]+)<\/revision>/); +if (!match) { + console.error('sync-version: not found in root pom.xml'); + process.exit(1); +} + +const version = match[1]; +const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf-8')); +if (pkg.version === version) { + console.log(`sync-version: package.json already at ${version}`); + process.exit(0); +} + +pkg.version = version; +fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + '\n'); +console.log(`sync-version: package.json ${pkg.version} -> ${version}`); diff --git a/web-front/src/views/Home.vue b/web-front/src/views/Home.vue index 66979ee..2868877 100644 --- a/web-front/src/views/Home.vue +++ b/web-front/src/views/Home.vue @@ -73,7 +73,7 @@

-
NFD网盘直链解析0.3.0
+
NFD网盘直链解析 {{ projectVersion }}
支持网盘:蓝奏云、蓝奏云优享、小飞机盘、123云盘、iCloud、移动云空间、联想乐云、QQ闪传等 >>
文件夹解析支持:蓝奏云、蓝奏云优享、小飞机盘、123云盘
@@ -717,6 +717,9 @@ export default { githubRepoUrl() { return process.env.VUE_APP_GITHUB_REPO_URL }, + projectVersion() { + return process.env.VUE_APP_VERSION || '0.0.0' + }, // 检查是否配置了认证信息(针对当前链接的网盘类型) hasAuthConfig() { const panType = this.getCurrentPanType() diff --git a/web-front/vue.config.js b/web-front/vue.config.js index 731ffdd..31bb93c 100644 --- a/web-front/vue.config.js +++ b/web-front/vue.config.js @@ -16,6 +16,17 @@ function getGitHubRepoUrl() { } catch (e) {} return 'https://github.com/qaiu/netdisk-fast-download'; } +// 从根 pom.xml 读取项目版本号(单一版本来源) +function getProjectVersion() { + try { + const pomContent = require('fs').readFileSync(path.resolve(__dirname, '../pom.xml'), 'utf-8'); + const match = pomContent.match(/([^<]+)<\/revision>/); + if (match) return match[1]; + } catch (e) {} + return require('./package.json').version; +} +const PROJECT_VERSION = getProjectVersion(); + const GITHUB_REPO_URL = getGitHubRepoUrl(); const CompressionPlugin = require('compression-webpack-plugin'); @@ -69,7 +80,8 @@ module.exports = { }, plugins: [ new webpack.DefinePlugin({ - 'process.env.VUE_APP_GITHUB_REPO_URL': JSON.stringify(GITHUB_REPO_URL) + 'process.env.VUE_APP_GITHUB_REPO_URL': JSON.stringify(GITHUB_REPO_URL), + 'process.env.VUE_APP_VERSION': JSON.stringify(PROJECT_VERSION) }), new MonacoEditorPlugin({ languages: ['javascript', 'typescript', 'json'],