@weitc/dfy-awesome-sidebar 0.0.0-stage → 1.0.1
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/CHANGELOG.md +4540 -0
- package/FEASIBILITY.md +250 -0
- package/INSTALL.md +93 -0
- package/LICENSE +43 -0
- package/README.md +170 -2
- package/assets/backgrounds/sidebar-default.jpg +0 -0
- package/assets/eggs/325/avatar.png +0 -0
- package/assets/eggs/325/baka-65-105-40s.webm +0 -0
- package/assets/eggs/325/stage.jpg +0 -0
- package/assets/eggs/347/avatar.png +0 -0
- package/assets/eggs/347/stage.jpg +0 -0
- package/assets/eggs/347/track-10-50-40s.webm +0 -0
- package/assets/themes/glass/actions-frame.css +90 -0
- package/assets/themes/glass/brand-frame.css +64 -0
- package/assets/themes/glass/footer-frame.css +111 -0
- package/assets/themes/glass/header-frame.css +285 -0
- package/assets/themes/glass/options-frame.css +129 -0
- package/assets/themes/glass/sidebar-outer.css +66 -0
- package/assets/themes/glass/topbar-frame.css +91 -0
- package/assets/themes/metal/actions-frame.css +90 -0
- package/assets/themes/metal/brand-frame.css +64 -0
- package/assets/themes/metal/footer-frame.css +111 -0
- package/assets/themes/metal/header-frame.css +300 -0
- package/assets/themes/metal/options-frame.css +129 -0
- package/assets/themes/metal/sidebar-outer.css +66 -0
- package/assets/themes/metal/topbar-frame.css +91 -0
- package/assets/themes/minimal/actions-frame.css +90 -0
- package/assets/themes/minimal/brand-frame.css +64 -0
- package/assets/themes/minimal/footer-frame.css +115 -0
- package/assets/themes/minimal/header-frame.css +271 -0
- package/assets/themes/minimal/options-frame.css +129 -0
- package/assets/themes/minimal/sidebar-outer.css +66 -0
- package/assets/themes/minimal/topbar-frame.css +91 -0
- package/assets/themes/neon/actions-frame.css +90 -0
- package/assets/themes/neon/brand-frame.css +64 -0
- package/assets/themes/neon/footer-frame.css +111 -0
- package/assets/themes/neon/header-frame.css +286 -0
- package/assets/themes/neon/options-frame.css +129 -0
- package/assets/themes/neon/sidebar-outer.css +66 -0
- package/assets/themes/neon/topbar-frame.css +91 -0
- package/assets/themes/ocean/actions-frame.css +90 -0
- package/assets/themes/ocean/brand-frame.css +64 -0
- package/assets/themes/ocean/footer-frame.css +111 -0
- package/assets/themes/ocean/header-frame.css +287 -0
- package/assets/themes/ocean/options-frame.css +129 -0
- package/assets/themes/ocean/sidebar-outer.css +66 -0
- package/assets/themes/ocean/topbar-frame.css +91 -0
- package/assets/themes/oldday/actions-frame.css +90 -0
- package/assets/themes/oldday/brand-frame.css +43 -0
- package/assets/themes/oldday/footer-frame.css +116 -0
- package/assets/themes/oldday/header-frame.css +142 -0
- package/assets/themes/oldday/options-frame.css +129 -0
- package/assets/themes/oldday/sidebar-outer.css +69 -0
- package/assets/themes/oldday/topbar-frame.css +91 -0
- package/assets/themes/pop/actions-frame.css +3 -0
- package/assets/themes/pop/brand-frame.css +3 -0
- package/assets/themes/pop/footer-frame.css +3 -0
- package/assets/themes/pop/header-frame.css +289 -0
- package/assets/themes/pop/options-frame.css +3 -0
- package/assets/themes/pop/pop-dust.css +37 -0
- package/assets/themes/pop/sidebar-outer.css +3 -0
- package/assets/themes/pop/topbar-frame.css +3 -0
- package/assets/themes/vaporwave/actions-frame.css +3 -0
- package/assets/themes/vaporwave/brand-frame.css +3 -0
- package/assets/themes/vaporwave/footer-frame.css +3 -0
- package/assets/themes/vaporwave/header-frame.css +436 -0
- package/assets/themes/vaporwave/options-frame.css +3 -0
- package/assets/themes/vaporwave/sidebar-outer.css +3 -0
- package/assets/themes/vaporwave/topbar-frame.css +3 -0
- package/assets/themes/vaporwave/vapor-dust.css +40 -0
- package/client.js +8116 -0
- package/cordis.patch.yml +6 -0
- package/docs/ACCEPTANCE-/345/244/264/345/203/217/351/242/204/350/247/210-20261201.md +42 -0
- package/docs/DETAIL.md +1 -0
- package/docs/DETAIL.zh.md +1 -0
- package/docs/pin-compare.png +0 -0
- package/docs/pin-modes.png +0 -0
- package/docs/preview.svg +84 -0
- package/docs/shot-fix7.png +0 -0
- package/docs/shot-frame-ocean.png +0 -0
- package/docs/shot-metal.png +0 -0
- package/docs/shot-stars.png +0 -0
- package/docs/shot-zones.png +0 -0
- package/icon.svg +5 -0
- package/index.js +2015 -0
- package/locale/en.json +7 -0
- package/locale/zh.json +7 -0
- package/package.json +58 -3
- package/pin.ps1 +172 -0
- package/rollback.ps1 +196 -0
- package/tools/__pycache__/pack-release.cpython-312.pyc +0 -0
- package/tools/_slice.txt +9 -0
- package/tools/boot.cjs +16 -0
- package/tools/build-frame-css.cjs +33 -0
- package/tools/check-docs.ps1 +41 -0
- package/tools/check-names.ps1 +35 -0
- package/tools/extract.cjs +28 -0
- package/tools/find-in-asar.cjs +43 -0
- package/tools/list-dir.cjs +21 -0
- package/tools/list-pkgs.cjs +10 -0
- package/tools/probe-delay.cjs +109 -0
- package/tools/probe-star-icon.cjs +164 -0
- package/tools/proof-glow-persist.cjs +102 -0
- package/tools/proof-migration.cjs +88 -0
- package/tools/proof-opacity.cjs +153 -0
- package/tools/proof-race.cjs +103 -0
- package/tools/run-asar.ps1 +53 -0
- package/tools/run.cmd +8 -0
- package/tools/scan.cjs +24 -0
- package/tools/smoke.cjs +179 -0
- package/tools/source-health.cjs +165 -0
- package/tools/splice.cjs +20 -0
- package/tools/test-account.cjs +74 -0
- package/tools/test-client.cjs +265 -0
- package/tools/test-dom.cjs +258 -0
- package/tools/test-host.cjs +500 -0
- package/tools/test-menu.cjs +591 -0
- package/tools/test-recharge.cjs +111 -0
- package/tools/test-v20.cjs +1793 -0
- package/workspace-pin.cmd +8 -0
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
// test-recharge.cjs — 日支在"充值/赠送"下的口径验收(只写临时 WP_DATA_DIR,不碰真实数据)
|
|
2
|
+
// 用例:A 无充值递减 / B 一次充值 / C 两次充值取最后一次 / D 赠送到账不影响 / E 旧日志无分项字段降级
|
|
3
|
+
const fs = require('node:fs')
|
|
4
|
+
const os = require('node:os')
|
|
5
|
+
const path = require('node:path')
|
|
6
|
+
const { pathToFileURL } = require('node:url')
|
|
7
|
+
|
|
8
|
+
module.exports = async function (args) {
|
|
9
|
+
const indexPath = path.resolve(args[0] || 'index.js')
|
|
10
|
+
const home = fs.mkdtempSync(path.join(os.tmpdir(), 'wp-recharge-'))
|
|
11
|
+
process.env.DSH_HOME = home
|
|
12
|
+
delete process.env.WP_BALANCE_LOG
|
|
13
|
+
process.env.WP_DATA_DIR = path.join(home, 'workspace-pin')
|
|
14
|
+
const dataDir = process.env.WP_DATA_DIR
|
|
15
|
+
const logFile = path.join(dataDir, 'balance-log.jsonl')
|
|
16
|
+
|
|
17
|
+
const routes = []
|
|
18
|
+
const cleanups = []
|
|
19
|
+
const ctx = {
|
|
20
|
+
effect(fn) { const c = fn(); if (typeof c === 'function') cleanups.push(c); return () => {}; },
|
|
21
|
+
on() { return () => {}; },
|
|
22
|
+
get() { return undefined; },
|
|
23
|
+
webServer: { register(route) { routes.push(route); return () => {}; } },
|
|
24
|
+
workspaceRegistry: { list: () => [{ id: 'ws-a', path: 'D:\\a', title: 'A' }], async insertBefore() { return ['ws-a']; } },
|
|
25
|
+
deepseekAccount: { async getBalance() { return { ok: true, value: { value: [{ balance: 100, currency: 'CNY' }], normal_wallets: [{ balance: 100 }], bonus_wallets: [] } } } },
|
|
26
|
+
}
|
|
27
|
+
const plugin = await import(pathToFileURL(indexPath).href)
|
|
28
|
+
plugin.apply(ctx)
|
|
29
|
+
const sleep = (ms) => new Promise((r) => setTimeout(r, ms))
|
|
30
|
+
const route = (n) => routes.find((r) => r.path === '/workspace-pin/' + n)
|
|
31
|
+
const makeRes = () => { const res = { statusCode: 0, body: '' }; res.writeHead = (c) => { res.statusCode = c; return res; }; res.end = (c) => { if (c !== undefined) res.body += c; return res; }; return res }
|
|
32
|
+
const call = async (name) => {
|
|
33
|
+
const res = makeRes()
|
|
34
|
+
await route(name).handler({ method: 'GET', headers: { host: 'x' }, url: '/' }, res)
|
|
35
|
+
return { code: res.statusCode, json: JSON.parse(res.body) }
|
|
36
|
+
}
|
|
37
|
+
const todayIso = (minuteOffset) => {
|
|
38
|
+
const d = new Date()
|
|
39
|
+
d.setHours(0, 0, 0, 0)
|
|
40
|
+
d.setMinutes(minuteOffset)
|
|
41
|
+
return d.toISOString()
|
|
42
|
+
}
|
|
43
|
+
const writeRows = (rows) => {
|
|
44
|
+
fs.mkdirSync(dataDir, { recursive: true })
|
|
45
|
+
fs.writeFileSync(logFile, rows.map((r) => JSON.stringify({ currency: 'CNY', bonus: '', source: 'workspace-pin', ...r })).join('\n') + '\n', 'utf8')
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const fails = []
|
|
49
|
+
const check = (ok, msg) => { console.log((ok ? ' PASS ' : ' FAIL ') + msg); if (!ok) fails.push(msg) }
|
|
50
|
+
await sleep(600)
|
|
51
|
+
|
|
52
|
+
// A 无充值:正常递减
|
|
53
|
+
writeRows([
|
|
54
|
+
{ at: todayIso(600), balance: '100.00', normalBalance: '100.00', bonusBalance: '0.00' },
|
|
55
|
+
{ at: todayIso(660), balance: '99.00', normalBalance: '99.00', bonusBalance: '0.00' },
|
|
56
|
+
{ at: todayIso(720), balance: '96.00', normalBalance: '96.00', bonusBalance: '0.00' },
|
|
57
|
+
])
|
|
58
|
+
let r = await call('account')
|
|
59
|
+
check(r.json.cost.reason === 'ok' && r.json.cost.spent === 4, 'A 无充值 → spent=4.00(实际 ' + r.json.cost.spent + ' / ' + r.json.cost.reason + ')')
|
|
60
|
+
check(r.json.cost.baselineSource === 'log-first' && r.json.cost.recharge === false, 'A baselineSource=log-first、recharge=false(实际 ' + r.json.cost.baselineSource + '/' + r.json.cost.recharge + ')')
|
|
61
|
+
|
|
62
|
+
// B 一次充值(芷汀那台的真实形状:66.52 → 20.46 → 520.23 → 519.64)
|
|
63
|
+
writeRows([
|
|
64
|
+
{ at: todayIso(600), balance: '66.52' },
|
|
65
|
+
{ at: todayIso(660), balance: '20.46' },
|
|
66
|
+
{ at: todayIso(675), balance: '520.23' },
|
|
67
|
+
{ at: todayIso(700), balance: '519.64' },
|
|
68
|
+
])
|
|
69
|
+
r = await call('account')
|
|
70
|
+
check(r.json.cost.reason === 'ok' && r.json.cost.spent === 0.59, 'B 一次充值 → spent=0.59、不再显示 --(实际 ' + r.json.cost.spent + ' / ' + r.json.cost.reason + ')')
|
|
71
|
+
check(r.json.cost.baselineSource === 'recharge-reset' && r.json.cost.recharge === true, 'B baselineSource=recharge-reset、recharge=true(实际 ' + r.json.cost.baselineSource + '/' + r.json.cost.recharge + ')')
|
|
72
|
+
check(Number(r.json.cost.baseline.balance) === 520.23, 'B 基线=充值后第一条 520.23(实际 ' + r.json.cost.baseline.balance + ')')
|
|
73
|
+
|
|
74
|
+
// C 两次充值 → 取最后一次
|
|
75
|
+
writeRows([
|
|
76
|
+
{ at: todayIso(600), balance: '100.00' },
|
|
77
|
+
{ at: todayIso(620), balance: '50.00' },
|
|
78
|
+
{ at: todayIso(640), balance: '300.00' },
|
|
79
|
+
{ at: todayIso(660), balance: '290.00' },
|
|
80
|
+
{ at: todayIso(680), balance: '400.00' },
|
|
81
|
+
{ at: todayIso(700), balance: '395.00' },
|
|
82
|
+
])
|
|
83
|
+
r = await call('account')
|
|
84
|
+
check(r.json.cost.spent === 5 && Number(r.json.cost.baseline.balance) === 400, 'C 两次充值 → 取最后一次(基线 400、spent 5;实际 ' + r.json.cost.baseline.balance + '/' + r.json.cost.spent + ')')
|
|
85
|
+
check(r.json.cost.rechargeResets === 2, 'C rechargeResets=2(实际 ' + r.json.cost.rechargeResets + ')')
|
|
86
|
+
|
|
87
|
+
// D 赠送到账:总余额上升、normal 不变 → 不重置、不作废
|
|
88
|
+
writeRows([
|
|
89
|
+
{ at: todayIso(600), balance: '100.00', normalBalance: '100.00', bonusBalance: '0.00' },
|
|
90
|
+
{ at: todayIso(660), balance: '99.00', normalBalance: '99.00', bonusBalance: '0.00' },
|
|
91
|
+
{ at: todayIso(720), balance: '149.00', normalBalance: '98.50', bonusBalance: '50.50' },
|
|
92
|
+
])
|
|
93
|
+
r = await call('account')
|
|
94
|
+
check(r.json.cost.recharge === false && r.json.cost.baselineSource === 'log-first', 'D 赠送不动 normal → recharge=false、仍 log-first(实际 ' + r.json.cost.recharge + '/' + r.json.cost.baselineSource + ')')
|
|
95
|
+
check(typeof r.json.cost.spent === 'number' && r.json.cost.spent >= 0, 'D spent 是数字、非负(实际 ' + r.json.cost.spent + ')')
|
|
96
|
+
|
|
97
|
+
// E 旧日志(无 normalBalance/bonusBalance)→ 降级总余额判据,不报错
|
|
98
|
+
writeRows([
|
|
99
|
+
{ at: todayIso(600), balance: '80.00' },
|
|
100
|
+
{ at: todayIso(660), balance: '30.00' },
|
|
101
|
+
{ at: todayIso(700), balance: '200.00' },
|
|
102
|
+
{ at: todayIso(740), balance: '198.50' },
|
|
103
|
+
])
|
|
104
|
+
r = await call('account')
|
|
105
|
+
check(r.code === 200 && r.json.cost.spent === 1.5 && r.json.cost.baselineSource === 'recharge-reset', 'E 旧行降级判据 → 200、spent=1.50、recharge-reset(实际 ' + r.code + '/' + r.json.cost.spent + '/' + r.json.cost.baselineSource + ')')
|
|
106
|
+
|
|
107
|
+
for (const fn of cleanups) { try { fn() } catch { /* ignore */ } }
|
|
108
|
+
fs.rmSync(home, { recursive: true, force: true })
|
|
109
|
+
console.log(fails.length === 0 ? 'RECHARGE PASS' : 'RECHARGE FAIL(' + fails.length + ' 项)')
|
|
110
|
+
return fails.length === 0 ? 0 : 1
|
|
111
|
+
}
|