44c54d6f80
Co-authored-by: Cursor <cursoragent@cursor.com>
98 lines
3.6 KiB
HTML
98 lines
3.6 KiB
HTML
{% extends "base.html" %}
|
|
{% block title %}下载中心 · {{ app_name }}{% endblock %}
|
|
{% block content %}
|
|
<h2 style="margin:0 0 14px">下载中心</h2>
|
|
<div class="grid cols-2">
|
|
<div class="card">
|
|
<h3>通用辅助包</h3>
|
|
<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>
|
|
{% else %}
|
|
<p><span class="tag gray">尚未放置 exe</span></p>
|
|
<p class="muted">请把打包文件放到服务器 <code>releases/黄金市价辅助.exe</code>。当前可下载说明文件。</p>
|
|
<a class="btn secondary" href="{{ url_for('download_file') }}">下载说明</a>
|
|
{% endif %}
|
|
</div>
|
|
<div class="card">
|
|
<h3>生成激活码</h3>
|
|
<p class="muted">管理员与普通用户均可发放;普通用户只能发给自己的账户。</p>
|
|
<form method="post" action="{{ url_for('download_create_activation') }}">
|
|
<div class="form-row">
|
|
<label>绑定账户</label>
|
|
<select name="account_id" required>
|
|
{% for a in accounts %}
|
|
<option value="{{ a.id }}">#{{ a.id }} {{ a.name }}</option>
|
|
{% endfor %}
|
|
</select>
|
|
</div>
|
|
<div class="form-row">
|
|
<label>预绑定机器(可选)</label>
|
|
<select name="machine_id">
|
|
<option value="">激活时自动创建</option>
|
|
{% for m in machines %}
|
|
<option value="{{ m.id }}">#{{ m.id }} {{ m.name }}</option>
|
|
{% endfor %}
|
|
</select>
|
|
</div>
|
|
<button class="btn" type="submit">生成激活码</button>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="card" style="margin-top:14px">
|
|
<h3>激活码列表</h3>
|
|
<table>
|
|
<thead><tr><th>激活码</th><th>账户</th><th>机器</th><th>状态</th><th>创建时间</th></tr></thead>
|
|
<tbody>
|
|
{% for a in activations %}
|
|
<tr>
|
|
<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>
|
|
{% 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>
|
|
{% endfor %}
|
|
</tbody>
|
|
</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 %}
|