koishi-plugin-delta-force 1.2.1 → 1.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/api.d.ts +1 -1
- package/lib/api.d.ts.map +1 -1
- package/lib/commands/report/weekly.d.ts.map +1 -1
- package/lib/commands/tools/resources.d.ts.map +1 -1
- package/lib/config.d.ts +1 -1
- package/lib/config.d.ts.map +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +575 -147
- package/lib/middleware.d.ts.map +1 -1
- package/lib/resources.d.ts +29 -32
- package/lib/resources.d.ts.map +1 -1
- package/package.json +1 -1
package/lib/api.d.ts
CHANGED
|
@@ -85,7 +85,7 @@ export declare class ApiService {
|
|
|
85
85
|
/** 获取日报 */
|
|
86
86
|
getDailyReport(frameworkToken: string, type?: string, date?: string): Promise<ApiResponse>;
|
|
87
87
|
/** 获取周报 */
|
|
88
|
-
getWeeklyReport(frameworkToken: string, type?: string, isShowNullFriend?: boolean, date?: string): Promise<ApiResponse>;
|
|
88
|
+
getWeeklyReport(frameworkToken: string, type?: string, isShowNullFriend?: boolean, date?: string, showExtra?: boolean): Promise<ApiResponse>;
|
|
89
89
|
/** AI评价战绩 */
|
|
90
90
|
getAiCommentary(frameworkToken: string, type?: string, preset?: string, conversationId?: string): Promise<ApiResponse>;
|
|
91
91
|
/** 获取AI评价预设列表 */
|
package/lib/api.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAA;AAChC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AACjC,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,qBAAqB,EAAE,QAAQ,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAE/G;;GAEG;AACH,qBAAa,UAAU;IAEnB,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T,YAAY,IAAI,OAAO,CAAC,WAAW,CAAC;IAI1C,eAAe;IACT,cAAc,CAAC,MAAM,GAAE;QAC3B,KAAK,CAAC,EAAE,MAAM,CAAA;QACd,QAAQ,CAAC,EAAE,MAAM,CAAA;QACjB,MAAM,CAAC,EAAE,MAAM,CAAA;QACf,KAAK,CAAC,EAAE,MAAM,CAAA;KACV,GAAG,OAAO,CAAC,WAAW,CAAC;IAI7B,eAAe;IACT,kBAAkB,CAAC,MAAM,GAAE;QAC/B,MAAM,CAAC,EAAE,MAAM,CAAA;QACf,QAAQ,CAAC,EAAE,MAAM,CAAA;QACjB,MAAM,CAAC,EAAE,MAAM,CAAA;KACX,GAAG,OAAO,CAAC,WAAW,CAAC;IAM7B,gBAAgB;IACV,YAAY,IAAI,OAAO,CAAC,WAAW,CAAC;IAI1C,kBAAkB;IACZ,aAAa,IAAI,OAAO,CAAC,WAAW,CAAC;IAI3C,kBAAkB;IACZ,YAAY,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;IAI7D,oBAAoB;IACd,aAAa,CAAC,MAAM,EAAE;QAC1B,IAAI,EAAE,MAAM,CAAA;QACZ,SAAS,EAAE,MAAM,CAAA;QACjB,OAAO,CAAC,EAAE,MAAM,CAAA;KACjB,GAAG,OAAO,CAAC,WAAW,CAAC;IAIxB,gBAAgB;IACV,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;IAI5D,gBAAgB;IACV,iBAAiB,IAAI,OAAO,CAAC,WAAW,CAAC;CAGhD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"weekly.d.ts","sourceRoot":"","sources":["../../../src/commands/report/weekly.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,
|
|
1
|
+
{"version":3,"file":"weekly.d.ts","sourceRoot":"","sources":["../../../src/commands/report/weekly.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAK,MAAM,QAAQ,CAAA;AACnC,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAA;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAIxC,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AAGvC,wBAAgB,sBAAsB,CACpC,GAAG,EAAE,OAAO,EACZ,GAAG,EAAE,UAAU,EACf,WAAW,EAAE,WAAW,EACxB,QAAQ,EAAE,QAAQ,QAyrBnB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resources.d.ts","sourceRoot":"","sources":["../../../src/commands/tools/resources.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAA;AAChC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AACrC,OAAO,EAAE,eAAe,
|
|
1
|
+
{"version":3,"file":"resources.d.ts","sourceRoot":"","sources":["../../../src/commands/tools/resources.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAA;AAChC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AACrC,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAEjD,wBAAgB,yBAAyB,CACvC,GAAG,EAAE,OAAO,EACZ,MAAM,EAAE,MAAM,EACd,eAAe,EAAE,eAAe,QAyFjC"}
|
package/lib/config.d.ts
CHANGED
package/lib/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAE/B,MAAM,WAAW,MAAM;IACrB,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,EAAE,MAAM,CAAA;IAChB,UAAU,EAAE,MAAM,CAAA;IAClB,
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAE/B,MAAM,WAAW,MAAM;IACrB,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,EAAE,MAAM,CAAA;IAChB,UAAU,EAAE,MAAM,CAAA;IAClB,UAAU,EAAE,OAAO,CAAA;CACpB;AAED,eAAO,MAAM,MAAM,EAAE,MAAM,CAAC,MAAM,CAsBhC,CAAA"}
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAA;AAChC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AAyCjC,eAAO,MAAM,IAAI,gBAAgB,CAAA;AACjC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AAEjC,eAAO,MAAM,MAAM;;;CAGlB,CAAA;AAED,wBAAgB,KAAK,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAA;AAChC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AAyCjC,eAAO,MAAM,IAAI,gBAAgB,CAAA;AACjC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AAEjC,eAAO,MAAM,MAAM;;;CAGlB,CAAA;AAED,wBAAgB,KAAK,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,QA6IjD"}
|
package/lib/index.js
CHANGED
|
@@ -482,13 +482,14 @@ var ApiService = class {
|
|
|
482
482
|
return this.request("GET", "/df/person/dailyRecord", params);
|
|
483
483
|
}
|
|
484
484
|
/** 获取周报 */
|
|
485
|
-
async getWeeklyReport(frameworkToken, type, isShowNullFriend = true, date) {
|
|
485
|
+
async getWeeklyReport(frameworkToken, type, isShowNullFriend = true, date, showExtra = false) {
|
|
486
486
|
const params = {
|
|
487
487
|
frameworkToken,
|
|
488
488
|
isShowNullFriend: String(isShowNullFriend)
|
|
489
489
|
};
|
|
490
490
|
if (type) params.type = type;
|
|
491
491
|
if (date) params.date = date;
|
|
492
|
+
if (showExtra) params.showExtra = String(showExtra);
|
|
492
493
|
return this.request("GET", "/df/person/weeklyRecord", params);
|
|
493
494
|
}
|
|
494
495
|
/** AI评价战绩 */
|
|
@@ -1469,12 +1470,24 @@ var commandRules = [
|
|
|
1469
1470
|
command: "df.daily",
|
|
1470
1471
|
args: /* @__PURE__ */ __name((match) => match[2]?.trim() || "", "args")
|
|
1471
1472
|
},
|
|
1473
|
+
// 开启/关闭日报推送: ^\^(开启|关闭)日报推送$
|
|
1474
|
+
{
|
|
1475
|
+
pattern: /^\^(开启|关闭)日报推送$/i,
|
|
1476
|
+
command: "df.daily.push",
|
|
1477
|
+
args: /* @__PURE__ */ __name((match) => match[1] === "开启" ? "on" : "off", "args")
|
|
1478
|
+
},
|
|
1472
1479
|
// 周报: ^\^(周报|weekly)\s*(.*)$
|
|
1473
1480
|
{
|
|
1474
1481
|
pattern: /^\^(周报|weekly)\s*(.*)$/i,
|
|
1475
1482
|
command: "df.weekly",
|
|
1476
1483
|
args: /* @__PURE__ */ __name((match) => match[2]?.trim() || "", "args")
|
|
1477
1484
|
},
|
|
1485
|
+
// 开启/关闭周报推送: ^\^(开启|关闭)周报推送$
|
|
1486
|
+
{
|
|
1487
|
+
pattern: /^\^(开启|关闭)周报推送$/i,
|
|
1488
|
+
command: "df.weekly.push",
|
|
1489
|
+
args: /* @__PURE__ */ __name((match) => match[1] === "开启" ? "on" : "off", "args")
|
|
1490
|
+
},
|
|
1478
1491
|
// 战绩: ^\^(战绩|record)\s*(.*)$
|
|
1479
1492
|
{
|
|
1480
1493
|
pattern: /^\^(战绩|record)\s*(.*)$/i,
|
|
@@ -1526,6 +1539,12 @@ var commandRules = [
|
|
|
1526
1539
|
pattern: /^\^(特勤处状态|placestatus)$/i,
|
|
1527
1540
|
command: "df.placestatus"
|
|
1528
1541
|
},
|
|
1542
|
+
// 开启/关闭特勤处推送: ^\^(开启|关闭)特勤处推送$
|
|
1543
|
+
{
|
|
1544
|
+
pattern: /^\^(开启|关闭)特勤处推送$/i,
|
|
1545
|
+
command: "df.place.push",
|
|
1546
|
+
args: /* @__PURE__ */ __name((match) => match[1] === "开启" ? "on" : "off", "args")
|
|
1547
|
+
},
|
|
1529
1548
|
// 封号记录: ^\^(封号记录|违规记录|违规历史|封号历史)$
|
|
1530
1549
|
{
|
|
1531
1550
|
pattern: /^\^(封号记录|违规记录|违规历史|封号历史)$/i,
|
|
@@ -1606,6 +1625,12 @@ var commandRules = [
|
|
|
1606
1625
|
pattern: /^\^(每日密码|今日密码|密码)$/i,
|
|
1607
1626
|
command: "df.password"
|
|
1608
1627
|
},
|
|
1628
|
+
// 开启/关闭每日密码推送: ^\^(开启|关闭)每日密码推送$
|
|
1629
|
+
{
|
|
1630
|
+
pattern: /^\^(开启|关闭)每日密码推送$/i,
|
|
1631
|
+
command: "df.password.push",
|
|
1632
|
+
args: /* @__PURE__ */ __name((match) => match[1] === "开启" ? "on" : "off", "args")
|
|
1633
|
+
},
|
|
1609
1634
|
// ==================== 帮助 ====================
|
|
1610
1635
|
// 帮助: ^\^(帮助|菜单|功能|help)$
|
|
1611
1636
|
{
|
|
@@ -1618,11 +1643,10 @@ var commandRules = [
|
|
|
1618
1643
|
pattern: /^\^资源状态$/i,
|
|
1619
1644
|
command: "df.resources.status"
|
|
1620
1645
|
},
|
|
1621
|
-
// 资源下载/更新: ^\^(资源下载|下载资源|资源更新|更新资源)
|
|
1646
|
+
// 资源下载/更新: ^\^(资源下载|下载资源|资源更新|更新资源)$
|
|
1622
1647
|
{
|
|
1623
|
-
pattern: /^\^(资源下载|下载资源|资源更新|更新资源)
|
|
1624
|
-
command: "df.resources.download"
|
|
1625
|
-
args: /* @__PURE__ */ __name((match) => match[2]?.toLowerCase() || "", "args")
|
|
1648
|
+
pattern: /^\^(资源下载|下载资源|资源更新|更新资源)$/i,
|
|
1649
|
+
command: "df.resources.download"
|
|
1626
1650
|
},
|
|
1627
1651
|
// 资源清理: ^\^(资源清理|清理资源)$
|
|
1628
1652
|
{
|
|
@@ -1994,40 +2018,42 @@ __name(createRenderer, "createRenderer");
|
|
|
1994
2018
|
// src/resources.ts
|
|
1995
2019
|
var fs2 = __toESM(require("fs"));
|
|
1996
2020
|
var path2 = __toESM(require("path"));
|
|
1997
|
-
var
|
|
1998
|
-
github: {
|
|
1999
|
-
owner: "Entropy-Increase-Team",
|
|
2000
|
-
repo: "koishi-plugin-delta-force",
|
|
2001
|
-
branch: "main",
|
|
2002
|
-
basePath: "resources"
|
|
2003
|
-
},
|
|
2004
|
-
gitee: {
|
|
2005
|
-
owner: "Dnyo666",
|
|
2006
|
-
repo: "koishi-plugin-delta-force",
|
|
2007
|
-
branch: "main",
|
|
2008
|
-
basePath: "resources"
|
|
2009
|
-
}
|
|
2010
|
-
};
|
|
2021
|
+
var GH_PROXY_PREFIX = "https://edgeone.gh-proxy.org/";
|
|
2011
2022
|
var ResourceManager = class {
|
|
2012
2023
|
constructor(ctx, pluginConfig) {
|
|
2013
2024
|
this.ctx = ctx;
|
|
2014
2025
|
this.pluginConfig = pluginConfig;
|
|
2015
2026
|
this.logger = ctx.logger("delta-force-resources");
|
|
2016
|
-
this.config = DEFAULT_RESOURCE_CONFIG;
|
|
2017
2027
|
this.resourcesPath = path2.join(ctx.baseDir, "data", "delta-force", "resources");
|
|
2018
2028
|
}
|
|
2019
2029
|
static {
|
|
2020
2030
|
__name(this, "ResourceManager");
|
|
2021
2031
|
}
|
|
2022
2032
|
resourcesPath;
|
|
2023
|
-
config;
|
|
2024
2033
|
logger;
|
|
2034
|
+
isDownloading = false;
|
|
2035
|
+
currentProgress = null;
|
|
2036
|
+
/**
|
|
2037
|
+
* 获取当前下载状态
|
|
2038
|
+
*/
|
|
2039
|
+
getDownloadStatus() {
|
|
2040
|
+
return {
|
|
2041
|
+
isDownloading: this.isDownloading,
|
|
2042
|
+
progress: this.currentProgress
|
|
2043
|
+
};
|
|
2044
|
+
}
|
|
2025
2045
|
/**
|
|
2026
2046
|
* 获取资源根目录路径
|
|
2027
2047
|
*/
|
|
2028
2048
|
getResourcesPath() {
|
|
2029
2049
|
return this.resourcesPath;
|
|
2030
2050
|
}
|
|
2051
|
+
/**
|
|
2052
|
+
* 延迟函数
|
|
2053
|
+
*/
|
|
2054
|
+
sleep(ms) {
|
|
2055
|
+
return new Promise((resolve3) => setTimeout(resolve3, ms));
|
|
2056
|
+
}
|
|
2031
2057
|
/**
|
|
2032
2058
|
* 检查资源是否已下载
|
|
2033
2059
|
*/
|
|
@@ -2035,57 +2061,64 @@ var ResourceManager = class {
|
|
|
2035
2061
|
return fs2.existsSync(this.resourcesPath) && fs2.existsSync(path2.join(this.resourcesPath, "Template"));
|
|
2036
2062
|
}
|
|
2037
2063
|
/**
|
|
2038
|
-
*
|
|
2064
|
+
* 获取后端 API 基础地址
|
|
2039
2065
|
*/
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
const fullPath = subPath ? `${cfg.basePath}/${subPath}` : cfg.basePath;
|
|
2043
|
-
if (source === "github") {
|
|
2044
|
-
return `https://api.github.com/repos/${cfg.owner}/${cfg.repo}/contents/${fullPath}?ref=${cfg.branch}`;
|
|
2045
|
-
} else {
|
|
2046
|
-
return `https://gitee.com/api/v5/repos/${cfg.owner}/${cfg.repo}/contents/${fullPath}`;
|
|
2047
|
-
}
|
|
2066
|
+
getApiBaseUrl() {
|
|
2067
|
+
return this.pluginConfig.apiBaseUrl || "https://df-api.shallow.ink";
|
|
2048
2068
|
}
|
|
2049
2069
|
/**
|
|
2050
|
-
*
|
|
2070
|
+
* 应用 gh-proxy 加速到下载 URL
|
|
2051
2071
|
*/
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
if (
|
|
2055
|
-
return
|
|
2056
|
-
} else {
|
|
2057
|
-
return `https://gitee.com/${cfg.owner}/${cfg.repo}/raw/${cfg.branch}/${filePath}`;
|
|
2072
|
+
applyGhProxy(url) {
|
|
2073
|
+
if (!this.pluginConfig.useGhProxy) return url;
|
|
2074
|
+
if (url.includes("raw.githubusercontent.com")) {
|
|
2075
|
+
return `${GH_PROXY_PREFIX}${url}`;
|
|
2058
2076
|
}
|
|
2077
|
+
return url;
|
|
2059
2078
|
}
|
|
2060
2079
|
/**
|
|
2061
|
-
*
|
|
2080
|
+
* 从后端 API 获取文件列表
|
|
2062
2081
|
*/
|
|
2063
|
-
async fetchFileList(
|
|
2064
|
-
const
|
|
2082
|
+
async fetchFileList() {
|
|
2083
|
+
const apiUrl = `${this.getApiBaseUrl()}/koishi/resources/tree`;
|
|
2065
2084
|
try {
|
|
2066
|
-
const response = await this.ctx.http.get(
|
|
2067
|
-
headers:
|
|
2068
|
-
"
|
|
2069
|
-
"
|
|
2070
|
-
} : {}
|
|
2071
|
-
});
|
|
2072
|
-
for (const item of response) {
|
|
2073
|
-
if (item.type === "dir") {
|
|
2074
|
-
const relativePath = item.path.replace(`${this.config[source].basePath}/`, "");
|
|
2075
|
-
await this.fetchFileList(source, relativePath, fileList);
|
|
2076
|
-
} else if (item.type === "file") {
|
|
2077
|
-
fileList.push({
|
|
2078
|
-
...item,
|
|
2079
|
-
download_url: item.download_url || this.getDownloadUrl(source, item.path)
|
|
2080
|
-
});
|
|
2085
|
+
const response = await this.ctx.http.get(apiUrl, {
|
|
2086
|
+
headers: {
|
|
2087
|
+
"User-Agent": "koishi-plugin-delta-force",
|
|
2088
|
+
"Authorization": `Bearer ${this.pluginConfig.apiKey}`
|
|
2081
2089
|
}
|
|
2090
|
+
});
|
|
2091
|
+
if (response.code !== "SUCCESS") {
|
|
2092
|
+
throw new Error(`API 返回错误: ${response.code}`);
|
|
2082
2093
|
}
|
|
2094
|
+
const fileList = [];
|
|
2095
|
+
this.extractFiles(response.data.tree, fileList);
|
|
2083
2096
|
return fileList;
|
|
2084
2097
|
} catch (error) {
|
|
2085
|
-
this.logger.error(
|
|
2098
|
+
this.logger.error(`获取文件列表失败: ${apiUrl}`, error);
|
|
2086
2099
|
throw error;
|
|
2087
2100
|
}
|
|
2088
2101
|
}
|
|
2102
|
+
/**
|
|
2103
|
+
* 递归提取树形结构中的所有文件
|
|
2104
|
+
*/
|
|
2105
|
+
extractFiles(node, fileList) {
|
|
2106
|
+
if (node.type === "file" && node.download_url) {
|
|
2107
|
+
fileList.push({
|
|
2108
|
+
name: node.name,
|
|
2109
|
+
path: node.path,
|
|
2110
|
+
sha: node.sha || "",
|
|
2111
|
+
size: node.size || 0,
|
|
2112
|
+
type: "file",
|
|
2113
|
+
download_url: node.download_url,
|
|
2114
|
+
html_url: node.html_url
|
|
2115
|
+
});
|
|
2116
|
+
} else if (node.type === "dir" && node.children) {
|
|
2117
|
+
for (const child of node.children) {
|
|
2118
|
+
this.extractFiles(child, fileList);
|
|
2119
|
+
}
|
|
2120
|
+
}
|
|
2121
|
+
}
|
|
2089
2122
|
/**
|
|
2090
2123
|
* 下载单个文件
|
|
2091
2124
|
*/
|
|
@@ -2103,80 +2136,118 @@ var ResourceManager = class {
|
|
|
2103
2136
|
fs2.writeFileSync(localPath, Buffer.from(response));
|
|
2104
2137
|
}
|
|
2105
2138
|
/**
|
|
2106
|
-
*
|
|
2139
|
+
* 下载所有资源(支持断点续传)
|
|
2107
2140
|
*/
|
|
2108
|
-
async downloadResources(
|
|
2109
|
-
this.
|
|
2141
|
+
async downloadResources(onProgress) {
|
|
2142
|
+
if (this.isDownloading) {
|
|
2143
|
+
const status = this.getDownloadStatus();
|
|
2144
|
+
if (status.progress) {
|
|
2145
|
+
const percent = Math.round(status.progress.downloaded / status.progress.total * 100);
|
|
2146
|
+
this.logger.warn(`资源正在下载中: ${status.progress.downloaded}/${status.progress.total} (${percent}%)`);
|
|
2147
|
+
}
|
|
2148
|
+
return {
|
|
2149
|
+
success: false,
|
|
2150
|
+
downloaded: 0,
|
|
2151
|
+
failed: ["下载正在进行中"]
|
|
2152
|
+
};
|
|
2153
|
+
}
|
|
2154
|
+
this.isDownloading = true;
|
|
2155
|
+
const useProxy = this.pluginConfig.useGhProxy;
|
|
2156
|
+
this.logger.info(`开始下载资源${useProxy ? " (使用 GH-Proxy 加速)" : ""}...`);
|
|
2110
2157
|
const progress = {
|
|
2111
2158
|
total: 0,
|
|
2112
2159
|
downloaded: 0,
|
|
2113
2160
|
current: "",
|
|
2114
2161
|
failed: []
|
|
2115
2162
|
};
|
|
2163
|
+
this.currentProgress = progress;
|
|
2116
2164
|
try {
|
|
2117
|
-
const fileList = await this.fetchFileList(
|
|
2165
|
+
const fileList = await this.fetchFileList();
|
|
2118
2166
|
progress.total = fileList.length;
|
|
2119
2167
|
this.logger.info(`共发现 ${fileList.length} 个文件`);
|
|
2120
2168
|
if (!fs2.existsSync(this.resourcesPath)) {
|
|
2121
2169
|
fs2.mkdirSync(this.resourcesPath, { recursive: true });
|
|
2122
2170
|
}
|
|
2123
|
-
|
|
2124
|
-
|
|
2171
|
+
let manifest = await this.loadManifest();
|
|
2172
|
+
const existingManifest = manifest;
|
|
2173
|
+
manifest = {
|
|
2174
|
+
version: (/* @__PURE__ */ new Date()).toISOString(),
|
|
2175
|
+
files: fileList.map((f) => {
|
|
2176
|
+
const relativePath = f.path.replace(/^resources\//, "");
|
|
2177
|
+
const existingFile = existingManifest?.files.find(
|
|
2178
|
+
(ef) => ef.relativePath === relativePath && ef.sha === f.sha && ef.downloaded
|
|
2179
|
+
);
|
|
2180
|
+
return {
|
|
2181
|
+
relativePath,
|
|
2182
|
+
sha: f.sha,
|
|
2183
|
+
size: f.size,
|
|
2184
|
+
downloaded: !!existingFile
|
|
2185
|
+
// 如果旧文件已下载且 SHA 相同,标记为已下载
|
|
2186
|
+
};
|
|
2187
|
+
})
|
|
2188
|
+
};
|
|
2189
|
+
await this.writeManifest(manifest);
|
|
2190
|
+
this.logger.info("已保存资源清单,支持断点续传");
|
|
2191
|
+
const downloadDelay = 100;
|
|
2192
|
+
const progressInterval = 20;
|
|
2193
|
+
let skippedCount = 0;
|
|
2194
|
+
let actualDownloaded = 0;
|
|
2195
|
+
for (let i = 0; i < manifest.files.length; i++) {
|
|
2196
|
+
const fileInfo = manifest.files[i];
|
|
2197
|
+
const relativePath = fileInfo.relativePath;
|
|
2125
2198
|
const localPath = path2.join(this.resourcesPath, relativePath);
|
|
2126
2199
|
progress.current = relativePath;
|
|
2200
|
+
if (fileInfo.downloaded && fs2.existsSync(localPath)) {
|
|
2201
|
+
skippedCount++;
|
|
2202
|
+
progress.downloaded++;
|
|
2203
|
+
onProgress?.(progress);
|
|
2204
|
+
continue;
|
|
2205
|
+
}
|
|
2206
|
+
const file = fileList.find((f) => f.path.replace(/^resources\//, "") === relativePath);
|
|
2207
|
+
if (!file) {
|
|
2208
|
+
progress.failed.push(relativePath);
|
|
2209
|
+
continue;
|
|
2210
|
+
}
|
|
2127
2211
|
try {
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
continue;
|
|
2133
|
-
}
|
|
2134
|
-
await this.downloadFile(file.download_url, localPath);
|
|
2212
|
+
const downloadUrl = this.applyGhProxy(file.download_url);
|
|
2213
|
+
await this.downloadFile(downloadUrl, localPath);
|
|
2214
|
+
manifest.files[i].downloaded = true;
|
|
2215
|
+
await this.writeManifest(manifest);
|
|
2135
2216
|
progress.downloaded++;
|
|
2136
|
-
|
|
2217
|
+
actualDownloaded++;
|
|
2218
|
+
if (progress.downloaded % progressInterval === 0) {
|
|
2219
|
+
const percent = Math.round(progress.downloaded / progress.total * 100);
|
|
2220
|
+
this.logger.info(`下载进度: ${progress.downloaded}/${progress.total} (${percent}%)`);
|
|
2221
|
+
}
|
|
2222
|
+
await this.sleep(downloadDelay);
|
|
2137
2223
|
} catch (error) {
|
|
2138
2224
|
progress.failed.push(relativePath);
|
|
2139
2225
|
this.logger.warn(`下载失败: ${relativePath}`, error);
|
|
2140
2226
|
}
|
|
2141
2227
|
onProgress?.(progress);
|
|
2142
2228
|
}
|
|
2143
|
-
|
|
2144
|
-
|
|
2229
|
+
if (skippedCount > 0) {
|
|
2230
|
+
this.logger.info(`跳过 ${skippedCount} 个已下载文件`);
|
|
2231
|
+
}
|
|
2232
|
+
this.logger.info(`资源下载完成: 新下载 ${actualDownloaded} 个, 跳过 ${skippedCount} 个, 失败 ${progress.failed.length} 个`);
|
|
2233
|
+
this.isDownloading = false;
|
|
2234
|
+
this.currentProgress = null;
|
|
2145
2235
|
return {
|
|
2146
2236
|
success: progress.failed.length === 0,
|
|
2147
|
-
downloaded:
|
|
2237
|
+
downloaded: actualDownloaded,
|
|
2148
2238
|
failed: progress.failed
|
|
2149
2239
|
};
|
|
2150
2240
|
} catch (error) {
|
|
2241
|
+
this.isDownloading = false;
|
|
2242
|
+
this.currentProgress = null;
|
|
2151
2243
|
this.logger.error("资源下载失败:", error);
|
|
2152
2244
|
throw error;
|
|
2153
2245
|
}
|
|
2154
2246
|
}
|
|
2155
2247
|
/**
|
|
2156
|
-
*
|
|
2157
|
-
*/
|
|
2158
|
-
async shouldSkipFile(localPath, remoteSha) {
|
|
2159
|
-
if (!fs2.existsSync(localPath)) return false;
|
|
2160
|
-
const manifest = await this.loadManifest();
|
|
2161
|
-
if (!manifest) return false;
|
|
2162
|
-
const fileInfo = manifest.files.find(
|
|
2163
|
-
(f) => path2.join(this.resourcesPath, f.relativePath) === localPath
|
|
2164
|
-
);
|
|
2165
|
-
return fileInfo?.sha === remoteSha;
|
|
2166
|
-
}
|
|
2167
|
-
/**
|
|
2168
|
-
* 保存资源清单
|
|
2248
|
+
* 写入 manifest 文件
|
|
2169
2249
|
*/
|
|
2170
|
-
async
|
|
2171
|
-
const manifest = {
|
|
2172
|
-
version: (/* @__PURE__ */ new Date()).toISOString(),
|
|
2173
|
-
source,
|
|
2174
|
-
files: fileList.map((f) => ({
|
|
2175
|
-
relativePath: f.path.replace(`${this.config[source].basePath}/`, ""),
|
|
2176
|
-
sha: f.sha,
|
|
2177
|
-
size: f.size
|
|
2178
|
-
}))
|
|
2179
|
-
};
|
|
2250
|
+
async writeManifest(manifest) {
|
|
2180
2251
|
const manifestPath = path2.join(this.resourcesPath, "manifest.json");
|
|
2181
2252
|
fs2.writeFileSync(manifestPath, JSON.stringify(manifest, null, 2));
|
|
2182
2253
|
}
|
|
@@ -2188,7 +2259,13 @@ var ResourceManager = class {
|
|
|
2188
2259
|
if (!fs2.existsSync(manifestPath)) return null;
|
|
2189
2260
|
try {
|
|
2190
2261
|
const content = fs2.readFileSync(manifestPath, "utf-8");
|
|
2191
|
-
|
|
2262
|
+
const manifest = JSON.parse(content);
|
|
2263
|
+
manifest.files = manifest.files.map((f) => ({
|
|
2264
|
+
...f,
|
|
2265
|
+
downloaded: f.downloaded ?? true
|
|
2266
|
+
// 旧版默认认为已下载
|
|
2267
|
+
}));
|
|
2268
|
+
return manifest;
|
|
2192
2269
|
} catch {
|
|
2193
2270
|
return null;
|
|
2194
2271
|
}
|
|
@@ -2203,7 +2280,7 @@ var ResourceManager = class {
|
|
|
2203
2280
|
path: this.resourcesPath,
|
|
2204
2281
|
fileCount: manifest?.files.length || 0,
|
|
2205
2282
|
lastUpdate: manifest?.version || null,
|
|
2206
|
-
|
|
2283
|
+
useGhProxy: this.pluginConfig.useGhProxy
|
|
2207
2284
|
};
|
|
2208
2285
|
}
|
|
2209
2286
|
/**
|
|
@@ -2220,10 +2297,10 @@ var ResourceManager = class {
|
|
|
2220
2297
|
* 类似 DataManager.init(),自动检查并更新资源
|
|
2221
2298
|
*/
|
|
2222
2299
|
async syncResources() {
|
|
2223
|
-
const
|
|
2224
|
-
this.logger.info(
|
|
2300
|
+
const useProxy = this.pluginConfig.useGhProxy;
|
|
2301
|
+
this.logger.info(`开始同步静态资源${useProxy ? " (使用 GH-Proxy 加速)" : ""}...`);
|
|
2225
2302
|
try {
|
|
2226
|
-
const result = await this.downloadResources(
|
|
2303
|
+
const result = await this.downloadResources();
|
|
2227
2304
|
if (result.success) {
|
|
2228
2305
|
if (result.downloaded > 0) {
|
|
2229
2306
|
this.logger.info(`资源同步完成,更新了 ${result.downloaded} 个文件`);
|
|
@@ -3284,6 +3361,7 @@ function registerDailyCommands(ctx, api, dataManager, renderer) {
|
|
|
3284
3361
|
__name(registerDailyCommands, "registerDailyCommands");
|
|
3285
3362
|
|
|
3286
3363
|
// src/commands/report/weekly.ts
|
|
3364
|
+
var import_koishi3 = require("koishi");
|
|
3287
3365
|
init_database();
|
|
3288
3366
|
function registerWeeklyCommands(ctx, api, dataManager, renderer) {
|
|
3289
3367
|
const logger = ctx.logger("delta-force");
|
|
@@ -3296,6 +3374,7 @@ function registerWeeklyCommands(ctx, api, dataManager, renderer) {
|
|
|
3296
3374
|
}
|
|
3297
3375
|
let mode = "";
|
|
3298
3376
|
let date = "";
|
|
3377
|
+
let showExtra = false;
|
|
3299
3378
|
const allArgs = [];
|
|
3300
3379
|
for (const arg of args) {
|
|
3301
3380
|
const parts = arg.split(/\s+/).filter(Boolean);
|
|
@@ -3306,14 +3385,18 @@ function registerWeeklyCommands(ctx, api, dataManager, renderer) {
|
|
|
3306
3385
|
mode = "sol";
|
|
3307
3386
|
} else if (["全面", "全面战场", "战场", "mp"].includes(arg)) {
|
|
3308
3387
|
mode = "mp";
|
|
3388
|
+
} else if (["详细", "detail", "extra"].includes(arg)) {
|
|
3389
|
+
showExtra = true;
|
|
3309
3390
|
} else if (/^\d{8}$/.test(arg)) {
|
|
3310
3391
|
date = arg;
|
|
3311
3392
|
}
|
|
3312
3393
|
}
|
|
3394
|
+
logger.info(`[weekly] 解析参数: mode=${mode}, date=${date}, showExtra=${showExtra}, allArgs=${JSON.stringify(allArgs)}`);
|
|
3313
3395
|
await session.send("正在查询周报数据...");
|
|
3314
3396
|
try {
|
|
3315
|
-
const res = await api.getWeeklyReport(token, mode, true, date);
|
|
3316
|
-
logger.
|
|
3397
|
+
const res = await api.getWeeklyReport(token, mode, true, date, showExtra);
|
|
3398
|
+
logger.info(`[weekly] API 响应: ${JSON.stringify(res).slice(0, 500)}`);
|
|
3399
|
+
logger.info(`[weekly] reportDm 存在: ${!!res.data?.reportDm}`);
|
|
3317
3400
|
if (await handleApiError(res, session)) return;
|
|
3318
3401
|
let solData;
|
|
3319
3402
|
let mpData;
|
|
@@ -3496,7 +3579,357 @@ function registerWeeklyCommands(ctx, api, dataManager, renderer) {
|
|
|
3496
3579
|
templateData.mpData = { isEmpty: true };
|
|
3497
3580
|
}
|
|
3498
3581
|
}
|
|
3499
|
-
|
|
3582
|
+
const reportDm = res.data?.reportDm;
|
|
3583
|
+
if (reportDm) {
|
|
3584
|
+
if (reportDm.wbn?.friends && Array.isArray(reportDm.wbn.friends)) {
|
|
3585
|
+
const friendsData = reportDm.wbn.friends;
|
|
3586
|
+
const sortedFriends = friendsData.filter((f) => f.total_gained_price && Number(f.total_gained_price) > 0).sort((a, b) => Number(b.total_gained_price) - Number(a.total_gained_price)).slice(0, 10);
|
|
3587
|
+
if (sortedFriends.length > 0) {
|
|
3588
|
+
const friendOpenIDs = sortedFriends.map((f) => f.Friendopenid);
|
|
3589
|
+
const friendNicknameMap = /* @__PURE__ */ new Map();
|
|
3590
|
+
const friendAvatarMap = /* @__PURE__ */ new Map();
|
|
3591
|
+
const friendPromises = friendOpenIDs.map(
|
|
3592
|
+
(openid) => api.getFriendInfo(token, openid)
|
|
3593
|
+
);
|
|
3594
|
+
const friendResults = await Promise.allSettled(friendPromises);
|
|
3595
|
+
friendResults.forEach((result, index) => {
|
|
3596
|
+
const openid = friendOpenIDs[index];
|
|
3597
|
+
if (result.status === "fulfilled" && result.value?.success && result.value.data) {
|
|
3598
|
+
const data = result.value.data;
|
|
3599
|
+
if (data.charac_name) {
|
|
3600
|
+
friendNicknameMap.set(openid, data.charac_name);
|
|
3601
|
+
}
|
|
3602
|
+
if (data.picurl) {
|
|
3603
|
+
let avatarUrl = data.picurl;
|
|
3604
|
+
if (/^[0-9]+$/.test(avatarUrl)) {
|
|
3605
|
+
avatarUrl = `https://wegame.gtimg.com/g.2001918-r.ea725/helper/df/skin/${avatarUrl}.webp`;
|
|
3606
|
+
} else {
|
|
3607
|
+
try {
|
|
3608
|
+
avatarUrl = decodeURIComponent(avatarUrl);
|
|
3609
|
+
} catch {
|
|
3610
|
+
}
|
|
3611
|
+
}
|
|
3612
|
+
friendAvatarMap.set(openid, avatarUrl);
|
|
3613
|
+
}
|
|
3614
|
+
}
|
|
3615
|
+
});
|
|
3616
|
+
const allItemIDs = /* @__PURE__ */ new Set();
|
|
3617
|
+
sortedFriends.forEach((friend) => {
|
|
3618
|
+
if (friend.CarryOut_highprice_list && Array.isArray(friend.CarryOut_highprice_list)) {
|
|
3619
|
+
friend.CarryOut_highprice_list.forEach((item) => {
|
|
3620
|
+
if (item.itemid) {
|
|
3621
|
+
allItemIDs.add(String(item.itemid));
|
|
3622
|
+
}
|
|
3623
|
+
});
|
|
3624
|
+
}
|
|
3625
|
+
if (friend.CarryOut_top2_highprice_list && Array.isArray(friend.CarryOut_top2_highprice_list)) {
|
|
3626
|
+
friend.CarryOut_top2_highprice_list.forEach((item) => {
|
|
3627
|
+
if (item.itemid) {
|
|
3628
|
+
allItemIDs.add(String(item.itemid));
|
|
3629
|
+
}
|
|
3630
|
+
});
|
|
3631
|
+
}
|
|
3632
|
+
});
|
|
3633
|
+
const itemNameMap = {};
|
|
3634
|
+
if (allItemIDs.size > 0) {
|
|
3635
|
+
try {
|
|
3636
|
+
const itemIDsArray = Array.from(allItemIDs);
|
|
3637
|
+
const itemIDsString = itemIDsArray.join(",");
|
|
3638
|
+
const itemRes = await api.searchObject("", itemIDsString);
|
|
3639
|
+
if (itemRes && itemRes.success && itemRes.data) {
|
|
3640
|
+
const keywords = itemRes.data.keywords;
|
|
3641
|
+
if (keywords && Array.isArray(keywords)) {
|
|
3642
|
+
keywords.forEach((item) => {
|
|
3643
|
+
if (item.objectID) {
|
|
3644
|
+
const id = String(item.objectID);
|
|
3645
|
+
const name2 = item.name || item.objectName;
|
|
3646
|
+
if (name2) {
|
|
3647
|
+
itemNameMap[id] = name2;
|
|
3648
|
+
}
|
|
3649
|
+
}
|
|
3650
|
+
});
|
|
3651
|
+
}
|
|
3652
|
+
}
|
|
3653
|
+
} catch (error) {
|
|
3654
|
+
logger.warn("[weekly] 获取物品名称失败:", error);
|
|
3655
|
+
}
|
|
3656
|
+
}
|
|
3657
|
+
const formatPrice3 = /* @__PURE__ */ __name((price) => {
|
|
3658
|
+
if (!price || isNaN(Number(price))) return "0";
|
|
3659
|
+
const numPrice = Number(price);
|
|
3660
|
+
if (numPrice >= 1e6) {
|
|
3661
|
+
return (numPrice / 1e6).toFixed(2) + "M";
|
|
3662
|
+
} else if (numPrice >= 1e3) {
|
|
3663
|
+
return (numPrice / 1e3).toFixed(1) + "K";
|
|
3664
|
+
} else {
|
|
3665
|
+
return numPrice.toLocaleString();
|
|
3666
|
+
}
|
|
3667
|
+
}, "formatPrice");
|
|
3668
|
+
templateData.topFriends = sortedFriends.map((friend, index) => {
|
|
3669
|
+
const friendName = friendNicknameMap.get(friend.Friendopenid) || `...${String(friend.Friendopenid).slice(-6)}`;
|
|
3670
|
+
const friendAvatar = friendAvatarMap.get(friend.Friendopenid) || "";
|
|
3671
|
+
const items = [];
|
|
3672
|
+
const addedItemIds = /* @__PURE__ */ new Set();
|
|
3673
|
+
if (friend.CarryOut_highprice_list && Array.isArray(friend.CarryOut_highprice_list)) {
|
|
3674
|
+
friend.CarryOut_highprice_list.forEach((item) => {
|
|
3675
|
+
if (item.itemid && !addedItemIds.has(String(item.itemid))) {
|
|
3676
|
+
const itemId = String(item.itemid);
|
|
3677
|
+
const rawPrice = Number(item.iPrice || 0);
|
|
3678
|
+
addedItemIds.add(itemId);
|
|
3679
|
+
items.push({
|
|
3680
|
+
itemid: itemId,
|
|
3681
|
+
name: itemNameMap[itemId] || `物品${item.itemid}`,
|
|
3682
|
+
imageUrl: `https://playerhub.df.qq.com/playerhub/60004/object/${item.itemid}.png`,
|
|
3683
|
+
price: formatPrice3(rawPrice),
|
|
3684
|
+
rawPrice,
|
|
3685
|
+
inum: item.inum || 1,
|
|
3686
|
+
quality: item.quality || 0
|
|
3687
|
+
});
|
|
3688
|
+
}
|
|
3689
|
+
});
|
|
3690
|
+
}
|
|
3691
|
+
if (friend.CarryOut_top2_highprice_list && Array.isArray(friend.CarryOut_top2_highprice_list)) {
|
|
3692
|
+
friend.CarryOut_top2_highprice_list.forEach((item) => {
|
|
3693
|
+
if (item.itemid && !addedItemIds.has(String(item.itemid)) && items.length < 3) {
|
|
3694
|
+
const itemId = String(item.itemid);
|
|
3695
|
+
const rawPrice = Number(item.iPrice || 0);
|
|
3696
|
+
addedItemIds.add(itemId);
|
|
3697
|
+
items.push({
|
|
3698
|
+
itemid: itemId,
|
|
3699
|
+
name: itemNameMap[itemId] || `物品${item.itemid}`,
|
|
3700
|
+
imageUrl: `https://playerhub.df.qq.com/playerhub/60004/object/${item.itemid}.png`,
|
|
3701
|
+
price: formatPrice3(rawPrice),
|
|
3702
|
+
rawPrice,
|
|
3703
|
+
inum: item.inum || 1,
|
|
3704
|
+
quality: item.quality || 0
|
|
3705
|
+
});
|
|
3706
|
+
}
|
|
3707
|
+
});
|
|
3708
|
+
}
|
|
3709
|
+
items.sort((a, b) => b.rawPrice - a.rawPrice);
|
|
3710
|
+
return {
|
|
3711
|
+
rank: index + 1,
|
|
3712
|
+
name: friendName,
|
|
3713
|
+
avatar: friendAvatar,
|
|
3714
|
+
total_gained_price: Number(friend.total_gained_price || 0).toLocaleString(),
|
|
3715
|
+
total_GainedPrice: formatPrice3(friend.total_GainedPrice || 0),
|
|
3716
|
+
max_GainedPrice: formatPrice3(friend.max_GainedPrice || 0),
|
|
3717
|
+
win_num: friend.win_num || 0,
|
|
3718
|
+
lose_num: friend.lose_num || 0,
|
|
3719
|
+
intimacy: friend.FriendIntimacy || 0,
|
|
3720
|
+
items: items.slice(0, 3)
|
|
3721
|
+
};
|
|
3722
|
+
});
|
|
3723
|
+
} else {
|
|
3724
|
+
templateData.topFriends = [];
|
|
3725
|
+
}
|
|
3726
|
+
} else {
|
|
3727
|
+
templateData.topFriends = [];
|
|
3728
|
+
}
|
|
3729
|
+
if (reportDm.report1) {
|
|
3730
|
+
templateData.report1 = {
|
|
3731
|
+
total_sell_price: Number(reportDm.report1.total_sell_price || 0).toLocaleString()
|
|
3732
|
+
};
|
|
3733
|
+
}
|
|
3734
|
+
if (reportDm.report3) {
|
|
3735
|
+
const r3 = reportDm.report3;
|
|
3736
|
+
const maxScoreMapId = r3.max_score_mapid ? dataManager.getMapName(r3.max_score_mapid) : "无";
|
|
3737
|
+
const maxScoreOperator = r3.max_mpmatch_num_deployarmedforcetype ? dataManager.getOperatorName(r3.max_mpmatch_num_deployarmedforcetype) : "无";
|
|
3738
|
+
const maxVehicleOperator = r3.max_vehicle_usedtime_vehicleid ? `载具ID: ${r3.max_vehicle_usedtime_vehicleid}` : "无";
|
|
3739
|
+
templateData.report3 = {
|
|
3740
|
+
max_mpmatch_num: r3.max_mpmatch_num || 0,
|
|
3741
|
+
max_vehicle_usedtime: r3.max_vehicle_usedtime ? `${Math.floor(Number(r3.max_vehicle_usedtime) / 60)}分钟` : "0",
|
|
3742
|
+
total_killvehicle: r3.total_killvehicle || 0,
|
|
3743
|
+
total_vehicle_usedtime: r3.total_vehicle_usedtime ? `${Math.floor(Number(r3.total_vehicle_usedtime) / 60)}分钟` : "0",
|
|
3744
|
+
total_vehicle_inum: r3.total_vehicle_inum || 0,
|
|
3745
|
+
max_score_killnum: r3.max_score_killnum || 0,
|
|
3746
|
+
max_score_death: r3.max_score_death || 0,
|
|
3747
|
+
win_mpmatch_num: r3.win_mpmatch_num || 0,
|
|
3748
|
+
max_score_assist: r3.max_score_assist || 0,
|
|
3749
|
+
total_mpmatch_num: r3.total_mpmatch_num || 0,
|
|
3750
|
+
max_score_mapid: maxScoreMapId,
|
|
3751
|
+
max_score_mapid_image: r3.max_score_mapid ? dataManager.getMapImagePath(maxScoreMapId, "mp") : null,
|
|
3752
|
+
max_mpmatch_num_Rescue: r3.max_mpmatch_num_Rescue || 0,
|
|
3753
|
+
max_mpmatch_num_deployarmedforcetype: maxScoreOperator,
|
|
3754
|
+
max_mpmatch_num_deployarmedforcetype_image: r3.max_mpmatch_num_deployarmedforcetype ? dataManager.getOperatorImagePath(maxScoreOperator) : null,
|
|
3755
|
+
max_score_dteventtime: r3.max_score_dteventtime || "-",
|
|
3756
|
+
total_killnum: r3.total_killnum || 0,
|
|
3757
|
+
max_vehicle_usedtime_vehicleid: maxVehicleOperator,
|
|
3758
|
+
total_score: Number(r3.total_score || 0).toLocaleString(),
|
|
3759
|
+
max_mpmatch_num_GameTime: r3.max_mpmatch_num_GameTime ? `${Math.floor(Number(r3.max_mpmatch_num_GameTime) / 3600)}小时${Math.floor(Number(r3.max_mpmatch_num_GameTime) % 3600 / 60)}分钟` : "0",
|
|
3760
|
+
total_vehicle_killnum: r3.total_vehicle_killnum || 0,
|
|
3761
|
+
max_vehicle_usedtime_killplayer: r3.max_vehicle_usedtime_killplayer || 0,
|
|
3762
|
+
max_mpmatch_num_Score: Number(r3.max_mpmatch_num_Score || 0).toLocaleString()
|
|
3763
|
+
};
|
|
3764
|
+
}
|
|
3765
|
+
if (reportDm.report4) {
|
|
3766
|
+
const r4 = reportDm.report4;
|
|
3767
|
+
const bestTeammateId = r4.max_mpwinnum_memberid;
|
|
3768
|
+
const worstTeammateId = r4.max_mplosenum_memberid;
|
|
3769
|
+
let bestTeammateName = "未知";
|
|
3770
|
+
let bestTeammateAvatar = "";
|
|
3771
|
+
let worstTeammateName = "未知";
|
|
3772
|
+
let worstTeammateAvatar = "";
|
|
3773
|
+
const teammatePromises = [];
|
|
3774
|
+
if (bestTeammateId) {
|
|
3775
|
+
teammatePromises.push(
|
|
3776
|
+
api.getFriendInfo(token, bestTeammateId).then((info) => ({ type: "best", info })).catch(() => ({ type: "best", info: null }))
|
|
3777
|
+
);
|
|
3778
|
+
} else {
|
|
3779
|
+
teammatePromises.push(Promise.resolve({ type: "best", info: null }));
|
|
3780
|
+
}
|
|
3781
|
+
if (worstTeammateId) {
|
|
3782
|
+
teammatePromises.push(
|
|
3783
|
+
api.getFriendInfo(token, worstTeammateId).then((info) => ({ type: "worst", info })).catch(() => ({ type: "worst", info: null }))
|
|
3784
|
+
);
|
|
3785
|
+
} else {
|
|
3786
|
+
teammatePromises.push(Promise.resolve({ type: "worst", info: null }));
|
|
3787
|
+
}
|
|
3788
|
+
const teammateResults = await Promise.all(teammatePromises);
|
|
3789
|
+
teammateResults.forEach((result) => {
|
|
3790
|
+
const info = result.info;
|
|
3791
|
+
if (result.type === "best" && info?.success && info.data) {
|
|
3792
|
+
const data = info.data;
|
|
3793
|
+
bestTeammateName = data.charac_name || "未知";
|
|
3794
|
+
if (data.picurl) {
|
|
3795
|
+
let avatarUrl = data.picurl;
|
|
3796
|
+
if (/^[0-9]+$/.test(avatarUrl)) {
|
|
3797
|
+
avatarUrl = `https://wegame.gtimg.com/g.2001918-r.ea725/helper/df/skin/${avatarUrl}.webp`;
|
|
3798
|
+
} else {
|
|
3799
|
+
try {
|
|
3800
|
+
avatarUrl = decodeURIComponent(avatarUrl);
|
|
3801
|
+
} catch {
|
|
3802
|
+
}
|
|
3803
|
+
}
|
|
3804
|
+
bestTeammateAvatar = avatarUrl;
|
|
3805
|
+
}
|
|
3806
|
+
} else if (result.type === "worst" && info?.success && info.data) {
|
|
3807
|
+
const data = info.data;
|
|
3808
|
+
worstTeammateName = data.charac_name || "未知";
|
|
3809
|
+
if (data.picurl) {
|
|
3810
|
+
let avatarUrl = data.picurl;
|
|
3811
|
+
if (/^[0-9]+$/.test(avatarUrl)) {
|
|
3812
|
+
avatarUrl = `https://wegame.gtimg.com/g.2001918-r.ea725/helper/df/skin/${avatarUrl}.webp`;
|
|
3813
|
+
} else {
|
|
3814
|
+
try {
|
|
3815
|
+
avatarUrl = decodeURIComponent(avatarUrl);
|
|
3816
|
+
} catch {
|
|
3817
|
+
}
|
|
3818
|
+
}
|
|
3819
|
+
worstTeammateAvatar = avatarUrl;
|
|
3820
|
+
}
|
|
3821
|
+
}
|
|
3822
|
+
});
|
|
3823
|
+
const bestOperator = r4.max_mpwinnum_member_deployarmedforcetype ? dataManager.getOperatorName(r4.max_mpwinnum_member_deployarmedforcetype) : "无";
|
|
3824
|
+
const worstOperator = r4.max_mplosenum_member_deployarmedforcetype ? dataManager.getOperatorName(r4.max_mplosenum_member_deployarmedforcetype) : "无";
|
|
3825
|
+
templateData.report4 = {
|
|
3826
|
+
best_teammate: {
|
|
3827
|
+
name: bestTeammateName,
|
|
3828
|
+
avatar: bestTeammateAvatar,
|
|
3829
|
+
intimacy: r4.max_mpwinnum_member_friendintimacy || 0,
|
|
3830
|
+
win_num: r4.max_mpwinnum_player_winmun || 0,
|
|
3831
|
+
lose_num: r4.max_mpwinnum_player_wlosemun || 0,
|
|
3832
|
+
kill_num: r4.max_mpwinnum_player_killnum || 0,
|
|
3833
|
+
assist: r4.max_mpwinnum_player_assist || 0,
|
|
3834
|
+
score: Number(r4.max_mpwinnum_player_score || 0).toLocaleString(),
|
|
3835
|
+
operator: bestOperator,
|
|
3836
|
+
operator_image: r4.max_mpwinnum_member_deployarmedforcetype ? dataManager.getOperatorImagePath(bestOperator) : null
|
|
3837
|
+
},
|
|
3838
|
+
worst_teammate: {
|
|
3839
|
+
name: worstTeammateName,
|
|
3840
|
+
avatar: worstTeammateAvatar,
|
|
3841
|
+
intimacy: r4.max_mplosenum_member_friendintimacy || 0,
|
|
3842
|
+
win_num: r4.max_mplosenum_player_winmun || 0,
|
|
3843
|
+
lose_num: r4.max_mplosenum_player_wlosemun || 0,
|
|
3844
|
+
kill_num: r4.max_mplosenum_player_killnum || 0,
|
|
3845
|
+
assist: r4.max_mplosenum_player_assist || 0,
|
|
3846
|
+
score: Number(r4.max_mplosenum_player_score || 0).toLocaleString(),
|
|
3847
|
+
operator: worstOperator,
|
|
3848
|
+
operator_image: r4.max_mplosenum_member_deployarmedforcetype ? dataManager.getOperatorImagePath(worstOperator) : null
|
|
3849
|
+
}
|
|
3850
|
+
};
|
|
3851
|
+
}
|
|
3852
|
+
if (reportDm.bk) {
|
|
3853
|
+
const bk = reportDm.bk;
|
|
3854
|
+
if (bk.mp_vehicleid_list && Array.isArray(bk.mp_vehicleid_list)) {
|
|
3855
|
+
templateData.bk = {
|
|
3856
|
+
vehicles: bk.mp_vehicleid_list.map((v) => ({
|
|
3857
|
+
vehicleid: v.vehicleid,
|
|
3858
|
+
inum: v.inum || 0,
|
|
3859
|
+
vehicle_name: `载具${v.vehicleid}`
|
|
3860
|
+
})).sort((a, b) => b.inum - a.inum),
|
|
3861
|
+
avg_score: Number(bk.mp_avgscore || 0).toFixed(1),
|
|
3862
|
+
support_count: bk.mp_supportcount || 0,
|
|
3863
|
+
support_details: {
|
|
3864
|
+
"1001012": bk.mp_supportcount_1001012 || 0,
|
|
3865
|
+
"1001011": bk.mp_supportcount_1001011 || 0,
|
|
3866
|
+
"1001014": bk.mp_supportcount_1001014 || 0,
|
|
3867
|
+
"1001015": bk.mp_supportcount_1001015 || 0
|
|
3868
|
+
}
|
|
3869
|
+
};
|
|
3870
|
+
} else {
|
|
3871
|
+
templateData.bk = {
|
|
3872
|
+
vehicles: [],
|
|
3873
|
+
avg_score: "0",
|
|
3874
|
+
support_count: 0,
|
|
3875
|
+
support_details: {}
|
|
3876
|
+
};
|
|
3877
|
+
}
|
|
3878
|
+
}
|
|
3879
|
+
} else {
|
|
3880
|
+
templateData.topFriends = [];
|
|
3881
|
+
}
|
|
3882
|
+
if (mode === "sol") {
|
|
3883
|
+
if (!templateData.solData || templateData.solData.isEmpty) {
|
|
3884
|
+
return "暂无烽火地带周报数据,不打两把吗?";
|
|
3885
|
+
}
|
|
3886
|
+
return renderer.renderToMessage("weeklyReport", {
|
|
3887
|
+
...templateData,
|
|
3888
|
+
mpData: null
|
|
3889
|
+
});
|
|
3890
|
+
}
|
|
3891
|
+
if (mode === "mp") {
|
|
3892
|
+
if (!templateData.mpData || templateData.mpData.isEmpty) {
|
|
3893
|
+
return "暂无全面战场周报数据,不打两把吗?";
|
|
3894
|
+
}
|
|
3895
|
+
return renderer.renderToMessage("weeklyReport", {
|
|
3896
|
+
...templateData,
|
|
3897
|
+
solData: null
|
|
3898
|
+
});
|
|
3899
|
+
}
|
|
3900
|
+
const hasSolData = templateData.solData && !templateData.solData.isEmpty;
|
|
3901
|
+
const hasMpData = templateData.mpData && !templateData.mpData.isEmpty;
|
|
3902
|
+
if (!hasSolData && !hasMpData) {
|
|
3903
|
+
return "暂无周报数据,不打两把吗?";
|
|
3904
|
+
}
|
|
3905
|
+
if (hasSolData && hasMpData) {
|
|
3906
|
+
const solImage = await renderer.renderToMessage("weeklyReport", {
|
|
3907
|
+
...templateData,
|
|
3908
|
+
mpData: null
|
|
3909
|
+
});
|
|
3910
|
+
if (solImage && typeof solImage !== "string") {
|
|
3911
|
+
await session.send((0, import_koishi3.h)("message", [import_koishi3.h.text("【烽火地带周报】\n"), solImage]));
|
|
3912
|
+
}
|
|
3913
|
+
const mpImage = await renderer.renderToMessage("weeklyReport", {
|
|
3914
|
+
...templateData,
|
|
3915
|
+
solData: null
|
|
3916
|
+
});
|
|
3917
|
+
if (mpImage && typeof mpImage !== "string") {
|
|
3918
|
+
await session.send((0, import_koishi3.h)("message", [import_koishi3.h.text("【全面战场周报】\n"), mpImage]));
|
|
3919
|
+
}
|
|
3920
|
+
return;
|
|
3921
|
+
}
|
|
3922
|
+
if (hasSolData) {
|
|
3923
|
+
return renderer.renderToMessage("weeklyReport", {
|
|
3924
|
+
...templateData,
|
|
3925
|
+
mpData: null
|
|
3926
|
+
});
|
|
3927
|
+
} else {
|
|
3928
|
+
return renderer.renderToMessage("weeklyReport", {
|
|
3929
|
+
...templateData,
|
|
3930
|
+
solData: null
|
|
3931
|
+
});
|
|
3932
|
+
}
|
|
3500
3933
|
} catch (error) {
|
|
3501
3934
|
logger.error("查询周报失败:", error);
|
|
3502
3935
|
return `查询失败: ${error.message}`;
|
|
@@ -3536,8 +3969,8 @@ function parseAssetTrend(totalPrice) {
|
|
|
3536
3969
|
const maxPrice = Math.max(...allPrices);
|
|
3537
3970
|
const minPrice = Math.min(...allPrices);
|
|
3538
3971
|
const priceRange = maxPrice - minPrice || 1;
|
|
3539
|
-
const chartWidth =
|
|
3540
|
-
const chartHeight =
|
|
3972
|
+
const chartWidth = 2e3;
|
|
3973
|
+
const chartHeight = 200;
|
|
3541
3974
|
const padding = { top: 20, right: 10, bottom: 30, left: 10 };
|
|
3542
3975
|
const plotWidth = chartWidth - padding.left - padding.right;
|
|
3543
3976
|
const plotHeight = chartHeight - padding.top - padding.bottom;
|
|
@@ -4018,9 +4451,9 @@ function formatDuration(value, unit = "seconds") {
|
|
|
4018
4451
|
} else {
|
|
4019
4452
|
totalMinutes = numValue;
|
|
4020
4453
|
}
|
|
4021
|
-
const
|
|
4454
|
+
const h6 = Math.floor(totalMinutes / 60);
|
|
4022
4455
|
const m = Math.floor(totalMinutes % 60);
|
|
4023
|
-
return `${
|
|
4456
|
+
return `${h6}小时${m}分钟`;
|
|
4024
4457
|
}
|
|
4025
4458
|
__name(formatDuration, "formatDuration");
|
|
4026
4459
|
|
|
@@ -6244,28 +6677,31 @@ function registerResourcesCommands(ctx, config, resourceManager) {
|
|
|
6244
6677
|
`状态: ${status.ready ? "✅ 已就绪" : "❌ 未下载"}`,
|
|
6245
6678
|
`路径: ${status.path}`,
|
|
6246
6679
|
`文件数: ${status.fileCount}`,
|
|
6247
|
-
|
|
6680
|
+
`GH-Proxy 加速: ${status.useGhProxy ? "✅ 已开启" : "❌ 未开启"}`
|
|
6248
6681
|
];
|
|
6249
6682
|
if (status.lastUpdate) {
|
|
6250
6683
|
lines.push(`最后更新: ${new Date(status.lastUpdate).toLocaleString("zh-CN")}`);
|
|
6251
6684
|
}
|
|
6252
|
-
if (status.source) {
|
|
6253
|
-
lines.push(`下载源: ${status.source}`);
|
|
6254
|
-
}
|
|
6255
6685
|
return lines.join("\n");
|
|
6256
6686
|
});
|
|
6257
|
-
ctx.command("df.resources.download
|
|
6258
|
-
const
|
|
6259
|
-
|
|
6260
|
-
|
|
6687
|
+
ctx.command("df.resources.download", "下载/更新资源", { authority: 4 }).alias("df.资源下载").alias("df.下载资源").alias("df.资源更新").alias("df.更新资源").option("force", "-f 强制重新下载所有文件").action(async ({ session, options }) => {
|
|
6688
|
+
const status = resourceManager.getDownloadStatus();
|
|
6689
|
+
if (status.isDownloading && status.progress) {
|
|
6690
|
+
const percent = Math.round(status.progress.downloaded / status.progress.total * 100);
|
|
6691
|
+
return `⏳ 资源正在下载中...
|
|
6692
|
+
进度: ${status.progress.downloaded}/${status.progress.total} (${percent}%)
|
|
6693
|
+
当前: ${status.progress.current || "准备中"}`;
|
|
6694
|
+
}
|
|
6695
|
+
const useProxy = config.useGhProxy;
|
|
6696
|
+
await session.send(`🔄 开始下载资源${useProxy ? " (使用 GH-Proxy 加速)" : ""},请稍候...`);
|
|
6261
6697
|
if (options?.force) {
|
|
6262
6698
|
await resourceManager.cleanResources();
|
|
6263
6699
|
}
|
|
6264
6700
|
try {
|
|
6265
|
-
const result = await resourceManager.downloadResources(
|
|
6701
|
+
const result = await resourceManager.downloadResources();
|
|
6266
6702
|
if (result.success) {
|
|
6267
6703
|
return `✅ 资源下载完成!
|
|
6268
|
-
|
|
6704
|
+
本次共下载 ${result.downloaded} 个文件`;
|
|
6269
6705
|
} else {
|
|
6270
6706
|
return `⚠️ 资源下载完成,但有 ${result.failed.length} 个文件失败
|
|
6271
6707
|
成功: ${result.downloaded} 个
|
|
@@ -6276,7 +6712,7 @@ ${result.failed.slice(0, 5).join("\n")}` + (result.failed.length > 5 ? `
|
|
|
6276
6712
|
} catch (error) {
|
|
6277
6713
|
logger.error("资源下载失败:", error);
|
|
6278
6714
|
return `❌ 资源下载失败: ${error.message}
|
|
6279
|
-
|
|
6715
|
+
请检查网络连接或尝试开启 GH-Proxy 加速`;
|
|
6280
6716
|
}
|
|
6281
6717
|
});
|
|
6282
6718
|
ctx.command("df.resources.clean", "清理资源目录", { authority: 4 }).alias("df.资源清理").action(async ({ session }) => {
|
|
@@ -6296,7 +6732,7 @@ ${result.failed.slice(0, 5).join("\n")}` + (result.failed.length > 5 ? `
|
|
|
6296
6732
|
__name(registerResourcesCommands, "registerResourcesCommands");
|
|
6297
6733
|
|
|
6298
6734
|
// src/commands/entertainment/voice.ts
|
|
6299
|
-
var
|
|
6735
|
+
var import_koishi4 = require("koishi");
|
|
6300
6736
|
var SCENE_MAP = {
|
|
6301
6737
|
"局内": "InGame",
|
|
6302
6738
|
"局外": "OutGame",
|
|
@@ -6606,12 +7042,12 @@ async function sendVoiceMessage(audio, session) {
|
|
|
6606
7042
|
infoMsg.push(`(链接${minutes}分${seconds}秒后失效)`);
|
|
6607
7043
|
}
|
|
6608
7044
|
const textPart = infoMsg.length > 0 ? infoMsg.join(" ") + "\n" : "";
|
|
6609
|
-
await session.send(textPart +
|
|
7045
|
+
await session.send(textPart + import_koishi4.h.audio(audio.download.url));
|
|
6610
7046
|
}
|
|
6611
7047
|
__name(sendVoiceMessage, "sendVoiceMessage");
|
|
6612
7048
|
|
|
6613
7049
|
// src/commands/entertainment/tts.ts
|
|
6614
|
-
var
|
|
7050
|
+
var import_koishi5 = require("koishi");
|
|
6615
7051
|
function registerTtsCommands(ctx, api) {
|
|
6616
7052
|
const logger = ctx.logger("delta-force");
|
|
6617
7053
|
ctx.command("df.tts.status", "查看TTS服务状态").alias("df.tts状态").action(async ({ session }) => {
|
|
@@ -6758,7 +7194,7 @@ function registerTtsCommands(ctx, api) {
|
|
|
6758
7194
|
return result.message || "语音合成失败";
|
|
6759
7195
|
}
|
|
6760
7196
|
if (result.audio_url) {
|
|
6761
|
-
await session.send(
|
|
7197
|
+
await session.send(import_koishi5.h.audio(result.audio_url));
|
|
6762
7198
|
logger.info(`TTS合成成功: ${result.filename}, 文本: ${parseResult.text.substring(0, 20)}...`);
|
|
6763
7199
|
}
|
|
6764
7200
|
} catch (error) {
|
|
@@ -6899,20 +7335,17 @@ async function pollTaskStatus(taskId, api, logger) {
|
|
|
6899
7335
|
__name(pollTaskStatus, "pollTaskStatus");
|
|
6900
7336
|
|
|
6901
7337
|
// src/config.ts
|
|
6902
|
-
var
|
|
6903
|
-
var Config =
|
|
6904
|
-
apiKey:
|
|
6905
|
-
clientID:
|
|
6906
|
-
apiBaseUrl:
|
|
6907
|
-
|
|
6908
|
-
|
|
6909
|
-
|
|
6910
|
-
|
|
7338
|
+
var import_koishi6 = require("koishi");
|
|
7339
|
+
var Config = import_koishi6.Schema.object({
|
|
7340
|
+
apiKey: import_koishi6.Schema.string().required().role("secret").description("API密钥,在 https://df.shallow.ink/api-keys 创建"),
|
|
7341
|
+
clientID: import_koishi6.Schema.string().required().description("客户端ID,从管理页面获取"),
|
|
7342
|
+
apiBaseUrl: import_koishi6.Schema.union([
|
|
7343
|
+
import_koishi6.Schema.const("https://df-api.shallow.ink").description("默认 CDN(推荐)"),
|
|
7344
|
+
import_koishi6.Schema.const("https://df-api-eo.shallow.ink").description("EdgeOne CDN"),
|
|
7345
|
+
import_koishi6.Schema.const("https://df-api-esa.shallow.ink").description("ESA CDN"),
|
|
7346
|
+
import_koishi6.Schema.string()
|
|
6911
7347
|
]).default("https://df-api.shallow.ink").description("API 基础地址"),
|
|
6912
|
-
|
|
6913
|
-
import_koishi5.Schema.const("github").description("GitHub(优先更新)"),
|
|
6914
|
-
import_koishi5.Schema.const("gitee").description("Gitee(国内用户推荐)")
|
|
6915
|
-
]).default("github").description("静态资源下载源")
|
|
7348
|
+
useGhProxy: import_koishi6.Schema.boolean().default(false).description("使用 GH-Proxy 加速下载(国内用户推荐开启)")
|
|
6916
7349
|
});
|
|
6917
7350
|
|
|
6918
7351
|
// src/index.ts
|
|
@@ -6930,18 +7363,13 @@ function apply(ctx, config) {
|
|
|
6930
7363
|
const dataManager = new DataManager(ctx, api);
|
|
6931
7364
|
const renderer = createRenderer(ctx);
|
|
6932
7365
|
const resourceManager = createResourceManager(ctx, config);
|
|
6933
|
-
|
|
6934
|
-
|
|
6935
|
-
resourceManager.syncResources()
|
|
6936
|
-
]).then((results) => {
|
|
6937
|
-
const [dataResult, resourceResult] = results;
|
|
6938
|
-
if (dataResult.status === "rejected") {
|
|
6939
|
-
logger.warn("数据管理器初始化失败:", dataResult.reason);
|
|
6940
|
-
}
|
|
6941
|
-
if (resourceResult.status === "rejected") {
|
|
6942
|
-
logger.warn("资源同步失败:", resourceResult.reason);
|
|
6943
|
-
}
|
|
7366
|
+
dataManager.init().catch((error) => {
|
|
7367
|
+
logger.warn("数据管理器初始化失败:", error);
|
|
6944
7368
|
});
|
|
7369
|
+
if (!resourceManager.isResourcesReady()) {
|
|
7370
|
+
logger.warn("静态资源未下载,请使用 df.resources.download 命令下载资源");
|
|
7371
|
+
logger.warn("国内用户推荐开启 useGhProxy 配置项以加速下载");
|
|
7372
|
+
}
|
|
6945
7373
|
ctx.command("df", "三角洲行动").alias("三角洲");
|
|
6946
7374
|
ctx.command("df.help", "查看帮助").action(async () => {
|
|
6947
7375
|
return `三角洲行动插件
|
package/lib/middleware.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"middleware.d.ts","sourceRoot":"","sources":["../src/middleware.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAW,MAAM,QAAQ,CAAA;
|
|
1
|
+
{"version":3,"file":"middleware.d.ts","sourceRoot":"","sources":["../src/middleware.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAW,MAAM,QAAQ,CAAA;AA2bzC;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,OAAO,QA6B9C"}
|
package/lib/resources.d.ts
CHANGED
|
@@ -6,8 +6,8 @@ export interface ResourceItem {
|
|
|
6
6
|
sha: string;
|
|
7
7
|
size: number;
|
|
8
8
|
type: 'file' | 'dir';
|
|
9
|
-
download_url: string
|
|
10
|
-
|
|
9
|
+
download_url: string;
|
|
10
|
+
html_url?: string;
|
|
11
11
|
}
|
|
12
12
|
export interface DownloadProgress {
|
|
13
13
|
total: number;
|
|
@@ -15,68 +15,65 @@ export interface DownloadProgress {
|
|
|
15
15
|
current: string;
|
|
16
16
|
failed: string[];
|
|
17
17
|
}
|
|
18
|
-
export type ResourceSource = 'github' | 'gitee';
|
|
19
|
-
export interface ResourceConfig {
|
|
20
|
-
github: {
|
|
21
|
-
owner: string;
|
|
22
|
-
repo: string;
|
|
23
|
-
branch: string;
|
|
24
|
-
basePath: string;
|
|
25
|
-
};
|
|
26
|
-
gitee: {
|
|
27
|
-
owner: string;
|
|
28
|
-
repo: string;
|
|
29
|
-
branch: string;
|
|
30
|
-
basePath: string;
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
18
|
export declare class ResourceManager {
|
|
34
19
|
private ctx;
|
|
35
20
|
private pluginConfig;
|
|
36
21
|
private resourcesPath;
|
|
37
|
-
private config;
|
|
38
22
|
private logger;
|
|
23
|
+
private isDownloading;
|
|
24
|
+
private currentProgress;
|
|
39
25
|
constructor(ctx: Context, pluginConfig: Config);
|
|
26
|
+
/**
|
|
27
|
+
* 获取当前下载状态
|
|
28
|
+
*/
|
|
29
|
+
getDownloadStatus(): {
|
|
30
|
+
isDownloading: boolean;
|
|
31
|
+
progress: DownloadProgress | null;
|
|
32
|
+
};
|
|
40
33
|
/**
|
|
41
34
|
* 获取资源根目录路径
|
|
42
35
|
*/
|
|
43
36
|
getResourcesPath(): string;
|
|
37
|
+
/**
|
|
38
|
+
* 延迟函数
|
|
39
|
+
*/
|
|
40
|
+
private sleep;
|
|
44
41
|
/**
|
|
45
42
|
* 检查资源是否已下载
|
|
46
43
|
*/
|
|
47
44
|
isResourcesReady(): boolean;
|
|
48
45
|
/**
|
|
49
|
-
*
|
|
46
|
+
* 获取后端 API 基础地址
|
|
50
47
|
*/
|
|
51
|
-
private
|
|
48
|
+
private getApiBaseUrl;
|
|
52
49
|
/**
|
|
53
|
-
*
|
|
50
|
+
* 应用 gh-proxy 加速到下载 URL
|
|
54
51
|
*/
|
|
55
|
-
private
|
|
52
|
+
private applyGhProxy;
|
|
56
53
|
/**
|
|
57
|
-
*
|
|
54
|
+
* 从后端 API 获取文件列表
|
|
58
55
|
*/
|
|
59
56
|
private fetchFileList;
|
|
57
|
+
/**
|
|
58
|
+
* 递归提取树形结构中的所有文件
|
|
59
|
+
*/
|
|
60
|
+
private extractFiles;
|
|
60
61
|
/**
|
|
61
62
|
* 下载单个文件
|
|
62
63
|
*/
|
|
63
64
|
private downloadFile;
|
|
64
65
|
/**
|
|
65
|
-
*
|
|
66
|
+
* 下载所有资源(支持断点续传)
|
|
66
67
|
*/
|
|
67
|
-
downloadResources(
|
|
68
|
+
downloadResources(onProgress?: (progress: DownloadProgress) => void): Promise<{
|
|
68
69
|
success: boolean;
|
|
69
70
|
downloaded: number;
|
|
70
71
|
failed: string[];
|
|
71
72
|
}>;
|
|
72
73
|
/**
|
|
73
|
-
*
|
|
74
|
-
*/
|
|
75
|
-
private shouldSkipFile;
|
|
76
|
-
/**
|
|
77
|
-
* 保存资源清单
|
|
74
|
+
* 写入 manifest 文件
|
|
78
75
|
*/
|
|
79
|
-
private
|
|
76
|
+
private writeManifest;
|
|
80
77
|
/**
|
|
81
78
|
* 加载资源清单
|
|
82
79
|
*/
|
|
@@ -89,7 +86,7 @@ export declare class ResourceManager {
|
|
|
89
86
|
path: string;
|
|
90
87
|
fileCount: number;
|
|
91
88
|
lastUpdate: string | null;
|
|
92
|
-
|
|
89
|
+
useGhProxy: boolean;
|
|
93
90
|
}>;
|
|
94
91
|
/**
|
|
95
92
|
* 清理资源目录
|
package/lib/resources.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resources.d.ts","sourceRoot":"","sources":["../src/resources.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAA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