feat: 支持自定义订阅节点并兼容现有数据库

This commit is contained in:
2026-09-29 11:52:41 +08:00
parent 3faf960f35
commit ab7d1c937a
27 changed files with 2203 additions and 449 deletions
+18
View File
@@ -0,0 +1,18 @@
import { test as base, expect } from "@playwright/test";
import Database from "better-sqlite3";
export const test = base.extend<{ isolatedData: void }>({
isolatedData: [async ({}, use) => {
const file = process.env.HY2_E2E_DATABASE;
if (!file || !/^\/tmp\/hy2-panel-ui-test-\d+\.db$/.test(file)) throw new Error("Refusing to reset a non-test database");
const db = new Database(file, { fileMustExist: true });
db.pragma("foreign_keys = ON");
db.transaction(() => {
db.exec("DELETE FROM hy2_nodes; DELETE FROM hy2_users WHERE is_admin = 0;");
db.prepare("UPDATE app_settings SET value = '[]' WHERE key IN ('main_proxy_group_member_slugs_json','proxy_groups_json')").run();
})();
db.close();
await use();
}, { auto: true }],
});
export { expect };