更新资源map;本地存在资源时不再获取节点加快响应;fix#91

This commit is contained in:
UCPr 2025-01-23 15:44:33 +08:00
parent 2e8aea4542
commit a62109a6c0
11 changed files with 21 additions and 17 deletions

View file

@ -4,7 +4,7 @@ import _ from 'lodash';
import { rulePrefix } from '../lib/common.js'; import { rulePrefix } from '../lib/common.js';
import request from '../utils/request.js'; import request from '../utils/request.js';
export class Note extends ZZZPlugin { export class Calendar extends ZZZPlugin {
constructor() { constructor() {
super({ super({
name: '[ZZZ-Plugin]Calendar', name: '[ZZZ-Plugin]Calendar',

View file

@ -4,7 +4,7 @@ import _ from 'lodash';
import { rulePrefix } from '../lib/common.js'; import { rulePrefix } from '../lib/common.js';
import { getCodeMsg } from '../lib/code.js'; import { getCodeMsg } from '../lib/code.js';
export class Note extends ZZZPlugin { export class Code extends ZZZPlugin {
constructor() { constructor() {
super({ super({
name: '[ZZZ-Plugin]Code', name: '[ZZZ-Plugin]Code',

View file

@ -4,7 +4,7 @@ import _ from 'lodash';
import { Deadly } from '../model/deadly.js'; import { Deadly } from '../model/deadly.js';
import { rulePrefix } from '../lib/common.js'; import { rulePrefix } from '../lib/common.js';
export class Abyss extends ZZZPlugin { export class deadly extends ZZZPlugin {
constructor() { constructor() {
super({ super({
name: '[ZZZ-Plugin]deadly', name: '[ZZZ-Plugin]deadly',

View file

@ -4,7 +4,7 @@ import _ from 'lodash';
import manage from './manage/index.js'; import manage from './manage/index.js';
import { rulePrefix } from '../lib/common.js'; import { rulePrefix } from '../lib/common.js';
export class Panel extends ZZZPlugin { export class Manage extends ZZZPlugin {
constructor() { constructor() {
super({ super({
name: '[ZZZ-Plugin]Manage', name: '[ZZZ-Plugin]Manage',

View file

@ -5,7 +5,7 @@ import _ from 'lodash';
import { rulePrefix } from '../lib/common.js'; import { rulePrefix } from '../lib/common.js';
import { getMonthly, getMonthlyCollect } from '../lib/monthly.js'; import { getMonthly, getMonthlyCollect } from '../lib/monthly.js';
export class Note extends ZZZPlugin { export class monthly extends ZZZPlugin {
constructor() { constructor() {
super({ super({
name: '[ZZZ-Plugin]Monthly', name: '[ZZZ-Plugin]Monthly',

View file

@ -121,7 +121,7 @@ export class Panel extends ZZZPlugin {
retType: 'base64', retType: 'base64',
}); });
const res = await this.reply(image); const res = await this.reply(image);
if (res?.message_id) if (res?.message_id && data.role_icon)
await redis.set(`ZZZ:PANEL:IMAGE:${res.message_id}`, data.role_icon, { await redis.set(`ZZZ:PANEL:IMAGE:${res.message_id}`, data.role_icon, {
EX: 3600 * 3, EX: 3600 * 3,
}); });

View file

@ -4,7 +4,7 @@ import common from '../../../lib/common/common.js';
import _ from 'lodash'; import _ from 'lodash';
import { rulePrefix } from '../lib/common.js'; import { rulePrefix } from '../lib/common.js';
export class Panel extends ZZZPlugin { export class User extends ZZZPlugin {
constructor() { constructor() {
super({ super({
name: '[ZZZ-Plugin]User', name: '[ZZZ-Plugin]User',

View file

@ -31,7 +31,7 @@ const displays = [
}, },
]; ];
export class Abyss extends ZZZPlugin { export class Wiki extends ZZZPlugin {
constructor() { constructor() {
super({ super({
name: '[ZZZ-Plugin]wiki', name: '[ZZZ-Plugin]wiki',

View file

@ -37,6 +37,9 @@ export const downloadResourceImage = async (
) => { ) => {
localBase = LocalURI[localBase]; localBase = LocalURI[localBase];
const finalPath = path.join(localBase, filename); const finalPath = path.join(localBase, filename);
if (fs.existsSync(finalPath) && fs.statSync(finalPath).size > 0) {
return finalPath;
}
const url = await getResourceRemotePath(remoteLabel, filename); const url = await getResourceRemotePath(remoteLabel, filename);
let result = await checkFile(url, finalPath); let result = await checkFile(url, finalPath);
if (!result && !!replaceFilename) { if (!result && !!replaceFilename) {

View file

@ -42,9 +42,9 @@
"en_name": "Grace" "en_name": "Grace"
}, },
"1321": { "1321": {
"sprite_id": "", "sprite_id": "37",
"name": "伊芙琳", "name": "伊芙琳",
"full_name": "伊芙琳", "full_name": "伊芙琳 · 舒瓦利耶",
"en_name": "Evelyn" "en_name": "Evelyn"
}, },
"2011": { "2011": {
@ -104,7 +104,7 @@
"1161": { "1161": {
"sprite_id": "26", "sprite_id": "26",
"name": "莱特", "name": "莱特",
"full_name": "...", "full_name": "莱特",
"en_name": "Lighter" "en_name": "Lighter"
}, },
"1111": { "1111": {
@ -138,10 +138,10 @@
"en_name": "Rina" "en_name": "Rina"
}, },
"1311": { "1311": {
"sprite_id": "", "sprite_id": "36",
"name": "耀嘉音", "name": "耀嘉音",
"full_name": "耀嘉音", "full_name": "耀嘉音",
"en_name": "Avatar_Female_Size03_Astra_En" "en_name": "Astra"
}, },
"1151": { "1151": {
"sprite_id": "27", "sprite_id": "27",
@ -158,7 +158,7 @@
"1221": { "1221": {
"sprite_id": "31", "sprite_id": "31",
"name": "柳", "name": "柳",
"full_name": "...", "full_name": "月城柳",
"en_name": "Yanagi" "en_name": "Yanagi"
}, },
"1271": { "1271": {

View file

@ -54,5 +54,6 @@
"14122": "Weapon_S_1221", "14122": "Weapon_S_1221",
"14124": "Weapon_S_1241", "14124": "Weapon_S_1241",
"14125": "Weapon_S_1251", "14125": "Weapon_S_1251",
"14126": "Weapon_S_1261" "14126": "Weapon_S_1261",
"14131": "Weapon_S_1311"
} }