@@ -9867,6 +9888,7 @@ ${err.stack}` : "");
if ($box2.find(".avatar-box").length > 0) return;
$box2.find(".photo-info").append(`
+
${this.removeSvg}
${this.screenSvg}
${this.videoSvg}
@@ -10039,6 +10061,41 @@ ${err.stack}` : "");
utils.download(blob, carNum2 + " " + title + ".jpg");
}));
}));
+ $(document).on("click", ".delete115Svg", (async (event) => {
+ event.preventDefault();
+ event.stopPropagation();
+ const $btn = $(event.currentTarget);
+ const dirId = $btn.attr("data-dir-id");
+ if (!dirId) {
+ show.error("未找到115目录ID");
+ return;
+ }
+ const $box2 = $btn.closest(".item");
+ const { carNum: carNum2 } = this.getBoxCarInfo($box2);
+ utils.q(event, `确认删除115中作品 "${carNum2}" 的整个目录吗?此操作不可撤销!`, (async () => {
+ let loadObj = loading();
+ try {
+ const result = await gmHttp.postForm("https://webapi.115.com/rb/delete", {
+ pid: 0,
+ "fid[0]": dirId
+ });
+ loadObj.close();
+ if (result && result.state) {
+ show.ok(`作品 "${carNum2}" 已从115删除`);
+ const matchPlugin = this.getBean("WangPan115MatchPlugin");
+ const matchList = await matchPlugin.searchFiles(carNum2);
+ matchPlugin.updateMatchStatus($box2, carNum2, matchList);
+ } else {
+ const errMsg = result && result.error_msg ? result.error_msg : "未知错误";
+ show.error(`删除失败: ${errMsg}`);
+ }
+ } catch (error) {
+ loadObj.close();
+ console.error("删除115文件失败:", error);
+ show.error(`删除失败: ${error.message || "网络错误"}`);
+ }
+ }));
+ }));
}
showImg($svgElement, $img, carNum2) {
$svgElement.html(this.videoSvg).attr("title", "播放视频");
diff --git a/src/plugins/cover-button.js b/src/plugins/cover-button.js
index a2302e8..c25a3d8 100644
--- a/src/plugins/cover-button.js
+++ b/src/plugins/cover-button.js
@@ -19,10 +19,10 @@ class CoverButtonPlugin extends BasePlugin {
$(this.getSelector().itemSelector).toArray().forEach((ele => {
let $box2 = $(ele);
if (!($box2.find(".tool-box").length > 0)) {
- isJavDb && $box2.find(".tags").append(`\n
\n `);
+ isJavDb && $box2.find(".tags").append(`\n
\n `);
if (isJavBus) {
if ($box2.find(".avatar-box").length > 0) return;
- $box2.find(".photo-info").append(`\n
\n `);
+ $box2.find(".photo-info").append(`\n
\n `);
}
}
}));
@@ -135,6 +135,45 @@ class CoverButtonPlugin extends BasePlugin {
utils.download(blob, carNum2 + " " + title + ".jpg");
}));
}));
+ $(document).on("click", ".delete115Svg", (async event => {
+ event.preventDefault();
+ event.stopPropagation();
+ const $btn = $(event.currentTarget);
+ const dirId = $btn.attr("data-dir-id");
+ if (!dirId) {
+ show.error("未找到115目录ID");
+ return;
+ }
+ const $box2 = $btn.closest(".item");
+ const {carNum: carNum2} = this.getBoxCarInfo($box2);
+ utils.q(event, `确认删除115中作品 "${carNum2}" 的整个目录吗?此操作不可撤销!`, (async () => {
+ let loadObj = loading();
+ try {
+ // 使用旧版115删除API删除整个作品目录
+ // 注意:此处仅删除文件目录,不会删除离线下载任务记录
+ // 原因:旧版任务删除接口(task_del)已失效,新版接口需要安全验证(如验证码),脚本无法绕过
+ // 如需重新下载同一作品,请先在115离线下载页面手动删除对应的任务记录,否则会提示"任务已存在"
+ const result = await gmHttp.postForm("https://webapi.115.com/rb/delete", {
+ pid: 0,
+ "fid[0]": dirId
+ });
+ loadObj.close();
+ if (result && result.state) {
+ show.ok(`作品 "${carNum2}" 已从115删除`);
+ const matchPlugin = this.getBean("WangPan115MatchPlugin");
+ const matchList = await matchPlugin.searchFiles(carNum2);
+ matchPlugin.updateMatchStatus($box2, carNum2, matchList);
+ } else {
+ const errMsg = result && result.error_msg ? result.error_msg : "未知错误";
+ show.error(`删除失败: ${errMsg}`);
+ }
+ } catch (error) {
+ loadObj.close();
+ console.error("删除115文件失败:", error);
+ show.error(`删除失败: ${error.message || "网络错误"}`);
+ }
+ }));
+ }));
}
showImg($svgElement, $img, carNum2) {
$svgElement.html(this.videoSvg).attr("title", "播放视频");
diff --git a/src/plugins/wangpan-115.js b/src/plugins/wangpan-115.js
index 3bc2ac7..8014177 100644
--- a/src/plugins/wangpan-115.js
+++ b/src/plugins/wangpan-115.js
@@ -341,7 +341,21 @@ const _WangPan115MatchPlugin = class _WangPan115MatchPlugin extends BasePlugin {
}
}
updateMatchStatus($box2, carNum2, matchList) {
- matchList.length > 0 ? $box2.find(".jhs-match-btn").replaceWith(`
匹配${matchList.length}个`) : $box2.find(".jhs-match-btn").replaceWith(`
未匹配`);
+ if (matchList.length > 0) {
+ $box2.find(".jhs-match-btn").replaceWith(`
匹配${matchList.length}个`);
+ const $deleteBtn = $box2.find(".delete115Svg");
+ if ($deleteBtn.length > 0 && matchList[0].dirId) {
+ $deleteBtn.attr("data-dir-id", matchList[0].dirId);
+ $deleteBtn.show();
+ }
+ } else {
+ $box2.find(".jhs-match-btn").replaceWith(`
未匹配`);
+ const $deleteBtn = $box2.find(".delete115Svg");
+ if ($deleteBtn.length > 0) {
+ $deleteBtn.removeAttr("data-dir-id");
+ $deleteBtn.hide();
+ }
+ }
}
async handleLoginRedirect() {
window.open("https://115.com");
@@ -351,6 +365,7 @@ const _WangPan115MatchPlugin = class _WangPan115MatchPlugin extends BasePlugin {
let searchKeyword = carNum2.toLowerCase().replace("fc2-", "");
return (null == (_a2 = (await searchFiles(searchKeyword)).data) ? void 0 : _a2.map((data => ({
folderId: data.fid,
+ dirId: data.cid,
videoId: data.pc,
name: data.n,
createTime: utils.formatDate(new Date(1e3 * data.te)),
@@ -392,6 +407,11 @@ const _WangPan115MatchPlugin = class _WangPan115MatchPlugin extends BasePlugin {
if (!($box2.find("[class^='jhs-match-']").length > 0)) if (this.loginStatus === _WangPan115MatchPlugin.LoginStatus.LOGGED_OUT) $box2.find(".video-title").prepend(`
未登录`); else if (matchList.length > 0) {
const title = 1 === matchList.length ? "点击直接播放" : `点击查看${matchList.length}个匹配结果`;
$box2.find(".video-title").prepend(`
匹配${matchList.length}个`);
+ const $deleteBtn = $box2.find(".delete115Svg");
+ if ($deleteBtn.length > 0 && matchList[0].dirId) {
+ $deleteBtn.attr("data-dir-id", matchList[0].dirId);
+ $deleteBtn.show();
+ }
} else $box2.find(".video-title").prepend(`
未匹配`);
}
formatSize(bytes) {