暂存-说明文档(部分)

This commit is contained in:
2026-05-16 00:45:51 +08:00
parent 91bedce2d7
commit 9c8de5e664
63 changed files with 2818 additions and 92 deletions

View File

@@ -35,8 +35,25 @@
{% endif %}
</td>
<td>
<small class="text-muted d-block">STL: {{ user_quotas[user.id]['stl'] if user_quotas[user.id]['stl'] != '0' else _('Unlimited') }} MB</small>
<small class="text-muted d-block">GCode: {{ user_quotas[user.id]['gcode'] if user_quotas[user.id]['gcode'] != '0' else _('Unlimited') }} MB</small>
{% if user.is_admin %}
<small class="text-muted d-block">STL: {{ _('Unlimited') }}</small>
<small class="text-muted d-block">GCode: {{ _('Unlimited') }}</small>
{% else %}
<small class="text-muted d-block">STL:
{% if user_quotas[user.id]['stl'] == '0' %}
{{ _('Default') }} ({{ user_quotas[user.id]['eff_stl'] if user_quotas[user.id]['eff_stl'] != '0' else _('Unlimited') }} MB)
{% else %}
{{ user_quotas[user.id]['stl'] }} MB
{% endif %}
</small>
<small class="text-muted d-block">GCode:
{% if user_quotas[user.id]['gcode'] == '0' %}
{{ _('Default') }} ({{ user_quotas[user.id]['eff_gcode'] if user_quotas[user.id]['eff_gcode'] != '0' else _('Unlimited') }} MB)
{% else %}
{{ user_quotas[user.id]['gcode'] }} MB
{% endif %}
</small>
{% endif %}
</td>
<td>{{ user.created_at.strftime('%Y-%m-%d %H:%M') }}</td>
<td>
@@ -66,11 +83,11 @@
</div>
<div class="modal-body">
<div class="mb-3">
<label class="form-label">{{ _('STL Quota') }} (MB) <small class="text-muted">(0 = {{ _('Unlimited') }})</small></label>
<label class="form-label">{{ _('STL Quota') }} (MB) <small class="text-muted">(0 = {{ _('Default') }})</small></label>
<input type="number" class="form-control" name="stl_quota_mb" value="{{ user_quotas[user.id]['stl'] }}" min="0">
</div>
<div class="mb-3">
<label class="form-label">{{ _('GCode Quota') }} (MB) <small class="text-muted">(0 = {{ _('Unlimited') }})</small></label>
<label class="form-label">{{ _('GCode Quota') }} (MB) <small class="text-muted">(0 = {{ _('Default') }})</small></label>
<input type="number" class="form-control" name="gcode_quota_mb" value="{{ user_quotas[user.id]['gcode'] }}" min="0">
</div>
</div>

View File

@@ -4,6 +4,7 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>AIO 3D Slicer</title>
<link href="{{ url_for('static', filename='img/favicon.ico') }}" rel="icon" type="image/x-icon">
<!-- Bootstrap 5 CSS -->
<link href="{{ url_for('static', filename='css/bootstrap.min.css') }}" rel="stylesheet">
<!-- Bootstrap Icons -->
@@ -131,6 +132,11 @@
<i class="bi bi-arrows-move me-2"></i>{{ _('Control') }}
</a>
</li>
<li class="nav-item mb-1">
<a class="nav-link text-dark {% if request.endpoint == 'printer.helper_printer' %}active text-white shadow-sm{% endif %}" href="{{ url_for('printer.helper_printer') }}">
<i class="bi bi-question-square me-2"></i>{{ _('Printer Helper') }}
</a>
</li>
<!-- {% if current_user.is_authenticated and not current_user.is_guest %}
<li class="nav-item mb-1">
<a class="nav-link text-dark {% if request.endpoint == 'main.account' %}active text-white shadow-sm{% endif %}" href="{{ url_for('main.account') }}">
@@ -185,6 +191,11 @@
</a>
</li>
{% endif %}
<li class="nav-item mb-1">
<a class="nav-link text-dark {% if request.endpoint == 'main.helper_slice' %}active text-white shadow-sm{% endif %}" href="{{ url_for('main.helper_slice') }}">
<i class="bi bi-question-square me-2"></i>{{ _('Slice Helper') }}
</a>
</li>
</ul>
{% if current_user.is_authenticated and current_user.is_admin %}

