4.1.4: QR sharing, venv tarball, flash script improvements
QR Channel Key Sharing: - Admin-only QR generator in about.html (was visible to all) - QR button for saved keys on account page - Fixed about() route missing channel status vars (bug) Pi Build Optimization: - Pre-built venv tarball support (39MB zstd, skips 20+ min compile) - setup.sh auto-detects and extracts tarball if present - Strip __pycache__/tests before tarball (295MB → 208MB) Flash Script Improvements: - flash-image.sh now uses config.json for headless WiFi setup - Consistent wipe prompt on both flash scripts - pull-image.sh re-enables auto-expand before shrinking Build Docs: - Added zstd and jq to pre-setup apt-get - Documented fast build option with pre-built venv 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -140,6 +140,13 @@
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="btn-group btn-group-sm">
|
||||
{% if is_admin %}
|
||||
<button type="button" class="btn btn-outline-info"
|
||||
onclick="showKeyQr('{{ key.channel_key }}', '{{ key.name }}')"
|
||||
title="Show QR Code">
|
||||
<i class="bi bi-qr-code"></i>
|
||||
</button>
|
||||
{% endif %}
|
||||
<button type="button" class="btn btn-outline-secondary"
|
||||
onclick="renameKey({{ key.id }}, '{{ key.name }}')"
|
||||
title="Rename">
|
||||
@@ -218,10 +225,38 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% if is_admin %}
|
||||
<!-- QR Code Modal (Admin only) -->
|
||||
<div class="modal fade" id="qrModal" tabindex="-1">
|
||||
<div class="modal-dialog modal-sm">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h6 class="modal-title"><i class="bi bi-qr-code me-2"></i><span id="qrKeyName">Channel Key</span></h6>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal"></button>
|
||||
</div>
|
||||
<div class="modal-body text-center">
|
||||
<canvas id="qrCanvas" class="bg-white p-2 rounded"></canvas>
|
||||
<div class="mt-2">
|
||||
<code class="small" id="qrKeyDisplay"></code>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer justify-content-center">
|
||||
<button type="button" class="btn btn-sm btn-outline-secondary" id="qrDownload">
|
||||
<i class="bi bi-download me-1"></i>Download PNG
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
{% block scripts %}
|
||||
<script src="{{ url_for('static', filename='js/auth.js') }}"></script>
|
||||
{% if is_admin %}
|
||||
<script src="https://cdn.jsdelivr.net/npm/qrcode@1.5.3/build/qrcode.min.js"></script>
|
||||
{% endif %}
|
||||
<script>
|
||||
StegasooAuth.initPasswordConfirmation('accountForm', 'newPasswordInput', 'newPasswordConfirmInput');
|
||||
|
||||
@@ -230,5 +265,45 @@ function renameKey(keyId, currentName) {
|
||||
document.getElementById('renameForm').action = '/account/keys/' + keyId + '/rename';
|
||||
new bootstrap.Modal(document.getElementById('renameModal')).show();
|
||||
}
|
||||
|
||||
{% if is_admin %}
|
||||
function showKeyQr(channelKey, keyName) {
|
||||
// Format key with dashes if not already
|
||||
const clean = channelKey.replace(/-/g, '').toUpperCase();
|
||||
const formatted = clean.match(/.{4}/g)?.join('-') || clean;
|
||||
|
||||
// Update modal content
|
||||
document.getElementById('qrKeyName').textContent = keyName;
|
||||
document.getElementById('qrKeyDisplay').textContent = formatted;
|
||||
|
||||
// Generate QR code
|
||||
const canvas = document.getElementById('qrCanvas');
|
||||
if (typeof QRCode !== 'undefined' && canvas) {
|
||||
QRCode.toCanvas(canvas, formatted, {
|
||||
width: 200,
|
||||
margin: 2,
|
||||
color: { dark: '#000', light: '#fff' }
|
||||
}, function(error) {
|
||||
if (error) {
|
||||
console.error('QR generation error:', error);
|
||||
return;
|
||||
}
|
||||
new bootstrap.Modal(document.getElementById('qrModal')).show();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// Download QR as PNG
|
||||
document.getElementById('qrDownload')?.addEventListener('click', function() {
|
||||
const canvas = document.getElementById('qrCanvas');
|
||||
const keyName = document.getElementById('qrKeyName').textContent;
|
||||
if (canvas) {
|
||||
const link = document.createElement('a');
|
||||
link.download = 'stegasoo-channel-key-' + keyName.toLowerCase().replace(/\s+/g, '-') + '.png';
|
||||
link.href = canvas.toDataURL('image/png');
|
||||
link.click();
|
||||
}
|
||||
});
|
||||
{% endif %}
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
||||
Reference in New Issue
Block a user