mirror of
https://github.com/qaiu/netdisk-fast-download.git
synced 2025-12-15 11:53:02 +00:00
目录解析支持优化 v0.1.9b5
This commit is contained in:
86
bin/nfd-install.sh
Normal file
86
bin/nfd-install.sh
Normal file
@@ -0,0 +1,86 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# ----------- 配置区域 ------------
|
||||
# JRE 下载目录
|
||||
JRE_DIR="/opt/custom-jre17"
|
||||
# 使用阿里云镜像下载 JRE(OpenJDK 17)
|
||||
JRE_TARBALL_URL="https://mirrors.tuna.tsinghua.edu.cn/Adoptium/17/jre/x64/linux/OpenJDK17U-jre_x64_linux_hotspot_17.0.15_6.tar.gz"
|
||||
|
||||
# ZIP 文件下载相关
|
||||
ZIP_URL="http://www.722shop.top:6401/parser?url=https://wwsd.lanzouw.com/i65zN30nd4dc"
|
||||
ZIP_DEST_DIR="/opt/target-zip"
|
||||
ZIP_FILE_NAME="nfd.zip"
|
||||
# --------------------------------
|
||||
|
||||
# 创建目录
|
||||
mkdir -p "$JRE_DIR"
|
||||
mkdir -p "$ZIP_DEST_DIR"
|
||||
|
||||
# -------- 检查 unzip 是否存在 --------
|
||||
if ! command -v unzip >/dev/null 2>&1; then
|
||||
echo "unzip 未安装,正在安装..."
|
||||
|
||||
if command -v apt-get >/dev/null 2>&1; then
|
||||
apt-get update && apt-get install -y unzip
|
||||
elif command -v yum >/dev/null 2>&1; then
|
||||
yum install -y unzip
|
||||
elif command -v dnf >/dev/null 2>&1; then
|
||||
dnf install -y unzip
|
||||
else
|
||||
echo "不支持的包管理器,无法自动安装 unzip,请手动安装后重试。"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "unzip 已安装"
|
||||
fi
|
||||
|
||||
# -------- 下载并解压 JRE --------
|
||||
echo "下载 JRE 17 到 $JRE_DIR..."
|
||||
curl -L "$JRE_TARBALL_URL" -o "$JRE_DIR/jre17.tar.gz"
|
||||
|
||||
echo "解压 JRE..."
|
||||
tar -xzf "$JRE_DIR/jre17.tar.gz" -C "$JRE_DIR" --strip-components=1
|
||||
rm "$JRE_DIR/jre17.tar.gz"
|
||||
echo "JRE 解压完成"
|
||||
|
||||
# -------- 下载 ZIP 文件 --------
|
||||
ZIP_PATH="$ZIP_DEST_DIR/$ZIP_FILE_NAME"
|
||||
echo "下载 ZIP 文件到 $ZIP_PATH..."
|
||||
curl -L "$ZIP_URL" -o "$ZIP_PATH"
|
||||
|
||||
# -------- 解压 ZIP 文件 --------
|
||||
echo "解压 ZIP 文件到 $ZIP_DEST_DIR..."
|
||||
unzip -o "$ZIP_PATH" -d "$ZIP_DEST_DIR"
|
||||
echo "解压完成"
|
||||
|
||||
# -------- 启动 JAR 程序 --------
|
||||
echo "进入 JAR 目录并后台运行程序..."
|
||||
|
||||
JAR_DIR="/opt/target-zip/netdisk-fast-download"
|
||||
JAR_FILE="netdisk-fast-download.jar"
|
||||
JAVA_BIN="$JRE_DIR/bin/java"
|
||||
LOG_FILE="$JAR_DIR/app.log"
|
||||
|
||||
if [ ! -d "$JAR_DIR" ]; then
|
||||
echo "[错误] 找不到 JAR 目录: $JAR_DIR"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cd "$JAR_DIR"
|
||||
|
||||
if [ ! -f "$JAR_FILE" ]; then
|
||||
echo "[错误] 找不到 JAR 文件: $JAR_FILE"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -x "$JAVA_BIN" ]; then
|
||||
echo "[错误] 找不到可执行的 java: $JAVA_BIN"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 后台运行,日志记录
|
||||
nohup "$JAVA_BIN" -jar "$JAR_FILE" > "$LOG_FILE" 2>&1 &
|
||||
|
||||
echo "程序已在后台启动 ✅"
|
||||
echo "日志路径: $LOG_FILE"
|
||||
@@ -4,6 +4,7 @@ import cn.qaiu.entity.FileInfo;
|
||||
import cn.qaiu.entity.ShareLinkInfo;
|
||||
import cn.qaiu.parser.PanBase;
|
||||
import cn.qaiu.util.CommonUtils;
|
||||
import cn.qaiu.util.FileSizeConverter;
|
||||
import cn.qaiu.util.JsExecUtils;
|
||||
import io.vertx.core.Future;
|
||||
import io.vertx.core.MultiMap;
|
||||
@@ -271,22 +272,68 @@ public class YeTool extends PanBase {
|
||||
for (int i = 0; i < infoList.size(); i++) {
|
||||
JsonObject item = infoList.getJsonObject(i);
|
||||
FileInfo fileInfo = new FileInfo();
|
||||
// "FileId": 16603582,
|
||||
// "FileName": "pdf",
|
||||
// "Type": 1,
|
||||
// "Size": 0,
|
||||
// "ContentType": "0",
|
||||
// "S3KeyFlag": "",
|
||||
// "CreateAt": "2025-07-09T06:56:20+08:00",
|
||||
// "UpdateAt": "2025-07-09T06:56:20+08:00",
|
||||
// "Etag": "",
|
||||
// "DownloadUrl": "",
|
||||
// "Status": 0,
|
||||
// "ParentFileId": 16603579,
|
||||
// "Category": 0,
|
||||
// "PunishFlag": 0,
|
||||
// "StorageNode": "m0",
|
||||
// "PreviewType": 0
|
||||
|
||||
// =>
|
||||
// {
|
||||
// "ShareKey":"iaKtVv-FTaCd",
|
||||
// "FileID":16604189,
|
||||
// "S3keyFlag":"1815268665-0",
|
||||
// "Size":425929,
|
||||
// "Etag":"70049de67075ab2b269c62d690424601",
|
||||
// "OrderId":""}
|
||||
JsonObject postData = JsonObject.of()
|
||||
.put("ShareKey", shareKey)
|
||||
.put("FileID", item.getInteger("FileId"))
|
||||
.put("S3keyFlag", item.getString("S3KeyFlag"))
|
||||
.put("Size", item.getLong("Size"))
|
||||
.put("Etag", item.getString("Etag"));
|
||||
|
||||
byte[] encode = Base64.getEncoder().encode(postData.encode().getBytes());
|
||||
String param = new String(encode);
|
||||
|
||||
if (item.getInteger("Type") == 0) { // 文件
|
||||
fileInfo.setFileName(item.getString("FileName"))
|
||||
.setFileId(item.getString("FileId"))
|
||||
.setFileType("file")
|
||||
.setSize(item.getLong("Size"))
|
||||
.setParserUrl(String.format("%s/v2/getFileList/%s/%s", getDomainName(),
|
||||
shareLinkInfo.getType(), generateParam(item)))
|
||||
.setCreateTime(item.getString("CreateAt"))
|
||||
.setUpdateTime(item.getString("UpdateAt"))
|
||||
.setSizeStr(FileSizeConverter.convertToReadableSize(item.getLong("Size")))
|
||||
.setParserUrl(String.format("%s/v2/redirectUrl/%s/%s", getDomainName(),
|
||||
shareLinkInfo.getType(), param))
|
||||
.setPreviewUrl(String.format("%s/v2/viewUrl/%s/%s", getDomainName(),
|
||||
shareLinkInfo.getType(), generateParam(item)));
|
||||
shareLinkInfo.getType(), param));
|
||||
result.add(fileInfo);
|
||||
} else if (item.getInteger("Type") == 1) { // 目录
|
||||
fileInfo.setFileName(item.getString("FileName"))
|
||||
.setFileId(item.getString("FileId"))
|
||||
.setCreateTime(item.getString("CreateAt"))
|
||||
.setUpdateTime(item.getString("UpdateAt"))
|
||||
.setSize(0L)
|
||||
.setFileType("folder")
|
||||
.setParserUrl(String.format("%s/v2/getFileList?url=%s&dirId=%s", getDomainName(),
|
||||
shareLinkInfo.getShareUrl(), item.getString("FileId")));
|
||||
.setParserUrl(
|
||||
String.format("%s/v2/getFileList?url=%s&dirId=%s&pwd=%s",
|
||||
getDomainName(),
|
||||
shareLinkInfo.getShareUrl(),
|
||||
item.getString("FileId"),
|
||||
pwd)
|
||||
);
|
||||
result.add(fileInfo);
|
||||
}
|
||||
}
|
||||
@@ -296,33 +343,11 @@ public class YeTool extends PanBase {
|
||||
return promise.future();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Future<String> parseById() {
|
||||
Promise<String> promise = Promise.promise();
|
||||
JsonObject paramJson = (JsonObject) shareLinkInfo.getOtherParam().get("paramJson");
|
||||
|
||||
// 调用下载接口获取直链
|
||||
client.getAbs(UriTemplate.of(DOWNLOAD_API_URL))
|
||||
.setTemplateParam("authK", paramJson.getString("authK"))
|
||||
.setTemplateParam("authV", paramJson.getString("authV"))
|
||||
.putHeaders(header)
|
||||
.send().onSuccess(res -> {
|
||||
JsonObject response = asJson(res);
|
||||
if (response.getInteger("code") != 0) {
|
||||
promise.fail("API错误: " + response.getString("message"));
|
||||
return;
|
||||
}
|
||||
String downloadUrl = response.getJsonObject("data").getString("redirect_url");
|
||||
promise.complete(downloadUrl);
|
||||
}).onFailure(promise::fail);
|
||||
|
||||
down(client, paramJson, DOWNLOAD_API_URL);
|
||||
return promise.future();
|
||||
}
|
||||
|
||||
|
||||
private String generateParam(JsonObject fileJson) {
|
||||
// 生成API请求所需的加密参数
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
module.exports = {
|
||||
presets: [
|
||||
'@vue/cli-plugin-babel/preset'
|
||||
],
|
||||
plugins: [
|
||||
'@vue/babel-plugin-transform-vue-jsx'
|
||||
]
|
||||
}
|
||||
|
||||
@@ -16,18 +16,22 @@
|
||||
"core-js": "^3.8.3",
|
||||
"element-plus": "^2.8.7",
|
||||
"qrcode": "^1.5.4",
|
||||
"splitpanes": "^4.0.4",
|
||||
"vue": "^3.5.12",
|
||||
"vue-clipboard3": "^2.0.0",
|
||||
"vue-router": "^4.5.1",
|
||||
"vue3-json-viewer": "2.2.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.26.0",
|
||||
"@babel/eslint-parser": "^7.25.9",
|
||||
"@babel/plugin-transform-class-properties": "^7.26.0",
|
||||
"@vue/babel-plugin-transform-vue-jsx": "^1.4.0",
|
||||
"@vue/cli-plugin-babel": "~5.0.8",
|
||||
"@vue/cli-plugin-eslint": "~5.0.8",
|
||||
"@vue/cli-service": "~5.0.8",
|
||||
"compression-webpack-plugin": "^11.1.0",
|
||||
"eslint": "^9.14.0",
|
||||
"eslint": "^9.0.0",
|
||||
"eslint-plugin-vue": "^9.30.0",
|
||||
"filemanager-webpack-plugin": "8.0.0"
|
||||
},
|
||||
@@ -49,5 +53,12 @@
|
||||
"> 1%",
|
||||
"last 2 versions",
|
||||
"not dead"
|
||||
]
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=16.0.0 <=22.0.0",
|
||||
"npm": ">=8.0.0"
|
||||
},
|
||||
"overrides": {
|
||||
"eslint": "^9.0.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
content="Netdisk fast download,网盘直链解析工具">
|
||||
<meta name="description"
|
||||
content="Netdisk fast download 网盘直链解析工具">
|
||||
<!-- Font Awesome 图标库 -->
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
||||
<style>
|
||||
.page-loading-wrap {
|
||||
padding: 120px;
|
||||
|
||||
@@ -1,379 +1,21 @@
|
||||
<template>
|
||||
<div id="app">
|
||||
|
||||
<el-row :gutter="20">
|
||||
<el-card class="box-card">
|
||||
|
||||
<div style="text-align: right"><DarkMode/></div>
|
||||
<div class="demo-basic--circle">
|
||||
<div class="block" style="text-align: center;">
|
||||
<img :height="150" src="../public/images/lanzou111.png" alt="lz"></img>
|
||||
</div>
|
||||
</div>
|
||||
<h3 style="text-align: center;">NFD网盘直链解析0.1.9_bate2</h3>
|
||||
<div class="typo">
|
||||
<p style="text-align: center;">
|
||||
<span>
|
||||
<el-link href="https://github.com/qaiu/netdisk-fast-download" target="_blank" rel="nofollow">
|
||||
<u>GitHub</u></el-link>
|
||||
</span>
|
||||
<span style="margin-left: 30px">
|
||||
<el-link href="https://blog.qaiu.top/archives/netdisk-fast-download-bao-ta-an-zhuang-jiao-cheng" target="_blank"
|
||||
rel="nofollow"><u>宝塔部署安装教程</u>
|
||||
</el-link>
|
||||
</span>
|
||||
<span style="margin-left: 30px">
|
||||
<el-link href="https://blog.qaiu.top" target="_blank"
|
||||
rel="nofollow"><u>QAIU博客</u>
|
||||
</el-link>
|
||||
</span></p>
|
||||
<p><strong>文件解析支持 </strong>蓝奏云/蓝奏云优享/小飞机盘/123云盘/奶牛快传/移动云云空间/亿方云/文叔叔/QQ邮箱文件中转站</p>
|
||||
<p><strong>目录解析支持 </strong>蓝奏云/蓝奏云优享/小飞机盘/123云盘(接入中)</p>
|
||||
<p>已加入缓存机制, 如果遇到解析出的下载链接失效的情况请及时到<a href="https://github.com/qaiu/netdisk-fast-download/issues">
|
||||
<u><strong>项目GitHub反馈</strong></u></a></p>
|
||||
<p>节点1: 回源请求数:{{ node1Info.parserTotal }}, 缓存请求数:{{ node1Info.cacheTotal }}, 总数:{{ node1Info.total }}</p>
|
||||
<!-- <p>节点2: 成功:{{ node2Info.success }},失败:{{ node2Info.fail }},总数:{{ node2Info.total }}</p>-->
|
||||
</div>
|
||||
<hr>
|
||||
<div class="main" v-loading="isLoading">
|
||||
<div class="grid-content">
|
||||
|
||||
<!-- 开关按钮,控制是否自动读取剪切板 -->
|
||||
<el-switch
|
||||
v-model="autoReadClipboard"
|
||||
active-text="自动识别剪切板"
|
||||
></el-switch>
|
||||
|
||||
<el-input placeholder="请粘贴分享链接(http://或https://)" v-model="link" id="url">
|
||||
<template #prepend>分享链接</template>
|
||||
<template #append v-if="!autoReadClipboard">
|
||||
<el-button @click="() => getPaste(1)">读取剪切板</el-button>
|
||||
</template>
|
||||
</el-input>
|
||||
<el-input placeholder="请输入密码" v-model="password" id="url">
|
||||
<template #prepend>分享密码</template>
|
||||
</el-input>
|
||||
<el-input v-show="getLink2" :value="getLink2" id="url">
|
||||
<template #prepend>智能直链</template>
|
||||
<template #append>
|
||||
<el-button v-clipboard:copy="getLink2"
|
||||
v-clipboard:success="onCopy"
|
||||
v-clipboard:error="onError">
|
||||
<el-icon><CopyDocument/></el-icon>
|
||||
</el-button>
|
||||
</template>
|
||||
</el-input>
|
||||
|
||||
<p style="text-align: center">
|
||||
<el-button style="margin-left: 40px" @click="onSubmit">文件解析</el-button>
|
||||
<!-- 目录解析-->
|
||||
<el-button style="margin-left: 20px" @click="getFileList">目录解析</el-button>
|
||||
<el-button style="margin-left: 20px" @click="genMd">生成Markdown链接</el-button>
|
||||
<el-button style="margin-left: 20px" @click="generateQRCode">扫码下载</el-button>
|
||||
<el-button style="margin-left: 20px" @click="getTj">链接信息统计</el-button>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div v-if="respData.code" style="margin-top: 10px">
|
||||
<strong>解析结果: </strong>
|
||||
<json-viewer
|
||||
:value="respData"
|
||||
:expand-depth=5
|
||||
copyable
|
||||
boxed
|
||||
sort
|
||||
/>
|
||||
<a :href="downUrl" v-show="downUrl">点击下载</a>
|
||||
</div>
|
||||
<div v-if="mdText" style="text-align: center">
|
||||
<el-input :value="mdText" readonly>
|
||||
<template #append>
|
||||
<el-button v-clipboard:copy="mdText"
|
||||
v-clipboard:success="onCopy"
|
||||
v-clipboard:error="onError">
|
||||
<el-icon><CopyDocument/></el-icon>
|
||||
</el-button>
|
||||
</template>
|
||||
</el-input>
|
||||
</div>
|
||||
<div style="text-align: center" v-show="showQrc">
|
||||
<canvas ref="qrcodeCanvas"></canvas>
|
||||
<div style="text-align: center"><el-link target="_blank" :href="codeUrl">{{ codeUrl }}</el-link></div>
|
||||
</div>
|
||||
<div v-if="tjData.shareLinkInfo">
|
||||
<el-descriptions class="margin-top" title="分享详情" :column="1" border>
|
||||
<template slot="extra">
|
||||
<el-button type="primary" size="small">操作</el-button>
|
||||
</template>
|
||||
<el-descriptions-item label="网盘名称">{{ tjData.shareLinkInfo.panName }}</el-descriptions-item>
|
||||
<el-descriptions-item label="网盘标识">{{ tjData.shareLinkInfo.type }}</el-descriptions-item>
|
||||
<el-descriptions-item label="分享Key">{{ tjData.shareLinkInfo.shareKey }}</el-descriptions-item>
|
||||
<el-descriptions-item label="分享链接"> <el-link target="_blank" :href="tjData.shareLinkInfo.shareUrl">{{ tjData.shareLinkInfo.shareUrl }}</el-link></el-descriptions-item>
|
||||
<el-descriptions-item label="jsonApi链接"> <el-link target="_blank" :href="tjData.apiLink">{{ tjData.apiLink }}</el-link></el-descriptions-item>
|
||||
<el-descriptions-item label="302下载链接"> <el-link target="_blank" :href="tjData.downLink">{{ tjData.downLink }}</el-link></el-descriptions-item>
|
||||
<el-descriptions-item label="解析次数">{{ tjData.parserTotal }}</el-descriptions-item>
|
||||
<el-descriptions-item label="缓存命中次数">{{ tjData.cacheHitTotal }}</el-descriptions-item>
|
||||
<el-descriptions-item label="总请求次数">{{ tjData.sumTotal }}</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</el-card>
|
||||
</el-row>
|
||||
<router-view></router-view>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import axios from 'axios'
|
||||
import QRCode from 'qrcode'
|
||||
import DarkMode from '@/components/DarkMode'
|
||||
|
||||
import parserUrl from './parserUrl1'
|
||||
|
||||
export default {
|
||||
name: 'App',
|
||||
components: {DarkMode},
|
||||
data() {
|
||||
return {
|
||||
// baseAPI: `${location.protocol}//${location.hostname}:6400`,
|
||||
baseAPI: `${location.protocol}//${location.host}`,
|
||||
autoReadClipboard: true, // 开关状态,默认为自动读取
|
||||
current: {}, // 当前分享
|
||||
showQrc: false,
|
||||
codeUrl: '',
|
||||
mdText: '',
|
||||
link: "",
|
||||
password: "",
|
||||
isLoading: false,
|
||||
downUrl: null,
|
||||
select: "lz",
|
||||
respData: {},
|
||||
tjData: {},
|
||||
getLink: null,
|
||||
getLink2: '',
|
||||
getLinkInfo: null,
|
||||
node1Info: {},
|
||||
node2Info: {},
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// toggleDark() {
|
||||
// toggleDark()
|
||||
// },
|
||||
check() {
|
||||
this.mdText = ''
|
||||
this.showQrc = false
|
||||
this.respData = {}
|
||||
this.tjData = {}
|
||||
if (!this.link.startsWith("https://") && !this.link.startsWith("http://")) {
|
||||
this.$message.error("请输入有效链接!")
|
||||
throw new Error('请输入有效链接')
|
||||
}
|
||||
},
|
||||
onSubmit() {
|
||||
this.check()
|
||||
this.isLoading = true
|
||||
this.downUrl = ''
|
||||
this.respData = {}
|
||||
this.getLink2 = `${this.baseAPI}/parser?url=${this.link}`
|
||||
// this.getLink = `${location.protocol}//${location.host}/api/json/parser?url=${this.link}`
|
||||
// this.getLink = `${location.protocol}//${location.host}/json/parser`
|
||||
if (this.password) {
|
||||
this.getLink2 += `&pwd=${this.password}`
|
||||
}
|
||||
axios.get(this.getLink, {params: {url: this.link, pwd: this.password}}).then(
|
||||
response => {
|
||||
this.isLoading = false
|
||||
this.respData = response.data
|
||||
if (response.data.code === 200) {
|
||||
this.$message({
|
||||
message: response.data.msg,
|
||||
type: 'success'
|
||||
})
|
||||
this.downUrl = response.data.data.directLink
|
||||
} else {
|
||||
this.$message.error(response.data.msg)
|
||||
}
|
||||
this.getInfo()
|
||||
},
|
||||
error => {
|
||||
this.isLoading = false
|
||||
this.$message.error(error.message)
|
||||
}
|
||||
)
|
||||
},
|
||||
onCopy() {
|
||||
this.$message.success('复制成功')
|
||||
},
|
||||
onError() {
|
||||
this.$message.error('复制失败')
|
||||
},
|
||||
getInfo() {
|
||||
// 初始化统计信息
|
||||
axios.get('/v2/statisticsInfo').then(
|
||||
response => {
|
||||
if (response.data.success) {
|
||||
this.node1Info = response.data.data
|
||||
}
|
||||
})
|
||||
// axios.get('/n2/statisticsInfo').then(
|
||||
// response => {
|
||||
// if (response.data.success) {
|
||||
// this.node2Info = response.data.data
|
||||
// }
|
||||
// })
|
||||
},
|
||||
genMd() {
|
||||
this.check()
|
||||
axios.get(this.getLinkInfo, {params: {url: this.link, pwd: this.password}}).then(
|
||||
response => {
|
||||
this.isLoading = false
|
||||
if (response.data.code === 200) {
|
||||
this.$message({
|
||||
message: response.data.msg,
|
||||
type: 'success'
|
||||
})
|
||||
this.mdText = this.buildMd('快速下载地址',response.data.data.downLink)
|
||||
} else {
|
||||
this.$message.error(response.data.msg)
|
||||
}
|
||||
});
|
||||
},
|
||||
buildMd(title, url) {
|
||||
return `[${title}](${url})`
|
||||
},
|
||||
generateQRCode() {
|
||||
this.check()
|
||||
const options = { // 设置二维码的参数,例如大小、边距等
|
||||
width: 150,
|
||||
height: 150,
|
||||
margin: 2
|
||||
};
|
||||
axios.get(this.getLinkInfo, {params: {url: this.link, pwd: this.password}}).then(
|
||||
response => {
|
||||
this.isLoading = false
|
||||
if (response.data.code === 200) {
|
||||
this.$message({
|
||||
message: response.data.msg,
|
||||
type: 'success'
|
||||
})
|
||||
this.codeUrl = response.data.data.downLink
|
||||
QRCode.toCanvas(this.$refs.qrcodeCanvas, this.codeUrl, options, error => {
|
||||
if (error) console.error(error);
|
||||
});
|
||||
this.showQrc = true
|
||||
} else {
|
||||
this.$message.error(response.data.msg)
|
||||
}
|
||||
});
|
||||
},
|
||||
getTj() {
|
||||
this.check()
|
||||
axios.get(this.getLinkInfo, {params: {url: this.link, pwd: this.password}}).then(
|
||||
response => {
|
||||
this.isLoading = false
|
||||
if (response.data.code === 200) {
|
||||
this.$message({
|
||||
message: response.data.msg,
|
||||
type: 'success'
|
||||
})
|
||||
this.tjData = response.data.data
|
||||
} else {
|
||||
this.$message.error(response.data.msg)
|
||||
}
|
||||
});
|
||||
},
|
||||
getFileList() {
|
||||
this.check()
|
||||
this.isLoading = true
|
||||
axios.get(this.getLinkInfo, {params: {url: this.link, pwd: this.password}}).then(
|
||||
response => {
|
||||
this.isLoading = false
|
||||
if (response.data.code === 200) {
|
||||
this.$message({
|
||||
message: response.data.msg,
|
||||
type: 'success'
|
||||
})
|
||||
const data = response.data.data
|
||||
const panList = ["iz", "lz", "fj", "ye"];
|
||||
|
||||
if (!panList.includes(data.shareLinkInfo.type)) {
|
||||
this.$message.error("当前网盘不支持目录解析")
|
||||
return;
|
||||
}
|
||||
let listUrl = `${window.location.origin}/list.html?url=${encodeURIComponent(this.link)}`
|
||||
let apiUrl = new URL(data.apiLink).origin + `/v2/getFileList?url=${this.link}`;
|
||||
// 动态添加密码参数
|
||||
if (this.password) {
|
||||
listUrl += `&pwd=${this.password}`;
|
||||
apiUrl += `&pwd=${this.password}`;
|
||||
}
|
||||
this.$alert(
|
||||
`目录解析API: <a href="${apiUrl}" target="_blank">${apiUrl}</a><br>打开文件列表: <a href="${listUrl}" target="_blank">点击这里</a>`,
|
||||
'目录解析信息',
|
||||
{
|
||||
dangerouslyUseHTMLString: true,
|
||||
confirmButtonText: '确定',
|
||||
type: 'info'
|
||||
}
|
||||
);
|
||||
|
||||
} else {
|
||||
this.$message.error(response.data.msg)
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
async getPaste(v) {
|
||||
const text = await navigator.clipboard.readText();
|
||||
console.log('获取到的文本内容是:', text);
|
||||
let linkInfo = parserUrl.parseLink(text);
|
||||
let pwd = parserUrl.parsePwd(text) || '';
|
||||
if (linkInfo.link) {
|
||||
if(linkInfo.link !== this.link || pwd !== this.password ) {
|
||||
this.password = pwd;
|
||||
this.link = linkInfo.link;
|
||||
this.getLink2 = `${this.baseAPI}/parser?url=${this.link}`
|
||||
if (this.link) this.$message.success(`自动识别分享成功, 网盘类型: ${linkInfo.name}; 分享URL ${this.link}; 分享密码: ${this.password || '空'}`);
|
||||
} else {
|
||||
v || this.$message.warning(`[${linkInfo.name}]分享信息无变化`)
|
||||
}
|
||||
} else {
|
||||
this.$message.warning("未能提取到分享链接, 该分享可能尚未支持, 你可以复制任意网盘/音乐App的分享到该页面, 系统智能识别")
|
||||
}
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
this.getLinkInfo = `${this.baseAPI}/v2/linkInfo`
|
||||
this.getLink = `${this.baseAPI}/json/parser`
|
||||
let item = window.localStorage.getItem("autoReadClipboard");
|
||||
if (item) {
|
||||
this.autoReadClipboard = (item === 'true');
|
||||
}
|
||||
|
||||
this.getInfo()
|
||||
|
||||
// 页面首次加载时,根据开关状态判断是否读取剪切板
|
||||
if (this.autoReadClipboard) {
|
||||
this.getPaste()
|
||||
}
|
||||
// 当文档获得焦点时触发
|
||||
window.addEventListener('focus', () => {
|
||||
if (this.autoReadClipboard) {
|
||||
this.getPaste()
|
||||
}
|
||||
});
|
||||
},
|
||||
watch: {
|
||||
autoReadClipboard(val) {
|
||||
window.localStorage.setItem("autoReadClipboard", val)
|
||||
}
|
||||
}
|
||||
|
||||
name: 'App'
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
body {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
|
||||
}
|
||||
#app {
|
||||
font-family: 'Avenir', Helvetica, Arial, sans-serif;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
@@ -383,62 +25,12 @@ export default {
|
||||
padding: 1em;
|
||||
max-width: 900px;
|
||||
}
|
||||
|
||||
|
||||
body:before {
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
opacity: .3;
|
||||
z-index: -1;
|
||||
position: fixed;
|
||||
nav ul {
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.grid-content {
|
||||
margin-top: 1em;
|
||||
border-radius: 4px;
|
||||
min-height: 50px;
|
||||
}
|
||||
|
||||
.el-select .el-input {
|
||||
width: 130px;
|
||||
}
|
||||
|
||||
.box-card {
|
||||
margin-top: 4em !important;
|
||||
margin-bottom: 4em !important;
|
||||
opacity: .8;
|
||||
}
|
||||
|
||||
@media screen and (max-width: 700px) {
|
||||
.box-card {
|
||||
margin-top: 1em !important;
|
||||
margin-bottom: 1em !important;
|
||||
}
|
||||
}
|
||||
|
||||
.download h3 {
|
||||
margin-top: 2em;
|
||||
}
|
||||
|
||||
.download button {
|
||||
margin-right: 0.5em;
|
||||
margin-left: 0.5em;
|
||||
}
|
||||
|
||||
.typo {
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.typo a {
|
||||
color: #0077ff;
|
||||
}
|
||||
|
||||
hr {
|
||||
height: 10px;
|
||||
margin-bottom: .8em;
|
||||
border: none;
|
||||
border-bottom: 1px solid rgba(0, 0, 0, .12);
|
||||
nav li {
|
||||
display: inline;
|
||||
margin-right: 15px;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -11,14 +11,18 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref,watch } from 'vue'
|
||||
import { ref, watch, onMounted } from 'vue'
|
||||
import { useDark, useToggle } from '@vueuse/core'
|
||||
/** 引入Element-Plus图标 */
|
||||
import { Sunny, Moon } from '@element-plus/icons-vue'
|
||||
|
||||
defineOptions({
|
||||
name: 'DarkMode'
|
||||
})
|
||||
|
||||
// 定义事件
|
||||
const emit = defineEmits(['theme-change'])
|
||||
|
||||
/** 切换模式 */
|
||||
const isDark = useDark({})
|
||||
|
||||
@@ -30,8 +34,32 @@ if (item) {
|
||||
}
|
||||
/** 是否切换为暗黑模式 */
|
||||
const darkMode = ref(item)
|
||||
|
||||
watch(darkMode, (newValue) => {
|
||||
console.log(`darkMode: ${newValue}`)
|
||||
window.localStorage.setItem("darkMode", newValue);
|
||||
|
||||
// 发射主题变化事件
|
||||
emit('theme-change', newValue)
|
||||
|
||||
// 应用主题到body
|
||||
if (newValue) {
|
||||
document.body.classList.add('dark-theme')
|
||||
document.documentElement.classList.add('dark-theme')
|
||||
} else {
|
||||
document.body.classList.remove('dark-theme')
|
||||
document.documentElement.classList.remove('dark-theme')
|
||||
}
|
||||
})
|
||||
|
||||
onMounted(() => {
|
||||
// 初始化时发射当前主题状态
|
||||
emit('theme-change', darkMode.value)
|
||||
|
||||
// 应用初始主题
|
||||
if (darkMode.value) {
|
||||
document.body.classList.add('dark-theme')
|
||||
document.documentElement.classList.add('dark-theme')
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
@@ -9,22 +9,24 @@ import 'element-plus/dist/index.css'
|
||||
import 'element-plus/theme-chalk/dark/css-vars.css'
|
||||
import "vue3-json-viewer/dist/index.css";
|
||||
import './styles/dark/css-vars.css'
|
||||
import router from './router'
|
||||
|
||||
window.$vueApp = Vue.createApp(App)
|
||||
const app = Vue.createApp(App)
|
||||
app.use(router)
|
||||
|
||||
|
||||
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
|
||||
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
|
||||
window.$vueApp.component(key, component)
|
||||
app.component(key, component)
|
||||
}
|
||||
|
||||
// Import JsonViewer as a Vue.js plugin
|
||||
window.$vueApp.use(JsonViewer)
|
||||
window.$vueApp.use(DirectiveExtensions)
|
||||
app.use(JsonViewer)
|
||||
app.use(DirectiveExtensions)
|
||||
|
||||
// or
|
||||
// components: {JsonViewer}
|
||||
|
||||
window.$vueApp.use(VueClipboard)
|
||||
window.$vueApp.use(ElementPlus)
|
||||
window.$vueApp.mount('#app')
|
||||
app.use(VueClipboard)
|
||||
app.use(ElementPlus)
|
||||
app.mount('#app')
|
||||
|
||||
@@ -0,0 +1,164 @@
|
||||
/* 全局样式 */
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: 'Avenir', Helvetica, Arial, sans-serif;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
|
||||
/* 亮色主题 */
|
||||
body {
|
||||
background-color: #f5f7fa;
|
||||
color: #2c3e50;
|
||||
}
|
||||
|
||||
/* 暗色主题 */
|
||||
body.dark-theme {
|
||||
background-color: #1a1a1a;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
/* Element Plus 暗色主题适配 */
|
||||
.dark-theme .el-card {
|
||||
background-color: #2d2d2d !important;
|
||||
border-color: #404040 !important;
|
||||
color: #ffffff !important;
|
||||
}
|
||||
|
||||
.dark-theme .el-input__inner {
|
||||
background-color: #404040 !important;
|
||||
border-color: #555555 !important;
|
||||
color: #ffffff !important;
|
||||
}
|
||||
|
||||
.dark-theme .el-input__inner::placeholder {
|
||||
color: #bdc3c7 !important;
|
||||
}
|
||||
|
||||
.dark-theme .el-button {
|
||||
background-color: #404040 !important;
|
||||
border-color: #555555 !important;
|
||||
color: #ffffff !important;
|
||||
}
|
||||
|
||||
.dark-theme .el-button:hover {
|
||||
background-color: #555555 !important;
|
||||
}
|
||||
|
||||
.dark-theme .el-button--primary {
|
||||
background-color: #409eff !important;
|
||||
border-color: #409eff !important;
|
||||
}
|
||||
|
||||
.dark-theme .el-button--primary:hover {
|
||||
background-color: #66b1ff !important;
|
||||
}
|
||||
|
||||
.dark-theme .el-button--success {
|
||||
background-color: #67c23a !important;
|
||||
border-color: #67c23a !important;
|
||||
}
|
||||
|
||||
.dark-theme .el-button--success:hover {
|
||||
background-color: #85ce61 !important;
|
||||
}
|
||||
|
||||
.dark-theme .el-switch__core {
|
||||
background-color: #555555 !important;
|
||||
}
|
||||
|
||||
.dark-theme .el-descriptions {
|
||||
background-color: #2d2d2d !important;
|
||||
color: #ffffff !important;
|
||||
}
|
||||
|
||||
.dark-theme .el-descriptions__label {
|
||||
color: #bdc3c7 !important;
|
||||
}
|
||||
|
||||
.dark-theme .el-descriptions__content {
|
||||
color: #ffffff !important;
|
||||
}
|
||||
|
||||
.dark-theme .el-dialog {
|
||||
background-color: #2d2d2d !important;
|
||||
color: #ffffff !important;
|
||||
}
|
||||
|
||||
.dark-theme .el-dialog__title {
|
||||
color: #ffffff !important;
|
||||
}
|
||||
|
||||
.dark-theme .el-dialog__body {
|
||||
color: #ffffff !important;
|
||||
}
|
||||
|
||||
.dark-theme .el-message {
|
||||
background-color: #2d2d2d !important;
|
||||
color: #ffffff !important;
|
||||
}
|
||||
|
||||
.dark-theme .el-message--success {
|
||||
background-color: #67c23a !important;
|
||||
color: #ffffff !important;
|
||||
}
|
||||
|
||||
.dark-theme .el-message--error {
|
||||
background-color: #f56c6c !important;
|
||||
color: #ffffff !important;
|
||||
}
|
||||
|
||||
.dark-theme .el-message--warning {
|
||||
background-color: #e6a23c !important;
|
||||
color: #ffffff !important;
|
||||
}
|
||||
|
||||
.dark-theme .el-message--info {
|
||||
background-color: #909399 !important;
|
||||
color: #ffffff !important;
|
||||
}
|
||||
|
||||
/* 链接颜色 */
|
||||
.dark-theme a {
|
||||
color: #4a9eff !important;
|
||||
}
|
||||
|
||||
.dark-theme a:hover {
|
||||
color: #66b1ff !important;
|
||||
}
|
||||
|
||||
/* 滚动条样式 */
|
||||
.dark-theme ::-webkit-scrollbar {
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
}
|
||||
|
||||
.dark-theme ::-webkit-scrollbar-track {
|
||||
background: #2d2d2d;
|
||||
}
|
||||
|
||||
.dark-theme ::-webkit-scrollbar-thumb {
|
||||
background: #555555;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.dark-theme ::-webkit-scrollbar-thumb:hover {
|
||||
background: #666666;
|
||||
}
|
||||
|
||||
/* 选择文本样式 */
|
||||
.dark-theme ::selection {
|
||||
background-color: #409eff;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
.dark-theme ::-moz-selection {
|
||||
background-color: #409eff;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
@@ -16,15 +16,27 @@ module.exports = {
|
||||
host: '127.0.0.1',
|
||||
port: 6444,
|
||||
proxy: {
|
||||
'/': {
|
||||
target: 'http://127.0.0.1:6400', // 请求本地
|
||||
'/parser': {
|
||||
target: 'http://127.0.0.1:6400/', // 请求本地
|
||||
ws: false
|
||||
},
|
||||
'/v2': {
|
||||
target: 'http://127.0.0.1:6400/', // 请求本地
|
||||
ws: false
|
||||
},
|
||||
'/json': {
|
||||
target: 'http://127.0.0.1:6400/', // 请求本地
|
||||
ws: false
|
||||
},
|
||||
'/d': {
|
||||
target: 'http://127.0.0.1:6400/', // 请求本地
|
||||
ws: false
|
||||
},
|
||||
}
|
||||
},
|
||||
configureWebpack: {
|
||||
// provide the app's title in webpack's name field, so that
|
||||
// it can be accessed in index.html to inject the correct title.
|
||||
// it can be accessed in list.html to inject the correct title.
|
||||
name: 'Netdisk fast download',
|
||||
resolve: {
|
||||
alias: {
|
||||
|
||||
Reference in New Issue
Block a user