mirror of
https://github.com/qaiu/netdisk-fast-download.git
synced 2026-06-10 23:47:29 +00:00
feat: 新功能与配置优化
- QQscTool: 支持多文件和目录解析,通过 GetFileList API 实现递归目录导航 - Home: 从粘贴文本中自动提取分享链接 - DirectoryTree: 目录浏览添加复制直链按钮 - domainName 改为可选,未配置时自动从请求地址推断 - 统一版本号管理,GitHub URL 构建时自动从 git remote origin 识别 - vue.config.js 添加前端构建配置,sync-version.js 构建时同步版本号
This commit is contained in:
@@ -10,7 +10,7 @@
|
||||
<meta name="description"
|
||||
content="Netdisk fast download 网盘直链解析工具">
|
||||
<!-- Font Awesome 图标库 - 使用国内CDN -->
|
||||
<link rel="stylesheet" href="https://cdn.bootcdn.net/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
||||
<link rel="stylesheet" href="https://s4.zstatic.net/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
||||
<!-- 迅雷 JS-SDK -->
|
||||
<script src="//open.thunderurl.com/thunder-link.js"></script>
|
||||
<style>
|
||||
|
||||
23
web-front/scripts/sync-version.js
Normal file
23
web-front/scripts/sync-version.js
Normal file
@@ -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>([^<]+)<\/revision>/);
|
||||
if (!match) {
|
||||
console.error('sync-version: <revision> 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}`);
|
||||
@@ -1,10 +1,34 @@
|
||||
|
||||
const path = require("path");
|
||||
const { execSync } = require("child_process");
|
||||
const webpack = require("webpack");
|
||||
|
||||
function resolve(dir) {
|
||||
return path.join(__dirname, dir)
|
||||
}
|
||||
|
||||
// 从 git remote origin 自动识别 GitHub 仓库地址
|
||||
function getGitHubRepoUrl() {
|
||||
try {
|
||||
const remoteUrl = execSync('git remote get-url origin', { encoding: 'utf-8', cwd: path.resolve(__dirname, '..') }).trim();
|
||||
const match = remoteUrl.match(/github\.com[:/]([^/]+\/[^/.]+?)(?:\.git)?$/);
|
||||
if (match) return `https://github.com/${match[1]}`;
|
||||
} 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>([^<]+)<\/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');
|
||||
const FileManagerPlugin = require('filemanager-webpack-plugin');
|
||||
const MonacoEditorPlugin = require('monaco-editor-webpack-plugin');
|
||||
@@ -55,6 +79,10 @@ module.exports = {
|
||||
]
|
||||
},
|
||||
plugins: [
|
||||
new webpack.DefinePlugin({
|
||||
'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'],
|
||||
features: ['coreCommands', 'find', 'format', 'suggest', 'quickCommand'],
|
||||
|
||||
Reference in New Issue
Block a user