View File

@@ -0,0 +1,56 @@
{% extends 'base.html' %}
{% block content %}
<div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 mb-3 border-bottom">
<h1 class="h2">{{ _('Printer Helper') }}</h1>
</div>
<div class="row">
<!-- Helper Content -->
<div class="col-12 markdown-body p-4 bg-white rounded shadow-sm">
{% if content_html %}
{{ content_html|safe }}
{% else %}
<p class="text-muted">{{ _('Documentation not available.') }}</p>
{% endif %}
</div>
</div>
<style>
/* 简单的 Markdown 样式优化 */
.markdown-body h1, .markdown-body h2, .markdown-body h3 {
margin-top: 24px;
margin-bottom: 16px;
font-weight: 600;
}
.markdown-body h1 {
font-size: 2em;
padding-bottom: .3em;
border-bottom: 1px solid #eaecef;
}
.markdown-body img {
max-width: 100%;
height: auto;
border-radius: 6px;
}
.markdown-body pre {
background-color: #f6f8fa;
padding: 16px;
border-radius: 6px;
overflow-x: auto;
}
.markdown-body code {
font-family: SFMono-Regular,Consolas,Liberation Mono,Menlo,monospace;
}
.markdown-body table {
width: 100%;
margin-bottom: 1rem;
color: #212529;
border-collapse: collapse;
}
.markdown-body table th, .markdown-body table td {
padding: 0.5rem;
border: 1px solid #dee2e6;
}
</style>
{% endblock %}

View File

@@ -84,7 +84,7 @@
<span class="badge bg-secondary font-monospace">{{ s.ip_address }}</span>
</td>
<td>
<small class="text-muted">{{ s.last_active.strftime('%Y-%m-%d %H:%M:%S') }}</small>
<small class="text-muted local-time" data-utc="{{ s.last_active.isoformat() }}Z">{{ s.last_active.strftime('%Y-%m-%d %H:%M:%S') }}</small>
</td>
<td class="text-end pe-4">
{% if s.session_token != current_token %}
@@ -111,4 +111,24 @@
</div>
</div>
</div>
<script>
document.addEventListener("DOMContentLoaded", function() {
document.querySelectorAll('.local-time').forEach(function(el) {
const utcDate = new Date(el.getAttribute('data-utc'));
if (!isNaN(utcDate)) {
const pad = (n) => n.toString().padStart(2, '0');
const yyyy = utcDate.getFullYear();
const MM = pad(utcDate.getMonth() + 1);
const dd = pad(utcDate.getDate());
const HH = pad(utcDate.getHours());
const mm = pad(utcDate.getMinutes());
const ss = pad(utcDate.getSeconds());
el.textContent = `${yyyy}-${MM}-${dd} ${HH}:${mm}:${ss}`;
}
});
});
</script>
{% endblock %}

View File

@@ -0,0 +1,56 @@
{% extends 'base.html' %}
{% block content %}
<div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 mb-3 border-bottom">
<h1 class="h2">{{ _('Slice Helper') }}</h1>
</div>
<div class="row">
<!-- Helper Content -->
<div class="col-12 markdown-body p-4 bg-white rounded shadow-sm">
{% if content_html %}
{{ content_html|safe }}
{% else %}
<p class="text-muted">{{ _('Documentation not available.') }}</p>
{% endif %}
</div>
</div>
<style>
/* 简单的 Markdown 样式优化 */
.markdown-body h1, .markdown-body h2, .markdown-body h3 {
margin-top: 24px;
margin-bottom: 16px;
font-weight: 600;
}
.markdown-body h1 {
font-size: 2em;
padding-bottom: .3em;
border-bottom: 1px solid #eaecef;
}
.markdown-body img {
max-width: 100%;
height: auto;
border-radius: 6px;
}
.markdown-body pre {
background-color: #f6f8fa;
padding: 16px;
border-radius: 6px;
overflow-x: auto;
}
.markdown-body code {
font-family: SFMono-Regular,Consolas,Liberation Mono,Menlo,monospace;
}
.markdown-body table {
width: 100%;
margin-bottom: 1rem;
color: #212529;
border-collapse: collapse;
}
.markdown-body table th, .markdown-body table td {
padding: 0.5rem;
border: 1px solid #dee2e6;
}
</style>
{% endblock %}