Feat: Refactor subscription page templates
This commit is contained in:
171
core/scripts/normalsub/template/index.html
Normal file
171
core/scripts/normalsub/template/index.html
Normal file
@ -0,0 +1,171 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="robots" content="noindex, nofollow, noarchive, nosnippet">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>{{ username }}</title>
|
||||
<link rel="stylesheet" href="style.css">
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/all.min.css">
|
||||
</head>
|
||||
<body>
|
||||
<div class="background-animation"></div>
|
||||
<div id="loading-indicator" class="loading-indicator">
|
||||
<div class="spinner"></div>
|
||||
</div>
|
||||
|
||||
<div class="container">
|
||||
<header class="header">
|
||||
<h1 class="header-title">Welcome, <strong>{{ username }}</strong></h1>
|
||||
<button id="dark-mode-toggle" class="theme-toggle" aria-label="Toggle theme">
|
||||
<i id="theme-icon" class="fas fa-sun"></i>
|
||||
</button>
|
||||
</header>
|
||||
|
||||
<main>
|
||||
<section class="info-grid">
|
||||
<div class="card info-card">
|
||||
<div class="card-icon"><i class="fas fa-user"></i></div>
|
||||
<div class="card-content">
|
||||
<h2 class="card-title">Username</h2>
|
||||
<p class="card-value">{{ username }}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card info-card">
|
||||
<div class="card-icon"><i class="fas fa-chart-line"></i></div>
|
||||
<div class="card-content" data-tooltip="{{ usage_raw }}">
|
||||
<h2 class="card-title">Data Usage</h2>
|
||||
<p class="card-value">{{ usage }}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card info-card">
|
||||
<div class="card-icon"><i class="fas fa-calendar-check"></i></div>
|
||||
<div class="card-content">
|
||||
<h2 class="card-title">Expires On</h2>
|
||||
<p class="card-value">{{ expiration_date }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="card app-import-section {% if blocked %}blocked{% endif %}">
|
||||
<div class="card-header">
|
||||
<i class="fas fa-link"></i>
|
||||
<h2>Client Import</h2>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
{% if blocked %}
|
||||
<div class="blocked-message">
|
||||
<i class="fas fa-exclamation-triangle"></i>
|
||||
<h3>Account Suspended</h3>
|
||||
<p>Your subscription is currently disabled.</p>
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="app-tabs">
|
||||
<div class="app-tabs-nav">
|
||||
<button class="app-tab-btn active" data-target="#tab-general">General</button>
|
||||
<button class="app-tab-btn" data-target="#tab-singbox">Sing-Box</button>
|
||||
<button class="app-tab-btn" data-target="#tab-hiddify">Hiddify</button>
|
||||
<button class="app-tab-btn" data-target="#tab-streisand">Streisand</button>
|
||||
<button class="app-tab-btn" data-target="#tab-nekobox">NekoBox</button>
|
||||
</div>
|
||||
<div class="app-tabs-content">
|
||||
<div class="app-tab-pane active" id="tab-general">
|
||||
<img src="{{ sublink_qrcode }}" alt="Universal Subscription QR Code" class="qrcode">
|
||||
<button class="btn btn-primary" onclick="copyToClipboard('{{ sub_link }}')">
|
||||
<i class="fas fa-copy"></i> Copy Universal Link
|
||||
</button>
|
||||
</div>
|
||||
<div class="app-tab-pane" id="tab-singbox">
|
||||
<img src="{{ singbox_qrcode }}" alt="Sing-Box QR Code" class="qrcode">
|
||||
<a href="sing-box://import-remote-profile?url={{ sub_link_encoded }}" class="btn btn-secondary">
|
||||
<i class="fas fa-arrow-right"></i> Add to Sing-Box
|
||||
</a>
|
||||
</div>
|
||||
<div class="app-tab-pane" id="tab-hiddify">
|
||||
<img src="{{ hiddify_qrcode }}" alt="Hiddify QR Code" class="qrcode">
|
||||
<a href="hiddify://import/{{ sub_link_encoded }}" class="btn btn-secondary">
|
||||
<i class="fas fa-arrow-right"></i> Add to Hiddify
|
||||
</a>
|
||||
</div>
|
||||
<div class="app-tab-pane" id="tab-streisand">
|
||||
<img src="{{ streisand_qrcode }}" alt="Streisand QR Code" class="qrcode">
|
||||
<a href="streisand://import/sub?url={{ sub_link_encoded }}" class="btn btn-secondary">
|
||||
<i class="fas fa-arrow-right"></i> Add to Streisand
|
||||
</a>
|
||||
</div>
|
||||
<div class="app-tab-pane" id="tab-nekobox">
|
||||
<img src="{{ nekobox_qrcode }}" alt="NekoBox QR Code" class="qrcode">
|
||||
<a href="nekobox://import?url={{ sub_link_encoded }}" class="btn btn-secondary">
|
||||
<i class="fas fa-arrow-right"></i> Add to NekoBox
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="card uri-section {% if blocked %}blocked{% endif %}">
|
||||
<div class="card-header">
|
||||
<i class="fas fa-server"></i>
|
||||
<h2>Manual Connection URIs</h2>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
{% if blocked %}
|
||||
<div class="blocked-message">
|
||||
<i class="fas fa-ban"></i>
|
||||
<h3>Connections Disabled</h3>
|
||||
<p>{{ usage_raw }}</p>
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="qr-grid">
|
||||
{% for item in local_uris %}
|
||||
<div class="qr-item">
|
||||
<h3 class="qr-title">{{ item.label }}</h3>
|
||||
{% if item.qrcode %}
|
||||
<img src="{{ item.qrcode }}" alt="{{ item.label }} QR Code" class="qrcode">
|
||||
<button class="btn btn-secondary" onclick="copyToClipboard('{{ item.uri }}')">
|
||||
<i class="fas fa-copy"></i> Copy URI
|
||||
</button>
|
||||
{% else %}
|
||||
<p class="uri-unavailable">URI not available</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</section>
|
||||
|
||||
{% if node_uris and not blocked %}
|
||||
<section class="card uri-section">
|
||||
<div class="card-header">
|
||||
<i class="fas fa-globe"></i>
|
||||
<h2>External Node URIs</h2>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="qr-grid">
|
||||
{% for item in node_uris %}
|
||||
<div class="qr-item">
|
||||
<h3 class="qr-title">{{ item.label }}</h3>
|
||||
{% if item.qrcode %}
|
||||
<img src="{{ item.qrcode }}" alt="{{ item.label }} QR Code" class="qrcode">
|
||||
<button class="btn btn-secondary" onclick="copyToClipboard('{{ item.uri }}')">
|
||||
<i class="fas fa-copy"></i> Copy URI
|
||||
</button>
|
||||
{% else %}
|
||||
<p class="uri-unavailable">URI not available</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
{% endif %}
|
||||
</main>
|
||||
</div>
|
||||
<script src="script.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
119
core/scripts/normalsub/template/script.js
Normal file
119
core/scripts/normalsub/template/script.js
Normal file
@ -0,0 +1,119 @@
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
const themeToggle = document.getElementById('dark-mode-toggle');
|
||||
const themeIcon = document.getElementById('theme-icon');
|
||||
let isDarkMode = localStorage.getItem('darkMode') === 'enabled';
|
||||
|
||||
const enableDarkMode = () => {
|
||||
document.body.classList.add('dark-mode');
|
||||
themeIcon.classList.replace('fa-sun', 'fa-moon');
|
||||
localStorage.setItem('darkMode', 'enabled');
|
||||
isDarkMode = true;
|
||||
};
|
||||
|
||||
const disableDarkMode = () => {
|
||||
document.body.classList.remove('dark-mode');
|
||||
themeIcon.classList.replace('fa-moon', 'fa-sun');
|
||||
localStorage.setItem('darkMode', 'disabled');
|
||||
isDarkMode = false;
|
||||
};
|
||||
|
||||
if (isDarkMode) {
|
||||
enableDarkMode();
|
||||
} else {
|
||||
const prefersDark = window.matchMedia('(prefers-color-scheme: dark)').matches;
|
||||
if (prefersDark && localStorage.getItem('darkMode') === null) {
|
||||
enableDarkMode();
|
||||
}
|
||||
}
|
||||
|
||||
themeToggle.addEventListener('click', () => {
|
||||
isDarkMode ? disableDarkMode() : enableDarkMode();
|
||||
});
|
||||
|
||||
// --- Loading Indicator ---
|
||||
const loadingIndicator = document.getElementById('loading-indicator');
|
||||
window.addEventListener('load', () => {
|
||||
loadingIndicator.style.opacity = '0';
|
||||
setTimeout(() => {
|
||||
loadingIndicator.style.display = 'none';
|
||||
}, 300);
|
||||
});
|
||||
|
||||
// --- App Import Tabs ---
|
||||
const tabsContainer = document.querySelector('.app-tabs');
|
||||
if (tabsContainer) {
|
||||
const tabButtons = tabsContainer.querySelectorAll('.app-tab-btn');
|
||||
const tabPanes = tabsContainer.querySelectorAll('.app-tab-pane');
|
||||
|
||||
tabButtons.forEach(button => {
|
||||
button.addEventListener('click', () => {
|
||||
const targetId = button.getAttribute('data-target');
|
||||
|
||||
tabButtons.forEach(btn => btn.classList.remove('active'));
|
||||
button.classList.add('active');
|
||||
|
||||
tabPanes.forEach(pane => {
|
||||
if ('#' + pane.id === targetId) {
|
||||
pane.classList.add('active');
|
||||
} else {
|
||||
pane.classList.remove('active');
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
function copyToClipboard(text) {
|
||||
if (!navigator.clipboard) {
|
||||
alert('Clipboard API not available.');
|
||||
return;
|
||||
}
|
||||
navigator.clipboard.writeText(text).then(() => {
|
||||
showToast('Copied to clipboard!');
|
||||
}).catch(err => {
|
||||
console.error('Failed to copy text: ', err);
|
||||
alert('Failed to copy.');
|
||||
});
|
||||
}
|
||||
|
||||
function showToast(message) {
|
||||
let toast = document.querySelector('.toast');
|
||||
if (toast) {
|
||||
toast.remove();
|
||||
}
|
||||
|
||||
toast = document.createElement('div');
|
||||
toast.className = 'toast';
|
||||
toast.textContent = message;
|
||||
|
||||
document.body.appendChild(toast);
|
||||
|
||||
const toastStyles = `
|
||||
position: fixed;
|
||||
bottom: 2rem;
|
||||
left: 50%;
|
||||
transform: translateX(-50%) translateY(20px);
|
||||
background-color: var(--text-light-primary);
|
||||
color: var(--bg-light);
|
||||
padding: 0.75rem 1.5rem;
|
||||
border-radius: 0.75rem;
|
||||
font-weight: 500;
|
||||
z-index: 1001;
|
||||
opacity: 0;
|
||||
transition: opacity 0.3s ease, transform 0.3s ease;
|
||||
box-shadow: var(--shadow-lg);
|
||||
`;
|
||||
toast.style.cssText = toastStyles;
|
||||
|
||||
setTimeout(() => {
|
||||
toast.style.opacity = '1';
|
||||
toast.style.transform = 'translateX(-50%) translateY(0)';
|
||||
}, 10);
|
||||
|
||||
setTimeout(() => {
|
||||
toast.style.opacity = '0';
|
||||
toast.style.transform = 'translateX(-50%) translateY(20px)';
|
||||
toast.addEventListener('transitionend', () => toast.remove());
|
||||
}, 2000);
|
||||
}
|
||||
118
core/scripts/normalsub/template/style.css
Normal file
118
core/scripts/normalsub/template/style.css
Normal file
@ -0,0 +1,118 @@
|
||||
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');
|
||||
|
||||
:root {
|
||||
/* Color Palette */
|
||||
--bg-light: #f9fafb;
|
||||
--bg-dark: #111827;
|
||||
--card-bg-light: #ffffff;
|
||||
--card-bg-dark: #1f2937;
|
||||
--text-light-primary: #1f2937;
|
||||
--text-light-secondary: #6b7280;
|
||||
--text-dark-primary: #f9fafb;
|
||||
--text-dark-secondary: #9ca3af;
|
||||
--accent-primary: #4f46e5;
|
||||
--accent-secondary: #3b82f6;
|
||||
--accent-danger: #e11d48;
|
||||
--border-light: #e5e7eb;
|
||||
--border-dark: #374151;
|
||||
--shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
|
||||
--shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
|
||||
--shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
|
||||
--gradient: linear-gradient(135deg, var(--accent-secondary) 0%, var(--accent-primary) 100%);
|
||||
|
||||
/* Layout & Design */
|
||||
--radius: 0.75rem;
|
||||
--transition-speed: 0.3s;
|
||||
}
|
||||
|
||||
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
|
||||
|
||||
body {
|
||||
font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
|
||||
background-color: var(--bg-light);
|
||||
color: var(--text-light-primary);
|
||||
transition: background-color var(--transition-speed) ease, color var(--transition-speed) ease;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
}
|
||||
|
||||
body.dark-mode {
|
||||
--bg-light: var(--bg-dark);
|
||||
--card-bg-light: var(--card-bg-dark);
|
||||
--text-light-primary: var(--text-dark-primary);
|
||||
--text-light-secondary: var(--text-dark-secondary);
|
||||
--border-light: var(--border-dark);
|
||||
--shadow-sm: none; --shadow-md: none; --shadow-lg: none;
|
||||
}
|
||||
|
||||
.background-animation { position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: -1; overflow: hidden; background: var(--bg-light); transition: background var(--transition-speed) ease; }
|
||||
.background-animation::before, .background-animation::after { content: ''; position: absolute; width: 40vw; height: 40vw; max-width: 500px; max-height: 500px; border-radius: 50%; background: var(--gradient); opacity: 0.1; filter: blur(120px); animation: float 30s infinite ease-in-out; }
|
||||
.background-animation::before { top: 5%; left: 5%; }
|
||||
.background-animation::after { bottom: 5%; right: 5%; animation-delay: -15s; }
|
||||
@keyframes float { 50% { transform: translate(20%, -20%) scale(1.1); } }
|
||||
|
||||
.container { max-width: 900px; margin: 0 auto; padding: 2rem; }
|
||||
.header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 3.5rem; }
|
||||
.header-title { font-size: 1.75rem; font-weight: 600; }
|
||||
.header-title strong { font-weight: 700; background: var(--gradient); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
|
||||
.theme-toggle { background-color: transparent; border: 1px solid var(--border-light); color: var(--text-light-secondary); width: 40px; height: 40px; border-radius: 50%; cursor: pointer; display: grid; place-items: center; font-size: 1.125rem; transition: all var(--transition-speed) ease; }
|
||||
.theme-toggle:hover { color: var(--accent-primary); border-color: var(--accent-primary); transform: rotate(15deg); }
|
||||
|
||||
.card { background: var(--card-bg-light); border: 1px solid var(--border-light); border-radius: var(--radius); margin-bottom: 1rem; margin-top: 1rem; box-shadow: var(--shadow-md); transition: transform var(--transition-speed) ease, box-shadow var(--transition-speed) ease; }
|
||||
.dark-mode .card { background: var(--card-bg-dark); }
|
||||
.card:hover { transform: translateY(-5px); box-shadow: var(--shadow-lg); }
|
||||
.card:last-child { margin-bottom: 0; }
|
||||
.card-header { display: flex; align-items: center; gap: 0.75rem; padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--border-light); font-weight: 600; font-size: 1.125rem; }
|
||||
.card-header i { color: var(--accent-primary); }
|
||||
.card-body { padding: 1.5rem; }
|
||||
|
||||
.info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1.5rem; }
|
||||
.info-card { display: flex; align-items: center; gap: 1rem; padding: 1.5rem; margin-bottom: 0; }
|
||||
.card-icon { background: var(--gradient); color: white; width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; font-size: 1.25rem; flex-shrink: 0; }
|
||||
.card-title { font-size: 0.875rem; font-weight: 500; color: var(--text-light-secondary); margin-bottom: 0.25rem; }
|
||||
.card-value { font-size: 1.25rem; font-weight: 600; }
|
||||
|
||||
[data-tooltip] { position: relative; cursor: help; }
|
||||
[data-tooltip]::after { content: attr(data-tooltip); position: absolute; bottom: 110%; left: 50%; transform: translateX(-50%); background: var(--text-light-primary); color: var(--bg-light); padding: 0.5rem 0.75rem; border-radius: 0.5rem; font-size: 0.875rem; font-weight: 500; white-space: nowrap; opacity: 0; visibility: hidden; transition: opacity var(--transition-speed) ease; box-shadow: var(--shadow-lg); }
|
||||
[data-tooltip]:hover::after { opacity: 1; visibility: visible; }
|
||||
|
||||
.app-import-section.blocked, .uri-section.blocked { background-color: var(--accent-danger); color: white; }
|
||||
.app-import-section.blocked .card-header, .uri-section.blocked .card-header { border-color: transparent; color: white; }
|
||||
.app-import-section.blocked .card-header i, .uri-section.blocked .card-header i { color: white; }
|
||||
.blocked-message { text-align: center; }
|
||||
.blocked-message i { font-size: 2.5rem; margin-bottom: 1rem; }
|
||||
.blocked-message h3 { font-size: 1.25rem; }
|
||||
.blocked-message p { opacity: 0.9; }
|
||||
|
||||
.app-tabs-nav { display: flex; overflow-x: auto; margin-bottom: 1.5rem; border-bottom: 1px solid var(--border-light); gap: 0.5rem; }
|
||||
.app-tab-btn { font-family: inherit; font-size: 0.9rem; font-weight: 600; color: var(--text-light-secondary); background: transparent; border: none; padding: 0.75rem 1rem; cursor: pointer; transition: all var(--transition-speed) ease; border-bottom: 2px solid transparent; }
|
||||
.app-tab-btn:hover { color: var(--text-light-primary); }
|
||||
.app-tab-btn.active { color: var(--accent-primary); border-bottom-color: var(--accent-primary); }
|
||||
.app-tabs-content { padding-top: 1rem; }
|
||||
.app-tab-pane { display: none; flex-direction: column; align-items: center; gap: 1.25rem; }
|
||||
.app-tab-pane.active { display: flex; }
|
||||
|
||||
.qr-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 2.5rem; place-items: center; }
|
||||
.qr-item { display: flex; flex-direction: column; align-items: center; gap: 1.25rem; text-align: center; }
|
||||
.qr-title { font-weight: 600; font-size: 1rem; }
|
||||
.qrcode { max-width: 200px; width: 100%; padding: 0.75rem; background: white; border-radius: 0.75rem; box-shadow: var(--shadow-md); }
|
||||
|
||||
.btn { font-family: inherit; text-decoration: none; font-size: 1rem; font-weight: 600; padding: 0.75rem 1.5rem; border: none; border-radius: 0.5rem; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; transition: all var(--transition-speed) ease; }
|
||||
.btn-primary { background: var(--gradient); color: white; box-shadow: var(--shadow-md); }
|
||||
.btn-primary:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
|
||||
.btn-secondary { background: var(--card-bg-light); color: var(--accent-primary); border: 1px solid var(--border-light); }
|
||||
.btn-secondary:hover { background-color: var(--accent-primary); color: white; border-color: var(--accent-primary); }
|
||||
|
||||
.uri-unavailable { color: var(--text-light-secondary); }
|
||||
|
||||
.loading-indicator { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: var(--bg-light); display: grid; place-items: center; z-index: 1000; transition: opacity var(--transition-speed) ease; }
|
||||
.spinner { width: 3rem; height: 3rem; border: 4px solid var(--accent-primary); border-top-color: transparent; border-radius: 50%; animation: spin 0.8s linear infinite; }
|
||||
@keyframes spin { to { transform: rotate(360deg); } }
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.container { padding: 1rem; }
|
||||
.header { flex-direction: column; gap: 1.5rem; align-items: flex-start; margin-bottom: 2.5rem; }
|
||||
.header-title { font-size: 1.5rem; }
|
||||
.card-body { padding: 1rem; }
|
||||
.info-grid { grid-template-columns: 1fr; }
|
||||
}
|
||||
Reference in New Issue
Block a user