Download center: copy code, online/offline status; remove client offline mode.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-10-17 20:09:22 +08:00
parent 09c7ee0188
commit 44c54d6f80
6 changed files with 144 additions and 52 deletions
+38 -4
View File
@@ -5,7 +5,7 @@
<div class="grid cols-2">
<div class="card">
<h3>通用辅助包</h3>
<p class="muted">所有机器下载同一 exe。首次启动输入激活码,绑定账户与机器标识。</p>
<p class="muted">所有机器下载同一 exe。首次启动输入激活码,绑定账户与机器标识(须在线,不允许离线运行)。</p>
{% if exe_ready %}
<p><span class="tag green">已上传 {{ exe_name }}</span></p>
<a class="btn" href="{{ url_for('download_file') }}">下载 exe</a>
@@ -48,11 +48,21 @@
<tbody>
{% for a in activations %}
<tr>
<td><code>{{ a.code }}</code></td>
<td>
<code id="code-{{ loop.index }}">{{ a.code }}</code>
<button type="button" class="btn secondary btn-copy" style="margin-left:8px;padding:4px 10px;font-size:12px"
data-code="{{ a.code }}">复制</button>
</td>
<td>{{ a.account_name or a.account_id }}</td>
<td>{{ a.machine_name or a.machine_id or '—' }}</td>
<td><span class="tag {% if a.status=='active' %}green{% else %}gray{% endif %}">{{ a.status }}</span></td>
<td class="muted">{{ a.created_at }}</td>
<td>
{% if a.online %}
<span class="tag green">在线</span>
{% else %}
<span class="tag gray">离线</span>
{% endif %}
</td>
<td class="muted">{{ a.created_at_fmt }}</td>
</tr>
{% else %}
<tr><td colspan="5" class="muted">暂无激活码</td></tr>
@@ -61,3 +71,27 @@
</table>
</div>
{% endblock %}
{% block scripts %}
<script>
document.querySelectorAll('.btn-copy').forEach(function (btn) {
btn.addEventListener('click', function () {
var code = btn.getAttribute('data-code') || '';
function done(ok) {
var old = btn.textContent;
btn.textContent = ok ? '已复制' : '失败';
setTimeout(function () { btn.textContent = old; }, 1200);
}
if (navigator.clipboard && navigator.clipboard.writeText) {
navigator.clipboard.writeText(code).then(function () { done(true); }).catch(function () { done(false); });
} else {
var ta = document.createElement('textarea');
ta.value = code;
document.body.appendChild(ta);
ta.select();
try { document.execCommand('copy'); done(true); } catch (e) { done(false); }
document.body.removeChild(ta);
}
});
});
</script>
{% endblock %}