Compare commits
12
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a1da019299 | ||
|
|
9c21f9767e | ||
|
|
e951bd2f40 | ||
|
|
0501711267 | ||
|
|
3633ba32a6 | ||
|
|
299f8f2d5a | ||
|
|
d8022bb840 | ||
|
|
8642c1be7f | ||
|
|
2a82819ce8 | ||
|
|
97da1ae43a | ||
|
|
8c1a01ab3b | ||
|
|
296e063e3c |
No files matched your search
@@ -7,6 +7,7 @@ use App\Services\Plugin\HookManager;
|
||||
use App\Utils\CacheKey;
|
||||
use App\Utils\Helper;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class LoginService
|
||||
{
|
||||
@@ -110,7 +111,17 @@ class LoginService
|
||||
$user->password_algo = NULL;
|
||||
$user->password_salt = NULL;
|
||||
|
||||
if (!$user->save()) {
|
||||
// Password recovery invalidates every existing login, including the caller's.
|
||||
// Commit both changes together so a revocation failure cannot leave old sessions valid.
|
||||
$saved = DB::transaction(function () use ($user) {
|
||||
if (!$user->save()) {
|
||||
return false;
|
||||
}
|
||||
$user->tokens()->delete();
|
||||
return true;
|
||||
});
|
||||
|
||||
if (!$saved) {
|
||||
return [false, [500, __('Reset failed')]];
|
||||
}
|
||||
|
||||
@@ -152,4 +163,4 @@ class LoginService
|
||||
|
||||
return $url;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -41,7 +41,7 @@ class AutoReplyService
|
||||
$outHeaders['In-Reply-To'] = $headers['message-id'];
|
||||
$outHeaders['References'] = $headers['message-id'];
|
||||
}
|
||||
$html = view('mail.default.notify', array_replace([
|
||||
$html = view(config('mailflow.auto_reply_view', 'mail.default.notify'), array_replace([
|
||||
'name' => admin_setting('app_name', 'dpl'), 'url' => admin_setting('app_url', config('app.url')),
|
||||
'content' => e((string) Settings::get('auto_reply_text')),
|
||||
], Branding::values()))->render();
|
||||
|
||||
@@ -9,7 +9,7 @@ class HttpsTransport
|
||||
public function request(string $method,string $url,array $fields=[],bool $downstream=false): array
|
||||
{
|
||||
[$host,$ip]=$this->endpoint($url,$downstream);
|
||||
$client=Http::withoutRedirecting()->connectTimeout(10)->timeout(25)->withUserAgent('XB-PaymentHealth/1.0')
|
||||
$client=Http::withoutRedirecting()->connectTimeout(10)->timeout(25)->withUserAgent('XB-PaymentHealth/1.0')->accept('text/html')
|
||||
->withOptions(['verify'=>true,'curl'=>[CURLOPT_RESOLVE=>[$host.':443:'.(str_contains($ip,':')?'['.$ip.']':$ip)]]]);
|
||||
$response=$method==='POST'?$client->asForm()->post($url,$fields):$client->get($url);
|
||||
$body=$response->body();if(strlen($body)>2097152)throw new RuntimeException('oversized_cashier_response');
|
||||
|
||||
@@ -11,7 +11,18 @@ class QrEvidence
|
||||
|| preg_match('/(?:money|amount|price)["\x27\s:=]+'.preg_quote($amount,'/').'(?![0-9.])/i',$html);
|
||||
if(!$amountSeen)return false;
|
||||
$uri=$type==='wxpay'?'(?:wxpay:\/\/|weixin:\/\/wxpay\/)':'(?:alipays:\/\/|https:\/\/qr\.alipay\.com\/)';
|
||||
if(!preg_match('~'.$uri.'[^\s"\x27<>]+~i',$html))return false;
|
||||
$paymentUriSeen=(bool)preg_match('~'.$uri.'[^\s"\x27<>]+~i',$html);
|
||||
// This provider renders WeChat QR codes as an HTTPS short link. Inspect the
|
||||
// complete URL so lookalike hosts or a URL embedded in another URL fail.
|
||||
if(!$paymentUriSeen&&$type==='wxpay'&&preg_match_all('~https://[^\s"\x27<>\\\\]+~i',html_entity_decode($html,ENT_QUOTES|ENT_HTML5),$links)){
|
||||
foreach($links[0] as $link){
|
||||
$parts=parse_url($link);
|
||||
if($parts!==false&&strtolower($parts['scheme']??'')==='https'&&strtolower($parts['host']??'')==='wxmpurl.cn'
|
||||
&&!isset($parts['user'])&&!isset($parts['pass'])&&!isset($parts['port'])&&!isset($parts['fragment'])
|
||||
&&($parts['path']??'/')!=='/'){$paymentUriSeen=true;break;}
|
||||
}
|
||||
}
|
||||
if(!$paymentUriSeen)return false;
|
||||
// Structured rendering of a real payment URI, or a QR bitmap with three finder patterns.
|
||||
if(preg_match('~(?:new\s+QRCode|\.qrcode\s*\(|QRCode\.to(?:Canvas|DataURL|String))~i',$html))return true;
|
||||
if(preg_match_all('~data:image/png;base64,([A-Za-z0-9+/=]+)~',$html,$matches))foreach($matches[1]as$data){
|
||||
|
||||
@@ -17,6 +17,8 @@ return [
|
||||
'imap_password' => env('MAIL_IMAP_PASSWORD'),
|
||||
'imap_folder' => 'INBOX',
|
||||
'auto_reply_enabled' => false,
|
||||
// An instance may brand incoming-mail replies without changing shared defaults.
|
||||
'auto_reply_view' => env('MAIL_AUTO_REPLY_VIEW', 'mail.default.notify'),
|
||||
'auto_reply_subject' => '我们已收到您的邮件',
|
||||
'auto_reply_text' => '您的邮件已收到,我们会尽快处理。',
|
||||
'report_enabled' => env('MAIL_REPORT_ENABLED', false),
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
# DPL 单节点 Hysteria2
|
||||
|
||||
当前协议分配与全节点验收以[UDP协议维护](UDP_PROTOCOLS.md)为准。以下保留本日早先单节点验证的历史范围,不代表全站当前协议。
|
||||
|
||||
## 当前状态(2026-11-03)
|
||||
|
||||
用户要求将DPL一个节点改为Hysteria2 UDP。DPL「🇭🇰 香港 HK - 07」(节点/机器22,物理vn01/VPS-034)已改为type=hysteria、version=2、UDP24443。中转haiwi.lshan.eu.org:47308、严格TLS/SNI vn01.gembox-dns.com、证书路径、展示编号、正式组1和费率保持。客户端须更新DPL订阅,该条缓存AnyTLS配置不再适用。
|
||||
|
||||
同机HN「香港01」继续Hysteria2/UDP24444、中转47318;没有修改HN节点。原dpl-node共享主PID13203、程序/配置/secret/unit及旧XrayR文件摘要保持,旧443保持。未改XB核心、节点二进制、DNS、证书/续期或中转规则,也未重启共享unit。
|
||||
|
||||
## 传输范围
|
||||
|
||||
客户端到入口、出口到落地使用UDP,原47308→24443的随机校验串UDP往返及Hysteria2实际鉴权/联网均通过。但“能转发UDP”不证明中转内部隧道底层也为UDP:当前规则6461、隧道143(17517-jp),内部承载协议未核实,未切换。不能把本次结果写成全链路UDP或已解决国内封锁。
|
||||
|
||||
## 执行与回退
|
||||
|
||||
先保存面板私密原始行和两站23节点基线,验证DPL原端口UDP可达。按已验证原生机器发现流程,只将DPL节点22 enabled=false;确认24443 TCP/UDP均清空且HN UDP/原PID保持后,设置模型规范化Hysteria2配置并恢复enabled。最后仅UDP24443,不残留旧AnyTLS TCP。没有走会残留旧inbound的直接跨协议热更新。
|
||||
|
||||
回退原始行位于面板/root/codex-backups/dpl/hy2-vn01-20261103/node-before.json;同目录阶段意图记录真实原值。仅在本任务after精确匹配、其他保护字段不变时停用本DPL子实例,等端口清空,再恢复原type/protocol_settings和enabled;不重启整个unit、不覆盖HN或整库。原生停用阶段曾记录旧子实例final report被面板拒绝“Node not found on this machine”,本次新Hysteria2上下行已确认上报;不据此宣称停用瞬间所有旧未上报字节均保留。
|
||||
|
||||
## 验收与证据
|
||||
|
||||
- 真实DPL完整sing-box订阅与Clash YAML各23节点结构、端点、实际凭据、SNI和严格TLS核对通过:1条Hysteria2、其余22条AnyTLS。
|
||||
- 初次10秒冷启动未就绪;try2明确60秒启动等待后仍遇GitHub geosite/geoip规则集下载超时,无认证拒绝;原失败保留。只读确认两站DNS与规则URL相同、系统/AliDoH/Cloudflare解析均为当前107.148.118.186;先用真实目标参数隔离证明节点本身联网,再在独立try3以原DNS/路由/TLS判据完成完整真实订阅联网。没有改DNS、固定入口IP或删除生产规则集迁就验收。
|
||||
- 固定SHA已有sing-box1.14.3在gateway01运行,完整订阅只将诊断路由/selector限定到目标,并使用任务独立cache路径;得到96.9.228.135/HK,两HTTPS出口一致、严格TLS通过;错误密码被明确认证拒绝。上传、下载账户与本节点统计均增长,新鲜kernel/users指标通过。
|
||||
- 同机HN用摘要绑定的原真实HN订阅作新鲜Hysteria2联网回归,通过原47318得到同一预期出口。两站各23条节点已回读,除本次DPL节点22协议字段外,其余保存值保持;保护文件与主PID保持。
|
||||
- 正式验收器复用既有有效账号1(owned=false);未新建QA,任务租约已关闭,不禁用、不轮换该账号,也不声称其订阅403。所有临时客户端已退出。
|
||||
|
||||
私密证据根:codex/output/dpl-hy2-20261103/(Git忽略),以server-acceptance.json、acceptance.json、negative-auth.json、hn-regression.json为准;真实订阅、凭据及失败客户端日志只留服务器私密任务目录,不进入Git。已完成服务器侧验收,未做线上页面验收或国内用户故障网络验收。
|
||||
@@ -0,0 +1,47 @@
|
||||
# FUC → XB 本地迁移演练
|
||||
|
||||
2026-11-03;状态:**独立试导及VIP期初接入完成,39项XB回归通过;后续用户已明确要求完成VIP自动升级,已在独立插件实现并通过本地测试,唯一实现及当前状态见[VIP模块](FUC_VIP.md)。** 未切站,营业接入后置。来源见[迁移研究](FUC_MIGRATION_STUDY.md),业务决定见[功能对照](FUC_XB_FEATURE_COMPARISON.md)。下文期初阶段的“自动升级尚未实现”由此后续结果覆盖。
|
||||
|
||||
## 本地隔离与范围
|
||||
|
||||
本次授权为本地试导和测试钱包入账,不含生产迁移、源站退款、共享核心改造、节点切换或发布。使用既有13:42:26快照,不再次访问生产。实例为`fuc-migration-test`,数据库`instances/fuc-migration-test/database/rehearsal.sqlite`,环境、缓存和日志独立,目录700、文件600;不启动Web、调度或Horizon,不配置支付/邮件服务。`xb.loc`仍是原合成验收站,不展示真实用户数据;DPL/HN未被本次工具读写。源快照SHA256保持研究记录值。
|
||||
|
||||
## 已完成的导入和验证
|
||||
|
||||
| 项目 | 结果 |
|
||||
| --- | --- |
|
||||
| 用户 | 11,542全量试导;密码哈希、UUID、邀请关系、u/d、总额度、到期和佣金逐用户回读通过;不继承旧会话或管理员权限 |
|
||||
| 历史权益 | 296账号映射166个隐藏/停售/不可续费历史权益记录、3个权限组;用户自身字节和确切到期不变,不调用开通/流量重置;尚未证明真实节点集合等价 |
|
||||
| 钱包 | 原422.19元+13笔/3用户完整预购实付3,228.68元=测试库3,650.87元;逐用户及总和一致;佣金钱包仍16.32元 |
|
||||
| 旧账 | 原4,770订单及全部13表共38,901行存入独立`private/legacy-readonly.sqlite`;只读连接写入被拒绝;XB原生订单池为空,不重播历史支付/返佣,不参与新交易折抵 |
|
||||
| 身份例外 | 原指定邮箱1人,随后用户明确要求剩余3个缺后缀账号统一补`@dove.com`;已更新私有映射、字段投影及测试库,4个映射均通过严格格式/重复检查,当前邮箱待核查0人;源站原值不变。原无token的26账号保持空值,不生成正式新token |
|
||||
| 幂等/回退 | 重跑仅核对、不加钱;导入第101行故障全事务回滚通过;另在私有副本中先写钱包及独立幂等账本、再注入故障,两者共同回滚通过 |
|
||||
| XB业务 | 37项检查通过:原生模型/HTTP内核读取、资料/订阅/订单接口、原生VIP百分比、使用退回余额购买并开通、取消返还、再次取消不重复返还;临时订单/账号/节点/登录令牌全部回滚 |
|
||||
| 密码范围 | 用FUC同算法合成bcrypt测试正确/错误密码登录API;旧用户哈希保持,不掌握真实用户明文密码,未声称全员真实登录通过 |
|
||||
|
||||
测试通过后,测试库仍保留11,542个迁移用户和上述钱包金额,原生订单、临时节点及登录令牌均为0。没有提交、推送、发布或为本轮修改XB共享代码/迁移文件。
|
||||
|
||||
补后缀前已私有备份身份映射、字段投影、测试库和幂等账本;限定仅3个缺`@`账号的email字段变化,其余逐用户字段必须一致。邮件修正和导入指纹同事务更新;随后重跑导入及37项原生检查。此处只证明地址语法可用,不证明收件箱存在或已验证收信。
|
||||
|
||||
## 仍待完成的业务与兼容性
|
||||
|
||||
**用户最新收窄范围**:客户端明确改为有感迁移、重新导入新站订阅;不再开发旧URL兼容或安排无感切换验收。新站商品营业配置、真实收款和发信接入后面再做。以下旧订阅模拟结果只作历史研究证据,不再作为实施待办;已迁UUID/token不自动轮换。
|
||||
|
||||
**VIP期初已按确认规则本地应用,自动升级尚未实现。** 用户明确旧累计以`total_pay`为准、扣预购返还后最低0、钱包全额返还。11,542人的期初累计存入私有幂等库`vip_opening`(不是XB共享表),测试库`discount`按该累计计算;3个退款账号完成回读,其中1人累计归零、期初折扣改变,其余用户金额/权益和折扣不变。最新39项检查及重复导入核对通过;未改XB共享代码或数据库结构,没有给其他实例启用VIP。原账单差值留档,不再要求旧账重建。自动升级功能仍需实现。
|
||||
|
||||
应用前备份在`private/before-confirmed-vip-opening/`;只有核对原导入指纹及全部用户非折扣字段一致后,才允许更新确认的折扣、私有累计账本及导入指纹,操作同事务完成。用户确认范围和聚合结果在`confirmed-rules.json`、`rehearsal-results.json`,期初逐用户值为`private/vip-opening.jsonl`,3个退款账号回读为`private/confirmed-vip-opening-readback.json`。这些均不公开、不提交Git。
|
||||
|
||||
**旧订阅尚未实现真实无感接替。** 原版实际路由`/sub/{token}/{subtype}`及`/api/v1/client/subscribe/{subtype}?token=...`在XB返回404。离线模拟入口重写到既有`/api/v1/client/subscribe?token=...&flag=...`后,Clash、sing-box、V2Ray两类旧路径均生成含原UUID的配置;别名`singbox→sing-box`、`v2ray→general`,畸形token/未知格式拒绝。只验证配置生成,合成节点为`.invalid`,没有联网、部署重写、迁移域名或接入节点。其他旧格式及真实客户端待验证。XB的`subscribe_path`配置能改变基础路径,但不能单独处理类型后缀。
|
||||
|
||||
361个历史账号有旧IP数量限制,不将其等同XB设备限制;当前未过期权益中此类限制为0人,原值留档。28元旧`pending_activation`记录继续隔离,不重复返还。正式销售商品尚未配置,购买测试仅使用临时套餐并回滚。支付/邮件/验证码外部联调未执行。
|
||||
|
||||
## 证据与恢复
|
||||
|
||||
忽略目录`codex/output/fuc-migration-20261103/`包含:
|
||||
|
||||
- `rehearsal-results.json`:全量试导、资金/权益守恒及两类故障回滚、重复执行证据。
|
||||
- `rehearsal-verify-results.json`:37项实际XB模型/HTTP内核/业务服务检查。
|
||||
- `rehearsal-setup.php`、`rehearsal-bootstrap.php`、`rehearsal.py`、`rehearsal-verify.php`、`rehearsal-rollback-probe.py`:本地专用CLI工具,不是生产导入器。
|
||||
- `private/`:只读旧账、独立幂等账本、退款映射与VIP异常记录;不提交Git、不由网页提供。
|
||||
|
||||
导入工具只接受固定测试实例标记、快照SHA、空目标库和一致的映射指纹;重复运行发现用户状态不同会停止,不能覆盖后续业务。测试库是可删除的演练产物,不是正式目标库。退出本次试验仅处理该专用实例及其私有试验产物,不恢复或覆盖其他实例;当前保留证据供后续复核。
|
||||
@@ -0,0 +1,91 @@
|
||||
# FUC → FUC-XB 用户迁移研究
|
||||
|
||||
2026-11-03;状态:**生产快照研究及独立本地试导已完成;11,542用户写入专用测试库、37项XB检查通过。未修改FUC生产或XB核心,未切站。** 本地试导范围、资金结果、VIP/订阅未完成项及恢复唯一见[本地迁移演练](FUC_MIGRATION_REHEARSAL.md)。下文“未导入”等为初始只读研究阶段记录,当前执行状态以上述演练为准;尚不具备直接无损切站条件。
|
||||
|
||||
## 用户最新迁移决定(2026-11-03)
|
||||
|
||||
用户已要求:新增实例级可关闭的VIP升级,其他子项目默认关、FUC-XB开;已付未履约预购迁移后退钱包,原管理员订单也迁移;不要旧自动续订;客户端随后明确改为有感迁移、重新导入新站订阅,不做旧URL兼容;旧账只读归档,新站显示新业务、不影响XB折抵返佣。新站营业接入后面再做。最新边界唯一见[功能对照最新边界](FUC_XB_FEATURE_COMPARISON.md#用户已明确的新边界2026-11-03本节覆盖下方旧建议)。下文旧建议保留证据性质,不能继续实施已放弃的预购队列/自动续订/无感兼容。
|
||||
|
||||
## VIP全量差值核对(2026-11-03)
|
||||
|
||||
用户随后明确:迁移累计以旧`total_pay`为准,不按账单重建;预购退款扣减后的累计最低0,钱包仍全额返还。已将`max(0, total_pay-预购返还)`用于独立测试库的期初折扣及私有累计账本,39项检查通过;本节差值只归档,不再阻塞基线。自动升级模块尚未实施,源站未修改。
|
||||
|
||||
此前只核对3个预购退款账号,不是已完成全量账务对账。用户要求说明数量后,基于同一私有快照对11,542个现存账号比较旧`total_pay`与现存套餐已付账单完整金额(按`paid_gateway/paid_balance/paid_admin`状态、排除充值商品`code`,网关混付含余额贡献):955个账号不相等,其中旧累计较小941、较大14;731个旧累计为0但存在已付套餐账单,1个有累计但没有对应现存已付套餐账单。
|
||||
|
||||
这是**字段与现存账单的算术差值,不是955个已确认错账或损失账号**。旧累计算法、账单保存范围、管理员付款标记和历史处理版本均尚需解释;不能直接覆盖用户VIP或将旧累计与完整退款机械相减。仅36个差值账号当前账单中带余额/充值/管理员付款标记,不能把全部差值归因于余额支付。
|
||||
|
||||
3个有效预购退款账号中,2个旧累计与现存套餐已付账单合计不同、1个完全一致;其中1人完整退款额大于旧累计,直接相减为负。具体身份、各自金额和订单只保存在`private/vip-three-account-readback.json`;全量明细在`private/vip-all-account-comparison.json`,聚合口径在`vip-all-account-comparison-summary.json`。本次仅只读计算,没有调整测试库VIP、退款金额或生产数据。
|
||||
|
||||
本轮尚未执行钱包退款、用户导入、VIP核心实现、源站订单变更、节点切换或上线。
|
||||
|
||||
## 来源、目标与保护
|
||||
|
||||
来源是目前对外服务的FUC生产站(福云123.com),`site-jp01 /www/wwwroot/fuuuu.cloud`,现场HEAD `fea0d886f77a19a7b174836262917f7a735b2a5f`,与本地新版`fuc-new.loc`参考一致。“旧FUC”在本任务指相对于FUC-XB的现行业务站,不是本地旧目录`fuc.loc`。用户授权先把用户数据取回本地、研究迁移风险,不包含正式导入、改造核心或上线。
|
||||
|
||||
研究目标是独立的FUC-XB实例/数据库,尚未创建迁移运行库;当前`xb.loc`继续是合成数据验收站。不能把FUC数据合并到DPL/HN,不能覆盖根`.env`或`instances/hn`。主题0.11.0本地与已列API验收通过,真实支付、邮件、验证码及客户端联网未完成外部联调;旧FUC的预购、自动续订、会员等业务也不能由主题样式代替。
|
||||
|
||||
采集沿本机SSH→已登记白色机→site-jp01,使用既有受信主机密钥、准确资源凭据字段;数据库连接只在目标机内从其配置交给PDO。未打开线上网站,也未运行FUC应用入口、Cron、邮件或支付。数据直接经SSH压缩流写入本地,不在服务器生成明文备份文件,不输出用户明细、密码哈希或订阅令牌。
|
||||
|
||||
私有产物位于XB忽略目录`codex/output/fuc-migration-20261103/private/`:目录700、文件600,父目录700,Git排除;未挂载到网页、运行服务或共享数据库。`snapshot.jsonl.gz`为研究所需13张表的一致性摘录,**不是全库灾备**。排除用户二步验证密钥、API密钥、提现地址、注册IP及备注/封禁理由;未采集会话、登录IP历史、节点地址/密钥、支付商配置、全局应用密钥。密码哈希和订阅token仅存在私有数据文件中。
|
||||
|
||||
## 快照证据
|
||||
|
||||
- 快照时间:2026-11-03 **13:42:26 UTC+8**,应用时区现场核实为`Asia/Taipei`。导出PHP CLI默认时区为UTC,不把它当成应用时区;原到期/注册字符串按应用时区转换为Unix秒。
|
||||
- 全部所选表为InnoDB,以`REPEATABLE READ`、`READ ONLY`、`WITH CONSISTENT SNAPSHOT`读取;逐表导出数量、尾部完成记录及gzip完整性已核对。生产业务写入0;没有暂停原服务。
|
||||
- 压缩文件2,334,996字节;SHA256 `18f8346061922da82075f3d1d040f51247f23432b26e29ea2bfe73d8b7117103`。
|
||||
- user 11,542;order 4,770;invoice 4,769;paylist 5,528;link 11,517;product 14;renewal_quote 214;user_money_log 193;payback 5;invite_up 333;user_coupon 12;vip_map 4;plan_queue 0。**plan_queue为空不代表没有已付预购,真实待激活状态在order。**
|
||||
- 13:51追加只读统计:43个启用/显示节点均标为VMess,等级1、分组1;没有读取地址或密钥,未逐条联网。该附加元数据不与13:42账务快照混称同一事务。
|
||||
|
||||
## 可以保留的基础数据
|
||||
|
||||
| 对象 | 实测结果 | 迁移约束 |
|
||||
| --- | --- | --- |
|
||||
| 账号 | 11,542,规范化邮箱无重复,UUID全有效且无重复 | ID只在独立空目标库按映射保留;不能对其他实例按同ID覆盖 |
|
||||
| 密码 | 11,542均为PHP可识别bcrypt;原FUC生成的合成密码哈希由XB Helper正确验过,错误密码拒绝 | pass→password,不二次哈希,不回收/重置密码;未掌握或测试真实用户明文密码,不声称全员真实登录已验收 |
|
||||
| 钱包 | 26人非零,共422.19元;无负数/分以下金额 | Decimal转换为42,219分,投影逐用户及总和守恒,不走充值/支付回调 |
|
||||
| 返利钱包 | 4人非零,共16.32元 | 独立转为commission_balance 1,632分;不能与钱包混合、再次发放历史返佣 |
|
||||
| 流量 | user.transfer_enable/u/d均为字节 | 保留原值;SKU的bandwidth是GB,不能再次给用户字节值乘GB;不调用开通/重置服务 |
|
||||
| 到期 | 有效付费等级195人,含1管理员;等级1另101人 | 保留原Unix秒,不用导入日重新计算期限;失效日期不得转为XB的NULL不限时 |
|
||||
| 邀请关系 | 无缺失邀请人、自指或循环 | 先映射全部用户ID,再赋invite_user_id,不重新触发邀请奖励 |
|
||||
| 订阅token | 11,516条关联有效用户;无重复;26账号没有token;另1条孤儿link | 可保留有效token;无token仅在批准后生成新token;孤儿token隔离,不重新分配给其他用户 |
|
||||
| 安全状态 | 当前MFA、封禁、影子封禁均0;原管理员1人 | 研究投影所有is_admin/is_staff均false;旧管理员单独人工确认,不自动继承权限;不复制会话/全局密钥 |
|
||||
|
||||
离线投影输出`private/user-projection.jsonl`,只作为字段核对,**不是可直接执行的导入文件**。其中plan_id标为未解决、next_reset_at为空占位,不得直接加载进运行库。逐用户余额、返利、u/d、总额度、到期和UUID保留;余额/返利/已用/剩余字节总和断言通过,未执行流量重置、目标DB写入或管理员授权。
|
||||
|
||||
## 确定风险与处置要求
|
||||
|
||||
| 风险 | 本次证据 | 必须如何处理 |
|
||||
| --- | --- | --- |
|
||||
| 旧额度被新商品覆盖 | 195个当前有效付费等级账号中126人的额度不同于当前同SKU:97人更少、29人更多 | 当前user额度/u/d/到期为迁移基线;按历史权益建立映射,不能套当前SKU开通。101个等级1用户也不能改成XB默认1GB/24h新用户试用 |
|
||||
| 已付预购丢失或提前生效 | 17笔pending中13笔关联现存3个用户,其中1人11笔;4笔属已删除用户。另有1笔现存用户的旧pending_activation且账单paid_gateway | 按原ID顺序保留权益;原规则是到期或流量耗尽才取下一笔,不可一次叠加时长/额度或重播支付回调;旧状态1笔先核实是否已履约,不能自动再激活 |
|
||||
| 自动续订/优惠不兼容 | 开关34人;当前有效付费中13人开启且报价ready。13笔有效预购报价12 ready、1 review;有效当前/预购记录中2笔user_price与账单完整付款额不一致 | XB没有FUC同等队列/自动扣余额报价流程;完整保留renewal_quote及来源,不能按尾款推算,也不能默默关闭用户权益或擅自改成当前价 |
|
||||
| 周期/流量策略不同 | 原商品30/90/365天,活动400/183天;原套餐总流量可耗尽后提前切换下一包。XB常规续费按日历月累加,有按月重置逻辑 | 原剩余期按确切秒/字节保留;历史包不设默认月重置;后续固定天数产品、排队及耗尽触发需要专门设计,主题换色不能解决 |
|
||||
| 异常邮箱 | XB实际email:strict验证4个账号不通过,含1个有付费等级和余额的原管理员 | 私有异常表人工核实真实邮箱/管理员归属;不伪造地址,不放宽全站验证,不直接丢弃含余额账号 |
|
||||
| 孤儿/旧账状态 | 47笔订单找不到用户,含4 activated、4 pending;1条孤儿订阅;另外存在pending_payment/payment_pending旧状态 | 留只读历史档案并单独核对,不给新用户复用旧ID,不把旧账导成新待扣款订单;原网关在途回调需切站账本处理 |
|
||||
| VIP与优惠叠加 | 94人有当前会员折扣:90人8%、3人12%、1人15%;FUC有累计消费升级。FUC折扣连乘,XB券与VIP同基数累计 | 不能只搬一个discount字段就宣称规则一致;例如8%会员+10%券,FUC应付82.8%,当前XB应付82%。保留累计消费/已约定续订优惠,未来规则单独确认 |
|
||||
| URL和节点接替 | 旧URL为/sub/token及历史类型路由,XB默认/s/token/flag;当前43个启用节点均VMess,UUID可保留,但未接入XB | 保留UUID/token可减少换配置;域名、路径、旧客户端格式/参数、节点代理和计费须专项验证。当前未发现启用SS节点,SS passwd与XB uuid的差异不应冒充本次现网阻塞,但未来混合协议需另查 |
|
||||
| 误用注册/开通服务 | XB createUser会重哈希密码、生成新UUID/token并可能赠试用;OrderService会开通/重置/余额/返佣处理 | 正式导入须是有逐项清单和守恒检查的专用事务,关闭/规避普通注册与订单副作用;不调用现成API“重放”旧用户或旧订单 |
|
||||
|
||||
另有2,198个账号保留非零auto_reset_day(当前付费等级中14个),但当前相关重置实现已注释,不能按遗留字段自动开启XB每月重置。待迁移的历史周期先按现有额度/u/d保留,试迁移再核对实际调度和后续重置策略。
|
||||
|
||||
源码依据:FUC `src/Utils/Hash.php`、`src/Models/VipMap.php`、`src/Services/Cron.php`的orderToPlan/planQueue_pendingToActivation/_plan_to_user、`src/Services/RenewalPricing.php`、`src/Services/Subscribe.php`及`src/Services/Subscribe/V2Ray.php`;XB `app/Utils/Helper.php`、`app/Http/Requests/Passport/AuthLogin.php`、`app/Http/Middleware/Client.php`、`app/Services/UserService.php`、`app/Services/OrderService.php`、`app/Services/CouponService.php`、`app/Services/TrafficResetService.php`、`app/Models/Plan.php`及`app/Models/Server.php`。不依据旧模型表名推断当前运行状态。
|
||||
|
||||
## 追加方向:沿用XB业务规则(2026-11-03)
|
||||
|
||||
用户明确要求尽量不改XB代码、不动原有业务逻辑。两边功能差异、可用原生配置处理的部分、旧特殊权益处置及不能靠主题补齐的部分,统一见[功能对照与方案](FUC_XB_FEATURE_COMPARISON.md)。不据此自动开始导入或改造。
|
||||
|
||||
追加只读核查:13笔有效预购中11笔属于同一个原管理员账号,另外2笔各属于一个普通账号。是否为测试单尚未经用户确认,仍全部保留为待处置权益;账号/订单/账单明细只放`private/queued-11-details.json`及私有对照表,不写入普通文档。混付的完整账单合计需包含余额贡献,不能直接取旧order.user_price尾款。
|
||||
|
||||
## 建议路线与正式迁移关卡
|
||||
|
||||
1. **保持FUC继续服务**。先完成独立FUC-XB试迁移设计:用户/钱包/当前权益、历史只读账本、预购队列/续订报价的承接方案;按需提出具体XB核心变更申请,未批准前不修改共用核心。
|
||||
2. **先隔离演练**。在独立非公开目标库试导,禁止付款、发信、回调、自动续订、外部队列。逐用户核对邮箱、密码哈希、余额分、UUID/token、邀请关系、当前额度/u/d/到期及历史权益;特测11笔排队、400/183天、余额+网关混付、review报价、等级1和管理员。验证重复运行不重发权益/金额,失败全事务回退。当前仅做了内存投影,没有执行这次运行库演练。
|
||||
3. **业务补齐后联调**。需要真实支付回调、邮件/验证码、旧订阅URL/客户端、节点对接与计费、权限,以及共享宿主DPL/HN不受影响的验收。沿既有访问审批/服务器侧路线,不以本地主题页面通过替代。
|
||||
4. **切换单独批准**。正式迁移前安排源站冻结窗口:FUC注册/下单/充值/自动续订及在途回调、节点最终流量上报按明确水位排空;最终一致性快照+增量核对,原数据库备份及明确代码版本保留。研究快照不能在以后直接覆盖线上。
|
||||
5. **回滚保留增量**。若新站已产生付款/消耗,先保存新站交易和流量账本、按业务主键对账后再回切;不能恢复旧快照后丢弃切换后的订单、余额和流量。不要让两个系统同时扣费或消费同一预购权益。
|
||||
|
||||
本轮没有用户迁移、账号改密/创建、支付、节点切换、DB迁移、推送或部署;没有为恢复主题而改XB核心。已完成服务器侧只读采集及本地离线研究,未做线上页面验收。
|
||||
|
||||
## 产物与检查
|
||||
|
||||
`codex/output/fuc-migration-20261103/`内:`summary.json`、`deeper-summary.json`、`contract-results.json`、`projection-results.json`为聚合证据;`private/`内快照、私有异常ID和字段投影不提交Git、不在报告输出值。`probe.php`/`snapshot.php`/`clock.php`/`access.php`为本次受限只读采集;`analyze.py`/`deeper.py`/`project.py`/`validate-contracts.php`为离线研究,**没有写入目标数据库的导入器**。原始快照尾标/行数/gzip/SHA、文件权限与Git排除、真实哈希格式、合成密码兼容、XB严格邮箱校验、资金和流量投影守恒均已核对。
|
||||
+114
-24
@@ -1,6 +1,89 @@
|
||||
# Fuc:新版 FUC 用户主题适配
|
||||
|
||||
当前版本 **0.6.1**。2026-10-30重新对照小龙最新FUC源码,已同步新Logo、认证页独立云图标、侧栏对齐和深浅字标,修正原适配中的CSS加载顺序、跨页面样式污染、页脚与首页滚动导航/轮播差异。管理员后台与XB核心未改。2026-10-30完成本地合成数据复查和主题包;2026-10-31随XB统一功能提交1ded402推送、发布为可选主题,DPL/HN仍保持Stellar/EZ。FUC业务后端/数据不在本批范围,部署与恢复见[共用后端](UNIFIED_BACKEND.md)。
|
||||
当前用户主题更新为 **0.12.0**:接入独立VIP模块,沿用原版会员卡片,显示累计、等级和升级差额;42项Node测试、原素材字节及原右侧IAB显示验收通过。VIP插件仅FUC两个本地测试实例开启,其他默认关闭;原生接口、并发、金额和恢复唯一见[VIP模块](FUC_VIP.md)。仅本地,无提交推送或上线;下文0.11.0为此前四季验收记录。
|
||||
|
||||
当前本地版本 **0.11.0**,四季配色及此前真实XB接口对接的验收范围见下文;本轮尚未提交、推送或生产部署。0.6.1已于2026-10-31随XB统一功能提交1ded402发布为可选主题,DPL/HN仍保持Stellar/EZ。0.7.0主题适配只修改Fuc独立主题及专属验收工具,未要求XB核心兼容改造;之后用户单独批准的找回密码会话安全修复见下文,管理员不变。FUC业务后端/数据不在范围,部署与恢复见[共用后端](UNIFIED_BACKEND.md)。
|
||||
|
||||
FUC现行业务用户迁移是独立事项,2026-11-03仅完成只读采集及离线研究,未导入XB。预购/自动续订等风险与后续关卡见[用户迁移研究](FUC_MIGRATION_STUDY.md)。
|
||||
|
||||
## 0.11.0 按原绿色重做四季与火箭联动(2026-11-03)
|
||||
|
||||
用户明确否定0.10.0的灰暗配色,要求参考原绿色的明度/饱和度,并将原绿色直接作为春;另指出商店小火箭应随配色变化。本轮已替代旧四季:紫色保留,春·原版绿色、夏·晴空蓝、秋·杏叶橙、冬·冰川蓝,共五个选项。旧`cyan`偏好自动解析为春,旧春樱粉也转为原绿色,无重复绿色选项。
|
||||
|
||||
- 春季用户亮色直接加载原`style-cyan.css`,不叠加自定义季节颜色。夏/秋/冬也以该文件为底,分别将每个颜色转色相30°/222°/65°,保留原色各自的饱和度、明度、透明度、悬停与渐变层次;移除0.10.0的灰暗主色及染色页面/暗色背景。`seasonal-css.py`只生成配色与滤镜声明,不改变几何或动画。
|
||||
- 原绿色火箭滤镜为290°,四季分别为290°/320°/152°/355°;保留原图与原动画,只用原版同类CSS滤镜,不修改图片。暗色也覆盖原版强制紫色/无滤镜的规则,侧栏、按钮和火箭保持对应季节。
|
||||
- 恢复原`core/app.js`的菜单/顶栏明暗类归一逻辑:原模板同时含menu-light/menu-dark,亮色只保留menu-light、暗色只保留menu-dark。修复先前原紫色菜单覆盖绿色、普通菜单浅字难读的问题,系统亮暗切换也同步处理。FUC原文件未改。
|
||||
- 41项Node契约/DOM/交互测试、19份原CSS/26份模板/Pace/UI库完整性、运行语法与ZIP源码/CRC/ESM闭包通过。右侧现有IAB实际保存切换四季×亮暗8种桌面组合,火箭滤镜、按钮RGB和菜单渐变均符合各自原绿色色阶;四季390px切换均无横向溢出。侧栏、顶栏、套餐卡布局尺寸保持,火箭仍有原版运动。另回归冬季首页和登录页配色;最终保留春季亮色预览。没有重新进行业务API、支付或邮件联调。
|
||||
|
||||
证据:`codex/output/fuc-theme/seasons-refresh-tests.tap`及`season-refresh/`内browser.json、mobile.json、8份桌面/4份手机截图、seasons-overview.jpg、package.json。0.10.0主题ZIP与`before-season-refresh-20261103/`保留用于本轮回退。本轮仅Fuc主题、专属工具与文档,没有新增XB核心、管理员或API修改;未提交/推送/生产部署。
|
||||
|
||||
## 原版内置配色核查(2026-11-03)
|
||||
|
||||
用户询问原版是否隐藏其他主题色。只读核对新版FUC当前HEAD `fea0d886f77a19a7b174836262917f7a735b2a5f` 的活动用户header、样式目录和设置保存控制器:完整配色仅`style-purple.css`和`style-cyan.css`,选项也仅紫/绿。`style-cyan_back.css`是旧绿色备份,与当前绿色只差Logo滤镜及空白,不是第三套配色;`dark-layout.css`为统一暗色覆盖。`color.css`只定义绿/紫基础变量,Bootstrap通用状态色不是额外整站主题。原`themeDark`虽然保存且选项为purple,但活动header没有按它选择独立暗色CSS。XB的四季配色为本次新增,不是原版隐藏主题。本次未修改FUC或XB运行代码,也未访问线上。证据:`codex/output/fuc-theme/original-palette-audit-20261103.json`。
|
||||
|
||||
## 0.10.0 春夏秋冬配色(本地)
|
||||
|
||||
历史方案:配色已由0.11.0按用户反馈替代,以下仅保留当时实现与验收记录。
|
||||
|
||||
按用户要求,在原紫色、绿色之外增加春·樱花粉、夏·湖水蓝、秋·枫叶橙、冬·霜雪蓝。四套均支持原有亮色、暗色与跟随系统模式,主题偏好只保存于当前浏览器。桌面从齿轮进入面板设置,手机从头像菜单进入面板设置,选择“配色主题”并保存,沿用原提示及1000ms后刷新。
|
||||
|
||||
- `assets/palettes.mjs`维护六套白名单和四季颜色变量;`scripts/theme-fuc/seasonal-css.py`从原紫色CSS提取颜色声明,再追加`seasonal-surfaces.css`中的亮暗表面规则,生成`assets/native/seasonal.css`。原紫/绿CSS、FUC源文件及原动画时长未改,新增规则只在四季配色时启用。
|
||||
- 覆盖首页、认证页、侧栏/顶栏、按钮、卡片、表单、页签、弹窗、表格、Pace与流量图。保留危险、警告等语义颜色;公开首页Logo保持白色可读,用户区Logo随四季调色。
|
||||
- 修复面板选项经HTML序列化后丢失当前选中项的问题;配色、亮暗模式和菜单状态在刷新后正确回读。旧的空置暗色配色下拉替换为四季说明,原亮/暗/系统模式入口保留。
|
||||
- 本轮仅Fuc独立主题与专属工具,无XB核心、管理员或API修改,没有提交、推送、上线或切换DPL/HN。此前独立批准的核心安全修复不属于本轮配色。
|
||||
|
||||
验收:39项Node契约/DOM/交互测试通过;原19份CSS、26份惰性模板、Pace及UI库完整性通过。仅使用当前聊天右侧IAB,四季×亮暗共8种桌面组合实际保存/刷新,其侧栏、顶栏、首张套餐卡几何与原绿色基线完全相同;四季390px手机切换均无横向溢出。另核验冬季首页、登录页、流量图/图例,春季刷新回读、暗色侧栏与原绿色回切;追加四季浅色字标均为rgb(94,88,115),避免缓存中的暗色字标颜色污染。色彩对比度测试覆盖白色主按钮文字及暗色链接;未将本轮配色检查写成外部支付/邮件等业务复验。
|
||||
|
||||
证据:`codex/output/fuc-theme/seasons-tests.tap`、`seasons-browser.json`、`seasons-mobile.json`、`season-*.jpg`、`seasons-settings.jpg`、`seasons-overview.jpg`及`package-seasons.json`。保留0.9.0包和`before-seasons-20261102/`主题文件备份,回退仅恢复Fuc主题,不还原其他工作区文件或后端。
|
||||
|
||||
## 0.9.0 再次复核与可安装交付(2026-11-02)
|
||||
|
||||
本轮目标是让Fuc作为正常XB主题使用,不要求用户先选择或切换某个生产实例。所有业务仍调用安装该主题的XB同源API,沿用目标XB已有的支付、邮件、验证码和节点配置;本轮没有新增XB核心适配或管理员修改,也没有提交、推送、部署或切换DPL/HN主题。
|
||||
|
||||
- 新版FUC当前参考HEAD为`fea0d886f77a19a7b174836262917f7a735b2a5f`,前端无未提交改动。相对前次参考,套餐和自动续订提示新增续订报价说明;已重新导出当前原模板。XB无FUC自动续订报价,相关可选include保持惰性,不伪造数据。
|
||||
- 登录/注册恢复原`auth.js`的等待文案、成功后OK确认弹窗及确认后进入用户中心;错误保留原组件。订阅重置恢复原二次确认的图标、文字、确定/取消按钮。工单、回复、提醒等成功提示按原1000ms、返利按1500ms后刷新当前数据,旧页面请求不再覆盖新页面。
|
||||
- 修复FAQ关闭时`aria-expanded`被误置为true、箭头无法复位的问题,保留原Bootstrap对同组问题的联动;实际右侧IAB已观测展开`collapse show`/true和收起`collapse`/false。
|
||||
- 加入真实动画时长的切页复现,发现并修复Bootstrap弹窗过渡尚未结束就销毁组件后的`focus`空引用。离页先完成原组件待执行的过渡回调并解绑下一弹窗回调,再清理遮罩与滚动锁;旧页面提示一并关闭。
|
||||
- 今日流量接入XB已有`user/stat/getTrafficLog`,使用StatUserJob已计倍率的u/d,避免再次乘倍率;圆环拆分剩余、历史、今日。接口不可用仍显示未知。无订阅时恢复原空流量/不可订阅状态,签到按钮不再错误显示已签到。
|
||||
- Trojan复制入口使用XB现有`flag=general&types=trojan`,其他复制/导入使用已存在的协议flags;保留订阅地址已有参数,不新增后端路由。社群入口取XB的`telegram_discuss_link`,不继承FUC频道;首页导航反映当前登录态。商店显示XB实际返利比例和套餐重置规则,不保留FUC专属注册流量奖励/提现门槛的虚假占位承诺,原横幅DOM与样式保留。账户等级没有XB对应字段,显示未知,避免把长套餐名称挤入Level窄列。
|
||||
- 当前套餐新增手动续费/重置流量的周期入口,套餐由XB按当前用户权限返回;修复已有用户续费被新购库存或停售标记误挡的问题。仍以后端下单校验为准,不开放隐藏管理员套餐或绕过续费权限。
|
||||
|
||||
本轮验收:**36项Node契约/DOM/交互与异步切页测试通过;18组真实XB HTTP回归通过;此前独立批准的密码重置修复5项/21断言复验通过**。19份原CSS、Pace和原UI库字节核对、26份惰性模板完整性、运行语法、ZIP CRC、包与源码逐文件匹配及ESM引用闭包通过。密码重置单元测试须按下文业务约束的完整隔离命令运行;缺少`APP_ENV=testing`时迁移保护会阻止初始化,不能将该错误当成业务回归失败。
|
||||
|
||||
IAB本轮对照了9个桌面用户页面的原版布局和组件参数,侧栏宽260px、顶栏位置/字体/过渡一致;短内容与长内容引起是否出现6px滚动条,页面宽度会相应变化,不作为CSS漂移。右侧原生标签实测15个390px用户/详情/订单路由,无页面级横向溢出、损坏图片或未替换占位符。登录成功确认、订阅重置确认内容与原版一致;隔离站实际创建12元待付订单、取消并刷新回读已取消,无真实付款和待付遗留。手动续费入口实际选择月付并进入正确套餐确认页,未重复开通。组件测试另覆盖停售已购套餐续费及旧优惠码回包不误打开新页面弹窗。
|
||||
|
||||
证据在`codex/output/fuc-theme/`:`readiness-tests.tap`、`readiness-integration.txt`、`readiness-auth-tests.txt`、`readiness-desktop-geometry.json`、`readiness-mobile.json`、`readiness-login-success.jpg`、`readiness-reset-confirm.jpg`、`readiness-order-canceled.jpg`及`package-readiness.json`。主题包可安装与本地同源业务验收已完成;真实支付/验证码服务、邮件投递及客户端联网仍未做外部联调,不能称为这些外部链路已验收,亦不声称所有业务数据和状态已逐帧、逐像素证明一致。此前用户确认的文档/订单布局补偿、XB必要字段和缺失FUC后端能力边界继续有效。
|
||||
|
||||
## 0.8.0 动态与交互对照
|
||||
|
||||
用户再次要求动态效果与原版一致,并明确由AI自行查找、只复用当前右侧内置浏览器标签。本轮仅修改Fuc主题与专属工具,没有新增XB核心或管理员修改;上一节记录的找回密码核心修复是此前独立批准事项。
|
||||
|
||||
- 对照仍为新版`fuc-new.loc`,HEAD `4eff00023420175662792769d1d2ee1c16d9bb68`,前端路径无未提交变化。复用现有IAB的XB和FUC标签,没有新建浏览器或标签。
|
||||
- 从FUC原文件按明确边界提取未改动的jQuery 3.4.1、Popper、Bootstrap 4.3.1、PerfectScrollbar、Hammer、Waves;原SweetAlert2、SmoothScroll和首页Bootstrap 5.0.0-beta1一起本地化。首页Bootstrap5保留自己的data API,不覆盖用户区Bootstrap4插件;XB主题没有执行FUC业务脚本或重复加载Pace,接口仍仅接入XB。`vendor-interactions.py`可重建,`verify-native.py`逐字核对源文件,原许可证说明保留。
|
||||
- 原弹窗进出/遮罩/滚动锁、页签淡出淡入、FAQ高度折叠、按钮波纹、下拉菜单、工具提示、返回顶部1000ms和首页500速率平滑滚动改用原组件。侧栏复原hover类带来的文字位移、折叠后的悬停展开/移出收回、切换图标、500ms状态过渡、200ms图表重排、原Hammer阈值250px的侧栏滑动收回及手机遮罩;用户已批准保留的旧页面布局补偿现在随侧栏260/80px以原300ms过渡。
|
||||
- 商店层级改为每个XB套餐一个原版分组页签,周期价格呈现为该组内月/季/年等原卡片。套餐/周期组合使用独立DOM标识,实际建单仍提交原XB plan_id与period。重置流量卡只在当前套餐允许时出现。
|
||||
- 购买恢复原版优惠码弹窗→订单确认弹窗,保留真实XB优惠检查和建单。自动续订等XB缺失能力继续禁用;支付仍进入XB订单流程,不伪造FUC的财务/排队续订后端。原独立purchase路由保留兼容入口。
|
||||
- 去掉切页时先清空样式和重建空白用户壳的中间态。公共样式保留,新样式准备完成后与完整内容一次切换;页面滚动在切换完成后复位,点击当前菜单同样加载并恢复默认页签。窗口未跨布局断点时保留当前菜单状态。ApexCharts恢复原版默认动画,移除先显示自制圆环的占位跳变;离页销毁图表。深浅切换恢复原版刷新,面板保存采用原版提示后1000ms刷新。ES模块、原模板/样式索引、桥接样式及UI库增加版本缓存标识。
|
||||
|
||||
验收:22项接口契约、DOM和原组件生命周期测试通过;19份原CSS、26份惰性HTML、Pace及新提取库原文完整性通过。在现有IAB实际观测FAQ的`collapsing`、页签退出`fade active`、手机首页导航`navbar-collapse collapsing`,确认侧栏hover expanded/移出收回、手机遮罩d-block/d-none,以及原Hammer阈值的拖动使侧栏回到menu-hide。原弹窗完成真实XB零元建单和开通;新套餐分组后再次确认套餐/周期正确持久化,测试产生的最后一笔待付零元单已通过隔离OrderService取消。深浅切换刷新后body类均正确。HTTP本地域名采用原ClipboardJS的execCommand兼容路径,内置浏览器原生点击后已读取确认本地订阅链接,测试剪贴板随后清空。所有操作限独立验收站;没有生产付款、上线或管理员变更。
|
||||
|
||||
证据:`motion-audit.json`、`motion-tests.tap`、`motion-order-modal.jpg`、`motion-plans.jpg`,均在`codex/output/fuc-theme/`。原版本地提前续订按钮本次点击未弹出提示,因此购买过程按原`couponForm/buyForm`源码、模板和组件原文核对;不将未观测到的原站购买流程记为逐帧对比通过。此验收覆盖列出的组件和状态,不把不同业务数据、必要字段或缺失后端能力描述为全站所有状态像素相同。
|
||||
|
||||
## 0.7.0 真实 XB 对接与验收
|
||||
|
||||
- 认证使用真实同源API;支持邮箱验证码、邀请注册、邮件快速登录、密码找回、登录设备撤销和XB的过期会话403。登录页移除XB不支持的令牌输入,保留必要字段。无效邮件登录链接显示错误后允许正常密码登录。
|
||||
- 对接Turnstile、reCAPTCHA v2/v3;按本站公开配置加载官方SDK,不降低或跳过后端验证。SDK契约用测试替身验证,未执行真实验证码服务联调。
|
||||
- 订单、周期、优惠码、余额抵扣、取消和状态回读使用XB结果。支付type=0显示本地生成的二维码,type=1支持URL或经重建的支付表单,type=-1只有data=true作为结算成功;持续回读订单状态。HTML响应不执行脚本。StripeCredit使用Stripe托管输入组件及token接口;真实支付插件/回调、Stripe外部支付均未验收。
|
||||
- 钱包使用XB余额和礼品卡检查/兑换/记录;佣金转入、配置允许的提现方式、财务工单按XB流程。账户页接入真实会话、提醒和Telegram绑定指令(仅配置启用时),不伪造原FUC不具备的能力。新增Markdown文档及表格清洗渲染,保留正文安全链接;修复工单详情路由和页面切换后旧请求覆盖当前操作对象的问题。
|
||||
- `http://xb.loc`已由用户执行安装器并验证HTTP200,右侧Codex IAB可登录。它连接`instances/fuc-acceptance/`内独立SQLite与真实Laravel内核,Node/PHP只监听回环8594/8595。独立环境从迁移初始化,不复制DPL/HN或FUC数据;HTTP外部调用受阻,邮件/其他任务使用测试替身,订单开通任务真实执行。
|
||||
- **18组真实HTTP/API回归通过**:认证与拒绝错误密码、主题入口/敏感文件404、订单创建/取消/零元开通、订阅重置、Clash Meta/Sing-box输出、优惠金额及订单所有权、礼品卡一次性兑换、邀请/佣金、工单闭环、提现工单、提醒、文档等列表、改密、邮箱验证码重置、撤销会话403。邮件只验证本地验证码契约,没有外发。
|
||||
- **16项静态契约/DOM测试通过**:认证失效、支付返回分支、危险表单过滤、Markdown链接/表格、安全清洗、套餐数量/周期/零价、必填认证字段,以及验证码和Stripe SDK替身。19份CSS、26份惰性HTML和原Pace脚本/CSS完整性通过;PHP和运行模块语法通过。
|
||||
- **右侧IAB真实页面验收**:测试账号登录、工单创建/详情/回复/关闭、提醒保存回读、文档详情与FAQ展开、零元订单创建/结算/已完成回读;首页、注册、找回表单已检查。11个用户菜单页面390px基础检查无横向溢出、损坏图片、未替换字段或加载错误;桌面关键页面已操作并截图。此结果不表示全站所有数据状态逐像素一致。
|
||||
- 证据:`codex/output/fuc-theme/integration-20261101.json`、`real-browser-20261101.json`、`real-order-20261101.jpg`、`real-dashboard-20261101.jpg`。
|
||||
|
||||
尚未完成:目标站真实邮件收件、验证码服务、支付渠道付款/回调和客户端联网联调,生产发布/切换。本地隔离验收不替代这些项目。此前发现的XB找回密码不撤销旧登录会话问题,用户已于2026-11-01明确批准本地修复并测试:密码保存和撤销全部登录令牌现在同事务完成;5项单元测试/21断言及增强的18组HTTP回归通过,未提交、推送或上线。唯一行为、批准及回退记录见[业务约束](BUSINESS_RULES.md#找回密码撤销登录会话2026-11-01本地已批准修复)。这项独立安全修复不是主题适配所需,主题ZIP不含后端修复。
|
||||
|
||||
公共能力核对:沿用XB的DomainHub地址配置、现有ATOM/TeleHub后端能力;Fuc不新增后台、凭据、汇报任务或常驻调度。
|
||||
|
||||
用户本轮明确确认两个例外:**文档/订单旧模板保留可用布局补偿;XB认证、提现等保留必要字段和流程,采用FUC样式**。不以这两类差异扩展为XB核心改造授权,也不把全站描述为所有状态逐像素一致。
|
||||
|
||||
@@ -32,7 +115,7 @@ XB 工作区为 `/Users/hellcat/Documents/GemCodes/xb`,实现为独立主题 `
|
||||
|
||||
## 页面覆盖
|
||||
|
||||
以下路由均有本地页面验收。模板路径相对于新版 FUC 的 `resources/views/tabler/`。
|
||||
以下路由历史合成验收与本轮真实验收范围分别见上文。模板路径相对于新版 FUC 的 `resources/views/tabler/`。
|
||||
|
||||
| XB 路由/区域 | FUC 原模板 | XB 行为 |
|
||||
| --- | --- | --- |
|
||||
@@ -41,12 +124,12 @@ XB 工作区为 `/Users/hellcat/Documents/GemCodes/xb`,实现为独立主题 `
|
||||
| register | auth/register.tpl | 邮箱验证码、注册、邀请码、密码确认 |
|
||||
| forget / reset | password/reset.tpl、token.tpl | 发邮箱验证码后设置新密码 |
|
||||
| dashboard | user/index.tpl | 账户、公告、订阅、教程、ApexCharts流量图 |
|
||||
| plans | user/product.tpl | 原商店横幅、周期页签、套餐卡、库存、购买 |
|
||||
| plans | user/product.tpl | 原商店横幅、套餐分组页签、周期卡、库存、购买 |
|
||||
| myplan | user/plan.tpl、plan/ajax_planLog.tpl | 当前订阅、购买记录、订单详情入口 |
|
||||
| orders | user/order/index.tpl | XB完整订单集的本地20条分页 |
|
||||
| purchase | user/order/create.tpl | 套餐核对、优惠码、创建订单 |
|
||||
| checkout | user/order/view.tpl | 订单详情、付款方式、取消、状态回读 |
|
||||
| wallet | user/code.tpl、code/ajax_moneyLog.tpl | 余额、原充值布局、钱包记录页签 |
|
||||
| wallet | user/code.tpl、code/ajax_moneyLog.tpl | 余额、礼品卡兑换、兑换记录页签 |
|
||||
| invite | user/invite.tpl、invite/ajax_affMoneyLog.tpl | 生成/复制链接、佣金记录分页、原弹窗转入钱包/申请提现 |
|
||||
| profile | user/profile.tpl | 原彩色设置卡、个人资料、改密、重置订阅、提醒设置弹窗 |
|
||||
| tickets / ticket/:id | user/ticket.tpl、ticket/detail.tpl | 原弹窗创建、关闭、回复、关闭后禁止回复 |
|
||||
@@ -66,40 +149,47 @@ XB 工作区为 `/Users/hellcat/Documents/GemCodes/xb`,实现为独立主题 `
|
||||
|
||||
`assets/native.mjs` 负责原模板数据绑定及结构适配;`assets/app.mjs` 负责同源XB API、路由、提交、状态;bridge.css仅补交互、弹窗/焦点、只读输入外观及用户确认保留的Tabler容器补偿;此前长套餐名与钱包按钮额外排版覆盖已移除。原CSS仅做本地依赖路径转换。文本、真实数据、功能能力与源站不同,不声称真实FUC运行页面逐像素截图比对通过。
|
||||
|
||||
XB未提供的FUC功能保留原位置并有不可用说明:独立钱包充值/流水、自动续订、签到、昵称保存、TG绑定、原FUC二步验证、IP解封、账号删除和原登录/IP记录。累计付款、在线设备、今日用量及奖励流量等未知字段显示“—”;不使用FUC静态快照假数据。提醒设置采用XB到期/流量提醒,提现提交XB财务工单,不声称原USDT系统已接入。仅Trojan专用订阅入口提示使用通用订阅;其他格式按XB本地协议flags构造,未进行客户端真实联网验证。
|
||||
XB未提供的FUC功能保留原位置并有不可用说明:独立现金充值/通用钱包流水、自动续订、签到、昵称保存、原FUC二步验证、IP解封、账号删除和原登录/IP记录。累计付款、在线设备及奖励流量等未知字段显示“—”;今日用量由XB流量日志提供,日志加载失败时显示“—”;不使用FUC静态快照假数据。提醒设置采用XB到期/流量提醒,提现提交XB财务工单,不声称原USDT系统已接入。Trojan专用入口使用XB通用格式加types筛选;其他格式按XB本地协议flags构造,未进行客户端真实联网验证。
|
||||
|
||||
## 接口、安全与验证范围
|
||||
|
||||
只调用同源 `/api/v1/…`,auth_data原样放Authorization;默认sessionStorage,勾选记住设备才用localStorage,预览与正式缓存隔离。401清缓存回登录,HTTP200业务失败、非JSON、超时和加载错误均有提示。金额按分、套餐流量按GB、用量按字节;优惠码随创建订单提交,由后端校验;库存及最终应付以后端为准。订单与返利分页、工单全列表按当前XB控制器契约实现。
|
||||
只调用同源 `/api/v1/…`,auth_data原样放Authorization;默认sessionStorage,勾选记住设备才用localStorage,预览与正式缓存隔离。401及XB未登录/过期403清缓存回登录,HTTP200业务失败、非JSON、超时和加载错误均有提示。金额按分、套餐流量按GB、用量按字节;优惠码随创建订单提交,由后端校验;库存及最终应付以后端为准。订单与返利分页、工单全列表按当前XB控制器契约实现。
|
||||
|
||||
验证码组件仍未接入,启用captcha或登录配置读取失败时禁用认证提交;没有降低验证。支付保留type/data,支持标准URL跳转及余额/无跳转状态回读;嵌入HTML、扫码、Stripe等格式未完整适配,会提示使用原主题。未做真实付款、邮件发送、账号创建/改密、资金转入/提现或生产操作;本地流程全部是合成API。
|
||||
验证码、支付的当前实现与真实验收边界见0.7.0章节;不能将SDK替身或零元结算当成外部验证码、真实支付验收。
|
||||
|
||||
0.5历史本地验收:18个二级/认证路由分别在1280和390像素检查,无页面级横向溢出、缺失图片、未绑定占位符或内联处理器;9种空列表和503错误提示;套餐周期、FAQ展开、原弹窗工单创建/回复/关闭、订单创建/演示结算、密码修改/找回、佣金转入/演示提现、深浅主题设置已实际点击。当时原CSS17份/惰性HTML25份完整性与6项接口隔离测试通过。后端源码契约检查不能代替真实业务验收。
|
||||
|
||||
## 开发、复核与交付
|
||||
|
||||
当前日常入口是`http://xb.loc`,使用右侧Codex IAB。启动独立真实验收站:
|
||||
|
||||
```bash
|
||||
# 首次初始化;目录已存在时setup拒绝覆盖,不要重复seed
|
||||
php scripts/theme-fuc/integration-setup.php
|
||||
php scripts/theme-fuc/integration-seed.php
|
||||
node scripts/theme-fuc/integration-serve.mjs
|
||||
# 另一终端执行真实接口验收,仅访问xb.loc的隔离环境
|
||||
node scripts/theme-fuc/integration-test.mjs
|
||||
```
|
||||
|
||||
`instances/fuc-acceptance`是本地测试数据,不提交、不部署、不复用生产凭据。脚本内的example.test账号和密码是合成测试值。服务启动时确认8594/8595空闲,不接管HN的8592/8593;退出服务会停止自己启动的PHP。旧`dev.py`是合成API演示,不能与真实验收站同时占用8594,也不作为正式对接证据。固定域名安装器已由用户执行,后续不要重复改系统配置。
|
||||
|
||||
运行使用原生ES modules,无需build。复核命令:
|
||||
|
||||
```bash
|
||||
php scripts/theme-fuc/import-native.php
|
||||
python3 scripts/theme-fuc/vendor-native.py
|
||||
python3 scripts/theme-fuc/verify-native.py
|
||||
python3 scripts/theme-fuc/reference.py
|
||||
node --test scripts/theme-fuc/core.test.mjs
|
||||
python3 scripts/theme-fuc/dev.py
|
||||
# DOM测试依赖仅装入忽略的验收工具目录,不修改共享锁文件
|
||||
npm install --prefix codex/output/fuc-theme/test-tools --no-audit --no-fund --ignore-scripts [email protected]
|
||||
node --test scripts/theme-fuc/dom.test.mjs scripts/theme-fuc/motion.test.mjs scripts/theme-fuc/app.test.mjs scripts/theme-fuc/palettes.test.mjs
|
||||
python3 scripts/theme-fuc/seasonal-css.py
|
||||
python3 scripts/theme-fuc/verify-native.py
|
||||
python3 scripts/theme-fuc/package.py
|
||||
```
|
||||
|
||||
本轮临时诊断监听`127.0.0.1:8594`,`#/home`为首页、`#/demo`进入合成用户区。旧8592已被HN的PHP进程占用,本轮没有停止或替换它。演示不会连接真实数据库;`/?fixture=empty#/demo`、`/?fixture=error#/tickets`、`/?fixture=normal#/demo`仍可用于状态检查。
|
||||
原版素材重新导入只在确认参考源码更新后执行`import-native.php`、`vendor-native.py`与`reference.py`,不把导入当普通构建。`bundle-vendor.mjs`只重建Fuc自己的运行依赖,锁定现有esbuild/qrcode/marked/DOMPurify版本并输出版本、SHA256和许可证;不自动更新共享依赖。外部SDK依据[Turnstile官方文档](https://developers.cloudflare.com/turnstile/get-started/client-side-rendering/)、[reCAPTCHA文档](https://developers.google.com/recaptcha/docs/v3)、[Stripe token文档](https://docs.stripe.com/js/tokens/create_token?type=card)对接。
|
||||
|
||||
固定入口计划为`http://xb.loc`,**尚未配置/验收**:本机Nginx重载需要管理员权限,`sudo -n`返回需要密码。已准备可审阅脚本`install-preview-domain.py`,只新增xb.loc回环映射及反向代理到8594,先备份、配置检查失败回退,保留HN/DPL配置,不扩大监听;目前只做语法检查,未执行系统写入。用户在本机终端运行后还须回读HTTP:
|
||||
当前交付包`codex/output/fuc-theme/Fuc-0.11.0.zip`,643个运行文件,7601363字节,SHA256 `2eae7736bc6da9158b4ce2563aff049f2893a51a5b333ba25419b2dee0bf526f`。ZIP完整性、源码逐字匹配、ESM引用闭包及不含测试数据/私密配置/管理员文件检查通过。0.10.0、0.9.0及0.6.1包保留用于对照与回退。
|
||||
|
||||
```bash
|
||||
sudo /usr/local/bin/python3 /Users/hellcat/Documents/GemCodes/xb/scripts/theme-fuc/install-preview-domain.py
|
||||
```
|
||||
Fuc在XB中已是系统主题,不能声称通过后台“上传同名主题”升级成功。正式发布沿Git流程部署明确提交,只更新该主题并通过现有ThemeService发布资源;启用由目标实例配置决定,不自动切换DPL/HN。各ES模块引用已带0.11.0版本,避免升级后旧模块缓存混用。生产发布前保存目标主题版本和选择,回退只恢复Fuc主题及该实例主题选择,不恢复其他聊天或整库变更。
|
||||
|
||||
这项固定入口待管理员操作,不能将临时端口记录为已完成的日常域名。
|
||||
|
||||
运行使用原生ES modules,无需build。安装包 `codex/output/fuc-theme/Fuc-0.6.1.zip` 只含运行文件和本地静态依赖,不含导出脚本、编译缓存、预览数据、私有配置或管理员文件。完整性报告 `native-integrity.json`,逐页证据 `secondary-browser-audit.json`、`secondary-*.png`;截图/日志在codex/output,不提交Git。部署及切换需另行任务;本次未执行。
|
||||
|
||||
本次安装包核对:623个运行文件,ZIP 7438172字节,SHA256 `7f9dbc518e7aedad28709a9a1d2e5c3f7ff9f509efdda774efca71f373427998`。主题包不含参考页、合成数据、系统配置安装器或管理员文件。
|
||||
|
||||
本轮文档已同步GemDocs的dpl/fuc主题摘要;全库离线检查通过(19项目、584文档、5643链接、535对象),该检查不代表运行或业务验收。
|
||||
打包收尾发现并行任务新增可选Chatwoot配置与模块,予以保留;包收集Fuc运行模块并核对Blade入口和ESM引用,避免遗漏文件。本次没有验证该并行客服服务,空配置时不会加载外站SDK。GemDocs本轮摘要已同步,离线结构检查通过(19项目、591文档、6005链接、542对象及13个岗位/科室绑定),不替代业务验收。
|
||||
@@ -0,0 +1,54 @@
|
||||
# FUC-XB VIP 自动升级(本地完成)
|
||||
|
||||
2026-11-03。用户明确要求完成VIP自动升级、本地测试、其他子项目默认关闭、仅FUC-XB开启、先不动线上。本次在当前XB `master` 工作区新增独立插件及主题适配;没有修改订单/支付/钱包/返佣核心文件,没有提交、推送或部署。此前密码安全及客服等并行差异不属于本次VIP修改。
|
||||
|
||||
## 规则与实例开关
|
||||
|
||||
- 默认满100/200/360元为小福/中福/大福,减8/12/15%(9.2/8.8/8.5折),XB原生后台插件设置可调整。
|
||||
- 迁移期初为`max(0,旧total_pay-预购返还)`,不按旧账单回算;历史订单价格不变,钱包仍全额返还。源决定见[功能边界](FUC_XB_FEATURE_COMPARISON.md)。
|
||||
- 套餐开通成功后累计实际钱包支付+在线应付本金,排除手续费、券优惠和折抵;充值、佣金转余额、未付/取消、重置流量单不累计,一次性流量套餐累计。
|
||||
- 本单按下单时优惠,开通后升级用于下一单,不追补旧订单;券和折抵保持XB算法。
|
||||
- 保留人工折扣,实际优惠取人工与VIP较大值;关闭恢复人工折扣、保留VIP账本。
|
||||
|
||||
普通插件源`plugins/VipLoyalty/`,码`vip_loyalty`;不加入`plugins-core`自动安装列表。原生安装默认`is_enabled=false`,业务配置默认`enabled=false`,两项都开才生效,不随主题或域名自动开启。
|
||||
|
||||
仅在`fuc-migration-test`(私有迁移测试,无Web)和`fuc-acceptance`(`http://xb.loc`,合成数据)安装开启。DPL/HN未安装/开启,未读写它们的业务库。`scripts/vip-loyalty/local-setup.php`只接受这两个实例及本地标记;安装前SQLite备份在各自`storage/app/vip-before-install/`。真实迁移数据不挂到`xb.loc`。
|
||||
|
||||
## 独立数据及原生接入
|
||||
|
||||
插件安装目标库才创建`fuc_vip_accounts`(期初/累计/人工及生效折扣)与`fuc_vip_entries`(唯一键消费/冲回账本)。不改`v2_user`或`v2_order`结构,沿用原生`v2_user.discount`结算;不导旧订单进入原生折抵/返佣池。
|
||||
|
||||
`order.create.before`同步用户折扣;`order.open.before`在XB开通事务内累计,和套餐一起提交/回滚。锁顺序为订单→用户→VIP账户,`purchase:{order_id}`唯一键阻止重试重复累计;并发用户累计由用户行锁串行处理。原钩子及开通顺序不变。
|
||||
|
||||
后台继续使用XB插件编辑器。插件自己的服务提供者仅为本插件保存增加校验,其他插件调用原实现。门槛递增、优惠不倒退、金额最多两位小数、优惠0至100%;启用状态的损坏配置会明确阻止创建/开通,避免静默漏记,管理员修复后可重试。关闭状态不激活VIP。修改规则后下次访问VIP信息或下单重新计算。
|
||||
|
||||
## 接口与命令
|
||||
|
||||
- `GET /api/v1/user/vip`:原生用户认证;返回等级、实际优惠、累计、下一等级及差额。
|
||||
- `GET/POST /api/v2/{后台安全路径}/vip`:原生管理员认证,校验保存设置,匿名/普通用户拒绝。
|
||||
- `vip:import-opening FILE --reference=快照SHA256`:私有JSONL每行含整数`user_id`、`uuid`、非负整数`opening_cumulative_cents`。按UUID确认身份,同摘要/金额重复执行不变;禁止覆盖不同期初或在新消费后补期初;整批事务。不动钱包/套餐。
|
||||
- `vip:reverse-consumption ORDER_ID AMOUNT_CENTS REFERENCE`:只登记**实际退款完成后**的VIP消费冲回,不能超过该单尚未冲回本金;同凭证重复执行不再扣。它不退款、不动钱包。XB没有已完成订单退款的统一钩子,不伪造自动退款功能。
|
||||
|
||||
## 主题与本地验证
|
||||
|
||||
Fuc 0.12.0沿用原VIP卡片/等级名称,显示累计和升级差额;购买页显示优惠生效时序。关闭/未安装插件时回退。原19份CSS、26模板、Pace及依赖字节检查通过,未改原动画。
|
||||
|
||||
| 验证 | 结果 |
|
||||
| --- | --- |
|
||||
| VIP专项 | 18项/58断言:默认关闭、实付累计、下一单升级、重复开通、回滚、人工折扣/开关、期初/冲回幂等、配置及权限 |
|
||||
| 原生订单/礼品卡 | 无VIP安装的内存库4项/13断言 |
|
||||
| 主题 | 42项Node测试,含VIP原卡片与关闭回退 |
|
||||
| 迁移用户 | 11,542人期初接入;39项原生回归再次通过,临时交易全部回滚 |
|
||||
| 双进程 | 私有副本同时开同一单,仅1条消费、累计100元、8%优惠,不写迁移原库 |
|
||||
| 真HTTP内核 | 12项:期初100→原价300实付276→累计376→下一单255;重复支付不累计、取消返还/冲回及最终回滚 |
|
||||
| 浏览器 | 用户原右侧IAB标签显示等级/累计/差额通过;截图在忽略产物中。后台设置保存/权限用原生API验证,未切换浏览器账户验收后台页面 |
|
||||
|
||||
证据在忽略目录`codex/output/fuc-migration-20261103/`:`vip-unit-tests.log`、`vip-native-regression-tests.log`、`vip-theme-tests.log`、`vip-concurrency-results.json`、`vip-http-flow-results.json`、`rehearsal-verify-results.json`、`vip-dashboard.png`。私有源快照、身份、期初及副本维持700目录/600文件,不提交Git。
|
||||
|
||||
主题包`codex/output/fuc-theme/Fuc-0.12.0.zip`:643文件、7,600,972字节,SHA256 `120c0a358110042b22f992d2673fbfe8e67f1bd62c1930fef7b690cf31968011`,CRC/源码字节通过。包只含主题,VIP插件单独安装,不能只换主题就宣称VIP启用。
|
||||
|
||||
## 恢复与边界
|
||||
|
||||
关闭业务开关或禁用插件恢复人工优惠并保留累计。原生卸载会删除插件表,不能用卸载代替保留账本的关闭。安装前备份仅在本地且无后续新业务时适合整库恢复;已有新业务时先保留新账本、按变更恢复,不能直接覆盖。
|
||||
|
||||
保持有感迁移:重新登录并导入新站订阅,不新增旧URL兼容。营业套餐、真实支付/邮件/节点外部接入按用户要求后置。本轮无线上操作、真实付款或生产发布;本地VIP完成不代表整个新站已营业。
|
||||
@@ -0,0 +1,102 @@
|
||||
# FUC 与 FUC-XB 功能差异及沿用XB规则方案
|
||||
|
||||
2026-11-03;状态:**功能分析已完成;随后用户明确授权本地迁移测试,已完成独立库试导及37项XB检查,未修改共享核心或上线。** 实际试导、测试钱包入账及仍未实现的VIP/订阅范围见[本地迁移演练](FUC_MIGRATION_REHEARSAL.md);下文旧“未导入/未返还”记录指初始研究阶段。业务方向仍为尽量沿用XB原有逻辑,本地测试不授权生产操作。
|
||||
|
||||
来源:本地新版FUC当前源码及本轮生产快照;目标:当前XB共用后端与Fuc 0.11.0主题。下表比较代码能力,不把FUC存在功能入口当成生产全部已启用;生产配置只确认[迁移研究](FUC_MIGRATION_STUDY.md)列明的范围。
|
||||
|
||||
## 用户已明确的新边界(2026-11-03,本节覆盖下方旧建议)
|
||||
|
||||
后续执行:用户明确要求完成VIP自动升级、仅FUC本地开启、其他实例默认关闭、不动线上;已按范围完成独立插件及本地验证,当前实现唯一见[VIP模块](FUC_VIP.md)。下文“尚未实施”属于此前设计阶段,不代表当前VIP状态。
|
||||
|
||||
补充执行状态:用户明确要求剩余3个缺邮箱后缀账号统一加`@dove.com`;已完成私有映射、字段投影及本地测试库修正,严格格式/唯一性检查通过,邮箱待核查现为0人;源站不变。下文较早“3个异常邮箱待核查”记录由本决定替代。
|
||||
|
||||
1. **VIP新增范围**:本次指定的功能例外,共用XB提供VIP升级能力;按实例隔离,其他子项目默认关闭、FUC-XB开启,不随主题自动开启。默认满100/200/360元分别减8/12/15%,后台可调整。
|
||||
2. **累计原则**:购买套餐计消费,同一笔钱只计一次;充值、佣金转入本身不重复计。VIP之外沿用XB原交易规则,优惠券不改成FUC连乘算法。
|
||||
3. **VIP最新方案(期初已本地试算,自动升级未实施)**:用户已明确迁移前累计以旧`user.total_pay`字段为准,不根据账单重新计算或覆盖,955个差值只归档。预购返钱包后扣减累计、重算下一单折扣,新消费完成再累计;旧单价格不变、不补差。用户已明确“按0处理”,因此期初累计为`max(0, total_pay-本次预购返还)`,钱包仍全额入账。该规则已应用独立本地测试库的期初折扣及私有累计账本,全量回读和39项原生检查通过。示例400退300→累计100、下一单9.2折;再买原价300实付276→累计376、后续8.5折。永久保级/保留旧累计资金池草案废弃;此处业务边界已全部明确。
|
||||
4. **预购返钱包**:有效已付且未履约预购按完整已付款(原余额贡献+实际在线付款)转入新钱包,不按现售价或旧订单尾款核算;不再迁入自动激活队列。dove订单同样纳入,旧单只读归档、不作为新订单重放,不删除源账或重复返佣。
|
||||
5. **旧功能与历史**:不要原自动续订,不新增自动扣余额/锁价流程;旧账只读归档,新站显示新业务,旧单不参与XB折抵/返佣。原管理员新站邮箱由用户明确指定,已通过格式及重复检查,仅在私有身份映射/本地研究投影更新,不改旧站或运行库。
|
||||
6. **客户端与原权益(用户最新更正)**:改为有感迁移,用户在新站重新登录、获取并重新导入新订阅;不新增旧订阅URL兼容层,不再以无感接替为目标。已迁UUID/token不因这次决定自动轮换;钱包、返利、当前额度/u/d/到期保留。DPL/HN不合并,管理员后台保持XB。
|
||||
|
||||
最新范围:用户要求先列VIP累计与账单差值;新站套餐营业配置、真实支付/发信等接入后面再做,不作为当前执行任务。全量差值定义、数量及退款账号核对见[迁移研究的VIP全量核对](FUC_MIGRATION_STUDY.md#vip全量差值核对2026-11-03)。
|
||||
|
||||
其他业务边界已明确;VIP以本节最新讨论方案核对,不再沿用已被澄清的永久保级草案,也不据本次核对自动实施财务或核心变更。其他3个异常邮箱和额外28元旧状态记录先做技术核查,若确有身份资料或履约证据缺口,再就具体对象说明。原生收付款、退款金额及原VIP数据仍需按最终冻结快照逐单对账,不能把研究快照直接当成正式执行清单。
|
||||
|
||||
本次再次核对发现:3个有效pending退款账号中,1个旧total_pay小于拟返还完整金额,不能直接做total_pay减退款;需区分账单完整支付、旧VIP累计实际贡献和历史统计缺陷,先逐笔对账。返钱包金额仍以完整实付为准,VIP统计不得凭字段机械相减算负数。剩余3个异常邮箱在当前快照没有余额/返利及有效付费权益,保留身份/历史后核查,不猜真实收信地址。28元旧pending_activation虽已付,但快照不能证明未履约,因此不自动混入13笔退款。上述均为技术/数据核查,尚未修改任何运行数据。
|
||||
|
||||
参考快照:13笔有效pending完整已付额3,228.68元,其中原管理员11笔3,165.76元;另1笔pending_activation为28元,履约状态未定,不自动重复返还。规则摘要在忽略目录`codex/output/fuc-migration-20261103/confirmed-rules.json`,身份映射在私有目录。**尚未执行VIP核心开发、钱包返还、运行库导入、源站业务变更、节点切换或生产发布。**
|
||||
|
||||
## 功能对照
|
||||
|
||||
| 功能 | FUC实现 | 当前XB / FUC-XB实现 | 按用户方向建议 |
|
||||
| --- | --- | --- | --- |
|
||||
| 密码登录 | bcrypt,独立cookie/会话 | 同样可验证bcrypt,使用XB会话令牌 | 一次性搬哈希,用户重新登录;不复制会话/密钥,不重哈希旧哈希 |
|
||||
| 找回密码 | 邮件中的重置token链接 | 邮箱验证码重置 | 使用XB邮件/验证码流程,主题保留必要字段,不改认证核心 |
|
||||
| 二步验证 | GA/TOTP接口与字段 | 当前标准登录链无等价GA校验 | 当前快照启用0人;保留XB现状,不新增认证分支 |
|
||||
| 邮箱和管理员 | 旧账号可能不是规范邮箱,原管理员标记 | email:strict校验,XB独立管理权限 | 4个异常账号人工核对;管理员单独处理,不把旧权限自动批量赋予 |
|
||||
| 套餐数据结构 | 一个SKU对应固定时长与总流量,30/90/365天额度各自不同 | 一个plan有多个价格周期,plan流量额度固定 | 可用不同XB套餐记录表达不同额度;只配数据,不改plan/价格模型 |
|
||||
| 当前额度与到期 | 用户当前值独立于现售SKU | user也存额度、u/d、到期 | 逐用户保留旧值;126个不同于新SKU的账号不得重新开通覆盖。需要时用隐藏过渡套餐区分历史额度,不自动开放续售 |
|
||||
| 后续购买周期 | 按固定天数,含183/400天活动包 | 普通周期按日历月累加;一次性套餐不限时、用完止 | 旧到期时间原样迁;未来商品走XB月/季/年规则。183/400天作为历史权益处理,不新增自定义周期算法 |
|
||||
| 预购/提前续订 | 付款后排队,当前到期或耗尽才激活下一笔 | 付款完成即按新购/续费/换套餐开通,没有原FUC那种已付包队列 | 新订单采用XB;旧13笔另行逐笔确认处置,不批量激活、不直接累计时长/流量 |
|
||||
| 自动续订 | 用户开关、余额扣款、独立锁定续订报价 | 当前标准链无等价自动扣余额续订 | 不仿造自动扣款;切站前确认34人开关及相关承诺,说明未来转手动续费。尚未关闭任何人的原开关 |
|
||||
| 流量重置 | 当前有效新套餐总额,耗尽触发下一包;遗留auto_reset字段不能当成当前调度 | 可配月初、按月、从不重置、年初、按年等 | 历史总流量套餐可用XB原生“不重置”;未来按本站XB配置。不新增耗尽自动激活逻辑 |
|
||||
| 换套餐/折抵 | 不同SKU也可排队,按旧流程处理 | 区分新购/续费/升级,具备剩余折抵规则 | 新交易沿XB设置和算法;历史订单不直接塞入completed订单池,避免参与新折抵计算 |
|
||||
| 钱包/余额抵扣 | 元计价,充值/余额/网关混付独立账单 | 分计价,订单按XB流程抵扣余额 | Decimal一次性换单位、保持资产,不重放充值、开通或退款事件 |
|
||||
| 自选金额在线充值 | FUC有钱包充值购买流程 | 当前标准用户接口及Fuc主题未对接等价自选金额充值 | 采用XB直接买套餐、兑换码入账、佣金转钱包;不为复制充值页另造收款流程 |
|
||||
| 礼品卡 | 余额礼品卡及消费记录 | XB原生兑换码/礼品卡,可有多种奖励及限制 | 用XB自己的兑换/记录;旧已使用卡仅归档,未使用卡须单独核对,不能直接搬状态数字 |
|
||||
| 会员/VIP | 按累计消费升级,8/12/15%等级折扣 | 支持用户折扣字段,当前标准链无同等累计消费升等 | 原有94人的折扣与历史续订承诺先核对;若采用原生用户折扣,未来按XB算法,不补动态升等器 |
|
||||
| 会员+优惠码 | 折扣依次连乘 | 券与用户折扣按同一原价累计 | 未来沿XB规则并修正说明;不能宣称相同。例如100元、8%会员+10%券,FUC82.80元,XB82.00元 |
|
||||
| 返利/提现 | money_aff、旧返利账、旧申请流程与门槛 | commission_balance、原生转钱包、提现财务工单 | 保留金额和邀请关系;之后用XB审核/门槛/工单,不复制旧扣款与自动打款逻辑 |
|
||||
| 到期后的免费体验 | FUC具有降级/赠体验配置流程 | XB可配置新注册试用;没有同等到期自动降级流程 | 保留当前101个等级1账号的实际期限/流量,不能当新注册重新赠送;后续到期按XB原规则 |
|
||||
| 每日签到 | 可配置签到赠流量 | 当前标准XB无等价接口;Fuc签到已禁用 | 保持未开放,前台可说明/隐藏;不修改用户流量服务添加签到 |
|
||||
| 节点授权与计费 | node_class + node_group、旧面板接口 | XB权限组、节点API与计费链 | 映射权限组,保留UUID,使用XB节点对接;当前43个启用节点均VMess,但接口接替和联网未验收,不把搬用户当节点已迁 |
|
||||
| 订阅地址/格式 | /sub/token/subtype、旧api类型路由等 | 可配订阅路径,使用token及flag/types等协议选择 | 优先原生配置保留域名/主路径;旧后缀与客户端参数逐项对照。必要反代重写仅作为候选,不改订阅核心,也未部署 |
|
||||
| 历史订单/累计流量 | 旧订单、账单、钱包日志、transfer_total等 | XB独立订单/返佣/统计模型 | 旧账保留独立只读档案,当前u/d继续计费;不伪造新订单、返佣或把累计流量加回当前u/d |
|
||||
| 工单/公告/文档 | FUC独立表、路由和模板内容 | XB原生工单、公告、知识库;主题已接对应接口 | 新业务用XB;旧内容按需另做一次性转换/归档,本轮13表快照没有包含所有历史工单/正文 |
|
||||
| TG/通知/邮件 | 原站独立绑定/机器人/邮件配置 | XB原生绑定/通知/邮件流程 | 不复制旧机器人/全局密钥;本次联系值为空,不承诺旧会话/绑定无缝继承;真实投递需单独联调 |
|
||||
| 主题偏好 | 原版panel_option保存在用户资料 | 当前Fuc配色/亮暗/菜单偏好保存在浏览器 | 接受前端偏好范围;若需账号跨设备同步,另讨论,不加字段/API冒充无改动 |
|
||||
| 管理员后台 | FUC原后台 | XB自带后台 | 保持XB后台及权限体系,不复制FUC后台 |
|
||||
|
||||
## 再次确认:哪些可直接沿用XB
|
||||
|
||||
“可直接沿用”指复用当前XB原生业务,不代表FUC每个细节相同,也不代表所有外部链路已做生产验收。本轮进一步核对`app/Http/Routes/V1/UserRoute.php`、主题实际API调用及业务服务。
|
||||
|
||||
- **原生业务可直接使用**:正常邮箱账号登录/注册/找回与改密/登录设备;套餐查询、创建/支付/取消/查询订单、优惠码、余额抵扣、手动续费与换套餐/折抵;可配置流量重置;余额/佣金钱包、礼品卡、邀请返佣及提现财务工单;当前用量/到期显示;订阅查看/复制/导入和安全重置;节点列表、公告、知识库与FAQ、工单。以上采用XB自己的校验、计算和状态流程,保留其必要字段。FUC resetURL本身也同时更新UUID/节点密钥,XB resetSecurity同时更新UUID/token,不能误认为FUC仅改token。
|
||||
- **无需新增业务逻辑,但需一次性数据/配置和演练**:bcrypt、余额/返利元转分、邀请ID、当前额度/u/d/到期、UUID/token、各等级/权限组、旧套餐配置;固定用户折扣可按XB字段表达,但未来叠加/升等不等价。4个异常邮箱、126个历史额度与新SKU不同的账号单独处理。旧订阅完整URL/参数与43节点接替须配置、联调,不能只搬token就认定完成。
|
||||
- **当前XB无法原样承接的FUC规则**:已付预购排队及耗尽后自动激活、自动扣余额续订/锁价、FUC固定天数商品按原方式售卖续期、累计消费自动升VIP及原折扣连乘、自选金额在线充值、签到赠流量、GA二步验证、到期自动降级赠体验。旧订单/累计流量及账号跨设备主题偏好的原样展示也不是现有字段直接复制即可完成。这里只确认差异,未新增兼容逻辑。
|
||||
- **原生能力与真实验收分开**:支付渠道/回调、实际邮件与验证码、Telegram绑定、旧客户端订阅及节点联网/计费尚需专项联调;Telegram未列入本轮“完全确认可用”名单。当前用户路由只有getBotInfo,不能仅凭未挂路由的旧unbind方法认定解绑已接入或故障已触发。
|
||||
|
||||
## 此前推荐落地范围(VIP与预购处理以最新边界为准)
|
||||
|
||||
1. **数据与配置能做的**:迁移账号哈希、UUID/token、邀请关系、余额/返利及当前流量/到期;使用独立FUC-XB库和XB既有套餐/权限组/重置配置。导入只是后续候选方案,本轮没有编写运行库导入器或执行数据修改。
|
||||
2. **历史特殊权益先确认**:13笔预购中,同一个原管理员账号占11笔,另外2笔属于2个普通账号;11笔是否为测试单未知,不能自行排除。管理员测试单若获明确确认和处置授权可按批准范围处理;普通用户的已付权益需先定人工承接/补偿方案,不能擅自换余额或作废。另1笔旧pending_activation已付记录仍单列核查。
|
||||
3. **新交易统一采用XB原规则**:手动续费、日历月周期、本站重置设置、原生优惠叠加/折抵、返佣与提现工单。旧自动续订/固定天数活动/累计消费升等不在XB里复刻。切站前必须确认受影响权益和说明,不能默默取消原承诺。
|
||||
4. **保留无法等价承接的边界**:若必须原样自动执行FUC预购耗尽激活、自动扣余额及锁价,这不是单纯数据配置能解决的。在不改XB业务逻辑的要求下,应先暂缓切站或确定人工处置;不以外置脚本/插件自动扣款来规避用户“不动原有业务逻辑”的意图。
|
||||
5. **可以只在主题层修正文案**:本次发现Fuc套餐卡/确认弹窗仍用30/90/365天等固定展示值,而XB实际续期按日历月。后续应显示XB真实月/季/年周期,文案改动不改变计费算法。当前只列出问题,未修改主题。
|
||||
|
||||
## XB代码改动盘点与VIP后续范围(2026-11-03,只读核对)
|
||||
|
||||
**当前实际改动按任务区分:**
|
||||
|
||||
- FUC界面/动画/配色/API适配在独立`theme/Fuc/`及`scripts/theme-fuc/`,不是重写XB订单、支付或节点服务。
|
||||
- 本聊天此前单独获批的共享核心修复在`app/Services/Auth/LoginService.php`及其单元测试:找回密码成功时,同事务撤销该用户全部旧登录令牌。批准、测试、未上线及回退唯一记录在[业务约束](BUSINESS_RULES.md#找回密码撤销登录会话2026-11-01本地已批准修复)。主题ZIP不含后端修复。
|
||||
- 当前用户迁移/VIP研究阶段仅修改维护文档和忽略目录中的离线工具、私有身份投影;没有实现VIP、改业务配置或导入运行库。
|
||||
- 当前共享工作区还存在独立客服改动:`app/Http/Controllers/V2/Admin/CustomerServiceController.php`、`app/Services/CustomerService/Settings.php`、`app/Http/Routes/V2/AdminRoute.php`、`routes/web.php`及客服测试。代码用于客服设置、挂件注入与管理入口,不是本轮VIP或迁移引入。本轮只读识别,未修改/回退,不能以本轮说明代替其授权或验收。
|
||||
|
||||
**VIP后续最小范围建议,尚未实施:**
|
||||
|
||||
| 范围 | 内容 | 隔离要求 |
|
||||
| --- | --- | --- |
|
||||
| 独立VIP模块或插件 | 等级规则、有效累计、升级/重算、防重复计数 | 按实例开关,默认关闭;不以主题名自动启用 |
|
||||
| VIP数据存储 | 门槛/折扣配置、用户累计/等级及订单处理台账 | 独立数据和唯一业务键;具体表/字段在实现方案确定,不混入旧订单折抵/返佣池 |
|
||||
| XB现有接入点 | 核对已有`order.create.before`与`order.open.after`等插件扩展点,连接VIP折扣和完成消费累计 | 优先复用现有机制;仍需验证人工折扣、重试/并发、价格生效顺序及开关关闭行为,不提前承诺零核心文件改动 |
|
||||
| 后台配置 | VIP开关、等级门槛/折扣管理 | 延续XB后台样式与权限;其他实例原行为必须回归 |
|
||||
| Fuc主题展示 | 当前等级、有效累计、升级进度、实际折扣 | 只读VIP信息,价格以后端为准;先修正日历月文案 |
|
||||
| 一次性迁移工具 | 用户/权益映射、预购款入新钱包、VIP期初对账、旧账归档 | 不是新增运行时自动退款/续订流程;默认只读预演,执行另有清单与幂等核对 |
|
||||
|
||||
VIP属于用户本次明确要求的新增行为,开启后会影响对应用户等级/折扣;“可关闭”不等于没有业务改动。订单开通、支付金额、钱包扣款、优惠券叠加、折抵、返佣、流量周期及节点鉴权算法不为复刻FUC而重写。若核查现有扩展点确有缺口,再在具体方案中列出必要核心接入差异、影响与验证,不能把插件或外置脚本当作绕过核心边界的理由。当前只完成范围核对,未据此写入VIP核心代码或上线。
|
||||
|
||||
## 验证和事实边界
|
||||
|
||||
本轮核对了两边当前源码、真实私有快照、账单/成功网关记录与已完成离线守恒结果;没有调用注册、充值、支付、开通、返佣等运行API,没有修改业务配置,没有运行预购队列或自动续订任务,没有更改XB核心/主题运行代码,也没有重测/部署支付、节点或邮件链路。对比来源及证据可从[迁移研究](FUC_MIGRATION_STUDY.md)继续定位。
|
||||
|
||||
关键源码:FUC `src/Services/Cron.php`、`RenewalPricing.php`、`Payment.php`、`src/Models/VipMap.php`、`src/Controllers/PasswordController.php`、`UserController.php`、`src/Controllers/User/MoneyController.php`及`app/routes.php`;XB `app/Services/OrderService.php`、`PlanService.php`、`UserService.php`、`TrafficResetService.php`、`CouponService.php`、`app/Models/Plan.php`、`Order.php`、`Server.php`、`app/Http/Controllers/V1/User/TicketController.php`、`GiftCardController.php`、`app/Http/Requests/Passport/AuthLogin.php`及`routes/web.php`;Fuc展示层`theme/Fuc/assets/native.mjs`的days/pData及wallet/invite适配。
|
||||
@@ -0,0 +1,29 @@
|
||||
# HN 单节点 Hysteria2
|
||||
|
||||
当前协议分配与全节点验收以[UDP协议维护](UDP_PROTOCOLS.md)为准。以下保留本日早先单节点验证的历史范围,不代表全站当前协议。
|
||||
|
||||
## 当前状态(2026-11-03)
|
||||
|
||||
用户要求将HN一个节点改为Hysteria2 UDP。HN「🇭🇰 香港 HK - 01」(节点/机器1,物理vn01/VPS-034)已切换:面板type=hysteria、version=2,UDP24444;原中转haiwi.lshan.eu.org:47318、严格TLS/SNI vn01.gembox-dns.com、原证书路径、展示编号、组2和费率保持。客户端须更新HN订阅,缓存的该条旧AnyTLS配置不再适用。
|
||||
|
||||
HN本轮切换时,DPL同机节点22保留AnyTLS/TCP24443、中转47308;共享dpl-node主PID13203保持,原程序、配置、secret、unit和旧XrayR文件摘要保持。不更新XB核心、节点二进制、DNS、证书、续期或中转规则,不重启共享主进程。
|
||||
|
||||
## 操作与恢复边界
|
||||
|
||||
先在空闲UDP24444使用20秒自动退出、仅响应随机校验串的探针,经原47318实际往返成功;它不影响同端口TCP。现场中转规则6459、隧道143(17517-jp),为用户此前已调整的当前值;本任务只读取,不改隧道和规则。
|
||||
|
||||
初次模型热更新已生成UDP,但保留旧AnyTLS TCP监听,因此未判成功。回退保护因模型按协议规范化settings(删除alpn、补hop_interval)拒绝了原始未规范化CAS;原失败与调查证据保留,没有强行覆盖。只读确认准确after后,经原生enabled移除/发现重建该HN子实例:确认24444 TCP/UDP均清空且DPL仍在,再恢复原enabled与Hysteria2。最终仅UDP24444,DPL TCP24443保持;不能把跨协议热更新直接当成已清除旧监听。
|
||||
|
||||
私密回退快照:面板/root/codex-backups/hn/hy2-vn01-20261103/node-before.json;阶段意图同目录。回退必须核对本任务after与并行变动,按同样子实例停止→恢复该行原type/protocol_settings→恢复enabled流程,仅处理HN节点1;不重启共享unit、不恢复整库、不覆盖其他节点。现有临时change.php使用未规范化settings的回退判据不可直接重放,须用已读回模型规范化值作CAS。已执行的原生子实例阶段日志不覆写。
|
||||
|
||||
## 验收
|
||||
|
||||
- 原中转实际UDP往返,真实HN完整sing-box订阅与Clash YAML各23条参数/凭据/SNI/严格TLS核对:目标1条Hysteria2,其余22条AnyTLS。
|
||||
- 固定SHA的已有sing-box1.14.3在gateway01运行,保留真实订阅DNS/路由/ruleset,仅将诊断目的路由和selector限定到目标;经Hysteria2获得96.9.228.135/HK,双HTTPS出口一致、严格TLS通过,上传/下载流量入账和新鲜kernel/users指标通过。客户端测试进程退出。
|
||||
- 随机错误密码的独立客户端被明确认证拒绝;因真实订阅启动时下载规则集也经该出口,拒绝发生于客户端启动阶段。原失败和私密日志保留,不把通用启动失败当认证拒绝;另行只读核实明确authentication failed标志。
|
||||
- 两站各23条节点回读:只有HN节点1的type/protocol_settings变化;其余HN、全部DPL保存值保持。同机DPL经原中转的严格TLS通过,主PID和原保护文件不变。
|
||||
- 按正式验收器选择既有有效账号57(owned=false),没有创建QA;任务租约已关闭,既有账号不禁用、不轮换,不能声称其订阅403。日志与秘密仅保留私密任务目录,不提交Git。
|
||||
|
||||
证据唯一根:codex/output/hn-hy2-20261103/(Git忽略),server-acceptance.json及其阶段回执;原始失败不覆盖。已完成服务器侧验收,未做线上页面验收。没有来自用户故障国内网络的实测,因此不认定已解决“被墙”,也不把海外网关测通作为国内链路可用证明。
|
||||
|
||||
同日后续状态:用户另行要求DPL单节点改Hysteria2,DPL香港07/vn01已切为UDP24443,见[DPL单节点Hysteria2](DPL_HYSTERIA2.md)。本页前述“DPL保持”是HN切换当时的保护范围。两端UDP验证不代表中转内部承载已核实为UDP。
|
||||
@@ -26,6 +26,8 @@
|
||||
|
||||
## HN 邮件运行配置
|
||||
|
||||
HN六类普通邮件及来信自动回复已正式统一为独立HN样式,真实收件与启用/回退见[邮件主题](HN_MAIL_THEME.md);DPL模板与配置保持原样。
|
||||
|
||||
`/www/wwwroot/hardnerd.net/.env`、HN库的 `mail_flow` 设置;SMTP465 SSL与IMAP993 TLS均校验证书。旧Laravel读取 `MAIL_DRIVER`,已明确设smtp,不能只设MAIL_MAILER。发件名称hardnerd、地址及Reply-To均为自有邮箱,页脚主站hardnerd.net,空MAIL_LOGO_PATH避免沿用DPL图片。
|
||||
|
||||
验证码/登录链接/工单回复优先Resend,其他走企业SMTP;额度100/3000且使用官方用量与本地预占,规则沿 [BUSINESS_RULES](BUSINESS_RULES.md)。Resend密钥、IMAP密码与回调签名秘密在HN库加密;SMTP密码只在私有环境,未复制进普通后台可读设置。ACC-HN-MAIL与ACC-RESEND-HN私有字段按GemDocs读取,本文不存值。
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
# HN 邮件主题
|
||||
|
||||
## 当前状态
|
||||
|
||||
2026-11-01用户明确批准“补齐并正式启用HN”后,已在sitejp02 HN实例启用全部六类普通邮件及来信自动回复,统一HN Logo、深灰底与绿色样式。本地HN也已同步六类模板及Logo/自动回复视图,保持本地mailflow关闭,没有本地真实发信或收件任务。DPL的环境、配置缓存、数据库模板、邮件设置、支付与用户订单基线均未改。
|
||||
|
||||
功能提交 `2a82819ce8ddb46625ee5a9e2f811d32449a58e2`;初稿设计提交97da1ae。已提交推送master、codex/hn-mail-design、codex/xb-unified-20261031,生产共用/www/wwwroot/xb/current从8c1a01a Git快进,保留原并行Stellar模板。此前“仅预览、尚未启用”为历史阶段。
|
||||
|
||||
## 覆盖范围与实现
|
||||
|
||||
| 源文件 | 用途 | 业务变量/备注 |
|
||||
| --- | --- | --- |
|
||||
| `resources/mail/hn/verify.html` | 邮箱验证码 | code;注册/找回等共用验证入口 |
|
||||
| `resources/mail/hn/mailLogin.html` | 邮件登录 | link |
|
||||
| `resources/mail/hn/notify.html` | 站点通知、工单回复、群发、管理员测试 | content;各用途原邮件标题保留 |
|
||||
| `resources/mail/hn/remindExpire.html` | 订阅即将到期 | 24小时提醒语义保留 |
|
||||
| `resources/mail/hn/serviceExpired.html` | 套餐已到期 | 档位及资格限制保留 |
|
||||
| `resources/mail/hn/remindTraffic.html` | 流量提醒 | 80%提醒语义保留 |
|
||||
| `resources/views/mail/hn/autoReply.blade.php` | 真实来信自动回复 | 原回复正文、当前网站地址与访问按钮 |
|
||||
|
||||
六份普通HTML通过HN独立v2_mail_templates覆盖,subject有意置空,使用现有MailService回退以保留验证码、工单及群发等各自业务标题;对应mail_template缓存已逐名清理。不新增数据库结构或邮件API,不复制其他实例数据/密钥。
|
||||
|
||||
本次获批核心仅两处:AutoReplyService按配置选择视图;config/mailflow.php新增MAIL_AUTO_REPLY_VIEW,默认mail.default.notify。HN环境单独设mail.hn.autoReply,DPL未配置时继续原默认视图,包括旧配置缓存兼容回退。原自动回复开启状态、正文、主题、北京时间每发件人每日一次、按父记录去重、退信/自动邮件过滤、原收件游标及回信头均保持。
|
||||
|
||||
HN单独MAIL_LOGO_PATH指向resources/mail/hn/logo.png;PNG由现有public/brand/hn/logo.svg无修改渲染为128px,展示44px。CID `site-logo@dpl` 仅是既有传输内部兼容标识,实际图片和可见品牌为HN。主题深灰底#111518、内容卡#1E242A、绿色#B4F047,单列600px表格、内联样式与480px窄屏样式,无远程图片/字体、脚本或追踪像素。
|
||||
|
||||
## 测试与真实收件验收
|
||||
|
||||
邮件全套、共享实例及管理员套餐回归87项504断言通过;包括六类经MailService实际渲染、业务标题保留、文字转义、PNG附件、HN自动回复选择、DPL默认兼容及防循环/按日去重。自动回复正文新增动态站点地址后,两项相关选择/转义回归再次通过。
|
||||
|
||||
用户指定的当前Proton账号已由页面账号标识核对,具体私人收件地址仅保留私有回执,不复制到普通Git。真实验收:
|
||||
|
||||
- 初稿通知:HN MailMessage7,SMTP submitted,Proton已收到并打开。
|
||||
- 初稿验证码:第一次测试键含点号导致Resend HTTP422(8,failed、无provider_id);仅修正测试键后9经Resend submitted并收到。服务商字段限制见[官方规范](https://github.com/resend/resend-openapi/blob/main/resend.yaml)。旧失败记录保留,不重发通知,不改核心。
|
||||
- 正式启用后,邮件登录12、即将到期13、已到期14、流量提醒15,均经MailService选择db:对应模板,原测试标题保留、SMTP submitted;四封均在Proton收到并打开,标题、Logo、正文与按钮显示核对通过。测试不创建真实验证码或登录凭证,不变更真实用户套餐。
|
||||
- 用户批准的一封Proton来信,已在已发送确认,HN IMAP INBOX UID4/UIDVALIDITY1793103379正常入库16;AutoReplyService生成17,原Horizon经SMTP提交一次并在Proton收到、打开,HN Logo、新样式及动态https://hardnerd.net地址显示通过。日去重仍为1,无重复回信。
|
||||
|
||||
最初按完整主题查询未匹配该来信,不能据此认定漏收;随后用IMAP唯一键确认原信和回复均已正常处理。中间一次既有带锁轮询返回0;未重新发送来信、回退游标、重扫历史、改反垃圾规则或手动补造入站记录。
|
||||
|
||||
本轮实际收件覆盖六类模板及独立自动回复。工单/群发复用notify,并通过六模板真实渲染回归核对,不为验收创建客户工单或给真实客户群发。Proton桌面显示已验收,不扩大为所有客户端/手机或真实用户订阅到期触发验收。本机仅访问用户指定第三方邮箱,未访问HN/DPL项目线上页面。
|
||||
|
||||
## 发布、备份与运行
|
||||
|
||||
私有备份:sitejp02 `/root/codex-backups/hn-mail-theme/20261101-full/`,目录700、私密副本600;保存两实例原环境/配置缓存、HN原模板、变更源文件、版本、Git差异、启用与实发回执。初稿试发回执另存 `/root/codex-backups/hn-mail-design/20261101-v1/`。本地HN备份在忽略目录codex/output/hn-mail-design-20261101/local-private-backup/,不提交Git。
|
||||
|
||||
仅HN配置缓存按hn身份重建;定点刷新相关OPcache,不做全局重启。HN Horizon正常终止后,现有systemd Restart=on-failure不会自动拉起成功退出的进程;已显式start并核对HN/DPL Horizon及php8.4-fpm均active,未修改Restart策略。后续优雅重载必须按实际Restart策略核对并显式启动,不能只执行horizon:terminate就声称已恢复。
|
||||
|
||||
## 回退
|
||||
|
||||
仅恢复HN六个指定模板名的原记录,不能整表覆盖随后新增配置;逐名清理mail_template缓存。仅将HN MAIL_AUTO_REPLY_VIEW、MAIL_LOGO_PATH恢复为发布前值/缺省状态,重建仅HN配置缓存并按上述策略重载HN队列。保留所有已发送/入站/投递记录与IMAP游标,不删除事件或重发历史邮件。DPL配置与模板不参与回退;需要代码回退时只回退本任务相关改动,保留并行提交与Stellar本地差异。原MAIL_DRIVER、SMTP/IMAP、Resend及邮件档位均未变。
|
||||
@@ -1,5 +1,10 @@
|
||||
# HN / DPL 共享落地:单进程、不同端口
|
||||
|
||||
2026-11-03全节点UDP分配:HN、DPL各5条TUIC v5、18条Hysteria2;执行、分账和当前验收以[UDP协议维护](UDP_PROTOCOLS.md)为准,下文早先协议例外属于历史。
|
||||
|
||||
2026-11-03协议例外:同一物理vn01的HN香港01与DPL香港07均已改Hysteria2/UDP,两条旧AnyTLS缓存均须更新。当前验收与恢复见[HN](HN_HYSTERIA2.md)、[DPL](DPL_HYSTERIA2.md);中转内部承载仍未核实。
|
||||
|
||||
|
||||
2026-10-31 当前两站节点SNI及续期以[统一SNI维护](NODE_SNI_DOMAINS.md)为准;下述2026-10-28批次保持其历史接入证据范围。
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
# HN / DPL 节点 SNI 域名
|
||||
|
||||
2026-11-03全节点UDP分配:HN、DPL各5条TUIC v5、18条Hysteria2;执行、分账和当前验收以[UDP协议维护](UDP_PROTOCOLS.md)为准,下文早先协议例外属于历史。
|
||||
|
||||
2026-11-03协议例外:同一物理vn01的HN香港01与DPL香港07均已改Hysteria2/UDP,两条旧AnyTLS缓存均须更新。当前验收与恢复见[HN](HN_HYSTERIA2.md)、[DPL](DPL_HYSTERIA2.md);中转内部承载仍未核实。
|
||||
|
||||
|
||||
2026-10-30用户指定:两站同一落地共用`<物理部署key>.gembox-dns.com`,例如`node-jp02 → jp02.gembox-dns.com`。物理key与面板ID、展示编号分别维护;vn01仍用vn01前缀,不按其香港展示改名。该规则用于节点TLS证书名称/SNI,不是HTTP订阅入口,也不替换既有中转host/端口。节点排序不属于本次变更。
|
||||
|
||||
## 当前任务状态
|
||||
|
||||
@@ -105,3 +105,37 @@ FUC只读聚合验证:生产当前启用epay,最近30日非管理员EPay WeC
|
||||
19:47:35 +08:00原HN支付宝单已过期,严格拒绝恢复。用户随后明确追加授权仅一笔HN支付宝32元待支付测试单、不付款并在成功后恢复HN支付宝。19:51:29生产原EPay插件和已修复EpayProbe实际运行:网关仅POST一次,随后q.fenjingwl.cn GET HTTP200,fresh_cashier_qr、32元/支付URI/二维码严格验证通过,未误跟到授权登录页。随后只恢复HN支付宝,核对通道身份/配置与有效监测归属,在事务清除归属、保留原slot与每日预算;微信仍关闭。没有新增应用用户/订单、扫码或付款,商户平台有这一笔待支付记录。证据ali-fresh-claim/probe、私有请求/响应与ali-recovery.json均在本批备份目录。HN恢复通知使用稳定事件键经既有TeleHub调用方发送,初次回执queued,随后仅查询该回执确认sent;未重复投递。DPL开关/状态未人工修改,下一自然检测2026-11-01 00:00可用新检测结果自行恢复。微信故障仍未修通,需继续核对商户实际子通道路由;已有同单404证据可交支付平台,尚未对外发送。
|
||||
|
||||
本批共59项隔离测试258断言通过;已完成服务器侧发布验收,未做线上页面验收,未扫码、付款或验证到账。二维码漏判、告警文案与HN支付宝收银验收/恢复已完成;微信收银仍未修通,不把代码发布或收银通过写为实际付款/到账成功。
|
||||
|
||||
## 2026-11-01 FUC与HN微信对照:两处检测误判已定位
|
||||
|
||||
诊断已完成;用户在解释两项具体修复后明确“弄”,批准本轮核心实现、测试及HN/DPL发布。发布前复核生产HEAD为f825c30038723c0c7d5ea0aadc0ce9286f3edc7e;当时HN/DPL支付宝1、微信2均关闭且具有有效监测归属,最近自动结果为12:00 cashier_not_found,每实例当日预算6。保留生产并行Stellar修改和所有自动账本,不以昨日支付宝恢复记录代替当前状态。
|
||||
|
||||
FUC生产只读数据及支付商后台已确认今日普通用户微信成功记录(50元/15元),其中15元单已支付且通知成功。FUC成功单与XB未付微信探测均为channel8/subchannel0/version0;当前随机HMAC比较确认网关、商户号、密钥、MD5一致。不能将差异归因为不同商户、管理员捷径或submit.php/mapi.php本身。
|
||||
|
||||
用户明确批准最多3笔HN微信待支付对照单、不付款。15:57:56至15:58:00已执行全部3笔:32元原32位格式、32元8位短格式、16元8位短格式,各仅一次mapi请求取得支付商成功返回,随后旧检测传输的收银POST均404,响应为相同通用404页面。因此格式或金额不是这次404的充分解释。三笔已用完授权;没有新增FUC/DPL应用订单或修改商户配置,没有扫码或付款;应用用户/订单计数、通道和自动状态保持。私有完整请求/响应保存在sitejp02的/root/codex-backups/xb-payment-health/manual-20261101-format-matrix-1/,不得复跑矩阵创建新单。
|
||||
|
||||
对上述同一批现有订单进行浏览器收银检查,16元短格式与32元长格式都显示正确金额和微信二维码。捕获浏览器实际POST与服务器原POST逐字段及编码字节比较均相同,目标IP亦相同。继续在同一生产HN服务器、同一32元订单、HTTP/1.1和原XB-PaymentHealth/1.0 User-Agent下控制变量:原请求404;仅添加Accept: text/html后200,出现32.00、二维码渲染器及支付链接;最后验证时间16:14:42 +08。未创建新订单。这定位HttpsTransport缺少HTML Accept头,不推断服务商故意拦截或某种WAF策略。
|
||||
|
||||
另一独立误判:QrEvidence只接受原生wxpay/weixin URI,实际收银页二维码内容为HTTPS wxmpurl.cn链接。对实际渲染的230px二维码截图使用ZXing离线解码,确认QR Code/valid=true、HTTPS、精确主机wxmpurl.cn;当前检测器仍返回false。二维码未展示、扫码或打开实际付款URI,此证据仅证明收银二维码可用,未完成资金支付或到账验收。脱敏解码结果位于codex/output/payment-format-diagnosis-20261101/browser-qr-decode-redacted.json。
|
||||
|
||||
本轮最小核心修复:HttpsTransport添加Accept: text/html;QrEvidence仅在微信分支识别精确HTTPS wxmpurl.cn支付链接,同时保持金额、二维码渲染/定位图案和现有TLS/公网DNS/SSRF校验,不泛化接受任意HTTPS链接、不请求二维码URL。回归覆盖请求头、真实页面形状的合成夹具、恶意相似主机、错误金额、无二维码、旧订单回调及人工停用归属。提交/推送/Git部署到HN/DPL和监测归属恢复已获本轮批准;支付宝须另有有效收银证据,不能用微信证明恢复。
|
||||
|
||||
旧Oct31订单被服务商改回调域名而提示“支付参数有变化”,该证据被排除出本轮控制变量结论。Windows经登记FUC反代仅做只读首页HTTP200,不声称FUC浏览器购买流程验收;服务商验证码由用户完成,VNC/RDP管理员会话发生切换后停止桌面输入。此次本机只访问第三方支付收银台,未访问本机禁访的项目线上入口;测试收银台已关闭以停止状态轮询。
|
||||
|
||||
### 本轮批准与实现验收
|
||||
|
||||
批准范围仅HttpsTransport的HTML Accept、QrEvidence的精确HTTPS wxmpurl.cn识别及相关测试/文档/Git发布。实际实现解析完整URL,拒绝子域、后缀相似主机、用户信息、显式端口、片段及嵌入其他URL的伪装;维持原User-Agent,不改变支付插件、签名、回调、数据库结构或每6小时调度。检测不访问二维码链接。
|
||||
|
||||
支付/EPay/回调隔离测试36项180断言通过,涵盖人工停用、监测归属及既有有效回调。发布前合入生产f825c30038723c0c7d5ea0aadc0ce9286f3edc7e,保留已发布付款汇报。共享主题/管理员套餐/注册及付款汇报隔离回归52项196断言通过;与支付回归共88项376断言。共享vendor的工作树测试引导已在忽略目录明确APP_BASE_PATH及App/Tests类路径,未改业务代码或依赖。未实际付款。
|
||||
|
||||
### 2026-11-01 16:39 两实例发布与微信恢复
|
||||
|
||||
功能提交296e063e3cb3235e4cdec2e13fd5081785a5da35已通过白色机原子推送master、codex/payment-health、codex/xb-unified-20261031,并将sitejp02共用/www/wwwroot/xb/current从f825c30038723c0c7d5ea0aadc0ce9286f3edc7e Git快进到该提交。中继原远端三分支停留18913a1,首次增量缺生产基线而拒绝导入;核对origin确为/tom/dpl.git后,改传从已知18913a1开始的24KB完整增量链,验证祖先后正常快进推送;无强推、打包覆盖或回退并行付款汇报。
|
||||
|
||||
私有备份/root/codex-backups/xb-payment-health/20261101-html-wxqr-fix/包含发布前明确提交、回退说明、两实例环境和状态、变更源文件、发布与既有单验收回执;目录700、敏感副本600。PHP语法与两实例运行元数据检查通过,FPM/Horizon三服务active;定点OPcache检查均未缓存两类文件,无全局重启。生产原theme/Stellar/dashboard.blade.php并行改动哈希保持。
|
||||
|
||||
16:38:52仅POST原HN矩阵long_32同一笔下游签名表单,未再次mapi下单:api.shangri-la.vc返回HTTP200、金额32元、业务错误检测为false、修复后QrEvidence=true。私有响应与existing-order-verification.json保留,应用用户/订单、通道与自动状态在验收请求前后均不变。
|
||||
|
||||
16:39:14按批准仅恢复HN/DPL微信2:两站url/pid/key/type在内存精确一致,分别锁定状态、核对有效Ownership及通道revision/updated_at后事务开启,清除监测归属;DPL复用同商户的HN既有单证据,没有DPL新单或独立付款验收。保留人工停用保护、每站当日预算6及原slot;支付宝1仍关闭且监测归属保留,等待自然18:00独立收银检测,不能把微信证据当支付宝验证。
|
||||
|
||||
两站各生成一条恢复通知,使用既有TeleHub专用调用方、notification/base和新稳定事件键,初始回执queued;随后只GET查询各自原回执,HN/DPL两条均确认sent,未重复发送历史通知。完整实际支付、微信客户端扫码和到账未验收;本轮修复不涉及前台交互,已完成服务器侧收银验收,未做项目线上页面验收。回退时先关自动控制,再将本轮两类检测实现恢复到发布前明确版本;保留实例配置、已恢复的开关、监测账本和所有并行功能,不能整库或无范围reset。
|
||||
@@ -1,5 +1,7 @@
|
||||
# dpl:AI 维护入口
|
||||
|
||||
2026-11-03全节点UDP分配:HN、DPL各5条TUIC v5、18条Hysteria2;执行、分账和当前验收以[UDP协议维护](UDP_PROTOCOLS.md)为准,下文早先协议例外属于历史。
|
||||
|
||||
核对日期:2026-10-11。文档随代码版本维护;运行状态必须现场复核,不能把历史验收当成当前状态。
|
||||
|
||||
## XB与衍生项目工作规则
|
||||
@@ -37,6 +39,8 @@
|
||||
| STATUS.md | 最近验证基线、已知限制与待验收项目 |
|
||||
| CLOUD_FLARE_AUDIT.md | 两机场 Cloudflare 审查、已部署调优、域名轮换与回退及可选未实施项 |
|
||||
| NODE_SNI_DOMAINS.md | HN/DPL节点统一物理key.gembox-dns.com、兼容证书、逐台切换与恢复 |
|
||||
| DPL_HYSTERIA2.md | DPL香港07/vn01单节点Hysteria2 UDP、HN回归、中转承载验证边界与恢复 |
|
||||
| HN_HYSTERIA2.md | HN香港01/vn01单节点Hysteria2 UDP、共享进程保护、真实订阅及恢复 |
|
||||
| HN_SHARED_NODES.md | HN/DPL共享落地:逐台单进程不同端口接入、分别记账验收、证据及恢复 |
|
||||
| NODE_ONBOARDING.md | 五节点链路、命名规则、共享资源与验收 |
|
||||
| NODE_RUNBOOK.md | initialize/append参数、脚本入口、前检/证书/验收与面板回退;隔离测试/运维版本与现场边界,含验证清单 |
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
# HN / DPL UDP 协议分配与维护
|
||||
|
||||
## 当前结果(2026-11-03)
|
||||
|
||||
按用户要求,两站各自每个现有国家/地区保留一条TUIC v5,其余使用Hysteria2。当前每站23条:5条TUIC、18条Hysteria2,两站共46条;23台落地继续各运行一个现有dpl-node进程,以两站不同端口及独立用户身份分别计费。国家集合与节点数来自本批冻结盘点,并非未来固定配额;新增/删除国家或节点须重新盘点,不能硬编码23或5。
|
||||
|
||||
两站同一国家的TUIC使用同一物理落地;展示编号分别沿两站原编号,不能把物理服务器编号当展示编号:
|
||||
|
||||
| 国家/地区 | 物理资源 | HN 展示名 | DPL 展示名 |
|
||||
| --- | --- | --- | --- |
|
||||
| HK | hk01 | 🇭🇰 香港 HK - 05 | 🇭🇰 香港 HK - 04 |
|
||||
| JP | jp02 | 🇯🇵 日本 JP - 01 | 🇯🇵 日本 JP - 01 |
|
||||
| RU | ru01 | 🇷🇺 俄罗斯 RU - 01 | 🇷🇺 俄罗斯 RU - 01 |
|
||||
| SG | sg02 | 🇸🇬 新加坡 SG - 01 | 🇸🇬 新加坡 SG - 01 |
|
||||
| US | us01 | 🇺🇸 美国 US - 01 | 🇺🇸 美国 US - 01 |
|
||||
|
||||
其他现有节点均为Hysteria2;物理vn01两站此前已完成Hysteria2,本批只复验,没有重启。客户端应更新各自订阅,旧AnyTLS缓存不再适用;TUIC要求支持v5的客户端,不能拿v4 token参数代替UUID/password。
|
||||
|
||||
## 实施与恢复边界
|
||||
|
||||
本批经登记白色机SSH逐台执行,不打开线上网站:先保存两站原始模型行、实际服务和保护文件摘要,核对所有入口UDP。22台需变更的落地各执行一次现有共享unit优雅stop→保持两站节点enabled=true直至旧进程最终上报完成→两站事务保存规范化协议→启动同一unit。仅这一台两站连接短暂中断;通过两站真实联网才处理下一台。记录本任务拥有的旧/新PID和时间,不把已更换PID冒充原PID保持。未改XB核心、二进制、unit、secret/config、原服务配置、DNS或证书。
|
||||
|
||||
TUIC设置version5、BBR、ALPN h3、UDP native;Hysteria设置version2并保持严格TLS。地址/中转端口/落地端口、SNI、文件证书、展示名/sort、machine绑定、group、倍率、show/enabled均与冻结原值一致。全部有效TUIC用户UUID在开工前验证。跨协议直接热更新曾残留旧TCP监听,故不能只看面板保存成功。
|
||||
|
||||
前检发现HN物理hk03的既有入口端口缺少任何中转规则,按原目标补建唯一规则7297;中转配置总数68→69,逐id配置回读证明原规则均保持,两站实际UDP往返复测通过。没有将这项缺失归因于封锁或任何操作者。精确目标与原始配置仅留私密资源/任务证据。
|
||||
|
||||
恢复只处理任务拥有且当前after精确匹配的一台:优雅停该台现有unit,按两站备份模型规范化CAS恢复原type/protocol_settings,再启动同一unit并验证原传输监听;不回整库、不回滚流量、不覆盖其他字段或并行改动。未知stop/start或事务结果先读实际服务与意图,不盲目重复写。若原服务PID/监听发生非本任务变化,应调查配置/程序/故障原因,不据PID独自归因。
|
||||
|
||||
## 验收与证据
|
||||
|
||||
两站全部46条均通过真实完整sing-box订阅、Clash YAML参数检查和实际联网:严格TLS、预期IPv4与国家、双HTTPS出口一致。每个阶段以当时真实混合协议集合核对;已通过的节点在最终依赖未变时绑定原始实测时间,不反复整轮重测。实际客户端保留订阅DNS/路由/ruleset,仅诊断目的路由与selector限定目标、cache改为任务独立路径。已有固定SHA sing-box1.14.3在gateway01消费,未临时在节点安装客户端。
|
||||
|
||||
hk01使用两站独立100MiB/1h测试用户顺序制造流量,两站上传/下载分别增长,对侧测试账户计数保持;交叉使用另一站UUID/password均有明确认证拒绝。该严格隔离计费验证覆盖同一台两站TUIC,不冒充逐台独立计费证明;其他节点以真实有效授权、两站联网及本节点上传/下载/新鲜kernel-users上报覆盖。客户端负测原始curl35/UNPROVEN保留;拒绝结论使用两向各2条服务端unknown user/authentication、精确foreign UUID摘要、拥有的PID/时间窗和唯一出站/中转端口映射绑定,未重复负测。测试用户最终禁用、有效节点用户集排除、订阅实测源站空text/plain 403且排除缓存/挑战;原验收器借用的既有账号只关闭任务租约,账号保持。
|
||||
|
||||
时间判据:last_push_at绑定那次真实流量已经上报;当前健康新鲜性使用last_check_at和metrics.updated_at。空闲节点不一定持续刷新last_push_at,不能因此误判或重跑联网。原错误判据失败记录保留,未刷新原实测时间。
|
||||
|
||||
所有23台最终仅UDP24443/24444由对应共享主进程持有,不残留旧AnyTLS TCP。保护文件摘要、SSH与旧443监听/进程与基线保持;未修改原XrayR。独立助手审查冻结计划、UDP资源冲突、客户端合同和最终证据。
|
||||
|
||||
私密证据唯一根codex/output/protocol-batch-20261103/(Git忽略);线上原始行、service journal与回退根/root/codex-backups/protocol-batch-20261103。以plan.json、各host-complete/network、final-structure-runtime-audit.json、billing-complete.json、traffic-final.json、cleanup-complete.json及独立审查为准。原失败不覆盖;脚本为本批受控协议迁移,未宣称正式AnyTLS新节点适配器已支持TUIC/Hysteria2无人值守接入。
|
||||
|
||||
已完成服务器侧验收,未做线上页面验收。海外网关测通不证明用户国内到入口的UDP可达;端点UDP也不证明中转内部隧道底层为UDP,不能宣称已解决封锁或限速。
|
||||
+3
-1
@@ -1,2 +1,4 @@
|
||||
*
|
||||
!.gitignore
|
||||
!.gitignore
|
||||
!VipLoyalty/
|
||||
!VipLoyalty/**
|
||||
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
namespace Plugin\VipLoyalty\Commands;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Plugin\VipLoyalty\Service;
|
||||
final class ImportOpening extends Command {
|
||||
protected $signature='vip:import-opening {file : Private JSONL opening file} {--reference= : Snapshot SHA256}';
|
||||
protected $description='导入已核定VIP期初,不导入旧订单、不改变钱包或套餐';
|
||||
public function handle(Service $service): int {
|
||||
$file=$this->argument('file');$reference=(string)$this->option('reference');
|
||||
if(!is_file($file)||!is_readable($file)||!preg_match('/^[a-f0-9]{64}$/D',$reference)){$this->error('期初文件或快照摘要无效');return self::FAILURE;}
|
||||
$count=0;
|
||||
DB::transaction(function()use($file,$reference,$service,&$count){
|
||||
$f=fopen($file,'r');$seen=[];
|
||||
try {while(($line=fgets($f))!==false){
|
||||
$v=json_decode($line,true,512,JSON_THROW_ON_ERROR);
|
||||
if(!isset($v['user_id'],$v['uuid'],$v['opening_cumulative_cents']) || !is_int($v['user_id']) || !is_int($v['opening_cumulative_cents']) || isset($seen[$v['user_id']]))throw new \RuntimeException('期初字段或用户唯一性检查失败');
|
||||
$seen[$v['user_id']]=true;$service->opening($v['user_id'],$v['uuid'],$v['opening_cumulative_cents'],$reference);++$count;
|
||||
}}finally{fclose($f);}
|
||||
});
|
||||
$this->info('已核对VIP期初 '.$count.' 人;钱包、套餐和历史订单未改变。');return self::SUCCESS;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
namespace Plugin\VipLoyalty\Commands;
|
||||
use Illuminate\Console\Command;
|
||||
use Plugin\VipLoyalty\Service;
|
||||
final class ReverseConsumption extends Command {
|
||||
protected $signature='vip:reverse-consumption {order_id} {amount_cents} {reference}';
|
||||
protected $description='仅登记已完成退款的VIP消费冲回,不执行退款、不动钱包';
|
||||
public function handle(Service $service): int {
|
||||
if(!ctype_digit($this->argument('order_id')) || !ctype_digit($this->argument('amount_cents'))) {$this->error('订单及金额须为正整数');return self::FAILURE;}
|
||||
$service->reverse((int)$this->argument('order_id'),(int)$this->argument('amount_cents'),$this->argument('reference'));
|
||||
$this->info('VIP消费已核对冲回;未执行付款或钱包退款。');return self::SUCCESS;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
namespace Plugin\VipLoyalty\Controllers;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Plugin;
|
||||
use App\Services\Plugin\PluginConfigService;
|
||||
use Illuminate\Http\Request;
|
||||
use Plugin\VipLoyalty\{Service,Settings};
|
||||
final class VipController extends Controller {
|
||||
public function show(Request $request,Service $service) {return $this->success($service->summary($request->user()->id));}
|
||||
public function settings(Settings $settings) {return $this->success($settings->values());}
|
||||
public function save(Request $request,Settings $settings,Service $service) {
|
||||
$current=json_decode(Plugin::where('code','vip_loyalty')->value('config')??'{}',true)?:[];
|
||||
$values=$settings->validate(array_replace($current,$request->only(array_keys(Settings::DEFAULTS))));
|
||||
app(PluginConfigService::class)->updateConfig('vip_loyalty',$values);
|
||||
if(!$values['enabled'])$service->suspend();
|
||||
return $this->success($settings->values());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
namespace Plugin\VipLoyalty;
|
||||
use App\Services\Plugin\AbstractPlugin;
|
||||
use Illuminate\Support\Facades\{Log,Schema};
|
||||
use Illuminate\Validation\ValidationException;
|
||||
final class Plugin extends AbstractPlugin {
|
||||
public function boot(): void {
|
||||
if(!Schema::hasTable('fuc_vip_accounts'))return;
|
||||
$service=app(Service::class);
|
||||
try {$enabled=$service->enabled();}
|
||||
catch(ValidationException $e) {
|
||||
// An enabled but corrupt policy must not silently lose paid consumption.
|
||||
// Hooks below reject new creation/opening until an administrator repairs it.
|
||||
Log::warning('vip_loyalty_invalid_configuration');$enabled=true;
|
||||
}
|
||||
if(!$enabled){$service->suspend();return;}
|
||||
$this->listen('order.create.before',static function($payload)use($service){$service->sync($payload[0]->id);});
|
||||
$this->listen('order.open.before',[$service,'openingOrder']);
|
||||
$this->listen('admin.user.update.after',[$service,'manualChanged']);
|
||||
}
|
||||
public function cleanup(): void {
|
||||
if(Schema::hasTable('fuc_vip_accounts'))app(Service::class)->suspend();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
namespace Plugin\VipLoyalty\Providers;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use App\Services\Plugin\PluginConfigService;
|
||||
use Plugin\VipLoyalty\ValidatedConfigService;
|
||||
final class PluginServiceProvider extends ServiceProvider {
|
||||
public function register(): void {
|
||||
$this->app->bind(PluginConfigService::class,ValidatedConfigService::class);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
# VIP 自动升级
|
||||
|
||||
默认关闭,安装后还需明确开启插件及“开启 VIP 自动升级”。只影响当前实例。
|
||||
|
||||
默认满100/200/360元,分别享9.2/8.8/8.5折;可修改门槛和优惠。套餐实际付款在开通成功后累计,升级用于下一单。充值、佣金转余额、取消和流量重置不计。原生人工优惠保留,关闭VIP恢复人工优惠、保留累计。
|
||||
|
||||
用户中心显示原版会员名称、累计和升级差额。保存配置验证门槛/优惠有效,不改变XB支付、钱包、折抵或返佣算法。
|
||||
|
||||
迁移期初导入、消费冲回、实例隔离、本地验证和恢复见仓库维护文档 `docs/maintenance/FUC_VIP.md`。冲回命令只登记已实际退款后的VIP消费扣减,不执行钱包退款。
|
||||
@@ -0,0 +1,114 @@
|
||||
<?php
|
||||
namespace Plugin\VipLoyalty;
|
||||
use App\Models\{User,Order,Plan};
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Validation\ValidationException;
|
||||
final class Service {
|
||||
public function __construct(private Settings $settings) {}
|
||||
public function enabled(): bool { return $this->settings->values()['enabled']; }
|
||||
private function account(User $user): object {
|
||||
DB::table('fuc_vip_accounts')->insertOrIgnore(['user_id'=>$user->id,'opening_cents'=>0,'cumulative_cents'=>0,'manual_discount'=>$user->discount,
|
||||
'created_at'=>time(),'updated_at'=>time()]);
|
||||
return DB::table('fuc_vip_accounts')->where('user_id',$user->id)->lockForUpdate()->first();
|
||||
}
|
||||
private function apply(User $user,object $account): object {
|
||||
$manual=$account->manual_discount;
|
||||
// Respect a native admin discount edit since our last write.
|
||||
if($account->applied_discount!==null && (int)$user->discount!==(int)$account->applied_discount)$manual=$user->discount;
|
||||
$vip=0;foreach($this->settings->levels() as $tier)if($account->cumulative_cents >= $tier['threshold_cents'])$vip=$tier['discount'];
|
||||
$effective=max((int)$manual,$vip);
|
||||
$user->discount=$effective;$user->save();
|
||||
DB::table('fuc_vip_accounts')->where('user_id',$user->id)->update(['manual_discount'=>$manual,'applied_discount'=>$effective,'updated_at'=>time()]);
|
||||
$account->manual_discount=$manual;$account->applied_discount=$effective;
|
||||
return $account;
|
||||
}
|
||||
public function sync(int $userId): ?object {
|
||||
if(!$this->enabled())return null;
|
||||
return DB::transaction(function()use($userId){
|
||||
$user=User::whereKey($userId)->lockForUpdate()->firstOrFail();
|
||||
return $this->apply($user,$this->account($user));
|
||||
});
|
||||
}
|
||||
public function opening(int $userId,string $uuid,int $cents,string $reference): void {
|
||||
if(!$this->enabled())throw new \RuntimeException('VIP未在当前实例启用');
|
||||
if($cents<0 || !preg_match('/^[a-f0-9]{64}$/D',$reference))throw new \InvalidArgumentException('Invalid opening');
|
||||
DB::transaction(function()use($userId,$uuid,$cents,$reference){
|
||||
$user=User::whereKey($userId)->lockForUpdate()->firstOrFail();
|
||||
if(!hash_equals($user->uuid,$uuid))throw new \RuntimeException('迁移用户UUID不一致');
|
||||
$account=$this->account($user);
|
||||
if($account->opening_reference!==null) {
|
||||
if($account->opening_reference!==$reference || (int)$account->opening_cents!==$cents)throw new \RuntimeException('期初已存在且不同,禁止覆盖');
|
||||
return;
|
||||
}
|
||||
if(DB::table('fuc_vip_entries')->where('user_id',$userId)->where('kind','!=','opening')->exists())throw new \RuntimeException('用户已有新消费,禁止补写期初');
|
||||
DB::table('fuc_vip_entries')->insert(['user_id'=>$userId,'entry_key'=>'opening:'.$userId,'kind'=>'opening','amount_cents'=>$cents,'created_at'=>time()]);
|
||||
// Migrated discount is old VIP, not an unrelated native manual discount.
|
||||
DB::table('fuc_vip_accounts')->where('user_id',$userId)->update(['opening_cents'=>$cents,'cumulative_cents'=>$cents,'manual_discount'=>null,'applied_discount'=>$user->discount,'opening_reference'=>$reference]);
|
||||
$account=DB::table('fuc_vip_accounts')->where('user_id',$userId)->first();$this->apply($user,$account);
|
||||
});
|
||||
}
|
||||
public function openingOrder(Order $order): void {
|
||||
if(!$this->enabled())return;
|
||||
if(DB::transactionLevel()<1)throw new \RuntimeException('VIP累计必须与开通同事务');
|
||||
if((int)$order->status!==Order::STATUS_PROCESSING || !in_array($order->period,[Plan::PERIOD_MONTHLY,Plan::PERIOD_QUARTERLY,Plan::PERIOD_HALF_YEARLY,Plan::PERIOD_YEARLY,Plan::PERIOD_TWO_YEARLY,Plan::PERIOD_THREE_YEARLY,Plan::PERIOD_ONETIME],true))return;
|
||||
$user=User::whereKey($order->user_id)->lockForUpdate()->firstOrFail();$account=$this->account($user);
|
||||
$key='purchase:'.$order->id;
|
||||
if(DB::table('fuc_vip_entries')->where('entry_key',$key)->exists())return;
|
||||
$amount=(int)$order->total_amount+(int)$order->balance_amount;
|
||||
if($amount<0)throw new \RuntimeException('套餐消费金额不能为负');
|
||||
DB::table('fuc_vip_entries')->insert(['user_id'=>$user->id,'order_id'=>$order->id,'entry_key'=>$key,'kind'=>'purchase','amount_cents'=>$amount,'created_at'=>time()]);
|
||||
$account->cumulative_cents+=(int)$amount;
|
||||
DB::table('fuc_vip_accounts')->where('user_id',$user->id)->update(['cumulative_cents'=>$account->cumulative_cents]);
|
||||
$this->apply($user,$account);
|
||||
}
|
||||
public function reverse(int $orderId,int $cents,string $reference): void {
|
||||
if(!$this->enabled())throw new \RuntimeException('VIP未启用');
|
||||
if($cents<=0 || !preg_match('/^[A-Za-z0-9_-]{1,80}$/D',$reference))throw new \InvalidArgumentException('Invalid reversal');
|
||||
DB::transaction(function()use($orderId,$cents,$reference){
|
||||
$order=Order::whereKey($orderId)->lockForUpdate()->firstOrFail();
|
||||
$user=User::whereKey($order->user_id)->lockForUpdate()->firstOrFail();$account=$this->account($user);
|
||||
$key='refund:'.$reference;
|
||||
$existing=DB::table('fuc_vip_entries')->where('entry_key',$key)->first();
|
||||
if($existing) {
|
||||
if((int)$existing->order_id!==$orderId || -(int)$existing->amount_cents!==$cents)throw new \RuntimeException('退款凭证已用于其他金额或订单');
|
||||
return;
|
||||
}
|
||||
$paid=DB::table('fuc_vip_entries')->where('entry_key','purchase:'.$orderId)->value('amount_cents');
|
||||
$reversed=-(int)DB::table('fuc_vip_entries')->where('order_id',$orderId)->where('kind','refund')->sum('amount_cents');
|
||||
if($paid===null || $cents>(int)$paid-$reversed)throw ValidationException::withMessages(['amount'=>'VIP冲回超过已计入且未冲回的消费']);
|
||||
DB::table('fuc_vip_entries')->insert(['user_id'=>$user->id,'order_id'=>$orderId,'entry_key'=>$key,'kind'=>'refund','amount_cents'=>-$cents,'created_at'=>time()]);
|
||||
$account->cumulative_cents=max(0,(int)$account->cumulative_cents-$cents);
|
||||
DB::table('fuc_vip_accounts')->where('user_id',$user->id)->update(['cumulative_cents'=>$account->cumulative_cents]);
|
||||
$this->apply($user,$account);
|
||||
});
|
||||
}
|
||||
public function suspend(): void {
|
||||
// Disable changes discounts only; keep the independent consumption audit intact.
|
||||
DB::table('fuc_vip_accounts')->whereNotNull('applied_discount')->orderBy('user_id')->chunkById(200,function($rows){
|
||||
foreach($rows as $row)DB::transaction(function()use($row){
|
||||
$user=User::whereKey($row->user_id)->lockForUpdate()->first();
|
||||
$account=DB::table('fuc_vip_accounts')->where('user_id',$row->user_id)->lockForUpdate()->first();
|
||||
if(!$user || $account->applied_discount===null)return;
|
||||
if((int)$user->discount===(int)$account->applied_discount){$user->discount=$account->manual_discount;$user->save();}
|
||||
DB::table('fuc_vip_accounts')->where('user_id',$row->user_id)->update(['applied_discount'=>null]);
|
||||
});
|
||||
},'user_id');
|
||||
}
|
||||
public function manualChanged(array $payload): void {
|
||||
if(!$this->enabled() || !array_key_exists('discount',$payload['params']??[]))return;
|
||||
$id=$payload['user']->id;
|
||||
DB::transaction(function()use($id,$payload){
|
||||
$user=User::whereKey($id)->lockForUpdate()->firstOrFail();$account=$this->account($user);
|
||||
DB::table('fuc_vip_accounts')->where('user_id',$id)->update(['manual_discount'=>$payload['params']['discount'],'applied_discount'=>$user->discount]);
|
||||
$account->manual_discount=$payload['params']['discount'];$account->applied_discount=$user->discount;
|
||||
$this->apply($user,$account);
|
||||
});
|
||||
}
|
||||
public function summary(int $userId): array {
|
||||
if(!$this->enabled())return ['enabled'=>false];
|
||||
$a=$this->sync($userId);$levels=$this->settings->levels();$current=0;$next=null;
|
||||
foreach($levels as $tier) {if($a->cumulative_cents >= $tier['threshold_cents'])$current=$tier['level'];elseif($next===null)$next=$tier;}
|
||||
return ['enabled'=>true,'cumulative_cents'=>(int)$a->cumulative_cents,'level'=>$current,'name'=>$current?$levels[$current-1]['name']:'普通用户','discount_percent'=>(int)$a->applied_discount,
|
||||
'next_level'=>$next,'remaining_cents'=>$next?max(0,$next['threshold_cents']-(int)$a->cumulative_cents):0,'levels'=>$levels];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
namespace Plugin\VipLoyalty;
|
||||
use App\Models\Plugin;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
final class Settings {
|
||||
public const DEFAULTS=['enabled'=>false,'tier1_amount'=>100,'tier1_discount'=>8,'tier2_amount'=>200,'tier2_discount'=>12,'tier3_amount'=>360,'tier3_discount'=>15];
|
||||
public function values(): array {
|
||||
$plugin=Plugin::where('code','vip_loyalty')->first();
|
||||
$values=array_replace(self::DEFAULTS,json_decode($plugin?->config??'{}',true)?:[]);
|
||||
$values['enabled']=(bool)($plugin?->is_enabled) && filter_var($values['enabled'],FILTER_VALIDATE_BOOL);
|
||||
return $values['enabled']?$this->validate($values):$values;
|
||||
}
|
||||
public function validate(array $values): array {
|
||||
$values=array_replace(self::DEFAULTS,$values);
|
||||
$rules=['enabled'=>'required|boolean'];
|
||||
for($i=1;$i<=3;$i++) {
|
||||
$rules['tier'.$i.'_amount']='required|numeric|min:0.01|max:100000000|decimal:0,2';
|
||||
$rules['tier'.$i.'_discount']='required|integer|min:0|max:100';
|
||||
}
|
||||
Validator::make($values,$rules)->after(function($validator)use($values){
|
||||
if($validator->errors()->isNotEmpty())return;
|
||||
for($i=2;$i<=3;$i++)if((float)$values['tier'.$i.'_amount']<=(float)$values['tier'.($i-1).'_amount'] || (int)$values['tier'.$i.'_discount']<(int)$values['tier'.($i-1).'_discount'])$validator->errors()->add('tiers','VIP门槛须递增,优惠不能降低');
|
||||
})->validate();
|
||||
return array_intersect_key($values,self::DEFAULTS);
|
||||
}
|
||||
public function levels(?array $values=null): array {
|
||||
$values??=$this->values();$levels=[];
|
||||
for($i=1;$i<=3;$i++)$levels[]=['level'=>$i,'name'=>[1=>'小福',2=>'中福',3=>'大福'][$i],'threshold_cents'=>(int)round((float)$values['tier'.$i.'_amount']*100),'discount'=>(int)$values['tier'.$i.'_discount']];
|
||||
return $levels;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
namespace Plugin\VipLoyalty;
|
||||
use App\Services\Plugin\PluginConfigService;
|
||||
// Keep the native administrator plugin editor; validate only this plugin's payload.
|
||||
final class ValidatedConfigService extends PluginConfigService {
|
||||
public function updateConfig(string $pluginCode,array $config): bool {
|
||||
if($pluginCode!=='vip_loyalty')return parent::updateConfig($pluginCode,$config);
|
||||
$values=app(Settings::class)->validate(array_replace($this->getDbConfig($pluginCode),$config));
|
||||
$saved=parent::updateConfig($pluginCode,$values);
|
||||
if(!$values['enabled'])app(Service::class)->suspend();
|
||||
return $saved;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"name": "VIP 自动升级",
|
||||
"code": "vip_loyalty",
|
||||
"version": "1.0.0",
|
||||
"description": "按实际套餐消费自动升级;独立实例开关,默认关闭。",
|
||||
"author": "XB",
|
||||
"type": "feature",
|
||||
"config": {
|
||||
"enabled": {"type":"boolean","default":false,"label":"开启 VIP 自动升级","description":"仅对当前实例生效;其他实例默认关闭。"},
|
||||
"tier1_amount": {"type":"number","default":100,"label":"VIP 1 累计门槛(元)"},
|
||||
"tier1_discount": {"type":"number","default":8,"label":"VIP 1 优惠百分比","description":"8 表示减 8%,即 9.2 折"},
|
||||
"tier2_amount": {"type":"number","default":200,"label":"VIP 2 累计门槛(元)"},
|
||||
"tier2_discount": {"type":"number","default":12,"label":"VIP 2 优惠百分比"},
|
||||
"tier3_amount": {"type":"number","default":360,"label":"VIP 3 累计门槛(元)"},
|
||||
"tier3_discount": {"type":"number","default":15,"label":"VIP 3 优惠百分比"}
|
||||
}
|
||||
}
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
return new class extends Migration {
|
||||
public function up(): void {
|
||||
Schema::create('fuc_vip_accounts', function(Blueprint $t) {
|
||||
$t->unsignedBigInteger('user_id')->primary();
|
||||
$t->bigInteger('opening_cents')->default(0);
|
||||
$t->bigInteger('cumulative_cents')->default(0);
|
||||
$t->unsignedTinyInteger('manual_discount')->nullable();
|
||||
$t->unsignedTinyInteger('applied_discount')->nullable();
|
||||
$t->string('opening_reference',64)->nullable();
|
||||
$t->bigInteger('created_at');$t->bigInteger('updated_at');
|
||||
});
|
||||
Schema::create('fuc_vip_entries', function(Blueprint $t) {
|
||||
$t->id();$t->unsignedBigInteger('user_id')->index();
|
||||
$t->unsignedBigInteger('order_id')->nullable()->index();
|
||||
$t->string('entry_key',191)->unique();
|
||||
$t->string('kind',16);$t->bigInteger('amount_cents');
|
||||
$t->bigInteger('created_at');
|
||||
});
|
||||
}
|
||||
public function down(): void {
|
||||
Schema::dropIfExists('fuc_vip_entries');Schema::dropIfExists('fuc_vip_accounts');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Plugin\VipLoyalty\Controllers\VipController;
|
||||
Route::middleware('user')->get('/api/v1/user/vip',[VipController::class,'show']);
|
||||
$secure=admin_setting('secure_path',admin_setting('frontend_admin_path',hash('crc32b',config('app.key'))));
|
||||
Route::middleware('admin')->prefix('/api/v2/'.$secure.'/vip')->group(function(){
|
||||
Route::get('/',[VipController::class,'settings']);Route::post('/',[VipController::class,'save']);
|
||||
});
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 1.8 KiB |
@@ -0,0 +1,19 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width,initial-scale=1.0"><meta name="color-scheme" content="dark"><meta name="supported-color-schemes" content="dark"><title>登录确认 · HardNerd</title>
|
||||
<style>@media only screen and (max-width:480px){.hn-shell{width:100%!important}.hn-pad{padding-left:24px!important;padding-right:24px!important}.hn-outer{padding:20px 12px!important}.hn-title{font-size:24px!important;line-height:34px!important}}a[x-apple-data-detectors]{color:inherit!important;text-decoration:none!important}</style></head>
|
||||
<body bgcolor="#111518" style="margin:0;padding:0;background-color:#111518;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI','Microsoft YaHei',Arial,sans-serif;color:#EDF1F4;-webkit-text-size-adjust:100%;">
|
||||
<div style="display:none;font-size:1px;color:#111518;line-height:1px;max-height:0;max-width:0;opacity:0;overflow:hidden;mso-hide:all;">登录确认 · HardNerd 账户与服务邮件</div>
|
||||
<table role="presentation" width="100%" cellpadding="0" cellspacing="0" border="0" bgcolor="#111518" style="background-color:#111518;"><tr><td class="hn-outer" align="center" style="padding:40px 16px;">
|
||||
<!--[if mso]><table role="presentation" width="600" cellpadding="0" cellspacing="0"><tr><td><![endif]-->
|
||||
<table class="hn-shell" role="presentation" width="100%" cellpadding="0" cellspacing="0" border="0" style="width:100%;max-width:600px;table-layout:fixed;">
|
||||
<tr><td class="hn-pad" bgcolor="#1E242A" style="padding:28px 36px;background-color:#1E242A;border:1px solid #353D44;border-bottom:0;border-radius:10px 10px 0 0;">
|
||||
<table role="presentation" cellpadding="0" cellspacing="0" border="0"><tr><td width="48" valign="middle" style="width:48px;padding-right:12px;"><img src="cid:site-logo@dpl" width="44" height="44" alt="HardNerd" style="display:block;width:44px;height:44px;border:0;border-radius:10px;"></td><td valign="middle" style="font-family:-apple-system,BlinkMacSystemFont,'Segoe UI','Microsoft YaHei',Arial,sans-serif;font-size:24px;line-height:30px;letter-spacing:-0.7px;color:#F2F4F1;font-weight:750;">Hard<span style="color:#B4F047;">Nerd</span></td></tr></table>
|
||||
</td></tr>
|
||||
<tr><td bgcolor="#1E242A" style="background-color:#1E242A;border-left:1px solid #353D44;border-right:1px solid #353D44;padding:0 36px;"><table role="presentation" width="100%" cellpadding="0" cellspacing="0"><tr><td height="1" bgcolor="#39432F" style="height:1px;background-color:#39432F;font-size:0;line-height:0;"> </td></tr></table></td></tr>
|
||||
<tr><td class="hn-pad" bgcolor="#1E242A" style="padding:32px 36px 36px;background-color:#1E242A;border:1px solid #353D44;border-top:0;border-radius:0 0 10px 10px;">
|
||||
<h1 class="hn-title" style="margin:0 0 20px;font-size:27px;line-height:38px;letter-spacing:-0.4px;font-weight:700;color:#F2F4F1;">登录确认</h1>
|
||||
<p style="margin:0 0 18px;color:#C5CBD2;font-size:15px;line-height:26px;word-break:break-word;overflow-wrap:anywhere;">点击下方按钮登录 HardNerd,链接有效期为 5 分钟。</p><table role="presentation" cellpadding="0" cellspacing="0" border="0"><tr><td bgcolor="#B4F047" style="background-color:#B4F047;border-radius:6px;text-align:center;mso-padding-alt:14px 28px;"><a href="{{link}}" style="display:inline-block;padding:14px 28px;border:1px solid #B4F047;border-radius:6px;background-color:#B4F047;color:#141A12;font-size:15px;line-height:22px;font-weight:700;text-decoration:none;">确认登录</a></td></tr></table><p style="margin:22px 0 0;color:#939CA6;font-size:12px;line-height:21px;">如非本人操作,请忽略此邮件。请勿将登录链接转发给他人。</p><p style="margin:22px 0 0;color:#939CA6;font-size:12px;line-height:21px;">按钮无法打开时,可复制此链接到浏览器:<br><a href="{{link}}" style="color:#B4F047;text-decoration:underline;word-break:break-all;">{{link}}</a></p>
|
||||
</td></tr>
|
||||
<tr><td class="hn-pad" align="left" style="padding:22px 36px 0;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI','Microsoft YaHei',Arial,sans-serif;font-size:12px;line-height:22px;color:#8D979F;">此邮件由 HardNerd 系统发送。<br><a href="{{site_url|https://hardnerd.net}}" style="color:#B4F047;text-decoration:none;">hardnerd.net</a><span style="color:#59636D;"> / </span><a href="mailto:[email protected]" style="color:#AAB4BC;text-decoration:none;">[email protected]</a></td></tr>
|
||||
</table><!--[if mso]></td></tr></table><![endif]-->
|
||||
</td></tr></table></body></html>
|
||||
@@ -0,0 +1,55 @@
|
||||
{
|
||||
"brand": "hn",
|
||||
"version": 1,
|
||||
"status": "production",
|
||||
"active_by_default": false,
|
||||
"templates": [
|
||||
{
|
||||
"name": "verify",
|
||||
"subject": "HardNerd · 邮箱验证码",
|
||||
"file": "verify.html",
|
||||
"required_vars": [
|
||||
"code"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "notify",
|
||||
"subject": "HardNerd · 站点通知",
|
||||
"file": "notify.html",
|
||||
"required_vars": [
|
||||
"content"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "mailLogin",
|
||||
"subject": "HardNerd · 登录确认",
|
||||
"file": "mailLogin.html",
|
||||
"required_vars": [
|
||||
"link"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "remindExpire",
|
||||
"subject": "HardNerd · 订阅即将到期",
|
||||
"file": "remindExpire.html",
|
||||
"required_vars": []
|
||||
},
|
||||
{
|
||||
"name": "serviceExpired",
|
||||
"subject": "HardNerd · 套餐已到期",
|
||||
"file": "serviceExpired.html",
|
||||
"required_vars": []
|
||||
},
|
||||
{
|
||||
"name": "remindTraffic",
|
||||
"subject": "HardNerd · 流量使用提醒",
|
||||
"file": "remindTraffic.html",
|
||||
"required_vars": []
|
||||
}
|
||||
],
|
||||
"logo": "logo.png",
|
||||
"logo_content_id": "site-logo@dpl",
|
||||
"compatibility_note": "Existing mail transport CID retained; image and visible branding are HN only.",
|
||||
"auto_reply_view": "mail.hn.autoReply",
|
||||
"activation_scope": "HN instance database templates and environment only"
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width,initial-scale=1.0"><meta name="color-scheme" content="dark"><meta name="supported-color-schemes" content="dark"><title>站点通知 · HardNerd</title>
|
||||
<style>@media only screen and (max-width:480px){.hn-shell{width:100%!important}.hn-pad{padding-left:24px!important;padding-right:24px!important}.hn-outer{padding:20px 12px!important}.hn-title{font-size:24px!important;line-height:34px!important}}a[x-apple-data-detectors]{color:inherit!important;text-decoration:none!important}</style></head>
|
||||
<body bgcolor="#111518" style="margin:0;padding:0;background-color:#111518;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI','Microsoft YaHei',Arial,sans-serif;color:#EDF1F4;-webkit-text-size-adjust:100%;">
|
||||
<div style="display:none;font-size:1px;color:#111518;line-height:1px;max-height:0;max-width:0;opacity:0;overflow:hidden;mso-hide:all;">站点通知 · HardNerd 账户与服务邮件</div>
|
||||
<table role="presentation" width="100%" cellpadding="0" cellspacing="0" border="0" bgcolor="#111518" style="background-color:#111518;"><tr><td class="hn-outer" align="center" style="padding:40px 16px;">
|
||||
<!--[if mso]><table role="presentation" width="600" cellpadding="0" cellspacing="0"><tr><td><![endif]-->
|
||||
<table class="hn-shell" role="presentation" width="100%" cellpadding="0" cellspacing="0" border="0" style="width:100%;max-width:600px;table-layout:fixed;">
|
||||
<tr><td class="hn-pad" bgcolor="#1E242A" style="padding:28px 36px;background-color:#1E242A;border:1px solid #353D44;border-bottom:0;border-radius:10px 10px 0 0;">
|
||||
<table role="presentation" cellpadding="0" cellspacing="0" border="0"><tr><td width="48" valign="middle" style="width:48px;padding-right:12px;"><img src="cid:site-logo@dpl" width="44" height="44" alt="HardNerd" style="display:block;width:44px;height:44px;border:0;border-radius:10px;"></td><td valign="middle" style="font-family:-apple-system,BlinkMacSystemFont,'Segoe UI','Microsoft YaHei',Arial,sans-serif;font-size:24px;line-height:30px;letter-spacing:-0.7px;color:#F2F4F1;font-weight:750;">Hard<span style="color:#B4F047;">Nerd</span></td></tr></table>
|
||||
</td></tr>
|
||||
<tr><td bgcolor="#1E242A" style="background-color:#1E242A;border-left:1px solid #353D44;border-right:1px solid #353D44;padding:0 36px;"><table role="presentation" width="100%" cellpadding="0" cellspacing="0"><tr><td height="1" bgcolor="#39432F" style="height:1px;background-color:#39432F;font-size:0;line-height:0;"> </td></tr></table></td></tr>
|
||||
<tr><td class="hn-pad" bgcolor="#1E242A" style="padding:32px 36px 36px;background-color:#1E242A;border:1px solid #353D44;border-top:0;border-radius:0 0 10px 10px;">
|
||||
<h1 class="hn-title" style="margin:0 0 20px;font-size:27px;line-height:38px;letter-spacing:-0.4px;font-weight:700;color:#F2F4F1;">站点通知</h1>
|
||||
<p style="margin:0 0 18px;color:#C5CBD2;font-size:15px;line-height:26px;word-break:break-word;overflow-wrap:anywhere;">{{content}}</p><table role="presentation" cellpadding="0" cellspacing="0" border="0"><tr><td bgcolor="#B4F047" style="background-color:#B4F047;border-radius:6px;text-align:center;mso-padding-alt:14px 28px;"><a href="{{url}}" style="display:inline-block;padding:14px 28px;border:1px solid #B4F047;border-radius:6px;background-color:#B4F047;color:#141A12;font-size:15px;line-height:22px;font-weight:700;text-decoration:none;">前往查看</a></td></tr></table>
|
||||
</td></tr>
|
||||
<tr><td class="hn-pad" align="left" style="padding:22px 36px 0;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI','Microsoft YaHei',Arial,sans-serif;font-size:12px;line-height:22px;color:#8D979F;">此邮件由 HardNerd 系统发送。<br><a href="{{site_url|https://hardnerd.net}}" style="color:#B4F047;text-decoration:none;">hardnerd.net</a><span style="color:#59636D;"> / </span><a href="mailto:[email protected]" style="color:#AAB4BC;text-decoration:none;">[email protected]</a></td></tr>
|
||||
</table><!--[if mso]></td></tr></table><![endif]-->
|
||||
</td></tr></table></body></html>
|
||||
@@ -0,0 +1,19 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width,initial-scale=1.0"><meta name="color-scheme" content="dark"><meta name="supported-color-schemes" content="dark"><title>订阅即将到期 · HardNerd</title>
|
||||
<style>@media only screen and (max-width:480px){.hn-shell{width:100%!important}.hn-pad{padding-left:24px!important;padding-right:24px!important}.hn-outer{padding:20px 12px!important}.hn-title{font-size:24px!important;line-height:34px!important}}a[x-apple-data-detectors]{color:inherit!important;text-decoration:none!important}</style></head>
|
||||
<body bgcolor="#111518" style="margin:0;padding:0;background-color:#111518;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI','Microsoft YaHei',Arial,sans-serif;color:#EDF1F4;-webkit-text-size-adjust:100%;">
|
||||
<div style="display:none;font-size:1px;color:#111518;line-height:1px;max-height:0;max-width:0;opacity:0;overflow:hidden;mso-hide:all;">订阅即将到期 · HardNerd 账户与服务邮件</div>
|
||||
<table role="presentation" width="100%" cellpadding="0" cellspacing="0" border="0" bgcolor="#111518" style="background-color:#111518;"><tr><td class="hn-outer" align="center" style="padding:40px 16px;">
|
||||
<!--[if mso]><table role="presentation" width="600" cellpadding="0" cellspacing="0"><tr><td><![endif]-->
|
||||
<table class="hn-shell" role="presentation" width="100%" cellpadding="0" cellspacing="0" border="0" style="width:100%;max-width:600px;table-layout:fixed;">
|
||||
<tr><td class="hn-pad" bgcolor="#1E242A" style="padding:28px 36px;background-color:#1E242A;border:1px solid #353D44;border-bottom:0;border-radius:10px 10px 0 0;">
|
||||
<table role="presentation" cellpadding="0" cellspacing="0" border="0"><tr><td width="48" valign="middle" style="width:48px;padding-right:12px;"><img src="cid:site-logo@dpl" width="44" height="44" alt="HardNerd" style="display:block;width:44px;height:44px;border:0;border-radius:10px;"></td><td valign="middle" style="font-family:-apple-system,BlinkMacSystemFont,'Segoe UI','Microsoft YaHei',Arial,sans-serif;font-size:24px;line-height:30px;letter-spacing:-0.7px;color:#F2F4F1;font-weight:750;">Hard<span style="color:#B4F047;">Nerd</span></td></tr></table>
|
||||
</td></tr>
|
||||
<tr><td bgcolor="#1E242A" style="background-color:#1E242A;border-left:1px solid #353D44;border-right:1px solid #353D44;padding:0 36px;"><table role="presentation" width="100%" cellpadding="0" cellspacing="0"><tr><td height="1" bgcolor="#39432F" style="height:1px;background-color:#39432F;font-size:0;line-height:0;"> </td></tr></table></td></tr>
|
||||
<tr><td class="hn-pad" bgcolor="#1E242A" style="padding:32px 36px 36px;background-color:#1E242A;border:1px solid #353D44;border-top:0;border-radius:0 0 10px 10px;">
|
||||
<h1 class="hn-title" style="margin:0 0 20px;font-size:27px;line-height:38px;letter-spacing:-0.4px;font-weight:700;color:#F2F4F1;">订阅即将到期</h1>
|
||||
<p style="margin:0 0 18px;color:#C5CBD2;font-size:15px;line-height:26px;word-break:break-word;overflow-wrap:anywhere;">您的订阅服务将在 <strong style="color:#F1F4F0;">24 小时内到期</strong>。</p><p style="margin:0 0 18px;color:#C5CBD2;font-size:15px;line-height:26px;word-break:break-word;overflow-wrap:anywhere;">为避免服务中断,请及时续费。如已完成续费,请忽略此提醒。</p><table role="presentation" cellpadding="0" cellspacing="0" border="0"><tr><td bgcolor="#B4F047" style="background-color:#B4F047;border-radius:6px;text-align:center;mso-padding-alt:14px 28px;"><a href="{{url}}" style="display:inline-block;padding:14px 28px;border:1px solid #B4F047;border-radius:6px;background-color:#B4F047;color:#141A12;font-size:15px;line-height:22px;font-weight:700;text-decoration:none;">管理订阅</a></td></tr></table>
|
||||
</td></tr>
|
||||
<tr><td class="hn-pad" align="left" style="padding:22px 36px 0;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI','Microsoft YaHei',Arial,sans-serif;font-size:12px;line-height:22px;color:#8D979F;">此邮件由 HardNerd 系统发送。<br><a href="{{site_url|https://hardnerd.net}}" style="color:#B4F047;text-decoration:none;">hardnerd.net</a><span style="color:#59636D;"> / </span><a href="mailto:[email protected]" style="color:#AAB4BC;text-decoration:none;">[email protected]</a></td></tr>
|
||||
</table><!--[if mso]></td></tr></table><![endif]-->
|
||||
</td></tr></table></body></html>
|
||||
@@ -0,0 +1,19 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width,initial-scale=1.0"><meta name="color-scheme" content="dark"><meta name="supported-color-schemes" content="dark"><title>流量使用提醒 · HardNerd</title>
|
||||
<style>@media only screen and (max-width:480px){.hn-shell{width:100%!important}.hn-pad{padding-left:24px!important;padding-right:24px!important}.hn-outer{padding:20px 12px!important}.hn-title{font-size:24px!important;line-height:34px!important}}a[x-apple-data-detectors]{color:inherit!important;text-decoration:none!important}</style></head>
|
||||
<body bgcolor="#111518" style="margin:0;padding:0;background-color:#111518;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI','Microsoft YaHei',Arial,sans-serif;color:#EDF1F4;-webkit-text-size-adjust:100%;">
|
||||
<div style="display:none;font-size:1px;color:#111518;line-height:1px;max-height:0;max-width:0;opacity:0;overflow:hidden;mso-hide:all;">流量使用提醒 · HardNerd 账户与服务邮件</div>
|
||||
<table role="presentation" width="100%" cellpadding="0" cellspacing="0" border="0" bgcolor="#111518" style="background-color:#111518;"><tr><td class="hn-outer" align="center" style="padding:40px 16px;">
|
||||
<!--[if mso]><table role="presentation" width="600" cellpadding="0" cellspacing="0"><tr><td><![endif]-->
|
||||
<table class="hn-shell" role="presentation" width="100%" cellpadding="0" cellspacing="0" border="0" style="width:100%;max-width:600px;table-layout:fixed;">
|
||||
<tr><td class="hn-pad" bgcolor="#1E242A" style="padding:28px 36px;background-color:#1E242A;border:1px solid #353D44;border-bottom:0;border-radius:10px 10px 0 0;">
|
||||
<table role="presentation" cellpadding="0" cellspacing="0" border="0"><tr><td width="48" valign="middle" style="width:48px;padding-right:12px;"><img src="cid:site-logo@dpl" width="44" height="44" alt="HardNerd" style="display:block;width:44px;height:44px;border:0;border-radius:10px;"></td><td valign="middle" style="font-family:-apple-system,BlinkMacSystemFont,'Segoe UI','Microsoft YaHei',Arial,sans-serif;font-size:24px;line-height:30px;letter-spacing:-0.7px;color:#F2F4F1;font-weight:750;">Hard<span style="color:#B4F047;">Nerd</span></td></tr></table>
|
||||
</td></tr>
|
||||
<tr><td bgcolor="#1E242A" style="background-color:#1E242A;border-left:1px solid #353D44;border-right:1px solid #353D44;padding:0 36px;"><table role="presentation" width="100%" cellpadding="0" cellspacing="0"><tr><td height="1" bgcolor="#39432F" style="height:1px;background-color:#39432F;font-size:0;line-height:0;"> </td></tr></table></td></tr>
|
||||
<tr><td class="hn-pad" bgcolor="#1E242A" style="padding:32px 36px 36px;background-color:#1E242A;border:1px solid #353D44;border-top:0;border-radius:0 0 10px 10px;">
|
||||
<h1 class="hn-title" style="margin:0 0 20px;font-size:27px;line-height:38px;letter-spacing:-0.4px;font-weight:700;color:#F2F4F1;">流量使用提醒</h1>
|
||||
<p style="margin:0 0 18px;color:#C5CBD2;font-size:15px;line-height:26px;word-break:break-word;overflow-wrap:anywhere;">您的套餐流量已使用 <strong style="color:#F1F4F0;">80%</strong>。</p><p style="margin:0 0 18px;color:#C5CBD2;font-size:15px;line-height:26px;word-break:break-word;overflow-wrap:anywhere;">请留意剩余流量,您可以在控制台查看详细使用情况。</p><table role="presentation" cellpadding="0" cellspacing="0" border="0"><tr><td bgcolor="#B4F047" style="background-color:#B4F047;border-radius:6px;text-align:center;mso-padding-alt:14px 28px;"><a href="{{url}}" style="display:inline-block;padding:14px 28px;border:1px solid #B4F047;border-radius:6px;background-color:#B4F047;color:#141A12;font-size:15px;line-height:22px;font-weight:700;text-decoration:none;">查看用量</a></td></tr></table>
|
||||
</td></tr>
|
||||
<tr><td class="hn-pad" align="left" style="padding:22px 36px 0;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI','Microsoft YaHei',Arial,sans-serif;font-size:12px;line-height:22px;color:#8D979F;">此邮件由 HardNerd 系统发送。<br><a href="{{site_url|https://hardnerd.net}}" style="color:#B4F047;text-decoration:none;">hardnerd.net</a><span style="color:#59636D;"> / </span><a href="mailto:[email protected]" style="color:#AAB4BC;text-decoration:none;">[email protected]</a></td></tr>
|
||||
</table><!--[if mso]></td></tr></table><![endif]-->
|
||||
</td></tr></table></body></html>
|
||||
@@ -0,0 +1,19 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width,initial-scale=1.0"><meta name="color-scheme" content="dark"><meta name="supported-color-schemes" content="dark"><title>套餐已到期 · HardNerd</title>
|
||||
<style>@media only screen and (max-width:480px){.hn-shell{width:100%!important}.hn-pad{padding-left:24px!important;padding-right:24px!important}.hn-outer{padding:20px 12px!important}.hn-title{font-size:24px!important;line-height:34px!important}}a[x-apple-data-detectors]{color:inherit!important;text-decoration:none!important}</style></head>
|
||||
<body bgcolor="#111518" style="margin:0;padding:0;background-color:#111518;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI','Microsoft YaHei',Arial,sans-serif;color:#EDF1F4;-webkit-text-size-adjust:100%;">
|
||||
<div style="display:none;font-size:1px;color:#111518;line-height:1px;max-height:0;max-width:0;opacity:0;overflow:hidden;mso-hide:all;">套餐已到期 · HardNerd 账户与服务邮件</div>
|
||||
<table role="presentation" width="100%" cellpadding="0" cellspacing="0" border="0" bgcolor="#111518" style="background-color:#111518;"><tr><td class="hn-outer" align="center" style="padding:40px 16px;">
|
||||
<!--[if mso]><table role="presentation" width="600" cellpadding="0" cellspacing="0"><tr><td><![endif]-->
|
||||
<table class="hn-shell" role="presentation" width="100%" cellpadding="0" cellspacing="0" border="0" style="width:100%;max-width:600px;table-layout:fixed;">
|
||||
<tr><td class="hn-pad" bgcolor="#1E242A" style="padding:28px 36px;background-color:#1E242A;border:1px solid #353D44;border-bottom:0;border-radius:10px 10px 0 0;">
|
||||
<table role="presentation" cellpadding="0" cellspacing="0" border="0"><tr><td width="48" valign="middle" style="width:48px;padding-right:12px;"><img src="cid:site-logo@dpl" width="44" height="44" alt="HardNerd" style="display:block;width:44px;height:44px;border:0;border-radius:10px;"></td><td valign="middle" style="font-family:-apple-system,BlinkMacSystemFont,'Segoe UI','Microsoft YaHei',Arial,sans-serif;font-size:24px;line-height:30px;letter-spacing:-0.7px;color:#F2F4F1;font-weight:750;">Hard<span style="color:#B4F047;">Nerd</span></td></tr></table>
|
||||
</td></tr>
|
||||
<tr><td bgcolor="#1E242A" style="background-color:#1E242A;border-left:1px solid #353D44;border-right:1px solid #353D44;padding:0 36px;"><table role="presentation" width="100%" cellpadding="0" cellspacing="0"><tr><td height="1" bgcolor="#39432F" style="height:1px;background-color:#39432F;font-size:0;line-height:0;"> </td></tr></table></td></tr>
|
||||
<tr><td class="hn-pad" bgcolor="#1E242A" style="padding:32px 36px 36px;background-color:#1E242A;border:1px solid #353D44;border-top:0;border-radius:0 0 10px 10px;">
|
||||
<h1 class="hn-title" style="margin:0 0 20px;font-size:27px;line-height:38px;letter-spacing:-0.4px;font-weight:700;color:#F2F4F1;">套餐已到期</h1>
|
||||
<p style="margin:0 0 18px;color:#C5CBD2;font-size:15px;line-height:26px;word-break:break-word;overflow-wrap:anywhere;">您的套餐已到期。如需继续使用,请前往网站续费。</p><table role="presentation" cellpadding="0" cellspacing="0" border="0"><tr><td bgcolor="#B4F047" style="background-color:#B4F047;border-radius:6px;text-align:center;mso-padding-alt:14px 28px;"><a href="{{url}}" style="display:inline-block;padding:14px 28px;border:1px solid #B4F047;border-radius:6px;background-color:#B4F047;color:#141A12;font-size:15px;line-height:22px;font-weight:700;text-decoration:none;">前往续费</a></td></tr></table>
|
||||
</td></tr>
|
||||
<tr><td class="hn-pad" align="left" style="padding:22px 36px 0;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI','Microsoft YaHei',Arial,sans-serif;font-size:12px;line-height:22px;color:#8D979F;">此邮件由 HardNerd 系统发送。<br><a href="{{site_url|https://hardnerd.net}}" style="color:#B4F047;text-decoration:none;">hardnerd.net</a><span style="color:#59636D;"> / </span><a href="mailto:[email protected]" style="color:#AAB4BC;text-decoration:none;">[email protected]</a></td></tr>
|
||||
</table><!--[if mso]></td></tr></table><![endif]-->
|
||||
</td></tr></table></body></html>
|
||||
@@ -0,0 +1,19 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width,initial-scale=1.0"><meta name="color-scheme" content="dark"><meta name="supported-color-schemes" content="dark"><title>邮箱验证码 · HardNerd</title>
|
||||
<style>@media only screen and (max-width:480px){.hn-shell{width:100%!important}.hn-pad{padding-left:24px!important;padding-right:24px!important}.hn-outer{padding:20px 12px!important}.hn-title{font-size:24px!important;line-height:34px!important}}a[x-apple-data-detectors]{color:inherit!important;text-decoration:none!important}</style></head>
|
||||
<body bgcolor="#111518" style="margin:0;padding:0;background-color:#111518;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI','Microsoft YaHei',Arial,sans-serif;color:#EDF1F4;-webkit-text-size-adjust:100%;">
|
||||
<div style="display:none;font-size:1px;color:#111518;line-height:1px;max-height:0;max-width:0;opacity:0;overflow:hidden;mso-hide:all;">邮箱验证码 · HardNerd 账户与服务邮件</div>
|
||||
<table role="presentation" width="100%" cellpadding="0" cellspacing="0" border="0" bgcolor="#111518" style="background-color:#111518;"><tr><td class="hn-outer" align="center" style="padding:40px 16px;">
|
||||
<!--[if mso]><table role="presentation" width="600" cellpadding="0" cellspacing="0"><tr><td><![endif]-->
|
||||
<table class="hn-shell" role="presentation" width="100%" cellpadding="0" cellspacing="0" border="0" style="width:100%;max-width:600px;table-layout:fixed;">
|
||||
<tr><td class="hn-pad" bgcolor="#1E242A" style="padding:28px 36px;background-color:#1E242A;border:1px solid #353D44;border-bottom:0;border-radius:10px 10px 0 0;">
|
||||
<table role="presentation" cellpadding="0" cellspacing="0" border="0"><tr><td width="48" valign="middle" style="width:48px;padding-right:12px;"><img src="cid:site-logo@dpl" width="44" height="44" alt="HardNerd" style="display:block;width:44px;height:44px;border:0;border-radius:10px;"></td><td valign="middle" style="font-family:-apple-system,BlinkMacSystemFont,'Segoe UI','Microsoft YaHei',Arial,sans-serif;font-size:24px;line-height:30px;letter-spacing:-0.7px;color:#F2F4F1;font-weight:750;">Hard<span style="color:#B4F047;">Nerd</span></td></tr></table>
|
||||
</td></tr>
|
||||
<tr><td bgcolor="#1E242A" style="background-color:#1E242A;border-left:1px solid #353D44;border-right:1px solid #353D44;padding:0 36px;"><table role="presentation" width="100%" cellpadding="0" cellspacing="0"><tr><td height="1" bgcolor="#39432F" style="height:1px;background-color:#39432F;font-size:0;line-height:0;"> </td></tr></table></td></tr>
|
||||
<tr><td class="hn-pad" bgcolor="#1E242A" style="padding:32px 36px 36px;background-color:#1E242A;border:1px solid #353D44;border-top:0;border-radius:0 0 10px 10px;">
|
||||
<h1 class="hn-title" style="margin:0 0 20px;font-size:27px;line-height:38px;letter-spacing:-0.4px;font-weight:700;color:#F2F4F1;">邮箱验证码</h1>
|
||||
<p style="margin:0 0 18px;color:#C5CBD2;font-size:15px;line-height:26px;word-break:break-word;overflow-wrap:anywhere;">请使用以下验证码完成验证。</p><table role="presentation" width="100%" cellpadding="0" cellspacing="0"><tr><td bgcolor="#14191D" style="padding:24px 16px;border:1px solid #39442E;border-radius:6px;text-align:center;"><span style="font-family:'Courier New',Courier,monospace;font-size:34px;line-height:44px;letter-spacing:8px;font-weight:700;color:#B4F047;">{{code}}</span></td></tr></table><p style="margin:22px 0 0;color:#939CA6;font-size:12px;line-height:21px;">验证码有效期为 5 分钟,请勿转发或透露给他人。如非本人操作,请忽略此邮件。</p>
|
||||
</td></tr>
|
||||
<tr><td class="hn-pad" align="left" style="padding:22px 36px 0;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI','Microsoft YaHei',Arial,sans-serif;font-size:12px;line-height:22px;color:#8D979F;">此邮件由 HardNerd 系统发送。<br><a href="{{site_url|https://hardnerd.net}}" style="color:#B4F047;text-decoration:none;">hardnerd.net</a><span style="color:#59636D;"> / </span><a href="mailto:[email protected]" style="color:#AAB4BC;text-decoration:none;">[email protected]</a></td></tr>
|
||||
</table><!--[if mso]></td></tr></table><![endif]-->
|
||||
</td></tr></table></body></html>
|
||||
@@ -0,0 +1,19 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width,initial-scale=1.0"><meta name="color-scheme" content="dark"><meta name="supported-color-schemes" content="dark"><title>来信已收到 · HardNerd</title>
|
||||
<style>@media only screen and (max-width:480px){.hn-shell{width:100%!important}.hn-pad{padding-left:24px!important;padding-right:24px!important}.hn-outer{padding:20px 12px!important}.hn-title{font-size:24px!important;line-height:34px!important}}a[x-apple-data-detectors]{color:inherit!important;text-decoration:none!important}</style></head>
|
||||
<body bgcolor="#111518" style="margin:0;padding:0;background-color:#111518;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI','Microsoft YaHei',Arial,sans-serif;color:#EDF1F4;-webkit-text-size-adjust:100%;">
|
||||
<div style="display:none;font-size:1px;color:#111518;line-height:1px;max-height:0;max-width:0;opacity:0;overflow:hidden;mso-hide:all;">来信已收到 · HardNerd 账户与服务邮件</div>
|
||||
<table role="presentation" width="100%" cellpadding="0" cellspacing="0" border="0" bgcolor="#111518" style="background-color:#111518;"><tr><td class="hn-outer" align="center" style="padding:40px 16px;">
|
||||
<!--[if mso]><table role="presentation" width="600" cellpadding="0" cellspacing="0"><tr><td><![endif]-->
|
||||
<table class="hn-shell" role="presentation" width="100%" cellpadding="0" cellspacing="0" border="0" style="width:100%;max-width:600px;table-layout:fixed;">
|
||||
<tr><td class="hn-pad" bgcolor="#1E242A" style="padding:28px 36px;background-color:#1E242A;border:1px solid #353D44;border-bottom:0;border-radius:10px 10px 0 0;">
|
||||
<table role="presentation" cellpadding="0" cellspacing="0" border="0"><tr><td width="48" valign="middle" style="width:48px;padding-right:12px;"><img src="cid:site-logo@dpl" width="44" height="44" alt="HardNerd" style="display:block;width:44px;height:44px;border:0;border-radius:10px;"></td><td valign="middle" style="font-family:-apple-system,BlinkMacSystemFont,'Segoe UI','Microsoft YaHei',Arial,sans-serif;font-size:24px;line-height:30px;letter-spacing:-0.7px;color:#F2F4F1;font-weight:750;">Hard<span style="color:#B4F047;">Nerd</span></td></tr></table>
|
||||
</td></tr>
|
||||
<tr><td bgcolor="#1E242A" style="background-color:#1E242A;border-left:1px solid #353D44;border-right:1px solid #353D44;padding:0 36px;"><table role="presentation" width="100%" cellpadding="0" cellspacing="0"><tr><td height="1" bgcolor="#39432F" style="height:1px;background-color:#39432F;font-size:0;line-height:0;"> </td></tr></table></td></tr>
|
||||
<tr><td class="hn-pad" bgcolor="#1E242A" style="padding:32px 36px 36px;background-color:#1E242A;border:1px solid #353D44;border-top:0;border-radius:0 0 10px 10px;">
|
||||
<h1 class="hn-title" style="margin:0 0 20px;font-size:27px;line-height:38px;letter-spacing:-0.4px;font-weight:700;color:#F2F4F1;">来信已收到</h1>
|
||||
<p style="margin:0 0 18px;color:#C5CBD2;font-size:15px;line-height:26px;word-break:break-word;overflow-wrap:anywhere;">{!! nl2br($content) !!}</p><p style="margin:0 0 22px;color:#C5CBD2;font-size:15px;line-height:26px;">当前网站地址:<br><a href="{{$site_url ?? $url}}" style="color:#B4F047;font-weight:700;text-decoration:none;word-break:break-all;">{{$site_url ?? $url}}</a></p><table role="presentation" cellpadding="0" cellspacing="0" border="0"><tr><td bgcolor="#B4F047" style="background-color:#B4F047;border-radius:6px;text-align:center;mso-padding-alt:14px 28px;"><a href="{{$url}}" style="display:inline-block;padding:14px 28px;border:1px solid #B4F047;border-radius:6px;background-color:#B4F047;color:#141A12;font-size:15px;line-height:22px;font-weight:700;text-decoration:none;">访问 HardNerd</a></td></tr></table>
|
||||
</td></tr>
|
||||
<tr><td class="hn-pad" align="left" style="padding:22px 36px 0;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI','Microsoft YaHei',Arial,sans-serif;font-size:12px;line-height:22px;color:#8D979F;">此邮件由 HardNerd 系统发送。<br><a href="{{$site_url ?? 'https://hardnerd.net'}}" style="color:#B4F047;text-decoration:none;">hardnerd.net</a><span style="color:#59636D;"> / </span><a href="mailto:[email protected]" style="color:#AAB4BC;text-decoration:none;">mail@hardnerd.dev</a></td></tr>
|
||||
</table><!--[if mso]></td></tr></table><![endif]-->
|
||||
</td></tr></table></body></html>
|
||||
@@ -0,0 +1,9 @@
|
||||
# FUC-XB测试反代
|
||||
|
||||
用户2026-11-04明确要求用tomtojapan.online,为本次新入口覆盖默认IP加端口的选型;不更改全局规则。
|
||||
|
||||
精确入口`fuc-xb-test.tomtojapan.online`,经白色机HTTPS反代到`fuc-xb-test.gemcook.net`。复用已登记的橙云泛域DNS和Origin CA,反代域名不指向业务服务器。独立Nginx文件,不改旧FUC或其他站点的精确/泛映射。保留测试入口密码、安全Cookie和XB令牌权限。
|
||||
|
||||
代码按Git提交/推送,白色机稀疏检出到`/var/www/wwwroot/fuc-xb-test-proxy`,以root运行`python3 scripts/fuc-xb-test-proxy/deploy.py`。脚本拒绝覆盖同名配置、保存已有配置摘要、检查Nginx后平滑reload,失败撤回本次新增链接。上游证书严格校验,Host/SNI为源站,URL路径/查询/Authorization/Cookie原样转发;同站Origin/Referer、Cookie域、Location及正文URL按精确域名转换,跨站值保持。
|
||||
|
||||
验收和凭据入口见`docs/maintenance/FUC_XB_STAGING.md`。回退仅删除本次配置链接,`nginx -t`后平滑reload;保留源测试站、Git版本和备份,不删数据库或改变其他反代。WebSocket仅配置透传,不把常规HTTP验证说成真实WebSocket验收。
|
||||
@@ -0,0 +1,51 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Install only this Git checkout's new staging alias on the registered white host."""
|
||||
import datetime
|
||||
import hashlib
|
||||
import json
|
||||
import os
|
||||
import pathlib
|
||||
import subprocess
|
||||
|
||||
def sha(path):
|
||||
return hashlib.sha256(path.read_bytes()).hexdigest()
|
||||
|
||||
def main():
|
||||
if os.geteuid() != 0:
|
||||
raise SystemExit('Run on the registered white server as root')
|
||||
source = pathlib.Path(__file__).with_name('nginx.conf').resolve()
|
||||
root = source.parents[2]
|
||||
if root != pathlib.Path('/var/www/wwwroot/fuc-xb-test-proxy'):
|
||||
raise RuntimeError('Wrong deployment checkout')
|
||||
target = pathlib.Path('/etc/nginx/conf.d/fuc-xb-test-proxy.conf')
|
||||
if target.exists() or target.is_symlink():
|
||||
raise RuntimeError('Refuse to overwrite an existing mapping')
|
||||
cert = pathlib.Path('/etc/white-proxy-origin/tomtojapan.online/fullchain.pem')
|
||||
subprocess.run(['openssl','x509','-in',str(cert),'-noout','-checkend','604800'], check=True, capture_output=True)
|
||||
subprocess.run(['nginx','-t'], check=True, capture_output=True)
|
||||
os.umask(0o077)
|
||||
stamp = datetime.datetime.now(datetime.timezone.utc).strftime('%Y%m%d-%H%M%S')
|
||||
backup = pathlib.Path('/root/codex-backups/fuc-xb-test-proxy') / stamp
|
||||
backup.mkdir(parents=True, mode=0o700)
|
||||
before = {str(p):sha(p) for p in pathlib.Path('/etc/nginx/conf.d').glob('*.conf') if p.is_file()}
|
||||
head = subprocess.check_output(['git','-C',str(root),'rev-parse','HEAD'],text=True).strip()
|
||||
manifest = {'commit':head, 'existing_configs':before, 'new_target':str(target), 'new_source':str(source), 'source_sha256':sha(source), 'previous_mapping':'absent'}
|
||||
(backup/'manifest.json').write_text(json.dumps(manifest,indent=2))
|
||||
target.symlink_to(source)
|
||||
try:
|
||||
subprocess.run(['nginx','-t'], check=True, capture_output=True)
|
||||
subprocess.run(['systemctl','reload','nginx'], check=True, capture_output=True)
|
||||
if any(not pathlib.Path(p).is_file() or sha(pathlib.Path(p)) != h for p,h in before.items()):
|
||||
raise RuntimeError('An existing configuration changed during deployment')
|
||||
except BaseException:
|
||||
if target.is_symlink() and target.resolve() == source:
|
||||
target.unlink()
|
||||
subprocess.run(['nginx','-t'], check=True, capture_output=True)
|
||||
subprocess.run(['systemctl','reload','nginx'], check=True, capture_output=True)
|
||||
raise
|
||||
result = {'installed':True,'commit':head,'target':str(target),'backup':str(backup),'existing_config_hashes_unchanged':True,'dns_or_certificate_changed':False}
|
||||
(backup/'result.json').write_text(json.dumps(result,indent=2))
|
||||
print(json.dumps(result))
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
@@ -0,0 +1,76 @@
|
||||
# Dedicated FUC-XB staging alias. Never maps tomtojapan.online to the business IP.
|
||||
map $http_upgrade $fuc_xb_test_proxy_connection {
|
||||
default upgrade;
|
||||
'' close;
|
||||
}
|
||||
map $http_origin $fuc_xb_test_proxy_origin {
|
||||
default $http_origin;
|
||||
https://fuc-xb-test.tomtojapan.online https://fuc-xb-test.gemcook.net;
|
||||
}
|
||||
map $http_referer $fuc_xb_test_proxy_referer {
|
||||
default $http_referer;
|
||||
"~^https://fuc-xb-test\.tomtojapan\.online(?<fuc_xb_test_refpath>/.*)?$" https://fuc-xb-test.gemcook.net$fuc_xb_test_refpath;
|
||||
}
|
||||
server {
|
||||
listen 80;
|
||||
listen [::]:80;
|
||||
server_name fuc-xb-test.tomtojapan.online;
|
||||
access_log off;
|
||||
error_log /var/log/nginx/fuc-xb-test-proxy.error.log crit;
|
||||
location / { return 301 https://fuc-xb-test.tomtojapan.online$request_uri; }
|
||||
}
|
||||
server {
|
||||
listen 443 ssl;
|
||||
listen [::]:443 ssl;
|
||||
server_name fuc-xb-test.tomtojapan.online;
|
||||
ssl_certificate /etc/white-proxy-origin/tomtojapan.online/fullchain.pem;
|
||||
ssl_certificate_key /etc/white-proxy-origin/tomtojapan.online/privatekey.pem;
|
||||
ssl_protocols TLSv1.2 TLSv1.3;
|
||||
include /etc/nginx/white-proxy-cloudflare-realip.conf;
|
||||
access_log off;
|
||||
error_log /var/log/nginx/fuc-xb-test-proxy.error.log crit;
|
||||
client_max_body_size 20m;
|
||||
resolver 1.1.1.1 1.0.0.1 valid=300s ipv6=off;
|
||||
resolver_timeout 5s;
|
||||
set $fuc_xb_test_upstream fuc-xb-test.gemcook.net;
|
||||
add_header Cache-Control "private, no-store" always;
|
||||
add_header X-Robots-Tag "noindex, nofollow, noarchive" always;
|
||||
location / {
|
||||
proxy_pass https://$fuc_xb_test_upstream$request_uri;
|
||||
proxy_ssl_server_name on;
|
||||
proxy_ssl_name fuc-xb-test.gemcook.net;
|
||||
proxy_ssl_verify on;
|
||||
proxy_ssl_verify_depth 4;
|
||||
proxy_ssl_trusted_certificate /etc/ssl/certs/ca-certificates.crt;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Host fuc-xb-test.gemcook.net;
|
||||
proxy_set_header X-Forwarded-Host $host;
|
||||
proxy_set_header X-Forwarded-Proto https;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $remote_addr;
|
||||
proxy_set_header Origin $fuc_xb_test_proxy_origin;
|
||||
proxy_set_header Referer $fuc_xb_test_proxy_referer;
|
||||
proxy_set_header Authorization $http_authorization;
|
||||
proxy_set_header Cookie $http_cookie;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection $fuc_xb_test_proxy_connection;
|
||||
proxy_set_header Accept-Encoding "";
|
||||
proxy_connect_timeout 15s;
|
||||
proxy_read_timeout 120s;
|
||||
proxy_buffering off;
|
||||
proxy_cache off;
|
||||
proxy_no_cache 1;
|
||||
proxy_cache_bypass 1;
|
||||
proxy_hide_header Cache-Control;
|
||||
proxy_redirect https://fuc-xb-test.gemcook.net/ https://fuc-xb-test.tomtojapan.online/;
|
||||
proxy_redirect http://fuc-xb-test.gemcook.net/ https://fuc-xb-test.tomtojapan.online/;
|
||||
proxy_cookie_domain fuc-xb-test.gemcook.net fuc-xb-test.tomtojapan.online;
|
||||
sub_filter_once off;
|
||||
sub_filter_types text/css application/javascript application/json;
|
||||
sub_filter 'https://fuc-xb-test.gemcook.net' 'https://fuc-xb-test.tomtojapan.online';
|
||||
sub_filter 'http://fuc-xb-test.gemcook.net' 'https://fuc-xb-test.tomtojapan.online';
|
||||
sub_filter '//fuc-xb-test.gemcook.net' '//fuc-xb-test.tomtojapan.online';
|
||||
# JSON may escape URL slashes; the exact hostname remains unchanged.
|
||||
sub_filter 'fuc-xb-test.gemcook.net' 'fuc-xb-test.tomtojapan.online';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
// Run the theme's real event handlers against a static DOM and delayed API doubles.
|
||||
// This checks races and business payloads; it is not browser/provider acceptance.
|
||||
import test from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import fs from 'node:fs/promises';
|
||||
import {JSDOM,VirtualConsole} from '../../codex/output/fuc-theme/test-tools/node_modules/jsdom/lib/api.js';
|
||||
const jsErrors=[],consoleCapture=new VirtualConsole();consoleCapture.on('jsdomError',error=>jsErrors.push(error));
|
||||
const dom=new JSDOM('<html><head><style>.modal.fade .modal-dialog{transition:transform .3s ease-out}.modal-backdrop.fade{transition:opacity .15s linear}</style></head><body><div id="app"></div></body></html>',{url:'http://xb.loc/#/login',runScripts:'outside-only',pretendToBeVisual:true,virtualConsole:consoleCapture});
|
||||
for(const key of ['window','document','DOMParser','localStorage','sessionStorage','location','history','FormData'])globalThis[key]=dom.window[key];
|
||||
globalThis.innerWidth=1280;globalThis.matchMedia=()=>({matches:false,addEventListener(){}});
|
||||
globalThis.requestAnimationFrame=window.requestAnimationFrame.bind(window);globalThis.cancelAnimationFrame=window.cancelAnimationFrame.bind(window);
|
||||
window.scrollTo=()=>{};window.ApexCharts=class{render(){return Promise.resolve()}destroy(){}};
|
||||
const plans=[{id:1,name:'Paid',month_price:1200,transfer_enable:100},{id:2,name:'Free',month_price:0,transfer_enable:10}];
|
||||
const calls=[];let delayedLogin,delayedCoupon;
|
||||
const payload=(data,status=200)=>({ok:status<400,status,json:async()=>({data})});
|
||||
globalThis.fetch=async(url,options={})=>{
|
||||
if(String(url).startsWith('file:'))return {ok:true,text:()=>fs.readFile(new URL(url),'utf8'),json:async()=>JSON.parse(await fs.readFile(new URL(url),'utf8'))};
|
||||
const path=String(url).replace('/api/v1/','');calls.push({path,body:options.body?JSON.parse(options.body):null});
|
||||
if(path==='guest/comm/config')return payload({is_captcha:0});
|
||||
if(path==='passport/auth/login')return new Promise(resolve=>delayedLogin=()=>resolve(payload({auth_data:'Bearer synthetic'})));
|
||||
if(path==='user/info')return payload({email:'[email protected]',plan_id:2});
|
||||
if(path==='user/getSubscribe')return payload({plan_id:2,plan:plans[1],transfer_enable:1000,u:0,d:0,subscribe_url:'http://xb.loc/s/synthetic'});
|
||||
if(path==='user/comm/config')return payload({withdraw_methods:[]});
|
||||
if(path==='user/plan/fetch')return payload(plans);
|
||||
if(path==='user/plan/fetch?id=2')return payload({...plans[1],show:false,sell:false,renew:true,capacity_limit:'Sold out'});
|
||||
if(path==='user/coupon/check')return new Promise(resolve=>delayedCoupon=()=>resolve(payload({name:'QA'})));
|
||||
if(path==='user/order/save')return payload('synthetic-order');
|
||||
if(path==='user/order/detail?trade_no=synthetic-order')return payload({trade_no:'synthetic-order',plan:plans[1],period:'month_price',status:0,total_amount:0});
|
||||
return payload([]);
|
||||
};
|
||||
const append=document.head.append.bind(document.head);
|
||||
document.head.append=node=>{append(node);if(node.tagName==='SCRIPT')queueMicrotask(()=>{try{window.eval(requireFile(node.src));node.onload?.();}catch(error){node.onerror?.(error);}});if(node.tagName==='LINK')queueMicrotask(()=>node.onload?.());};
|
||||
const {readFileSync}=await import('node:fs');const requireFile=url=>readFileSync(new URL(url),'utf8');
|
||||
const until=async predicate=>{for(let n=0;n<200;n++){if(predicate())return;await new Promise(resolve=>setTimeout(resolve,10));}throw Error('DOM state did not settle');};
|
||||
const go=async route=>{location.hash='/'+route;await until(()=>document.body.dataset.nativePage===route);};
|
||||
await import('../../theme/Fuc/assets/app.mjs');
|
||||
test('login uses original pending text and waits for success confirmation before routing',async()=>{
|
||||
await until(()=>document.querySelector('[data-form=login]'));const form=document.querySelector('[data-form=login]'),button=form.querySelector('[type=submit]');
|
||||
form.querySelector('[name=email]').value='[email protected]';form.querySelector('[name=password]').value='synthetic-password';
|
||||
form.dispatchEvent(new window.Event('submit',{bubbles:true,cancelable:true}));
|
||||
assert.equal(button.textContent,'正在登录');assert.equal(button.disabled,true);await until(()=>delayedLogin);delayedLogin();
|
||||
await until(()=>document.querySelector('.swal2-confirm'));assert.equal(location.hash,'#/login');
|
||||
document.querySelector('.swal2-confirm').click();await until(()=>document.body.dataset.nativePage==='dashboard');
|
||||
assert.equal(calls.find(c=>c.path==='passport/auth/login').body.password,'synthetic-password');
|
||||
});
|
||||
test('a delayed coupon response cannot reopen a purchase modal on a different page',async()=>{
|
||||
await go('plans');document.querySelector('[data-action=buy]').click();await until(()=>document.querySelector('#coupon_modal.show'));
|
||||
const form=document.querySelector('[data-form=purchase-coupon]');form.querySelector('[name=coupon_code]').value='QA';
|
||||
form.dispatchEvent(new window.Event('submit',{bubbles:true,cancelable:true}));await until(()=>delayedCoupon);
|
||||
await go('profile');delayedCoupon();await new Promise(resolve=>setTimeout(resolve,50));
|
||||
assert.equal(document.querySelector('#order_modal.show'),null);assert.equal(document.body.dataset.nativePage,'profile');
|
||||
assert.equal(calls.filter(c=>c.path==='user/order/save').length,0);
|
||||
});
|
||||
test('canceling the source-style subscription reset never calls the reset API',async()=>{
|
||||
document.querySelector('[data-target="#sublink-modal"]').click();await until(()=>document.querySelector('#sublink-modal.show'));
|
||||
document.querySelector('[data-action=reset-security]').click();await until(()=>document.querySelector('.swal2-cancel'));
|
||||
document.querySelector('.swal2-cancel').click();await new Promise(resolve=>setTimeout(resolve,20));
|
||||
assert.equal(calls.some(c=>c.path==='user/resetSecurity'),false);
|
||||
});
|
||||
test('leaving during the original modal transition leaves no late component errors',async()=>{
|
||||
await go('plans');document.querySelector('[data-action=buy]').click();
|
||||
await go('profile');await new Promise(resolve=>setTimeout(resolve,700));
|
||||
assert.deepEqual(jsErrors.map(e=>e.message),[]);
|
||||
});
|
||||
test('manual renewal of an off-sale owned plan keeps the actual XB plan and period',async()=>{
|
||||
await go('myplan');const renewal=document.querySelector('.card-header .dropdown-item');assert.ok(renewal);
|
||||
renewal.click();await until(()=>document.body.dataset.nativePage==='purchase');
|
||||
const form=document.querySelector('[data-form=purchase]');form.dispatchEvent(new window.Event('submit',{bubbles:true,cancelable:true}));
|
||||
await until(()=>document.body.dataset.nativePage==='checkout');
|
||||
assert.deepEqual(calls.find(c=>c.path==='user/order/save').body,{plan_id:2,period:'month_price'});
|
||||
});
|
||||
test.after(()=>{window.Pace.stop();dom.window.close();});
|
||||
@@ -0,0 +1,21 @@
|
||||
// Run only when updating the Fuc runtime bundles. Never modifies shared dependencies.
|
||||
import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
import {createRequire} from 'node:module';
|
||||
import {fileURLToPath} from 'node:url';
|
||||
import {createHash} from 'node:crypto';
|
||||
const root=fileURLToPath(new URL('../../',import.meta.url));
|
||||
const require=createRequire(path.join(root,'theme/package.json'));
|
||||
const versions={esbuild:'0.25.12',qrcode:'1.5.4',marked:'15.0.12',dompurify:'3.4.17'};
|
||||
for(const [name,version] of Object.entries(versions)){
|
||||
const actual=JSON.parse(fs.readFileSync(path.join(root,'theme/node_modules',name,'package.json'),'utf8')).version;
|
||||
if(actual!==version)throw Error(`${name}: expected ${version}, found ${actual}; review dependency update first`);
|
||||
}
|
||||
const {build}=require('esbuild');const output=path.join(root,'theme/Fuc/assets/vendor');fs.mkdirSync(output,{recursive:true});
|
||||
for(const [name,contents] of Object.entries({qrcode:"export {default} from 'qrcode/lib/browser.js';",richtext:"export {marked} from 'marked'; export {default as DOMPurify} from 'dompurify';"})){
|
||||
await build({stdin:{contents,resolveDir:path.join(root,'theme')},bundle:true,format:'esm',platform:'browser',minify:true,outfile:path.join(output,name+'.mjs')});
|
||||
}
|
||||
for(const [name,file] of [['qrcode','license'],['marked','LICENSE.md'],['dompurify','LICENSE']])fs.copyFileSync(path.join(root,'theme/node_modules',name,file),path.join(output,name+'.LICENSE'));
|
||||
const hashes=Object.fromEntries(['qrcode.mjs','richtext.mjs'].map(name=>[name,createHash('sha256').update(fs.readFileSync(path.join(output,name))).digest('hex')]));
|
||||
fs.writeFileSync(path.join(output,'manifest.json'),JSON.stringify({versions,sha256:hashes},null,2)+'\n');
|
||||
console.log('Fuc vendor bundles and license provenance updated');
|
||||
@@ -1,7 +1,39 @@
|
||||
import test from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import {createApi, soldOut, safeUrl, bytes, money} from '../../theme/Fuc/assets/core.mjs';
|
||||
import {createApi, soldOut, safeUrl, bytes, money, paymentResult, routeFromHash,trafficSummary,canPurchase} from '../../theme/Fuc/assets/core.mjs';
|
||||
import {subscriptionUrl,importUrl} from '../../theme/Fuc/assets/subscription.mjs';
|
||||
const response = (body,status=200) => ({ok:status<400,status,json:async()=>body});
|
||||
test('owned renewal is not blocked by new-sale capacity, and reset requires ownership',()=>{
|
||||
const plan={id:7,show:false,sell:false,renew:true,capacity_limit:'Sold out',month_price:1200,reset_price:100};
|
||||
assert.equal(canPurchase(plan,{plan_id:7},'month_price'),true);
|
||||
assert.equal(canPurchase(plan,{plan_id:8},'month_price'),false);
|
||||
assert.equal(canPurchase({...plan,renew:false},{plan_id:7},'month_price'),false);
|
||||
assert.equal(canPurchase(plan,{plan_id:7},'reset_price'),true);
|
||||
assert.equal(canPurchase(plan,{plan_id:8},'reset_price'),false);
|
||||
});
|
||||
test('an expired response from a previous token cannot discard a newer login',async()=>{
|
||||
let token='Bearer old',resolve,cleared=false;
|
||||
const api=createApi({getToken:()=>token,onUnauthorized:()=>cleared=true,fetcher:()=>new Promise(done=>resolve=done)});
|
||||
const pending=api('user/info');token='Bearer new';resolve(response({message:'未登录'},401));
|
||||
await assert.rejects(pending);assert.equal(cleared,false);
|
||||
});
|
||||
test('today traffic uses rated XB bytes once and keeps donut slices consistent',()=>{
|
||||
const now=new Date(2026,10,2,12),today=new Date(2026,10,2).getTime()/1000,yesterday=today-86400;
|
||||
const summary=trafficSummary({transfer_enable:1000,u:100,d:300},[{record_at:today,u:20,d:30,server_rate:2},{record_at:yesterday,u:50,d:100}],now);
|
||||
assert.equal(summary.today,50);assert.equal(summary.history,350);assert.equal(summary.remaining,600);assert.deepEqual(summary.series,[60,35,5]);
|
||||
assert.deepEqual(trafficSummary({transfer_enable:0},[],now).series,[0,0,0]);
|
||||
assert.equal(trafficSummary({},null,now).today,null,'failed stats are unknown, not fake zero');
|
||||
assert.equal(trafficSummary({transfer_enable:100,u:150},[{record_at:today,u:150,d:0}],now).series.reduce((a,b)=>a+b),100);
|
||||
});
|
||||
test('each subscription control uses XB flags and Trojan uses the supported type filter',()=>{
|
||||
const raw='https://subscription.example.test/s/synthetic?token=local&custom=kept';
|
||||
const trojan=new URL(subscriptionUrl(raw,'trojan'));assert.equal(trojan.searchParams.get('flag'),'general');assert.equal(trojan.searchParams.get('types'),'trojan');assert.equal(trojan.searchParams.get('custom'),'kept');
|
||||
for(const client of ['general','meta','hiddify','sing-box','shadowsocks'])assert.equal(new URL(subscriptionUrl(raw,client)).searchParams.get('flag'),client);
|
||||
assert.equal(new URL(subscriptionUrl(raw,'shadowrocket')).searchParams.get('flag'),'general');
|
||||
const clash=new URL(importUrl(raw,'meta','验收站'));assert.equal(new URL(clash.searchParams.get('url')).searchParams.get('flag'),'meta');assert.equal(clash.searchParams.get('name'),'验收站');
|
||||
const rocket=importUrl(raw,'shadowrocket');assert.equal(atob(rocket.slice('shadowrocket://add/sub://'.length)),subscriptionUrl(raw,'shadowrocket'));
|
||||
assert.throws(()=>subscriptionUrl('javascript:alert(1)','meta'));assert.throws(()=>subscriptionUrl(raw,'unsupported'));
|
||||
});
|
||||
test('uses auth_data verbatim, sends writes as JSON, unwraps Resource data',async()=>{
|
||||
let call; const api=createApi({getToken:()=> 'Bearer synthetic',fetcher:async(...args)=>{call=args;return response({status:'success',data:{id:7}});}});
|
||||
assert.deepEqual(await api('user/update',{remind_expire:1}),{id:7});
|
||||
@@ -25,7 +57,30 @@ test('stock null and positive are available, zero and localized sold-out are not
|
||||
assert.equal(soldOut({capacity_limit:100,capacity_remaining:0}),true);
|
||||
});
|
||||
test('rejects script URLs and embedded credentials; formats actual XB money and bytes',()=>{
|
||||
assert.equal(safeUrl(''), '');
|
||||
assert.equal(safeUrl('javascript:alert(1)'), ''); assert.equal(safeUrl('https://user:[email protected]'), '');
|
||||
assert.equal(safeUrl('https://example.test/sub'), 'https://example.test/sub');
|
||||
assert.equal(money(1200),'¥12.00'); assert.equal(bytes(1024**3),'1.00 GB'); assert.equal(bytes(1024**2),'1.00 MB'); assert.equal(bytes(-1),'0 B');
|
||||
});
|
||||
test('XB expired session 403 clears auth but permission denial does not',async()=>{
|
||||
for(const [message,expected] of [['未登录或登陆已过期',true],['没有权限',false]]){
|
||||
let cleared=false;
|
||||
await assert.rejects(createApi({onUnauthorized:()=>cleared=true,fetcher:async()=>response({message},403)})('user/info'));
|
||||
assert.equal(cleared,expected);
|
||||
}
|
||||
});
|
||||
test('payment contracts distinguish QR, redirects, form and successful settlement',()=>{
|
||||
assert.deepEqual(paymentResult({type:0,data:'alipay://pay/test'}),{kind:'qr',value:'alipay://pay/test'});
|
||||
assert.equal(paymentResult({type:1,data:'https://example.test/pay'}).kind,'url');
|
||||
assert.equal(paymentResult({type:1,data:'<form action="https://example.test/pay"></form>'}).kind,'form');
|
||||
assert.equal(paymentResult({type:-1,data:true}).kind,'complete');
|
||||
for(const result of [{type:-1,data:false},{type:0,data:''},{type:1,data:'javascript:alert(1)'},{type:1,data:'https://u:[email protected]/'},{type:9,data:true}])assert.throws(()=>paymentResult(result));
|
||||
});
|
||||
test('detail routes survive legacy aliases and email-login query parsing',()=>{
|
||||
assert.equal(routeFromHash('#/ticket/123').name,'ticket');
|
||||
assert.equal(routeFromHash('#/ticket').name,'tickets');
|
||||
assert.equal(routeFromHash('#/order/no').name,'checkout');
|
||||
assert.equal(routeFromHash('#/order').name,'orders');
|
||||
assert.equal(routeFromHash('#/shop').name,'plans');
|
||||
assert.equal(routeFromHash('#/login?verify=abc&redirect=dashboard').query.get('verify'),'abc');
|
||||
});
|
||||
@@ -0,0 +1,135 @@
|
||||
// Static DOM contract tests, not a substitute for browser or provider acceptance.
|
||||
import test from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import fs from 'node:fs/promises';
|
||||
import {JSDOM} from '../../codex/output/fuc-theme/test-tools/node_modules/jsdom/lib/api.js';
|
||||
const dom=new JSDOM('<!doctype html><html><head></head><body></body></html>',{url:'http://xb.loc/'});
|
||||
for(const key of ['window','document','DOMParser','localStorage'])globalThis[key]=dom.window[key];
|
||||
globalThis.fetch=async url=>({ok:true,text:()=>fs.readFile(new URL(url),'utf8'),json:async()=>JSON.parse(await fs.readFile(new URL(url),'utf8'))});
|
||||
const {paymentForm,showPayment}=await import('../../theme/Fuc/assets/payments.mjs');
|
||||
const {richText}=await import('../../theme/Fuc/assets/content.mjs');
|
||||
const {copyText}=await import('../../theme/Fuc/assets/clipboard.mjs');
|
||||
const native=await import('../../theme/Fuc/assets/native.mjs');await native.nativeReady;
|
||||
test('VIP uses the original dashboard card and displays cumulative, level and next discount',()=>{
|
||||
const user={email:'[email protected]',vip:{enabled:true,name:'小福',cumulative_cents:10000,discount_percent:8,next_level:{name:'中福'},remaining_cents:10000}};
|
||||
const host=document.createElement('div');host.innerHTML=native.nativeDashboard(user,{plan_id:1,plan:{name:'套餐'},transfer_enable:100,u:0,d:0,expired_at:2000000000},[],'福云',v=>v);
|
||||
const card=host.querySelector('.card-stats .col');assert.equal(card.querySelector('span.h3').textContent,'小福');assert.match(card.textContent,/累计支付:¥ 100.00/);assert.match(card.querySelector('[data-vip-progress]').textContent,/9.2 折.*距中福还差 ¥100.00/);
|
||||
const off=document.createElement('div');off.innerHTML=native.nativeDashboard({email:'[email protected]'},{plan:{name:'套餐'}},[],'福云',v=>v);assert.equal(off.querySelector('[data-vip-progress]'),null);
|
||||
});
|
||||
test('payment HTML rebuild excludes scripts, handlers and unsafe actions',()=>{
|
||||
const form=paymentForm('<form action="https://pay.example.test/checkout" method="post" onsubmit="bad()"><input name="signature" value="signed"><input name="bad" type="file"><script>bad()</script></form>');
|
||||
assert.equal(form.method,'post');assert.equal(form.target,'_blank');assert.equal(form.querySelector('[name=signature]').value,'signed');
|
||||
assert.equal(form.querySelector('script,[onsubmit],input[type=file]'),null);
|
||||
assert.throws(()=>paymentForm('<form action="javascript:bad()"></form>'));
|
||||
assert.throws(()=>paymentForm('<form action="https://u:[email protected]/"></form>'));
|
||||
});
|
||||
test('payment redirect is explicit and never reports completed before settlement',async()=>{
|
||||
const container=document.createElement('div');
|
||||
assert.equal(await showPayment({type:1,data:'https://pay.example.test/'},container),false);
|
||||
assert.equal(container.querySelector('a').rel,'noopener noreferrer');
|
||||
assert.equal(await showPayment({type:-1,data:true},container),true);
|
||||
});
|
||||
test('copy succeeds with original HTTP fallback, cleans selection field and prefers modern clipboard',async()=>{
|
||||
let copied='';document.execCommand=action=>{assert.equal(action,'copy');copied=document.activeElement.value;return true;};
|
||||
await copyText('synthetic local link',{clipboard:undefined,document});
|
||||
assert.equal(copied,'synthetic local link');assert.equal(document.querySelector('textarea'),null);
|
||||
await copyText('modern local link',{clipboard:{writeText:async value=>copied=value},document});
|
||||
assert.equal(copied,'modern local link');delete document.execCommand;
|
||||
});
|
||||
test('knowledge Markdown renders tables and safe links after native template binding',()=>{
|
||||
const html=native.nativeSecondary('article',{user:{},sub:{},data:{title:'Guide',body:'## Guide\n\n[Documentation](https://docs.example.test/)\n\n| A | B |\n| - | - |\n| 1 | 2 |\n\n<img src="https://img.example.test/a.png" onerror="bad()"><script>bad()</script>'},richText,config:{}});
|
||||
const view=new DOMParser().parseFromString(html,'text/html');
|
||||
assert.equal(view.querySelector('[data-fuc-richtext] a').href,'https://docs.example.test/');
|
||||
assert.ok(view.querySelector('[data-fuc-richtext] table'));
|
||||
assert.equal(view.querySelector('script,[onerror]'),null);
|
||||
assert.equal(view.querySelector('[data-fuc-richtext] img').src,'https://img.example.test/a.png');
|
||||
});
|
||||
test('home shows only actual plans, with real available period and zero price',()=>{
|
||||
const html=native.nativeHome([{name:'Annual',year_price:12000,transfer_enable:10},{name:'Free',month_price:0,transfer_enable:1}],'QA');
|
||||
const view=new DOMParser().parseFromString(html,'text/html');
|
||||
assert.equal(view.querySelectorAll('#pricing .pricing').length,2);
|
||||
assert.match(view.querySelectorAll('.pricing-price')[0].textContent,/120.00.*年付/s);
|
||||
assert.match(view.querySelectorAll('.pricing-price')[1].textContent,/0.00.*月付/s);
|
||||
assert.equal(new DOMParser().parseFromString(native.nativeHome([],'QA'),'text/html').querySelectorAll('#pricing .pricing').length,0);
|
||||
const loggedIn=new DOMParser().parseFromString(native.nativeHome([],'QA',true),'text/html');assert.equal(loggedIn.querySelector('.nav-btn').getAttribute('href'),'#/dashboard');assert.match(loggedIn.querySelector('.nav-btn').textContent,/用户中心/);
|
||||
});
|
||||
test('community link comes from XB config and never inherits the FUC channel',()=>{
|
||||
const parse=config=>new DOMParser().parseFromString(native.nativeHeader({},'QA','dashboard',config),'text/html');
|
||||
const link=doc=>[...doc.querySelectorAll('a')].find(n=>n.textContent.includes('加入 Telegram'));
|
||||
assert.equal(link(parse({})).hasAttribute('href'),false);
|
||||
const configured=link(parse({telegram_discuss_link:'https://t.me/example_test_channel'}));
|
||||
assert.equal(configured.href,'https://t.me/example_test_channel');assert.equal(configured.hasAttribute('data-action'),false);
|
||||
assert.equal(link(parse({telegram_discuss_link:'javascript:alert(1)'})).hasAttribute('href'),false);
|
||||
});
|
||||
test('panel settings retain saved palette, mode and collapsed menu after template serialization',()=>{
|
||||
localStorage.setItem('fuc_themeLight','winter');localStorage.setItem('fuc_themeMod','dark');localStorage.setItem('fuc_menuToggle','close');
|
||||
try{const view=new DOMParser().parseFromString(native.nativeHeader({},'QA','plans'),'text/html');
|
||||
assert.equal(view.querySelector('#themeLight').value,'winter');assert.equal(view.querySelector('#themeMod').value,'dark');assert.equal(view.querySelector('#menuToggle').value,'close');
|
||||
assert.ok(view.querySelector('.dropdown-user .dropdown-menu [data-target="#panel-option-modal"]'),'mobile users can open panel settings from their account menu');
|
||||
}finally{localStorage.clear();}
|
||||
});
|
||||
test('native header restores the original light/dark menu scheme without conflicting classes',()=>{
|
||||
try{for(const mode of ['light','dark']){
|
||||
document.documentElement.dataset.color=mode;const view=new DOMParser().parseFromString(native.nativeHeader({},'QA','plans'),'text/html'),menu=view.querySelector('.main-menu');
|
||||
assert.equal(menu.classList.contains('menu-light'),mode==='light');assert.equal(menu.classList.contains('menu-dark'),mode==='dark');
|
||||
}}finally{delete document.documentElement.dataset.color;}
|
||||
});
|
||||
test('auth removes unsupported 2FA and optional verification without weakening required fields',()=>{
|
||||
const login=new DOMParser().parseFromString(native.nativeAuth('login','QA',{}),'text/html');
|
||||
assert.equal(login.querySelector('[id="2fa-form"]'),null);assert.equal(login.querySelector('[name=password]').required,true);
|
||||
for(const required of [0,1]){const view=new DOMParser().parseFromString(native.nativeAuth('register','QA',{is_email_verify:required}),'text/html');assert.equal(!!view.querySelector('[name=email_code]'),!!required);}
|
||||
});
|
||||
test('dashboard retains source empty-subscription state and profile does not invent FUC user level',()=>{
|
||||
const view=new DOMParser().parseFromString(native.nativeDashboard({},{},[],'QA',richText,[]),'text/html');
|
||||
assert.equal(view.querySelector('#donut-chart').hidden,true);assert.match(view.body.textContent,/无可用流量/);
|
||||
assert.ok(view.querySelector('[data-action=subscription-unavailable]'));
|
||||
const checkin=view.querySelector('button[title="本站未开放签到"]');assert.equal(checkin.disabled,true);assert.doesNotMatch(checkin.textContent,/已签到/);
|
||||
const profile=new DOMParser().parseFromString(native.nativeSecondary('profile',{sub:{plan:{name:'Long plan is not an account level'}},richText}),'text/html');
|
||||
assert.equal(profile.querySelector('.card-profile-stats .heading').textContent,'—');
|
||||
});
|
||||
test('shop mirrors source plan-group tabs with period cards and original purchase modals',()=>{
|
||||
const plans=[{id:1,name:'轻量套餐',month_price:1200,year_price:12000,reset_price:500,transfer_enable:100},{id:2,name:'标准套餐',month_price:0,transfer_enable:10}];
|
||||
const html=native.nativeSecondary('plans',{user:{plan_id:2},sub:{},data:plans,period:'plan-1',richText,config:{}});
|
||||
const view=new DOMParser().parseFromString(html,'text/html');
|
||||
assert.deepEqual([...view.querySelectorAll('.shop_tab span')].map(n=>n.textContent),['轻量套餐','标准套餐']);
|
||||
const group=view.getElementById('top-home-plan-1');assert.equal(group.classList.contains('show'),true);
|
||||
assert.deepEqual([...group.querySelectorAll('[data-action=buy]')].map(n=>[n.dataset.id,n.dataset.period]),[['1','month_price'],['1','year_price']]);
|
||||
assert.equal(view.querySelector('#coupon_modal [name=coupon_code]').required,false);
|
||||
assert.equal(view.querySelector('#order_modal form').dataset.form,'purchase');
|
||||
assert.equal(view.querySelector('#pay-confirm').closest('[data-action]'),null,'submit must not inherit an unrelated banner action');
|
||||
native.fillPurchaseModal(view,plans[0],'year_price','QA');
|
||||
assert.equal(view.querySelector('#order_modal [name=coupon_code]').value,'QA');
|
||||
assert.match(view.querySelector('#shop_time').textContent,/365/);
|
||||
assert.equal(view.querySelector('#autorenew').disabled,true);
|
||||
assert.doesNotMatch(view.querySelector('.selling-slide').textContent,/—GB|满—元/);
|
||||
assert.match(group.querySelector('.pricing-content').textContent,/跟随系统设置/);
|
||||
});
|
||||
test('current-plan renewal uses the authorized XB plan and preserves all configured periods',()=>{
|
||||
const renewPlan={id:7,name:'Existing',sell:false,show:false,renew:true,capacity_limit:'Sold out',month_price:1200,year_price:12000,reset_price:100};
|
||||
const view=new DOMParser().parseFromString(native.nativeSecondary('myplan',{user:{plan_id:7},sub:{plan:renewPlan},data:[],renewPlan,richText}),'text/html');
|
||||
assert.deepEqual([...view.querySelectorAll('.card-header .dropdown-item')].map(n=>n.getAttribute('href')),['#/purchase/7?period=month_price','#/purchase/7?period=year_price','#/purchase/7?period=reset_price']);
|
||||
assert.equal(view.querySelector('.card-header h4').textContent,'Existing');
|
||||
});
|
||||
test('captcha contracts cover Turnstile, v2, v3, expiration and disposal with SDK doubles',async()=>{
|
||||
const {createCaptcha}=await import('../../theme/Fuc/assets/captcha.mjs');
|
||||
const original=document.head.append.bind(document.head);document.head.append=node=>{original(node);queueMicrotask(()=>node.onload?.());};
|
||||
try{
|
||||
for(const [type,key,field] of [['turnstile','turnstile_site_key','turnstile_token'],['recaptcha','recaptcha_site_key','recaptcha_data'],['recaptcha-v3','recaptcha_v3_site_key','recaptcha_v3_token']]){
|
||||
let callbacks;const sdk={ready:fn=>fn(),render:(el,options)=>{callbacks=options;return 0;},execute:async()=> 'synthetic-token',reset:()=>{},remove:()=>{}};
|
||||
window.turnstile=sdk;window.grecaptcha=sdk;
|
||||
const container=document.createElement('div');document.body.append(container);
|
||||
const captcha=createCaptcha({is_captcha:1,captcha_type:type,[key]:'test-key'},container);
|
||||
if(type!=='recaptcha-v3'){await assert.rejects(captcha.payload(),/请先完成/);callbacks.callback('synthetic-token');}
|
||||
assert.deepEqual(await captcha.payload(),{[field]:'synthetic-token'});
|
||||
if(callbacks){callbacks['expired-callback']();await assert.rejects(captcha.payload(),/请先完成/);}
|
||||
captcha.dispose();await assert.rejects(captcha.payload(),/页面已切换/);container.remove();
|
||||
}
|
||||
}finally{document.head.append=original;}
|
||||
});
|
||||
test('Stripe hosted card tokenization passes only SDK token and destroys card',async()=>{
|
||||
const {mountCard}=await import('../../theme/Fuc/assets/payments.mjs');let destroyed=false;
|
||||
const original=document.head.append.bind(document.head);document.head.append=node=>{original(node);queueMicrotask(()=>node.onload?.());};
|
||||
window.Stripe=()=>({elements:()=>({create:()=>({mount:()=>{},destroy:()=>destroyed=true})}),createToken:async()=>({token:{id:'tok_test_only'}})});
|
||||
const container=document.createElement('div');document.body.append(container);
|
||||
try{const card=await mountCard(async()=> 'pk_test_fixture',1,container);assert.equal(await card.token(),'tok_test_only');card.dispose();assert.equal(destroyed,true);}finally{document.head.append=original;container.remove();}
|
||||
});
|
||||
@@ -18,6 +18,8 @@ function source($path) {
|
||||
$text=preg_replace('/<!--.*?-->/s','',$text);
|
||||
$text=preg_replace('/<script\b[^>]*>.*?<\/script>/is','',$text);
|
||||
$text=str_replace("{include file='brand/head.tpl'}",file_get_contents('/Users/hellcat/Documents/GemCodes/fuc-new.loc/resources/views/tabler/brand/head.tpl'),$text);
|
||||
// XB has no automatic-renewal quote. Keep this optional source include inert.
|
||||
$text=preg_replace("/^[\\t ]*\\{include file='user\\/plan\\/renewal_quote\\.tpl'\\}[\\t ]*$/m",'',$text);
|
||||
$text=preg_replace('/\{include[^}]*\}/','',$text);
|
||||
// Keep the data output branch, without comparing placeholder strings.
|
||||
$text=preg_replace('/\{if \$user->LastusedTrafficPercent\(\) < \'1\'\}.*?\{else\}(.*?)\{\/if\}/s','$1',$text);
|
||||
|
||||
@@ -6,7 +6,7 @@ DOMAIN='xb.loc'
|
||||
HOSTS=Path('/etc/hosts')
|
||||
CONF=Path('/usr/local/etc/nginx/servers/xb.loc.conf')
|
||||
NGINX='/usr/local/bin/nginx'
|
||||
CONTENT='''# Isolated XB Fuc theme preview. Synthetic data only.
|
||||
CONTENT='''# Isolated XB Fuc theme preview. Dedicated Fuc acceptance instance; no DPL/HN data.
|
||||
server {
|
||||
listen 127.0.0.1:80;
|
||||
listen [::1]:80;
|
||||
@@ -45,6 +45,6 @@ def main():
|
||||
if had_conf:shutil.copy2(backup/'xb.loc.conf',CONF)
|
||||
else:CONF.unlink()
|
||||
raise
|
||||
print('Configured http://xb.loc -> local synthetic preview on 8594; verify HTTP separately.')
|
||||
print('Configured http://xb.loc -> isolated local XB acceptance instance on 8594; verify HTTP separately.')
|
||||
print('Recovery files:',backup)
|
||||
if __name__=='__main__':main()
|
||||
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
// Isolated acceptance environment. Uses the real XB kernel, routes and services.
|
||||
// Never loads DPL/HN environment or sends external mail, payments or notifications.
|
||||
require __DIR__.'/../../vendor/autoload.php';
|
||||
$root=dirname(__DIR__,2);
|
||||
$dir=$root.'/instances/fuc-acceptance';
|
||||
if (!is_file($dir.'/.fuc-acceptance')) throw new RuntimeException('Run integration-setup.php first');
|
||||
$_SERVER['XB_INSTANCE']=$_ENV['XB_INSTANCE']='fuc-acceptance';putenv('XB_INSTANCE=fuc-acceptance');
|
||||
$app=require $root.'/bootstrap/app.php';
|
||||
$app->beforeBootstrapping(Illuminate\Foundation\Bootstrap\RegisterProviders::class,function($app)use($dir){
|
||||
$app['config']->set([
|
||||
'app.env'=>'testing','app.debug'=>false,'app.url'=>'http://xb.loc',
|
||||
'database.default'=>'sqlite','database.connections.sqlite.database'=>$dir.'/database/acceptance.sqlite',
|
||||
'cache.default'=>'file','cache.stores.redis'=>['driver'=>'file','path'=>$dir.'/storage/framework/cache/redis'],
|
||||
'session.driver'=>'file','queue.default'=>'sync','mail.default'=>'array',
|
||||
'site.theme'=>'Fuc','site.name'=>'Fuc 验收站','site.admin_only_plan_ids'=>[],
|
||||
]);
|
||||
});
|
||||
$app->make(Illuminate\Contracts\Console\Kernel::class)->bootstrap();
|
||||
Illuminate\Support\Facades\Http::preventStrayRequests();
|
||||
Illuminate\Support\Facades\Queue::fake()->except([App\Jobs\OrderHandleJob::class]);
|
||||
Illuminate\Support\Facades\Mail::fake();
|
||||
return $app;
|
||||
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
$app=require __DIR__.'/integration-bootstrap.php';
|
||||
$email=$argv[1]??'';
|
||||
if(!preg_match('/^qa-[0-9]+@example\.test$/D',$email))throw new RuntimeException('Only generated local acceptance accounts allowed');
|
||||
App\Models\User::byEmail($email)->update(['commission_balance'=>2000]);
|
||||
$suffix=explode('@',$email)[0];
|
||||
App\Models\Coupon::firstOrCreate(['code'=>$suffix],['name'=>'Local QA coupon','type'=>1,'value'=>100,'show'=>true,'started_at'=>time()-60,'ended_at'=>time()+86400,'limit_plan_ids'=>[1]]);
|
||||
$template=App\Models\GiftCardTemplate::firstOrCreate(['name'=>'Local QA balance'],['type'=>1,'status'=>true,'rewards'=>['balance'=>500],'admin_id'=>0]);
|
||||
App\Models\GiftCardCode::firstOrCreate(['code'=>$suffix],['template_id'=>$template->id,'status'=>0,'max_usage'=>1]);
|
||||
@@ -0,0 +1,6 @@
|
||||
<?php
|
||||
// Read only a code generated by this isolated test, never a real mailbox.
|
||||
$app=require __DIR__.'/integration-bootstrap.php';
|
||||
$email=$argv[1]??'';
|
||||
if(!preg_match('/^qa-[0-9]+@example\.test$/D',$email))throw new RuntimeException('Only generated local acceptance accounts allowed');
|
||||
echo Illuminate\Support\Facades\Cache::get(App\Utils\CacheKey::get('EMAIL_VERIFY_CODE',$email));
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
// Loopback only, disposable acceptance instance, not a production entry point.
|
||||
$path=parse_url($_SERVER['REQUEST_URI'],PHP_URL_PATH);
|
||||
if(str_starts_with($path,'/theme/Fuc/assets/')){
|
||||
$base=realpath(__DIR__.'/../../theme/Fuc/assets');$file=realpath($base.'/'.substr(rawurldecode($path),strlen('/theme/Fuc/assets/')));
|
||||
if(!$file||!str_starts_with($file,$base.'/')||!is_file($file)){http_response_code(404);exit;}
|
||||
$types=['mjs'=>'text/javascript','js'=>'text/javascript','css'=>'text/css','html'=>'text/html','json'=>'application/json','svg'=>'image/svg+xml','png'=>'image/png','jpg'=>'image/jpeg','woff2'=>'font/woff2','woff'=>'font/woff'];
|
||||
header('Content-Type: '.($types[pathinfo($file,PATHINFO_EXTENSION)]??'application/octet-stream'));header('Cache-Control: no-store');readfile($file);exit;
|
||||
}
|
||||
if($path!=='/'&&!str_starts_with($path,'/api/v1/')&&!str_starts_with($path,'/api/v2/')&&$path!=='/fuc-qa-admin'&&$path!=='/fuc-qa-admin/customer-service'&&!str_starts_with($path,'/customer-service/')&&!str_starts_with($path,'/admin-custom/')&&!str_starts_with($path,'/assets/admin/')&&!preg_match('#^/s/[a-f0-9]+$#D',$path)){http_response_code(404);exit;}
|
||||
if (($path !== '/customer-service/status' && str_starts_with($path, '/customer-service/')) || str_starts_with($path, '/admin-custom/') || str_starts_with($path, '/assets/admin/')) {
|
||||
$base=realpath(__DIR__.'/../../public'); $file=realpath($base.$path);
|
||||
if(!$file || !str_starts_with($file,$base.'/') || !is_file($file)){http_response_code(404);exit;}
|
||||
$types=['mjs'=>'text/javascript','js'=>'text/javascript','css'=>'text/css','json'=>'application/json','svg'=>'image/svg+xml','woff2'=>'font/woff2'];
|
||||
header('Content-Type: '.($types[pathinfo($file,PATHINFO_EXTENSION)]??'application/octet-stream'));readfile($file);exit;
|
||||
}
|
||||
$app=require __DIR__.'/integration-bootstrap.php';
|
||||
$kernel=$app->make(Illuminate\Contracts\Http\Kernel::class);
|
||||
$request=Illuminate\Http\Request::capture();$response=$kernel->handle($request);$response->send();$kernel->terminate($request,$response);
|
||||
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
$app=require __DIR__.'/integration-bootstrap.php';
|
||||
use App\Models\{User,Plan,Notice,Knowledge};
|
||||
use Illuminate\Support\Facades\DB;
|
||||
if(User::count())throw new RuntimeException('Instance is already seeded');
|
||||
admin_setting(['app_name'=>'Fuc 验收站','app_url'=>'http://xb.loc','frontend_theme'=>'Fuc','secure_path'=>'fuc-qa-admin','captcha_enable'=>0,'email_verify'=>0,'telegram_bot_enable'=>0,'commission_withdraw_method'=>['支付宝','USDT'],'commission_withdraw_limit'=>1,'mail_flow'=>['enabled'=>false],'safe_mode_enable'=>0]);
|
||||
$group=DB::table('v2_server_group')->insertGetId(['name'=>'验收组','created_at'=>time(),'updated_at'=>time()]);
|
||||
$plan=Plan::create(['name'=>'本地验收月付','group_id'=>$group,'prices'=>['monthly'=>12,'yearly'=>120,'reset_traffic'=>5],'transfer_enable'=>100,'capacity_limit'=>null,'show'=>true,'sell'=>true,'renew'=>true,'content'=>'<p>真实 XB 接口验收套餐</p>']);
|
||||
$free=Plan::create(['name'=>'本地零元开通验收','group_id'=>$group,'prices'=>['monthly'=>0],'transfer_enable'=>10,'capacity_limit'=>null,'show'=>true,'sell'=>true,'renew'=>true]);
|
||||
$user=User::create(['email'=>'[email protected]','password'=>password_hash('Fuc-QA-Only-2026!',PASSWORD_DEFAULT),'uuid'=>(string)Illuminate\Support\Str::uuid(),'token'=>bin2hex(random_bytes(16)),'balance'=>0,'commission_balance'=>2000]);
|
||||
Notice::create(['title'=>'Fuc 真实接口验收','content'=>'<p>本页面读取独立 SQLite 中的 XB 数据。</p>','show'=>1]);
|
||||
Knowledge::create(['title'=>'配置指南','category'=>'使用说明','language'=>'zh-CN','body'=>"## 订阅导入\n\n使用个人订阅链接:{{subscribeUrl}}\n\n| 客户端 | 状态 |\n| --- | --- |\n| Clash | 支持 |",'show'=>1]);
|
||||
echo "Seeded isolated account, two plans, notice and knowledge; no live data copied.\n";
|
||||
@@ -0,0 +1,15 @@
|
||||
// Node absorbs speculative idle browser connections; one PHP kernel remains isolated.
|
||||
import http from 'node:http';
|
||||
import net from 'node:net';
|
||||
import {spawn} from 'node:child_process';
|
||||
import {fileURLToPath} from 'node:url';
|
||||
const root=fileURLToPath(new URL('../../',import.meta.url));
|
||||
for(const port of [8594,8595])await new Promise((resolve,reject)=>{const probe=net.createServer();probe.once('error',reject);probe.listen(port,'127.0.0.1',()=>probe.close(resolve));});
|
||||
const php=spawn('/usr/local/bin/php',['-S','127.0.0.1:8595',root+'scripts/theme-fuc/integration-router.php'],{cwd:root,stdio:['ignore','ignore','ignore']});
|
||||
const server=http.createServer((req,res)=>{
|
||||
const upstream=http.request({hostname:'127.0.0.1',port:8595,path:req.url,method:req.method,headers:{...req.headers,connection:'close'},agent:false},response=>{res.writeHead(response.statusCode,response.headers);response.pipe(res);});
|
||||
upstream.setTimeout(30000,()=>upstream.destroy());upstream.on('error',()=>{if(!res.headersSent)res.writeHead(502);res.end('Acceptance backend unavailable');});req.on('aborted',()=>upstream.destroy());req.pipe(upstream);
|
||||
});
|
||||
let stopping=false;function stop(){if(stopping)return;stopping=true;server.close();server.closeAllConnections();php.kill();}
|
||||
process.on('SIGINT',stop);process.on('SIGTERM',stop);php.on('exit',stop);php.on('error',stop);server.on('error',stop);
|
||||
server.listen(8594,'127.0.0.1',()=>console.log('Fuc isolated XB acceptance: loopback 8594; no live data.'));
|
||||
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
// Creates only a new disposable instance. Refuses to overwrite an existing one.
|
||||
$root=dirname(__DIR__,2);$dir=$root.'/instances/fuc-acceptance';
|
||||
if(is_dir($dir))throw new RuntimeException('Acceptance instance already exists; refusing to overwrite');
|
||||
foreach(['database','bootstrap/cache','storage/framework/cache/data','storage/framework/cache/redis','storage/framework/sessions','storage/framework/views','storage/logs'] as $path)mkdir($dir.'/'.$path,0700,true);
|
||||
file_put_contents($dir.'/.fuc-acceptance','isolated-fuc-acceptance-v1');
|
||||
file_put_contents($dir.'/.env',"APP_ENV=testing\nAPP_KEY=base64:".base64_encode(random_bytes(32))."\nAPP_DEBUG=false\nAPP_URL=http://xb.loc\nDB_CONNECTION=sqlite\nDB_DATABASE=".$dir."/database/acceptance.sqlite\nCACHE_DRIVER=file\nSESSION_DRIVER=file\nQUEUE_CONNECTION=sync\nSITE_THEME=Fuc\n");chmod($dir.'/.env',0600);
|
||||
touch($dir.'/database/acceptance.sqlite');
|
||||
$app=require __DIR__.'/integration-bootstrap.php';
|
||||
$exit=Illuminate\Support\Facades\Artisan::call('migrate',['--force'=>true]);
|
||||
echo Illuminate\Support\Facades\Artisan::output();
|
||||
exit($exit);
|
||||
@@ -0,0 +1,48 @@
|
||||
// Real HTTP -> Laravel -> isolated SQLite acceptance. No external providers.
|
||||
import assert from 'node:assert/strict';
|
||||
import fs from 'node:fs';
|
||||
import {createApi} from '../../theme/Fuc/assets/core.mjs';
|
||||
const origin='http://xb.loc';let token='';const email='qa-'+Date.now()+'@example.test';const evidence=[];
|
||||
const api=createApi({getToken:()=>token,fetcher:(url,options)=>fetch(origin+url,options)});
|
||||
async function check(name,fn){await fn();evidence.push(name);console.log('PASS '+name);}
|
||||
await check('guest plans and login config',async()=>{assert.equal((await api('guest/plan/fetch')).length,2);assert.equal((await api('guest/comm/config')).app_name,'Fuc 验收站');});
|
||||
await check('invalid credentials rejected',async()=>{await assert.rejects(api('passport/auth/login',{email:'[email protected]',password:'wrong-password'}));});
|
||||
await check('real auth token and account endpoints',async()=>{const auth=await api('passport/auth/register',{email,password:'Fuc-QA-Only-2026!'});token=auth.auth_data;assert.ok(token.startsWith('Bearer '));assert.equal((await api('user/info')).email,email);assert.ok((await api('user/comm/config')).withdraw_methods.includes('支付宝'));});
|
||||
await check('templates render and protected theme files are absent',async()=>{const page=await fetch(origin);assert.match(await page.text(),/fucSettings/);assert.equal((await fetch(origin+'/theme/Fuc/dashboard.blade.php')).status,404);});
|
||||
await check('order create detail cancellation and persistent readback',async()=>{const no=await api('user/order/save',{plan_id:1,period:'month_price'});const detail=await api('user/order/detail?trade_no='+no);assert.equal(detail.total_amount,1200);assert.equal(detail.period,'month_price');await api('user/order/cancel',{trade_no:no});assert.equal(await api('user/order/check?trade_no='+no),2);});
|
||||
await check('free checkout opens real subscription',async()=>{const no=await api('user/order/save',{plan_id:2,period:'month_price'});assert.deepEqual(await api('user/order/checkout',{trade_no:no,method:0}),{type:-1,data:true});assert.equal(await api('user/order/check?trade_no='+no),3);const sub=await api('user/getSubscribe');assert.equal(sub.plan_id,2);assert.equal(sub.transfer_enable,10*1024**3);});
|
||||
await check('subscription reset changes old token',async()=>{const before=(await api('user/getSubscribe')).subscribe_url;await api('user/resetSecurity');const after=(await api('user/getSubscribe')).subscribe_url;assert.notEqual(after,before);});
|
||||
await check('subscription URL serves local Clash Meta and Sing-box output',async()=>{const sub=await api('user/getSubscribe');for(const flag of ['meta','sing-box']){const url=new URL(sub.subscribe_url);assert.equal(url.origin,origin);url.searchParams.set('flag',flag);const response=await fetch(url);assert.equal(response.status,200);const body=await response.text();assert.ok(body.length);assert.doesNotMatch(body,/<html/i);}});
|
||||
const {execFileSync}=await import('node:child_process');execFileSync('/usr/local/bin/php',['scripts/theme-fuc/integration-credit.php',email]);
|
||||
await check('coupon changes authoritative order amount and ownership is enforced',async()=>{const code=email.split('@')[0];await api('user/coupon/check',{code,plan_id:1,period:'month_price'});const no=await api('user/order/save',{plan_id:1,period:'month_price',coupon_code:code});const detail=await api('user/order/detail?trade_no='+no);assert.equal(detail.discount_amount,100);const other=await api('passport/auth/register',{email:'foreign-'+Date.now()+'@example.test',password:'Fuc-QA-Only-2026!'});const foreign=createApi({getToken:()=>other.auth_data,fetcher:(u,o)=>fetch(origin+u,o)});await assert.rejects(foreign('user/order/detail?trade_no='+no));await api('user/order/cancel',{trade_no:no});const sessions=await foreign('user/getActiveSession');assert.equal(sessions.length,1);await foreign('user/removeActiveSession',{session_id:String(sessions[0].id)});});
|
||||
await check('gift redemption credits wallet once and persists history',async()=>{const code=email.split('@')[0],before=await api('user/info');assert.equal((await api('user/gift-card/check',{code})).can_redeem,true);await api('user/gift-card/redeem',{code});assert.equal((await api('user/info')).balance,before.balance+500);assert.ok((await api('user/gift-card/history')).length);await assert.rejects(api('user/gift-card/redeem',{code}));});
|
||||
await check('invite creation and commission transfer are persisted',async()=>{await api('user/invite/save');assert.ok((await api('user/invite/fetch')).codes.length);const before=await api('user/info');await api('user/transfer',{transfer_amount:100});const after=await api('user/info');assert.equal(after.balance,before.balance+100);assert.equal(after.commission_balance,before.commission_balance-100);});
|
||||
await check('ticket create reply close',async()=>{await api('user/ticket/save',{subject:'Fuc接口验收 '+Date.now(),level:1,message:'测试工单'});const t=(await api('user/ticket/fetch'))[0];await api('user/ticket/reply',{id:t.id,message:'测试回复'});const detail=await api('user/ticket/fetch?id='+t.id);assert.equal(detail.message.length,2);await api('user/ticket/close',{id:t.id});assert.equal((await api('user/ticket/fetch?id='+t.id)).status,1);await assert.rejects(api('user/ticket/reply',{id:t.id,message:'关闭后不可回复'}));});
|
||||
await check('withdraw uses configured methods and creates finance ticket',async()=>{await assert.rejects(api('user/ticket/withdraw',{withdraw_method:'invalid',withdraw_account:'QA'}));await api('user/ticket/withdraw',{withdraw_method:'支付宝',withdraw_account:'QA-local-only'});const t=(await api('user/ticket/fetch'))[0];assert.ok(t.subject);await api('user/ticket/close',{id:t.id});});
|
||||
await check('reminders save and readback',async()=>{await api('user/update',{remind_expire:1,remind_traffic:0});assert.equal((await api('user/info')).remind_expire,true);});
|
||||
await check('knowledge notices nodes traffic and gifts contracts',async()=>{assert.ok((await api('user/notice/fetch')).length);const groups=await api('user/knowledge/fetch?language=zh-CN');const doc=Object.values(groups).flat()[0];assert.match((await api('user/knowledge/fetch?id='+doc.id)).body,/订阅导入/);assert.ok(Array.isArray(await api('user/server/fetch')));assert.ok(Array.isArray(await api('user/stat/getTrafficLog')));assert.ok(Array.isArray(await api('user/gift-card/history')));await assert.rejects(api('user/gift-card/check',{code:'invalid-qa-code'}));await assert.rejects(api('user/coupon/check',{code:'invalid-qa-code',plan_id:1,period:'month_price'}));});
|
||||
await check('password change retains current session and rejects old password',async()=>{await api('user/changePassword',{old_password:'Fuc-QA-Only-2026!',new_password:'Fuc-QA-Changed-2026!'});assert.equal((await api('user/info')).email,email);await assert.rejects(api('passport/auth/login',{email,password:'Fuc-QA-Only-2026!'}));});
|
||||
await check('email code reset revokes every old login and permits only new credentials',async()=>{
|
||||
const firstToken=token;
|
||||
const secondToken=(await api('passport/auth/login',{email,password:'Fuc-QA-Changed-2026!'})).auth_data;
|
||||
assert.equal((await api('user/getActiveSession')).length,2);
|
||||
await api('passport/comm/sendEmailVerify',{email});
|
||||
await assert.rejects(api('passport/auth/forget',{email,email_code:'wrong',password:'Fuc-QA-Reset-2026!'}));
|
||||
assert.equal((await api('user/info')).email,email);
|
||||
assert.equal((await api('user/getActiveSession')).length,2);
|
||||
const code=execFileSync('/usr/local/bin/php',['scripts/theme-fuc/integration-email-code.php',email],{encoding:'utf8'}).trim();
|
||||
assert.match(code,/^\d{6}$/);
|
||||
await api('passport/auth/forget',{email,email_code:code,password:'Fuc-QA-Reset-2026!'});
|
||||
for(const oldToken of [firstToken,secondToken]){
|
||||
let expired=false;
|
||||
const oldApi=createApi({getToken:()=>oldToken,onUnauthorized:()=>expired=true,fetcher:(u,o)=>fetch(origin+u,o)});
|
||||
await assert.rejects(oldApi('user/info'));assert.equal(expired,true);
|
||||
}
|
||||
await assert.rejects(api('passport/auth/login',{email,password:'Fuc-QA-Changed-2026!'}));
|
||||
token=(await api('passport/auth/login',{email,password:'Fuc-QA-Reset-2026!'})).auth_data;
|
||||
assert.equal((await api('user/getActiveSession')).length,1);
|
||||
await assert.rejects(api('passport/auth/forget',{email,email_code:code,password:'Another-QA-Reset-2026!'}));
|
||||
assert.equal((await api('user/info')).email,email);
|
||||
});
|
||||
await check('revoked session returns 403 and clears theme authentication',async()=>{const sessions=await api('user/getActiveSession');assert.ok(sessions.length);for(const session of sessions.sort((a,b)=>a.id-b.id))await api('user/removeActiveSession',{session_id:String(session.id)});let expired=false;const dead=createApi({getToken:()=>token,onUnauthorized:()=>expired=true,fetcher:(url,opt)=>fetch(origin+url,opt)});await assert.rejects(dead('user/info'));assert.equal(expired,true);});
|
||||
fs.mkdirSync('codex/output/fuc-theme',{recursive:true});fs.writeFileSync('codex/output/fuc-theme/integration-20261101.json',JSON.stringify({checks:evidence,passed:evidence.length,environment:'isolated XB kernel and SQLite; provider HTTP blocked, mail and other jobs faked; real OrderHandleJob allowed'},null,2));
|
||||
@@ -0,0 +1,70 @@
|
||||
// Exercise the original UI libraries in a static DOM; browser evidence is separate.
|
||||
import test from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import fs from 'node:fs';
|
||||
import {JSDOM} from '../../codex/output/fuc-theme/test-tools/node_modules/jsdom/lib/api.js';
|
||||
const dom=new JSDOM('<html><head><style>.fade{transition:opacity .15s linear}.modal.fade .modal-dialog{transition:transform .3s ease-out}.collapse:not(.show){display:none}.collapsing{transition:height .35s ease}</style></head><body><div id="app"></div></body></html>',{url:'http://xb.loc/',runScripts:'outside-only',pretendToBeVisual:true});
|
||||
for(const key of ['window','document','DOMParser','localStorage'])globalThis[key]=dom.window[key];
|
||||
globalThis.innerWidth=1280;
|
||||
const root=document.getElementById('app');
|
||||
const append=document.head.append.bind(document.head);
|
||||
document.head.append=node=>{append(node);if(node.tagName==='SCRIPT')queueMicrotask(()=>{try{window.eval(fs.readFileSync(new URL(node.src),'utf8'));node.onload?.();}catch(error){node.onerror?.(error);}});};
|
||||
const ui=await import('../../theme/Fuc/assets/interactions.mjs');await ui.interactionsReady;
|
||||
const $=window.jQuery;
|
||||
const event=(element,name)=>new Promise(resolve=>$(element).one(name,resolve));
|
||||
test('auth feedback waits for original OK confirmation and subscription reset supports cancel',async()=>{
|
||||
let finished=false;const notice=ui.authFeedback('登录成功','登录成功').then(()=>finished=true);
|
||||
await new Promise(resolve=>setTimeout(resolve,0));assert.equal(finished,false);
|
||||
assert.equal(document.querySelector('.swal2-title').innerText,'登录成功');
|
||||
assert.equal(document.querySelector('.swal2-confirm').textContent,'OK');
|
||||
document.querySelector('.swal2-confirm').click();await notice;assert.equal(finished,true);
|
||||
const confirmation=ui.confirmSubscriptionReset();await new Promise(resolve=>setTimeout(resolve,0));
|
||||
assert.equal(document.querySelector('.swal2-confirm').textContent,'确定重置');
|
||||
assert.equal(document.querySelector('.swal2-cancel').textContent,'取消');
|
||||
document.querySelector('.swal2-cancel').click();assert.equal((await confirmation).value,undefined);
|
||||
});
|
||||
test('original modal completes enter and exit before removing backdrop and body lock',async()=>{
|
||||
assert.equal($.fn.modal.Constructor.VERSION,'4.3.1','landing Bootstrap 5 must not replace user Bootstrap 4');
|
||||
root.innerHTML='<div class="modal fade" tabindex="-1"><div class="modal-dialog"><div class="modal-content"><button>Close</button></div></div></div>';
|
||||
const modal=root.firstElementChild,shown=event(modal,'shown.bs.modal');
|
||||
ui.showModal(modal);assert.equal(document.body.classList.contains('modal-open'),true);
|
||||
assert.equal($(modal).data('bs.modal')._isTransitioning,true);await shown;
|
||||
assert.equal(modal.classList.contains('show'),true);assert.equal(document.querySelectorAll('.modal-backdrop').length,1);
|
||||
const hidden=event(modal,'hidden.bs.modal');ui.hideModals(root);await hidden;
|
||||
assert.equal(document.body.classList.contains('modal-open'),false);assert.equal(document.querySelector('.modal-backdrop'),null);
|
||||
ui.disposeInteractions(root);
|
||||
});
|
||||
test('tabs retain existing nodes and use Bootstrap fade lifecycle',async()=>{
|
||||
root.innerHTML='<ul class="nav"><li><a role="tab" class="active" data-target="first" href="#">One</a></li><li><a role="tab" data-target="second" href="#">Two</a></li></ul><div><div class="tab-pane fade active show" id="first"></div><div class="tab-pane fade" id="second"></div></div>';
|
||||
const first=document.getElementById('first'),second=document.getElementById('second'),trigger=root.querySelectorAll('a')[1];
|
||||
const shown=event(trigger,'shown.bs.tab');ui.selectTab(trigger);await shown;
|
||||
assert.equal(root.querySelector('#first'),first);assert.equal(root.querySelector('#second'),second);
|
||||
assert.equal(second.classList.contains('show'),true);assert.equal(first.classList.contains('active'),false);assert.equal(trigger.getAttribute('aria-selected'),'true');
|
||||
});
|
||||
test('FAQ collapse animates height and returns to stable collapse classes',async()=>{
|
||||
root.innerHTML='<button></button><div class="collapse"><p>Content</p></div>';
|
||||
const target=root.lastElementChild,shown=event(target,'shown.bs.collapse');
|
||||
ui.toggleCollapse(target,root.firstElementChild);assert.equal(target.classList.contains('collapsing'),true);await shown;
|
||||
assert.equal(target.classList.contains('show'),true);
|
||||
assert.equal(root.firstElementChild.getAttribute('aria-expanded'),'true');
|
||||
const hidden=event(target,'hidden.bs.collapse');ui.toggleCollapse(target,root.firstElementChild);await hidden;
|
||||
assert.equal(target.className,'collapse');
|
||||
assert.equal(root.firstElementChild.getAttribute('aria-expanded'),'false');
|
||||
assert.equal(root.firstElementChild.classList.contains('collapsed'),true);
|
||||
});
|
||||
test('FAQ accordion restores the previous arrow when another answer opens',async()=>{
|
||||
root.innerHTML='<div id="faq"><button data-toggle="collapse" data-target="#one"></button><div id="one" class="collapse" data-parent="#faq"></div><button data-toggle="collapse" data-target="#two"></button><div id="two" class="collapse" data-parent="#faq"></div></div>';
|
||||
const first=root.querySelector('#one'),second=root.querySelector('#two'),buttons=root.querySelectorAll('button');
|
||||
let shown=event(first,'shown.bs.collapse');ui.toggleCollapse(first,buttons[0]);await shown;
|
||||
shown=event(second,'shown.bs.collapse');ui.toggleCollapse(second,buttons[1]);await shown;
|
||||
assert.equal(buttons[0].getAttribute('aria-expanded'),'false');assert.equal(buttons[1].getAttribute('aria-expanded'),'true');
|
||||
assert.equal(first.classList.contains('show'),false);
|
||||
});
|
||||
test('Waves is attached and mobile menu backdrop restores scroll on close',()=>{
|
||||
root.innerHTML='<div class="main-menu"><div class="main-menu-content"></div></div><button class="btn btn-primary">Action</button><a class="menu-toggle"></a>';
|
||||
document.body.className='vertical-layout vertical-overlay-menu';globalThis.innerWidth=390;
|
||||
ui.paintInteractions(root);assert.equal(root.querySelector('button').classList.contains('waves-effect'),true);
|
||||
ui.toggleMenu(root);assert.equal(document.body.style.overflow,'hidden');assert.equal(root.querySelector('.sidenav-overlay').classList.contains('d-block'),true);
|
||||
ui.toggleMenu(root);assert.equal(document.body.style.overflow,'');assert.equal(root.querySelector('.sidenav-overlay').classList.contains('d-none'),true);
|
||||
ui.disposeInteractions(root);
|
||||
});
|
||||
@@ -6,7 +6,9 @@ from pathlib import Path
|
||||
from zipfile import ZipFile, ZIP_DEFLATED
|
||||
ROOT = Path(__file__).resolve().parents[2]
|
||||
SOURCE = ROOT / 'theme/Fuc'
|
||||
FILES = ['config.json','dashboard.blade.php','assets/app.mjs','assets/core.mjs','assets/native.mjs','assets/progress.mjs']
|
||||
FILES = ['config.json','dashboard.blade.php']
|
||||
FILES += [str(p.relative_to(SOURCE)) for p in sorted((SOURCE/'assets').glob('*.mjs')) if p.is_file()]
|
||||
FILES += [str(p.relative_to(SOURCE)) for p in sorted((SOURCE/'assets/vendor').rglob('*')) if p.is_file()]
|
||||
FILES += [str(p.relative_to(SOURCE)) for p in sorted((SOURCE/'assets/native').rglob('*')) if p.is_file() and p.name != 'manifest.json']
|
||||
config = json.loads((SOURCE / 'config.json').read_text())
|
||||
output = ROOT / 'codex/output/fuc-theme' / f'Fuc-{config["version"]}.zip'
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
import test from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import fs from 'node:fs';
|
||||
import {JSDOM} from '../../codex/output/fuc-theme/test-tools/node_modules/jsdom/lib/api.js';
|
||||
import {palettes,getPalette,nativePalette,applyPalette,paintPaletteOptions,chartColors,rotateColor} from '../../theme/Fuc/assets/palettes.mjs';
|
||||
const saturationAndLightness=hex=>{const rgb=hex.slice(1).match(/../g).map(c=>parseInt(c,16)/255),max=Math.max(...rgb),min=Math.min(...rgb),d=max-min,l=(max+min)/2;return [d?d/(1-Math.abs(2*l-1)):0,l];};
|
||||
test('spring is the original green; saved cyan migrates without recoloring its user area',()=>{
|
||||
const dom=new JSDOM('<html><body></body></html>',{url:'http://xb.loc/'}),storage=dom.window.localStorage;
|
||||
for(const id of ['cyan','spring']){
|
||||
storage.setItem('fuc_themeLight',id);assert.equal(getPalette(storage),'spring');assert.equal(nativePalette(storage),'cyan');
|
||||
applyPalette(dom.window.document,storage);assert.equal(dom.window.document.documentElement.dataset.fucPalette,'spring');assert.equal(dom.window.document.documentElement.dataset.fucSeason,undefined);
|
||||
assert.deepEqual(chartColors(storage),['#7D72F1','#FF9F43','#EA5455']);
|
||||
}
|
||||
storage.setItem('fuc_themeLight','summer');applyPalette(dom.window.document,storage);assert.equal(dom.window.document.documentElement.dataset.fucSeason,'summer');
|
||||
for(const id of ['purple','unexpected']){
|
||||
storage.setItem('fuc_themeLight',id);applyPalette(dom.window.document,storage);assert.equal(getPalette(storage),'purple');assert.equal(nativePalette(storage),'purple');assert.equal(dom.window.document.documentElement.dataset.fucSeason,undefined);assert.equal(dom.window.document.documentElement.style.getPropertyValue('--season-primary'),'');
|
||||
}
|
||||
dom.window.close();
|
||||
});
|
||||
test('season accents preserve original green saturation/lightness and rotate the rocket',()=>{
|
||||
const css=fs.readFileSync(new URL('../../theme/Fuc/assets/native/seasonal.css',import.meta.url),'utf8'),colors=new Set();
|
||||
for(const [id,p] of Object.entries(palettes).filter(([,p])=>p.rotation!==undefined)){
|
||||
colors.add(p.primary);
|
||||
const a=saturationAndLightness('#52cfbc'),b=saturationAndLightness(p.primary);a.forEach((v,i)=>assert.ok(Math.abs(v-b[i])<.005,id+' HSL tone'));
|
||||
if(id!=='spring'){
|
||||
const prefix=`html[data-fuc-season=${id}]`;
|
||||
assert.ok(css.includes(prefix+' .btn-primary{background-color:'+p.button),id+' native button tone');
|
||||
assert.ok(css.includes(prefix+' .offer-slider .slide .selling-slide .shop_img img{filter:hue-rotate('+((290+p.rotation)%360)+'deg)'),id+' rocket hue');
|
||||
}
|
||||
}
|
||||
assert.equal(colors.size,4);assert.equal(rotateColor('#52cfbc',360),'#52cfbc');assert.equal(rotateColor('#f8f8f8',222),'#f8f8f8');
|
||||
});
|
||||
test('settings offer purple plus four seasons and retain saved aliases through serialization',()=>{
|
||||
const dom=new JSDOM('<div id="root"><div><select id="themeLight"></select></div><div class="form-group"><select id="themeDark"></select></div></div>',{url:'http://xb.loc/'});
|
||||
dom.window.localStorage.setItem('fuc_themeLight','cyan');paintPaletteOptions(dom.window.document.getElementById('root'),dom.window.localStorage);
|
||||
const select=dom.window.document.getElementById('themeLight');assert.equal(select.options.length,5);assert.equal(select.value,'spring');assert.equal(select.selectedOptions[0].textContent,'春 · 原版绿色');
|
||||
const roundTrip=new dom.window.DOMParser().parseFromString(dom.window.document.getElementById('root').innerHTML,'text/html');assert.equal(roundTrip.getElementById('themeLight').value,'spring');
|
||||
assert.equal(dom.window.document.getElementById('themeDark'),null);assert.equal(dom.window.document.querySelectorAll('.season-swatch').length,4);dom.window.close();
|
||||
});
|
||||
@@ -0,0 +1,67 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Rotate the original green palette's hues; preserve every saturation/lightness step."""
|
||||
from pathlib import Path
|
||||
import colorsys,re
|
||||
ROOT=Path(__file__).resolve().parents[2]
|
||||
BASE=ROOT/'theme/Fuc/assets/native'
|
||||
source=(BASE/'theme/cool/assets/css/theme/style-cyan.css').read_text()
|
||||
SEASONS={'spring':0,'summer':30,'autumn':222,'winter':65}
|
||||
def recolor(match,rotation):
|
||||
text=match.group()
|
||||
if text.startswith('#'):
|
||||
raw=text[1:]
|
||||
if len(raw) in (3,4):raw=''.join(c*2 for c in raw)
|
||||
rgb=[int(raw[i:i+2],16) for i in (0,2,4)];alpha=int(raw[6:8],16)/255 if len(raw)==8 else None
|
||||
else:
|
||||
nums=[float(v) for v in re.findall(r'[\d.]+',text)]
|
||||
rgb=nums[:3];alpha=(nums[3]/100 if '%' in text else nums[3]) if len(nums)>3 else None
|
||||
h,l,s=colorsys.rgb_to_hls(*(v/255 for v in rgb))
|
||||
if s<.2:return text
|
||||
result=[int(c*255+.5) for c in colorsys.hls_to_rgb((h+rotation/360)%1,l,s)]
|
||||
if alpha is not None:return 'rgba('+','.join(map(str,result))+','+format(alpha,'.6g')+')'
|
||||
return '#'+''.join(f'{c:02x}' for c in result)
|
||||
def rules(css,season,rotation):
|
||||
prefix=f'html[data-fuc-season={season}]' if season!='spring' else 'html[data-fuc-palette=spring] body:is(:not([data-native-mode=user]),.dark-layout)'
|
||||
out=[];pos=0
|
||||
while True:
|
||||
start=css.find('{',pos)
|
||||
if start<0:break
|
||||
header=css[pos:start].strip();end=start+1;depth=1
|
||||
while depth:
|
||||
if css[end]=='{':depth+=1
|
||||
elif css[end]=='}':depth-=1
|
||||
end+=1
|
||||
body=css[start+1:end-1];pos=end
|
||||
if header.startswith('@'):
|
||||
inner=rules(body,season,rotation)
|
||||
if inner:out.append(header+'{'+inner+'}')
|
||||
continue
|
||||
declarations=[];changed=False
|
||||
for declaration in body.split(';'):
|
||||
if ':' not in declaration:continue
|
||||
key,value=map(str.strip,declaration.split(':',1))
|
||||
# Copy only accent declarations; neutral light/dark surfaces stay native.
|
||||
if re.search(r'#[0-9a-fA-F]{3,8}\b|rgba?\(',value):
|
||||
accent=re.sub(r'#[0-9a-fA-F]{3,8}\b|rgba?\([^)]*\)',lambda m:recolor(m,1),value)!=value
|
||||
if accent:
|
||||
declarations.append(key+':'+re.sub(r'#[0-9a-fA-F]{3,8}\b|rgba?\([^)]*\)',lambda m:recolor(m,rotation),value));changed=True
|
||||
elif key=='filter' and 'hue-rotate' in value:
|
||||
declarations.append('filter:'+re.sub(r'hue-rotate\(([\d.]+)deg\)',lambda m:f'hue-rotate({(float(m[1])+rotation)%360:g}deg)',value))
|
||||
if changed:
|
||||
white=re.search(r'(?:^|;)\s*color\s*:\s*(#[fF]{3,6})(\s*!important)?\s*(?:;|$)',body)
|
||||
if white:declarations.append('color:'+white[1]+(white[2] or ''))
|
||||
if declarations:
|
||||
selectors=[]
|
||||
for s in map(str.strip,header.split(',')):
|
||||
s=s.replace('.menu-light',':is(.menu-light,.menu-dark)')
|
||||
if s in ('a','a:hover'):
|
||||
selectors.append(prefix+' :where(a:not(.btn,.nav-link,.dropdown-item,.navbar-brand))'+(':hover' if s.endswith(':hover') else ''))
|
||||
elif s==':root':selectors.append(prefix)
|
||||
elif s.startswith('html '):selectors.append(prefix+s[4:])
|
||||
else:selectors.append(prefix+' '+s)
|
||||
out.append(',\n'.join(selectors)+'{'+ ';'.join(declarations)+';}')
|
||||
return '\n'.join(out)
|
||||
extra=(ROOT/'scripts/theme-fuc/seasonal-surfaces.css').read_text()
|
||||
css=re.sub(r'/\*.*?\*/','',source,flags=re.S)
|
||||
(BASE/'seasonal.css').write_text('/* Hue rotations of original FUC green; no native layout or animation declarations. */\n'+'\n'.join(rules(css,name,rotation) for name,rotation in SEASONS.items())+'\n'+extra)
|
||||
print('PASS: seasonal colors generated from original green; spring user area uses unchanged cyan CSS')
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
/* Preserve the original neutral surfaces and dark layout; only seasonal accents change. */
|
||||
html[data-fuc-season] .bg-gradient-primary{background:linear-gradient(118deg,var(--season-deep),var(--season-bright))!important;}
|
||||
html[data-fuc-season] .custom-control-input:focus~.custom-control-label:before{box-shadow:0 0 0 .2rem rgba(var(--season-rgb),.25);}
|
||||
html[data-fuc-season] .fuc-sidebar-mark,html[data-fuc-season] .fuc-auth-mark{filter:var(--season-logo);}
|
||||
html:is([data-fuc-season],[data-fuc-palette=spring]) .native-public .hero-1{background-color:var(--season-primary);background-blend-mode:luminosity;}
|
||||
html:is([data-fuc-season],[data-fuc-palette=spring]) .native-public .navbar-brand img{filter:var(--season-logo);}
|
||||
html:is([data-fuc-season],[data-fuc-palette=spring]) .native-public #navbar:not(.nav-sticky) .navbar-brand img{filter:brightness(0) invert(1);}
|
||||
html:is([data-fuc-season],[data-fuc-palette=spring]) .native-public .bg-light{background-color:var(--season-tint)!important;}
|
||||
html:is([data-fuc-season],[data-fuc-palette=spring]) .native-public .nav-sticky .nav-link.active,html:is([data-fuc-season],[data-fuc-palette=spring]) .native-public .nav-sticky .nav-link:hover{color:var(--season-primary);}
|
||||
html:is([data-fuc-season],[data-fuc-palette=spring]) .native-public .nav-btn{background-color:var(--season-primary);border-color:var(--season-primary);color:#fff;}
|
||||
html:is([data-fuc-season],[data-fuc-palette=spring]) .native-public .pricing [style*="color:#3c2299"]{color:var(--season-primary)!important;}
|
||||
html:is([data-fuc-season],[data-fuc-palette=spring]) .native-public .btn-light{color:var(--season-primary);}
|
||||
/* Brand ink must remain legible while cached light/dark styles are prepared. */
|
||||
html:is([data-fuc-season],[data-fuc-palette=spring]) .fuc-brand-wordmark{background-color:#5e5873;}
|
||||
html:is([data-fuc-season],[data-fuc-palette=spring]) .dark-layout .fuc-brand-wordmark{background-color:#e7e5f4;}
|
||||
.season-swatch{display:inline-block;width:10px;height:10px;border-radius:50%;margin-right:6px;}
|
||||
@@ -0,0 +1,27 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Extract unchanged FUC UI libraries; exclude original business code and duplicate Pace."""
|
||||
from pathlib import Path
|
||||
import hashlib
|
||||
import json
|
||||
|
||||
source = Path('/Users/hellcat/Documents/GemCodes/fuc-new.loc/public')
|
||||
out = Path(__file__).resolve().parents[2] / 'theme/Fuc/assets/native'
|
||||
vendor = (source / 'theme/cool/assets/vendors/js/vendors.min.js').read_text()
|
||||
widgets = vendor[:vendor.index('/* Unison JS */')]
|
||||
start = vendor.index('// Waves')
|
||||
widgets += vendor[start:vendor.index('// Promises - for IE11', start)]
|
||||
files = {
|
||||
'widgets.min.js': widgets.encode(),
|
||||
'sweetalert2.min.js': (source / 'theme/cool/assets/js/scripts/sweetalert2.min.js').read_bytes(),
|
||||
'smooth-scroll.min.js': (source / 'assets/cool/smooth-scroll.polyfills.min.js').read_bytes(),
|
||||
'landing-bootstrap5.min.js': (source / 'assets/cool/bootstrap.bundle.min.js').read_bytes(),
|
||||
}
|
||||
for name, content in files.items():
|
||||
(out / name).write_bytes(content)
|
||||
(out / 'widgets-provenance.json').write_text(json.dumps({
|
||||
'source': 'fuc-new.loc/public',
|
||||
'widgets': ['jQuery 3.4.1', 'Popper', 'Bootstrap 4.3.1', 'Bootstrap 5.0.0-beta1 for original landing page', 'PerfectScrollbar 1.4.0', 'Hammer 2.0.8', 'Waves', 'SweetAlert2', 'SmoothScroll'],
|
||||
'sha256': {name: hashlib.sha256(content).hexdigest() for name, content in files.items()},
|
||||
'excludes': ['duplicate Pace', 'FUC business scripts', 'remote requests'],
|
||||
}, indent=2) + '\n')
|
||||
print('FUC original UI libraries extracted with hashes; no business scripts included')
|
||||
@@ -34,3 +34,11 @@ original=(source/'theme/cool/assets/vendors/css/vendors.min.css').read_text()
|
||||
rules=[rule.strip()+'}' for rule in original.split('}') if '.pace' in rule.split('{',1)[0]]
|
||||
assert (OUT/'pace.css').read_text()=='\n'.join(rules)+'\n'
|
||||
print('PASS: original Pace 1.0.2 script and progress CSS match FUC source')
|
||||
|
||||
expected_widgets=vendor[:vendor.index('/* Unison JS */')]
|
||||
start=vendor.index('// Waves')
|
||||
expected_widgets+=vendor[start:vendor.index('// Promises - for IE11',start)]
|
||||
assert (OUT/'widgets.min.js').read_text()==expected_widgets
|
||||
for target,original in [('sweetalert2.min.js','theme/cool/assets/js/scripts/sweetalert2.min.js'),('smooth-scroll.min.js','assets/cool/smooth-scroll.polyfills.min.js'),('landing-bootstrap5.min.js','assets/cool/bootstrap.bundle.min.js')]:
|
||||
assert (OUT/target).read_bytes()==(source/original).read_bytes()
|
||||
print('PASS: original jQuery/Popper/Bootstrap/PerfectScrollbar/Waves, SweetAlert2 and SmoothScroll match FUC source')
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
// Strictly local FUC instances only. Never invokes a production deployment.
|
||||
umask(0077);
|
||||
$root=dirname(__DIR__,2);$instance=$argv[1]??'';
|
||||
if(!in_array($instance,['fuc-acceptance','fuc-migration-test'],true))throw new RuntimeException('Only the two marked local FUC instances are allowed');
|
||||
$dir=$root.'/instances/'.$instance;
|
||||
$marker=$instance==='fuc-acceptance'?'.fuc-acceptance':'.migration-rehearsal';
|
||||
if(!is_file($dir.'/'.$marker))throw new RuntimeException('Missing local marker');
|
||||
require $root.'/vendor/autoload.php';
|
||||
$file=$dir.'/database/'.($instance==='fuc-acceptance'?'acceptance.sqlite':'rehearsal.sqlite');
|
||||
$backup=$dir.'/storage/app/vip-before-install';
|
||||
if(!is_dir($backup))mkdir($backup,0700,true);
|
||||
if(!is_file($backup.'/database.sqlite')){
|
||||
$source=new SQLite3($file,SQLITE3_OPEN_READONLY);$target=new SQLite3($backup.'/database.sqlite');
|
||||
if(!$source->backup($target))throw new RuntimeException('Backup failed');$source->close();$target->close();
|
||||
}
|
||||
$app=require $instance==='fuc-acceptance'?$root.'/scripts/theme-fuc/integration-bootstrap.php':$root.'/codex/output/fuc-migration-20261103/rehearsal-bootstrap.php';
|
||||
if(realpath(Illuminate\Support\Facades\DB::connection()->getDatabaseName())!==realpath($file))throw new RuntimeException('Wrong instance database');
|
||||
$manager=app(App\Services\Plugin\PluginManager::class);
|
||||
if(!App\Models\Plugin::where('code','vip_loyalty')->exists())$manager->install('vip_loyalty');
|
||||
$plugin=App\Models\Plugin::where('code','vip_loyalty')->firstOrFail();
|
||||
$values=array_replace(Plugin\VipLoyalty\Settings::DEFAULTS,json_decode($plugin->config,true)?:[],['enabled'=>true]);
|
||||
$values=app(Plugin\VipLoyalty\Settings::class)->validate($values);
|
||||
$plugin->config=json_encode($values);$plugin->save();$manager->enable('vip_loyalty');
|
||||
$count=0;
|
||||
if($instance==='fuc-migration-test') {
|
||||
$private=$root.'/codex/output/fuc-migration-20261103/private';$identities=[];
|
||||
foreach(file($private.'/user-projection.jsonl',FILE_IGNORE_NEW_LINES) as $line){$v=json_decode($line,true,512,JSON_THROW_ON_ERROR);$identities[$v['legacy_id']]=$v['uuid'];}
|
||||
Illuminate\Support\Facades\DB::transaction(function()use($private,$identities,&$count){
|
||||
$f=fopen($private.'/vip-opening.jsonl','r');
|
||||
try{while(($line=fgets($f))!==false){$v=json_decode($line,true,512,JSON_THROW_ON_ERROR);
|
||||
app(Plugin\VipLoyalty\Service::class)->opening($v['user_id'],$identities[$v['user_id']],$v['opening_cumulative_cents'],'18f8346061922da82075f3d1d040f51247f23432b26e29ea2bfe73d8b7117103');++$count;
|
||||
}}finally{fclose($f);}
|
||||
});
|
||||
}
|
||||
echo json_encode(['instance'=>$instance,'vip_enabled'=>app(Plugin\VipLoyalty\Service::class)->enabled(),'opening_users_checked'=>$count,'other_instances_written'=>0,'production_operations'=>0]).PHP_EOL;
|
||||
@@ -256,6 +256,55 @@ class MailFlowTest extends TestCase
|
||||
$this->assertSame('conventional', $reply->refresh()->channel);
|
||||
}
|
||||
|
||||
public function test_instance_auto_reply_view_uses_hn_brand_and_keeps_escape_headers_and_subject(): void
|
||||
{
|
||||
config(['mailflow.auto_reply_enabled'=>true,'mailflow.auto_reply_view'=>'mail.hn.autoReply',
|
||||
'mailflow.logo_path'=>base_path('resources/mail/hn/logo.png'),
|
||||
'mailflow.auto_reply_subject'=>'Original reply subject','mailflow.auto_reply_text'=>"Latest address\n<script>not executable</script>"]);
|
||||
$incoming=MailMessage::create(['message_key'=>'hn-incoming','direction'=>'in','purpose'=>'incoming','email'=>'[email protected]','subject'=>'Help','status'=>'received']);
|
||||
$reply=app(AutoReplyService::class)->prepare($incoming,['message-id'=>'<[email protected]>']);
|
||||
$this->assertNotNull($reply);$this->assertSame('Original reply subject',$reply->subject);
|
||||
$this->assertStringContainsString('Hard<span',$reply->payload['html']);
|
||||
$this->assertStringContainsString('#B4F047',$reply->payload['html']);
|
||||
$this->assertStringContainsString('<script>',$reply->payload['html']);
|
||||
$this->assertStringNotContainsString('<script>',$reply->payload['html']);
|
||||
$this->assertSame('auto-replied',$reply->payload['headers']['Auto-Submitted']);
|
||||
$this->assertSame('<[email protected]>',$reply->payload['headers']['In-Reply-To']);
|
||||
$this->assertSame(file_get_contents(base_path('resources/mail/hn/logo.png')),base64_decode($reply->payload['attachments'][0]['content']));
|
||||
$this->assertNull(app(AutoReplyService::class)->prepare($incoming,[]));
|
||||
}
|
||||
|
||||
public function test_default_auto_reply_view_remains_legacy_for_other_instances(): void
|
||||
{
|
||||
$this->assertSame('mail.default.notify',config('mailflow.auto_reply_view'));
|
||||
config(['mailflow.auto_reply_enabled'=>true]);
|
||||
$incoming=MailMessage::create(['message_key'=>'default-incoming','direction'=>'in','purpose'=>'incoming','email'=>'[email protected]','subject'=>'Help','status'=>'received']);
|
||||
$reply=app(AutoReplyService::class)->prepare($incoming,[]);
|
||||
$this->assertStringContainsString('#142542',$reply->payload['html']);
|
||||
$this->assertStringNotContainsString('Hard<span',$reply->payload['html']);
|
||||
}
|
||||
|
||||
public function test_all_six_hn_templates_render_through_mail_service_preserving_business_subject(): void
|
||||
{
|
||||
Schema::create('v2_mail_templates',function(Blueprint $t){$t->id();$t->string('name');$t->string('subject');$t->text('content');$t->timestamps();});
|
||||
Schema::create('v2_mail_log',function(Blueprint $t){$t->id();$t->string('email');$t->string('subject');$t->string('template_name');$t->text('error')->nullable();$t->integer('created_at')->nullable();$t->integer('updated_at')->nullable();});
|
||||
config(['mailflow.logo_path'=>base_path('resources/mail/hn/logo.png')]);
|
||||
$manifest=json_decode(file_get_contents(base_path('resources/mail/hn/manifest.json')),true);
|
||||
$dispatcher=Mockery::mock(Dispatcher::class);
|
||||
$dispatcher->shouldReceive('send')->times(6)->withArgs(function($params,$subject,$html){
|
||||
$this->assertSame('Preserved purpose-specific subject',$subject);
|
||||
$this->assertStringContainsString('Hard<span',$html);$this->assertStringContainsString('#B4F047',$html);
|
||||
$this->assertDoesNotMatchRegularExpression('/\{\{[A-Za-z_]/',$html);
|
||||
$this->assertStringNotContainsString('<script>',$html);$this->assertCount(1,$params['attachments']);return true;
|
||||
})->andReturn(['status'=>'submitted','error'=>null]);$this->app->instance(Dispatcher::class,$dispatcher);
|
||||
foreach($manifest['templates'] as $item){
|
||||
\App\Models\MailTemplate::create(['name'=>$item['name'],'subject'=>'','content'=>file_get_contents(base_path('resources/mail/hn/'.$item['file']))]);
|
||||
$out=\App\Services\MailService::sendEmail(['email'=>'[email protected]','subject'=>'Preserved purpose-specific subject','template_name'=>$item['name'],'purpose'=>'admin_test',
|
||||
'template_value'=>['name'=>'HardNerd','url'=>'https://example.com','link'=>'https://example.com/login','code'=>'123456','content'=>'<script>not executable</script>','content_mode'=>'text']]);
|
||||
$this->assertSame('submitted',$out['status']);$this->assertSame('db:'.$item['name'],$out['template_name']);
|
||||
}
|
||||
}
|
||||
|
||||
public function test_auto_reply_skips_automated_bulk_and_own_messages(): void
|
||||
{
|
||||
config(['mailflow.auto_reply_enabled' => true]);
|
||||
|
||||
@@ -134,6 +134,36 @@ class PaymentHealthTest extends TestCase
|
||||
$q=new QrEvidence;$body='<p>32.00</p><div id="qr"></div><script>new QRCode(document.getElementById("qr"),"weixin://wxpay/bizpayurl?pr=fixture-only")</script>';
|
||||
$this->assertTrue($q->valid($body,'wxpay',3200));$this->assertFalse($q->valid(str_replace('32.00','16.00',$body),'wxpay',3200));$this->assertFalse($q->valid('32.00 微信二维码','wxpay',3200));
|
||||
}
|
||||
public function test_cashier_requests_explicitly_accept_html_with_the_original_agent():void
|
||||
{
|
||||
Http::fake(['https://pay.airspay.top/*'=>Http::response('cashier',200)]);
|
||||
$transport=new class extends HttpsTransport {protected function publicAddress(string $host):string{return '93.184.216.34';}};
|
||||
$transport->request('POST','https://pay.airspay.top/submit.php',['money'=>'32.00']);
|
||||
Http::assertSent(fn($r)=>$r->hasHeader('Accept','text/html')&&$r->hasHeader('User-Agent','XB-PaymentHealth/1.0')&&$r['money']==='32.00');
|
||||
Http::assertSentCount(1);
|
||||
}
|
||||
public function test_wechat_https_qr_still_requires_exact_host_amount_and_rendering():void
|
||||
{
|
||||
$q=new QrEvidence;
|
||||
$body='<p>32.00</p><script>$("#qrcode").qrcode({text:"https://wxmpurl.cn/fixture-only"});</script>';
|
||||
$this->assertTrue($q->valid($body,'wxpay',3200));
|
||||
$this->assertFalse($q->valid($body,'wxpay',1600));
|
||||
$this->assertFalse($q->valid($body,'alipay',3200));
|
||||
$this->assertFalse($q->valid('32.00 https://wxmpurl.cn/fixture-only','wxpay',3200));
|
||||
foreach(['http://wxmpurl.cn/fixture','https://wxmpurl.cn.evil.invalid/fixture','https://sub.wxmpurl.cn/fixture',
|
||||
'https://wxmpurlXcn/fixture','https://[email protected]/fixture','https://[email protected]/fixture',
|
||||
'https://wxmpurl.cn:8443/fixture','https://evil.invalid/https://wxmpurl.cn/fixture',
|
||||
'https://evil.invalid/?next=https://wxmpurl.cn/fixture','https://wxmpurl.cn/','https://wxmpurl.cn/fixture#fragment']as$url){
|
||||
$this->assertFalse($q->valid(str_replace('https://wxmpurl.cn/fixture-only',$url,$body),'wxpay',3200),$url);
|
||||
}
|
||||
}
|
||||
public function test_wechat_https_cashier_is_healthy_without_following_the_qr_url():void
|
||||
{
|
||||
$body='<p>32.00</p><script>$("#qrcode").qrcode({text:"https://wxmpurl.cn/fixture-only"});location.href="https://other.example.invalid/";</script>';
|
||||
$t=new QueueTransport;$t->responses=[[200,$body]];
|
||||
$out=(new TestEpayProbe($t,new QrEvidence))->probe(Payment::find(1),'fixture-trade');
|
||||
$this->assertSame('healthy',$out['status']);$this->assertSame('fresh_cashier_qr',$out['reason']);$this->assertCount(1,$t->calls);
|
||||
}
|
||||
private function qrPng(int $pixels):string
|
||||
{
|
||||
$matrix=\BaconQrCode\Encoder\Encoder::encode('alipays://platformapi/startapp?appId=fixture-only',\BaconQrCode\Common\ErrorCorrectionLevel::M())->getMatrix();
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
namespace Tests\Feature\VipLoyalty;
|
||||
// Run the existing native order/gift-card race regressions in memory, without VIP installed.
|
||||
class NativeOrderRegressionTest extends \Tests\Unit\Services\OrderServiceConcurrencyTest {
|
||||
public function createApplication() {
|
||||
$app=require dirname(__DIR__,3).'/bootstrap/app.php';
|
||||
$app->beforeBootstrapping(\Illuminate\Foundation\Bootstrap\RegisterProviders::class,function($app){
|
||||
$app->instance('env','testing');
|
||||
$app['config']->set(['app.env'=>'testing','database.default'=>'sqlite','database.connections.sqlite.database'=>':memory:',
|
||||
'cache.default'=>'array','cache.stores.redis'=>['driver'=>'array'],'mail.default'=>'array','queue.default'=>'sync']);
|
||||
});
|
||||
$app->make(\Illuminate\Contracts\Console\Kernel::class)->bootstrap();return $app;
|
||||
}
|
||||
protected function beforeRefreshingDatabase(): void {
|
||||
\Illuminate\Support\Facades\DB::purge('sqlite');
|
||||
\Illuminate\Support\Facades\Cache::forgetDriver(['redis','array']);
|
||||
\Illuminate\Support\Facades\Http::preventStrayRequests();
|
||||
\Illuminate\Support\Facades\Mail::fake();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,149 @@
|
||||
<?php
|
||||
namespace Tests\Feature\VipLoyalty;
|
||||
use App\Models\{User,Plan,Order,Plugin};
|
||||
use App\Services\OrderService;
|
||||
use App\Services\Plugin\{HookManager,PluginManager};
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Illuminate\Support\Facades\{DB,Cache,Http,Mail,Queue};
|
||||
use Illuminate\Contracts\Console\Kernel;
|
||||
use Plugin\VipLoyalty\{Service,Settings};
|
||||
use Tests\TestCase;
|
||||
class VipLoyaltyTest extends TestCase {
|
||||
use RefreshDatabase;
|
||||
public function createApplication() {
|
||||
$app=require dirname(__DIR__,3).'/bootstrap/app.php';
|
||||
$app->beforeBootstrapping(\Illuminate\Foundation\Bootstrap\RegisterProviders::class,function($app){
|
||||
$app->instance('env','testing');
|
||||
$app['config']->set(['app.env'=>'testing','database.default'=>'sqlite','database.connections.sqlite.database'=>':memory:',
|
||||
'cache.default'=>'array','cache.stores.redis'=>['driver'=>'array'],'mail.default'=>'array','queue.default'=>'sync']);
|
||||
});
|
||||
$app->make(Kernel::class)->bootstrap();return $app;
|
||||
}
|
||||
protected function beforeRefreshingDatabase(): void {
|
||||
DB::purge('sqlite');Cache::forgetDriver(['array','redis']);Http::preventStrayRequests();Mail::fake();Queue::fake();
|
||||
}
|
||||
protected function setUp(): void {
|
||||
parent::setUp();HookManager::reset();
|
||||
(require base_path('plugins/VipLoyalty/database/migrations/2026_11_03_000001_create_vip_loyalty_tables.php'))->up();
|
||||
app()->forgetInstance(\App\Support\Setting::class);Cache::flush();
|
||||
}
|
||||
private function enable(array $config=[]): Service {
|
||||
Plugin::updateOrCreate(['code'=>'vip_loyalty'],['name'=>'VIP','version'=>'1.0.0','type'=>'feature','is_enabled'=>true,'config'=>json_encode(array_replace(Settings::DEFAULTS,['enabled'=>true],$config))]);
|
||||
app()->register(\Plugin\VipLoyalty\Providers\PluginServiceProvider::class);
|
||||
(new \Plugin\VipLoyalty\Plugin('vip_loyalty'))->boot();return app(Service::class);
|
||||
}
|
||||
private function user(array $attrs=[]): User {return User::create($attrs+['email'=>bin2hex(random_bytes(6)).'@example.test','password'=>password_hash('private-test-password',PASSWORD_BCRYPT),'uuid'=>(string)\Illuminate\Support\Str::uuid(),'token'=>bin2hex(random_bytes(16)),'balance'=>0,'u'=>0,'d'=>0,'expired_at'=>0]);}
|
||||
private function plan(int $price=100): Plan {return Plan::create(['name'=>'VIP test','prices'=>['monthly'=>$price,'onetime'=>$price,'reset_traffic'=>5],'transfer_enable'=>100,'show'=>true,'sell'=>true,'renew'=>true,'reset_traffic_method'=>2]);}
|
||||
private function processing(User $u,Plan $p,array $attrs=[]): Order {return Order::create($attrs+['user_id'=>$u->id,'plan_id'=>$p->id,'trade_no'=>bin2hex(random_bytes(12)),'type'=>Order::TYPE_NEW_PURCHASE,'period'=>'monthly','status'=>Order::STATUS_PROCESSING,'total_amount'=>10000,'paid_at'=>time()]);}
|
||||
private function cumulative(User $u): int {return (int)DB::table('fuc_vip_accounts')->where('user_id',$u->id)->value('cumulative_cents');}
|
||||
public function test_default_install_and_feature_switch_are_off(): void {
|
||||
$this->assertFalse(app(Service::class)->enabled());
|
||||
\Illuminate\Support\Facades\Schema::drop('fuc_vip_entries');\Illuminate\Support\Facades\Schema::drop('fuc_vip_accounts');
|
||||
app(PluginManager::class)->install('vip_loyalty');
|
||||
$this->assertFalse(Plugin::where('code','vip_loyalty')->first()->is_enabled);
|
||||
Plugin::where('code','vip_loyalty')->update(['is_enabled'=>true]);
|
||||
(new \Plugin\VipLoyalty\Plugin('vip_loyalty'))->boot();$this->assertFalse(app(Service::class)->enabled());
|
||||
$u=$this->user(['discount'=>5]);$o=$this->processing($u,$this->plan());(new OrderService($o))->open();
|
||||
$this->assertSame(0,DB::table('fuc_vip_entries')->count());$this->assertSame(5,$u->fresh()->discount);
|
||||
}
|
||||
public function test_original_discount_next_purchase_and_upgrade_example(): void {
|
||||
$s=$this->enable();$u=$this->user(['balance'=>100000]);$s->opening($u->id,$u->uuid,10000,str_repeat('a',64));
|
||||
$p=$this->plan(300);$o=OrderService::createFromRequest($u,$p,'monthly');
|
||||
$this->assertEquals(27600,$o->balance_amount);$this->assertEquals(0,$o->total_amount);
|
||||
$o->status=Order::STATUS_PROCESSING;$o->save();(new OrderService($o))->open();
|
||||
$this->assertSame(37600,$this->cumulative($u));$this->assertSame(15,$u->fresh()->discount);
|
||||
$this->assertEquals(2400,$o->fresh()->discount_amount);
|
||||
$next=OrderService::createFromRequest($u->fresh(),$p,'monthly');$this->assertEquals(25500,$next->balance_amount);
|
||||
}
|
||||
public function test_threshold_crossing_does_not_reprice_current_order(): void {
|
||||
$s=$this->enable();$u=$this->user(['balance'=>100000]);$s->opening($u->id,$u->uuid,9900,str_repeat('b',64));
|
||||
$o=OrderService::createFromRequest($u,$this->plan(2),'monthly');$this->assertEquals(200,$o->balance_amount);
|
||||
$o->status=1;$o->save();(new OrderService($o))->open();
|
||||
$this->assertSame(10100,$this->cumulative($u));$this->assertSame(8,$u->fresh()->discount);$this->assertEquals(200,$o->fresh()->balance_amount);
|
||||
}
|
||||
public function test_mixed_payment_counts_principal_once_excluding_surplus_and_fees(): void {
|
||||
$this->enable();$u=$this->user();$o=$this->processing($u,$this->plan(),['total_amount'=>1000,'balance_amount'=>250,'surplus_amount'=>500,'handling_amount'=>35]);
|
||||
(new OrderService($o))->open();$this->assertSame(1250,$this->cumulative($u));
|
||||
}
|
||||
public function test_duplicate_open_and_stale_models_do_not_duplicate_consumption(): void {
|
||||
$this->enable();$u=$this->user();$o=$this->processing($u,$this->plan());$stale=Order::find($o->id);
|
||||
(new OrderService($o))->open();(new OrderService($stale))->open();
|
||||
$this->assertSame(10000,$this->cumulative($u));$this->assertSame(1,DB::table('fuc_vip_entries')->where('kind','purchase')->count());
|
||||
}
|
||||
public function test_open_failure_rolls_back_vip_ledger_and_discount(): void {
|
||||
$s=$this->enable();$u=$this->user();$s->sync($u->id);$o=$this->processing($u,$this->plan());
|
||||
HookManager::register('order.open.before',fn()=>throw new \RuntimeException('injected'),99);
|
||||
try{(new OrderService($o))->open();$this->fail('Expected failure');}catch(\RuntimeException $e){$this->assertSame('injected',$e->getMessage());}
|
||||
$this->assertSame(0,$this->cumulative($u));$this->assertSame(0,DB::table('fuc_vip_entries')->count());$this->assertSame(0,$u->fresh()->discount);$this->assertSame(1,$o->fresh()->status);
|
||||
}
|
||||
public function test_pending_cancel_and_retry_never_accrue(): void {
|
||||
$this->enable();$u=$this->user(['balance'=>10000]);$o=OrderService::createFromRequest($u,$this->plan(),'monthly');
|
||||
$this->assertSame(0,$this->cumulative($u));$this->assertTrue((new OrderService($o))->cancel());$this->assertFalse((new OrderService($o))->cancel());
|
||||
$this->assertSame(10000,$u->fresh()->balance);$this->assertSame(0,DB::table('fuc_vip_entries')->count());
|
||||
}
|
||||
public function test_balance_credit_and_commission_transfer_do_not_accrue_before_package_purchase(): void {
|
||||
$s=$this->enable();$u=$this->user(['commission_balance'=>10000]);$s->sync($u->id);
|
||||
app(\App\Services\UserService::class)->addBalance($u->id,10000);
|
||||
$u->refresh();$u->balance+=10000;$u->commission_balance=0;$u->save();
|
||||
$this->assertSame(0,$this->cumulative($u));
|
||||
$o=OrderService::createFromRequest($u,$this->plan(),'monthly');$o->status=1;$o->save();(new OrderService($o))->open();
|
||||
$this->assertSame(10000,$this->cumulative($u));
|
||||
}
|
||||
public function test_reset_packages_do_not_accrue_but_onetime_packages_do(): void {
|
||||
$this->enable();$u=$this->user();$p=$this->plan();$r=$this->processing($u,$p,['period'=>'reset_traffic']);(new OrderService($r))->open();
|
||||
$this->assertSame(0,DB::table('fuc_vip_entries')->count());$o=$this->processing($u,$p,['period'=>'onetime']);(new OrderService($o))->open();$this->assertSame(10000,$this->cumulative($u));
|
||||
}
|
||||
public function test_opening_import_is_idempotent_and_cannot_overwrite_afterwards(): void {
|
||||
$s=$this->enable();$u=$this->user();$ref=str_repeat('c',64);$s->opening($u->id,$u->uuid,0,$ref);$s->opening($u->id,$u->uuid,0,$ref);
|
||||
$this->assertSame(1,DB::table('fuc_vip_entries')->count());$this->assertSame(0,$u->fresh()->discount);
|
||||
$this->expectException(\RuntimeException::class);$s->opening($u->id,$u->uuid,100,$ref);
|
||||
}
|
||||
public function test_opening_rejects_wrong_identity_and_negative_amount(): void {
|
||||
$s=$this->enable();$u=$this->user();
|
||||
try{$s->opening($u->id,'other-uuid',0,str_repeat('a',64));$this->fail();}catch(\RuntimeException){}
|
||||
$this->assertSame(0,DB::table('fuc_vip_accounts')->count());
|
||||
$this->expectException(\InvalidArgumentException::class);$s->opening($u->id,$u->uuid,-1,str_repeat('a',64));
|
||||
}
|
||||
public function test_manual_discount_preserved_when_disabling_and_reenabling(): void {
|
||||
$s=$this->enable();$u=$this->user(['discount'=>10]);$s->sync($u->id);
|
||||
$o=$this->processing($u,$this->plan(),['total_amount'=>40000]);(new OrderService($o))->open();$this->assertSame(15,$u->fresh()->discount);
|
||||
app(PluginManager::class)->disable('vip_loyalty');$this->assertSame(10,$u->fresh()->discount);
|
||||
$this->assertSame(40000,$this->cumulative($u));$this->enable();$s->sync($u->id);$this->assertSame(15,$u->fresh()->discount);
|
||||
}
|
||||
public function test_native_manual_discount_edit_is_not_lost(): void {
|
||||
$s=$this->enable();$u=$this->user();$s->sync($u->id);$u->discount=20;$u->save();
|
||||
HookManager::call('admin.user.update.after',['user'=>$u,'params'=>['discount'=>20]]);$this->assertSame(20,$u->fresh()->discount);
|
||||
app(PluginManager::class)->disable('vip_loyalty');$this->assertSame(20,$u->fresh()->discount);
|
||||
}
|
||||
public function test_refund_reversal_is_bounded_idempotent_and_recalculates_level(): void {
|
||||
$s=$this->enable();$u=$this->user();$o=$this->processing($u,$this->plan(),['total_amount'=>40000]);(new OrderService($o))->open();
|
||||
$balance=$u->fresh()->balance;$s->reverse($o->id,30000,'verified-refund');$s->reverse($o->id,30000,'verified-refund');
|
||||
$this->assertSame(10000,$this->cumulative($u));$this->assertSame(8,$u->fresh()->discount);$this->assertSame($balance,$u->fresh()->balance);
|
||||
$this->expectException(\Illuminate\Validation\ValidationException::class);$s->reverse($o->id,10001,'over-refund');
|
||||
}
|
||||
public function test_config_edit_is_instance_scoped_and_validated(): void {
|
||||
$s=$this->enable();$u=$this->user();$s->opening($u->id,$u->uuid,10000,str_repeat('d',64));
|
||||
$cfg=array_replace(Settings::DEFAULTS,['enabled'=>true,'tier1_discount'=>9]);Plugin::where('code','vip_loyalty')->update(['config'=>json_encode($cfg)]);
|
||||
$this->assertSame(9,$s->summary($u->id)['discount_percent']);
|
||||
$this->expectException(\Illuminate\Validation\ValidationException::class);app(Settings::class)->validate(['tier2_amount'=>50]);
|
||||
}
|
||||
public function test_native_plugin_editor_cannot_save_invalid_vip_policy(): void {
|
||||
$this->enable();$before=Plugin::where('code','vip_loyalty')->value('config');
|
||||
try{app(\App\Services\Plugin\PluginConfigService::class)->updateConfig('vip_loyalty',['tier2_amount'=>1]);$this->fail();}catch(\Illuminate\Validation\ValidationException){}
|
||||
$this->assertSame($before,Plugin::where('code','vip_loyalty')->value('config'));
|
||||
}
|
||||
public function test_corrupt_enabled_policy_blocks_accrual_instead_of_silently_skipping(): void {
|
||||
$this->enable(['tier2_amount'=>1]);$u=$this->user();
|
||||
$this->expectException(\Illuminate\Validation\ValidationException::class);
|
||||
OrderService::createFromRequest($u,$this->plan(),'monthly');
|
||||
}
|
||||
public function test_user_endpoint_and_admin_settings_permissions(): void {
|
||||
$this->enable();app(PluginManager::class)->initializeEnabledPlugins();
|
||||
$this->getJson('/api/v1/user/vip')->assertStatus(403);
|
||||
$u=$this->user();$this->actingAs($u,'sanctum');$this->getJson('/api/v1/user/vip')->assertOk()->assertJsonPath('data.cumulative_cents',0);
|
||||
$secure=admin_setting('secure_path',admin_setting('frontend_admin_path',hash('crc32b',config('app.key'))));$url='/api/v2/'.$secure.'/vip';
|
||||
$this->postJson($url,['enabled'=>false])->assertStatus(403);
|
||||
$u->is_admin=true;$u->save();$this->actingAs($u,'sanctum');$this->postJson($url,['enabled'=>true,'tier2_amount'=>1])->assertStatus(422);
|
||||
$this->postJson($url,['enabled'=>false])->assertOk()->assertJsonPath('data.enabled',false);
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,7 @@ use App\Utils\CacheKey;
|
||||
use App\Utils\Helper;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Tests\TestCase;
|
||||
|
||||
@@ -17,6 +18,22 @@ class LoginServiceTest extends TestCase
|
||||
|
||||
private LoginService $service;
|
||||
|
||||
protected function beforeRefreshingDatabase(): void
|
||||
{
|
||||
config([
|
||||
'app.env' => 'testing',
|
||||
'database.default' => 'sqlite',
|
||||
'database.connections.sqlite.database' => ':memory:',
|
||||
'cache.default' => 'array',
|
||||
'cache.stores.redis' => ['driver' => 'array'],
|
||||
]);
|
||||
DB::purge('sqlite');
|
||||
Cache::forgetDriver(['redis', 'array']);
|
||||
\Illuminate\Support\Facades\Http::preventStrayRequests();
|
||||
\Illuminate\Support\Facades\Queue::fake();
|
||||
\Illuminate\Support\Facades\Mail::fake();
|
||||
}
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
@@ -28,6 +45,7 @@ class LoginServiceTest extends TestCase
|
||||
public function test_reset_password_rejects_missing_cached_email_code(): void
|
||||
{
|
||||
$user = $this->createUser('[email protected]', 'old-password');
|
||||
$user->createToken('existing-device');
|
||||
|
||||
[$success, $result] = $this->service->resetPassword($user->email, '', 'new-password');
|
||||
|
||||
@@ -36,11 +54,17 @@ class LoginServiceTest extends TestCase
|
||||
|
||||
$user->refresh();
|
||||
$this->assertTrue(password_verify('old-password', $user->password));
|
||||
$this->assertSame(1, $user->tokens()->count());
|
||||
}
|
||||
|
||||
public function test_reset_password_accepts_matching_cached_email_code(): void
|
||||
{
|
||||
$user = $this->createUser('[email protected]', 'old-password');
|
||||
$subscriptionToken = $user->token;
|
||||
$user->createToken('first-device');
|
||||
$user->createToken('second-device');
|
||||
$other = $this->createUser('[email protected]', 'other-password');
|
||||
$other->createToken('unrelated-device');
|
||||
Cache::put(CacheKey::get('EMAIL_VERIFY_CODE', $user->email), 123456, 300);
|
||||
|
||||
[$success, $result] = $this->service->resetPassword($user->email, '123456', 'new-password');
|
||||
@@ -51,6 +75,45 @@ class LoginServiceTest extends TestCase
|
||||
$user->refresh();
|
||||
$this->assertTrue(password_verify('new-password', $user->password));
|
||||
$this->assertNull(Cache::get(CacheKey::get('EMAIL_VERIFY_CODE', $user->email)));
|
||||
$this->assertSame(0, $user->tokens()->count());
|
||||
$this->assertSame(1, $other->tokens()->count());
|
||||
$this->assertSame($subscriptionToken, $user->token);
|
||||
}
|
||||
|
||||
public function test_wrong_code_preserves_password_and_login_sessions(): void
|
||||
{
|
||||
$user = $this->createUser('[email protected]', 'old-password');
|
||||
$user->createToken('existing-device');
|
||||
Cache::put(CacheKey::get('EMAIL_VERIFY_CODE', $user->email), 123456, 300);
|
||||
|
||||
[$success] = $this->service->resetPassword($user->email, '654321', 'new-password');
|
||||
|
||||
$this->assertFalse($success);
|
||||
$this->assertTrue(password_verify('old-password', $user->fresh()->password));
|
||||
$this->assertSame(1, $user->tokens()->count());
|
||||
$this->assertSame(123456, Cache::get(CacheKey::get('EMAIL_VERIFY_CODE', $user->email)));
|
||||
}
|
||||
|
||||
public function test_revocation_failure_rolls_back_password_change(): void
|
||||
{
|
||||
if (DB::getDriverName() !== 'sqlite') {
|
||||
$this->markTestSkipped('SQLite trigger supplies the isolated failure injection');
|
||||
}
|
||||
$user = $this->createUser('[email protected]', 'old-password');
|
||||
$user->createToken('existing-device');
|
||||
Cache::put(CacheKey::get('EMAIL_VERIFY_CODE', $user->email), 123456, 300);
|
||||
DB::unprepared("CREATE TEMP TRIGGER reject_reset_token_delete BEFORE DELETE ON personal_access_tokens BEGIN SELECT RAISE(ABORT, 'test revocation failure'); END");
|
||||
try {
|
||||
$this->service->resetPassword($user->email, '123456', 'new-password');
|
||||
$this->fail('The failed revocation must not report a successful reset');
|
||||
} catch (\Illuminate\Database\QueryException $error) {
|
||||
$this->assertStringContainsString('test revocation failure', $error->getMessage());
|
||||
} finally {
|
||||
DB::unprepared('DROP TRIGGER reject_reset_token_delete');
|
||||
}
|
||||
$this->assertTrue(password_verify('old-password', $user->fresh()->password));
|
||||
$this->assertSame(1, $user->tokens()->count());
|
||||
$this->assertSame(123456, Cache::get(CacheKey::get('EMAIL_VERIFY_CODE', $user->email)));
|
||||
}
|
||||
|
||||
public function test_forget_password_validation_rejects_boolean_email_code(): void
|
||||
@@ -80,4 +143,4 @@ class LoginServiceTest extends TestCase
|
||||
'updated_at' => time(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
+129
-91
@@ -1,6 +1,13 @@
|
||||
import {beginPageProgress,finishPageProgress} from './progress.mjs?v=0.6.1';
|
||||
import {nativeReady,nativeMode,nativeHeader,nativeFooter,nativeDashboard,nativeHome,nativeAuth,nativeSecondary,paintNativeChart,paintNativeHome} from './native.mjs?v=0.6.1';
|
||||
import {escape as e, money, bytes, date, list, groupedList, periods, orderStates, soldOut, safeUrl, createApi} from './core.mjs';
|
||||
import {applyPalette} from './palettes.mjs?v=0.12.0';
|
||||
import {subscriptionUrl as makeSubscriptionUrl,importUrl} from './subscription.mjs?v=0.12.0';
|
||||
import {interactionsReady,paintInteractions,disposeInteractions,showModal,hideModals,toggleCollapse,selectTab,toggleDropdown,notify,scrollTop,scrollSection,toggleMenu,updateMenu,paintScrollTop,authFeedback,confirmSubscriptionReset} from './interactions.mjs?v=0.12.0';
|
||||
import {richText} from './content.mjs?v=0.12.0';
|
||||
import {copyText} from './clipboard.mjs?v=0.12.0';
|
||||
import {createCaptcha} from './captcha.mjs?v=0.12.0';
|
||||
import {showPayment,mountCard} from './payments.mjs?v=0.12.0';
|
||||
import {beginPageProgress,finishPageProgress} from './progress.mjs?v=0.12.0';
|
||||
import {nativeReady,prepareNativeMode,nativeMode,fillPurchaseModal,nativeHeader,nativeFooter,nativeDashboard,nativeHome,nativeAuth,nativeSecondary,paintNativeChart,paintNativeHome} from './native.mjs?v=0.12.0';
|
||||
import {escape as e, money, bytes, date, list, groupedList, periods, orderStates, soldOut, safeUrl, createApi, routeFromHash,canPurchase} from './core.mjs?v=0.12.0';
|
||||
const settings = window.fucSettings || {};
|
||||
const root = document.querySelector('#app');
|
||||
const preview = settings.preview === true;
|
||||
@@ -8,45 +15,42 @@ const storageKey = preview ? 'fuc_preview_auth' : 'fuc_auth';
|
||||
const token = () => sessionStorage.getItem(storageKey) || localStorage.getItem(storageKey) || '';
|
||||
const clearAuth = () => { sessionStorage.removeItem(storageKey); localStorage.removeItem(storageKey); };
|
||||
const api = createApi({getToken:token,onUnauthorized:() => { clearAuth(); location.hash = '/login'; }});
|
||||
let captcha=null,cardPayment=null,paymentMethods=[],paymentTimer=null;
|
||||
let user = {}, sub = {}, config = {}, routeSequence = 0, cycle = 'month_price', page = 1;
|
||||
let pageData = [], selectedTicket = null, selectedOrder = null, selectedPlan = null, authConfigError = '', loading = false;
|
||||
const btn = (text, action, klass = '', extra = '') => `<button class="btn ${klass}" data-action="${action}" ${extra}>${text}</button>`;
|
||||
const link = (text, href, klass = '') => `<a class="${klass}" href="${e(href)}">${text}</a>`;
|
||||
const empty=(text='暂无记录',action='')=>`<div class="native-empty">${e(text)}${action?`<p>${action}</p>`:''}</div>`;
|
||||
const card = (title, body, klass = '') => `<section class="card ${klass}"><div class="card-body">${title ? `<h3 class="card-title">${title}</h3>` : ''}${body}</div></section>`;
|
||||
const getRoute = () => { const parts = (location.hash.slice(1) || '/home').split('?'); const [route, id] = parts[0].replace(/^\//,'').split('/'); return {name:route || 'home',id,query:new URLSearchParams(parts[1] || '')}; };
|
||||
const getRoute = () => routeFromHash(location.hash);
|
||||
const go = route => { if (location.hash === `#/${route}`) renderRoute(); else location.hash = `/${route}`; };
|
||||
const toast = message => { document.querySelector('.native-toast')?.remove(); const el = document.createElement('div'); el.className = 'native-toast'; el.setAttribute('role','status'); el.textContent = message; document.body.append(el); setTimeout(() => el.remove(), 4000); };
|
||||
const plain = value => { const doc = new DOMParser().parseFromString(String(value || ''),'text/html'); return doc.body.textContent || ''; };
|
||||
function richText(value) {
|
||||
// Rebuild only a tiny formatting allowlist; no scripts, images, embedded content or arbitrary attributes survive.
|
||||
const source = new DOMParser().parseFromString(String(value || ''),'text/html');
|
||||
const allowed = new Set(['P','BR','STRONG','B','EM','I','UL','OL','LI','H2','H3','H4','BLOCKQUOTE','CODE','PRE','A']);
|
||||
function clean(node) {
|
||||
if (node.nodeType === Node.TEXT_NODE) return document.createTextNode(node.textContent);
|
||||
if (['SCRIPT','STYLE','IFRAME','OBJECT','SVG','MATH'].includes(node.nodeName)) return document.createTextNode('');
|
||||
const target = allowed.has(node.nodeName) ? document.createElement(node.nodeName.toLowerCase()) : document.createDocumentFragment();
|
||||
if (node.nodeName === 'A') { const href = safeUrl(node.getAttribute('href') || ''); if (href) {target.href = href; target.target = '_blank'; target.rel = 'noopener noreferrer';} }
|
||||
for (const child of node.childNodes) target.append(clean(child)); return target;
|
||||
}
|
||||
const result = document.createElement('div'); for (const child of source.body.childNodes) result.append(clean(child)); return result.innerHTML;
|
||||
const toast = (message,type='success') => notify(message,type);
|
||||
const waitFeedback = ms => new Promise(resolve=>setTimeout(resolve,ms));
|
||||
async function successRefresh(message,seq,delay=1000,destination=''){
|
||||
if(seq!==routeSequence)return;toast(message);await waitFeedback(delay);
|
||||
if(seq!==routeSequence)return;if(destination)go(destination);else await renderRoute();
|
||||
}
|
||||
const busyLabels={login:'正在登录',register:'注册中',forget:'正在重置','reset-code':'正在发送...',ticket:'提交中',reply:'提交中',purchase:'提交中','purchase-coupon':'验证中',password:'修改中',checkout:'处理中'};
|
||||
const plain = value => { const doc = new DOMParser().parseFromString(String(value || ''),'text/html'); return doc.body.textContent || ''; };
|
||||
|
||||
|
||||
function homepage(plans = [], error = '') {
|
||||
nativeMode('home');root.innerHTML=nativeHome(plans,settings.title||'福云');
|
||||
disposeInteractions(root);nativeMode('home');root.innerHTML=nativeHome(plans,settings.title||'福云',!!token());
|
||||
if(error){const el=document.createElement('p');el.textContent=error;el.className='alert alert-warning';root.querySelector('#pricing .container')?.prepend(el);}
|
||||
document.title=`${settings.title||'福云'} · 全球网络中继服务`;void paintNativeHome().catch(()=>{});
|
||||
}
|
||||
function authPage(name,error=''){
|
||||
nativeMode('auth',name);root.innerHTML=nativeAuth(name,settings.title||'福云',config,name==='reset'?getRoute().query.get('email')||'':getRoute().query.get('code')||'');
|
||||
disposeInteractions(root);nativeMode('auth',name);root.innerHTML=nativeAuth(name,settings.title||'福云',config,name==='reset'?getRoute().query.get('email')||'':getRoute().query.get('code')||'');
|
||||
document.title=`${{login:'登录',register:'注册',forget:'找回密码',reset:'重置密码'}[name]} — ${settings.title||'福云'}`;
|
||||
const captcha=Number(config.is_captcha||config.is_recaptcha)===1;
|
||||
if(captcha||authConfigError||error){const note=document.createElement('p');note.className='alert alert-warning';note.textContent=error||authConfigError||'本站需要人机验证,当前主题尚未接入验证组件';root.querySelector('form')?.prepend(note);root.querySelectorAll('[type=submit]').forEach(n=>n.disabled=true);}
|
||||
paintInteractions(root);
|
||||
if(['register','forget'].includes(name)){const container=document.createElement('div');container.className='my-2';root.querySelector('form')?.append(container);captcha=createCaptcha(config,container);}
|
||||
if(authConfigError||error){const note=document.createElement('p');note.className='alert alert-warning';note.textContent=error||authConfigError;root.querySelector('form')?.prepend(note);if(authConfigError)root.querySelectorAll('[type=submit]').forEach(n=>n.disabled=true);}
|
||||
}
|
||||
const titles = {wallet:['我的钱包','账户余额与佣金信息'],notices:['网站公告','查看网站最新消息'],dashboard:['用户中心','在这里查看账户信息和最新公告'],plans:['购买套餐','购买一个套餐'],orders:['我的订单','查看订单详情与支付状态'],purchase:['确认套餐','核对所选套餐与计费周期'],checkout:['订单详情','核对套餐与订单信息'],profile:['账户资料','管理账户信息和登录密码'],invite:['邀请好友','邀请好友,共享优质网络'],tickets:['问题反馈','如有问题,请在这里联系我们'],ticket:['工单详情','查看回复与跟进处理进度'],servers:['节点列表','查看当前订阅可用的节点'],knowledge:['使用文档','找到适合你的客户端与使用方法']};
|
||||
function shell(name,content){
|
||||
nativeMode('user',name);document.body.dataset.nativePage=name;document.body.classList.remove('modal-open');
|
||||
disposeInteractions(root);nativeMode('user',name);document.body.dataset.nativePage=name;document.body.classList.remove('modal-open');
|
||||
const body=content.includes('class="app-content content')||content.includes('class="page-wrapper"')?content:`<div class="app-content content"><div class="content-wrapper"><div class="content-body">${content}</div></div></div>`;
|
||||
root.innerHTML=nativeHeader(user,settings.title||'福云',name)+body+nativeFooter(settings.title||'福云');
|
||||
root.innerHTML=nativeHeader(user,settings.title||'福云',name,config)+body+nativeFooter(settings.title||'福云');paintInteractions(root);
|
||||
document.title=`${titles[name]?.[0]||({myplan:'我的套餐',faq:'常见问题'}[name])||name} — ${settings.title||'福云'}`;if(name==='dashboard')void paintNativeChart().catch(()=>{});
|
||||
}
|
||||
const secondary=(name,data,extra={})=>nativeSecondary(name,{user,sub,data,period:cycle,page,config,richText,...extra});
|
||||
@@ -55,115 +59,149 @@ async function renderRoute() {
|
||||
try {await renderPage();} finally {finishPageProgress(ticket);}
|
||||
}
|
||||
async function renderPage() {
|
||||
clearTimeout(paymentTimer);captcha?.dispose();captcha=null;cardPayment?.dispose();cardPayment=null;
|
||||
const seq = ++routeSequence, {name,id} = getRoute(); selectedTicket = null; selectedOrder = null; selectedPlan = null;
|
||||
if (name === 'demo') {if (preview) {sessionStorage.setItem(storageKey,'Bearer local-preview-only');go(['invite','knowledge','tickets'].includes(getRoute().query.get('next')) ? getRoute().query.get('next') : 'dashboard');} else go('login');return;}
|
||||
if (name === 'home') {homepage();try {const plans = list(await api('guest/plan/fetch'));if (seq === routeSequence) homepage(plans,plans.length ? '' : '暂无公开展示的套餐');} catch(error) {if (seq === routeSequence) homepage([],error.message);}return;}
|
||||
if (name === 'home') {try {const plans = list(await api('guest/plan/fetch'));if(seq===routeSequence){await prepareNativeMode('home');if(seq===routeSequence)homepage(plans,plans.length?'':'暂无公开展示的套餐');}} catch(error) {if(seq===routeSequence){await prepareNativeMode('home');if(seq===routeSequence)homepage([],error.message);}}return;}
|
||||
const auth = ['login','register','forget','reset'].includes(name);
|
||||
if(auth){await prepareNativeMode('auth',name);if(seq!==routeSequence)return;}
|
||||
if (!token() && !auth) {go('login'); return;}
|
||||
if (name==='login'&&getRoute().query.has('verify')) {
|
||||
const verify=getRoute().query.get('verify'),redirect=getRoute().query.get('redirect');
|
||||
history.replaceState(null,'',location.pathname+location.search+'#/login');
|
||||
try {const result=await api('passport/auth/token2Login?verify='+encodeURIComponent(verify));if(seq!==routeSequence)return;saveAuth(result,false);go(['dashboard','plans','orders','profile','invite','tickets','knowledge'].includes(redirect)?redirect:'dashboard');}
|
||||
catch(error){if(seq===routeSequence)authPage('login',error.message);}return;
|
||||
}
|
||||
if (auth) {authPage(name); return;}
|
||||
shell(name,'<div class="card page-loading" role="status">正在加载…</div>');
|
||||
try {
|
||||
const info = await Promise.all([api('user/info'),api('user/getSubscribe')]);
|
||||
if (seq !== routeSequence) return; [user,sub] = info;
|
||||
let content;
|
||||
if(name==='dashboard')content=nativeDashboard(user,sub,list(await api('user/notice/fetch')),settings.title||'福云',richText);
|
||||
const info = await Promise.all([api('user/info'),api('user/getSubscribe'),api('user/comm/config'),api('user/vip').catch(()=>null)]);
|
||||
if (seq !== routeSequence) return; [user,sub] = info;config={...config,...info[2]};
|
||||
if(info[3]?.enabled===true){user.vip=info[3];user.discount=info[3].discount_percent;}
|
||||
let content, nextData=[], nextTicket=null, nextOrder=null, nextPlan=null, nextMethods=[];
|
||||
if(name==='dashboard'){const [notices,traffic]=await Promise.all([api('user/notice/fetch'),api('user/stat/getTrafficLog').then(list).catch(()=>null)]);content=nativeDashboard(user,sub,list(notices),settings.title||'福云',richText,traffic);}
|
||||
else if(name==='notices')content=secondary('notices',list(await api('user/notice/fetch')));
|
||||
else if(name==='plans'){pageData=list(await api('user/plan/fetch'));if(!pageData.some(p=>p[cycle]!=null))cycle=Object.keys(periods).find(k=>pageData.some(p=>p[k]!=null))||'month_price';content=secondary('plans',pageData);}
|
||||
else if(name==='purchase'&&id){const plans=list(await api('user/plan/fetch')),plan=plans.find(p=>String(p.id)===id),period=getRoute().query.get('period');if(!plan||!Object.hasOwn(periods,period)||plan[period]==null||soldOut(plan)||plan.sell===false)throw Error('此套餐或计费周期不可购买');selectedPlan={plan,period};content=secondary('purchase',plan,{period});}
|
||||
else if(name==='orders'||name==='myplan'){pageData=list(await api('user/order/fetch')).slice((page-1)*20,page*20);content=secondary(name,pageData);}
|
||||
else if(name==='checkout'&&id){selectedOrder=await api(`user/order/detail?trade_no=${encodeURIComponent(id)}`);const methods=selectedOrder.status===0?list(await api('user/order/getPaymentMethod')):[];content=secondary('checkout',selectedOrder,{methods});}
|
||||
else if(name==='profile'||name==='wallet')content=secondary(name,null);
|
||||
else if(name==='plans'){const [plans,invite]=await Promise.all([api('user/plan/fetch'),api('user/invite/fetch').catch(()=>null)]);nextData=list(plans);if(!nextData.some(p=>'plan-'+p.id===cycle))cycle='plan-'+nextData[0]?.id;content=secondary('plans',nextData,{inviteRate:invite?.stat?.[3]});}
|
||||
else if(name==='purchase'&&id){const result=await api('user/plan/fetch?id='+encodeURIComponent(id)),plan=Array.isArray(result)?result.find(p=>String(p.id)===id):result,period=getRoute().query.get('period');if(!canPurchase(plan,user,period))throw Error('此套餐或计费周期不可购买');nextPlan={plan,period};content=secondary('purchase',plan,{period});}
|
||||
else if(name==='orders'||name==='myplan'){const [orders,renewPlan]=await Promise.all([api('user/order/fetch'),name==='myplan'&&sub.plan_id?api('user/plan/fetch?id='+encodeURIComponent(sub.plan_id)).catch(()=>null):null]);nextData=list(orders).slice((page-1)*20,page*20);content=secondary(name,nextData,{renewPlan});}
|
||||
else if(name==='checkout'&&id){nextOrder=await api(`user/order/detail?trade_no=${encodeURIComponent(id)}`);const methods=nextOrder.status===0?list(await api('user/order/getPaymentMethod')):[];nextMethods=methods;content=secondary('checkout',nextOrder,{methods});}
|
||||
else if(name==='profile'){content=secondary(name,null,{sessions:list(await api('user/getActiveSession'))});}
|
||||
else if(name==='wallet')content=secondary(name,list(await api('user/gift-card/history?per_page=20&page='+page)));
|
||||
else if(name==='invite'){const [data,details]=await Promise.all([api('user/invite/fetch'),api(`user/invite/details?current=${page}&page_size=20`)]);content=secondary('invite',data,{details:list(details)});}
|
||||
else if(name==='tickets'){pageData=list(await api('user/ticket/fetch'));content=secondary('tickets',pageData);}
|
||||
else if(name==='ticket'&&id){selectedTicket=await api(`user/ticket/fetch?id=${encodeURIComponent(id)}`);content=secondary('ticket',selectedTicket);}
|
||||
else if(name==='servers'){pageData=groupedList(await api('user/server/fetch'));content=secondary('servers',pageData);}
|
||||
else if(name==='tickets'){nextData=list(await api('user/ticket/fetch'));content=secondary('tickets',nextData);}
|
||||
else if(name==='ticket'&&id){nextTicket=await api(`user/ticket/fetch?id=${encodeURIComponent(id)}`);content=secondary('ticket',nextTicket);}
|
||||
else if(name==='servers'){nextData=groupedList(await api('user/server/fetch'));content=secondary('servers',nextData);}
|
||||
else if(name==='knowledge'||name==='faq'){const data=await api(`user/knowledge/fetch?language=zh-CN${id?`&id=${encodeURIComponent(id)}`:''}`);content=secondary(id?'article':name,data);}
|
||||
else content=card('',empty('页面不存在',link('返回用户中心','#/dashboard','btn btn-primary')));
|
||||
if (seq !== routeSequence) return; shell(name,content);
|
||||
} catch (error) {if (seq === routeSequence && token()) shell(name,card('',`<div class="alert" role="alert">${e(error.message)}</div>${btn('重新加载','retry')}`));}
|
||||
if(seq!==routeSequence)return;await prepareNativeMode('user',name);if(seq!==routeSequence)return;pageData=nextData;selectedTicket=nextTicket;selectedOrder=nextOrder;selectedPlan=nextPlan;paymentMethods=nextMethods;shell(name,content);
|
||||
} catch (error) {if (seq === routeSequence && token()) {await prepareNativeMode('user',name);if(seq!==routeSequence)return;shell(name,card('',`<div class="alert" role="alert">${e(error.message)}</div>${btn('重新加载','retry')}`));}}
|
||||
}
|
||||
async function copy(text) { if (!text) throw new Error('暂无可复制内容'); try {await navigator.clipboard.writeText(text);} catch {throw new Error('复制失败,请选中链接手动复制');} toast('已复制到剪贴板'); }
|
||||
async function copy(text) {if(!text)throw Error('暂无可复制内容');await copyText(text);toast('已复制到剪贴板');}
|
||||
root.addEventListener('click',async event => {
|
||||
const routeLink=event.target.closest('a[href^="#/"]');
|
||||
if(routeLink&&!routeLink.dataset.action&&routeLink.getAttribute('href')===location.hash){event.preventDefault();page=1;cycle='';await renderRoute();window.scrollTo(0,0);return;}
|
||||
const button = event.target.closest('[data-action]'); if (!button || button.disabled) return;
|
||||
const action = button.dataset.action;event.preventDefault();
|
||||
if(action==='scroll-top'){window.scrollTo({top:0,behavior:'smooth'});return;}
|
||||
if(action==='scroll-top'){scrollTop();return;}
|
||||
if(action==='native-banner'){root.querySelectorAll('.swiper-slide').forEach((n,i)=>n.style.display=i===Number(button.dataset.index)?'block':'none');root.querySelectorAll('.swiper-pagination-bullet').forEach(n=>n.classList.toggle('swiper-pagination-bullet-active',n===button));return;}
|
||||
if(action==='native-collapse'){const el=root.querySelector('#navbarCollapse');el?.classList.toggle('show');button.setAttribute('aria-expanded',String(el?.classList.contains('show')));return;}
|
||||
if(action==='native-unavailable'){toast(button.dataset.reason||'此入口尚未接入 XB');return;}
|
||||
if(action==='native-dropdown'){const menu=button.parentElement.querySelector('.dropdown-menu');menu?.classList.toggle('show');button.setAttribute('aria-expanded',String(menu?.classList.contains('show')));return;}
|
||||
if(action==='native-cycle'){cycle=button.dataset.cycle;shell('plans',secondary('plans',pageData));return;}
|
||||
if(action==='native-settings'){for(const id of ['themeMod','themeLight','menuToggle'])localStorage.setItem('fuc_'+id,root.querySelector('#'+id).value);const mode=localStorage.getItem('fuc_themeMod');document.documentElement.dataset.color=mode==='system'?(matchMedia('(prefers-color-scheme: dark)').matches?'dark':'light'):mode;localStorage.setItem('fuc_color',document.documentElement.dataset.color);closeModal();nativeMode('user');toast('面板设置已保存到此浏览器');return;}
|
||||
if(action==='native-collapse'){toggleCollapse(root.querySelector('#navbarCollapse'),button);return;}
|
||||
if(action==='subscription-unavailable'){void authFeedback('请先购买一个套餐','','warning');return;}
|
||||
if(action==='native-unavailable'){toast(button.dataset.reason||'此入口尚未接入 XB','info');return;}
|
||||
if(action==='native-dropdown'){toggleDropdown(button);return;}
|
||||
if(action==='native-cycle'){cycle=button.dataset.cycle;selectTab(button);return;}
|
||||
if(action==='native-settings'){for(const id of ['themeMod','themeLight','menuToggle'])localStorage.setItem('fuc_'+id,root.querySelector('#'+id).value);const mode=localStorage.getItem('fuc_themeMod'),color=mode==='system'?(matchMedia('(prefers-color-scheme: dark)').matches?'dark':'light'):mode;localStorage.setItem('fuc_color',color);toast('面板设置已保存');setTimeout(()=>location.reload(),1000);return;}
|
||||
if(action==='native-go-invite'){go('invite');return;}
|
||||
if(action==='native-modal'){openModal(button.dataset.target);return;}
|
||||
if(action==='native-dismiss'){closeModal();return;}
|
||||
if(action==='native-accordion'){const target=root.querySelector(button.dataset.target||'__none__');if(target&&!target.dataset.loaded&&button.dataset.target?.startsWith('#faq-')){try{const d=await api(`user/knowledge/fetch?language=zh-CN&id=${encodeURIComponent(button.dataset.target.slice(5))}`);target.querySelector('.card-body').innerHTML=richText(d.body);target.dataset.loaded='true';}catch(error){toast(error.message);return;}}target?.classList.toggle('show');button.setAttribute('aria-expanded',String(target?.classList.contains('show')));return;}
|
||||
if(action==='native-accordion'){const requestSequence=routeSequence,target=root.querySelector(button.dataset.target||'__none__');if(target&&!target.dataset.loaded&&button.dataset.target?.startsWith('#faq-')){try{const d=await api(`user/knowledge/fetch?language=zh-CN&id=${encodeURIComponent(button.dataset.target.slice(5))}`);if(requestSequence!==routeSequence||!target.isConnected)return;target.querySelector('.card-body').innerHTML=richText(d.body);target.dataset.loaded='true';}catch(error){if(requestSequence===routeSequence)toast(error.message,'error');return;}}toggleCollapse(target,button);return;}
|
||||
if(action==='native-node-detail'){const node=pageData.find(n=>String(n.id)===button.dataset.id);if(node){const modal=root.querySelector('#nodeinfo');modal.querySelectorAll('.modal-body').forEach(n=>n.remove());modal.querySelector('.modal-content').insertAdjacentHTML('beforeend',`<div class="modal-body"><p>${e(node.name)}</p><p>协议:${e(node.type)} · 流量倍率:${e(node.rate??1)}x</p><p>状态:${node.is_online||node.is_available?'在线':'离线'}</p></div>`);openModal('#nodeinfo');}return;}
|
||||
if(action==='native-close-ticket'){selectedTicket=pageData.find(n=>String(n.id)===button.dataset.id);const b=root.querySelector('#ticket-close-click');b.dataset.action='confirm-close-ticket';openModal('#ticket-close-modal');return;}
|
||||
if(action==='native-tab'){const ul=button.closest('ul');ul?.querySelectorAll('a').forEach(a=>a.classList.toggle('active',a===button));const target=document.getElementById(button.dataset.target);if(target){target.parentElement.querySelectorAll(':scope > .tab-pane').forEach(p=>(p.classList.toggle('active',p===target),p.classList.toggle('show',p===target)));}return;}
|
||||
if (action === 'section') {document.getElementById(button.dataset.target)?.scrollIntoView({behavior:'smooth',block:'start'});return;}
|
||||
if (action === 'menu') {if(innerWidth<1200)document.body.classList.toggle('menu-open');else{document.body.classList.toggle('menu-collapsed');document.body.classList.toggle('menu-expanded');}return;}
|
||||
if (action === 'mode') {const mode = document.documentElement.dataset.color === 'dark' ? 'light' : 'dark'; document.documentElement.dataset.color = mode; localStorage.setItem('fuc_color',mode);localStorage.setItem('fuc_themeMod',mode); root.querySelectorAll('details').forEach(d=>d.open=false);nativeMode(['home','login','register','forget','reset'].includes(getRoute().name)?getRoute().name==='home'?'home':'auth':'user');return;}
|
||||
if (action === 'logout') {clearAuth(); user = {}; sub = {}; go('login'); return;}
|
||||
if(action==='native-close-ticket'){selectedTicket=pageData.find(n=>String(n.id)===button.dataset.id);const b=root.querySelector('#ticket-close-click');b.dataset.action='confirm-close-ticket';b.removeAttribute('title');openModal('#ticket-close-modal');return;}
|
||||
if(action==='native-tab'){selectTab(button);return;}
|
||||
if (action === 'section') {scrollSection(document.getElementById(button.dataset.target));return;}
|
||||
if (action === 'menu') {if(button.classList.contains('sidenav-overlay')&&!document.body.classList.contains('menu-open'))return;toggleMenu(root);return;}
|
||||
if (action === 'mode') {const mode=document.documentElement.dataset.color==='dark'?'light':'dark';localStorage.setItem('fuc_color',mode);localStorage.setItem('fuc_themeMod',mode);location.reload();return;}
|
||||
if (action === 'logout') {clearAuth();user={};sub={};go('login');return;}
|
||||
if (action === 'prev' || action === 'next') {page = Math.max(1,page + (action === 'next' ? 1 : -1)); renderRoute(); return;}
|
||||
if (action === 'retry') {renderRoute(); return;}
|
||||
if (action === 'retry'||action==='refresh-payment') {renderRoute(); return;}
|
||||
if (loading) return;
|
||||
loading = true; button.disabled = true;
|
||||
const seq=routeSequence,order=selectedOrder,ticket=selectedTicket,activeCaptcha=captcha;
|
||||
loading = true; button.disabled = true;const oldLabel=button.textContent;
|
||||
try {
|
||||
if (action === 'copy-sub') {if(button.dataset.client==='trojan')throw Error('XB 未提供独立 Trojan 格式,请复制通用 V2Ray 订阅');await copy(subscriptionUrl(button.dataset.client));}
|
||||
if (action === 'copy-sub') await copy(subscriptionUrl(button.dataset.client));
|
||||
if (action === 'copy-invite') await copy(`${location.origin}${location.pathname}#/register?code=${encodeURIComponent(button.dataset.code)}`);
|
||||
if(action==='import'){const client=button.dataset.client||'meta',url=subscriptionUrl(client);if(!url)throw Error('没有有效的订阅链接');const name=encodeURIComponent(settings.title||'Fuc');const target=client==='shadowrocket'?`shadowrocket://add/sub://${btoa(url)}`:client==='hiddify'?`hiddify://import/${url}#${name}`:client==='sing-box'?`sing-box://import-remote-profile?url=${encodeURIComponent(url)}#${name}`:`clash://install-config?url=${encodeURIComponent(url)}&name=${name}`;if(preview)toast('预览模式:导入格式已校验,不启动客户端');else location.href=target;}
|
||||
if (action === 'buy') {go(`purchase/${button.dataset.id}?period=${button.dataset.period||cycle}`);}
|
||||
if (action === 'reset-security') {button.dataset.action='confirm-reset-security';button.textContent='再次点击确认重置(旧订阅将失效)';return;}
|
||||
if (action === 'confirm-reset-security') {await api('user/resetSecurity');await renderRoute();toast('订阅已重置,请重新复制订阅');}
|
||||
if (action === 'invite') {await api('user/invite/save'); await renderRoute(); toast('邀请码已生成');}
|
||||
if (action === 'send-code') {const email = root.querySelector('[name=email]'); if (!email.reportValidity()) return; await api('passport/comm/sendEmailVerify',{email:email.value}); toast('验证码已发送'); let left = 60; const timer = setInterval(()=>{ if (!button.isConnected || --left <= 0) {clearInterval(timer); button.disabled=false; button.textContent='发送验证码';} else button.textContent=`${left} 秒后重试`; },1000); button.dataset.cooldown='true';}
|
||||
if(action==='import'){const client=button.dataset.client||'meta',target=importUrl(sub.subscribe_url||'',client,settings.title||'Fuc');if(preview)toast('预览模式:导入格式已校验,不启动客户端');else location.href=target;}
|
||||
if (action === 'buy') {const plan=pageData.find(p=>String(p.id)===button.dataset.id),period=button.dataset.period||cycle;if(!canPurchase(plan,user,period))throw Error('此套餐或周期不可购买');selectedPlan={plan,period};const input=root.querySelector('#coupon');if(input)input.value='';openModal('#coupon_modal');}
|
||||
if (action === 'reset-security') {const answer=await confirmSubscriptionReset();if(!answer.value||seq!==routeSequence)return;button.textContent='重置中 ';await api('user/resetSecurity');await successRefresh('重置节点订阅链接成功',seq,1000,'dashboard');}
|
||||
if (action === 'invite') {await api('user/invite/save');await successRefresh('邀请码已生成',seq,1500);}
|
||||
if(action==='check-coupon'&&selectedPlan){const input=root.querySelector('#coupon');if(!input?.value.trim())throw Error('请输入优惠码');const result=await api('user/coupon/check',{code:input.value.trim(),plan_id:selectedPlan.plan.id,period:selectedPlan.period});if(seq===routeSequence)toast('优惠码有效:'+(result.name||input.value)+',最终金额以创建后的订单为准');}
|
||||
if(action==='revoke-session'){await api('user/removeActiveSession',{session_id:button.dataset.id});if(seq===routeSequence){await renderRoute();toast('登录会话已退出');}}
|
||||
if(action==='telegram'){if(!config.is_telegram)throw Error('本站未开启 Telegram');const subscribe=sub.subscribe_url,bot=await api('user/telegram/getBotInfo');if(seq!==routeSequence)return;if(!/^[A-Za-z0-9_]+$/.test(bot.username||''))throw Error('机器人信息无效');const area=root.querySelector('#telegram .modal-body');area.innerHTML='<p>在机器人中发送以下命令绑定账号,请勿向他人透露。</p>';const code=document.createElement('input');code.className='form-control';code.readOnly=true;code.value='/bind '+subscribe;area.append(code);const a=document.createElement('a');a.className='btn btn-primary mt-2';a.href='https://t.me/'+bot.username;a.target='_blank';a.rel='noopener noreferrer';a.textContent='打开 Telegram 机器人';area.append(a);openModal('#telegram');}
|
||||
if(action==='check-gift'){const code=root.querySelector('[name=gift_code]')?.value.trim();if(!code)throw Error('请输入兑换码');const result=await api('user/gift-card/check',{code});if(seq===routeSequence)toast(result.can_redeem?'兑换码有效,请确认兑换':result.reason||'此兑换码不可用');}
|
||||
if (action === 'send-code') {const email = root.querySelector('[name=email]'); if (!email.reportValidity()) return; try{await api('passport/comm/sendEmailVerify',{email:email.value,...await captchaPayload('send_email',activeCaptcha)});}finally{activeCaptcha?.reset();}if(seq!==routeSequence)return;void authFeedback('操作成功','验证码已发送');let left=60;button.textContent='重新发送(60)'; const timer = setInterval(()=>{ if (!button.isConnected || --left <= 0) {clearInterval(timer); button.disabled=false; delete button.dataset.cooldown;button.textContent=oldLabel;} else button.textContent=`重新发送(${left})`; },1000); button.dataset.cooldown='true';}
|
||||
if (action === 'cancel-order' || action === 'close-ticket') {button.dataset.action = `confirm-${action}`;button.textContent = action === 'cancel-order' ? '再次点击确认取消' : '再次点击确认关闭';return;}
|
||||
if (action === 'confirm-cancel-order' && selectedOrder) {await api('user/order/cancel',{trade_no:selectedOrder.trade_no}); await renderRoute();}
|
||||
if (action === 'confirm-close-ticket' && selectedTicket) {await api('user/ticket/close',{id:selectedTicket.id}); await renderRoute();}
|
||||
} catch (error) {toast(error.message || '操作失败');}
|
||||
finally {loading=false; if (!button.dataset.cooldown) button.disabled=false;}
|
||||
if (action === 'confirm-cancel-order' && order) {await api('user/order/cancel',{trade_no:order.trade_no});if(seq===routeSequence)await renderRoute();}
|
||||
if (action === 'confirm-close-ticket' && ticket) {button.textContent='关闭中';await api('user/ticket/close',{id:ticket.id});await successRefresh('工单已关闭',seq);}
|
||||
} catch (error) {if(seq===routeSequence)toast(error.message || '操作失败','error');}
|
||||
finally {loading=false; if (!button.dataset.cooldown) button.disabled=false;if(action==='reset-security'||action==='confirm-close-ticket')button.textContent=oldLabel;}
|
||||
});
|
||||
root.addEventListener('submit',async event => {
|
||||
event.preventDefault(); if (loading) return; const form=event.target, type=form.dataset.form, fields=Object.fromEntries(new FormData(form));
|
||||
const button=form.querySelector('[type=submit]');if(!type||!button)return; button.disabled=true; loading=true;
|
||||
const button=form.querySelector('[type=submit]');if(!type||!button)return;const seq=routeSequence,plan=selectedPlan,order=selectedOrder,ticket=selectedTicket,activeCaptcha=captcha,oldLabel=button.textContent; button.disabled=true; loading=true;if(busyLabels[type])button.textContent=busyLabels[type];
|
||||
try {
|
||||
if(type==='reset-code'){await api('passport/comm/sendEmailVerify',{email:fields.email});go(`reset?email=${encodeURIComponent(fields.email)}`);toast('验证码已发送,请设置新密码');}
|
||||
if(type==='reset-code'){try{await api('passport/comm/sendEmailVerify',{email:fields.email,...await captchaPayload('send_email',activeCaptcha)});}finally{activeCaptcha?.reset();}if(seq!==routeSequence)return;await authFeedback('验证码已发送','请设置新密码');if(seq===routeSequence)go(`reset?email=${encodeURIComponent(fields.email)}`);}
|
||||
if (['login','register','forget'].includes(type)) {
|
||||
if(fields.password_confirm&&fields.password!==fields.password_confirm)throw Error('两次密码不一致');
|
||||
if (authConfigError || Number(config.is_captcha || config.is_recaptcha) === 1) throw new Error('登录配置未就绪或需要人机验证');
|
||||
if (authConfigError) throw new Error(authConfigError);
|
||||
const endpoint = type === 'forget' ? 'forget' : type;
|
||||
const authFields={email:fields.email,password:fields.password};if(type!=='login'){authFields.email_code=fields.email_code;if(fields.invite_code)authFields.invite_code=fields.invite_code;}const result = await api(`passport/auth/${endpoint}`,authFields);
|
||||
if (type === 'forget') {go('login'); toast('密码已重置,请重新登录');}
|
||||
else {if (!result?.auth_data) throw new Error('登录响应缺少身份令牌'); clearAuth(); const store = fields.remember ? localStorage : sessionStorage; store.setItem(storageKey,result.auth_data); go('dashboard');}
|
||||
const authFields={email:fields.email,password:fields.password};if(type!=='login'){authFields.email_code=fields.email_code;if(fields.invite_code)authFields.invite_code=fields.invite_code;}let result;try{if(type==='register')Object.assign(authFields,await captchaPayload('register',activeCaptcha));result=await api(`passport/auth/${endpoint}`,authFields);}finally{if(type==='register')activeCaptcha?.reset();}
|
||||
if(seq!==routeSequence)return;
|
||||
if (type === 'forget') {await authFeedback('密码已重置,请重新登录');if(seq===routeSequence)go('login');}
|
||||
else {await authFeedback(type==='login'?'登录成功':'注册成功',type==='login'?'登录成功':'注册成功');if(seq===routeSequence){saveAuth(result,!!fields.remember);go('dashboard');}}
|
||||
}
|
||||
if (type === 'purchase' && selectedPlan) {const result = await api('user/order/save',{plan_id:selectedPlan.plan.id,period:selectedPlan.period,...(fields.coupon_code?{coupon_code:fields.coupon_code}:{})}); const no = typeof result === 'string' ? result : result?.trade_no; if (!no) throw new Error('创建订单响应缺少订单号,请查看订单列表核实'); go(`checkout/${encodeURIComponent(no)}`);}
|
||||
if(type==='transfer'){const amount=Math.round(Number(fields.amount)*100);if(!Number.isFinite(amount)||amount<=0||amount>Number(user.commission_balance||0))throw Error('请输入有效金额且不超过可用佣金');await api('user/transfer',{transfer_amount:amount});await renderRoute();toast('佣金已转入钱包');}
|
||||
if(type==='withdraw'){await api('user/ticket/withdraw',{withdraw_method:fields.withdraw_method,withdraw_account:fields.withdraw_account});await renderRoute();toast('提现申请已提交');}
|
||||
if (type === 'password') {if (fields.new_password !== fields.password_confirm) throw new Error('两次新密码不一致'); await api('user/changePassword',{old_password:fields.old_password,new_password:fields.new_password}); clearAuth(); go('login'); toast('密码已修改,请重新登录');}
|
||||
if (type === 'reminders') {await api('user/update',{remind_expire:fields.remind_expire ? 1 : 0,remind_traffic:fields.remind_traffic ? 1 : 0}); toast('提醒设置已保存');}
|
||||
if (type === 'ticket') {await api('user/ticket/save',{subject:fields.subject,level:Number(fields.level),message:fields.message}); await renderRoute(); toast('工单已提交');}
|
||||
if (type === 'reply' && selectedTicket) {await api('user/ticket/reply',{id:selectedTicket.id,message:fields.message}); await renderRoute(); toast('回复已发送');}
|
||||
if (type === 'checkout' && selectedOrder) { const result = await api('user/order/checkout',{trade_no:selectedOrder.trade_no,method:fields.method || 0}); const url = typeof result === 'string' ? result : (typeof result?.data === 'string' ? result.data : result?.url); const paymentUrl = url && safeUrl(url); if (result === true || (result?.type === -1 && result?.data === true) || result?.type === 0) {await renderRoute();toast('请核对订单支付状态');} else if (paymentUrl) {location.assign(paymentUrl);} else {throw new Error('此支付渠道尚未适配,请使用原主题完成支付');} }
|
||||
} catch (error) {toast(error.message || '操作失败');}
|
||||
finally {loading=false;if (button.isConnected) button.disabled=false;}
|
||||
if(type==='purchase-coupon'&&plan){const code=(fields.coupon_code||'').trim();if(code)await api('user/coupon/check',{code,plan_id:plan.plan.id,period:plan.period});if(seq!==routeSequence)return;fillPurchaseModal(root,plan.plan,plan.period,code);openModal('#order_modal');}
|
||||
if(type==='gift'){await api('user/gift-card/redeem',{code:fields.gift_code.trim()});await successRefresh('兑换成功',seq);}
|
||||
if (type === 'purchase' && plan) {const result = await api('user/order/save',{plan_id:plan.plan.id,period:plan.period,...(fields.coupon_code?{coupon_code:fields.coupon_code}:{})}); const no = typeof result === 'string' ? result : result?.trade_no; if (!no) throw new Error('创建订单响应缺少订单号,请查看订单列表核实'); if(seq===routeSequence)go(`checkout/${encodeURIComponent(no)}`);}
|
||||
if(type==='transfer'){const amount=Math.round(Number(fields.amount)*100);if(!Number.isFinite(amount)||amount<=0||amount>Number(user.commission_balance||0))throw Error('请输入有效金额且不超过可用佣金');await api('user/transfer',{transfer_amount:amount});await successRefresh('佣金已转入钱包',seq,1500);}
|
||||
if(type==='withdraw'){await api('user/ticket/withdraw',{withdraw_method:fields.withdraw_method,withdraw_account:fields.withdraw_account});await successRefresh('提现申请已提交',seq,1500);}
|
||||
if (type === 'password') {if (fields.new_password !== fields.password_confirm) throw new Error('两次新密码不一致'); await api('user/changePassword',{old_password:fields.old_password,new_password:fields.new_password}); await successRefresh('密码已修改,其他设备的登录已失效',seq);}
|
||||
if (type === 'reminders') {await api('user/update',{remind_expire:fields.remind_expire ? 1 : 0,remind_traffic:fields.remind_traffic ? 1 : 0}); await successRefresh('提醒设置已保存',seq);}
|
||||
if (type === 'ticket') {await api('user/ticket/save',{subject:fields.subject,level:Number(fields.level),message:fields.message}); await successRefresh('工单已提交',seq);}
|
||||
if (type === 'reply' && ticket) {await api('user/ticket/reply',{id:ticket.id,message:fields.message});await successRefresh('回复已发送',seq);}
|
||||
if (type === 'checkout' && order) {
|
||||
const no=order.trade_no,method=paymentMethods.find(m=>String(m.id)===fields.method);
|
||||
const payload={trade_no:no,method:fields.method||0};
|
||||
if(method?.payment==='StripeCredit'){if(!cardPayment)throw Error('银行卡组件尚未就绪');payload.token=await cardPayment.token();}
|
||||
if(seq!==routeSequence)return;
|
||||
const result=await api('user/order/checkout',payload);
|
||||
if(seq!==routeSequence)return;
|
||||
const area=root.querySelector('#payment-result');
|
||||
if(await showPayment(result,area)){await renderRoute();toast('订单状态已更新');}else pollPayment(no,seq);
|
||||
}
|
||||
} catch (error) {if(seq===routeSequence){if(['login','register','forget','reset-code'].includes(type))void authFeedback(error.message||'操作失败','','error');else toast(error.message || '操作失败','error');}}
|
||||
finally {loading=false;if(button.isConnected){button.disabled=false;button.textContent=oldLabel;}}
|
||||
});
|
||||
window.addEventListener('hashchange',()=>{page=1;renderRoute();window.scrollTo(0,0);});
|
||||
window.addEventListener('hashchange',()=>{page=1;cycle='';const hash=location.hash;renderRoute().then(()=>{if(location.hash===hash)window.scrollTo(0,0);});});
|
||||
document.documentElement.dataset.color = localStorage.getItem('fuc_themeMod')==='system'?(matchMedia('(prefers-color-scheme: dark)').matches?'dark':'light'):localStorage.getItem('fuc_color') || 'light';
|
||||
async function start() {const ticket=beginPageProgress();try {root.innerHTML='<div class="page-loading" role="status">正在加载主题…</div>'; try {await nativeReady;} catch {root.innerHTML='<div class="alert" role="alert">原版主题资源加载失败,请刷新或核对主题包是否完整。</div>';return;} try {config=await api('guest/comm/config');} catch(error) {authConfigError=`无法加载登录配置:${error.message}`;} await renderRoute();} finally {finishPageProgress(ticket);}}
|
||||
applyPalette();
|
||||
async function start() {const ticket=beginPageProgress();try {root.innerHTML='<div class="page-loading" role="status">正在加载主题…</div>'; try {await Promise.all([nativeReady,interactionsReady]);} catch {root.innerHTML='<div class="alert" role="alert">原版主题资源加载失败,请刷新或核对主题包是否完整。</div>';return;} try {config=await api('guest/comm/config');} catch(error) {authConfigError=`无法加载登录配置:${error.message}`;} await renderRoute();} finally {finishPageProgress(ticket);}}
|
||||
start();
|
||||
|
||||
let modalFocus=null;
|
||||
function closeModal(){root.querySelectorAll('.modal.show').forEach(n=>{n.classList.remove('show');n.style.display='none';n.setAttribute('aria-hidden','true');});root.querySelectorAll('.modal-backdrop').forEach(n=>n.remove());document.body.classList.remove('modal-open');modalFocus?.focus();}
|
||||
function openModal(selector){closeModal();const modal=root.querySelector(selector||'__none__');if(!modal)return;modalFocus=document.activeElement;modal.classList.add('show');modal.style.display='block';modal.setAttribute('aria-hidden','false');document.body.classList.add('modal-open');const backdrop=document.createElement('div');backdrop.className='modal-backdrop fade show';backdrop.dataset.action='native-dismiss';root.append(backdrop);modal.querySelector('input,textarea,button')?.focus();}
|
||||
function closeModal(){hideModals(root);}
|
||||
function openModal(selector){const modal=root.querySelector(selector||'__none__');if(!modal)return;const previous=root.querySelector('.modal.show');if(previous&&previous!==modal){window.jQuery(previous).one('hidden.bs.modal',()=>showModal(modal));window.jQuery(previous).modal('hide');return;}modalFocus=document.activeElement;window.jQuery(modal).one('hidden.bs.modal',()=>modalFocus?.focus());showModal(modal);}
|
||||
root.addEventListener('click',event=>{if(event.target.matches('.modal.show'))closeModal();});
|
||||
document.addEventListener('keydown',event=>{if((event.key==='Enter'||event.key===' ')&&event.target.matches('[role=button][data-action]')){event.preventDefault();event.target.click();}if(event.key==='Escape')closeModal();if(event.key==='Tab'){const modal=root.querySelector('.modal.show');if(!modal)return;const items=[...modal.querySelectorAll('button:not([disabled]),input:not([disabled]),textarea,select,a[href]')].filter(n=>n.getClientRects().length);if(!items.length)return;const first=items[0],last=items.at(-1);if(event.shiftKey&&document.activeElement===first){event.preventDefault();last.focus();}else if(!event.shiftKey&&document.activeElement===last){event.preventDefault();first.focus();}}});
|
||||
root.addEventListener('input',event=>{if(event.target.id!=='searchbar')return;const q=event.target.value.toLowerCase();root.querySelectorAll('.collapse').forEach(n=>{const card=n.closest('.card');if(card)card.hidden=!card.textContent.toLowerCase().includes(q);});});
|
||||
|
||||
function subscriptionUrl(client){const raw=safeUrl(sub.subscribe_url||'');if(!raw)throw Error('没有有效的订阅链接');const url=new URL(raw);if(client)url.searchParams.set('flag',client);return url.href;}
|
||||
function subscriptionUrl(client){return makeSubscriptionUrl(sub.subscribe_url||'',client||'general');}
|
||||
|
||||
matchMedia('(prefers-color-scheme: dark)').addEventListener('change',event=>{if(localStorage.getItem('fuc_themeMod')==='system'){document.documentElement.dataset.color=event.matches?'dark':'light';localStorage.setItem('fuc_color',document.documentElement.dataset.color);if(document.body.dataset.nativeMode==='user')nativeMode('user');}});
|
||||
|
||||
window.addEventListener('scroll',()=>{document.getElementById('navbar')?.classList.toggle('nav-sticky',window.scrollY>=50);root.querySelectorAll('.scroll-top').forEach(n=>n.style.display=window.scrollY>400?'block':'none');},{passive:true});
|
||||
window.addEventListener('scroll',()=>{document.getElementById('navbar')?.classList.toggle('nav-sticky',window.scrollY>=50);paintScrollTop(root);},{passive:true});
|
||||
|
||||
let viewportFrame;
|
||||
window.addEventListener('resize',()=>{cancelAnimationFrame(viewportFrame);viewportFrame=requestAnimationFrame(()=>{const mode=document.body.dataset.nativeMode;if(!mode)return;nativeMode(mode,mode==='auth'?getRoute().name:'');if(root.querySelector('.modal.show'))document.body.classList.add('modal-open');});});
|
||||
let viewportFrame,desktopViewport=innerWidth>=1200;
|
||||
window.addEventListener('resize',()=>{cancelAnimationFrame(viewportFrame);viewportFrame=requestAnimationFrame(()=>{const mode=document.body.dataset.nativeMode;if(!mode)return;const desktop=innerWidth>=1200;if(desktop===desktopViewport){updateMenu(root);return;}desktopViewport=desktop;nativeMode(mode,mode==='auth'?getRoute().name:'');updateMenu(root);if(root.querySelector('.modal.show'))document.body.classList.add('modal-open');});});
|
||||
|
||||
function saveAuth(result,remember){if(!result?.auth_data)throw Error('登录响应缺少身份令牌');clearAuth();(remember?localStorage:sessionStorage).setItem(storageKey,result.auth_data);}
|
||||
async function captchaPayload(action,instance=captcha){if(authConfigError)throw Error(authConfigError);if(Number(config.is_captcha??config.is_recaptcha)!==1)return {};if(!instance)throw Error('人机验证尚未就绪,请刷新重试');return instance.payload(action);}
|
||||
function pollPayment(no,seq,attempt=0){clearTimeout(paymentTimer);if(attempt>=120||seq!==routeSequence)return;paymentTimer=setTimeout(async()=>{if(seq!==routeSequence)return;try{if(document.visibilityState==='visible'){const status=await api('user/order/check?trade_no='+encodeURIComponent(no));if(seq!==routeSequence)return;if(Number(status)!==0){await renderRoute();toast('订单状态已更新');return;}}pollPayment(no,seq,attempt+1);}catch{const area=root.querySelector('#payment-result');if(area&&seq===routeSequence)area.insertAdjacentHTML('beforeend','<p role="alert">暂时无法自动刷新,请手动刷新订单状态。</p>');}},5000);}
|
||||
root.addEventListener('change',async event=>{if(event.target.name!=='method')return;cardPayment?.dispose();cardPayment=null;const container=root.querySelector('#card-element');container?.replaceChildren();const method=paymentMethods.find(m=>String(m.id)===event.target.value);if(method?.payment!=='StripeCredit'||!container)return;const seq=routeSequence;try{const mounted=await mountCard(api,method.id,container);if(seq===routeSequence&&root.querySelector('[name=method]')?.value===String(method.id))cardPayment=mounted;else mounted?.dispose();}catch(error){if(container.isConnected)container.textContent=error.message;}});
|
||||
@@ -0,0 +1,42 @@
|
||||
const scripts=new Map();
|
||||
export function loadScript(url) {
|
||||
if(!scripts.has(url)) scripts.set(url,new Promise((resolve,reject)=>{
|
||||
const script=document.createElement('script');script.src=url;script.async=true;
|
||||
const timer=setTimeout(()=>{script.remove();scripts.delete(url);reject(Error('外部组件加载超时,请刷新重试'));},15000);
|
||||
script.onload=()=>{clearTimeout(timer);resolve();};
|
||||
script.onerror=()=>{clearTimeout(timer);script.remove();scripts.delete(url);reject(Error('外部组件无法加载,请刷新重试'));};
|
||||
document.head.append(script);
|
||||
}));
|
||||
return scripts.get(url);
|
||||
}
|
||||
export function createCaptcha(config,container) {
|
||||
let sdk,widget,token='',error='',disposed=false;
|
||||
const enabled=Number(config.is_captcha??config.is_recaptcha)===1;
|
||||
const type=config.captcha_type||'recaptcha';
|
||||
const ready=(async()=>{
|
||||
if(!enabled)return;
|
||||
try {
|
||||
const key=config[{turnstile:'turnstile_site_key','recaptcha-v3':'recaptcha_v3_site_key',recaptcha:'recaptcha_site_key'}[type]];
|
||||
if(!key)throw Error('本站人机验证配置不完整,请联系支持');
|
||||
if(type==='turnstile'){
|
||||
await loadScript('https://challenges.cloudflare.com/turnstile/v0/api.js?render=explicit');sdk=window.turnstile;
|
||||
}else if(type==='recaptcha'||type==='recaptcha-v3'){
|
||||
await loadScript('https://www.google.com/recaptcha/api.js?render='+(type==='recaptcha-v3'?encodeURIComponent(key):'explicit'));
|
||||
sdk=window.grecaptcha;await new Promise(resolve=>sdk.ready(resolve));
|
||||
}else throw Error('本站人机验证类型不受支持');
|
||||
if(disposed||!container.isConnected)return;
|
||||
if(type!=='recaptcha-v3')widget=sdk.render(container,{sitekey:key,callback:value=>{token=value;error='';},'expired-callback':()=>token='','error-callback':()=>{token='';error='人机验证失败,请重新验证';}});
|
||||
}catch(e){error=e.message;if(!disposed)container.textContent=error;}
|
||||
})();
|
||||
return {
|
||||
async payload(action='register'){
|
||||
if(!enabled)return {};
|
||||
await ready;if(error)throw Error(error);if(disposed)throw Error('页面已切换,请重新验证');
|
||||
if(type==='recaptcha-v3')token=await sdk.execute(config.recaptcha_v3_site_key,{action});
|
||||
if(!token)throw Error('请先完成人机验证');
|
||||
return {[type==='turnstile'?'turnstile_token':type==='recaptcha-v3'?'recaptcha_v3_token':'recaptcha_data']:token};
|
||||
},
|
||||
reset(){token='';if(sdk&&widget!==undefined&&!disposed)sdk.reset(widget);},
|
||||
dispose(){disposed=true;token='';if(sdk&&widget!==undefined&&type==='turnstile')sdk.remove(widget);}
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
// Compatibility tombstone: customer service is loaded by the XB core renderer.
|
||||
@@ -0,0 +1,9 @@
|
||||
export async function copyText(text,{clipboard=globalThis.navigator?.clipboard,document=globalThis.document}={}){
|
||||
if(clipboard?.writeText){try{await clipboard.writeText(text);return;}catch{}}
|
||||
// Same fallback used by the original ClipboardJS, including HTTP local previews.
|
||||
const active=document.activeElement,input=document.createElement('textarea');
|
||||
input.value=text;input.readOnly=true;input.style.cssText='position:fixed;left:-9999px;top:0';
|
||||
document.body.append(input);
|
||||
try{input.focus({preventScroll:true});input.select();input.setSelectionRange(0,input.value.length);if(!document.execCommand?.('copy'))throw Error('复制失败,请选中链接手动复制');}
|
||||
finally{input.remove();if(active?.isConnected)active.focus();}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
import {marked,DOMPurify} from './vendor/richtext.mjs?v=0.12.0';
|
||||
export function richText(value) {
|
||||
const html=marked.parse(String(value||''),{async:false});
|
||||
return '<div data-fuc-richtext>'+DOMPurify.sanitize(html,{ALLOWED_TAGS:['p','br','strong','b','em','i','ul','ol','li','h1','h2','h3','h4','h5','h6','blockquote','code','pre','a','img','table','thead','tbody','tr','th','td','hr','details','summary','div','span'],ALLOWED_ATTR:['href','src','alt','title','colspan','rowspan'],ALLOW_DATA_ATTR:false})+'</div>';
|
||||
}
|
||||
@@ -6,24 +6,63 @@ export const list = value => Array.isArray(value) ? value : Array.isArray(value?
|
||||
export const groupedList = value => Array.isArray(value) ? value : Object.values(value || {}).flatMap(list);
|
||||
export const periods = {month_price:'月付',quarter_price:'季付',half_year_price:'半年付',year_price:'年付',two_year_price:'两年付',three_year_price:'三年付',onetime_price:'一次性',reset_price:'流量重置'};
|
||||
export const orderStates = ['待支付','开通中','已取消','已完成','已折抵'];
|
||||
export function trafficSummary(sub,logs=null,now=new Date()) {
|
||||
const positive=value=>Number.isFinite(Number(value))?Math.max(0,Number(value)):0;
|
||||
const total=positive(sub.transfer_enable),used=positive(sub.u)+positive(sub.d);
|
||||
const start=new Date(now);start.setHours(0,0,0,0);const end=new Date(start);end.setDate(end.getDate()+1);
|
||||
// StatUserJob has already applied server_rate to u/d; never charge it twice.
|
||||
const today=logs===null?null:logs.reduce((sum,row)=>Number(row.record_at)*1000>=start.getTime()&&Number(row.record_at)*1000<end.getTime()?sum+positive(row.u)+positive(row.d):sum,0);
|
||||
const countedToday=today===null?0:Math.min(used,today),countedUsed=total?Math.min(total,used):0;
|
||||
const pct=value=>total?value/total*100:0;
|
||||
return {remaining:Math.max(0,total-used),today,history:today===null?used:Math.max(0,used-countedToday),series:[pct(Math.max(0,total-used)),pct(Math.max(0,countedUsed-Math.min(countedUsed,countedToday))),pct(Math.min(countedUsed,countedToday))]};
|
||||
}
|
||||
export function soldOut(plan) { const stock = plan.capacity_remaining ?? plan.capacity_limit; return stock === 0 || stock === '0' || (typeof stock === 'string' && !/^\d+$/.test(stock)); }
|
||||
export function canPurchase(plan,user,period) {
|
||||
if(!plan||!Object.hasOwn(periods,period)||plan[period]==null)return false;
|
||||
const owner=user.plan_id!=null&&String(user.plan_id)===String(plan.id);
|
||||
if(period==='reset_price')return owner;
|
||||
if(owner)return plan.renew!==false&&plan.renew!==0;
|
||||
return plan.show!==false&&plan.show!==0&&plan.sell!==false&&plan.sell!==0&&!soldOut(plan);
|
||||
}
|
||||
export function safeUrl(value, extra = []) {
|
||||
if(typeof value!=='string'||!value.trim())return '';
|
||||
try { const url = new URL(value, globalThis.location?.origin || 'http://localhost'); return ['http:','https:',...extra].includes(url.protocol) && !url.username && !url.password ? url.href : ''; } catch { return ''; }
|
||||
}
|
||||
export function createApi({fetcher = fetch, getToken = () => '', onUnauthorized = () => {}} = {}) {
|
||||
return async (path, data, method = data === undefined ? 'GET' : 'POST') => {
|
||||
const controller = new AbortController(); const timer = setTimeout(() => controller.abort(), 20000);
|
||||
const requestToken=getToken();
|
||||
try {
|
||||
const response = await fetcher(`/api/v1/${path}`, {
|
||||
method, credentials:'same-origin', signal:controller.signal,
|
||||
headers:{Accept:'application/json',...(data !== undefined ? {'Content-Type':'application/json'} : {}),...(getToken() ? {Authorization:getToken()} : {})},
|
||||
headers:{Accept:'application/json',...(data !== undefined ? {'Content-Type':'application/json'} : {}),...(requestToken ? {Authorization:requestToken} : {})},
|
||||
...(data !== undefined ? {body:JSON.stringify(data)} : {}),
|
||||
});
|
||||
let payload; try { payload = await response.json(); } catch { throw new Error('接口未返回有效数据,请检查网站配置'); }
|
||||
if (response.status === 401) onUnauthorized();
|
||||
if ((response.status === 401 || (response.status === 403 && /未登录|登陆已过期|登录已过期|unauthenticated/i.test(payload.message || ''))) && requestToken===getToken()) onUnauthorized();
|
||||
if (!response.ok || payload.status === 'fail' || payload.status === false) throw new Error(payload.message || `请求失败(${response.status})`);
|
||||
return Object.hasOwn(payload, 'type') ? payload : Object.hasOwn(payload, 'data') ? payload.data : payload;
|
||||
} catch (error) { if (error.name === 'AbortError') throw new Error('请求超时,请稍后重试'); throw error; }
|
||||
finally { clearTimeout(timer); }
|
||||
};
|
||||
}
|
||||
|
||||
export function paymentResult(result) {
|
||||
if (result?.type === -1 && result.data === true) return {kind:'complete'};
|
||||
if (result?.type === -1) throw new Error(typeof result.data==='string'?result.data:'支付未完成,请重试');
|
||||
if (result?.type === 0 && typeof result.data === 'string' && result.data.trim()) return {kind:'qr',value:result.data};
|
||||
if (result?.type === 1 && typeof result.data === 'string') {
|
||||
const value=result.data.trim();
|
||||
if (/^https?:\/\//i.test(value) && safeUrl(value)) return {kind:'url',value:safeUrl(value)};
|
||||
if (/<form\b/i.test(value)) return {kind:'form',value};
|
||||
}
|
||||
throw new Error('支付渠道返回无效结果,请刷新订单后重试或联系支持');
|
||||
}
|
||||
|
||||
export function routeFromHash(hash) {
|
||||
const [path,search='']=(hash.replace(/^#/, '')||'/home').split('?');
|
||||
const [route,id]=path.replace(/^\//,'').split('/');
|
||||
const query=new URLSearchParams(search);
|
||||
const aliases={order:id?'checkout':'orders',shop:'plans',plan:'plans',invite:'invite',ticket:id?'ticket':'tickets',document:'knowledge',subscribe:'myplan'};
|
||||
return {name:aliases[route]||route||'home',id,query};
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
// FUC's original UI plugins, driven only by the XB theme's event bindings.
|
||||
import {loadScript} from './captcha.mjs?v=0.12.0';
|
||||
const base=new URL('./native/',import.meta.url).href;
|
||||
let landingUI;
|
||||
export const interactionsReady=loadScript(base+'widgets.min.js?v=0.12.0').then(()=>loadScript(base+'sweetalert2.min.js?v=0.12.0')).then(()=>loadScript(base+'smooth-scroll.min.js?v=0.12.0')).then(async()=>{
|
||||
const userUI=window.bootstrap;
|
||||
// The source landing page uses Bootstrap 5; keep its data APIs separate from user Bootstrap 4.
|
||||
document.body.setAttribute('data-bs-no-jquery','');
|
||||
try{await loadScript(base+'landing-bootstrap5.min.js?v=0.12.0');landingUI=window.bootstrap;}
|
||||
finally{window.bootstrap=userUI;document.body.removeAttribute('data-bs-no-jquery');}
|
||||
// Delegated data APIs would duplicate the theme's explicit XB action handlers.
|
||||
window.jQuery(document).off('.bs.modal.data-api .bs.collapse.data-api .bs.tab.data-api .bs.dropdown.data-api');
|
||||
window.Waves.init();
|
||||
document.addEventListener('click',event=>{
|
||||
if(event.target.closest('[data-action="native-dropdown"],.dropdown-menu input,.dropdown-menu textarea'))return;
|
||||
document.querySelectorAll('[data-action="native-dropdown"][aria-expanded="true"]').forEach(n=>window.jQuery(n).dropdown('hide'));
|
||||
});
|
||||
});
|
||||
let scrollbar=null,hoverTimer;
|
||||
let smoothScroll=null,menuTimer,resizeTimer;
|
||||
let gestures=[];
|
||||
export function paintInteractions(root){
|
||||
const $=window.jQuery;if(!$)return;
|
||||
scrollbar?.destroy();scrollbar=null;
|
||||
const menu=root.querySelector('.main-menu-content');
|
||||
if(menu)scrollbar=new window.PerfectScrollbar(menu,{suppressScrollX:true,wheelPropagation:false});
|
||||
if(menu&&!root.querySelector('.sidenav-overlay')){const overlay=document.createElement('div');overlay.className='sidenav-overlay d-none';overlay.dataset.action='menu';root.append(overlay);}
|
||||
window.Waves.attach(".btn:not([class*='btn-relief-']):not([class*='btn-gradient-']):not([class*='btn-outline-']):not([class*='btn-flat-'])",['waves-float','waves-light']);
|
||||
window.Waves.attach("[class*='btn-outline-']");window.Waves.attach("[class*='btn-flat-']");
|
||||
$(root).find('[data-toggle="tooltip"]').tooltip({container:'body'});
|
||||
root.querySelectorAll('.navigation-main li').forEach(item=>item.addEventListener('mouseenter',()=>{
|
||||
root.querySelectorAll('.navigation-main .hover').forEach(n=>n.classList.remove('hover'));
|
||||
item.classList.add('hover');
|
||||
}));
|
||||
root.querySelectorAll('.main-menu,.navbar-header').forEach(menu=>{
|
||||
menu.addEventListener('mouseenter',()=>{clearTimeout(hoverTimer);if(innerWidth>=1200)root.querySelectorAll('.main-menu,.navbar-header').forEach(n=>n.classList.add('expanded'));});
|
||||
menu.addEventListener('mouseleave',()=>{hoverTimer=setTimeout(()=>{if(document.body.classList.contains('menu-collapsed')&&!root.querySelector('.main-menu:hover,.navbar-header:hover'))root.querySelectorAll('.main-menu,.navbar-header').forEach(n=>n.classList.remove('expanded'));},1);});
|
||||
});
|
||||
root.querySelectorAll('.modal').forEach(modal=>$(modal).on('hidden.bs.modal',()=>modal.setAttribute('aria-hidden','true')));
|
||||
const rtl=document.documentElement.dataset.textdirection==='rtl';
|
||||
const menuElement=root.querySelector('.main-menu');
|
||||
if(menuElement){const gesture=new window.Hammer(menuElement);gesture.get('pan').set({direction:window.Hammer.DIRECTION_ALL,threshold:250});gesture.on(rtl?'panright':'panleft',()=>{if(innerWidth<1200&&document.body.classList.contains('menu-open'))toggleMenu(root);});gestures.push(gesture);}
|
||||
const edge=root.querySelector('.drag-target');
|
||||
if(edge){const gesture=new window.Hammer(edge);gesture.on(rtl?'panleft':'panright',()=>{if(innerWidth<1200&&!document.body.classList.contains('menu-open'))toggleMenu(root);});gestures.push(gesture);}
|
||||
const backdrop=root.querySelector('.sidenav-overlay');
|
||||
if(backdrop){const gesture=new window.Hammer(backdrop);gesture.on('tap',()=>{if(innerWidth<1200&&document.body.classList.contains('menu-open'))toggleMenu(root);});gestures.push(gesture);}
|
||||
updateMenu(root);
|
||||
}
|
||||
export function updateMenu(root){
|
||||
const body=document.body,expanded=body.classList.contains('menu-expanded')||body.classList.contains('menu-open');
|
||||
root.querySelectorAll('.menu-toggle').forEach(n=>n.classList.toggle('is-active',expanded));
|
||||
root.querySelectorAll('.modern-nav-toggle .toggle-icon').forEach(n=>{n.classList.toggle('icon-disc',expanded);n.classList.toggle('icon-circle',!expanded);});
|
||||
const overlay=root.querySelector('.sidenav-overlay'),open=innerWidth<1200&&body.classList.contains('menu-open');
|
||||
if(overlay){overlay.classList.toggle('d-block',open);overlay.classList.toggle('d-none',!open);}
|
||||
body.style.overflow=open?'hidden':'';scrollbar?.update();
|
||||
}
|
||||
export function toggleMenu(root){
|
||||
clearTimeout(menuTimer);document.body.classList.add('changing-menu');
|
||||
if(innerWidth<1200){const open=document.body.classList.toggle('menu-open');document.body.classList.toggle('menu-hide',!open);}
|
||||
else{document.body.classList.toggle('menu-collapsed');document.body.classList.toggle('menu-expanded');localStorage.setItem('fuc_menuToggle',document.body.classList.contains('menu-collapsed')?'close':'open');}
|
||||
updateMenu(root);clearTimeout(resizeTimer);resizeTimer=setTimeout(()=>window.dispatchEvent(new window.Event('resize')),200);menuTimer=setTimeout(()=>{document.body.classList.remove('changing-menu');scrollbar?.update();},500);
|
||||
}
|
||||
export function disposeInteractions(root){
|
||||
scrollbar?.destroy();scrollbar=null;clearTimeout(hoverTimer);clearTimeout(menuTimer);clearTimeout(resizeTimer);gestures.forEach(g=>g.destroy());gestures=[];
|
||||
const $=window.jQuery;if(!$)return;
|
||||
// A full FUC navigation destroys the old document. Finish Bootstrap's pending
|
||||
// transition callbacks before destroying a view, so they cannot access disposed
|
||||
// modal state or open the next modal on the new XB route.
|
||||
root.querySelectorAll('.modal').forEach(modal=>{
|
||||
$(modal).off('hidden.bs.modal');
|
||||
$('.modal-backdrop').trigger('transitionend');
|
||||
$(modal.querySelector('.modal-dialog')).trigger('transitionend');
|
||||
$(modal).trigger('transitionend');
|
||||
$('.modal-backdrop').trigger('transitionend');
|
||||
$(modal).modal('dispose');
|
||||
});
|
||||
root.querySelectorAll('.native-public .collapse,#navbarCollapse').forEach(n=>landingUI?.Collapse.getInstance?.(n)?.dispose());
|
||||
$(root).find('[data-toggle="tooltip"]').tooltip('dispose');
|
||||
document.querySelectorAll('.tooltip').forEach(n=>n.remove());
|
||||
document.querySelectorAll('.modal-backdrop').forEach(n=>n.remove());
|
||||
window.Swal?.close();
|
||||
document.body.classList.remove('modal-open');document.body.style.removeProperty('padding-right');
|
||||
document.body.style.removeProperty('overflow');
|
||||
}
|
||||
export function showModal(modal){if(modal)window.jQuery(modal).modal('show');}
|
||||
export function hideModals(root){root.querySelectorAll('.modal.show').forEach(modal=>window.jQuery(modal).modal('hide'));}
|
||||
export function toggleCollapse(target,trigger){
|
||||
if(!target||target.classList.contains('collapsing'))return;
|
||||
const opening=!target.classList.contains('show');window.jQuery(target).collapse('toggle');
|
||||
if(trigger&&(target.classList.contains('collapsing')||target.classList.contains('show')===opening)){
|
||||
trigger.setAttribute('aria-expanded',String(opening));trigger.classList.toggle('collapsed',!opening);
|
||||
}
|
||||
}
|
||||
export function selectTab(trigger){trigger.setAttribute('data-target','#'+trigger.dataset.target.replace(/^#/,''));window.jQuery(trigger).tab('show');}
|
||||
export function toggleDropdown(trigger){window.jQuery(trigger).dropdown('toggle');}
|
||||
export function notify(message,type='success'){return window.Swal.fire({type,titleText:message,timer:1500,showConfirmButton:false});}
|
||||
// FUC auth.js uses a confirmation dialog, unlike the timed user-center notices.
|
||||
export function authFeedback(title,message='',type='success'){return window.Swal.fire({type,titleText:title,text:message});}
|
||||
export function confirmSubscriptionReset(){return window.Swal.fire({type:'info',titleText:'请注意!',text:'重置节点订阅链接后,原订阅链接将失效,并生成新的订阅链接,您需要在所有客户端重新添加新的订阅后更新节点才能使用',showCancelButton:true,confirmButtonText:'确定重置',cancelButtonText:'取消'});}
|
||||
export function scrollTop(){window.jQuery('html,body').animate({scrollTop:0},1000);}
|
||||
export function scrollSection(target){if(!target)return;smoothScroll??=new window.SmoothScroll();smoothScroll.animateScroll(target,null,{speed:500});}
|
||||
export function paintScrollTop(root){const $=window.jQuery;if(!$)return;root.querySelectorAll('.scroll-top').forEach(n=>{$(n).stop(true)[window.scrollY>400?'fadeIn':'fadeOut']();});}
|
||||
+96
-49
@@ -1,29 +1,45 @@
|
||||
import {escape as e,money,bytes,date,safeUrl,soldOut} from './core.mjs';
|
||||
import {getPalette,nativePalette,applyPalette,paintPaletteOptions,chartColors} from './palettes.mjs?v=0.12.0';
|
||||
import {escape as e,money,bytes,date,safeUrl,soldOut,trafficSummary,canPurchase} from './core.mjs?v=0.12.0';
|
||||
const base = new URL('./native/',import.meta.url).href;
|
||||
let templates = {},sourceStyles={};
|
||||
const styleReady=fetch(base+'styles.json').then(r=>r.json()).then(v=>sourceStyles=v);
|
||||
export const nativeReady = Promise.all(['footer','header','index','home','login','register','forget','reset','plans','myplan','wallet','invite','profile','tickets','ticket','servers','notices','knowledge','article','faq','orders','purchase','checkout','planlog','walletlog','afflog'].map(async name=>{const r=await fetch(`${base}${name}.html`);if(!r.ok)throw Error('原版模板加载失败');templates[name]=await r.text();})).then(()=>styleReady);
|
||||
const styleReady=fetch(base+'styles.json?v=0.12.0').then(r=>r.json()).then(v=>sourceStyles=v);
|
||||
export const nativeReady = Promise.all(['footer','header','index','home','login','register','forget','reset','plans','myplan','wallet','invite','profile','tickets','ticket','servers','notices','knowledge','article','faq','orders','purchase','checkout','planlog','walletlog','afflog'].map(async name=>{const r=await fetch(`${base}${name}.html?v=0.12.0`);if(!r.ok)throw Error('原版模板加载失败');templates[name]=await r.text();})).then(()=>styleReady);
|
||||
let nativeSwiper=null,swiperLibrary=null;
|
||||
export async function paintNativeHome(){if(!document.querySelector('.native-public .swiper-container'))return;if(!window.Swiper){if(!swiperLibrary)swiperLibrary=new Promise((resolve,reject)=>{const s=document.createElement('script');s.src=base+'assets/cool/swiper.min.js';s.onload=resolve;s.onerror=reject;document.head.append(s);});await swiperLibrary;}const el=document.querySelector('.native-public .swiper-container');if(!el)return;if(nativeSwiper){try{nativeSwiper.destroy(true,true);}catch{}}el.querySelectorAll('.swiper-slide').forEach(n=>{n.style.removeProperty('display');n.style.removeProperty('width');});el.querySelector('.swiper-wrapper')?.removeAttribute('style');nativeSwiper=new window.Swiper(el,{direction:'horizontal',loop:true,autoplay:{delay:5000,disableOnInteraction:true},navigation:{nextEl:'.swiper-button-next',prevEl:'.swiper-button-prev'}});}
|
||||
let currentMode='',chartData=null,chartInstance=null,chartLibrary=null;
|
||||
export async function paintNativeChart(){if(!chartData||!document.getElementById('donut-chart'))return;if(!window.ApexCharts){if(!chartLibrary)chartLibrary=new Promise((resolve,reject)=>{const s=document.createElement('script');s.src=base+'theme/cool/assets/vendors/js/charts/apexcharts.min.js';s.onload=resolve;s.onerror=reject;document.head.append(s);});await chartLibrary;}const target=document.getElementById('donut-chart');if(!target)return;if(chartInstance){try{chartInstance.destroy();}catch{}}target.innerHTML='';chartInstance=new window.ApexCharts(target,{chart:{height:350,type:'donut',animations:{enabled:false}},legend:{show:true,position:'bottom'},labels:['可用','历史使用','今日使用(未提供)'],series:[chartData.remain,chartData.used,0],colors:['#7D72F1','#FF9F43','#EA5455'],dataLabels:{enabled:true,formatter:val=>parseInt(val)+'%'},plotOptions:{pie:{donut:{labels:{show:true,name:{fontSize:'2rem',fontFamily:'Nunito'},value:{fontSize:'1rem',fontFamily:'Nunito',formatter:val=>parseInt(val)+'%'}}}}}});await chartInstance.render();}
|
||||
let currentMode='',styleSequence=0,chartData=null,chartInstance=null,chartLibrary=null;
|
||||
export async function paintNativeChart(){if(!chartData||!document.getElementById('donut-chart')||document.getElementById('donut-chart').hidden)return;if(!window.ApexCharts){if(!chartLibrary)chartLibrary=new Promise((resolve,reject)=>{const s=document.createElement('script');s.src=base+'theme/cool/assets/vendors/js/charts/apexcharts.min.js';s.onload=resolve;s.onerror=reject;document.head.append(s);});await chartLibrary;}const target=document.getElementById('donut-chart');if(!target)return;if(chartInstance){try{chartInstance.destroy();}catch{}}target.innerHTML='';chartInstance=new window.ApexCharts(target,{chart:{height:350,type:'donut'},legend:{show:true,position:'bottom'},labels:['可用','历史使用',chartData.todayKnown?'今日使用':'今日使用(未提供)'],series:chartData.series,colors:chartColors(),dataLabels:{enabled:true,formatter:val=>parseInt(val)+'%'},plotOptions:{pie:{donut:{labels:{show:true,name:{fontSize:'2rem',fontFamily:'Nunito'},value:{fontSize:'1rem',fontFamily:'Nunito',formatter:val=>parseInt(val)+'%'}}}}}});await chartInstance.render();}
|
||||
export async function prepareNativeMode(mode,page='') {
|
||||
const key=mode==='home'?'home':mode==='auth'?(page||'login'):(page||document.body.dataset.nativePage||'dashboard');
|
||||
const sourcePage=({dashboard:'index','knowledge-detail':'article'})[key]||key;
|
||||
const palette=getPalette(),signature=key+':'+palette;
|
||||
if(currentMode===signature)return;
|
||||
const seq=++styleSequence;
|
||||
const paths=(mode==='user'?[...sourceStyles.header,...(sourceStyles[sourcePage]||[])]:sourceStyles[sourcePage]||[]).map(p=>p.replace('theme/style-purple.css','theme/style-'+nativePalette()+'.css'));
|
||||
paths.push('seasonal.css');
|
||||
const existing=new Map([...document.querySelectorAll('[data-fuc-native]')].map(n=>[n.href,n]));
|
||||
const links=paths.map(path=>{const url=new URL(path,base);url.searchParams.set('theme_v','0.12.0');const href=url.href;if(existing.has(href))return existing.get(href);const n=document.createElement('link');n.rel='stylesheet';n.href=href;n.media='not all';n.dataset.fucNative='true';n.ready=new Promise((resolve,reject)=>{n.onload=resolve;n.onerror=()=>reject(Error('原版样式加载失败'));});document.head.append(n);return n;});
|
||||
await Promise.all(links.map(n=>n.ready));if(seq!==styleSequence)return;
|
||||
document.querySelectorAll('[data-fuc-native]').forEach(n=>{if(!links.includes(n))n.remove();});
|
||||
links.forEach(n=>{n.media='all';document.head.append(n);});
|
||||
currentMode=signature;
|
||||
}
|
||||
// Original app.js selects one menu/navbar scheme after the template's two classes.
|
||||
function syncNativeMenu(root){
|
||||
const dark=document.documentElement.dataset.color==='dark';
|
||||
root.querySelectorAll('.main-menu').forEach(n=>{n.classList.toggle('menu-light',!dark);n.classList.toggle('menu-dark',dark);});
|
||||
root.querySelectorAll('.header-navbar').forEach(n=>{n.classList.toggle('navbar-light',!dark);n.classList.toggle('navbar-dark',dark);});
|
||||
}
|
||||
export function nativeMode(mode, page='') {
|
||||
applyPalette();
|
||||
let icon=document.getElementById('native-icon');if(!icon){icon=document.createElement('link');icon.id='native-icon';icon.rel='icon';icon.type='image/svg+xml';icon.href=base+'images/brand/fuc-mark.svg';document.head.append(icon);}
|
||||
const key=mode==='home'?'home':mode==='auth'?(page||'login'):(page||document.body.dataset.nativePage||'dashboard');
|
||||
if(mode!=='home'&&nativeSwiper){try{nativeSwiper.destroy(true,true);}catch{}nativeSwiper=null;}
|
||||
const sourcePage=({dashboard:'index','knowledge-detail':'article'})[key]||key;
|
||||
const paths=mode==='user'?[...sourceStyles.header,...(sourceStyles[sourcePage]||[])]:sourceStyles[sourcePage]||[];
|
||||
const palette=localStorage.getItem('fuc_themeLight')==='cyan'?'cyan':'purple';
|
||||
const signature=key+':'+palette;
|
||||
if(currentMode!==signature){
|
||||
document.querySelectorAll('[data-fuc-native],#native-auth,#native-color,#native-brand').forEach(n=>n.remove());
|
||||
for(let path of paths){path=path.replace('theme/style-purple.css','theme/style-'+palette+'.css');const link=document.createElement('link');link.rel='stylesheet';link.href=base+path;link.dataset.fucNative='true';document.head.append(link);}
|
||||
currentMode=signature;
|
||||
}
|
||||
if((mode!=='user'||key!=='dashboard')&&chartInstance){try{chartInstance.destroy();}catch{}chartInstance=null;}
|
||||
if(currentMode!==key+':'+getPalette())void prepareNativeMode(mode,page);
|
||||
let dark=document.getElementById('native-dark');if(!dark){dark=document.createElement('link');dark.id='native-dark';dark.rel='stylesheet';dark.href=base+'theme/cool/assets/css/theme/dark-layout.css';document.head.append(dark);}dark.disabled=mode!=='user'||document.documentElement.dataset.color!=='dark';document.head.append(dark);
|
||||
let bridge=document.getElementById('native-bridge');if(!bridge){bridge=document.createElement('link');bridge.id='native-bridge';bridge.rel='stylesheet';bridge.href=base+'bridge.css';}document.head.append(bridge);
|
||||
let bridge=document.getElementById('native-bridge');if(!bridge){bridge=document.createElement('link');bridge.id='native-bridge';bridge.rel='stylesheet';bridge.href=base+'bridge.css?v=0.12.0';}document.head.append(bridge);const seasonal=document.querySelector('link[data-fuc-native][href*="/seasonal.css"]');if(seasonal)document.head.append(seasonal);
|
||||
document.body.className=mode==='home'?'native-public':mode==='auth'?'vertical-layout vertical-menu-modern 1-column navbar-floating footer-static bg-full-screen-image blank-page':`vertical-layout ${innerWidth>=1200?'vertical-menu-modern menu-expanded':'vertical-overlay-menu'} navbar-floating footer-static ${document.documentElement.dataset.color==='dark'?'dark-layout':''}`;
|
||||
if(mode==='user'&&innerWidth>=1200&&localStorage.getItem('fuc_menuToggle')==='close'){document.body.classList.remove('menu-expanded');document.body.classList.add('menu-collapsed');}document.body.dataset.nativeMode=mode;document.body.classList.add(window.Pace?.running?'pace-running':'pace-done');
|
||||
if(mode==='user'&&innerWidth>=1200&&localStorage.getItem('fuc_menuToggle')==='close'){document.body.classList.remove('menu-expanded');document.body.classList.add('menu-collapsed');}document.body.dataset.nativeMode=mode;document.body.dataset.menu=innerWidth>=1200?'vertical-menu-modern':'vertical-overlay-menu';document.body.classList.add(window.Pace?.running?'pace-running':'pace-done');syncNativeMenu(document);
|
||||
}
|
||||
|
||||
const routes={'/':'#/home','/user':'#/dashboard','/user/':'#/dashboard','/user/shop':'#/plans','/user/announcement':'#/notices','/user/code':'#/wallet','/user/plan':'#/myplan','/user/invite':'#/invite','/user/profile':'#/profile','/user/ticket':'#/tickets','/user/node':'#/servers','/user/faq/1':'#/faq','/auth/login':'#/login','/auth/register':'#/register','/password/reset':'#/forget'};
|
||||
@@ -32,9 +48,9 @@ function sanitize(raw) {
|
||||
const doc=new DOMParser().parseFromString(raw,'text/html');
|
||||
doc.querySelectorAll('script,iframe,object,embed,link,meta').forEach(n=>n.remove());
|
||||
doc.querySelectorAll('*').forEach(n=>{for(const a of [...n.attributes])if(a.name.startsWith('on')||a.name.startsWith('data-cf-'))n.removeAttribute(a.name);});
|
||||
doc.querySelectorAll('[src]').forEach(n=>{let src=n.getAttribute('src');if(src==='/fucai192.png')src='/fucai192.png';if(src.startsWith('../theme/'))src=src.slice(2);if(src.startsWith('/')||src.startsWith('assets/cool/'))n.setAttribute('src',base+src.replace(/^\//,''));else if(!src.startsWith('data:'))n.removeAttribute('src');});
|
||||
doc.querySelectorAll('[src]').forEach(n=>{if(n.closest('[data-fuc-richtext]'))return;let src=n.getAttribute('src');if(src==='/fucai192.png')src='/fucai192.png';if(src.startsWith('../theme/'))src=src.slice(2);if(src.startsWith('/')||src.startsWith('assets/cool/'))n.setAttribute('src',base+src.replace(/^\//,''));else if(!src.startsWith('data:'))n.removeAttribute('src');});
|
||||
doc.querySelectorAll('[style]').forEach(n=>{n.setAttribute('style',n.getAttribute('style').replace(/url\((['"]?)(\/[^)'" ]+)\1\)/g,(_,q,p)=>`url(${base+p.slice(1)})`));});
|
||||
doc.querySelectorAll('a[href]').forEach(n=>{const href=n.getAttribute('href');if(routes[href])n.href=routes[href];else if(/^\/user\/ticket\/[^/]+\/detail$/.test(href))n.href='#/ticket/'+href.split('/')[3];else if(/^\/user\/docs\/[^/]+\/view$/.test(href))n.href='#/knowledge/'+href.split('/')[3];else if(href.startsWith('#/knowledge'))n.href='#/knowledge';else if(href.startsWith('/clients/')){n.removeAttribute('href');n.dataset.action='native-unavailable';n.title='下载地址尚未接入,请查看安装教程';}else if(href.startsWith('#')&&doc.getElementById(href.slice(1))&&!['pill','tab','collapse','modal'].includes(n.dataset.toggle)){n.dataset.action='section';n.dataset.target=href.slice(1);n.href='#';}else if(href.startsWith('javascript:')||href.startsWith('https:')||href.startsWith('http:')){n.removeAttribute('href');n.dataset.action='native-unavailable';}});
|
||||
doc.querySelectorAll('a[href]').forEach(n=>{if(n.closest('[data-fuc-richtext]'))return;const href=n.getAttribute('href');if(routes[href])n.href=routes[href];else if(/^\/user\/ticket\/[^/]+\/detail$/.test(href))n.href='#/ticket/'+href.split('/')[3];else if(/^\/user\/docs\/[^/]+\/view$/.test(href))n.href='#/knowledge/'+href.split('/')[3];else if(href.startsWith('#/knowledge'))n.href=/^#\/knowledge\/\d+$/.test(href)?href:'#/knowledge';else if(href.startsWith('/clients/')){n.removeAttribute('href');n.dataset.action='native-unavailable';n.title='下载地址尚未接入,请查看安装教程';}else if(href.startsWith('#')&&doc.getElementById(href.slice(1))&&!['pill','tab','collapse','modal'].includes(n.dataset.toggle||n.dataset.bsToggle)){n.dataset.action='section';n.dataset.target=href.slice(1);n.href='#';}else if(href.startsWith('javascript:')||href.startsWith('https:')||href.startsWith('http:')){n.removeAttribute('href');n.dataset.action='native-unavailable';}});
|
||||
doc.querySelectorAll('[data-toggle="pill"],[data-toggle="tab"]').forEach(n=>{const href=n.getAttribute('href');if(href?.startsWith('#')){n.dataset.action='native-tab';n.dataset.target=href.slice(1);n.href='#';}});
|
||||
doc.querySelectorAll('[data-toggle="dropdown"]').forEach(n=>{n.dataset.action='native-dropdown';n.removeAttribute('data-toggle');});
|
||||
doc.querySelectorAll('.icon-sun,.icon-moon').forEach(n=>{if(n.closest('a'))n.closest('a').dataset.action='mode';});
|
||||
@@ -42,35 +58,41 @@ function sanitize(raw) {
|
||||
doc.querySelectorAll('[href="/user/logout"]').forEach(n=>{n.removeAttribute('href');n.dataset.action='logout';});
|
||||
doc.querySelectorAll('[data-clipboard-text]').forEach(n=>{n.dataset.client=clientName(n.textContent);n.removeAttribute('data-clipboard-text');n.dataset.action='copy-sub';});
|
||||
doc.querySelectorAll('.dropdown-item').forEach(n=>{if(n.textContent.includes('一键导入')){n.dataset.action='import';n.dataset.client=clientName(n.textContent);}});
|
||||
doc.querySelectorAll('#checkin').forEach(n=>{n.disabled=true;n.title='当前 XB 未提供签到接口';});
|
||||
doc.querySelectorAll('#checkin').forEach(n=>{n.disabled=true;n.title='本站未开放签到';});
|
||||
return [...doc.head.querySelectorAll('style')].map(n=>n.outerHTML).join('')+doc.body.innerHTML;
|
||||
}
|
||||
function fill(raw,data) {return raw.replace(/__([A-Z_0-9]+)__/g,(_,key)=>data[key] ?? '—');}
|
||||
export function nativeFooter(brand){return sanitize(templates.footer).replace(/福云/g,e(brand)).replace('SSPANEL','XB').replace('type="button" style="margin-bottom: 2.5rem"','type="button" data-action="scroll-top" style="margin-bottom: 2.5rem"').replace('href="/staff.html"','href="#" data-action="native-unavailable"');}
|
||||
export function nativeHeader(user,brand,route) {
|
||||
export function nativeHeader(user,brand,route,config={}) {
|
||||
const html=sanitize(fill(templates.header,{NAME:e((user.email||'').split('@')[0]),EMAIL:e(user.email),BRAND:e(brand)}));
|
||||
const host=document.createElement('div');host.innerHTML=html;host.querySelectorAll('.icon-bell').forEach(i=>{const a=i.closest('a');if(a){a.href='#/notices';a.removeAttribute('data-action');}});host.querySelectorAll('a[href^="#/"]').forEach(a=>a.removeAttribute('target'));host.querySelectorAll('.navigation-main a').forEach(a=>a.parentElement.classList.toggle('active',a.getAttribute('href')===`#/${route}`));host.querySelectorAll('[data-toggle="modal"]').forEach(n=>{n.dataset.action='native-modal';n.dataset.target=n.getAttribute('data-target');});host.querySelectorAll('[data-dismiss="modal"]').forEach(n=>n.dataset.action='native-dismiss');const save=host.querySelector('#panel_option_save');if(save)save.dataset.action='native-settings';for(const id of ['themeMod','themeLight','menuToggle']){const n=host.querySelector('#'+id);if(n)n.value=localStorage.getItem('fuc_'+id)||({themeMod:'light',themeLight:'purple',menuToggle:'open'}[id]);}return host.innerHTML;
|
||||
const host=document.createElement('div');host.innerHTML=html;syncNativeMenu(host);const community=[...host.querySelectorAll('a')].find(n=>n.textContent.includes('加入 Telegram'));if(community){const url=safeUrl(config.telegram_discuss_link||'');if(url){community.href=url;community.target='_blank';community.rel='noopener noreferrer';community.removeAttribute('data-action');community.removeAttribute('title');}else{community.dataset.reason='本站暂未配置社群入口';}}host.querySelectorAll('.icon-bell').forEach(i=>{const a=i.closest('a');if(a){a.href='#/notices';a.removeAttribute('data-action');}});host.querySelectorAll('a[href^="#/"]').forEach(a=>a.removeAttribute('target'));host.querySelectorAll('.navigation-main a').forEach(a=>a.parentElement.classList.toggle('active',a.getAttribute('href')===`#/${route}`));host.querySelectorAll('[data-toggle="modal"]').forEach(n=>{n.dataset.action='native-modal';n.dataset.target=n.getAttribute('data-target');});host.querySelectorAll('[data-dismiss="modal"]').forEach(n=>n.dataset.action='native-dismiss');const save=host.querySelector('#panel_option_save');if(save)save.dataset.action='native-settings';for(const id of ['themeMod','themeLight','menuToggle']){const n=host.querySelector('#'+id);if(n){n.value=localStorage.getItem('fuc_'+id)||({themeMod:'light',themeLight:'purple',menuToggle:'open'}[id]);for(const option of n.options)option.toggleAttribute('selected',option.value===n.value);}}const logout=host.querySelector('[data-action=logout]');if(logout)logout.insertAdjacentHTML('beforebegin','<a class="dropdown-item" href="#" data-action="native-modal" data-target="#panel-option-modal"><i class="feather icon-settings"></i> 面板设置</a>');paintPaletteOptions(host);return host.innerHTML;
|
||||
}
|
||||
export function nativeDashboard(user,sub,notices,brand,richText) {
|
||||
const used=Number(sub.u||0)+Number(sub.d||0),total=Number(sub.transfer_enable||0),pct=total?Math.min(100,used/total*100):0,remain=100-pct;
|
||||
const data={NAME:e((user.email||'').split('@')[0]),BRAND:e(brand),PLAN:e(sub.plan?.name||'未订阅'),CLASS:e(sub.plan?.name||'未订阅'),BALANCE:e((Number(user.balance||0)/100).toFixed(2)),DAYS:sub.expired_at?Math.max(0,Math.ceil((sub.expired_at*1000-Date.now())/86400000)):'—',TOTAL_PAY:'—',PINNED:notices[0]?richText(notices[0].content):'暂无公告',PIN_DATE:date(notices[0]?.created_at),LATEST:notices[1]?richText(notices[1].content):notices[0]?richText(notices[0].content):'暂无公告',LATEST_DATE:date((notices[1]||notices[0])?.created_at),SUB_URL:e(safeUrl(sub.subscribe_url||'')),RESET_DATE:sub.reset_day!=null?`${sub.reset_day} 天后`:'—',REMAIN_PERCENT:remain.toFixed(1),REMAIN_BYTES:bytes(Math.max(0,total-used)),TODAY_PERCENT:'—',TODAY_BYTES:'—',PAST_PERCENT:pct.toFixed(1),PAST_BYTES:bytes(used)};
|
||||
export function nativeDashboard(user,sub,notices,brand,richText,traffic=null) {
|
||||
const usage=trafficSummary(sub,traffic),[remain,pct,today]=usage.series;
|
||||
const data={NAME:e((user.email||'').split('@')[0]),BRAND:e(brand),PLAN:e(sub.plan?.name||'未订阅'),CLASS:e(sub.plan?.name||'未订阅'),BALANCE:e((Number(user.balance||0)/100).toFixed(2)),DAYS:sub.expired_at?Math.max(0,Math.ceil((sub.expired_at*1000-Date.now())/86400000)):'—',TOTAL_PAY:'—',PINNED:notices[0]?richText(notices[0].content):'暂无公告',PIN_DATE:date(notices[0]?.created_at),LATEST:notices[1]?richText(notices[1].content):notices[0]?richText(notices[0].content):'暂无公告',LATEST_DATE:date((notices[1]||notices[0])?.created_at),SUB_URL:e(safeUrl(sub.subscribe_url||'')),RESET_DATE:sub.reset_day!=null?`${sub.reset_day} 天后`:'—',REMAIN_PERCENT:remain.toFixed(1),REMAIN_BYTES:bytes(usage.remaining),TODAY_PERCENT:usage.today===null?'—':today.toFixed(1),TODAY_BYTES:usage.today===null?'—':bytes(usage.today),PAST_PERCENT:pct.toFixed(1),PAST_BYTES:bytes(usage.history)};
|
||||
const host=document.createElement('div');host.innerHTML=sanitize(fill(templates.index,data));
|
||||
if(user.vip?.enabled===true){const vip=user.vip,card=host.querySelector('.card-stats .col');if(card){card.querySelector('span.h3').textContent=vip.name||'普通用户';card.querySelector('h5').textContent=`累计支付:¥ ${(Number(vip.cumulative_cents)/100).toFixed(2)}`;const progress=document.createElement('div');progress.className='font-small-3 text-muted mt-50';progress.dataset.vipProgress='true';const rate=Number(vip.discount_percent||0);progress.textContent=(rate?`${((100-rate)/10).toFixed(1)} 折`:'原价')+(vip.next_level?` · 距${vip.next_level.name}还差 ¥${(Number(vip.remaining_cents)/100).toFixed(2)}`:' · 已达最高等级');card.append(progress);}}
|
||||
host.querySelectorAll('h5').forEach(n=>{if(n.textContent.includes('套餐自动续订'))n.textContent='套餐自动续订:—';if(n.textContent.trim()==='在线设备'){const value=n.parentElement.querySelector('span.h3');if(value)value.textContent='—';}});
|
||||
host.querySelectorAll('.btn.disabled').forEach(n=>{n.classList.remove('disabled');n.disabled=true;n.title='当前 XB 未提供签到接口';n.textContent='每日签到';});
|
||||
chartData={remain,used:pct};const chart=host.querySelector('#donut-chart');if(chart)chart.innerHTML=`<div class="native-donut" style="--remaining:${remain}%"><span><small>剩余流量</small><strong>${bytes(Math.max(0,total-used))}</strong></span></div>`;
|
||||
const checkin=host.querySelector('#checkin,.float-right > button.btn.disabled');if(checkin){checkin.classList.remove('disabled');checkin.disabled=true;checkin.title='本站未开放签到';for(const n of checkin.childNodes)if(n.nodeType===3&&n.textContent.trim())n.textContent=' 每日签到';}
|
||||
const available=!!sub.plan_id&&(sub.expired_at==null||Number(sub.expired_at)>Date.now()/1000);
|
||||
host.querySelectorAll('.btn-sub,.btn-shadowrocket').forEach(n=>{if(!available){n.classList.add('disabled');n.dataset.action='subscription-unavailable';}});
|
||||
const seriesMarker=host.querySelector('.traffic-info .series-info i');if(seriesMarker)seriesMarker.style.color=chartColors()[0];
|
||||
chartData={series:usage.series,todayKnown:usage.today!==null};const chart=host.querySelector('#donut-chart');if(chart){chart.innerHTML='';chart.hidden=!available;if(!available){const empty=document.createElement('div');empty.textContent='无可用流量';chart.before(empty);}}
|
||||
return host.innerHTML;
|
||||
}
|
||||
export function nativeHome(plans,brand) {
|
||||
export function nativeHome(plans,brand,loggedIn=false) {
|
||||
const data={BRAND:e(brand)};for(let i=0;i<3;i++){data[`PUBLIC_PLAN_${i}`]=e(plans[i]?.name||'—');data[`PUBLIC_PRICE_${i}`]=((plans[i]?.month_price||0)/100).toFixed(2);data[`PUBLIC_GB_${i}`]=e(plans[i]?.transfer_enable||'—');}
|
||||
const host=document.createElement('div');host.innerHTML=sanitize(fill(templates.home,data)).replace(/福云/g,e(brand));
|
||||
const host=document.createElement('div');host.innerHTML=sanitize(fill(templates.home,data)).replace(/福云|Gopass/g,e(brand));
|
||||
if(loggedIn){const login=host.querySelector('.nav-btn');if(login){login.href='#/dashboard';login.innerHTML='<i class="fas fa-sign-in-alt"></i> 用户中心';}}
|
||||
host.querySelectorAll('#pricing .pricing').forEach((card,i)=>{const plan=plans[i];if(!plan){card.parentElement.remove();return;}const period=Object.keys(periodLabels).find(k=>k!=='reset_price'&&plan[k]!=null);const price=card.querySelector('.pricing-price');if(price){price.children[0].textContent=period?(Number(plan[period])/100).toFixed(2):'—';price.children[1].textContent=periodLabels[period]||'暂无可购周期';}const labels=card.querySelectorAll('.pricing-item-label');if(labels[1])labels[1].textContent=(plan.display_device_limit??plan.device_limit)?`${plan.display_device_limit??plan.device_limit} 台在线客户端`:'不限在线客户端';if(labels[4])labels[4].textContent=plan.speed_limit?`最高 ${plan.speed_limit} Mbps`:'不限速套餐';if(labels[5])labels[5].textContent='节点以套餐实际配置为准';});
|
||||
const slides=[...host.querySelectorAll('.swiper-slide')].filter(n=>!n.classList.contains('swiper-slide-duplicate'));host.querySelectorAll('.swiper-slide-duplicate').forEach(n=>n.remove());
|
||||
host.querySelectorAll('.swiper-wrapper').forEach(n=>n.style.transform='none');slides.forEach((n,i)=>{n.style.width='100%';n.style.display=i===0?'block':'none';n.classList.toggle('swiper-slide-active',i===0);});
|
||||
const dots=host.querySelector('.swiper-pagination');if(dots)dots.replaceChildren();
|
||||
host.querySelector('.navbar-toggler')?.setAttribute('data-action','native-collapse');return host.innerHTML;
|
||||
return host.innerHTML;
|
||||
}
|
||||
export function nativeLogin(brand,preview) {
|
||||
const host=document.createElement('div');host.innerHTML=sanitize(templates.login).replace(/福云/g,e(brand));
|
||||
const form=host.querySelector('#login_form');if(form){form.dataset.form='login';form.querySelector('[name=passwd]')?.setAttribute('name','password');const extra=form.querySelector('[id="2fa-form"] input');if(extra){extra.readOnly=true;extra.title='当前XB认证接口未提供此字段,仅保留原版布局';}form.querySelectorAll('[name="remember-me"],[name=remember_me]').forEach(n=>n.name='remember');const submit=form.querySelector('[type=submit]')||form.querySelector('button');if(submit){submit.type='submit';submit.removeAttribute('onclick');}const email=form.querySelector('[name=email]');if(email){email.type='email';email.required=true;}const pass=form.querySelector('[name=password]');if(pass)pass.required=true;}
|
||||
const form=host.querySelector('#login_form');if(form){form.dataset.form='login';form.querySelector('[name=passwd]')?.setAttribute('name','password');form.querySelector('[id="2fa-form"]')?.remove();form.querySelectorAll('[name="remember-me"],[name=remember_me]').forEach(n=>n.name='remember');const submit=form.querySelector('[type=submit]')||form.querySelector('button');if(submit){submit.type='submit';submit.removeAttribute('onclick');}const email=form.querySelector('[name=email]');if(email){email.type='email';email.required=true;}const pass=form.querySelector('[name=password]');if(pass)pass.required=true;}
|
||||
return host.innerHTML;
|
||||
}
|
||||
|
||||
@@ -92,11 +114,11 @@ export function nativeAuth(name,brand,config,code=''){
|
||||
const host=document.createElement('div');host.innerHTML=fragment(name,{BRAND:e(brand)}).replace(/福云/g,e(brand));
|
||||
if(name==='register'){
|
||||
asForm(host,'#register_form','register',{'[name=email]':'email','[name=passwd]':'password','[name=confirm_password]':'password_confirm','[name=email_code]':'email_code'},'#register-button');
|
||||
const nick=host.querySelector('[name=name]');if(nick){nick.readOnly=true;nick.title='XB 不保存昵称';}
|
||||
const nick=host.querySelector('[name=name]');if(nick){nick.required=false;nick.closest('.form-group')?.remove();}
|
||||
const email=host.querySelector('[name=email]');if(email)email.type='email';
|
||||
const pass=host.querySelector('[name=password]');if(pass)pass.minLength=8;
|
||||
const invite=host.querySelector('[name=invite_code]');if(invite){invite.value=code;invite.required=!!Number(config.is_invite_force);}
|
||||
const verify=host.querySelector('[name=email_code]');if(verify)verify.required=!!Number(config.is_email_verify);
|
||||
const verify=host.querySelector('[name=email_code]');if(verify){verify.required=!!Number(config.is_email_verify);if(!verify.required)verify.closest('.form-group')?.remove();}
|
||||
const btn=host.querySelector('#email_verify');if(btn)btn.dataset.action='send-code';
|
||||
host.querySelector('#agree')?.setAttribute('required','');
|
||||
}else if(name==='forget'){
|
||||
@@ -104,16 +126,17 @@ export function nativeAuth(name,brand,config,code=''){
|
||||
}else if(name==='reset'){
|
||||
const b=host.querySelector('#reset-update');if(b){const f=b.closest('form');f.dataset.form='forget';const pass=f.querySelector('[name=password]');pass.required=true;pass.minLength=8;const repeat=f.querySelector('[name=repasswd]');repeat.name='password_confirm';repeat.required=true;const input=document.createElement('div');input.innerHTML=formControl('邮箱','email','email',code)+formControl('邮箱验证码','email_code');f.prepend(input);f.querySelectorAll('input').forEach(n=>n.required=true);b.type='submit';}
|
||||
}
|
||||
host.querySelectorAll('a[href="/tos"]').forEach(n=>unavailable(n,'服务条款请以本站公告为准'));
|
||||
host.querySelectorAll('a[href="/tos"]').forEach(n=>{const url=safeUrl(config.tos_url||'');if(config.tos_url&&url){n.href=url;n.target='_blank';n.rel='noopener noreferrer';}else n.closest('.form-group')?.remove();});
|
||||
return host.innerHTML;
|
||||
}
|
||||
export function nativeSecondary(name,ctx){
|
||||
const {user={},sub={},data,period='month_price',page=1,richText,config={}}=ctx;
|
||||
const common={NAME:e((user.email||'').split('@')[0]),EMAIL:e(user.email),BALANCE:(Number(user.balance||0)/100).toFixed(2),COMMISSION:(Number(user.commission_balance||0)/100).toFixed(2),GB:(Number(sub.transfer_enable||0)/1073741824).toFixed(0),PLAN:e(sub.plan?.name||'未订阅'),RATE:'—',WITHDRAW_MIN:'—',REWARD_GB:'—',FEE:'—'};
|
||||
const common={NAME:e((user.email||'').split('@')[0]),EMAIL:e(user.email),BALANCE:(Number(user.balance||0)/100).toFixed(2),COMMISSION:(Number(user.commission_balance||0)/100).toFixed(2),GB:(Number(sub.transfer_enable||0)/1073741824).toFixed(0),PLAN:e(sub.plan?.name||'未订阅'),RATE:e(ctx.inviteRate??'—'),WITHDRAW_MIN:'—',REWARD_GB:'—',FEE:'—'};
|
||||
let repeats={},values={},template=name;
|
||||
if(name==='plans'){
|
||||
const groups=Object.keys(days).concat(['onetime_price','reset_price']).filter(k=>data.some(p=>p[k]!=null));
|
||||
const group=k=>({CYCLE:k,repeats:{row:data.filter(p=>p[k]!=null).map(p=>pData(p,k))}});
|
||||
const groups=data.filter(p=>Object.keys(periodLabels).some(k=>p[k]!=null));
|
||||
const cardNames={month_price:'月套餐',quarter_price:'季套餐',half_year_price:'半年套餐',year_price:'年套餐',two_year_price:'两年套餐',three_year_price:'三年套餐',onetime_price:'一次性套餐',reset_price:'流量重置'};
|
||||
const group=p=>({CYCLE:'plan-'+p.id,repeats:{row:Object.keys(periodLabels).filter(k=>p[k]!=null&&(k!=='reset_price'||String(user.plan_id)===String(p.id))).map(k=>({...pData(p,k),P_ID:e(p.id+'_'+k),P_NAME:e(cardNames[k])}))}});
|
||||
repeats={v:groups.map(group),productGroupValue:groups.map(group)};
|
||||
}else if(name==='tickets')repeats={oTicket:data.map(t=>({T_ID:e(t.id),T_TITLE:e(t.subject),T_DATE:date(t.created_at),T_STATUS:t.status===0?'处理中':'已关闭'}))};
|
||||
else if(name==='ticket'){values={T_ID:e(data.id)};repeats={oComment:(data.message||[]).map(m=>({M_NAME:m.is_me?'我':'客服',M_DATE:date(m.created_at),M_BODY:e(m.message).replace(/\n/g,'<br>')}))};}
|
||||
@@ -132,47 +155,61 @@ export function nativeSecondary(name,ctx){
|
||||
}
|
||||
const host=document.createElement('div');host.innerHTML=fragment(template,{...common,...values},repeats);if(name==='profile')host.innerHTML=host.innerHTML.replace(/2607:f2d8:6065:1053::a 没有被封/g,'—(XB 未提供)').replace(/>\s*`\s*</g,'><');
|
||||
// Restore source Bootstrap interactions without importing source business scripts.
|
||||
host.querySelectorAll('[data-toggle="modal"]').forEach(n=>{n.dataset.action='native-modal';n.dataset.target=n.getAttribute('data-target')||n.getAttribute('href');});
|
||||
host.querySelectorAll('[data-toggle="modal"]').forEach(n=>{n.dataset.action='native-modal';n.dataset.target=n.getAttribute('data-target')||n.getAttribute('href');n.removeAttribute('data-toggle');});
|
||||
host.querySelectorAll('[data-dismiss="modal"]').forEach(n=>{n.dataset.action='native-dismiss';n.type='button';});
|
||||
host.querySelectorAll('[data-toggle="collapse"]').forEach(n=>{n.dataset.action='native-accordion';n.dataset.target=n.getAttribute('data-target')||n.getAttribute('href');});
|
||||
host.querySelectorAll('a[href^="/"]').forEach(n=>unavailable(n));
|
||||
if(name==='plans'){
|
||||
const tabs=[...host.querySelectorAll('.shop_tab a')];tabs.forEach((a,i)=>{const k=a.dataset.target?.replace('top-home-','');a.querySelector('i')?.classList.remove('fa');a.querySelector('i')?.classList.add('fab');a.dataset.cycle=k;a.dataset.action='native-cycle';a.classList.toggle('active',k===period);a.setAttribute('aria-selected',String(k===period));a.querySelector('span').textContent=periodLabels[k]||k;a.id=`cycle-tab-${i}`;});
|
||||
host.querySelectorAll('.tab-pane').forEach(n=>{const active=n.id===`top-home-${period}`;n.classList.toggle('active',active);n.classList.toggle('show',active);});
|
||||
host.querySelectorAll('.pricing-card').forEach(n=>{const id=n.querySelector('input[id^="product-name-"]')?.id.replace('product-name-','');const plan=data.find(p=>String(p.id)===id),b=n.querySelector('button');if(!plan||!b)return;b.dataset.action='buy';b.dataset.id=id;b.dataset.period=n.closest('.tab-pane').id.replace('top-home-','');b.textContent=soldOutPlan(plan)?'已售罄':'购买';b.disabled=soldOutPlan(plan);n.querySelector('.classify').textContent=periodLabels[b.dataset.period];if(!days[b.dataset.period])n.querySelector('.duration').textContent=periodLabels[b.dataset.period];const features=n.querySelectorAll('.pricing-content li');if(features[1]&&!days[b.dataset.period])features[1].textContent=periodLabels[b.dataset.period];if(features[2])features[2].lastElementChild.textContent=(plan.display_device_limit??plan.device_limit)||'不限制';if(features[3])features[3].lastElementChild.textContent=plan.speed_limit?plan.speed_limit+' Mbps':'不限制';if(features[4])features[4].lastElementChild.textContent='以套餐实际配置为准';const stock=n.querySelector('.font-size-sm');if(stock)stock.textContent=plan.capacity_limit!=null?'库存以后端为准':'此商品无限制购买';if(plan.content){const desc=document.createElement('div');desc.innerHTML=richText(plan.content);n.querySelector('.pricing-content').after(desc);}});
|
||||
const activeGroup=data.some(p=>'plan-'+p.id===period)?period:'plan-'+data[0]?.id;
|
||||
const tabs=[...host.querySelectorAll('.shop_tab a')];tabs.forEach((a,i)=>{const k=a.dataset.target?.replace('top-home-',''),plan=data.find(p=>'plan-'+p.id===k);a.querySelector('i')?.classList.remove('fa');a.querySelector('i')?.classList.add('fab');a.dataset.cycle=k;a.dataset.action='native-cycle';a.classList.toggle('active',k===activeGroup);a.setAttribute('aria-selected',String(k===activeGroup));a.querySelector('span').textContent=plan?.name||'';a.id=`cycle-tab-${i}`;});
|
||||
host.querySelectorAll('.tab-pane').forEach(n=>{const active=n.id===`top-home-${activeGroup}`;n.classList.toggle('active',active);n.classList.toggle('show',active);});
|
||||
host.querySelectorAll('.pricing-card').forEach(n=>{const [id,...parts]=(n.querySelector('input[id^="product-name-"]')?.id.replace('product-name-','')||'').split('_');const plan=data.find(p=>String(p.id)===id),b=n.querySelector('button');if(!plan||!b)return;b.dataset.action='buy';b.dataset.id=id;b.dataset.period=parts.join('_');const purchasable=canPurchase(plan,user,b.dataset.period);b.textContent=purchasable?'购买':String(plan.id)===String(user.plan_id)?'不可续费':'已售罄';b.disabled=!purchasable;n.querySelector('.classify').textContent=periodLabels[b.dataset.period];if(!days[b.dataset.period])n.querySelector('.duration').textContent=periodLabels[b.dataset.period];const features=n.querySelectorAll('.pricing-content li');if(features[1]&&!days[b.dataset.period])features[1].textContent=periodLabels[b.dataset.period];if(features[2])features[2].lastElementChild.textContent=(plan.display_device_limit??plan.device_limit)||'不限制';if(features[3])features[3].lastElementChild.textContent=plan.speed_limit?plan.speed_limit+' Mbps':'不限制';if(features[4])features[4].lastElementChild.textContent=({0:'每月1号',1:'按月重置',2:'不重置',3:'每年1月1日',4:'按年重置'})[plan.reset_traffic_method]||'跟随系统设置';const stock=n.querySelector('.font-size-sm');if(stock)stock.textContent=plan.capacity_limit!=null?'库存以后端为准':'此商品无限制购买';if(plan.content){const desc=document.createElement('div');desc.innerHTML=richText(plan.content);n.querySelector('.pricing-content').after(desc);}});
|
||||
host.querySelector('.selling-slide')?.setAttribute('data-action','native-go-invite');
|
||||
const terms=host.querySelector('.selling-slide .badge-white');if(terms)terms.textContent='提现条件见返利页';const reward=host.querySelector('.selling-slide .right-content h2');if(reward)reward.textContent='返利收益可用于购买套餐';
|
||||
const couponButton=host.querySelector('#coupon_modal .modal-footer .btn-primary');
|
||||
if(couponButton){couponButton.id='native-coupon-submit';const form=makeSubmit(host,'#native-coupon-submit','purchase-coupon',{'#coupon':'coupon_code'});form.querySelector('#coupon').required=false;host.querySelectorAll('#coupon_modal p').forEach(n=>{if(n.textContent.includes('新用户专属优惠码'))n.remove();});}
|
||||
const confirm=host.querySelector('#pay-confirm');if(confirm){makeSubmit(host,'#pay-confirm','purchase',{});confirm.removeAttribute('data-dismiss');confirm.removeAttribute('data-action');const code=document.createElement('input');code.type='hidden';code.name='coupon_code';confirm.closest('form').append(code);}
|
||||
const renew=host.querySelector('#order_modal #autorenew');if(renew){renew.disabled=true;renew.title='本站未开放自动续订';}
|
||||
}else if(name==='purchase'){
|
||||
if(user.vip?.enabled===true){const rate=Number(user.vip.discount_percent||0),notice=document.createElement('p');notice.className='font-small-3 text-muted';notice.dataset.vipPrice='true';notice.textContent=`${user.vip.name||'普通用户'}:${rate?`${((100-rate)/10).toFixed(1)} 折`:'原价'},本单完成后累计消费,升级优惠从下一单生效。`;host.querySelector('.page-body .container-xl')?.prepend(notice);}
|
||||
const b=host.querySelector('#create-order');if(b){const f=document.createElement('form');f.dataset.form='purchase';b.before(f);f.append(b);b.type='submit';}
|
||||
const coupon=host.querySelector('#coupon');if(coupon){coupon.name='coupon_code';coupon.setAttribute('form','purchase-form');host.querySelector('[data-form=purchase]').id='purchase-form';}
|
||||
const apply=host.querySelector('#verify-coupon');if(apply){apply.dataset.action='native-unavailable';apply.dataset.reason='优惠码将在创建订单时由 XB 校验';}
|
||||
const apply=host.querySelector('#verify-coupon');if(apply){apply.dataset.action='check-coupon';apply.type='button';}
|
||||
}else if(name==='checkout'){
|
||||
host.querySelectorAll('a').forEach(a=>{if(a.textContent.includes('账单')){a.href='#/orders';a.removeAttribute('data-action');a.textContent='返回订单列表';}});
|
||||
host.querySelectorAll('a').forEach(a=>{if(a.textContent.includes('账单')){a.href='#/orders';a.removeAttribute('data-action');a.textContent='返回订单列表';a.removeAttribute('title');}});
|
||||
const area=host.querySelector('.page-body .container-xl')||host;
|
||||
if(data.status===0){const card=document.createElement('div');card.className='card my-3';card.innerHTML=`<div class="card-header"><h3 class="card-title">支付订单</h3></div><div class="card-body"><form data-form="checkout"><div class="form-group"><label for="method">支付方式</label><select class="form-control" id="method" name="method" ${data.total_amount>0?'required':''}><option value="">请选择支付方式</option>${(ctx.methods||[]).map(m=>`<option value="${e(m.id)}">${e(m.name)}</option>`).join('')}</select></div><p>实际支付金额及手续费以支付渠道为准。</p><button class="btn btn-primary" type="submit" ${ctx.methods?.length||data.total_amount<=0?'':'disabled'}>继续支付</button> <button type="button" class="btn btn-danger" data-action="cancel-order">取消订单</button></form></div>`;area.prepend(card);}
|
||||
if(data.status===0){const card=document.createElement('div');card.className='card my-3';card.innerHTML=`<div class="card-header"><h3 class="card-title">支付订单</h3></div><div class="card-body"><form data-form="checkout"><div class="form-group"><label for="method">支付方式</label><select class="form-control" id="method" name="method" ${data.total_amount>0?'required':''}><option value="">请选择支付方式</option>${(ctx.methods||[]).map(m=>`<option value="${e(m.id)}">${e(m.name)}${m.handling_fee_fixed||m.handling_fee_percent?'(手续费 '+money(m.handling_fee_fixed)+' + '+e(m.handling_fee_percent||0)+'%)':''}</option>`).join('')}</select></div><p>应付 ${money(data.total_amount)};所选渠道手续费另计。</p><div id="card-element" class="my-2"></div><button class="btn btn-primary" type="submit" ${ctx.methods?.length||data.total_amount<=0?'':'disabled'}>继续支付</button> <button type="button" class="btn btn-danger" data-action="cancel-order">取消订单</button></form><div id="payment-result" class="my-2" role="status"></div><button type="button" class="btn btn-outline-primary" data-action="refresh-payment">刷新订单状态</button></div>`;area.prepend(card);}
|
||||
}else if(name==='orders'){
|
||||
const table=host.querySelector('table');if(table){table.querySelector('thead tr').innerHTML=['订单号','套餐','金额','状态','创建时间','操作'].map(h=>`<th>${h}</th>`).join('');const body=document.createElement('tbody');body.innerHTML=data.map(o=>`<tr><td>${e(o.trade_no)}</td><td>${e(o.plan?.name||'—')}</td><td>${money(o.total_amount)}</td><td>${orderStatus(o.status)}</td><td>${date(o.created_at)}</td><td><a class="btn btn-primary btn-sm" href="#/checkout/${encodeURIComponent(o.trade_no)}">查看</a></td></tr>`).join('');table.append(body);table.parentElement.insertAdjacentHTML('afterend',pagination(page,data.length));}
|
||||
}else if(name==='myplan'){
|
||||
const target=host.querySelector('.card-content .card-body');if(target){target.innerHTML=fragment('planlog',common,{oUserPlanRow:(data||[]).map(o=>({O_ID:e(o.trade_no),O_NAME:e(o.plan?.name||'—'),O_PRICE:money(o.total_amount),O_STATUS:orderStatus(o.status),O_DATE:date(o.created_at)}))});target.querySelectorAll('tbody tr').forEach((tr,i)=>{const a=tr.querySelector('a');if(a)a.href=`#/checkout/${encodeURIComponent(data[i].trade_no)}`;});target.insertAdjacentHTML('afterbegin',`<p>当前套餐:${e(sub.plan?.name||'未订阅')} · 到期:${date(sub.expired_at)} <a class="btn btn-primary btn-sm" href="#/orders">全部订单</a></p>`);target.insertAdjacentHTML('beforeend',pagination(page,data.length));}
|
||||
const renewPlan=ctx.renewPlan;const header=host.querySelector('.card-header h4');if(header)header.textContent=sub.plan?.name||'未订阅';
|
||||
if(renewPlan){const periods=Object.keys(periodLabels).filter(k=>canPurchase(renewPlan,user,k));if(periods.length)host.querySelector('.card-header').insertAdjacentHTML('beforeend',`<div class="dropdown"><button type="button" class="btn btn-primary btn-sm dropdown-toggle" data-action="native-dropdown" aria-haspopup="true" aria-expanded="false">续费 / 重置流量</button><div class="dropdown-menu dropdown-menu-right">${periods.map(k=>`<a class="dropdown-item" href="#/purchase/${encodeURIComponent(renewPlan.id)}?period=${encodeURIComponent(k)}">${e(periodLabels[k])} · ${money(renewPlan[k])}</a>`).join('')}</div></div>`);}
|
||||
unavailable(host.querySelector('#autorenew'),'XB 当前未提供套餐自动续订接口');
|
||||
}else if(name==='wallet'){
|
||||
host.querySelectorAll('#pay_the a').forEach(n=>unavailable(n,'XB 当前未提供独立钱包充值接口,请前往套餐商店下单'));
|
||||
unavailable(host.querySelector('#pay-confirm'),'XB 当前未提供独立钱包充值接口,请前往套餐商店下单');host.querySelectorAll('input[name=money],#c_number').forEach(n=>n.disabled=true);const pay=host.querySelector('#pay-confirm');if(pay){const note=document.createElement('p');note.className='text-muted mt-1';note.textContent='XB 未提供独立钱包充值,请在套餐商店下单。';host.querySelector('#account-vertical-code .card-body').append(note);}
|
||||
const target=host.querySelector('#account-vertical-code_2 .card-body');if(target)target.innerHTML=fragment('walletlog',common,{aMoneyLogRow:[]})+'<p class="text-muted mt-2">XB 未提供独立钱包流水接口。</p>';
|
||||
host.querySelectorAll('a,h4').forEach(n=>{if(n.textContent.trim()==='钱包充值')n.textContent='余额与兑换';if(n.textContent.trim()==='钱包记录')n.textContent='兑换记录';});
|
||||
const target=host.querySelector('#account-vertical-code .card-body');if(target)target.innerHTML=`<p>账户余额:${money(user.balance)}。购买套餐时自动抵扣余额。</p><a class="btn btn-primary" href="#/plans">购买套餐</a><form data-form="gift" class="mt-2"><label>兑换码<input class="form-control" name="gift_code" required autocomplete="off"></label><div class="mt-1"><button type="button" class="btn btn-outline-primary" data-action="check-gift">检查兑换码</button> <button type="submit" class="btn btn-primary">确认兑换</button></div></form>`;
|
||||
const history=host.querySelector('#account-vertical-code_2 .card-body');if(history)history.innerHTML=`<div class="table-responsive"><table class="table"><thead><tr><th>兑换码</th><th>奖励</th><th>时间</th></tr></thead><tbody>${(data||[]).map(row=>`<tr><td>${e(row.code)}</td><td>${e(row.template_name||row.template_type_name)}</td><td>${e(typeof row.created_at==='number'?date(row.created_at):row.created_at)}</td></tr>`).join('')||'<tr><td colspan="3">暂无兑换记录</td></tr>'}</tbody></table></div>${pagination(page,(data||[]).length)}`;
|
||||
}else if(name==='invite'){
|
||||
const rules=host.querySelectorAll('.card-developer-meetup .list-group-item');if(rules[1])rules[1].textContent='返利可转入钱包,用于购买套餐。';if(rules[2])rules[2].textContent='提现条件以本站设置为准,可通过工单跟进申请。';
|
||||
const codes=data.codes||[];const copy=host.querySelector('.copy-text');if(copy){copy.dataset.action='copy-invite';copy.dataset.code=codes[0]?.code||'';copy.disabled=!codes.length;}
|
||||
const reset=host.querySelector('[data-target="#reset-invite-modal"]');if(reset){reset.dataset.action='invite';reset.removeAttribute('data-target');reset.textContent='生成链接';}
|
||||
const rows=ctx.details||[];host.querySelector('#affMoneyLog').innerHTML=fragment('afflog',common,{oAffMoneyLog:rows.map(a=>({A_ID:e(a.id??'—'),A_ORDER:e(a.trade_no??'—'),A_USER:e(a.user_id??'—'),A_NAME:'—',A_TOTAL:money(a.order_amount),A_AMOUNT:money(a.get_amount),A_DATE:date(a.created_at)}))})+pagination(page,rows.length);
|
||||
const transfer=host.querySelector('#modal_turn .modal-footer .btn-info');if(transfer){transfer.id='native-transfer-submit';const f=makeSubmit(host,'#native-transfer-submit','transfer',{'#num':'amount'});const amount=f.querySelector('#num');amount.type='number';amount.step='0.01';amount.min='0.01';f.querySelector('#num_get').value='以 XB 实际结果为准';const usdt=f.querySelector('#usdt');if(usdt){usdt.disabled=true;usdt.closest('.col-12').title='提现请使用收款信息弹窗';}const minimum=f.querySelector('.form-group > p');if(minimum)minimum.textContent='佣金可转入钱包;提现条件以本站设置为准。';}
|
||||
const withdraw=host.querySelector('#modal_info .modal-footer .btn-info');if(withdraw){withdraw.id='native-withdraw-submit';const info=host.querySelector('#modal_info .modal-body');info.innerHTML=formControl('提现方式','withdraw_method')+formControl('收款账号','withdraw_account')+'<p>提交将创建 XB 财务工单;可提现条件以后端为准。</p>';makeSubmit(host,'#native-withdraw-submit','withdraw',{'[name=withdraw_method]':'withdraw_method','[name=withdraw_account]':'withdraw_account'});withdraw.textContent='申请提现';}
|
||||
const withdraw=host.querySelector('#modal_info .modal-footer .btn-info');if(withdraw){withdraw.id='native-withdraw-submit';const info=host.querySelector('#modal_info .modal-body');info.innerHTML=`<label>提现方式<select class="form-control" name="withdraw_method" required>${(config.withdraw_methods||[]).map(m=>`<option value="${e(m)}">${e(m)}</option>`).join('')}</select></label>`+formControl('收款账号','withdraw_account')+'<p>提交将创建 XB 财务工单;可提现条件以后端为准。</p>';makeSubmit(host,'#native-withdraw-submit','withdraw',{'[name=withdraw_method]':'withdraw_method','[name=withdraw_account]':'withdraw_account'});withdraw.textContent=Number(config.withdraw_close)?'本站已关闭提现':'申请提现';withdraw.disabled=!!Number(config.withdraw_close)||!config.withdraw_methods?.length;}
|
||||
host.querySelectorAll('#modal_turn small').forEach(n=>{if(n.textContent.includes('提现完成时间'))n.textContent='实际处理时间以本站回复为准。';if(n.textContent.includes('满¥200'))n.textContent='以本站设置为准';});const linkCard=host.querySelector('.card-payment .card-body');if(codes.length>1)linkCard.insertAdjacentHTML('beforeend',codes.slice(1).map(c=>`<div class="input-group mt-1"><input class="form-control" readonly value="${e(inviteUrl(c.code))}"><button type="button" class="btn btn-primary" data-action="copy-invite" data-code="${e(c.code)}">复制</button></div>`).join(''));
|
||||
}else if(name==='profile'){
|
||||
makeSubmit(host,'#pwd-update','password',{'#oldpwd':'old_password','#pwd':'new_password','#repwd':'password_confirm'});
|
||||
const pass=host.querySelector('#pwd');if(pass)pass.minLength=8;
|
||||
const reset=host.querySelector('#sublink-reset');if(reset)reset.dataset.action='reset-security';
|
||||
for(const id of ['#ga-enable-true','#kill','#user_profile_dailymail'])unavailable(host.querySelector(id),'XB 未提供此项 FUC 账户功能');
|
||||
host.querySelectorAll('[data-target="#step2-modal"],[data-target="#telegram"],[data-target="#unblock-ip"],[data-target="#delete-account-modal"]').forEach(n=>unavailable(n,'XB 当前未提供对应的 FUC 账户功能'));
|
||||
host.querySelectorAll('[data-target="#step2-modal"],[data-target="#unblock-ip"],[data-target="#delete-account-modal"]').forEach(n=>unavailable(n,'XB 当前未提供对应的 FUC 账户功能'));
|
||||
host.querySelector('#user_profile_dailymail')?.remove();const mailTitle=host.querySelector('#dailymail-modal .modal-title');if(mailTitle)mailTitle.textContent='邮件提醒设置';
|
||||
const mail=host.querySelector('#dailymail-modal .modal-body');if(mail){mail.innerHTML=`<form data-form="reminders"><label class="d-block"><input name="remind_expire" type="checkbox" ${user.remind_expire?'checked':''}> 到期提醒</label><label class="d-block"><input name="remind_traffic" type="checkbox" ${user.remind_traffic?'checked':''}> 流量提醒</label><button type="submit" class="btn btn-primary">保存设置</button></form>`;}
|
||||
host.querySelectorAll('.card-profile-stats .heading').forEach(n=>n.title=n.textContent);const mailCard=host.querySelector('[data-target="#dailymail-modal"]');if(mailCard){const label=mailCard.querySelector('p');if(label)label.textContent=`到期提醒:${user.remind_expire?'开启':'关闭'} · 流量提醒:${user.remind_traffic?'开启':'关闭'}`;}const online=host.querySelectorAll('table tbody');online.forEach(n=>n.innerHTML='<tr><td colspan="6">XB 未提供此项记录</td></tr>');
|
||||
host.querySelectorAll('.card-profile-stats .heading').forEach(n=>n.title=n.textContent);const level=host.querySelector('.card-profile-stats .heading');if(level){level.textContent='—';level.title='XB 未提供 FUC 用户等级';}const mailCard=host.querySelector('[data-target="#dailymail-modal"]');if(mailCard){const label=mailCard.querySelector('p');if(label)label.textContent=`到期提醒:${user.remind_expire?'开启':'关闭'} · 流量提醒:${user.remind_traffic?'开启':'关闭'}`;}const online=host.querySelectorAll('table tbody');online.forEach(n=>n.innerHTML='<tr><td colspan="6">XB 未提供此项记录</td></tr>');
|
||||
const target=host.querySelector('.content-body')||host;target.insertAdjacentHTML('beforeend',`<section class="card"><div class="card-body"><h4>登录设备</h4><p>退出指定设备后,该设备需重新登录。</p><div class="table-responsive"><table class="table"><thead><tr><th>设备</th><th>创建时间</th><th>最近使用</th><th>操作</th></tr></thead><tbody>${(ctx.sessions||[]).map((session,i)=>`<tr><td>登录会话 ${i+1}</td><td>${e(new Date(session.created_at).toLocaleString('zh-CN'))}</td><td>${session.last_used_at?e(new Date(session.last_used_at).toLocaleString('zh-CN')):'—'}</td><td><button class="btn btn-outline-danger btn-sm" data-action="revoke-session" data-id="${e(session.id)}">退出此设备</button></td></tr>`).join('')}</tbody></table></div></div></section>`);
|
||||
const tg=host.querySelector('[data-target="#telegram"]');if(tg){tg.dataset.action='telegram';if(!Number(config.is_telegram))unavailable(tg,'本站未开启 Telegram');}
|
||||
|
||||
}else if(name==='tickets'){
|
||||
makeSubmit(host,'#ticket-create-click','ticket',{'#ticket-create-title-text':'subject','#ticket-create-content-text':'message'});
|
||||
const select=host.querySelector('#ticket-type');if(select){select.name='level';select.innerHTML='<option value="0">低优先级</option><option value="1" selected>中优先级</option><option value="2">高优先级</option>';select.previousElementSibling.textContent='优先级';}
|
||||
@@ -186,6 +223,7 @@ export function nativeSecondary(name,ctx){
|
||||
}else if(name==='servers'){
|
||||
host.querySelectorAll('.node-status').forEach((n,i)=>{if(!country(data[i].name))n.closest('.card').querySelector('img')?.remove();const online=!!(data[i].is_online||data[i].is_available);n.classList.toggle('node-is-online',online);n.classList.toggle('node-is-offline',!online);n.closest('.card').dataset.action='native-node-detail';n.closest('.card').dataset.id=data[i].id;});
|
||||
}else if(name==='faq'){
|
||||
const support=host.querySelector('.icon-send')?.closest('a');if(support){support.href='#/tickets';support.removeAttribute('data-action');}host.querySelectorAll('span.text-body').forEach(n=>{if(n.textContent.includes('右下角在线客服'))n.textContent='请提交工单,我们会尽快回复。';});
|
||||
const search=host.querySelector('#searchbar');if(search)search.dataset.action='faq-search';
|
||||
}
|
||||
if((name==='knowledge'||name==='faq')&&!Object.values(data||{}).flat().length)host.querySelector('.content-body,.page-body')?.insertAdjacentHTML('beforeend','<div class="native-empty">暂无文档</div>');if(['plans','tickets','myplan','invite','orders','notices','servers','knowledge','faq'].includes(name)){for(const body of host.querySelectorAll('tbody'))if(!body.children.length)body.innerHTML='<tr><td colspan="8" class="text-center py-2">暂无记录</td></tr>';if(Array.isArray(data)&&!data.length&&!host.querySelector('tbody'))host.querySelector('.content-body,.page-body,.content-wrapper')?.insertAdjacentHTML('beforeend','<div class="native-empty">暂无记录</div>');}
|
||||
@@ -195,6 +233,15 @@ export function nativeSecondary(name,ctx){
|
||||
for(const n of [...host.childNodes])if(n.nodeType===3&&n.textContent.trim()==='`')n.remove();host.querySelectorAll('[data-action]').forEach(n=>{if(!n.matches('button,a,input,select')){n.setAttribute('role','button');n.tabIndex=0;}});return host.innerHTML;
|
||||
}
|
||||
const periodLabels={month_price:'月付',quarter_price:'季付',half_year_price:'半年付',year_price:'年付',two_year_price:'两年付',three_year_price:'三年付',onetime_price:'一次性',reset_price:'流量重置'};
|
||||
export function fillPurchaseModal(host,plan,period,code=''){
|
||||
const text=(id,value)=>{const n=host.querySelector(id);if(n)n.textContent=value;};
|
||||
text('#shop_name','套餐名称:'+plan.name);text('#shop_time','套餐时长:'+(days[period]?days[period]+' 天':periodLabels[period]));
|
||||
text('#shop_payTotal','套餐金额:'+money(plan[period]));text('#shop_stneed',code?'优惠码:'+code+',最终应付以订单结算为准。':'最终应付与余额抵扣以订单结算为准。');
|
||||
const note=host.querySelector('#shop_stneed');if(note)note.style.display='';
|
||||
const payments=host.querySelector('#shop_payment');if(payments)payments.style.display='none';
|
||||
const input=host.querySelector('#order_modal [name=coupon_code]');if(input)input.value=code;
|
||||
text('#pay-confirm','创建订单');
|
||||
}
|
||||
function orderStatus(n){return ['待支付','开通中','已取消','已完成','已折抵'][n]||'未知';}
|
||||
function soldOutPlan(p){return p.sell===false||p.sell===0||soldOut(p)||p.sold_out===true;}
|
||||
function inviteUrl(code){return code?`${location.origin}${location.pathname}#/register?code=${encodeURIComponent(code)}`:'';}
|
||||
|
||||
Vendored
+5
-1
@@ -1,5 +1,5 @@
|
||||
/* XB behavior glue only. Native FUC styles control primary geometry. */
|
||||
.preview-note{display:none!important}body[data-native-mode] .native-unavailable{cursor:not-allowed}body[data-native-mode=user] .main-menu{top:0}body[data-native-mode=user] .main-menu.menu-fixed{position:fixed;top:0}body[data-native-mode=user] .dropdown-menu.show{display:block}body[data-native-mode=user] .navigation-main a{cursor:pointer}body[data-native-mode=user] .nav-link.active{cursor:default}.native-donut{margin:20px auto;display:grid;place-items:center;width:220px;height:220px;border-radius:50%;background:conic-gradient(#7d72f1 var(--remaining),#ff9f43 0)}.native-donut>span{background:#fff;border-radius:50%;width:180px;height:180px;display:flex;align-items:center;justify-content:center;flex-direction:column}.native-donut small{font-size:12px;color:#999}.native-donut strong{font-size:20px;margin-top:8px}.dark-layout .native-donut>span{background:#10163a}body.native-public{background:#fff}.native-toast{position:fixed;bottom:25px;left:50%;transform:translateX(-50%);z-index:9999;background:#292733;color:white;border-radius:5px;padding:12px 22px}.native-public .hero-bottom-shape img{max-width:100%}body[data-native-mode=user] .tab-pane{display:none}body[data-native-mode=user] .tab-pane.active{display:block}@media(prefers-reduced-motion:reduce){*{scroll-behavior:auto!important;transition:none!important}}
|
||||
.preview-note{display:none!important}body[data-native-mode] .native-unavailable{cursor:not-allowed}body[data-native-mode=user] .main-menu{top:0}body[data-native-mode=user] .main-menu.menu-fixed{position:fixed;top:0}body[data-native-mode=user] .dropdown-menu.show{display:block}body[data-native-mode=user] .navigation-main a{cursor:pointer}body[data-native-mode=user] .nav-link.active{cursor:default}.native-donut{margin:20px auto;display:grid;place-items:center;width:220px;height:220px;border-radius:50%;background:conic-gradient(#7d72f1 var(--remaining),#ff9f43 0)}.native-donut>span{background:#fff;border-radius:50%;width:180px;height:180px;display:flex;align-items:center;justify-content:center;flex-direction:column}.native-donut small{font-size:12px;color:#999}.native-donut strong{font-size:20px;margin-top:8px}.dark-layout .native-donut>span{background:#10163a}body.native-public{background:#fff}.native-toast{position:fixed;bottom:25px;left:50%;transform:translateX(-50%);z-index:9999;background:#292733;color:white;border-radius:5px;padding:12px 22px}.native-public .hero-bottom-shape img{max-width:100%}body[data-native-mode=user] .tab-pane{display:none}body[data-native-mode=user] .tab-pane.active{display:block}
|
||||
|
||||
|
||||
/* Runtime accessibility and source AJAX fragments only. */
|
||||
@@ -7,3 +7,7 @@ body[data-native-mode=user] .page-wrapper{margin-left:260px;padding:7rem 2.2rem
|
||||
|
||||
/* Read-only unsupported fields retain the source input appearance. */
|
||||
body[data-native-mode=auth] .form-control[readonly]{background-color:#fff;opacity:1}
|
||||
|
||||
/* Keep the approved legacy-page sidebar compensation in the original menu transition. */
|
||||
body[data-native-mode=user] .page-wrapper{transition:300ms ease all}
|
||||
@media(min-width:1200px){body[data-native-mode=user].menu-collapsed .page-wrapper{margin-left:80px}}
|
||||
@@ -0,0 +1,6 @@
|
||||
/*!
|
||||
* Bootstrap v5.0.0-beta1 (https://getbootstrap.com/)
|
||||
* Copyright 2011-2020 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
*/
|
||||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).bootstrap=e()}(this,(function(){"use strict";function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function e(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}function n(){return(n=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t}).apply(this,arguments)}function i(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}var o,r,s=function(t){do{t+=Math.floor(1e6*Math.random())}while(document.getElementById(t));return t},a=function(t){var e=t.getAttribute("data-bs-target");if(!e||"#"===e){var n=t.getAttribute("href");e=n&&"#"!==n?n.trim():null}return e},l=function(t){var e=a(t);return e&&document.querySelector(e)?e:null},c=function(t){var e=a(t);return e?document.querySelector(e):null},u=function(t){if(!t)return 0;var e=window.getComputedStyle(t),n=e.transitionDuration,i=e.transitionDelay,o=Number.parseFloat(n),r=Number.parseFloat(i);return o||r?(n=n.split(",")[0],i=i.split(",")[0],1e3*(Number.parseFloat(n)+Number.parseFloat(i))):0},f=function(t){t.dispatchEvent(new Event("transitionend"))},d=function(t){return(t[0]||t).nodeType},h=function(t,e){var n=!1,i=e+5;t.addEventListener("transitionend",(function e(){n=!0,t.removeEventListener("transitionend",e)})),setTimeout((function(){n||f(t)}),i)},p=function(t,e,n){Object.keys(n).forEach((function(i){var o,r=n[i],s=e[i],a=s&&d(s)?"element":null==(o=s)?""+o:{}.toString.call(o).match(/\s([a-z]+)/i)[1].toLowerCase();if(!new RegExp(r).test(a))throw new Error(t.toUpperCase()+': Option "'+i+'" provided type "'+a+'" but expected type "'+r+'".')}))},g=function(t){if(!t)return!1;if(t.style&&t.parentNode&&t.parentNode.style){var e=getComputedStyle(t),n=getComputedStyle(t.parentNode);return"none"!==e.display&&"none"!==n.display&&"hidden"!==e.visibility}return!1},m=function(){return function(){}},v=function(t){return t.offsetHeight},_=function(){var t=window.jQuery;return t&&!document.body.hasAttribute("data-bs-no-jquery")?t:null},b=function(t){"loading"===document.readyState?document.addEventListener("DOMContentLoaded",t):t()},y="rtl"===document.documentElement.dir,w=(o={},r=1,{set:function(t,e,n){void 0===t.bsKey&&(t.bsKey={key:e,id:r},r++),o[t.bsKey.id]=n},get:function(t,e){if(!t||void 0===t.bsKey)return null;var n=t.bsKey;return n.key===e?o[n.id]:null},delete:function(t,e){if(void 0!==t.bsKey){var n=t.bsKey;n.key===e&&(delete o[n.id],delete t.bsKey)}}}),E=function(t,e,n){w.set(t,e,n)},T=function(t,e){return w.get(t,e)},k=function(t,e){w.delete(t,e)},O=/[^.]*(?=\..*)\.|.*/,L=/\..*/,A=/::\d+$/,C={},D=1,x={mouseenter:"mouseover",mouseleave:"mouseout"},S=new Set(["click","dblclick","mouseup","mousedown","contextmenu","mousewheel","DOMMouseScroll","mouseover","mouseout","mousemove","selectstart","selectend","keydown","keypress","keyup","orientationchange","touchstart","touchmove","touchend","touchcancel","pointerdown","pointermove","pointerup","pointerleave","pointercancel","gesturestart","gesturechange","gestureend","focus","blur","change","reset","select","submit","focusin","focusout","load","unload","beforeunload","resize","move","DOMContentLoaded","readystatechange","error","abort","scroll"]);function j(t,e){return e&&e+"::"+D++||t.uidEvent||D++}function N(t){var e=j(t);return t.uidEvent=e,C[e]=C[e]||{},C[e]}function I(t,e,n){void 0===n&&(n=null);for(var i=Object.keys(t),o=0,r=i.length;o<r;o++){var s=t[i[o]];if(s.originalHandler===e&&s.delegationSelector===n)return s}return null}function P(t,e,n){var i="string"==typeof e,o=i?n:e,r=t.replace(L,""),s=x[r];return s&&(r=s),S.has(r)||(r=t),[i,o,r]}function M(t,e,n,i,o){if("string"==typeof e&&t){n||(n=i,i=null);var r=P(e,n,i),s=r[0],a=r[1],l=r[2],c=N(t),u=c[l]||(c[l]={}),f=I(u,a,s?n:null);if(f)f.oneOff=f.oneOff&&o;else{var d=j(a,e.replace(O,"")),h=s?function(t,e,n){return function i(o){for(var r=t.querySelectorAll(e),s=o.target;s&&s!==this;s=s.parentNode)for(var a=r.length;a--;)if(r[a]===s)return o.delegateTarget=s,i.oneOff&&H.off(t,o.type,n),n.apply(s,[o]);return null}}(t,n,i):function(t,e){return function n(i){return i.delegateTarget=t,n.oneOff&&H.off(t,i.type,e),e.apply(t,[i])}}(t,n);h.delegationSelector=s?n:null,h.originalHandler=a,h.oneOff=o,h.uidEvent=d,u[d]=h,t.addEventListener(l,h,s)}}}function B(t,e,n,i,o){var r=I(e[n],i,o);r&&(t.removeEventListener(n,r,Boolean(o)),delete e[n][r.uidEvent])}var H={on:function(t,e,n,i){M(t,e,n,i,!1)},one:function(t,e,n,i){M(t,e,n,i,!0)},off:function(t,e,n,i){if("string"==typeof e&&t){var o=P(e,n,i),r=o[0],s=o[1],a=o[2],l=a!==e,c=N(t),u=e.startsWith(".");if(void 0===s){u&&Object.keys(c).forEach((function(n){!function(t,e,n,i){var o=e[n]||{};Object.keys(o).forLine truncated
|
||||
@@ -53,6 +53,7 @@
|
||||
<h4></h4>
|
||||
|
||||
|
||||
|
||||
<div class="vs-checkbox-con vs-checkbox-primary">
|
||||
<span>自动续订:</span>
|
||||
<input type="checkbox" id="autorenew" >
|
||||
@@ -143,7 +144,8 @@
|
||||
<div class="modal-body">
|
||||
<div id="autorenew-modal-body-content">
|
||||
<label class="row col-12 col-form-label">当前套餐时间到期,或流量用尽时,将会自动续费。</label>
|
||||
<label class="row col-12 col-form-label">自动续费完全沿用当前使用中的套餐配置及打折优惠。</label>
|
||||
<label class="row col-12 col-form-label">自动续订按当前续订报价扣款,保留已确定的打折优惠。</label>
|
||||
|
||||
<label class="row col-12 col-form-label">请确保钱包余额充足,以免自动续费失败。</label>
|
||||
<label class="row col-12 col-form-label">钱包余额:__BALANCE__ 元。</label>
|
||||
<label class="row col-12 col-form-label"><a href="/user/code" class="btn btn-sm btn-info mr-4 waves-effect waves-float waves-light">钱包充值</a></label>
|
||||
|
||||
@@ -278,7 +278,8 @@
|
||||
<div class="modal-body">
|
||||
<div id="autorenew-modal-body-content">
|
||||
<label class="row col-12 col-form-label">当前套餐时间到期,或流量用尽时,将会自动续费。</label>
|
||||
<label class="row col-12 col-form-label">自动续费完全沿用当前的套餐配置及打折优惠。</label>
|
||||
<label class="row col-12 col-form-label">自动续订按当前续订报价扣款,保留已确定的打折优惠。</label>
|
||||
|
||||
<label class="row col-12 col-form-label">请确保钱包余额充足,以免自动续费失败。</label>
|
||||
<label class="row col-12 col-form-label">钱包余额:__BALANCE__ 元。</label>
|
||||
<label class="row col-12 col-form-label"><a href="/user/code" class="btn btn-sm btn-info mr-4 waves-effect waves-float waves-light">钱包充值</a></label>
|
||||
|
||||
Vendored
+189
@@ -0,0 +1,189 @@
|
||||
/* Hue rotations of original FUC green; no native layout or animation declarations. */
|
||||
html[data-fuc-palette=spring] body:is(:not([data-native-mode=user]),.dark-layout){--primary-color:#52cfbc;}
|
||||
html[data-fuc-palette=spring] body:is(:not([data-native-mode=user]),.dark-layout) .brand-logo-img{filter:hue-rotate(290deg) brightness(106%);}
|
||||
html[data-fuc-palette=spring] body:is(:not([data-native-mode=user]),.dark-layout) .main-menu:is(.menu-light,.menu-dark) .navigation>li.active>a{background:linear-gradient(118deg, #47ccb7, #71d7c7);box-shadow:0 0 10px 1px #6fd7c7;color:#fff;}
|
||||
html[data-fuc-palette=spring] body:is(:not([data-native-mode=user]),.dark-layout) .vs-checkbox-con input:checked~.vs-checkbox{border-color:#71d7c7;}
|
||||
html[data-fuc-palette=spring] body:is(:not([data-native-mode=user]),.dark-layout) .vs-checkbox-con input:checked~.vs-checkbox .vs-checkbox--check{background-color:#82dcce;}
|
||||
html[data-fuc-palette=spring] body:is(:not([data-native-mode=user]),.dark-layout) .horizontal-menu .header-navbar.navbar-horizontal ul#main-menu-navigation>li.active>a{background:linear-gradient(118deg, #47ccb7, #6fd7c7);box-shadow:0px 0px 6px 1px #6fd7c7;color:#fff;}
|
||||
html[data-fuc-palette=spring] body:is(:not([data-native-mode=user]),.dark-layout) .bg-primary{background-color:#3dc9b3 !important;}
|
||||
html[data-fuc-palette=spring] body:is(:not([data-native-mode=user]),.dark-layout) #dashboard-analytics .bg-analytics{background:linear-gradient(118deg, #49ccb8, #72d8c8);}
|
||||
html[data-fuc-palette=spring] body:is(:not([data-native-mode=user]),.dark-layout) .btn-radio.active{background-color:#52cebb;color:#FFFFFF;}
|
||||
html[data-fuc-palette=spring] body:is(:not([data-native-mode=user]),.dark-layout) .nav-pills .nav-link.active,
|
||||
html[data-fuc-palette=spring] body:is(:not([data-native-mode=user]),.dark-layout) .nav-pills .show>.nav-link{background-color:#52cebb;box-shadow:0 4px 18px -4px rgba(82,206,187,0.6);color:#fff;}
|
||||
html[data-fuc-palette=spring] body:is(:not([data-native-mode=user]),.dark-layout) .node-pills .nav-link{color:#66d5c3;box-shadow:0 4px 6px rgba(50,50,93,0.11), 0 1px 3px rgba(0, 0, 0, .08);}
|
||||
html[data-fuc-palette=spring] body:is(:not([data-native-mode=user]),.dark-layout) .btn-outline-primary:hover{background-color:rgba(115,103,240,0.08);color:#6ed7c6;}
|
||||
html[data-fuc-palette=spring] body:is(:not([data-native-mode=user]),.dark-layout) .btn-outline-primary{border:1px solid #6fd7c7;color:#50ceba;}
|
||||
html[data-fuc-palette=spring] body:is(:not([data-native-mode=user]),.dark-layout) .btn-primary{background-color:#5ed2c0;border-color:#6ad6c5;color:#fff;}
|
||||
html[data-fuc-palette=spring] body:is(:not([data-native-mode=user]),.dark-layout) .btn-primary:hover{background-color:#64d4c2;border-color:#6fd7c7;color:#fff;}
|
||||
html[data-fuc-palette=spring] body:is(:not([data-native-mode=user]),.dark-layout) .btn-primary:focus,
|
||||
html[data-fuc-palette=spring] body:is(:not([data-native-mode=user]),.dark-layout) .btn-primary.focus{background-color:#79daca;box-shadow:0 0 0 0.2rem rgba(136,126,242,0.5);}
|
||||
html[data-fuc-palette=spring] body:is(:not([data-native-mode=user]),.dark-layout) .btn-primary.disabled,
|
||||
html[data-fuc-palette=spring] body:is(:not([data-native-mode=user]),.dark-layout) .btn-primary:disabled{background-color:#50cebb;border-color:#6ed7c6;color:#fff;}
|
||||
html[data-fuc-palette=spring] body:is(:not([data-native-mode=user]),.dark-layout) .btn-primary:not(:disabled):not(.disabled):active:focus,
|
||||
html[data-fuc-palette=spring] body:is(:not([data-native-mode=user]),.dark-layout) .btn-primary:not(:disabled):not(.disabled).active:focus,
|
||||
html[data-fuc-palette=spring] body:is(:not([data-native-mode=user]),.dark-layout) .show>.btn-primary.dropdown-toggle:focus{box-shadow:0 0 0 0.2rem rgba(136,126,242,0.5);}
|
||||
html[data-fuc-palette=spring] body:is(:not([data-native-mode=user]),.dark-layout) .main-menu .navbar-header .navbar-brand .brand-text{color:#52cfbc;}
|
||||
html[data-fuc-palette=spring] body:is(:not([data-native-mode=user]),.dark-layout) .text-primary{color:#5dd2bf !important;}
|
||||
html[data-fuc-palette=spring] body:is(:not([data-native-mode=user]),.dark-layout) :where(a:not(.btn,.nav-link,.dropdown-item,.navbar-brand)){color:#50cebb;}
|
||||
html[data-fuc-palette=spring] body:is(:not([data-native-mode=user]),.dark-layout) :where(a:not(.btn,.nav-link,.dropdown-item,.navbar-brand)):hover{color:#6cd6c6;}
|
||||
html[data-fuc-palette=spring] body:is(:not([data-native-mode=user]),.dark-layout) .pace .pace-progress{background:#6dd7c6;}
|
||||
html[data-fuc-palette=spring] body:is(:not([data-native-mode=user]),.dark-layout) .card.card-hero .card-header{background-image:linear-gradient(to bottom, #43bdaa, #82dcce);color:#fff;}
|
||||
html[data-fuc-palette=spring] body:is(:not([data-native-mode=user]),.dark-layout) .card.card-hero .card-header .card-icon{color:#7dd9cb;}
|
||||
html[data-fuc-palette=spring] body:is(:not([data-native-mode=user]),.dark-layout) .header-navbar .navbar-container ul.nav li.dropdown-user .dropdown-menu-right .dropdown-item:hover,
|
||||
html[data-fuc-palette=spring] body:is(:not([data-native-mode=user]),.dark-layout) .header-navbar .navbar-container ul.nav li.dropdown-user .dropdown-menu-right .dropdown-item:active{background:#52cfbb;color:#fff !important;}
|
||||
html[data-fuc-palette=spring] body:is(:not([data-native-mode=user]),.dark-layout) .pagination .page-item.active .page-link{background-color:#61d3c1;color:#fff;}
|
||||
html[data-fuc-palette=spring] body:is(:not([data-native-mode=user]),.dark-layout) .offer-slider .slide .selling-slide .shop_img img{filter:hue-rotate(290deg);}
|
||||
html[data-fuc-palette=spring] body:is(:not([data-native-mode=user]),.dark-layout) .b-primary{border:1px solid #3dc9b3 !important;}
|
||||
html[data-fuc-palette=spring] body:is(:not([data-native-mode=user]),.dark-layout) .badge-primary{background-color:#51cfbc;color:#fff;}
|
||||
html[data-fuc-palette=spring] body:is(:not([data-native-mode=user]),.dark-layout) .nav.nav-tabs .nav-item .nav-link.active:after{background:linear-gradient(30deg, #3dc9b3, rgba(108,205,190,0.490196)) !important;box-shadow:0 0 8px 0 rgba(61,201,179,0.529412) !important;}
|
||||
html[data-fuc-palette=spring] body:is(:not([data-native-mode=user]),.dark-layout) .dropdown-list .dropdown-item:focus{background-color:#3ec9b3;}
|
||||
html[data-fuc-palette=spring] body:is(:not([data-native-mode=user]),.dark-layout) .dropdown-item:hover,
|
||||
html[data-fuc-palette=spring] body:is(:not([data-native-mode=user]),.dark-layout) .dropdown-item:focus{color:#3ec9b3;background-color:rgba(209,252,245,0.4);}
|
||||
html[data-fuc-palette=spring] body:is(:not([data-native-mode=user]),.dark-layout) .dropdown-item.active,
|
||||
html[data-fuc-palette=spring] body:is(:not([data-native-mode=user]),.dark-layout) .dropdown-item:active{background-color:#3ec9b3;color:#FFFFFF;}
|
||||
html[data-fuc-palette=spring] body:is(:not([data-native-mode=user]),.dark-layout) .custom-control-input:checked~.custom-control-label::before{border-color:rgba(91,201,184,0.4);background-color:#5bc9b8;color:#FFFFFF;}
|
||||
html[data-fuc-season=summer]{--primary-color:#52a4cf;}
|
||||
html[data-fuc-season=summer] .brand-logo-img{filter:hue-rotate(320deg) brightness(106%);}
|
||||
html[data-fuc-season=summer] .main-menu:is(.menu-light,.menu-dark) .navigation>li.active>a{background:linear-gradient(118deg, #479fcc, #71b4d7);box-shadow:0 0 10px 1px #6fb3d7;color:#fff;}
|
||||
html[data-fuc-season=summer] .vs-checkbox-con input:checked~.vs-checkbox{border-color:#71b4d7;}
|
||||
html[data-fuc-season=summer] .vs-checkbox-con input:checked~.vs-checkbox .vs-checkbox--check{background-color:#82bddc;}
|
||||
html[data-fuc-season=summer] .horizontal-menu .header-navbar.navbar-horizontal ul#main-menu-navigation>li.active>a{background:linear-gradient(118deg, #479fcc, #6fb3d7);box-shadow:0px 0px 6px 1px #6fb3d7;color:#fff;}
|
||||
html[data-fuc-season=summer] .bg-primary{background-color:#3d99c9 !important;}
|
||||
html[data-fuc-season=summer] #dashboard-analytics .bg-analytics{background:linear-gradient(118deg, #499fcc, #72b5d8);}
|
||||
html[data-fuc-season=summer] .btn-radio.active{background-color:#52a3ce;color:#FFFFFF;}
|
||||
html[data-fuc-season=summer] .nav-pills .nav-link.active,
|
||||
html[data-fuc-season=summer] .nav-pills .show>.nav-link{background-color:#52a3ce;box-shadow:0 4px 18px -4px rgba(82,163,206,0.6);color:#fff;}
|
||||
html[data-fuc-season=summer] .node-pills .nav-link{color:#66b0d5;box-shadow:0 4px 6px rgba(71,50,93,0.11), 0 1px 3px rgba(0, 0, 0, .08);}
|
||||
html[data-fuc-season=summer] .btn-outline-primary:hover{background-color:rgba(184,103,240,0.08);color:#6eb3d7;}
|
||||
html[data-fuc-season=summer] .btn-outline-primary{border:1px solid #6fb3d7;color:#50a3ce;}
|
||||
html[data-fuc-season=summer] .btn-primary{background-color:#5eaad2;border-color:#6ab1d6;color:#fff;}
|
||||
html[data-fuc-season=summer] .btn-primary:hover{background-color:#64aed4;border-color:#6fb3d7;color:#fff;}
|
||||
html[data-fuc-season=summer] .btn-primary:focus,
|
||||
html[data-fuc-season=summer] .btn-primary.focus{background-color:#79b9da;box-shadow:0 0 0 0.2rem rgba(194,126,242,0.5);}
|
||||
html[data-fuc-season=summer] .btn-primary.disabled,
|
||||
html[data-fuc-season=summer] .btn-primary:disabled{background-color:#50a2ce;border-color:#6eb3d7;color:#fff;}
|
||||
html[data-fuc-season=summer] .btn-primary:not(:disabled):not(.disabled):active:focus,
|
||||
html[data-fuc-season=summer] .btn-primary:not(:disabled):not(.disabled).active:focus,
|
||||
html[data-fuc-season=summer] .show>.btn-primary.dropdown-toggle:focus{box-shadow:0 0 0 0.2rem rgba(194,126,242,0.5);}
|
||||
html[data-fuc-season=summer] .main-menu .navbar-header .navbar-brand .brand-text{color:#52a4cf;}
|
||||
html[data-fuc-season=summer] .text-primary{color:#5daad2 !important;}
|
||||
html[data-fuc-season=summer] :where(a:not(.btn,.nav-link,.dropdown-item,.navbar-brand)){color:#50a2ce;}
|
||||
html[data-fuc-season=summer] :where(a:not(.btn,.nav-link,.dropdown-item,.navbar-brand)):hover{color:#6cb1d6;}
|
||||
html[data-fuc-season=summer] .pace .pace-progress{background:#6db3d7;}
|
||||
html[data-fuc-season=summer] .card.card-hero .card-header{background-image:linear-gradient(to bottom, #4393bd, #82bddc);color:#fff;}
|
||||
html[data-fuc-season=summer] .card.card-hero .card-header .card-icon{color:#7db9d9;}
|
||||
html[data-fuc-season=summer] .header-navbar .navbar-container ul.nav li.dropdown-user .dropdown-menu-right .dropdown-item:hover,
|
||||
html[data-fuc-season=summer] .header-navbar .navbar-container ul.nav li.dropdown-user .dropdown-menu-right .dropdown-item:active{background:#52a4cf;color:#fff !important;}
|
||||
html[data-fuc-season=summer] .pagination .page-item.active .page-link{background-color:#61acd3;color:#fff;}
|
||||
html[data-fuc-season=summer] .offer-slider .slide .selling-slide .shop_img img{filter:hue-rotate(320deg);}
|
||||
html[data-fuc-season=summer] .b-primary{border:1px solid #3d99c9 !important;}
|
||||
html[data-fuc-season=summer] .badge-primary{background-color:#51a3cf;color:#fff;}
|
||||
html[data-fuc-season=summer] .nav.nav-tabs .nav-item .nav-link.active:after{background:linear-gradient(30deg, #3d99c9, rgba(108,171,205,0.490196)) !important;box-shadow:0 0 8px 0 rgba(61,153,201,0.529412) !important;}
|
||||
html[data-fuc-season=summer] .dropdown-list .dropdown-item:focus{background-color:#3e99c9;}
|
||||
html[data-fuc-season=summer] .dropdown-item:hover,
|
||||
html[data-fuc-season=summer] .dropdown-item:focus{color:#3e99c9;background-color:rgba(209,238,252,0.4);}
|
||||
html[data-fuc-season=summer] .dropdown-item.active,
|
||||
html[data-fuc-season=summer] .dropdown-item:active{background-color:#3e99c9;color:#FFFFFF;}
|
||||
html[data-fuc-season=summer] .custom-control-input:checked~.custom-control-label::before{border-color:rgba(91,163,201,0.4);background-color:#5ba3c9;color:#FFFFFF;}
|
||||
html[data-fuc-season=autumn]{--primary-color:#cf9652;}
|
||||
html[data-fuc-season=autumn] .brand-logo-img{filter:hue-rotate(152deg) brightness(106%);}
|
||||
html[data-fuc-season=autumn] .main-menu:is(.menu-light,.menu-dark) .navigation>li.active>a{background:linear-gradient(118deg, #cc8f47, #d7a871);box-shadow:0 0 10px 1px #d7a86f;color:#fff;}
|
||||
html[data-fuc-season=autumn] .vs-checkbox-con input:checked~.vs-checkbox{border-color:#d7a871;}
|
||||
html[data-fuc-season=autumn] .vs-checkbox-con input:checked~.vs-checkbox .vs-checkbox--check{background-color:#dcb382;}
|
||||
html[data-fuc-season=autumn] .horizontal-menu .header-navbar.navbar-horizontal ul#main-menu-navigation>li.active>a{background:linear-gradient(118deg, #cc8f47, #d7a86f);box-shadow:0px 0px 6px 1px #d7a86f;color:#fff;}
|
||||
html[data-fuc-season=autumn] .bg-primary{background-color:#c9893d !important;}
|
||||
html[data-fuc-season=autumn] #dashboard-analytics .bg-analytics{background:linear-gradient(118deg, #cc9149, #d8a972);}
|
||||
html[data-fuc-season=autumn] .btn-radio.active{background-color:#ce9652;color:#FFFFFF;}
|
||||
html[data-fuc-season=autumn] .nav-pills .nav-link.active,
|
||||
html[data-fuc-season=autumn] .nav-pills .show>.nav-link{background-color:#ce9652;box-shadow:0 4px 18px -4px rgba(206,150,82,0.6);color:#fff;}
|
||||
html[data-fuc-season=autumn] .node-pills .nav-link{color:#d5a266;box-shadow:0 4px 6px rgba(63,93,50,0.11), 0 1px 3px rgba(0, 0, 0, .08);}
|
||||
html[data-fuc-season=autumn] .btn-outline-primary:hover{background-color:rgba(132,240,103,0.08);color:#d7a76e;}
|
||||
html[data-fuc-season=autumn] .btn-outline-primary{border:1px solid #d7a86f;color:#ce9450;}
|
||||
html[data-fuc-season=autumn] .btn-primary{background-color:#d29d5e;border-color:#d6a56a;color:#fff;}
|
||||
html[data-fuc-season=autumn] .btn-primary:hover{background-color:#d4a064;border-color:#d7a86f;color:#fff;}
|
||||
html[data-fuc-season=autumn] .btn-primary:focus,
|
||||
html[data-fuc-season=autumn] .btn-primary.focus{background-color:#daad79;box-shadow:0 0 0 0.2rem rgba(151,242,126,0.5);}
|
||||
html[data-fuc-season=autumn] .btn-primary.disabled,
|
||||
html[data-fuc-season=autumn] .btn-primary:disabled{background-color:#ce9550;border-color:#d7a76e;color:#fff;}
|
||||
html[data-fuc-season=autumn] .btn-primary:not(:disabled):not(.disabled):active:focus,
|
||||
html[data-fuc-season=autumn] .btn-primary:not(:disabled):not(.disabled).active:focus,
|
||||
html[data-fuc-season=autumn] .show>.btn-primary.dropdown-toggle:focus{box-shadow:0 0 0 0.2rem rgba(151,242,126,0.5);}
|
||||
html[data-fuc-season=autumn] .main-menu .navbar-header .navbar-brand .brand-text{color:#cf9652;}
|
||||
html[data-fuc-season=autumn] .text-primary{color:#d29c5d !important;}
|
||||
html[data-fuc-season=autumn] :where(a:not(.btn,.nav-link,.dropdown-item,.navbar-brand)){color:#ce9550;}
|
||||
html[data-fuc-season=autumn] :where(a:not(.btn,.nav-link,.dropdown-item,.navbar-brand)):hover{color:#d6a66c;}
|
||||
html[data-fuc-season=autumn] .pace .pace-progress{background:#d7a66d;}
|
||||
html[data-fuc-season=autumn] .card.card-hero .card-header{background-image:linear-gradient(to bottom, #bd8543, #dcb382);color:#fff;}
|
||||
html[data-fuc-season=autumn] .card.card-hero .card-header .card-icon{color:#d9af7d;}
|
||||
html[data-fuc-season=autumn] .header-navbar .navbar-container ul.nav li.dropdown-user .dropdown-menu-right .dropdown-item:hover,
|
||||
html[data-fuc-season=autumn] .header-navbar .navbar-container ul.nav li.dropdown-user .dropdown-menu-right .dropdown-item:active{background:#cf9652;color:#fff !important;}
|
||||
html[data-fuc-season=autumn] .pagination .page-item.active .page-link{background-color:#d39f61;color:#fff;}
|
||||
html[data-fuc-season=autumn] .offer-slider .slide .selling-slide .shop_img img{filter:hue-rotate(152deg);}
|
||||
html[data-fuc-season=autumn] .b-primary{border:1px solid #c9893d !important;}
|
||||
html[data-fuc-season=autumn] .badge-primary{background-color:#cf9651;color:#fff;}
|
||||
html[data-fuc-season=autumn] .nav.nav-tabs .nav-item .nav-link.active:after{background:linear-gradient(30deg, #c9893d, rgba(205,161,108,0.490196)) !important;box-shadow:0 0 8px 0 rgba(201,137,61,0.529412) !important;}
|
||||
html[data-fuc-season=autumn] .dropdown-list .dropdown-item:focus{background-color:#c9893e;}
|
||||
html[data-fuc-season=autumn] .dropdown-item:hover,
|
||||
html[data-fuc-season=autumn] .dropdown-item:focus{color:#c9893e;background-color:rgba(252,232,209,0.4);}
|
||||
html[data-fuc-season=autumn] .dropdown-item.active,
|
||||
html[data-fuc-season=autumn] .dropdown-item:active{background-color:#c9893e;color:#FFFFFF;}
|
||||
html[data-fuc-season=autumn] .custom-control-input:checked~.custom-control-label::before{border-color:rgba(201,151,91,0.4);background-color:#c9975b;color:#FFFFFF;}
|
||||
html[data-fuc-season=winter]{--primary-color:#525bcf;}
|
||||
html[data-fuc-season=winter] .brand-logo-img{filter:hue-rotate(355deg) brightness(106%);}
|
||||
html[data-fuc-season=winter] .main-menu:is(.menu-light,.menu-dark) .navigation>li.active>a{background:linear-gradient(118deg, #4751cc, #7178d7);box-shadow:0 0 10px 1px #6f76d7;color:#fff;}
|
||||
html[data-fuc-season=winter] .vs-checkbox-con input:checked~.vs-checkbox{border-color:#7178d7;}
|
||||
html[data-fuc-season=winter] .vs-checkbox-con input:checked~.vs-checkbox .vs-checkbox--check{background-color:#8288dc;}
|
||||
html[data-fuc-season=winter] .horizontal-menu .header-navbar.navbar-horizontal ul#main-menu-navigation>li.active>a{background:linear-gradient(118deg, #4751cc, #6f76d7);box-shadow:0px 0px 6px 1px #6f76d7;color:#fff;}
|
||||
html[data-fuc-season=winter] .bg-primary{background-color:#3d47c9 !important;}
|
||||
html[data-fuc-season=winter] #dashboard-analytics .bg-analytics{background:linear-gradient(118deg, #4952cc, #7279d8);}
|
||||
html[data-fuc-season=winter] .btn-radio.active{background-color:#525bce;color:#FFFFFF;}
|
||||
html[data-fuc-season=winter] .nav-pills .nav-link.active,
|
||||
html[data-fuc-season=winter] .nav-pills .show>.nav-link{background-color:#525bce;box-shadow:0 4px 18px -4px rgba(82,91,206,0.6);color:#fff;}
|
||||
html[data-fuc-season=winter] .node-pills .nav-link{color:#666fd5;box-shadow:0 4px 6px rgba(93,50,89,0.11), 0 1px 3px rgba(0, 0, 0, .08);}
|
||||
html[data-fuc-season=winter] .btn-outline-primary:hover{background-color:rgba(240,103,217,0.08);color:#6e76d7;}
|
||||
html[data-fuc-season=winter] .btn-outline-primary{border:1px solid #6f76d7;color:#505ace;}
|
||||
html[data-fuc-season=winter] .btn-primary{background-color:#5e66d2;border-color:#6a72d6;color:#fff;}
|
||||
html[data-fuc-season=winter] .btn-primary:hover{background-color:#646dd4;border-color:#6f76d7;color:#fff;}
|
||||
html[data-fuc-season=winter] .btn-primary:focus,
|
||||
html[data-fuc-season=winter] .btn-primary.focus{background-color:#7981da;box-shadow:0 0 0 0.2rem rgba(242,126,222,0.5);}
|
||||
html[data-fuc-season=winter] .btn-primary.disabled,
|
||||
html[data-fuc-season=winter] .btn-primary:disabled{background-color:#5059ce;border-color:#6e76d7;color:#fff;}
|
||||
html[data-fuc-season=winter] .btn-primary:not(:disabled):not(.disabled):active:focus,
|
||||
html[data-fuc-season=winter] .btn-primary:not(:disabled):not(.disabled).active:focus,
|
||||
html[data-fuc-season=winter] .show>.btn-primary.dropdown-toggle:focus{box-shadow:0 0 0 0.2rem rgba(242,126,222,0.5);}
|
||||
html[data-fuc-season=winter] .main-menu .navbar-header .navbar-brand .brand-text{color:#525bcf;}
|
||||
html[data-fuc-season=winter] .text-primary{color:#5d66d2 !important;}
|
||||
html[data-fuc-season=winter] :where(a:not(.btn,.nav-link,.dropdown-item,.navbar-brand)){color:#5059ce;}
|
||||
html[data-fuc-season=winter] :where(a:not(.btn,.nav-link,.dropdown-item,.navbar-brand)):hover{color:#6c73d6;}
|
||||
html[data-fuc-season=winter] .pace .pace-progress{background:#6d75d7;}
|
||||
html[data-fuc-season=winter] .card.card-hero .card-header{background-image:linear-gradient(to bottom, #434cbd, #8288dc);color:#fff;}
|
||||
html[data-fuc-season=winter] .card.card-hero .card-header .card-icon{color:#7d83d9;}
|
||||
html[data-fuc-season=winter] .header-navbar .navbar-container ul.nav li.dropdown-user .dropdown-menu-right .dropdown-item:hover,
|
||||
html[data-fuc-season=winter] .header-navbar .navbar-container ul.nav li.dropdown-user .dropdown-menu-right .dropdown-item:active{background:#525ccf;color:#fff !important;}
|
||||
html[data-fuc-season=winter] .pagination .page-item.active .page-link{background-color:#616ad3;color:#fff;}
|
||||
html[data-fuc-season=winter] .offer-slider .slide .selling-slide .shop_img img{filter:hue-rotate(355deg);}
|
||||
html[data-fuc-season=winter] .b-primary{border:1px solid #3d47c9 !important;}
|
||||
html[data-fuc-season=winter] .badge-primary{background-color:#5159cf;color:#fff;}
|
||||
html[data-fuc-season=winter] .nav.nav-tabs .nav-item .nav-link.active:after{background:linear-gradient(30deg, #3d47c9, rgba(108,115,205,0.490196)) !important;box-shadow:0 0 8px 0 rgba(61,71,201,0.529412) !important;}
|
||||
html[data-fuc-season=winter] .dropdown-list .dropdown-item:focus{background-color:#3e48c9;}
|
||||
html[data-fuc-season=winter] .dropdown-item:hover,
|
||||
html[data-fuc-season=winter] .dropdown-item:focus{color:#3e48c9;background-color:rgba(209,212,252,0.4);}
|
||||
html[data-fuc-season=winter] .dropdown-item.active,
|
||||
html[data-fuc-season=winter] .dropdown-item:active{background-color:#3e48c9;color:#FFFFFF;}
|
||||
html[data-fuc-season=winter] .custom-control-input:checked~.custom-control-label::before{border-color:rgba(91,99,201,0.4);background-color:#5b63c9;color:#FFFFFF;}
|
||||
/* Preserve the original neutral surfaces and dark layout; only seasonal accents change. */
|
||||
html[data-fuc-season] .bg-gradient-primary{background:linear-gradient(118deg,var(--season-deep),var(--season-bright))!important;}
|
||||
html[data-fuc-season] .custom-control-input:focus~.custom-control-label:before{box-shadow:0 0 0 .2rem rgba(var(--season-rgb),.25);}
|
||||
html[data-fuc-season] .fuc-sidebar-mark,html[data-fuc-season] .fuc-auth-mark{filter:var(--season-logo);}
|
||||
html:is([data-fuc-season],[data-fuc-palette=spring]) .native-public .hero-1{background-color:var(--season-primary);background-blend-mode:luminosity;}
|
||||
html:is([data-fuc-season],[data-fuc-palette=spring]) .native-public .navbar-brand img{filter:var(--season-logo);}
|
||||
html:is([data-fuc-season],[data-fuc-palette=spring]) .native-public #navbar:not(.nav-sticky) .navbar-brand img{filter:brightness(0) invert(1);}
|
||||
html:is([data-fuc-season],[data-fuc-palette=spring]) .native-public .bg-light{background-color:var(--season-tint)!important;}
|
||||
html:is([data-fuc-season],[data-fuc-palette=spring]) .native-public .nav-sticky .nav-link.active,html:is([data-fuc-season],[data-fuc-palette=spring]) .native-public .nav-sticky .nav-link:hover{color:var(--season-primary);}
|
||||
html:is([data-fuc-season],[data-fuc-palette=spring]) .native-public .nav-btn{background-color:var(--season-primary);border-color:var(--season-primary);color:#fff;}
|
||||
html:is([data-fuc-season],[data-fuc-palette=spring]) .native-public .pricing [style*="color:#3c2299"]{color:var(--season-primary)!important;}
|
||||
html:is([data-fuc-season],[data-fuc-palette=spring]) .native-public .btn-light{color:var(--season-primary);}
|
||||
/* Brand ink must remain legible while cached light/dark styles are prepared. */
|
||||
html:is([data-fuc-season],[data-fuc-palette=spring]) .fuc-brand-wordmark{background-color:#5e5873;}
|
||||
html:is([data-fuc-season],[data-fuc-palette=spring]) .dark-layout .fuc-brand-wordmark{background-color:#e7e5f4;}
|
||||
.season-swatch{display:inline-block;width:10px;height:10px;border-radius:50%;margin-right:6px;}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
/*! SmoothScroll v16.1.4 | (c) 2020 Chris Ferdinandi | MIT License | http://github.com/cferdinandi/smooth-scroll */
|
||||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).SmoothScroll=t()}(this,(function(){"use strict";window.Element&&!Element.prototype.closest&&(Element.prototype.closest=function(e){var t,n=(this.document||this.ownerDocument).querySelectorAll(e),o=this;do{for(t=n.length;--t>=0&&n.item(t)!==o;);}while(t<0&&(o=o.parentElement));return o}),function(){if("function"==typeof window.CustomEvent)return!1;function e(e,t){t=t||{bubbles:!1,cancelable:!1,detail:void 0};var n=document.createEvent("CustomEvent");return n.initCustomEvent(e,t.bubbles,t.cancelable,t.detail),n}e.prototype=window.Event.prototype,window.CustomEvent=e}(),
|
||||
/**
|
||||
* requestAnimationFrame() polyfill
|
||||
* By Erik Möller. Fixes from Paul Irish and Tino Zijdel.
|
||||
* @link http://paulirish.com/2011/requestanimationframe-for-smart-animating/
|
||||
* @link http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating
|
||||
* @license MIT
|
||||
*/
|
||||
function(){for(var e=0,t=["ms","moz","webkit","o"],n=0;n<t.length&&!window.requestAnimationFrame;++n)window.requestAnimationFrame=window[t[n]+"RequestAnimationFrame"],window.cancelAnimationFrame=window[t[n]+"CancelAnimationFrame"]||window[t[n]+"CancelRequestAnimationFrame"];window.requestAnimationFrame||(window.requestAnimationFrame=function(t,n){var o=(new Date).getTime(),i=Math.max(0,16-(o-e)),a=window.setTimeout((function(){t(o+i)}),i);return e=o+i,a}),window.cancelAnimationFrame||(window.cancelAnimationFrame=function(e){clearTimeout(e)})}();var e={ignore:"[data-scroll-ignore]",header:null,topOnEmptyHash:!0,speed:500,speedAsDuration:!1,durationMax:null,durationMin:null,clip:!0,offset:0,easing:"easeInOutCubic",customEasing:null,updateURL:!0,popstate:!0,emitEvents:!0},t=function(){var e={};return Array.prototype.forEach.call(arguments,(function(t){for(var n in t){if(!t.hasOwnProperty(n))return;e[n]=t[n]}})),e},n=function(e){"#"===e.charAt(0)&&(e=e.substr(1));for(var t,n=String(e),o=n.length,i=-1,a="",r=n.charCodeAt(0);++i<o;){if(0===(t=n.charCodeAt(i)))throw new InvalidCharacterError("Invalid character: the input contains U+0000.");t>=1&&t<=31||127==t||0===i&&t>=48&&t<=57||1===i&&t>=48&&t<=57&&45===r?a+="\\"+t.toString(16)+" ":a+=t>=128||45===t||95===t||t>=48&&t<=57||t>=65&&t<=90||t>=97&&t<=122?n.charAt(i):"\\"+n.charAt(i)}return"#"+a},o=function(){return Math.max(document.body.scrollHeight,document.documentElement.scrollHeight,document.body.offsetHeight,document.documentElement.offsetHeight,document.body.clientHeight,document.documentElement.clientHeight)},i=function(e){return e?(t=e,parseInt(window.getComputedStyle(t).height,10)+e.offsetTop):0;var t},a=function(e,t,n){0===e&&document.body.focus(),n||(e.focus(),document.activeElement!==e&&(e.setAttribute("tabindex","-1"),e.focus(),e.style.outline="none"),window.scrollTo(0,t))},r=function(e,t,n,o){if(t.emitEvents&&"function"==typeof window.CustomEvent){var i=new CustomEvent(e,{bubbles:!0,detail:{anchor:n,toggle:o}});document.dispatchEvent(i)}};return function(c,u){var s,l,d,m,f={};f.cancelScroll=function(e){cancelAnimationFrame(m),m=null,e||r("scrollCancel",s)},f.animateScroll=function(n,c,u){f.cancelScroll();var l=t(s||e,u||{}),w="[object Number]"===Object.prototype.toString.call(n),h=w||!n.tagName?null:n;if(w||h){var p=window.pageYOffset;l.header&&!d&&(d=document.querySelector(l.header));var g,y,v,S=i(d),E=w?n:function(e,t,n,i){var a=0;if(e.offsetParent)do{a+=e.offsetTop,e=e.offsetParent}while(e);return a=Math.max(a-t-n,0),i&&(a=Math.min(a,o()-window.innerHeight)),a}(h,S,parseInt("function"==typeof l.offset?l.offset(n,c):l.offset,10),l.clip),b=E-p,A=o(),O=0,C=function(e,t){var n=t.speedAsDuration?t.speed:Math.abs(e/1e3*t.speed);return t.durationMax&&n>t.durationMax?t.durationMax:t.durationMin&&n<t.durationMin?t.durationMin:parseInt(n,10)}(b,l),M=function(e){g||(g=e),O+=e-g,v=p+b*function(e,t){var n;return"easeInQuad"===e.easing&&(n=t*t),"easeOutQuad"===e.easing&&(n=t*(2-t)),"easeInOutQuad"===e.easing&&(n=t<.5?2*t*t:(4-2*t)*t-1),"easeInCubic"===e.easing&&(n=t*t*t),"easeOutCubic"===e.easing&&(n=--t*t*t+1),"easeInOutCubic"===e.easing&&(n=t<.5?4*t*t*t:(t-1)*(2*t-2)*(2*t-2)+1),"easeInQuart"===e.easing&&(n=t*t*t*t),"easeOutQuart"===e.easing&&(n=1- --t*t*t*t),"easeInOutQuart"===e.easing&&(n=t<.5?8*t*t*t*t:1-8*--t*t*t*t),"easeInQuint"===e.easing&&(n=t*t*t*t*t),"easeOutQuint"===e.easing&&(n=1+--t*t*t*t*t),"easeInOutQuint"===e.easing&&(n=t<.5?16*t*t*t*t*t:1+16*--t*t*t*t*t),e.customEasing&&(n=e.customEasing(t)),n||t}(l,y=(y=0===C?0:O/C)>1?1:y),window.scrollTo(0,Math.floor(v)),function(e,t){var o=window.pageYOffset;if(e==t||o==t||(p<t&&window.innerHeight+o)>=A)return f.cancelScroll(!0),a(n,t,w),r("scrollStop",l,n,c),g=null,m=null,!0}(v,E)||(m=window.requestAnimationFrame(M),g=e)};0===window.pageYOffset&&window.scrollTo(0,0),function(e,t,n){t||history.pushState&&n.updateURL&&history.pushState({smoothScroll:JSON.stringify(n),anchor:e.id},document.title,e===document.documentElement?"#top":"#"+e.id)}(n,w,l),"matchMedia"in window&&window.matchMedia("(prefers-reduced-motion)").matches?a(n,Math.floor(E),!1):(r("scrollStart",l,n,c),f.cancelScroll(!0),window.requestAnimationFrame(M))}};var w=function(e){if(!e.defaultPrevented&&!(0!==e.button||e.metaKey||e.ctrlKey||e.shiftKey)&&"closest"in e.target&&(l=e.target.closest(c))&&"a"===l.tagName.toLowerCase()&&!e.target.closest(s.ignore)&&l.hostname===window.location.hostname&&l.pathname===window.location.pathname&&/#/.test(l.href)){var t,o;try{t=n(decodeURIComponent(l.hash))}catch(e){t=n(l.hash)}if("#"===t){if(!s.topOnEmptyHash)return;o=document.documentElement}else o=document.querySelector(t);(o=o||"#top"!==t?o:document.documentElement)&&(e.preventDefault(),function(e){if(history.replaceState&&e.updateURL&&!history.state){var t=window.location.hash;t=t||"",history.replaceState({smoothScroll:JSON.stringify(e),anchor:t||window.pageYOffset},document.title,t||window.location.href)}}(s),f.animateScroll(o,l))}},h=function(){if(null!==Line truncated
|
||||
+1
@@ -0,0 +1 @@
|
||||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.Sweetalert2=t()}(this,function(){"use strict";function q(e){return(q="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function i(e,t,n){return t&&o(e.prototype,t),n&&o(e,n),e}function r(){return(r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e}).apply(this,arguments)}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&u(e,t)}function c(e){return(c=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function u(e,t){return(u=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function l(e,t,n){return(l=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}()?Reflect.construct:function(e,t,n){var o=[null];o.push.apply(o,t);var i=new(Function.bind.apply(e,o));return n&&u(i,n.prototype),i}).apply(null,arguments)}function d(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function p(e,t,n){return(p="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var o=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=c(e)););return e}(e,t);if(o){var i=Object.getOwnPropertyDescriptor(o,t);return i.get?i.get.call(n):i.value}})(e,t,n||e)}var t="SweetAlert2:",f=function(e){return Array.prototype.slice.call(e)},R=function(e){console.warn("".concat(t," ").concat(e))},I=function(e){console.error("".concat(t," ").concat(e))},n=[],m=function(e){-1===n.indexOf(e)&&(n.push(e),R(e))},H=function(e){return"function"==typeof e?e():e},D=function(e){return e&&Promise.resolve(e)===e},e=Object.freeze({cancel:"cancel",backdrop:"overlay",close:"close",esc:"esc",timer:"timer"}),h=function(e){var t={};for(var n in e)t[e[n]]="swal2-"+e[n];return t},_=h(["container","shown","height-auto","iosfix","popup","modal","no-backdrop","toast","toast-shown","toast-column","fade","show","hide","noanimation","close","title","header","content","actions","confirm","cancel","footer","icon","icon-text","image","input","file","range","select","radio","checkbox","label","textarea","inputerror","validation-message","progresssteps","activeprogressstep","progresscircle","progressline","loading","styled","top","top-start","top-end","top-left","top-right","center","center-start","center-end","center-left","center-right","bottom","bottom-start","bottom-end","bottom-left","bottom-right","grow-row","grow-column","grow-fullscreen","rtl"]),g=h(["success","warning","info","question","error"]),b={previousBodyPadding:null},v=function(e,t){return e.classList.contains(t)},N=function(e){if(e.focus(),"file"!==e.type){var t=e.value;e.value="",e.value=t}},y=function(e,t,n){e&&t&&("string"==typeof t&&(t=t.split(/\s+/).filter(Boolean)),t.forEach(function(t){e.forEach?e.forEach(function(e){n?e.classList.add(t):e.classList.remove(t)}):n?e.classList.add(t):e.classList.remove(t)}))},z=function(e,t){y(e,t,!0)},W=function(e,t){y(e,t,!1)},U=function(e,t){for(var n=0;n<e.childNodes.length;n++)if(v(e.childNodes[n],t))return e.childNodes[n]},K=function(e){e.style.opacity="",e.style.display=e.id===_.content?"block":"flex"},F=function(e){e.style.opacity="",e.style.display="none"},Z=function(e){return e&&(e.offsetWidth||e.offsetHeight||e.getClientRects().length)},w=function(){return document.body.querySelector("."+_.container)},C=function(e){var t=w();return t?t.querySelector("."+e):null},k=function(){return C(_.popup)},x=function(){var e=k();return f(e.querySelectorAll("."+_.icon))},A=function(){return C(_.title)},B=function(){return C(_.content)},S=function(){return C(_.image)},P=function(){return C(_.progresssteps)},E=function(){return C(_["validation-message"])},L=function(){return C(_.confirm)},O=function(){return C(_.cancel)},Q=function(){return C(_.actions)},Y=function(){return C(_.footer)},$=function(){return C(_.close)},J=function(){var e=f(k().querySelectorAll('[tabindex]:not([tabindex="-1"]):not([tabindex="0"])')).sort(function(e,t){return e=Line truncated
|
||||
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"source": "fuc-new.loc/public",
|
||||
"widgets": [
|
||||
"jQuery 3.4.1",
|
||||
"Popper",
|
||||
"Bootstrap 4.3.1",
|
||||
"Bootstrap 5.0.0-beta1 for original landing page",
|
||||
"PerfectScrollbar 1.4.0",
|
||||
"Hammer 2.0.8",
|
||||
"Waves",
|
||||
"SweetAlert2",
|
||||
"SmoothScroll"
|
||||
],
|
||||
"sha256": {
|
||||
"widgets.min.js": "380cc70c1457a9bd4734ca8b28bddde42b8373634f9b586b124327c2fe5cb34b",
|
||||
"sweetalert2.min.js": "acd42f25cdff32ec01585c154eaaf4a89f759d6035a51ecf0cb937d61806a8ff",
|
||||
"smooth-scroll.min.js": "16dbfcd5b60cb93e1c5b4356be1477e727a44a3c0044ec178c6b14375f30fe41",
|
||||
"landing-bootstrap5.min.js": "f5133241b26e462a419045a3af96eb54ec22be2293e7c1f780daa2cd2df4f8d1"
|
||||
},
|
||||
"excludes": [
|
||||
"duplicate Pace",
|
||||
"FUC business scripts",
|
||||
"remote requests"
|
||||
]
|
||||
}
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
/*! jQuery v3.4.1 | (c) JS Foundation and other contributors | jquery.org/license */
|
||||
!function(e,t){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof window?window:this,function(C,e){"use strict";var t=[],E=C.document,r=Object.getPrototypeOf,s=t.slice,g=t.concat,u=t.push,i=t.indexOf,n={},o=n.toString,v=n.hasOwnProperty,a=v.toString,l=a.call(Object),y={},m=function(e){return"function"==typeof e&&"number"!=typeof e.nodeType},x=function(e){return null!=e&&e===e.window},c={type:!0,src:!0,nonce:!0,noModule:!0};function b(e,t,n){var r,i,o=(n=n||E).createElement("script");if(o.text=e,t)for(r in c)(i=t[r]||t.getAttribute&&t.getAttribute(r))&&o.setAttribute(r,i);n.head.appendChild(o).parentNode.removeChild(o)}function w(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?n[o.call(e)]||"object":typeof e}var f="3.4.1",k=function(e,t){return new k.fn.init(e,t)},p=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;function d(e){var t=!!e&&"length"in e&&e.length,n=w(e);return!m(e)&&!x(e)&&("array"===n||0===t||"number"==typeof t&&0<t&&t-1 in e)}k.fn=k.prototype={jquery:f,constructor:k,length:0,toArray:function(){return s.call(this)},get:function(e){return null==e?s.call(this):e<0?this[e+this.length]:this[e]},pushStack:function(e){var t=k.merge(this.constructor(),e);return t.prevObject=this,t},each:function(e){return k.each(this,e)},map:function(n){return this.pushStack(k.map(this,function(e,t){return n.call(e,t,e)}))},slice:function(){return this.pushStack(s.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(e){var t=this.length,n=+e+(e<0?t:0);return this.pushStack(0<=n&&n<t?[this[n]]:[])},end:function(){return this.prevObject||this.constructor()},push:u,sort:t.sort,splice:t.splice},k.extend=k.fn.extend=function(){var e,t,n,r,i,o,a=arguments[0]||{},s=1,u=arguments.length,l=!1;for("boolean"==typeof a&&(l=a,a=arguments[s]||{},s++),"object"==typeof a||m(a)||(a={}),s===u&&(a=this,s--);s<u;s++)if(null!=(e=arguments[s]))for(t in e)r=e[t],"__proto__"!==t&&a!==r&&(l&&r&&(k.isPlainObject(r)||(i=Array.isArray(r)))?(n=a[t],o=i&&!Array.isArray(n)?[]:i||k.isPlainObject(n)?n:{},i=!1,a[t]=k.extend(l,o,r)):void 0!==r&&(a[t]=r));return a},k.extend({expando:"jQuery"+(f+Math.random()).replace(/\D/g,""),isReady:!0,error:function(e){throw new Error(e)},noop:function(){},isPlainObject:function(e){var t,n;return!(!e||"[object Object]"!==o.call(e))&&(!(t=r(e))||"function"==typeof(n=v.call(t,"constructor")&&t.constructor)&&a.call(n)===l)},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},globalEval:function(e,t){b(e,{nonce:t&&t.nonce})},each:function(e,t){var n,r=0;if(d(e)){for(n=e.length;r<n;r++)if(!1===t.call(e[r],r,e[r]))break}else for(r in e)if(!1===t.call(e[r],r,e[r]))break;return e},trim:function(e){return null==e?"":(e+"").replace(p,"")},makeArray:function(e,t){var n=t||[];return null!=e&&(d(Object(e))?k.merge(n,"string"==typeof e?[e]:e):u.call(n,e)),n},inArray:function(e,t,n){return null==t?-1:i.call(t,e,n)},merge:function(e,t){for(var n=+t.length,r=0,i=e.length;r<n;r++)e[i++]=t[r];return e.length=i,e},grep:function(e,t,n){for(var r=[],i=0,o=e.length,a=!n;i<o;i++)!t(e[i],i)!==a&&r.push(e[i]);return r},map:function(e,t,n){var r,i,o=0,a=[];if(d(e))for(r=e.length;o<r;o++)null!=(i=t(e[o],o,n))&&a.push(i);else for(o in e)null!=(i=t(e[o],o,n))&&a.push(i);return g.apply([],a)},guid:1,support:y}),"function"==typeof Symbol&&(k.fn[Symbol.iterator]=t[Symbol.iterator]),k.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "),function(e,t){n["[object "+t+"]"]=t.toLowerCase()});var h=function(n){var e,d,b,o,i,h,f,g,w,u,l,T,C,a,E,v,s,c,y,k="sizzle"+1*new Date,m=n.document,S=0,r=0,p=ue(),x=ue(),N=ue(),A=ue(),D=function(e,t){return e===t&&(l=!0),0},j={}.hasOwnProperty,t=[],q=t.pop,L=t.push,H=t.push,O=t.slice,P=function(e,t){for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return-1},R="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",M="[\\x20\\t\\r\\n\\f]",I="(?:\\\\.|[\\w-]|[^\0-\\xa0])+",W="\\["+M+"*("+I+")(?:"+M+"*([*^$|!~]?=)"+M+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+I+"))|)"+M+"*\\]",$=":("+I+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+W+")*)|.*)\\)|)",F=new RegExp(M+"+","g"),B=new RegExp("^"+M+"+|((?:^|[^\\\\])(?:\\\\.)*)"+M+"+$","g"),_=new RegExp("^"+M+"*,"+M+"*"),z=new RegExp("^"+M+"*([>+~]|"+M+")"+M+"*"),U=new RegExp(M+"|>"),X=new RegExp($),V=new RegExp("^"+I+"$"),G={ID:new RegExp("^#("+I+")"),CLASS:new RegExp("^\\.("+I+")"),TAG:new RegExp("^("+I+"|[*])"),ATTR:new RegExp("^"+W),PSEUDO:new RegExp("^"+$),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+M+"*(even|odd|(([+-]|)(\\d*)n|)"+M+"*(?:([+-]|)"+M+"*(\\d+)|))"+M+"*\\)|)","i"),bool:new RegExp("^(?:"+R+")$","i"),needsContext:new RegExp("^"+Line truncated
|
||||
|
||||
/* popper JS */
|
||||
/*
|
||||
Copyright (C) Federico Zivolo 2019
|
||||
Distributed under the MIT License (license terms are at http://opensource.org/licenses/MIT).
|
||||
*/(function(e,t){'object'==typeof exports&&'undefined'!=typeof module?module.exports=t():'function'==typeof define&&define.amd?define(t):e.Popper=t()})(this,function(){'use strict';function e(e){return e&&'[object Function]'==={}.toString.call(e)}function t(e,t){if(1!==e.nodeType)return[];var o=e.ownerDocument.defaultView,n=o.getComputedStyle(e,null);return t?n[t]:n}function o(e){return'HTML'===e.nodeName?e:e.parentNode||e.host}function n(e){if(!e)return document.body;switch(e.nodeName){case'HTML':case'BODY':return e.ownerDocument.body;case'#document':return e.body;}var i=t(e),r=i.overflow,p=i.overflowX,s=i.overflowY;return /(auto|scroll|overlay)/.test(r+s+p)?e:n(o(e))}function r(e){return 11===e?pe:10===e?se:pe||se}function p(e){if(!e)return document.documentElement;for(var o=r(10)?document.body:null,n=e.offsetParent||null;n===o&&e.nextElementSibling;)n=(e=e.nextElementSibling).offsetParent;var i=n&&n.nodeName;return i&&'BODY'!==i&&'HTML'!==i?-1!==['TH','TD','TABLE'].indexOf(n.nodeName)&&'static'===t(n,'position')?p(n):n:e?e.ownerDocument.documentElement:document.documentElement}function s(e){var t=e.nodeName;return'BODY'!==t&&('HTML'===t||p(e.firstElementChild)===e)}function d(e){return null===e.parentNode?e:d(e.parentNode)}function a(e,t){if(!e||!e.nodeType||!t||!t.nodeType)return document.documentElement;var o=e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING,n=o?e:t,i=o?t:e,r=document.createRange();r.setStart(n,0),r.setEnd(i,0);var l=r.commonAncestorContainer;if(e!==l&&t!==l||n.contains(i))return s(l)?l:p(l);var f=d(e);return f.host?a(f.host,t):a(e,d(t).host)}function l(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:'top',o='top'===t?'scrollTop':'scrollLeft',n=e.nodeName;if('BODY'===n||'HTML'===n){var i=e.ownerDocument.documentElement,r=e.ownerDocument.scrollingElement||i;return r[o]}return e[o]}function f(e,t){var o=2<arguments.length&&void 0!==arguments[2]&&arguments[2],n=l(t,'top'),i=l(t,'left'),r=o?-1:1;return e.top+=n*r,e.bottom+=n*r,e.left+=i*r,e.right+=i*r,e}function m(e,t){var o='x'===t?'Left':'Top',n='Left'==o?'Right':'Bottom';return parseFloat(e['border'+o+'Width'],10)+parseFloat(e['border'+n+'Width'],10)}function h(e,t,o,n){return ee(t['offset'+e],t['scroll'+e],o['client'+e],o['offset'+e],o['scroll'+e],r(10)?parseInt(o['offset'+e])+parseInt(n['margin'+('Height'===e?'Top':'Left')])+parseInt(n['margin'+('Height'===e?'Bottom':'Right')]):0)}function c(e){var t=e.body,o=e.documentElement,n=r(10)&&getComputedStyle(o);return{height:h('Height',t,o,n),width:h('Width',t,o,n)}}function g(e){return fe({},e,{right:e.left+e.width,bottom:e.top+e.height})}function u(e){var o={};try{if(r(10)){o=e.getBoundingClientRect();var n=l(e,'top'),i=l(e,'left');o.top+=n,o.left+=i,o.bottom+=n,o.right+=i}else o=e.getBoundingClientRect()}catch(t){}var p={left:o.left,top:o.top,width:o.right-o.left,height:o.bottom-o.top},s='HTML'===e.nodeName?c(e.ownerDocument):{},d=s.width||e.clientWidth||p.right-p.left,a=s.height||e.clientHeight||p.bottom-p.top,f=e.offsetWidth-d,h=e.offsetHeight-a;if(f||h){var u=t(e);f-=m(u,'x'),h-=m(u,'y'),p.width-=f,p.height-=h}return g(p)}function b(e,o){var i=2<arguments.length&&void 0!==arguments[2]&&arguments[2],p=r(10),s='HTML'===o.nodeName,d=u(e),a=u(o),l=n(e),m=t(o),h=parseFloat(m.borderTopWidth,10),c=parseFloat(m.borderLeftWidth,10);i&&s&&(a.top=ee(a.top,0),a.left=ee(a.left,0));var b=g({top:d.top-a.top-h,left:d.left-a.left-c,width:d.width,height:d.height});if(b.marginTop=0,b.marginLeft=0,!p&&s){var w=parseFloat(m.marginTop,10),y=parseFloat(m.marginLeft,10);b.top-=h-w,b.bottom-=h-w,b.left-=c-y,b.right-=c-y,b.marginTop=w,b.marginLeft=y}return(p&&!i?o.contains(l):o===l&&'BODY'!==l.nodeName)&&(b=f(b,o)),b}function w(e){var t=1<arguments.length&&void 0!==arguments[1]&&arguments[1],o=e.ownerDocument.documentElement,n=b(e,o),i=ee(o.clientWidth,window.innerWidth||0),r=ee(o.clientHeight,window.innerHeight||0),p=t?0:l(o),s=t?0:l(o,'left'),d={top:p-n.top+n.marginTop,left:s-n.left+n.marginLeft,width:i,height:r};return g(d)}function y(e){var n=e.nodeName;if('BODY'===n||'HTML'===n)return!1;if('fixed'===t(e,'position'))return!0;var i=o(e);return!!i&&y(i)}function E(e){if(!e||!e.parentElement||r())return document.documentElement;for(var o=e.parentElement;o&&'none'===t(o,'transform');)o=o.parentElement;return o||document.documentElement}function v(e,t,i,r){var p=4<arguments.length&&void 0!==arguments[4]&&arguments[4],s={top:0,left:0},d=p?E(e):a(e,t);if('viewport'===r)s=w(d,p);else{var l;'scrollParent'===r?(l=n(o(t)),'BODY'===l.nodeName&&(l=e.ownerDocument.documentElement)):'window'===r?l=e.ownerDocument.documentElement:l=r;var f=b(l,d,p);if('HTML'===l.nodeName&&!y(d)){var m=c(e.ownerDocument),h=m.height,g=m.width;s.top+=f.top-f.marginTop,s.bottom=h+f.top,s.left+=f.left-f.marginLeft,s.right=g+f.left}else s=f}i=i||0;var u='number'==typeof i;return s.left+=u?i:i.left||0,s.top+=u?i:i.top||0,s.right-=u?i:i.right||0,s.bottom-=u?i:i.bottom||0,s}function x(e){var t=e.width,o=e.height;returLine truncated
|
||||
|
||||
/*!
|
||||
* Bootstrap v4.3.1 (https://getbootstrap.com/)
|
||||
* Copyright 2011-2019 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
||||
*/
|
||||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("jquery"),require("popper.js")):"function"==typeof define&&define.amd?define(["exports","jquery","popper.js"],e):e((t=t||self).bootstrap={},t.jQuery,t.Popper)}(this,function(t,g,u){"use strict";function i(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function s(t,e,n){return e&&i(t.prototype,e),n&&i(t,n),t}function l(o){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},e=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(e=e.concat(Object.getOwnPropertySymbols(r).filter(function(t){return Object.getOwnPropertyDescriptor(r,t).enumerable}))),e.forEach(function(t){var e,n,i;e=o,i=r[n=t],n in e?Object.defineProperty(e,n,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[n]=i})}return o}g=g&&g.hasOwnProperty("default")?g.default:g,u=u&&u.hasOwnProperty("default")?u.default:u;var e="transitionend";function n(t){var e=this,n=!1;return g(this).one(_.TRANSITION_END,function(){n=!0}),setTimeout(function(){n||_.triggerTransitionEnd(e)},t),this}var _={TRANSITION_END:"bsTransitionEnd",getUID:function(t){for(;t+=~~(1e6*Math.random()),document.getElementById(t););return t},getSelectorFromElement:function(t){var e=t.getAttribute("data-target");if(!e||"#"===e){var n=t.getAttribute("href");e=n&&"#"!==n?n.trim():""}try{return document.querySelector(e)?e:null}catch(t){return null}},getTransitionDurationFromElement:function(t){if(!t)return 0;var e=g(t).css("transition-duration"),n=g(t).css("transition-delay"),i=parseFloat(e),o=parseFloat(n);return i||o?(e=e.split(",")[0],n=n.split(",")[0],1e3*(parseFloat(e)+parseFloat(n))):0},reflow:function(t){return t.offsetHeight},triggerTransitionEnd:function(t){g(t).trigger(e)},supportsTransitionEnd:function(){return Boolean(e)},isElement:function(t){return(t[0]||t).nodeType},typeCheckConfig:function(t,e,n){for(var i in n)if(Object.prototype.hasOwnProperty.call(n,i)){var o=n[i],r=e[i],s=r&&_.isElement(r)?"element":(a=r,{}.toString.call(a).match(/\s([a-z]+)/i)[1].toLowerCase());if(!new RegExp(o).test(s))throw new Error(t.toUpperCase()+': Option "'+i+'" provided type "'+s+'" but expected type "'+o+'".')}var a},findShadowRoot:function(t){if(!document.documentElement.attachShadow)return null;if("function"!=typeof t.getRootNode)return t instanceof ShadowRoot?t:t.parentNode?_.findShadowRoot(t.parentNode):null;var e=t.getRootNode();return e instanceof ShadowRoot?e:null}};g.fn.emulateTransitionEnd=n,g.event.special[_.TRANSITION_END]={bindType:e,delegateType:e,handle:function(t){if(g(t.target).is(this))return t.handleObj.handler.apply(this,arguments)}};var o="alert",r="bs.alert",a="."+r,c=g.fn[o],h={CLOSE:"close"+a,CLOSED:"closed"+a,CLICK_DATA_API:"click"+a+".data-api"},f="alert",d="fade",m="show",p=function(){function i(t){this._element=t}var t=i.prototype;return t.close=function(t){var e=this._element;t&&(e=this._getRootElement(t)),this._triggerCloseEvent(e).isDefaultPrevented()||this._removeElement(e)},t.dispose=function(){g.removeData(this._element,r),this._element=null},t._getRootElement=function(t){var e=_.getSelectorFromElement(t),n=!1;return e&&(n=document.querySelector(e)),n||(n=g(t).closest("."+f)[0]),n},t._triggerCloseEvent=function(t){var e=g.Event(h.CLOSE);return g(t).trigger(e),e},t._removeElement=function(e){var n=this;if(g(e).removeClass(m),g(e).hasClass(d)){var t=_.getTransitionDurationFromElement(e);g(e).one(_.TRANSITION_END,function(t){return n._destroyElement(e,t)}).emulateTransitionEnd(t)}else this._destroyElement(e)},t._destroyElement=function(t){g(t).detach().trigger(h.CLOSED).remove()},i._jQueryInterface=function(n){return this.each(function(){var t=g(this),e=t.data(r);e||(e=new i(this),t.data(r,e)),"close"===n&&e[n](this)})},i._handleDismiss=function(e){return function(t){t&&t.preventDefault(),e.close(this)}},s(i,null,[{key:"VERSION",get:function(){return"4.3.1"}}]),i}();g(document).on(h.CLICK_DATA_API,'[data-dismiss="alert"]',p._handleDismiss(new p)),g.fn[o]=p._jQueryInterface,g.fn[o].Constructor=p,g.fn[o].noConflict=function(){return g.fn[o]=c,p._jQueryInterface};var v="button",y="bs.button",E="."+y,C=".data-api",T=g.fn[v],S="active",b="btn",I="focus",D='[data-toggle^="button"]',w='[data-toggle="buttons"]',A='input:not([type="hidden"])',N=".active",O=".btn",k={CLICK_DATA_API:"click"+E+C,FOCUS_BLUR_DATA_API:"focus"+E+C+" blur"+E+C},P=function(){function n(t){this._element=t}var t=n.prototype;return t.toggle=function(){var t=!0,e=!0,n=g(this._element).closest(w)[0];if(n){var i=this._element.querySelector(A);if(i){if("radio"===i.type)if(i.checked&&this._element.classList.contains(S))t=!1;else{var o=n.querySelector(N);o&&g(o).removeClass(S)}if(t){if(i.hasAttribute("disabled")||n.hasAttribute("disabled")||i.classList.contains("disabled")||n.classList.contains("disabled"))return;i.checked=!this._element.classList.contains(S),g(i).trigger("cLine truncated
|
||||
|
||||
/*!
|
||||
* perfect-scrollbar v1.4.0
|
||||
* (c) 2018 Hyunje Jun
|
||||
* @license MIT
|
||||
*/
|
||||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.PerfectScrollbar=e()}(this,function(){"use strict";function t(t){return getComputedStyle(t)}function e(t,e){for(var i in e){var r=e[i];"number"==typeof r&&(r+="px"),t.style[i]=r}return t}function i(t){var e=document.createElement("div");return e.className=t,e}function r(t,e){if(!v)throw new Error("No element matching method supported");return v.call(t,e)}function l(t){t.remove?t.remove():t.parentNode&&t.parentNode.removeChild(t)}function n(t,e){return Array.prototype.filter.call(t.children,function(t){return r(t,e)})}function o(t,e){var i=t.element.classList,r=m.state.scrolling(e);i.contains(r)?clearTimeout(Y[e]):i.add(r)}function s(t,e){Y[e]=setTimeout(function(){return t.isAlive&&t.element.classList.remove(m.state.scrolling(e))},t.settings.scrollingThreshold)}function a(t,e){o(t,e),s(t,e)}function c(t){if("function"==typeof window.CustomEvent)return new CustomEvent(t);var e=document.createEvent("CustomEvent");return e.initCustomEvent(t,!1,!1,void 0),e}function h(t,e,i,r,l){var n=i[0],o=i[1],s=i[2],h=i[3],u=i[4],d=i[5];void 0===r&&(r=!0),void 0===l&&(l=!1);var f=t.element;t.reach[h]=null,f[s]<1&&(t.reach[h]="start"),f[s]>t[n]-t[o]-1&&(t.reach[h]="end"),e&&(f.dispatchEvent(c("ps-scroll-"+h)),e<0?f.dispatchEvent(c("ps-scroll-"+u)):e>0&&f.dispatchEvent(c("ps-scroll-"+d)),r&&a(t,h)),t.reach[h]&&(e||l)&&f.dispatchEvent(c("ps-"+h+"-reach-"+t.reach[h]))}function u(t){return parseInt(t,10)||0}function d(t){return r(t,"input,[contenteditable]")||r(t,"select,[contenteditable]")||r(t,"textarea,[contenteditable]")||r(t,"button,[contenteditable]")}function f(e){var i=t(e);return u(i.width)+u(i.paddingLeft)+u(i.paddingRight)+u(i.borderLeftWidth)+u(i.borderRightWidth)}function p(t,e){return t.settings.minScrollbarLength&&(e=Math.max(e,t.settings.minScrollbarLength)),t.settings.maxScrollbarLength&&(e=Math.min(e,t.settings.maxScrollbarLength)),e}function b(t,i){var r={width:i.railXWidth},l=Math.floor(t.scrollTop);i.isRtl?r.left=i.negativeScrollAdjustment+t.scrollLeft+i.containerWidth-i.contentWidth:r.left=t.scrollLeft,i.isScrollbarXUsingBottom?r.bottom=i.scrollbarXBottom-l:r.top=i.scrollbarXTop+l,e(i.scrollbarXRail,r);var n={top:l,height:i.railYHeight};i.isScrollbarYUsingRight?i.isRtl?n.right=i.contentWidth-(i.negativeScrollAdjustment+t.scrollLeft)-i.scrollbarYRight-i.scrollbarYOuterWidth:n.right=i.scrollbarYRight-t.scrollLeft:i.isRtl?n.left=i.negativeScrollAdjustment+t.scrollLeft+2*i.containerWidth-i.contentWidth-i.scrollbarYLeft-i.scrollbarYOuterWidth:n.left=i.scrollbarYLeft+t.scrollLeft,e(i.scrollbarYRail,n),e(i.scrollbarX,{left:i.scrollbarXLeft,width:i.scrollbarXWidth-i.railBorderXWidth}),e(i.scrollbarY,{top:i.scrollbarYTop,height:i.scrollbarYHeight-i.railBorderYWidth})}function g(t,e){function i(e){b[d]=g+Y*(e[a]-v),o(t,f),R(t),e.stopPropagation(),e.preventDefault()}function r(){s(t,f),t[p].classList.remove(m.state.clicking),t.event.unbind(t.ownerDocument,"mousemove",i)}var l=e[0],n=e[1],a=e[2],c=e[3],h=e[4],u=e[5],d=e[6],f=e[7],p=e[8],b=t.element,g=null,v=null,Y=null;t.event.bind(t[h],"mousedown",function(e){g=b[d],v=e[a],Y=(t[n]-t[l])/(t[c]-t[u]),t.event.bind(t.ownerDocument,"mousemove",i),t.event.once(t.ownerDocument,"mouseup",r),t[p].classList.add(m.state.clicking),e.stopPropagation(),e.preventDefault()})}var v="undefined"!=typeof Element&&(Element.prototype.matches||Element.prototype.webkitMatchesSelector||Element.prototype.mozMatchesSelector||Element.prototype.msMatchesSelector),m={main:"ps",element:{thumb:function(t){return"ps__thumb-"+t},rail:function(t){return"ps__rail-"+t},consuming:"ps__child--consume"},state:{focus:"ps--focus",clicking:"ps--clicking",active:function(t){return"ps--active-"+t},scrolling:function(t){return"ps--scrolling-"+t}}},Y={x:null,y:null},X=function(t){this.element=t,this.handlers={}},w={isEmpty:{configurable:!0}};X.prototype.bind=function(t,e){void 0===this.handlers[t]&&(this.handlers[t]=[]),this.handlers[t].push(e),this.element.addEventListener(t,e,!1)},X.prototype.unbind=function(t,e){var i=this;this.handlers[t]=this.handlers[t].filter(function(r){return!(!e||r===e)||(i.element.removeEventListener(t,r,!1),!1)})},X.prototype.unbindAll=function(){var t=this;for(var e in t.handlers)t.unbind(e)},w.isEmpty.get=function(){var t=this;return Object.keys(this.handlers).every(function(e){return 0===t.handlers[e].length})},Object.defineProperties(X.prototype,w);var y=function(){this.eventElements=[]};y.prototype.eventElement=function(t){var e=this.eventElements.filter(function(e){return e.element===t})[0];return e||(e=new X(t),this.eventElements.push(e)),e},y.prototype.bind=function(t,e,i){this.eventElement(t).bind(e,i)},y.prototype.unbind=function(t,e,i){var r=this.eventElement(t);r.unbind(e,i),r.isEmpty&&this.eventElements.splice(this.eventElements.indexOf(r),1)},y.prototype.unbindAll=function(){this.eventElements.forEach(function(t){return t.unbindAll()}),Line truncated
|
||||
|
||||
/*! Hammer.JS - v2.0.8 - 2016-04-23
|
||||
* http://hammerjs.github.io/
|
||||
*
|
||||
* Copyright (c) 2016 Jorik Tangelder;
|
||||
* Licensed under the MIT license */
|
||||
!function(a,b,c,d){"use strict";function e(a,b,c){return setTimeout(j(a,c),b)}function f(a,b,c){return Array.isArray(a)?(g(a,c[b],c),!0):!1}function g(a,b,c){var e;if(a)if(a.forEach)a.forEach(b,c);else if(a.length!==d)for(e=0;e<a.length;)b.call(c,a[e],e,a),e++;else for(e in a)a.hasOwnProperty(e)&&b.call(c,a[e],e,a)}function h(b,c,d){var e="DEPRECATED METHOD: "+c+"\n"+d+" AT \n";return function(){var c=new Error("get-stack-trace"),d=c&&c.stack?c.stack.replace(/^[^\(]+?[\n$]/gm,"").replace(/^\s+at\s+/gm,"").replace(/^Object.<anonymous>\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",f=a.console&&(a.console.warn||a.console.log);return f&&f.call(a.console,e,d),b.apply(this,arguments)}}function i(a,b,c){var d,e=b.prototype;d=a.prototype=Object.create(e),d.constructor=a,d._super=e,c&&la(d,c)}function j(a,b){return function(){return a.apply(b,arguments)}}function k(a,b){return typeof a==oa?a.apply(b?b[0]||d:d,b):a}function l(a,b){return a===d?b:a}function m(a,b,c){g(q(b),function(b){a.addEventListener(b,c,!1)})}function n(a,b,c){g(q(b),function(b){a.removeEventListener(b,c,!1)})}function o(a,b){for(;a;){if(a==b)return!0;a=a.parentNode}return!1}function p(a,b){return a.indexOf(b)>-1}function q(a){return a.trim().split(/\s+/g)}function r(a,b,c){if(a.indexOf&&!c)return a.indexOf(b);for(var d=0;d<a.length;){if(c&&a[d][c]==b||!c&&a[d]===b)return d;d++}return-1}function s(a){return Array.prototype.slice.call(a,0)}function t(a,b,c){for(var d=[],e=[],f=0;f<a.length;){var g=b?a[f][b]:a[f];r(e,g)<0&&d.push(a[f]),e[f]=g,f++}return c&&(d=b?d.sort(function(a,c){return a[b]>c[b]}):d.sort()),d}function u(a,b){for(var c,e,f=b[0].toUpperCase()+b.slice(1),g=0;g<ma.length;){if(c=ma[g],e=c?c+f:b,e in a)return e;g++}return d}function v(){return ua++}function w(b){var c=b.ownerDocument||b;return c.defaultView||c.parentWindow||a}function x(a,b){var c=this;this.manager=a,this.callback=b,this.element=a.element,this.target=a.options.inputTarget,this.domHandler=function(b){k(a.options.enable,[a])&&c.handler(b)},this.init()}function y(a){var b,c=a.options.inputClass;return new(b=c?c:xa?M:ya?P:wa?R:L)(a,z)}function z(a,b,c){var d=c.pointers.length,e=c.changedPointers.length,f=b&Ea&&d-e===0,g=b&(Ga|Ha)&&d-e===0;c.isFirst=!!f,c.isFinal=!!g,f&&(a.session={}),c.eventType=b,A(a,c),a.emit("hammer.input",c),a.recognize(c),a.session.prevInput=c}function A(a,b){var c=a.session,d=b.pointers,e=d.length;c.firstInput||(c.firstInput=D(b)),e>1&&!c.firstMultiple?c.firstMultiple=D(b):1===e&&(c.firstMultiple=!1);var f=c.firstInput,g=c.firstMultiple,h=g?g.center:f.center,i=b.center=E(d);b.timeStamp=ra(),b.deltaTime=b.timeStamp-f.timeStamp,b.angle=I(h,i),b.distance=H(h,i),B(c,b),b.offsetDirection=G(b.deltaX,b.deltaY);var j=F(b.deltaTime,b.deltaX,b.deltaY);b.overallVelocityX=j.x,b.overallVelocityY=j.y,b.overallVelocity=qa(j.x)>qa(j.y)?j.x:j.y,b.scale=g?K(g.pointers,d):1,b.rotation=g?J(g.pointers,d):0,b.maxPointers=c.prevInput?b.pointers.length>c.prevInput.maxPointers?b.pointers.length:c.prevInput.maxPointers:b.pointers.length,C(c,b);var k=a.element;o(b.srcEvent.target,k)&&(k=b.srcEvent.target),b.target=k}function B(a,b){var c=b.center,d=a.offsetDelta||{},e=a.prevDelta||{},f=a.prevInput||{};b.eventType!==Ea&&f.eventType!==Ga||(e=a.prevDelta={x:f.deltaX||0,y:f.deltaY||0},d=a.offsetDelta={x:c.x,y:c.y}),b.deltaX=e.x+(c.x-d.x),b.deltaY=e.y+(c.y-d.y)}function C(a,b){var c,e,f,g,h=a.lastInterval||b,i=b.timeStamp-h.timeStamp;if(b.eventType!=Ha&&(i>Da||h.velocity===d)){var j=b.deltaX-h.deltaX,k=b.deltaY-h.deltaY,l=F(i,j,k);e=l.x,f=l.y,c=qa(l.x)>qa(l.y)?l.x:l.y,g=G(j,k),a.lastInterval=b}else c=h.velocity,e=h.velocityX,f=h.velocityY,g=h.direction;b.velocity=c,b.velocityX=e,b.velocityY=f,b.direction=g}function D(a){for(var b=[],c=0;c<a.pointers.length;)b[c]={clientX:pa(a.pointers[c].clientX),clientY:pa(a.pointers[c].clientY)},c++;return{timeStamp:ra(),pointers:b,center:E(b),deltaX:a.deltaX,deltaY:a.deltaY}}function E(a){var b=a.length;if(1===b)return{x:pa(a[0].clientX),y:pa(a[0].clientY)};for(var c=0,d=0,e=0;b>e;)c+=a[e].clientX,d+=a[e].clientY,e++;return{x:pa(c/b),y:pa(d/b)}}function F(a,b,c){return{x:b/a||0,y:c/a||0}}function G(a,b){return a===b?Ia:qa(a)>=qa(b)?0>a?Ja:Ka:0>b?La:Ma}function H(a,b,c){c||(c=Qa);var d=b[c[0]]-a[c[0]],e=b[c[1]]-a[c[1]];return Math.sqrt(d*d+e*e)}function I(a,b,c){c||(c=Qa);var d=b[c[0]]-a[c[0]],e=b[c[1]]-a[c[1]];return 180*Math.atan2(e,d)/Math.PI}function J(a,b){return I(b[1],b[0],Ra)+I(a[1],a[0],Ra)}function K(a,b){return H(b[0],b[1],Ra)/H(a[0],a[1],Ra)}function L(){this.evEl=Ta,this.evWin=Ua,this.pressed=!1,x.apply(this,arguments)}function M(){this.evEl=Xa,this.evWin=Ya,x.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}function N(){this.evTarget=$a,this.evWin=_a,this.started=!1,x.apply(this,arguments)}function O(a,b){var c=s(a.touches),d=s(a.changedTouches);return b&(Ga|Ha)&&(c=t(c.concat(d),"identifier",!0)),[c,d]}function P(){this.evTarget=bb,this.targetIds={},x.apply(this,arguments)}function Q(a,b){var c=s(a.touches)Line truncated
|
||||
|
||||
// Waves
|
||||
|
||||
!function(t,e){"use strict";"function"==typeof define&&define.amd?define([],function(){return t.Waves=e.call(t),t.Waves}):"object"==typeof exports?module.exports=e.call(t):t.Waves=e.call(t)}("object"==typeof global?global:this,function(){"use strict";function t(t){return null!==t&&t===t.window}function e(e){return t(e)?e:9===e.nodeType&&e.defaultView}function n(t){var e=typeof t;return"function"===e||"object"===e&&!!t}function o(t){return n(t)&&t.nodeType>0}function a(t){var e=f.call(t);return"[object String]"===e?d(t):n(t)&&/^\[object (Array|HTMLCollection|NodeList|Object)\]$/.test(e)&&t.hasOwnProperty("length")?t:o(t)?[t]:[]}function i(t){var n,o,a={top:0,left:0},i=t&&t.ownerDocument;return n=i.documentElement,void 0!==t.getBoundingClientRect&&(a=t.getBoundingClientRect()),o=e(i),{top:a.top+o.pageYOffset-n.clientTop,left:a.left+o.pageXOffset-n.clientLeft}}function r(t){var e="";for(var n in t)t.hasOwnProperty(n)&&(e+=n+":"+t[n]+";");return e}function s(t,e,n){if(n){n.classList.remove("waves-rippling");var o=n.getAttribute("data-x"),a=n.getAttribute("data-y"),i=n.getAttribute("data-scale"),s=n.getAttribute("data-translate"),u=350-(Date.now()-Number(n.getAttribute("data-hold")));u<0&&(u=0),"mousemove"===t.type&&(u=150);var c="mousemove"===t.type?2500:v.duration;setTimeout(function(){var t={top:a+"px",left:o+"px",opacity:"0","-webkit-transition-duration":c+"ms","-moz-transition-duration":c+"ms","-o-transition-duration":c+"ms","transition-duration":c+"ms","-webkit-transform":i+" "+s,"-moz-transform":i+" "+s,"-ms-transform":i+" "+s,"-o-transform":i+" "+s,transform:i+" "+s};n.setAttribute("style",r(t)),setTimeout(function(){try{e.removeChild(n)}catch(t){return!1}},c)},u)}}function u(t){if(!1===h.allowEvent(t))return null;for(var e=null,n=t.target||t.srcElement;n.parentElement;){if(!(n instanceof SVGElement)&&n.classList.contains("waves-effect")){e=n;break}n=n.parentElement}return e}function c(t){var e=u(t);if(null!==e){if(e.disabled||e.getAttribute("disabled")||e.classList.contains("disabled"))return;if(h.registerEvent(t),"touchstart"===t.type&&v.delay){var n=!1,o=setTimeout(function(){o=null,v.show(t,e)},v.delay),a=function(a){o&&(clearTimeout(o),o=null,v.show(t,e)),n||(n=!0,v.hide(a,e)),r()},i=function(t){o&&(clearTimeout(o),o=null),a(t),r()};e.addEventListener("touchmove",i,!1),e.addEventListener("touchend",a,!1),e.addEventListener("touchcancel",a,!1);var r=function(){e.removeEventListener("touchmove",i),e.removeEventListener("touchend",a),e.removeEventListener("touchcancel",a)}}else v.show(t,e),m&&(e.addEventListener("touchend",v.hide,!1),e.addEventListener("touchcancel",v.hide,!1)),e.addEventListener("mouseup",v.hide,!1),e.addEventListener("mouseleave",v.hide,!1)}}var l=l||{},d=document.querySelectorAll.bind(document),f=Object.prototype.toString,m="ontouchstart"in window,v={duration:750,delay:200,show:function(t,e,n){if(2===t.button)return!1;e=e||this;var o=document.createElement("div");o.className="waves-ripple waves-rippling",e.appendChild(o);var a=i(e),s=0,u=0;"touches"in t&&t.touches.length?(s=t.touches[0].pageY-a.top,u=t.touches[0].pageX-a.left):(s=t.pageY-a.top,u=t.pageX-a.left),u=u>=0?u:0,s=s>=0?s:0;var c="scale("+e.clientWidth/100*3+")",l="translate(0,0)";n&&(l="translate("+n.x+"px, "+n.y+"px)"),o.setAttribute("data-hold",Date.now()),o.setAttribute("data-x",u),o.setAttribute("data-y",s),o.setAttribute("data-scale",c),o.setAttribute("data-translate",l);var d={top:s+"px",left:u+"px"};o.classList.add("waves-notransition"),o.setAttribute("style",r(d)),o.classList.remove("waves-notransition"),d["-webkit-transform"]=c+" "+l,d["-moz-transform"]=c+" "+l,d["-ms-transform"]=c+" "+l,d["-o-transform"]=c+" "+l,d.transform=c+" "+l,d.opacity="1";var f="mousemove"===t.type?2500:v.duration;d["-webkit-transition-duration"]=f+"ms",d["-moz-transition-duration"]=f+"ms",d["-o-transition-duration"]=f+"ms",d["transition-duration"]=f+"ms",o.setAttribute("style",r(d))},hide:function(t,e){for(var n=(e=e||this).getElementsByClassName("waves-rippling"),o=0,a=n.length;o<a;o++)s(t,e,n[o]);m&&(e.removeEventListener("touchend",v.hide),e.removeEventListener("touchcancel",v.hide)),e.removeEventListener("mouseup",v.hide),e.removeEventListener("mouseleave",v.hide)}},p={input:function(t){var e=t.parentNode;if("i"!==e.tagName.toLowerCase()||!e.classList.contains("waves-effect")){var n=document.createElement("i");n.className=t.className+" waves-input-wrapper",t.className="waves-button-input",e.replaceChild(n,t),n.appendChild(t);var o=window.getComputedStyle(t,null),a=o.color,i=o.backgroundColor;n.setAttribute("style","color:"+a+";background:"+i),t.setAttribute("style","background-color:rgba(0,0,0,0);")}},img:function(t){var e=t.parentNode;if("i"!==e.tagName.toLowerCase()||!e.classList.contains("waves-effect")){var n=document.createElement("i");e.replaceChild(n,t),n.appendChild(t)}}},h={touches:0,allowEvent:function(t){var e=!0;return/^(mousedown|mousemove)$/.test(t.type)&&h.touches&&(e=!1),e},registerEvent:function(t){var e=t.type;"toucLine truncated
|
||||
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
// Spring uses the original FUC cyan stylesheet; other seasons rotate its hues only.
|
||||
export function rotateColor(hex,degrees=0){
|
||||
const [r,g,b]=hex.slice(1).match(/../g).map(c=>parseInt(c,16)/255),max=Math.max(r,g,b),min=Math.min(r,g,b),d=max-min,l=(max+min)/2;
|
||||
if(!d)return hex;
|
||||
const s=d/(1-Math.abs(2*l-1));let h=max===r?((g-b)/d)%6:max===g?(b-r)/d+2:(r-g)/d+4;
|
||||
h=((h*60+degrees)%360+360)%360;const c=(1-Math.abs(2*l-1))*s,x=c*(1-Math.abs((h/60)%2-1)),m=l-c/2;
|
||||
const rgb=h<60?[c,x,0]:h<120?[x,c,0]:h<180?[0,c,x]:h<240?[0,x,c]:h<300?[x,0,c]:[c,0,x];
|
||||
return '#'+rgb.map(v=>Math.round((v+m)*255).toString(16).padStart(2,'0')).join('');
|
||||
}
|
||||
const season=(label,rotation)=>({label,rotation,native:'cyan',primary:rotateColor('#52cfbc',rotation),button:rotateColor('#5ed2c0',rotation),deep:rotateColor('#47ccb7',rotation),bright:rotateColor('#71d7c7',rotation),tint:rotateColor('#ebfaf7',rotation),logo:`hue-rotate(${290+rotation}deg)`});
|
||||
export const palettes=Object.freeze({
|
||||
purple:{label:'紫色',primary:'#6200ee',native:'purple'},
|
||||
spring:season('春 · 原版绿色',0),
|
||||
summer:season('夏 · 晴空蓝',30),
|
||||
autumn:season('秋 · 杏叶橙',222),
|
||||
winter:season('冬 · 冰川蓝',65)
|
||||
});
|
||||
export function getPalette(storage=localStorage){const id=storage.getItem('fuc_themeLight');return id==='cyan'?'spring':Object.hasOwn(palettes,id)?id:'purple';}
|
||||
export function nativePalette(storage=localStorage){return palettes[getPalette(storage)].native;}
|
||||
export function applyPalette(doc=document,storage=localStorage){
|
||||
const id=getPalette(storage),palette=palettes[id],root=doc.documentElement;
|
||||
root.dataset.fucPalette=id;
|
||||
for(const key of Array.from(root.style))if(key.startsWith('--season-'))root.style.removeProperty(key);
|
||||
delete root.dataset.fucSeason;
|
||||
if(palette.rotation===undefined)return id;
|
||||
// The spring light user area keeps its original stylesheet; dark/public accents are extended.
|
||||
if(id!=='spring')root.dataset.fucSeason=id;
|
||||
for(const key of ['primary','deep','bright','tint','logo'])root.style.setProperty('--season-'+key,palette[key]);
|
||||
root.style.setProperty('--season-rgb',palette.primary.slice(1).match(/../g).map(c=>parseInt(c,16)).join(', '));
|
||||
return id;
|
||||
}
|
||||
export function chartColors(storage=localStorage){const id=getPalette(storage);return [id==='purple'||id==='spring'?'#7D72F1':palettes[id].primary,'#FF9F43','#EA5455'];}
|
||||
export function paintPaletteOptions(root,storage=localStorage){
|
||||
const select=root.querySelector('#themeLight');if(!select)return;
|
||||
select.innerHTML=Object.entries(palettes).map(([value,p])=>`<option value="${value}"${value===getPalette(storage)?' selected':''}>${p.label}</option>`).join('');select.value=getPalette(storage);
|
||||
const label=[...select.parentElement.childNodes].find(n=>n.nodeType===3&&n.textContent.trim());if(label)label.textContent='配色主题:';
|
||||
const oldDark=root.querySelector('#themeDark')?.closest('.form-group');
|
||||
if(oldDark){oldDark.classList.add('season-palette-options');oldDark.innerHTML='<p class="text-muted mb-1">春季沿用原版绿色,其余三季延续同样的清亮色阶。</p><div class="d-flex flex-wrap">'+Object.entries(palettes).filter(([,p])=>p.rotation!==undefined).map(([id,p])=>`<span class="mr-2 mb-1"><i class="season-swatch" style="background:${p.primary}" aria-hidden="true"></i>${p.label}</span>`).join('')+'</div>';}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
import {paymentResult,safeUrl} from './core.mjs?v=0.12.0';
|
||||
import QRCode from './vendor/qrcode.mjs?v=0.12.0';
|
||||
import {loadScript} from './captcha.mjs?v=0.12.0';
|
||||
export async function mountCard(api,id,container) {
|
||||
const key=await api('user/comm/getStripePublicKey',{id});
|
||||
if(typeof key!=='string'||!key.startsWith('pk_'))throw Error('银行卡支付未配置有效公钥');
|
||||
await loadScript('https://js.stripe.com/v3/');
|
||||
if(!container.isConnected)return null;
|
||||
const stripe=window.Stripe(key),card=stripe.elements().create('card');card.mount(container);
|
||||
return {async token(){const result=await stripe.createToken(card);if(result.error)throw Error(result.error.message);if(!result.token?.id)throw Error('银行卡验证失败');return result.token.id;},dispose(){card.destroy();}};
|
||||
}
|
||||
// Only copy a payment provider's form fields. Never execute response HTML/scripts.
|
||||
export function paymentForm(html) {
|
||||
const source=new DOMParser().parseFromString(html,'text/html').querySelector('form');
|
||||
const raw=source?.getAttribute('action')||'';
|
||||
const action=/^https?:\/\//i.test(raw)?safeUrl(raw):'';
|
||||
if(!source||!action)throw Error('支付表单缺少有效地址');
|
||||
const form=document.createElement('form');form.action=action;form.method=source.method==='get'?'get':'post';
|
||||
form.target='_blank';form.rel='noopener noreferrer';
|
||||
source.querySelectorAll('input[name]').forEach(input=>{if(input.disabled||['button','submit','file','reset'].includes(input.type))return;const field=document.createElement('input');field.type='hidden';field.name=input.name;field.value=input.value;form.append(field);});
|
||||
const button=document.createElement('button');button.type='submit';button.className='btn btn-primary';button.textContent='前往支付页面';form.append(button);return form;
|
||||
}
|
||||
export async function showPayment(result,container) {
|
||||
const payment=paymentResult(result);container.replaceChildren();
|
||||
if(payment.kind==='complete')return true;
|
||||
if(payment.kind==='qr'){
|
||||
const img=document.createElement('img');img.src=await QRCode.toDataURL(payment.value,{width:256,margin:2});img.alt='订单支付二维码';img.width=256;img.height=256;container.append(img);
|
||||
}else if(payment.kind==='url'){
|
||||
const a=document.createElement('a');a.href=payment.value;a.target='_blank';a.rel='noopener noreferrer';a.className='btn btn-primary';a.textContent='前往支付页面';container.append(a);
|
||||
}else container.append(paymentForm(payment.value));
|
||||
const note=document.createElement('p');note.textContent='付款后请刷新订单状态。以订单开通结果为准,请勿重复付款。';container.append(note);return false;
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
import {safeUrl} from './core.mjs?v=0.12.0';
|
||||
|
||||
// Use XB's public subscription filters; do not invent per-format backend routes.
|
||||
export function subscriptionUrl(raw,client='general') {
|
||||
const safe=safeUrl(raw);if(!safe)throw Error('没有有效的订阅链接');
|
||||
const url=new URL(safe);
|
||||
const flags={shadowrocket:'general',trojan:'general',meta:'meta',hiddify:'hiddify','sing-box':'sing-box',shadowsocks:'shadowsocks',general:'general'};
|
||||
if(!Object.hasOwn(flags,client))throw Error('不支持的订阅格式');
|
||||
url.searchParams.set('flag',flags[client]);
|
||||
if(client==='trojan')url.searchParams.set('types','trojan');
|
||||
return url.href;
|
||||
}
|
||||
export function importUrl(raw,client,title='Fuc') {
|
||||
const url=subscriptionUrl(raw,client),name=encodeURIComponent(title);
|
||||
if(client==='shadowrocket')return 'shadowrocket://add/sub://'+btoa(url);
|
||||
if(client==='hiddify')return `hiddify://import/${url}#${name}`;
|
||||
if(client==='sing-box')return `sing-box://import-remote-profile?url=${encodeURIComponent(url)}#${name}`;
|
||||
if(client==='meta')return `clash://install-config?url=${encodeURIComponent(url)}&name=${name}`;
|
||||
throw Error('此客户端不支持一键导入');
|
||||
}
|
||||
+202
@@ -0,0 +1,202 @@
|
||||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"versions": {
|
||||
"esbuild": "0.25.12",
|
||||
"qrcode": "1.5.4",
|
||||
"marked": "15.0.12",
|
||||
"dompurify": "3.4.17"
|
||||
},
|
||||
"sha256": {
|
||||
"qrcode.mjs": "2a06a160c79488722dc37ee98602caef44495947d4a63e6f7a49c2e44d5fc81b",
|
||||
"richtext.mjs": "5983262ee06c73fbd67fd014dcf28765d06bdfdbd7f3709fac5da87bf3cc8c6c"
|
||||
}
|
||||
}
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
# License information
|
||||
|
||||
## Contribution License Agreement
|
||||
|
||||
If you contribute code to this project, you are implicitly allowing your code
|
||||
to be distributed under the MIT license. You are also implicitly verifying that
|
||||
all code is your original work. `</legalese>`
|
||||
|
||||
## Marked
|
||||
|
||||
Copyright (c) 2018+, MarkedJS (https://github.com/markedjs/)
|
||||
Copyright (c) 2011-2018, Christopher Jeffrey (https://github.com/chjj/)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
## Markdown
|
||||
|
||||
Copyright © 2004, John Gruber
|
||||
http://daringfireball.net/
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
* Neither the name “Markdown” nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
||||
|
||||
This software is provided by the copyright holders and contributors “as is” and any express or implied warranties, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose are disclaimed. In no event shall the copyright owner or contributors be liable for any direct, indirect, incidental, special, exemplary, or consequential damages (including, but not limited to, procurement of substitute goods or services; loss of use, data, or profits; or business interruption) however caused and on any theory of liability, whether in contract, strict liability, or tort (including negligence or otherwise) arising in any way out of the use of this software, even if advised of the possibility of such damage.
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2012 Ryan Day
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
Vendored
+8
@@ -0,0 +1,8 @@
|
||||
var xe=Object.create;var Lt=Object.defineProperty;var Ue=Object.getOwnPropertyDescriptor;var qe=Object.getOwnPropertyNames;var De=Object.getPrototypeOf,Fe=Object.prototype.hasOwnProperty;var g=(n,t)=>()=>(t||n((t={exports:{}}).exports,t),t.exports);var ke=(n,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of qe(t))!Fe.call(n,o)&&o!==e&&Lt(n,o,{get:()=>t[o],enumerable:!(r=Ue(t,o))||r.enumerable});return n};var ze=(n,t,e)=>(e=n!=null?xe(De(n)):{},ke(t||!n||!n.__esModule?Lt(e,"default",{value:n,enumerable:!0}):e,n));var xt=g((Dn,_t)=>{_t.exports=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then}});var I=g(P=>{var st,Ve=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];P.getSymbolSize=function(t){if(!t)throw new Error('"version" cannot be null or undefined');if(t<1||t>40)throw new Error('"version" should be in range from 1 to 40');return t*4+17};P.getSymbolTotalCodewords=function(t){return Ve[t]};P.getBCHDigit=function(n){let t=0;for(;n!==0;)t++,n>>>=1;return t};P.setToSJISFunction=function(t){if(typeof t!="function")throw new Error('"toSJISFunc" is not a valid function.');st=t};P.isKanjiModeEnabled=function(){return typeof st<"u"};P.toSJIS=function(t){return st(t)}});var j=g(m=>{m.L={bit:1};m.M={bit:0};m.Q={bit:3};m.H={bit:2};function He(n){if(typeof n!="string")throw new Error("Param is not a string");switch(n.toLowerCase()){case"l":case"low":return m.L;case"m":case"medium":return m.M;case"q":case"quartile":return m.Q;case"h":case"high":return m.H;default:throw new Error("Unknown EC Level: "+n)}}m.isValid=function(t){return t&&typeof t.bit<"u"&&t.bit>=0&&t.bit<4};m.from=function(t,e){if(m.isValid(t))return t;try{return He(t)}catch{return e}}});var Dt=g((zn,qt)=>{function Ut(){this.buffer=[],this.length=0}Ut.prototype={get:function(n){let t=Math.floor(n/8);return(this.buffer[t]>>>7-n%8&1)===1},put:function(n,t){for(let e=0;e<t;e++)this.putBit((n>>>t-e-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(n){let t=Math.floor(this.length/8);this.buffer.length<=t&&this.buffer.push(0),n&&(this.buffer[t]|=128>>>this.length%8),this.length++}};qt.exports=Ut});var kt=g((Vn,Ft)=>{function k(n){if(!n||n<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=n,this.data=new Uint8Array(n*n),this.reservedBit=new Uint8Array(n*n)}k.prototype.set=function(n,t,e,r){let o=n*this.size+t;this.data[o]=e,r&&(this.reservedBit[o]=!0)};k.prototype.get=function(n,t){return this.data[n*this.size+t]};k.prototype.xor=function(n,t,e){this.data[n*this.size+t]^=e};k.prototype.isReserved=function(n,t){return this.reservedBit[n*this.size+t]};Ft.exports=k});var zt=g(G=>{var Ke=I().getSymbolSize;G.getRowColCoords=function(t){if(t===1)return[];let e=Math.floor(t/7)+2,r=Ke(t),o=r===145?26:Math.ceil((r-13)/(2*e-2))*2,i=[r-7];for(let s=1;s<e-1;s++)i[s]=i[s-1]-o;return i.push(6),i.reverse()};G.getPositions=function(t){let e=[],r=G.getRowColCoords(t),o=r.length;for(let i=0;i<o;i++)for(let s=0;s<o;s++)i===0&&s===0||i===0&&s===o-1||i===o-1&&s===0||e.push([r[i],r[s]]);return e}});var Kt=g(Ht=>{var Je=I().getSymbolSize,Vt=7;Ht.getPositions=function(t){let e=Je(t);return[[0,0],[e-Vt,0],[0,e-Vt]]}});var Jt=g(d=>{d.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};var b={N1:3,N2:3,N3:40,N4:10};d.isValid=function(t){return t!=null&&t!==""&&!isNaN(t)&&t>=0&&t<=7};d.from=function(t){return d.isValid(t)?parseInt(t,10):void 0};d.getPenaltyN1=function(t){let e=t.size,r=0,o=0,i=0,s=null,u=null;for(let c=0;c<e;c++){o=i=0,s=u=null;for(let l=0;l<e;l++){let a=t.get(c,l);a===s?o++:(o>=5&&(r+=b.N1+(o-5)),s=a,o=1),a=t.get(l,c),a===u?i++:(i>=5&&(r+=b.N1+(i-5)),u=a,i=1)}o>=5&&(r+=b.N1+(o-5)),i>=5&&(r+=b.N1+(i-5))}return r};d.getPenaltyN2=function(t){let e=t.size,r=0;for(let o=0;o<e-1;o++)for(let i=0;i<e-1;i++){let s=t.get(o,i)+t.get(o,i+1)+t.get(o+1,i)+t.get(o+1,i+1);(s===4||s===0)&&r++}return r*b.N2};d.getPenaltyN3=function(t){let e=t.size,r=0,o=0,i=0;for(let s=0;s<e;s++){o=i=0;for(let u=0;u<e;u++)o=o<<1&2047|t.get(s,u),u>=10&&(o===1488||o===93)&&r++,i=i<<1&2047|t.get(u,s),u>=10&&(i===1488||i===93)&&r++}return r*b.N3};d.getPenaltyN4=function(t){let e=0,r=t.data.length;for(let i=0;i<r;i++)e+=t.data[i];return Math.abs(Math.ceil(e*100/r/5)-10)*b.N4};function Ye(n,t,e){switch(n){case d.Patterns.PATTERN000:return(t+e)%2===0;case d.Patterns.PATTERN001:return t%2===0;case d.Patterns.PATTERN010:return e%3===0;case d.Patterns.PATTERN011:return(t+e)%3===0;case d.Patterns.PATTERN100:return(Math.floor(t/2)+Math.floor(e/3))%2===0;case d.Patterns.PATTERN101:return t*e%2+t*e%3===0;case d.Patterns.PATTERN110:return(t*e%2+t*e%3)%2===0;case d.Patterns.PATTERN111:return(t*e%3+(t+e)%2)%2===0;default:throw new Error("bad maskPattern:"+n)}}d.applyMask=function(t,e){let r=e.size;for(let o=0;o<r;o++)foLine truncated
|
||||
]))+`;B.KANJI=new RegExp(H,"g");B.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g");B.BYTE=new RegExp(je,"g");B.NUMERIC=new RegExp(Wt,"g");B.ALPHANUMERIC=new RegExp(Oe,"g");var Ge=new RegExp("^"+H+"$"),Qe=new RegExp("^"+Wt+"$"),$e=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");B.testKanji=function(t){return Ge.test(t)};B.testNumeric=function(t){return Qe.test(t)};B.testAlphanumeric=function(t){return $e.test(t)}});var M=g(p=>{var We=ft(),dt=gt();p.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]};p.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]};p.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]};p.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]};p.MIXED={bit:-1};p.getCharCountIndicator=function(t,e){if(!t.ccBits)throw new Error("Invalid mode: "+t);if(!We.isValid(e))throw new Error("Invalid version: "+e);return e>=1&&e<10?t.ccBits[0]:e<27?t.ccBits[1]:t.ccBits[2]};p.getBestModeForData=function(t){return dt.testNumeric(t)?p.NUMERIC:dt.testAlphanumeric(t)?p.ALPHANUMERIC:dt.testKanji(t)?p.KANJI:p.BYTE};p.toString=function(t){if(t&&t.id)return t.id;throw new Error("Invalid mode")};p.isValid=function(t){return t&&t.bit&&t.ccBits};function Ze(n){if(typeof n!="string")throw new Error("Param is not a string");switch(n.toLowerCase()){case"numeric":return p.NUMERIC;case"alphanumeric":return p.ALPHANUMERIC;case"kanji":return p.KANJI;case"byte":return p.BYTE;default:throw new Error("Unknown mode: "+n)}}p.from=function(t,e){if(p.isValid(t))return t;try{return Ze(t)}catch{return e}}});var ee=g(R=>{var X=I(),Xe=ct(),Zt=j(),S=M(),ht=ft(),vt=7973,Xt=X.getBCHDigit(vt);function ve(n,t,e){for(let r=1;r<=40;r++)if(t<=R.getCapacity(r,e,n))return r}function te(n,t){return S.getCharCountIndicator(n,t)+4}function tn(n,t){let e=0;return n.forEach(function(r){let o=te(r.mode,t);e+=o+r.getBitsLength()}),e}function en(n,t){for(let e=1;e<=40;e++)if(tn(n,e)<=R.getCapacity(e,t,S.MIXED))return e}R.from=function(t,e){return ht.isValid(t)?parseInt(t,10):e};R.getCapacity=function(t,e,r){if(!ht.isValid(t))throw new Error("Invalid QR Code version");typeof r>"u"&&(r=S.BYTE);let o=X.getSymbolTotalCodewords(t),i=Xe.getTotalCodewordsCount(t,e),s=(o-i)*8;if(r===S.MIXED)return s;let u=s-te(r,t);switch(r){case S.NUMERIC:return Math.floor(u/10*3);case S.ALPHANUMERIC:return Math.floor(u/11*2);case S.KANJI:return Math.floor(u/13);case S.BYTE:default:return Math.floor(u/8)}};R.getBestVersionForData=function(t,e){let r,o=Zt.from(e,Zt.M);if(Array.isArray(t)){if(t.length>1)return en(t,o);if(t.length===0)return 1;r=t[0]}else r=t;return ve(r.mode,r.getLength(),o)};R.getEncodedBits=function(t){if(!ht.isValid(t)||t<7)throw new Error("Invalid QR Code version");let e=t<<12;for(;X.getBCHDigit(e)-Xt>=0;)e^=vt<<X.getBCHDigit(e)-Xt;return t<<12|e}});var ie=g(oe=>{var pt=I(),re=1335,nn=21522,ne=pt.getBCHDigit(re);oe.getEncodedBits=function(t,e){let r=t.bit<<3|e,o=r<<10;for(;pt.getBCHDigit(o)-ne>=0;)o^=re<<pt.getBCHDigit(o)-ne;return(r<<10|o)^nn}});var ue=g((vn,se)=>{var rn=M();function x(n){this.mode=rn.NUMERIC,this.data=n.toString()}x.getBitsLength=function(t){return 10*Math.floor(t/3)+(t%3?t%3*3+1:0)};x.prototype.getLength=function(){return this.data.length};x.prototype.getBitsLength=function(){return x.getBitsLength(this.data.length)};x.prototype.write=function(t){let e,r,o;for(e=0;e+3<=this.data.length;e+=3)r=this.data.substr(e,3),o=parseInt(r,10),t.put(o,10);let i=this.data.length-e;i>0&&(r=this.data.substr(e),o=parseInt(r,10),t.put(o,i*3+1))};se.exports=x});var le=g((tr,ce)=>{var on=M(),wt=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function U(n){this.mode=on.ALPHANUMERIC,this.data=n}U.getBitsLength=function(t){return 11*Math.floor(t/2)+6*(t%2)};U.prototype.getLength=function(){return this.data.length};U.prototype.getBitsLength=function(){return U.getBitsLength(this.data.length)};U.prototype.write=function(t){let e;for(e=0;e+2<=this.data.length;e+=2){let r=wt.indexOf(this.data[e])*45;r+=wt.indexOf(this.data[e+1]),t.put(r,11)}this.data.length%2&&t.put(wt.indexOf(this.data[e]),6)};ce.exports=U});var fe=g((er,ae)=>{var sn=M();function q(n){this.mode=sn.BYTE,typeof n=="string"?this.data=new TextEncoder().encode(n):this.data=new Uint8Array(n)}q.getBitsLength=function(t){return t*8};q.prototype.getLength=function(){return this.data.length};q.prototype.getBitsLength=function(){return q.getBitsLength(this.data.length)};q.prototype.write=function(n){for(let t=0,e=this.data.length;t<e;t++)n.put(this.data[t],8)};ae.exports=q});var de=g((nr,ge)=>{var un=M(),cn=I();function D(n){this.mode=un.KANJI,this.data=n}D.getBitsLength=function(t){return t*13};D.prototype.getLength=function(){return this.data.length};D.prototype.getBitsLength=function(){return D.getBitsLength(this.data.length)};D.prototype.write=function(n){let t;for(t=0;t<this.data.length;t++){let e=cn.toSJIS(this.data[t]);if(e>=33088&&e<=40956)e-=33088;else if(e>=57408&&e<=60351)e-=49472;else throw new
Line truncated
|
||||
Make sure your charset is UTF-8`);e=(e>>>8&255)*192+(e&255),n.put(e,13)}};ge.exports=D});var he=g((rr,mt)=>{"use strict";var K={single_source_shortest_paths:function(n,t,e){var r={},o={};o[t]=0;var i=K.PriorityQueue.make();i.push(t,0);for(var s,u,c,l,a,w,h,y,A;!i.empty();){s=i.pop(),u=s.value,l=s.cost,a=n[u]||{};for(c in a)a.hasOwnProperty(c)&&(w=a[c],h=l+w,y=o[c],A=typeof o[c]>"u",(A||y>h)&&(o[c]=h,i.push(c,h),r[c]=u))}if(typeof e<"u"&&typeof o[e]>"u"){var T=["Could not find a path from ",t," to ",e,"."].join("");throw new Error(T)}return r},extract_shortest_path_from_predecessor_list:function(n,t){for(var e=[],r=t,o;r;)e.push(r),o=n[r],r=n[r];return e.reverse(),e},find_path:function(n,t,e){var r=K.single_source_shortest_paths(n,t,e);return K.extract_shortest_path_from_predecessor_list(r,e)},PriorityQueue:{make:function(n){var t=K.PriorityQueue,e={},r;n=n||{};for(r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);return e.queue=[],e.sorter=n.sorter||t.default_sorter,e},default_sorter:function(n,t){return n.cost-t.cost},push:function(n,t){var e={value:n,cost:t};this.queue.push(e),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};typeof mt<"u"&&(mt.exports=K)});var Ae=g(F=>{var f=M(),me=ue(),ye=le(),Ee=fe(),Ce=de(),J=gt(),v=I(),ln=he();function pe(n){return unescape(encodeURIComponent(n)).length}function Y(n,t,e){let r=[],o;for(;(o=n.exec(e))!==null;)r.push({data:o[0],index:o.index,mode:t,length:o[0].length});return r}function Be(n){let t=Y(J.NUMERIC,f.NUMERIC,n),e=Y(J.ALPHANUMERIC,f.ALPHANUMERIC,n),r,o;return v.isKanjiModeEnabled()?(r=Y(J.BYTE,f.BYTE,n),o=Y(J.KANJI,f.KANJI,n)):(r=Y(J.BYTE_KANJI,f.BYTE,n),o=[]),t.concat(e,r,o).sort(function(s,u){return s.index-u.index}).map(function(s){return{data:s.data,mode:s.mode,length:s.length}})}function yt(n,t){switch(t){case f.NUMERIC:return me.getBitsLength(n);case f.ALPHANUMERIC:return ye.getBitsLength(n);case f.KANJI:return Ce.getBitsLength(n);case f.BYTE:return Ee.getBitsLength(n)}}function an(n){return n.reduce(function(t,e){let r=t.length-1>=0?t[t.length-1]:null;return r&&r.mode===e.mode?(t[t.length-1].data+=e.data,t):(t.push(e),t)},[])}function fn(n){let t=[];for(let e=0;e<n.length;e++){let r=n[e];switch(r.mode){case f.NUMERIC:t.push([r,{data:r.data,mode:f.ALPHANUMERIC,length:r.length},{data:r.data,mode:f.BYTE,length:r.length}]);break;case f.ALPHANUMERIC:t.push([r,{data:r.data,mode:f.BYTE,length:r.length}]);break;case f.KANJI:t.push([r,{data:r.data,mode:f.BYTE,length:pe(r.data)}]);break;case f.BYTE:t.push([{data:r.data,mode:f.BYTE,length:pe(r.data)}])}}return t}function gn(n,t){let e={},r={start:{}},o=["start"];for(let i=0;i<n.length;i++){let s=n[i],u=[];for(let c=0;c<s.length;c++){let l=s[c],a=""+i+c;u.push(a),e[a]={node:l,lastCount:0},r[a]={};for(let w=0;w<o.length;w++){let h=o[w];e[h]&&e[h].node.mode===l.mode?(r[h][a]=yt(e[h].lastCount+l.length,l.mode)-yt(e[h].lastCount,l.mode),e[h].lastCount+=l.length):(e[h]&&(e[h].lastCount=l.length),r[h][a]=yt(l.length,l.mode)+4+f.getCharCountIndicator(l.mode,t))}}o=u}for(let i=0;i<o.length;i++)r[o[i]].end=0;return{map:r,table:e}}function we(n,t){let e,r=f.getBestModeForData(n);if(e=f.from(t,r),e!==f.BYTE&&e.bit<r.bit)throw new Error('"'+n+'" cannot be encoded with mode '+f.toString(e)+`.
|
||||
Suggested mode is: `+f.toString(r));switch(e===f.KANJI&&!v.isKanjiModeEnabled()&&(e=f.BYTE),e){case f.NUMERIC:return new me(n);case f.ALPHANUMERIC:return new ye(n);case f.KANJI:return new Ce(n);case f.BYTE:return new Ee(n)}}F.fromArray=function(t){return t.reduce(function(e,r){return typeof r=="string"?e.push(we(r,null)):r.data&&e.push(we(r.data,r.mode)),e},[])};F.fromString=function(t,e){let r=Be(t,v.isKanjiModeEnabled()),o=fn(r),i=gn(o,e),s=ln.find_path(i.map,"start","end"),u=[];for(let c=1;c<s.length-1;c++)u.push(i.table[s[c]].node);return F.fromArray(an(u))};F.rawSplit=function(t){return F.fromArray(Be(t,v.isKanjiModeEnabled()))}});var Ie=g(Te=>{var et=I(),Et=j(),dn=Dt(),hn=kt(),pn=zt(),wn=Kt(),At=Jt(),Tt=ct(),mn=Qt(),tt=ee(),yn=ie(),En=M(),Ct=Ae();function Cn(n,t){let e=n.size,r=wn.getPositions(t);for(let o=0;o<r.length;o++){let i=r[o][0],s=r[o][1];for(let u=-1;u<=7;u++)if(!(i+u<=-1||e<=i+u))for(let c=-1;c<=7;c++)s+c<=-1||e<=s+c||(u>=0&&u<=6&&(c===0||c===6)||c>=0&&c<=6&&(u===0||u===6)||u>=2&&u<=4&&c>=2&&c<=4?n.set(i+u,s+c,!0,!0):n.set(i+u,s+c,!1,!0))}}function Bn(n){let t=n.size;for(let e=8;e<t-8;e++){let r=e%2===0;n.set(e,6,r,!0),n.set(6,e,r,!0)}}function An(n,t){let e=pn.getPositions(t);for(let r=0;r<e.length;r++){let o=e[r][0],i=e[r][1];for(let s=-2;s<=2;s++)for(let u=-2;u<=2;u++)s===-2||s===2||u===-2||u===2||s===0&&u===0?n.set(o+s,i+u,!0,!0):n.set(o+s,i+u,!1,!0)}}function Tn(n,t){let e=n.size,r=tt.getEncodedBits(t),o,i,s;for(let u=0;u<18;u++)o=Math.floor(u/3),i=u%3+e-8-3,s=(r>>u&1)===1,n.set(o,i,s,!0),n.set(i,o,s,!0)}function Bt(n,t,e){let r=n.size,o=yn.getEncodedBits(t,e),i,s;for(i=0;i<15;i++)s=(o>>i&1)===1,i<6?n.set(i,8,s,!0):i<8?n.set(i+1,8,s,!0):n.set(r-15+i,8,s,!0),i<8?n.set(8,r-i-1,s,!0):i<9?n.set(8,15-i-1+1,s,!0):n.set(8,15-i-1,s,!0);n.set(r-8,8,1,!0)}function In(n,t){let e=n.size,r=-1,o=e-1,i=7,s=0;for(let u=e-1;u>0;u-=2)for(u===6&&u--;;){for(let c=0;c<2;c++)if(!n.isReserved(o,u-c)){let l=!1;s<t.length&&(l=(t[s]>>>i&1)===1),n.set(o,u-c,l),i--,i===-1&&(s++,i=7)}if(o+=r,o<0||e<=o){o-=r,r=-r;break}}}function Nn(n,t,e){let r=new dn;e.forEach(function(c){r.put(c.mode.bit,4),r.put(c.getLength(),En.getCharCountIndicator(c.mode,n)),c.write(r)});let o=et.getSymbolTotalCodewords(n),i=Tt.getTotalCodewordsCount(n,t),s=(o-i)*8;for(r.getLengthInBits()+4<=s&&r.put(0,4);r.getLengthInBits()%8!==0;)r.putBit(0);let u=(s-r.getLengthInBits())/8;for(let c=0;c<u;c++)r.put(c%2?17:236,8);return Mn(r,n,t)}function Mn(n,t,e){let r=et.getSymbolTotalCodewords(t),o=Tt.getTotalCodewordsCount(t,e),i=r-o,s=Tt.getBlocksCount(t,e),u=r%s,c=s-u,l=Math.floor(r/s),a=Math.floor(i/s),w=a+1,h=l-a,y=new mn(h),A=0,T=new Array(s),bt=new Array(s),rt=0,_e=new Uint8Array(n.buffer);for(let _=0;_<s;_++){let it=_<c?a:w;T[_]=_e.slice(A,A+it),bt[_]=y.encode(T[_]),A+=it,rt=Math.max(rt,it)}let ot=new Uint8Array(r),Rt=0,E,C;for(E=0;E<rt;E++)for(C=0;C<s;C++)E<T[C].length&&(ot[Rt++]=T[C][E]);for(E=0;E<h;E++)for(C=0;C<s;C++)ot[Rt++]=bt[C][E];return ot}function Sn(n,t,e,r){let o;if(Array.isArray(n))o=Ct.fromArray(n);else if(typeof n=="string"){let l=t;if(!l){let a=Ct.rawSplit(n);l=tt.getBestVersionForData(a,e)}o=Ct.fromString(n,l||40)}else throw new Error("Invalid data");let i=tt.getBestVersionForData(o,e);if(!i)throw new Error("The amount of data is too big to be stored in a QR Code");if(!t)t=i;else if(t<i)throw new Error(`
|
||||
The chosen QR Code version cannot contain this amount of data.
|
||||
Minimum version required to store current data is: `+i+`.
|
||||
`);let s=Nn(t,e,o),u=et.getSymbolSize(t),c=new hn(u);return Cn(c,t),Bn(c),An(c,t),Bt(c,e,0),t>=7&&Tn(c,t),In(c,s),isNaN(r)&&(r=At.getBestMask(c,Bt.bind(null,c,e))),At.applyMask(r,c),Bt(c,e,r),{modules:c,version:t,errorCorrectionLevel:e,maskPattern:r,segments:o}}Te.create=function(t,e){if(typeof t>"u"||t==="")throw new Error("No input text");let r=Et.M,o,i;return typeof e<"u"&&(r=Et.from(e.errorCorrectionLevel,Et.M),o=tt.from(e.version),i=At.from(e.maskPattern),e.toSJISFunc&&et.setToSJISFunction(e.toSJISFunc)),Sn(t,o,r,i)}});var It=g(L=>{function Ne(n){if(typeof n=="number"&&(n=n.toString()),typeof n!="string")throw new Error("Color should be defined as hex string");let t=n.slice().replace("#","").split("");if(t.length<3||t.length===5||t.length>8)throw new Error("Invalid hex color: "+n);(t.length===3||t.length===4)&&(t=Array.prototype.concat.apply([],t.map(function(r){return[r,r]}))),t.length===6&&t.push("F","F");let e=parseInt(t.join(""),16);return{r:e>>24&255,g:e>>16&255,b:e>>8&255,a:e&255,hex:"#"+t.slice(0,6).join("")}}L.getOptions=function(t){t||(t={}),t.color||(t.color={});let e=typeof t.margin>"u"||t.margin===null||t.margin<0?4:t.margin,r=t.width&&t.width>=21?t.width:void 0,o=t.scale||4;return{width:r,scale:r?4:o,margin:e,color:{dark:Ne(t.color.dark||"#000000ff"),light:Ne(t.color.light||"#ffffffff")},type:t.type,rendererOpts:t.rendererOpts||{}}};L.getScale=function(t,e){return e.width&&e.width>=t+e.margin*2?e.width/(t+e.margin*2):e.scale};L.getImageWidth=function(t,e){let r=L.getScale(t,e);return Math.floor((t+e.margin*2)*r)};L.qrToImageData=function(t,e,r){let o=e.modules.size,i=e.modules.data,s=L.getScale(o,r),u=Math.floor((o+r.margin*2)*s),c=r.margin*s,l=[r.color.light,r.color.dark];for(let a=0;a<u;a++)for(let w=0;w<u;w++){let h=(a*u+w)*4,y=r.color.light;if(a>=c&&w>=c&&a<u-c&&w<u-c){let A=Math.floor((a-c)/s),T=Math.floor((w-c)/s);y=l[i[A*o+T]?1:0]}t[h++]=y.r,t[h++]=y.g,t[h++]=y.b,t[h]=y.a}}});var Me=g(nt=>{var Nt=It();function Pn(n,t,e){n.clearRect(0,0,t.width,t.height),t.style||(t.style={}),t.height=e,t.width=e,t.style.height=e+"px",t.style.width=e+"px"}function bn(){try{return document.createElement("canvas")}catch{throw new Error("You need to specify a canvas element")}}nt.render=function(t,e,r){let o=r,i=e;typeof o>"u"&&(!e||!e.getContext)&&(o=e,e=void 0),e||(i=bn()),o=Nt.getOptions(o);let s=Nt.getImageWidth(t.modules.size,o),u=i.getContext("2d"),c=u.createImageData(s,s);return Nt.qrToImageData(c.data,t,o),Pn(u,i,s),u.putImageData(c,0,0),i};nt.renderToDataURL=function(t,e,r){let o=r;typeof o>"u"&&(!e||!e.getContext)&&(o=e,e=void 0),o||(o={});let i=nt.render(t,e,o),s=o.type||"image/png",u=o.rendererOpts||{};return i.toDataURL(s,u.quality)}});var be=g(Pe=>{var Rn=It();function Se(n,t){let e=n.a/255,r=t+'="'+n.hex+'"';return e<1?r+" "+t+'-opacity="'+e.toFixed(2).slice(1)+'"':r}function Mt(n,t,e){let r=n+t;return typeof e<"u"&&(r+=" "+e),r}function Ln(n,t,e){let r="",o=0,i=!1,s=0;for(let u=0;u<n.length;u++){let c=Math.floor(u%t),l=Math.floor(u/t);!c&&!i&&(i=!0),n[u]?(s++,u>0&&c>0&&n[u-1]||(r+=i?Mt("M",c+e,.5+l+e):Mt("m",o,0),o=0,i=!1),c+1<t&&n[u+1]||(r+=Mt("h",s),s=0)):o++}return r}Pe.render=function(t,e,r){let o=Rn.getOptions(e),i=t.modules.size,s=t.modules.data,u=i+o.margin*2,c=o.color.light.a?"<path "+Se(o.color.light,"fill")+' d="M0 0h'+u+"v"+u+'H0z"/>':"",l="<path "+Se(o.color.dark,"stroke")+' d="'+Ln(s,i,o.margin)+'"/>',a='viewBox="0 0 '+u+" "+u+'"',h='<svg xmlns="http://www.w3.org/2000/svg" '+(o.width?'width="'+o.width+'" height="'+o.width+'" ':"")+a+' shape-rendering="crispEdges">'+c+l+`</svg>
|
||||
`;return typeof r=="function"&&r(null,h),h}});var Le=g(O=>{var _n=xt(),St=Ie(),Re=Me(),xn=be();function Pt(n,t,e,r,o){let i=[].slice.call(arguments,1),s=i.length,u=typeof i[s-1]=="function";if(!u&&!_n())throw new Error("Callback required as last argument");if(u){if(s<2)throw new Error("Too few arguments provided");s===2?(o=e,e=t,t=r=void 0):s===3&&(t.getContext&&typeof o>"u"?(o=r,r=void 0):(o=r,r=e,e=t,t=void 0))}else{if(s<1)throw new Error("Too few arguments provided");return s===1?(e=t,t=r=void 0):s===2&&!t.getContext&&(r=e,e=t,t=void 0),new Promise(function(c,l){try{let a=St.create(e,r);c(n(a,t,r))}catch(a){l(a)}})}try{let c=St.create(e,r);o(null,n(c,t,r))}catch(c){o(c)}}O.create=St.create;O.toCanvas=Pt.bind(null,Re.render);O.toDataURL=Pt.bind(null,Re.renderToDataURL);O.toString=Pt.bind(null,function(n,t,e){return xn.render(n,e)})});var Un=ze(Le());var export_default=Un.default;export{export_default as default};
|
||||
Vendored
+64
@@ -0,0 +1,64 @@
|
||||
function $t(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var be=$t();function Gn(t){be=t}var Ue={exec:()=>null};function w(t,e=""){let n=typeof t=="string"?t:t.source,s={replace:(i,a)=>{let l=typeof a=="string"?a:a.source;return l=l.replace($.caret,"$1"),n=n.replace(i,l),s},getRegex:()=>new RegExp(n,e)};return s}var $={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:t=>new RegExp(`^( {0,3}${t})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}#`),htmlBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}<(?:[a-z].*>|!--)`,"i")},Jr=/^(?:[ \t]*(?:\n|$))+/,ei=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,ti=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Be=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,ni=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Ut=/(?:[*+-]|\d{1,9}[.)])/,Wn=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,jn=w(Wn).replace(/bull/g,Ut).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),ri=w(Wn).replace(/bull/g,Ut).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),Bt=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,ii=/^[^\n]+/,Ft=/(?!\s*\])(?:\\.|[^\[\]\\])+/,si=w(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Ft).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),oi=w(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Ut).getRegex(),ot="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",Ht=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,ai=w("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",Ht).replace("tag",ot).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),qn=w(Bt).replace("hr",Be).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|Line truncated
|
||||
]`).replace("lheading",jn).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},pi=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,fi=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Yn=/^( {2,}|\\)\n(?!\s*$)/,hi=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,at=/[\p{P}\p{S}]/u,Wt=/[\s\p{P}\p{S}]/u,Zn=/[^\s\p{P}\p{S}]/u,di=w(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,Wt).getRegex(),Vn=/(?!~)[\p{P}\p{S}]/u,gi=/(?!~)[\s\p{P}\p{S}]/u,mi=/(?:[^\s\p{P}\p{S}]|~)/u,bi=/\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g,Xn=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,ki=w(Xn,"u").replace(/punct/g,at).getRegex(),Ti=w(Xn,"u").replace(/punct/g,Vn).getRegex(),Qn="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",_i=w(Qn,"gu").replace(/notPunctSpace/g,Zn).replace(/punctSpace/g,Wt).replace(/punct/g,at).getRegex(),xi=w(Qn,"gu").replace(/notPunctSpace/g,mi).replace(/punctSpace/g,gi).replace(/punct/g,Vn).getRegex(),wi=w("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Zn).replace(/punctSpace/g,Wt).replace(/punct/g,at).getRegex(),yi=w(/\\(punct)/,"gu").replace(/punct/g,at).getRegex(),Si=w(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),Ai=w(Ht).replace("(?:-->|$)","-->").getRegex(),Ei=w("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",Ai).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),rt=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,Ri=w(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",rt).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Kn=w(/^!?\[(label)\]\[(ref)\]/).replace("label",rt).replace("ref",Ft).getRegex(),Jn=w(/^!?\[(ref)\](?:\[\])?/).replace("ref",Ft).getRegex(),vi=w("reflink|nolink(?!\\()","g").replace("reflink",Kn).replace("nolink",Jn).getRegex(),jt={_backpedal:Ue,anyPunctuation:yi,autolink:Si,blockSkip:bi,br:Yn,code:fi,del:Ue,emStrongLDelim:ki,emStrongRDelimAst:_i,emStrongRDelimUnd:wi,escape:pi,link:Ri,nolink:Jn,punctuation:di,reflink:Kn,reflinkSearch:vi,tag:Ei,text:hi,url:Ue},Li={...jt,link:w(/^!?\[(label)\]\((.*?)\)/).replace("label",rt).getRegex(),reflink:w(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",rt).getRegex()},Nt={...jt,emStrongRDelimAst:xi,emStrongLDelim:Ti,url:w(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\.|[^\\])*?(?:\\.|[^\s~\\]))\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},Ii={...Nt,br:w(Yn).replace("{2,}","*").getRegex(),text:w(Nt.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},tt={normal:Gt,gfm:ci,pedantic:ui},Me={normal:jt,gfm:Nt,breaks:Ii,pedantic:Li},Oi={"&":"&","<":"<",">":">",'"':""","'":"'"},Un=t=>Oi[t];function K(t,e){if(e){if($.escapeTest.test(t))return t.replace($.escapeReplace,Un)}else if($.escapeTestNoEncode.test(t))return t.replace($.escapeReplaceNoEncode,Un);return t}function Bn(t){try{t=encodeURI(t).replace($.percentDecode,"%")}catch{return null}return t}function Fn(t,e){let n=t.replace($.findPipe,(a,l,c)=>{let h=!1,d=l;for(;--d>=0&&c[d]==="\\";)h=!h;return h?"|":" |"}),s=n.split($.splitPipe),i=0;if(s[0].trim()||s.shift(),s.length>0&&!s.at(-1)?.trim()&&s.pop(),e)if(s.length>e)s.splice(e);else for(;s.length<e;)s.push("");for(;i<s.length;i++)s[i]=s[i].trim().replace($.slashPipe,"|");return s}function $e(t,e,n){let s=t.length;if(s===0)return"";let i=0;for(;i<s;){let a=t.charAt(s-i-1);if(a===e&&!n)i++;else if(a!==e&&n)i++;else break}return t.slice(0,s-i)}function Di(t,e){if(t.indexOf(e[1])===-1)return-1;let n=0;for(let s=0;s<t.length;s++)if(t[s]==="\\")s++;else if(t[s]===e[0])n++;else if(t[s]===e[1]&&(n--,n<Line truncated
|
||||
`).map(a=>{let l=a.match(n.other.beginningSpace);if(l===null)return a;let[c]=l;return c.length>=i.length?a.slice(i.length):a}).join(`
|
||||
`)}var it=class{options;rules;lexer;constructor(t){this.options=t||be}space(t){let e=this.rules.block.newline.exec(t);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(t){let e=this.rules.block.code.exec(t);if(e){let n=e[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:e[0],codeBlockStyle:"indented",text:this.options.pedantic?n:$e(n,`
|
||||
`)}}}fences(t){let e=this.rules.block.fences.exec(t);if(e){let n=e[0],s=Ci(n,e[3]||"",this.rules);return{type:"code",raw:n,lang:e[2]?e[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):e[2],text:s}}}heading(t){let e=this.rules.block.heading.exec(t);if(e){let n=e[2].trim();if(this.rules.other.endingHash.test(n)){let s=$e(n,"#");(this.options.pedantic||!s||this.rules.other.endingSpaceChar.test(s))&&(n=s.trim())}return{type:"heading",raw:e[0],depth:e[1].length,text:n,tokens:this.lexer.inline(n)}}}hr(t){let e=this.rules.block.hr.exec(t);if(e)return{type:"hr",raw:$e(e[0],`
|
||||
`)}}blockquote(t){let e=this.rules.block.blockquote.exec(t);if(e){let n=$e(e[0],`
|
||||
`).split(`
|
||||
`),s="",i="",a=[];for(;n.length>0;){let l=!1,c=[],h;for(h=0;h<n.length;h++)if(this.rules.other.blockquoteStart.test(n[h]))c.push(n[h]),l=!0;else if(!l)c.push(n[h]);else break;n=n.slice(h);let d=c.join(`
|
||||
`),m=d.replace(this.rules.other.blockquoteSetextReplace,`
|
||||
$1`).replace(this.rules.other.blockquoteSetextReplace2,"");s=s?`${s}
|
||||
${d}`:d,i=i?`${i}
|
||||
${m}`:m;let T=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(m,a,!0),this.lexer.state.top=T,n.length===0)break;let x=a.at(-1);if(x?.type==="code")break;if(x?.type==="blockquote"){let O=x,S=O.raw+`
|
||||
`+n.join(`
|
||||
`),U=this.blockquote(S);a[a.length-1]=U,s=s.substring(0,s.length-O.raw.length)+U.raw,i=i.substring(0,i.length-O.text.length)+U.text;break}else if(x?.type==="list"){let O=x,S=O.raw+`
|
||||
`+n.join(`
|
||||
`),U=this.list(S);a[a.length-1]=U,s=s.substring(0,s.length-x.raw.length)+U.raw,i=i.substring(0,i.length-O.raw.length)+U.raw,n=S.substring(a.at(-1).raw.length).split(`
|
||||
`);continue}}return{type:"blockquote",raw:s,tokens:a,text:i}}}list(t){let e=this.rules.block.list.exec(t);if(e){let n=e[1].trim(),s=n.length>1,i={type:"list",raw:"",ordered:s,start:s?+n.slice(0,-1):"",loose:!1,items:[]};n=s?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=s?n:"[*+-]");let a=this.rules.other.listItemRegex(n),l=!1;for(;t;){let h=!1,d="",m="";if(!(e=a.exec(t))||this.rules.block.hr.test(t))break;d=e[0],t=t.substring(d.length);let T=e[2].split(`
|
||||
`,1)[0].replace(this.rules.other.listReplaceTabs,Y=>" ".repeat(3*Y.length)),x=t.split(`
|
||||
`,1)[0],O=!T.trim(),S=0;if(this.options.pedantic?(S=2,m=T.trimStart()):O?S=e[1].length+1:(S=e[2].search(this.rules.other.nonSpaceChar),S=S>4?1:S,m=T.slice(S),S+=e[1].length),O&&this.rules.other.blankLine.test(x)&&(d+=x+`
|
||||
`,t=t.substring(x.length+1),h=!0),!h){let Y=this.rules.other.nextBulletRegex(S),Te=this.rules.other.hrRegex(S),_e=this.rules.other.fencesBeginRegex(S),Z=this.rules.other.headingBeginRegex(S),se=this.rules.other.htmlBeginRegex(S);for(;t;){let oe=t.split(`
|
||||
`,1)[0],C;if(x=oe,this.options.pedantic?(x=x.replace(this.rules.other.listReplaceNesting," "),C=x):C=x.replace(this.rules.other.tabCharGlobal," "),_e.test(x)||Z.test(x)||se.test(x)||Y.test(x)||Te.test(x))break;if(C.search(this.rules.other.nonSpaceChar)>=S||!x.trim())m+=`
|
||||
`+C.slice(S);else{if(O||T.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||_e.test(T)||Z.test(T)||Te.test(T))break;m+=`
|
||||
`+x}!O&&!x.trim()&&(O=!0),d+=oe+`
|
||||
`,t=t.substring(oe.length+1),T=C.slice(S)}}i.loose||(l?i.loose=!0:this.rules.other.doubleBlankLine.test(d)&&(l=!0));let U=null,ie;this.options.gfm&&(U=this.rules.other.listIsTask.exec(m),U&&(ie=U[0]!=="[ ] ",m=m.replace(this.rules.other.listReplaceTask,""))),i.items.push({type:"list_item",raw:d,task:!!U,checked:ie,loose:!1,text:m,tokens:[]}),i.raw+=d}let c=i.items.at(-1);if(c)c.raw=c.raw.trimEnd(),c.text=c.text.trimEnd();else return;i.raw=i.raw.trimEnd();for(let h=0;h<i.items.length;h++)if(this.lexer.state.top=!1,i.items[h].tokens=this.lexer.blockTokens(i.items[h].text,[]),!i.loose){let d=i.items[h].tokens.filter(T=>T.type==="space"),m=d.length>0&&d.some(T=>this.rules.other.anyLine.test(T.raw));i.loose=m}if(i.loose)for(let h=0;h<i.items.length;h++)i.items[h].loose=!0;return i}}html(t){let e=this.rules.block.html.exec(t);if(e)return{type:"html",block:!0,raw:e[0],pre:e[1]==="pre"||e[1]==="script"||e[1]==="style",text:e[0]}}def(t){let e=this.rules.block.def.exec(t);if(e){let n=e[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),s=e[2]?e[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",i=e[3]?e[3].substring(1,e[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):e[3];return{type:"def",tag:n,raw:e[0],href:s,title:i}}}table(t){let e=this.rules.block.table.exec(t);if(!e||!this.rules.other.tableDelimiter.test(e[2]))return;let n=Fn(e[1]),s=e[2].replace(this.rules.other.tableAlignChars,"").split("|"),i=e[3]?.trim()?e[3].replace(this.rules.other.tableRowBlankLine,"").split(`
|
||||
`):[],a={type:"table",raw:e[0],header:[],align:[],rows:[]};if(n.length===s.length){for(let l of s)this.rules.other.tableAlignRight.test(l)?a.align.push("right"):this.rules.other.tableAlignCenter.test(l)?a.align.push("center"):this.rules.other.tableAlignLeft.test(l)?a.align.push("left"):a.align.push(null);for(let l=0;l<n.length;l++)a.header.push({text:n[l],tokens:this.lexer.inline(n[l]),header:!0,align:a.align[l]});for(let l of i)a.rows.push(Fn(l,a.header.length).map((c,h)=>({text:c,tokens:this.lexer.inline(c),header:!1,align:a.align[h]})));return a}}lheading(t){let e=this.rules.block.lheading.exec(t);if(e)return{type:"heading",raw:e[0],depth:e[2].charAt(0)==="="?1:2,text:e[1],tokens:this.lexer.inline(e[1])}}paragraph(t){let e=this.rules.block.paragraph.exec(t);if(e){let n=e[1].charAt(e[1].length-1)===`
|
||||
`?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:n,tokens:this.lexer.inline(n)}}}text(t){let e=this.rules.block.text.exec(t);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(t){let e=this.rules.inline.escape.exec(t);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(t){let e=this.rules.inline.tag.exec(t);if(e)return!this.lexer.state.inLink&&this.rules.other.startATag.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(t){let e=this.rules.inline.link.exec(t);if(e){let n=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(n)){if(!this.rules.other.endAngleBracket.test(n))return;let a=$e(n.slice(0,-1),"\\");if((n.length-a.length)%2===0)return}else{let a=Di(e[2],"()");if(a===-2)return;if(a>-1){let c=(e[0].indexOf("!")===0?5:4)+e[1].length+a;e[2]=e[2].substring(0,a),e[0]=e[0].substring(0,c).trim(),e[3]=""}}let s=e[2],i="";if(this.options.pedantic){let a=this.rules.other.pedanticHrefTitle.exec(s);a&&(s=a[1],i=a[3])}else i=e[3]?e[3].slice(1,-1):"";return s=s.trim(),this.rules.other.startAngleBracket.test(s)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(n)?s=s.slice(1):s=s.slice(1,-1)),Hn(e,{href:s&&s.replace(this.rules.inline.anyPunctuation,"$1"),title:i&&i.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer,this.rules)}}reflink(t,e){let n;if((n=this.rules.inline.reflink.exec(t))||(n=this.rules.inline.nolink.exec(t))){let s=(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal," "),i=e[s.toLowerCase()];if(!i){let a=n[0].charAt(0);return{type:"text",raw:a,text:a}}return Hn(n,i,n[0],this.lexer,this.rules)}}emStrong(t,e,n=""){let s=this.rules.inline.emStrongLDelim.exec(t);if(!s||s[3]&&n.match(this.rules.other.unicodeAlphaNumeric))return;if(!(s[1]||s[2]||"")||!n||this.rules.inline.punctuation.exec(n)){let a=[...s[0]].length-1,l,c,h=a,d=0,m=s[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(m.lastIndex=0,e=e.slice(-1*t.length+a);(s=m.exec(e))!=null;){if(l=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!l)continue;if(c=[...l].length,s[3]||s[4]){h+=c;continue}else if((s[5]||s[6])&&a%3&&!((a+c)%3)){d+=c;continue}if(h-=c,h>0)continue;c=Math.min(c,c+h+d);let T=[...s[0]][0].length,x=t.slice(0,a+s.index+T+c);if(Math.min(a,c)%2){let S=x.slice(1,-1);return{type:"em",raw:x,text:S,tokens:this.lexer.inlineTokens(S)}}let O=x.slice(2,-2);return{type:"strong",raw:x,text:O,tokens:this.lexer.inlineTokens(O)}}}}codespan(t){let e=this.rules.inline.code.exec(t);if(e){let n=e[2].replace(this.rules.other.newLineCharGlobal," "),s=this.rules.other.nonSpaceChar.test(n),i=this.rules.other.startingSpaceChar.test(n)&&this.rules.other.endingSpaceChar.test(n);return s&&i&&(n=n.substring(1,n.length-1)),{type:"codespan",raw:e[0],text:n}}}br(t){let e=this.rules.inline.br.exec(t);if(e)return{type:"br",raw:e[0]}}del(t){let e=this.rules.inline.del.exec(t);if(e)return{type:"del",raw:e[0],text:e[2],tokens:this.lexer.inlineTokens(e[2])}}autolink(t){let e=this.rules.inline.autolink.exec(t);if(e){let n,s;return e[2]==="@"?(n=e[1],s="mailto:"+n):(n=e[1],s=n),{type:"link",raw:e[0],text:n,href:s,tokens:[{type:"text",raw:n,text:n}]}}}url(t){let e;if(e=this.rules.inline.url.exec(t)){let n,s;if(e[2]==="@")n=e[0],s="mailto:"+n;else{let i;do i=e[0],e[0]=this.rules.inline._backpedal.exec(e[0])?.[0]??"";while(i!==e[0]);n=e[0],e[1]==="www."?s="http://"+e[0]:s=e[0]}return{type:"link",raw:e[0],text:n,href:s,tokens:[{type:"text",raw:n,text:n}]}}}inlineText(t){let e=this.rules.inline.text.exec(t);if(e){let n=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:e[0],escaped:n}}}},ee=class zt{tokens;options;state;tokenizer;inlineQueue;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||be,this.options.tokenizer=this.options.tokenizer||new it,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let n={other:$,block:tt.normal,inline:Me.normal};this.options.pedantic?(n.block=tt.pedantic,n.inline=Me.pedantic):this.options.gfm&&(n.block=tt.gfm,this.options.breaks?n.inline=Me.breaks:n.inline=Me.gfm),this.tokenizer.rules=n}static get rules(){return{block:tt,inline:Me}}static lex(e,n){return new zt(n).lex(e)}static lexInline(e,n){return new zt(n).inlineTokens(e)}lex(e){e=e.replace($.carriageReturn,`
|
||||
`),this.blockTokens(e,this.tokens);for(let n=0;n<this.inlineQueue.length;n++){let s=this.inlineQueue[n];this.inlineTokens(s.src,s.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,n=[],s=!1){for(this.options.pedantic&&(e=e.replace($.tabCharGlobal," ").replace($.spaceLine,""));e;){let i;if(this.options.extensions?.block?.some(l=>(i=l.call({lexer:this},e,n))?(e=e.substring(i.raw.length),n.push(i),!0):!1))continue;if(i=this.tokenizer.space(e)){e=e.substring(i.raw.length);let l=n.at(-1);i.raw.length===1&&l!==void 0?l.raw+=`
|
||||
`:n.push(i);continue}if(i=this.tokenizer.code(e)){e=e.substring(i.raw.length);let l=n.at(-1);l?.type==="paragraph"||l?.type==="text"?(l.raw+=`
|
||||
`+i.raw,l.text+=`
|
||||
`+i.text,this.inlineQueue.at(-1).src=l.text):n.push(i);continue}if(i=this.tokenizer.fences(e)){e=e.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.heading(e)){e=e.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.hr(e)){e=e.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.blockquote(e)){e=e.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.list(e)){e=e.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.html(e)){e=e.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.def(e)){e=e.substring(i.raw.length);let l=n.at(-1);l?.type==="paragraph"||l?.type==="text"?(l.raw+=`
|
||||
`+i.raw,l.text+=`
|
||||
`+i.raw,this.inlineQueue.at(-1).src=l.text):this.tokens.links[i.tag]||(this.tokens.links[i.tag]={href:i.href,title:i.title});continue}if(i=this.tokenizer.table(e)){e=e.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.lheading(e)){e=e.substring(i.raw.length),n.push(i);continue}let a=e;if(this.options.extensions?.startBlock){let l=1/0,c=e.slice(1),h;this.options.extensions.startBlock.forEach(d=>{h=d.call({lexer:this},c),typeof h=="number"&&h>=0&&(l=Math.min(l,h))}),l<1/0&&l>=0&&(a=e.substring(0,l+1))}if(this.state.top&&(i=this.tokenizer.paragraph(a))){let l=n.at(-1);s&&l?.type==="paragraph"?(l.raw+=`
|
||||
`+i.raw,l.text+=`
|
||||
`+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=l.text):n.push(i),s=a.length!==e.length,e=e.substring(i.raw.length);continue}if(i=this.tokenizer.text(e)){e=e.substring(i.raw.length);let l=n.at(-1);l?.type==="text"?(l.raw+=`
|
||||
`+i.raw,l.text+=`
|
||||
`+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=l.text):n.push(i);continue}if(e){let l="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(l);break}else throw new Error(l)}}return this.state.top=!0,n}inline(e,n=[]){return this.inlineQueue.push({src:e,tokens:n}),n}inlineTokens(e,n=[]){let s=e,i=null;if(this.tokens.links){let c=Object.keys(this.tokens.links);if(c.length>0)for(;(i=this.tokenizer.rules.inline.reflinkSearch.exec(s))!=null;)c.includes(i[0].slice(i[0].lastIndexOf("[")+1,-1))&&(s=s.slice(0,i.index)+"["+"a".repeat(i[0].length-2)+"]"+s.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(i=this.tokenizer.rules.inline.anyPunctuation.exec(s))!=null;)s=s.slice(0,i.index)+"++"+s.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;(i=this.tokenizer.rules.inline.blockSkip.exec(s))!=null;)s=s.slice(0,i.index)+"["+"a".repeat(i[0].length-2)+"]"+s.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);let a=!1,l="";for(;e;){a||(l=""),a=!1;let c;if(this.options.extensions?.inline?.some(d=>(c=d.call({lexer:this},e,n))?(e=e.substring(c.raw.length),n.push(c),!0):!1))continue;if(c=this.tokenizer.escape(e)){e=e.substring(c.raw.length),n.push(c);continue}if(c=this.tokenizer.tag(e)){e=e.substring(c.raw.length),n.push(c);continue}if(c=this.tokenizer.link(e)){e=e.substring(c.raw.length),n.push(c);continue}if(c=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(c.raw.length);let d=n.at(-1);c.type==="text"&&d?.type==="text"?(d.raw+=c.raw,d.text+=c.text):n.push(c);continue}if(c=this.tokenizer.emStrong(e,s,l)){e=e.substring(c.raw.length),n.push(c);continue}if(c=this.tokenizer.codespan(e)){e=e.substring(c.raw.length),n.push(c);continue}if(c=this.tokenizer.br(e)){e=e.substring(c.raw.length),n.push(c);continue}if(c=this.tokenizer.del(e)){e=e.substring(c.raw.length),n.push(c);continue}if(c=this.tokenizer.autolink(e)){e=e.substring(c.raw.length),n.push(c);continue}if(!this.state.inLink&&(c=this.tokenizer.url(e))){e=e.substring(c.raw.length),n.push(c);continue}let h=e;if(this.options.extensions?.startInline){let d=1/0,m=e.slice(1),T;this.options.extensions.startInline.forEach(x=>{T=x.call({lexer:this},m),typeof T=="number"&&T>=0&&(d=Math.min(d,T))}),d<1/0&&d>=0&&(h=e.substring(0,d+1))}if(c=this.tokenizer.inlineText(h)){e=e.substring(c.raw.length),c.raw.slice(-1)!=="_"&&(l=c.raw.slice(-1)),a=!0;let d=n.at(-1);d?.type==="text"?(d.raw+=c.raw,d.text+=c.text):n.push(c);continue}if(e){let d="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(d);break}else throw new Error(d)}}return n}},st=class{options;parser;constructor(t){this.options=t||be}space(t){return""}code({text:t,lang:e,escaped:n}){let s=(e||"").match($.notSpaceStart)?.[0],i=t.replace($.endingNewline,"")+`
|
||||
`;return s?'<pre><code class="language-'+K(s)+'">'+(n?i:K(i,!0))+`</code></pre>
|
||||
`:"<pre><code>"+(n?i:K(i,!0))+`</code></pre>
|
||||
`}blockquote({tokens:t}){return`<blockquote>
|
||||
${this.parser.parse(t)}</blockquote>
|
||||
`}html({text:t}){return t}heading({tokens:t,depth:e}){return`<h${e}>${this.parser.parseInline(t)}</h${e}>
|
||||
`}hr(t){return`<hr>
|
||||
`}list(t){let e=t.ordered,n=t.start,s="";for(let l=0;l<t.items.length;l++){let c=t.items[l];s+=this.listitem(c)}let i=e?"ol":"ul",a=e&&n!==1?' start="'+n+'"':"";return"<"+i+a+`>
|
||||
`+s+"</"+i+`>
|
||||
`}listitem(t){let e="";if(t.task){let n=this.checkbox({checked:!!t.checked});t.loose?t.tokens[0]?.type==="paragraph"?(t.tokens[0].text=n+" "+t.tokens[0].text,t.tokens[0].tokens&&t.tokens[0].tokens.length>0&&t.tokens[0].tokens[0].type==="text"&&(t.tokens[0].tokens[0].text=n+" "+K(t.tokens[0].tokens[0].text),t.tokens[0].tokens[0].escaped=!0)):t.tokens.unshift({type:"text",raw:n+" ",text:n+" ",escaped:!0}):e+=n+" "}return e+=this.parser.parse(t.tokens,!!t.loose),`<li>${e}</li>
|
||||
`}checkbox({checked:t}){return"<input "+(t?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph({tokens:t}){return`<p>${this.parser.parseInline(t)}</p>
|
||||
`}table(t){let e="",n="";for(let i=0;i<t.header.length;i++)n+=this.tablecell(t.header[i]);e+=this.tablerow({text:n});let s="";for(let i=0;i<t.rows.length;i++){let a=t.rows[i];n="";for(let l=0;l<a.length;l++)n+=this.tablecell(a[l]);s+=this.tablerow({text:n})}return s&&(s=`<tbody>${s}</tbody>`),`<table>
|
||||
<thead>
|
||||
`+e+`</thead>
|
||||
`+s+`</table>
|
||||
`}tablerow({text:t}){return`<tr>
|
||||
${t}</tr>
|
||||
`}tablecell(t){let e=this.parser.parseInline(t.tokens),n=t.header?"th":"td";return(t.align?`<${n} align="${t.align}">`:`<${n}>`)+e+`</${n}>
|
||||
`}strong({tokens:t}){return`<strong>${this.parser.parseInline(t)}</strong>`}em({tokens:t}){return`<em>${this.parser.parseInline(t)}</em>`}codespan({text:t}){return`<code>${K(t,!0)}</code>`}br(t){return"<br>"}del({tokens:t}){return`<del>${this.parser.parseInline(t)}</del>`}link({href:t,title:e,tokens:n}){let s=this.parser.parseInline(n),i=Bn(t);if(i===null)return s;t=i;let a='<a href="'+t+'"';return e&&(a+=' title="'+K(e)+'"'),a+=">"+s+"</a>",a}image({href:t,title:e,text:n,tokens:s}){s&&(n=this.parser.parseInline(s,this.parser.textRenderer));let i=Bn(t);if(i===null)return K(n);t=i;let a=`<img src="${t}" alt="${n}"`;return e&&(a+=` title="${K(e)}"`),a+=">",a}text(t){return"tokens"in t&&t.tokens?this.parser.parseInline(t.tokens):"escaped"in t&&t.escaped?t.text:K(t.text)}},qt=class{strong({text:t}){return t}em({text:t}){return t}codespan({text:t}){return t}del({text:t}){return t}html({text:t}){return t}text({text:t}){return t}link({text:t}){return""+t}image({text:t}){return""+t}br(){return""}},te=class Mt{options;renderer;textRenderer;constructor(e){this.options=e||be,this.options.renderer=this.options.renderer||new st,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new qt}static parse(e,n){return new Mt(n).parse(e)}static parseInline(e,n){return new Mt(n).parseInline(e)}parse(e,n=!0){let s="";for(let i=0;i<e.length;i++){let a=e[i];if(this.options.extensions?.renderers?.[a.type]){let c=a,h=this.options.extensions.renderers[c.type].call({parser:this},c);if(h!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(c.type)){s+=h||"";continue}}let l=a;switch(l.type){case"space":{s+=this.renderer.space(l);continue}case"hr":{s+=this.renderer.hr(l);continue}case"heading":{s+=this.renderer.heading(l);continue}case"code":{s+=this.renderer.code(l);continue}case"table":{s+=this.renderer.table(l);continue}case"blockquote":{s+=this.renderer.blockquote(l);continue}case"list":{s+=this.renderer.list(l);continue}case"html":{s+=this.renderer.html(l);continue}case"paragraph":{s+=this.renderer.paragraph(l);continue}case"text":{let c=l,h=this.renderer.text(c);for(;i+1<e.length&&e[i+1].type==="text";)c=e[++i],h+=`
|
||||
`+this.renderer.text(c);n?s+=this.renderer.paragraph({type:"paragraph",raw:h,text:h,tokens:[{type:"text",raw:h,text:h,escaped:!0}]}):s+=h;continue}default:{let c='Token with "'+l.type+'" type was not found.';if(this.options.silent)return console.error(c),"";throw new Error(c)}}}return s}parseInline(e,n=this.renderer){let s="";for(let i=0;i<e.length;i++){let a=e[i];if(this.options.extensions?.renderers?.[a.type]){let c=this.options.extensions.renderers[a.type].call({parser:this},a);if(c!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(a.type)){s+=c||"";continue}}let l=a;switch(l.type){case"escape":{s+=n.text(l);break}case"html":{s+=n.html(l);break}case"link":{s+=n.link(l);break}case"image":{s+=n.image(l);break}case"strong":{s+=n.strong(l);break}case"em":{s+=n.em(l);break}case"codespan":{s+=n.codespan(l);break}case"br":{s+=n.br(l);break}case"del":{s+=n.del(l);break}case"text":{s+=n.text(l);break}default:{let c='Token with "'+l.type+'" type was not found.';if(this.options.silent)return console.error(c),"";throw new Error(c)}}}return s}},nt=class{options;block;constructor(t){this.options=t||be}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(t){return t}postprocess(t){return t}processAllTokens(t){return t}provideLexer(){return this.block?ee.lex:ee.lexInline}provideParser(){return this.block?te.parse:te.parseInline}},Pi=class{defaults=$t();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=te;Renderer=st;TextRenderer=qt;Lexer=ee;Tokenizer=it;Hooks=nt;constructor(...t){this.use(...t)}walkTokens(t,e){let n=[];for(let s of t)switch(n=n.concat(e.call(this,s)),s.type){case"table":{let i=s;for(let a of i.header)n=n.concat(this.walkTokens(a.tokens,e));for(let a of i.rows)for(let l of a)n=n.concat(this.walkTokens(l.tokens,e));break}case"list":{let i=s;n=n.concat(this.walkTokens(i.items,e));break}default:{let i=s;this.defaults.extensions?.childTokens?.[i.type]?this.defaults.extensions.childTokens[i.type].forEach(a=>{let l=i[a].flat(1/0);n=n.concat(this.walkTokens(l,e))}):i.tokens&&(n=n.concat(this.walkTokens(i.tokens,e)))}}return n}use(...t){let e=this.defaults.extensions||{renderers:{},childTokens:{}};return t.forEach(n=>{let s={...n};if(s.async=this.defaults.async||s.async||!1,n.extensions&&(n.extensions.forEach(i=>{if(!i.name)throw new Error("extension name required");if("renderer"in i){let a=e.renderers[i.name];a?e.renderers[i.name]=function(...l){let c=i.renderer.apply(this,l);return c===!1&&(c=a.apply(this,l)),c}:e.renderers[i.name]=i.renderer}if("tokenizer"in i){if(!i.level||i.level!=="block"&&i.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let a=e[i.level];a?a.unshift(i.tokenizer):e[i.level]=[i.tokenizer],i.start&&(i.level==="block"?e.startBlock?e.startBlock.push(i.start):e.startBlock=[i.start]:i.level==="inline"&&(e.startInline?e.startInline.push(i.start):e.startInline=[i.start]))}"childTokens"in i&&i.childTokens&&(e.childTokens[i.name]=i.childTokens)}),s.extensions=e),n.renderer){let i=this.defaults.renderer||new st(this.defaults);for(let a in n.renderer){if(!(a in i))throw new Error(`renderer '${a}' does not exist`);if(["options","parser"].includes(a))continue;let l=a,c=n.renderer[l],h=i[l];i[l]=(...d)=>{let m=c.apply(i,d);return m===!1&&(m=h.apply(i,d)),m||""}}s.renderer=i}if(n.tokenizer){let i=this.defaults.tokenizer||new it(this.defaults);for(let a in n.tokenizer){if(!(a in i))throw new Error(`tokenizer '${a}' does not exist`);if(["options","rules","lexer"].includes(a))continue;let l=a,c=n.tokenizer[l],h=i[l];i[l]=(...d)=>{let m=c.apply(i,d);return m===!1&&(m=h.apply(i,d)),m}}s.tokenizer=i}if(n.hooks){let i=this.defaults.hooks||new nt;for(let a in n.hooks){if(!(a in i))throw new Error(`hook '${a}' does not exist`);if(["options","block"].includes(a))continue;let l=a,c=n.hooks[l],h=i[l];nt.passThroughHooks.has(a)?i[l]=d=>{if(this.defaults.async)return Promise.resolve(c.call(i,d)).then(T=>h.call(i,T));let m=c.call(i,d);return h.call(i,m)}:i[l]=(...d)=>{let m=c.apply(i,d);return m===!1&&(m=h.apply(i,d)),m}}s.hooks=i}if(n.walkTokens){let i=this.defaults.walkTokens,a=n.walkTokens;s.walkTokens=function(l){let c=[];return c.push(a.call(this,l)),i&&(c=c.concat(i.call(this,l))),c}}this.defaults={...this.defaults,...s}}),this}setOptions(t){return this.defaults={...this.defaults,...t},this}lexer(t,e){return ee.lex(t,e??this.defaults)}parser(t,e){return te.parse(t,e??this.defaults)}parseMarkdown(t){return(n,s)=>{let i={...s},a={...this.defaults,...i},l=this.onError(!!a.silent,!!a.async);if(this.defaults.async===!0&&i.async===!1)return l(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof n>"u"||n===null)return l(new Error("marked(): input parameter is undefined or null"));if(typeof n!="string")return l(new Error("marked(): input parameter is of type "+Objec
Line truncated
|
||||
Please report this to https://github.com/markedjs/marked.`,t){let s="<p>An error occurred:</p><pre>"+K(n.message+"",!0)+"</pre>";return e?Promise.resolve(s):s}if(e)return Promise.reject(n);throw n}}},me=new Pi;function y(t,e){return me.parse(t,e)}y.options=y.setOptions=function(t){return me.setOptions(t),y.defaults=me.defaults,Gn(y.defaults),y};y.getDefaults=$t;y.defaults=be;y.use=function(...t){return me.use(...t),y.defaults=me.defaults,Gn(y.defaults),y};y.walkTokens=function(t,e){return me.walkTokens(t,e)};y.parseInline=me.parseInline;y.Parser=te;y.parser=te.parse;y.Renderer=st;y.TextRenderer=qt;y.Lexer=ee;y.lexer=ee.lex;y.Tokenizer=it;y.Hooks=nt;y.parse=y;var ds=y.options,gs=y.setOptions,ms=y.use,bs=y.walkTokens,ks=y.parseInline;var Ts=te.parse,_s=ee.lex;function Ni(t,e){this.v=t,this.k=e}function er(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,s=Array(e);n<e;n++)s[n]=t[n];return s}function zi(t){if(Array.isArray(t))return t}function Mi(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var s,i,a,l,c=[],h=!0,d=!1;try{if(a=(n=n.call(t)).next,e===0){if(Object(n)!==n)return;h=!1}else for(;!(h=(s=a.call(n)).done)&&(c.push(s.value),c.length!==e);h=!0);}catch(m){d=!0,i=m}finally{try{if(!h&&n.return!=null&&(l=n.return(),Object(l)!==l))return}finally{if(d)throw i}}return c}}function $i(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
||||
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ui(t,e){return zi(t)||Mi(t,e)||Bi(t,e)||$i()}function Bi(t,e){if(t){if(typeof t=="string")return er(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?er(t,e):void 0}}function lt(t){var e,n;function s(a,l){try{var c=t[a](l),h=c.value,d=h instanceof Ni;Promise.resolve(d?h.v:h).then(function(m){if(d){var T=a==="return"&&h.k?a:"next";if(!h.k||m.done)return s(T,m);m=t[T](m).value}i(!!c.done,m)},function(m){s("throw",m)})}catch(m){i(2,m)}}function i(a,l){a===2?e.reject(l):e.resolve({value:l,done:a}),(e=e.next)?s(e.key,e.arg):n=null}this._invoke=function(a,l){return new Promise(function(c,h){var d={key:a,arg:l,resolve:c,reject:h,next:null};n?n=n.next=d:(e=n=d,s(a,l))})},typeof t.return!="function"&&(this.return=void 0)}lt.prototype[typeof Symbol=="function"&&Symbol.asyncIterator||"@@asyncIterator"]=function(){return this},lt.prototype.next=function(t){return this._invoke("next",t)},lt.prototype.throw=function(t){return this._invoke("throw",t)},lt.prototype.return=function(t){return this._invoke("return",t)};var gr=Object.entries,tr=Object.setPrototypeOf,Fi=Object.isFrozen,mr=Object.getPrototypeOf,br=Object.getOwnPropertyDescriptor,P=Object.freeze,z=Object.seal,Le=Object.create,kr=typeof Reflect<"u"&&Reflect,nn=kr.apply,rn=kr.construct;P||(P=function(e){return e});z||(z=function(e){return e});nn||(nn=function(e,n){for(var s=arguments.length,i=new Array(s>2?s-2:0),a=2;a<s;a++)i[a-2]=arguments[a];return e.apply(n,i)});rn||(rn=function(e){for(var n=arguments.length,s=new Array(n>1?n-1:0),i=1;i<n;i++)s[i-1]=arguments[i];return new e(...s)});var ne=v(Array.prototype.forEach);Array.prototype.indexOf;var Hi=v(Array.prototype.lastIndexOf),nr=v(Array.prototype.pop),Fe=v(Array.prototype.push),Gi=v(Array.prototype.slice),Wi=v(Array.prototype.splice),Ie=Array.isArray,Yt=Tr(Set),Zt=v(Set.prototype.add),He=v(Set.prototype.has),ke=v(String.prototype.toLowerCase),Vt=v(String.prototype.toString),rr=v(String.prototype.match),Ge=v(String.prototype.replace),ir=v(String.prototype.indexOf),ji=v(String.prototype.trim),qi=v(Number.prototype.toString),Yi=v(Boolean.prototype.toString),sr=typeof BigInt>"u"?null:v(BigInt.prototype.toString),or=typeof Symbol>"u"?null:v(Symbol.prototype.toString),G=v(Object.prototype.hasOwnProperty),We=v(Object.prototype.toString),N=v(RegExp.prototype.test),re=Tr(TypeError);function v(t){return function(e){e instanceof RegExp&&(e.lastIndex=0);for(var n=arguments.length,s=new Array(n>1?n-1:0),i=1;i<n;i++)s[i-1]=arguments[i];return nn(t,e,s)}}function Tr(t){return function(){for(var e=arguments.length,n=new Array(e),s=0;s<e;s++)n[s]=arguments[s];return rn(t,n)}}function _(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:ke;if(tr&&tr(t,null),!Ie(e))return t;let s=e.length;for(;s--;){let i=e[s];if(typeof i=="string"){let a=n(i);a!==i&&(Fi(e)||(e[s]=a),i=a)}t[i]=!0}return t}function Zi(t){for(let e=0;e<t.length;e++)G(t,e)||(t[e]=null);return t}function W(t){let e=Le(null);for(let s of gr(t)){var n=Ui(s,2);let i=n[0],a=n[1];G(t,i)&&(Ie(a)?e[i]=Zi(a):a&&typeof a=="object"&&a.constructor===Object?e[i]=W(a):e[i]=a)}return e}function Vi(t){switch(typeof t){case"string":return t;case"number":return qi(t);case"boolean":return Yi(t);case"bigint":return sr?sr(t):"0";case"symbol":return or?or(t):"Symbol()";case"undefined":return We(t);case"function":case"object":{if(t===null)return We(t);let e=t,n=j(e,"toString");if(typeof n=="function"){let s=n(e);return typeof s=="string"?s:We(s)}return We(t)}default:return We(t)}}function j(t,e){for(;t!==null;){let s=br(t,e);if(s){if(s.get)return v(s.get);if(typeof s.value=="function")return v(s.value)}t=mr(t)}function n(){return null}return n}function Xi(t,e){for(;t!==null;){let n=br(t,e);if(n)return n.get?v(n.get):null;t=mr(t)}return null}function Qi(t){try{return N(t,""),!0}catch{return!1}}var ar=P(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),Xt=P(["svg","a","altglyph","altglyphdef","altglyphitem","
Line truncated
|
||||
`+M),J&&(M=Ke(M)),B&&Ve?xe(M):M},e.setConfig=function(){let f=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};At(f),bt=!0,qe=E,Ye=R},e.clearConfig=function(){Ae=null,bt=!1,qe=null,Ye=null,B=pt,pe=""},e.isValidAttribute=function(f,r,o){Ae||At({});let u=L(f),p=L(r);return typeof o=="string"&&(zn(r,o)||!mt&&N(hr,o))?!1:Pn(u,p,o)},e.addHook=function(f,r){typeof r=="function"&&G(A,f)&&Fe(A[f],r)},e.removeHook=function(f,r){if(G(A,f)){if(r!==void 0){let o=Hi(A[f],r);return o===-1?void 0:Wi(A[f],o,1)[0]}return nr(A[f])}},e.removeHooks=function(f){G(A,f)&&(A[f]=[])},e.removeAllHooks=function(){A=dr()},e}var hs=_r();export{hs as DOMPurify,y as marked};
|
||||
/*! Bundled license information:
|
||||
|
||||
dompurify/dist/purify.es.mjs:
|
||||
(*! @license DOMPurify 3.4.17 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.17/LICENSE *)
|
||||
(*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE *)
|
||||
*/
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "Fuc",
|
||||
"description": "直接复用新版FUC原始用户模板、样式、图标及素材,接入XB接口;XB管理员后台保持原样。",
|
||||
"version": "0.6.1",
|
||||
"version": "0.12.0",
|
||||
"images": "",
|
||||
"configs": [
|
||||
{
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
<script>window.fucSettings = @json(['title' => ($theme_config['brand_name'] ?? '') ?: $title, 'description' => $theme_config['tagline'] ?? $description]);</script>
|
||||
<script type="module" src="/theme/{{ $theme }}/assets/app.mjs?v=0.6.1"></script>
|
||||
<script type="module" src="/theme/{{ $theme }}/assets/app.mjs?v=0.12.0"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Reference in new issue
Block a user