gitscope
https://dev.kronoz.win/r/marzneshin.git
app/templates/subscription/index.html · v0.6.2
Source
1 a47eb4c Dawsh 2y ago <!DOCTYPE html>
2 a47eb4c Dawsh 2y ago <html>
3 a47eb4c Dawsh 2y ago
4 a47eb4c Dawsh 2y ago <head>
5 a47eb4c Dawsh 2y ago <title>Subscription Information</title>
6 a47eb4c Dawsh 2y ago <style>
7 a47eb4c Dawsh 2y ago body {
8 a47eb4c Dawsh 2y ago font-family: Arial, sans-serif;
9 a47eb4c Dawsh 2y ago padding: 20px;
10 a47eb4c Dawsh 2y ago }
11 a47eb4c Dawsh 2y ago
12 a47eb4c Dawsh 2y ago h1 {
13 a47eb4c Dawsh 2y ago margin-top: 0;
14 a47eb4c Dawsh 2y ago }
15 a47eb4c Dawsh 2y ago
16 a47eb4c Dawsh 2y ago .link-input {
17 a47eb4c Dawsh 2y ago margin-bottom: 10px;
18 a47eb4c Dawsh 2y ago }
19 a47eb4c Dawsh 2y ago
20 a47eb4c Dawsh 2y ago .copy-button {
21 a47eb4c Dawsh 2y ago margin-left: 10px;
22 a47eb4c Dawsh 2y ago }
23 a47eb4c Dawsh 2y ago
24 a47eb4c Dawsh 2y ago .status {
25 a47eb4c Dawsh 2y ago display: inline-block;
26 a47eb4c Dawsh 2y ago padding: 3px 8px;
27 a47eb4c Dawsh 2y ago border-radius: 3px;
28 a47eb4c Dawsh 2y ago font-weight: bold;
29 a47eb4c Dawsh 2y ago font-size: 16px;
30 a47eb4c Dawsh 2y ago line-height: 1;
31 a47eb4c Dawsh 2y ago }
32 a47eb4c Dawsh 2y ago
33 a47eb4c Dawsh 2y ago .active {
34 a47eb4c Dawsh 2y ago background-color: #4CAF50;
35 a47eb4c Dawsh 2y ago color: white;
36 a47eb4c Dawsh 2y ago }
37 a47eb4c Dawsh 2y ago
38 d377c4c Dawsh 2y ago .inactive {
39 a47eb4c Dawsh 2y ago background-color: #9E9E9E;
40 a47eb4c Dawsh 2y ago color: white;
41 a47eb4c Dawsh 2y ago }
42 a47eb4c Dawsh 2y ago
43 a47eb4c Dawsh 2y ago .qr-popup {
44 a47eb4c Dawsh 2y ago position: fixed;
45 a47eb4c Dawsh 2y ago top: 50%;
46 a47eb4c Dawsh 2y ago left: 50%;
47 a47eb4c Dawsh 2y ago transform: translate(-50%, -50%);
48 a47eb4c Dawsh 2y ago background-color: white;
49 a47eb4c Dawsh 2y ago padding: 10px 25px 25px 25px;
50 a47eb4c Dawsh 2y ago border-radius: 8px;
51 a47eb4c Dawsh 2y ago box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
52 a47eb4c Dawsh 2y ago display: none;
53 a47eb4c Dawsh 2y ago z-index: 9999;
54 a47eb4c Dawsh 2y ago }
55 a47eb4c Dawsh 2y ago
56 a47eb4c Dawsh 2y ago .qr-close-button {
57 a47eb4c Dawsh 2y ago text-align: right;
58 a47eb4c Dawsh 2y ago margin-bottom: 5px;
59 a47eb4c Dawsh 2y ago margin-right: -15px;
60 a47eb4c Dawsh 2y ago }
61 a47eb4c Dawsh 2y ago </style>
62 a47eb4c Dawsh 2y ago <script src="https://cdnjs.cloudflare.com/ajax/libs/qrcodejs/1.0.0/qrcode.min.js"></script>
63 a47eb4c Dawsh 2y ago </head>
64 a47eb4c Dawsh 2y ago
65 a47eb4c Dawsh 2y ago <body>
66 d377c4c Dawsh 2y ago <h1>User Information</h1>
67 d377c4c Dawsh 2y ago <p>Username: {{ user.username }} <span class="status {% if user.is_active %}active{% else %}inactive{% endif %}">{{
68 d377c4c Dawsh 2y ago "Active" if user.is_active else "Inactive"}}</span></p>
69 d377c4c Dawsh 2y ago
70 d377c4c Dawsh 2y ago <p>Data Used: {{ user.used_traffic | bytesformat }}{% if user.data_limit_reset_strategy != 'no_reset' %} (resets
71 d377c4c Dawsh 2y ago every {{ user.data_limit_reset_strategy.value }}){% endif %}</p>
72 d377c4c Dawsh 2y ago <p>Data Limit: {% if not user.data_limit %}∞{% else %}{{ user.data_limit | bytesformat }}{% endif %}</p>
73 d377c4c Dawsh 2y ago <p>Expiration Date:
74 d377c4c Dawsh 2y ago {% if user.expire_strategy == "never" %}
75 d377c4c Dawsh 2y ago never
76 d377c4c Dawsh 2y ago {% elif user.expire_strategy == "start_on_first_use" %}
77 d377c4c Dawsh 2y ago {{ user.usage_duration // 3600 // 24}} days after the first use
78 d377c4c Dawsh 2y ago {% else %}
79 d377c4c Dawsh 2y ago {% set current_datetime = now() %}
80 d377c4c Dawsh 2y ago {% set remaining_days = ((user.expire_date - current_datetime).days) %}
81 d377c4c Dawsh 2y ago {{ user.expire_date | datetime }} ({{ remaining_days | int }} days
82 d377c4c Dawsh 2y ago remaining)
83 d377c4c Dawsh 2y ago {% endif %}</p>
84 d377c4c Dawsh 2y ago
85 d377c4c Dawsh 2y ago {% if user.is_active %}
86 d377c4c Dawsh 2y ago <h2>Links:</h2>
87 d377c4c Dawsh 2y ago <ul>
88 d377c4c Dawsh 2y ago {% for link in links %}
89 d377c4c Dawsh 2y ago <li>
90 d377c4c Dawsh 2y ago <input type="text" value="{{ link }}" readonly>
91 d377c4c Dawsh 2y ago <button class="copy-button" onclick="copyLink('{{ link }}', this)">Copy</button>
92 d377c4c Dawsh 2y ago <button class="qr-button" data-link="{{ link }}">QR Code</button>
93 d377c4c Dawsh 2y ago </li>
94 d377c4c Dawsh 2y ago {% endfor %}
95 d377c4c Dawsh 2y ago </ul>
96 d377c4c Dawsh 2y ago <div class="qr-popup" id="qrPopup">
97 d377c4c Dawsh 2y ago <div class="qr-close-button">
98 d377c4c Dawsh 2y ago <button onclick="closeQrPopup()">X</button>
99 a47eb4c Dawsh 2y ago </div>
100 d377c4c Dawsh 2y ago <div id="qrCodeContainer"></div>
101 d377c4c Dawsh 2y ago </div>
102 d377c4c Dawsh 2y ago {% endif %}
103 d377c4c Dawsh 2y ago
104 d377c4c Dawsh 2y ago <script>
105 d377c4c Dawsh 2y ago
106 d377c4c Dawsh 2y ago function copyLink(link, button) {
107 d377c4c Dawsh 2y ago const tempInput = document.createElement('input');
108 d377c4c Dawsh 2y ago tempInput.setAttribute('value', link);
109 d377c4c Dawsh 2y ago document.body.appendChild(tempInput);
110 d377c4c Dawsh 2y ago tempInput.select();
111 d377c4c Dawsh 2y ago document.execCommand('copy');
112 d377c4c Dawsh 2y ago document.body.removeChild(tempInput);
113 d377c4c Dawsh 2y ago
114 d377c4c Dawsh 2y ago button.textContent = 'Copied!';
115 d377c4c Dawsh 2y ago setTimeout(function () {
116 d377c4c Dawsh 2y ago button.textContent = 'Copy';
117 d377c4c Dawsh 2y ago }, 1500);
118 d377c4c Dawsh 2y ago }
119 d377c4c Dawsh 2y ago
120 d377c4c Dawsh 2y ago const qrButtons = document.querySelectorAll('.qr-button');
121 d377c4c Dawsh 2y ago const qrPopup = document.getElementById('qrPopup');
122 d377c4c Dawsh 2y ago
123 d377c4c Dawsh 2y ago qrButtons.forEach((qrButton) => {
124 d377c4c Dawsh 2y ago qrButton.addEventListener('click', () => {
125 d377c4c Dawsh 2y ago const link = qrButton.dataset.link;
126 d377c4c Dawsh 2y ago while (qrCodeContainer.firstChild) {
127 d377c4c Dawsh 2y ago qrCodeContainer.removeChild(qrCodeContainer.firstChild);
128 d377c4c Dawsh 2y ago }
129 d377c4c Dawsh 2y ago const qrCode = new QRCode(qrCodeContainer, {
130 d377c4c Dawsh 2y ago text: link,
131 d377c4c Dawsh 2y ago width: 256,
132 d377c4c Dawsh 2y ago height: 256
133 a47eb4c Dawsh 2y ago });
134 d377c4c Dawsh 2y ago qrPopup.style.display = 'block';
135 a47eb4c Dawsh 2y ago });
136 d377c4c Dawsh 2y ago });
137 d377c4c Dawsh 2y ago function closeQrPopup() {
138 d377c4c Dawsh 2y ago document.getElementById('qrPopup').style.display = 'none';
139 d377c4c Dawsh 2y ago }
140 d377c4c Dawsh 2y ago </script>
141 a47eb4c Dawsh 2y ago </body>
142 a47eb4c Dawsh 2y ago
143 a47eb4c Dawsh 2y ago </html>