-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathindex.html
More file actions
67 lines (66 loc) · 3.71 KB
/
index.html
File metadata and controls
67 lines (66 loc) · 3.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>{{ user.username }} - Sub Info</title>
</head>
<body>
<div id="root"></div>
<script>
try {
const obj = {
user: {% if user %}{% set user_data = {
'id': user.id,
'username': user.username,
'status': user.status.name if user.status else 'active',
'used_traffic': user.used_traffic,
'lifetime_used_traffic': user.lifetime_used_traffic,
'data_limit': user.data_limit,
'data_limit_reset_strategy': user.data_limit_reset_strategy.name if user.data_limit_reset_strategy else 'no_reset',
'expire': user.expire.isoformat() if user.expire else None,
'on_hold_expire_duration': user.on_hold_expire_duration,
'on_hold_timeout': user.on_hold_timeout.isoformat() if user.on_hold_timeout else None,
'group_ids': user.group_ids,
'created_at': user.created_at.isoformat() if user.created_at else None,
'edit_at': user.edit_at.isoformat() if user.edit_at else None,
'online_at': user.online_at.isoformat() if user.online_at else None,
'proxy_settings': {
'vmess': {'id': user.proxy_settings.vmess.id|string} if user.proxy_settings.vmess else None,
'vless': {'id': user.proxy_settings.vless.id|string, 'flow': user.proxy_settings.vless.flow.name if user.proxy_settings.vless.flow else None} if user.proxy_settings.vless else None,
'trojan': {'password': user.proxy_settings.trojan.password} if user.proxy_settings.trojan else None,
'shadowsocks': {'password': user.proxy_settings.shadowsocks.password, 'method': user.proxy_settings.shadowsocks.method.name if user.proxy_settings.shadowsocks.method else None} if user.proxy_settings.shadowsocks else None,
'wireguard': {'public_key': user.proxy_settings.wireguard.public_key, 'peer_ips': user.proxy_settings.wireguard.peer_ips} if user.proxy_settings.wireguard else None,
'hysteria': {'auth': user.proxy_settings.hysteria.auth|string} if user.proxy_settings.hysteria else None
},
'next_plan': {
'user_template_id': user.next_plan.user_template_id,
'data_limit': user.next_plan.data_limit,
'expire': user.next_plan.expire,
'add_remaining_traffic': user.next_plan.add_remaining_traffic
} if user.next_plan else None
} %}{{ user_data | tojson | safe }}{% else %}null{% endif %},
links: {{ links | tojson | safe }},
apps: {% if apps %}{% set apps_data = [] %}{% for app in apps %}{% if app %}{% set download_links_data = [] %}{% for link in app.download_links %}{% if link %}{% set link_dict = {
'name': link.name,
'url': link.url,
'language': link.language
} %}{% set _ = download_links_data.append(link_dict) %}{% endif %}{% endfor %}{% set app_dict = {
'name': app.name,
'icon_url': app.icon_url,
'import_url': app.import_url,
'description': app.description,
'recommended': app.recommended,
'platform': app.platform,
'download_links': download_links_data
} %}{% set _ = apps_data.append(app_dict) %}{% endif %}{% endfor %}{{ apps_data | tojson | safe }}{% else %}null{% endif %},
};
window.__INITIAL_DATA__ = obj;
} catch (e) {
console.warn("❌ Failed to load initial data:", e);
window.__INITIAL_DATA__ = {};
}
</script>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>