1
0
mirror of https://gitee.com/bookshelfplus/bookshelfplus synced 2025-09-21 01:10:39 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee

网盘分享链接解析正则完善;文件对象修改页小优化

This commit is contained in:
2022-04-28 20:59:06 +08:00
parent bc8508248e
commit e957b512cd
5 changed files with 30 additions and 8 deletions

View File

@@ -3,11 +3,12 @@ function getNetdiskShareDetails(shareText) {
success: false,
url: null,
pwd: "",
platform: null
platform: null,
origin: shareText
};
try {
result.url = shareText.match(/https?:\/\/[-A-Za-z0-9+&@#/%?=~_|!:,.;]+[-A-Za-z0-9+&@#/%=~_|]/g)[0];
var pwdRegExpResult = shareText.match(/提取码[:|] *(.*)[ |\n]?/); //.match(/提取码[:|] *(.*?)[ |\n]?/);
var pwdRegExpResult = shareText.match(/提取码[:|][ ]*([^ \n]*)[ |\n]?/); //.match(/提取码[:|] *(.*?)[ |\n]?/);
// console.log(shareText, pwdRegExpResult);
// console.log("--------")
// return;
@@ -41,7 +42,13 @@ function getNetdiskShareDetails(shareText) {
// 提取码60va
// --来自百度网盘超级会员V3的分享`);
// // 百度网盘PC端有密码
// getNetdiskShareDetails(`链接https://pan.baidu.com/s/1YBeqYwrka7Z9G0H0q0GO_w?pwd=60va
// 提取码60va
// 复制这段内容后打开百度网盘手机App操作更方便哦`);
// // 百度网盘无密码
// console.log("👇无提取码");
// getNetdiskShareDetails(`链接https://pan.baidu.com/s/1YBeqYwrka7Z9G0H0q0GO_w?pwd=60va`);
// // 阿里云盘有密码
@@ -49,11 +56,13 @@ function getNetdiskShareDetails(shareText) {
// 点击链接保存或者复制本段内容打开「阿里云盘」APP ,无需下载极速在线查看,视频原画倍速播放。`);
// // 阿里云盘无密码
// console.log("👇无提取码");
// getNetdiskShareDetails(`「ZenTaoPMS.16.4.win64.exe」https://www.aliyundrive.com/s/aZLhoqNFyiv
// 点击链接保存或者复制本段内容打开「阿里云盘」APP ,无需下载极速在线查看,视频原画倍速播放。`);
// // 其他情况
// console.log("👇以下是非分享链接");
// getNetdiskShareDetails(`非链接`);
// getNetdiskShareDetails(`其他的链接https://www.baidu.com/s?wd=60va dsadsads`);
// getNetdiskShareDetails(`链接https://pan.woshijiade.com/s/1YBeqYwrka7Z9G0H0q0GO_w?pwd=60va
// 提取码60vas`);
// 提取码60va`);

View File

@@ -93,7 +93,7 @@
.replace("SUCCESS", "<span style='color: green; font-weight: bold;'>成功</span>")
.replace("UPLOADING", "<span style='color: orange; font-weight: bold;'>正在上传</span>")
.replace("NOT_EXIST", "<span style='color: red; font-weight: bold;'>不存在</span>")}</td>
<td><a href="<%= pageUrl %>../object-detail?id=${item.id}&fileId=${item.fileId}">修改</a></td>
<td><a href="<%= pageUrl %>../get-share-url?id=${item.id}&fileId=${item.fileId}">修改</a></td>
</tr>`);
}
document.getElementById("file-object-container").innerHTML =

View File

@@ -49,7 +49,7 @@
.replace("NOT_EXIST", "<span style='color: red; font-weight: bold;'>不存在</span>")}`,
管理: `<span span class="overflow-omit" style="margin: 0 auto;">
<a href="javascript:refreshFileObjectStatus(${element.id});" style="${element.storageMedium == "QCLOUD_COS" ? "" : "display: none;"}">刷新状态</a>
<a href="<%= pageUrl %>../object-detail?id=${element.id}&fileId=${element.fileId}">修改</a>
<a href="<%= pageUrl %>../get-share-url?id=${element.id}&fileId=${element.fileId}">修改</a>
<a href="javascript:deleteFileObject(${element.id});">删除</a>
</span >`,
})

View File

@@ -1,3 +1,6 @@
<div class="show-modify-or-add" style="text-align: center;">
当前为:<span id="upload-type" style="font-weight: bold;">新增文件对象</span>
</div>
<div class="show-only-modify" style="text-align: center;">
上传状态:<span id="upload-status"></span>
</div>
@@ -17,8 +20,12 @@
// 新增文件对象
fileObjectId = 0;
$(".show-only-modify").hide();
$("#upload-type").html("新增文件对象");
$("#upload-type").css("color", "green");
} else {
// 修改文件对象
$("#upload-type").html("修改文件对象");
$("#upload-type").css("color", "red");
}
// 点击提交按钮

View File

@@ -10,21 +10,27 @@
</style>
<input id="sharecode_input" placeholder="请在此处粘贴网盘分享链接">
<input id="paste-button" value="点击粘贴" type="button" onclick="pasteText();">
<input id="next-button" value="直接前往添加" type="button" onclick="location.replace(redirectUrl);">
<input id="next-button" value="直接前往添加/修改" type="button" onclick="location.replace(redirectUrl);">
<!-- 获取参数 -->
<script src="/assets/javascripts/getParams.js"></script>
<script>
var requestParams = getParams();
// 文件对象 id (修改文件对象用)
var id = requestParams["id"] ?? "";
// 文件 id
var fileId = Number(requestParams["fileId"]) ?? "";
if (fileId === "")
history.go(-1);
console.log(fileId);
console.log(id, fileId);
</script>
<!-- 获取网盘分享链接 -->
<script src="/assets/javascripts/dashboard/netdiskShareStringUtils.js"></script>
<script>
var redirectUrl = `<%= pageUrl %>../object-detail?fileId=${fileId}&referrer=${encodeURIComponent(document.referrer)}`
var redirectUrl = `<%= pageUrl %>../object-detail?id=${id}&fileId=${fileId}&referrer=${encodeURIComponent(document.referrer)}`
$(document).ready(function () {
$("#sharecode_input").on({
// copy: function () {