Skip to content

Commit 49500d3

Browse files
committed
style-qbit. eslint
1 parent 756959e commit 49500d3

2 files changed

Lines changed: 17 additions & 14 deletions

File tree

eslint.config.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ export default antfu(
2929
"no-unused-vars": "off", // 关闭原生的 no-unused-vars 规则,使用插件的版本
3030
"unused-imports/no-unused-vars": ["error", { vars: "all", varsIgnorePattern: "^_" }],
3131
"unused-imports/no-unused-imports": ["error", { vars: "all", varsIgnorePattern: "^_" }],
32+
"node/prefer-global/process": ["off"],
3233
},
3334
},
3435

packages/qBit/src/_def.js

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {
88
import DefForm from "./_defForm";
99
import { http } from "./_http";
1010
import tplEdt from "./tpl/edt.html";
11-
import "./style/style.css"
11+
import "./style/style.css";
1212

1313
if (typeof __GM_api !== "undefined") {
1414
_log(__GM_api);
@@ -47,6 +47,17 @@ const gob = {
4747
},
4848
// 获取种子列表: torrents/info?tag=test 或 category=test
4949
apiTorrents(filter = "", fn = () => { }) {
50+
// category 查询
51+
const tryCategory = () => {
52+
const url = gob.apiUrl(`torrents/info?category=${filter}`);
53+
gob.http.get(url).then((res) => {
54+
gob.data.listTorrent = gob.parseReq(res, "json");
55+
fn();
56+
}).catch(() => {
57+
gob.data.listTorrent = [];
58+
fn();
59+
});
60+
};
5061
// tag 查询
5162
const tryTag = () => {
5263
const url = gob.apiUrl(`torrents/info?tag=${filter}`);
@@ -55,25 +66,16 @@ const gob = {
5566
if (list.length > 0) {
5667
gob.data.listTorrent = list;
5768
fn();
58-
} else {
69+
}
70+
else {
5971
tryCategory();
6072
}
6173
}).catch(tryCategory);
6274
};
63-
// category 查询
64-
const tryCategory = () => {
65-
const url = gob.apiUrl(`torrents/info?category=${filter}`);
66-
gob.http.get(url).then((res) => {
67-
gob.data.listTorrent = gob.parseReq(res, "json");
68-
fn();
69-
}).catch(() => {
70-
gob.data.listTorrent = [];
71-
fn();
72-
});
73-
};
7475
if (filter) {
7576
tryTag();
76-
} else {
77+
}
78+
else {
7779
// 如果为空,查询所有
7880
const url = gob.apiUrl("torrents/info");
7981
gob.http.get(url).then((res) => {

0 commit comments

Comments
 (0)