v0.2.4: fix ad key-words comma split + deleteAdFiles entry for extensions only

This commit is contained in:
root
2026-05-16 19:49:58 +08:00
parent e38adee8ff
commit b5d3620273
30 changed files with 1458 additions and 335 deletions

View File

@@ -6,7 +6,7 @@ import { QuarkDriver } from './drivers/quark.driver';
import { BaiduDriver } from './drivers/baidu.driver';
import { CloudConfig, getAndValidateCredential, getActiveCloudConfigs } from './credential.service';
import { lookupIpLocation } from './ip-lookup';
import { notify, notifyError, notifyInfo, notifyWarn, notifyEvent } from './notification.service';
import { notify, notifyError, notifyInfo, notifyWarn, notifyEvent, notifyConfigEvent } from './notification.service';
/** In-flight save dedup: prevents concurrent saves of the same URL (race condition fix) */
const inFlightSaves = new Map<string, Promise<SaveResult>>();
@@ -195,7 +195,7 @@ async function doSaveFromShare(shareUrl: string, cloudType: string, sourceTitle?
if (driverResult.success) {
const nickname = config.nickname || cloudType;
notifyEvent('save_success', `✅ 转存成功`,
notifyConfigEvent(config.id, 'save_success', `✅ 转存成功`,
`**${cloudType}** · ${nickname}\n文件: ${driverResult.folderName || sourceTitle || shareUrl}\n耗时: ${((Date.now() - startTime) / 1000).toFixed(1)}s`,
'info');
@@ -204,7 +204,7 @@ async function doSaveFromShare(shareUrl: string, cloudType: string, sourceTitle?
).run(config.id);
} else if ((driverResult as any).cookieExpired) {
// Cookie expired — don't count as failure, user needs to re-login
notifyEvent('cookie_expire', `⚠️ Cookie过期`,
notifyConfigEvent(config.id, 'cookie_expire', `⚠️ Cookie过期`,
`**${cloudType}** · ${config.nickname || '未知'}\n链接: ${shareUrl}\n请重新登录`,
'error');
} else {
@@ -213,7 +213,7 @@ async function doSaveFromShare(shareUrl: string, cloudType: string, sourceTitle?
).run(config.id);
const failCount = (db.prepare(`SELECT consecutive_failures FROM cloud_configs WHERE id = ?`).get(config.id) as any)?.consecutive_failures || 0;
if (failCount >= 3) {
notifyEvent('save_fail', `❌ 转存连续失败 ${failCount}`,
notifyConfigEvent(config.id, 'save_fail', `❌ 转存连续失败 ${failCount}`,
`**${cloudType}** · ${config.nickname || '未知'}\n链接: ${shareUrl}\n错误: ${driverResult.message}`,
'warn');
}