modified: templates/itemeditor_command_storage.html

This commit is contained in:
SimolZimol
2026-01-07 03:55:19 +01:00
parent 9e0a1abb53
commit ff5b0c3a54

View File

@@ -109,18 +109,25 @@
<div class="info-card"> <div class="info-card">
<div class="info-icon"> <div class="info-icon">
<i class="fas fa-code"></i> <i class="fas fa-server"></i>
</div> </div>
<h3>Plugin Usage</h3> <h3>Self-Hosting on Your Webserver</h3>
<p class="code-description">Load command in your plugin:</p> <p class="code-description">You can run this command storage system on your own webserver for production use:</p>
<pre class="code-block">GET https://devanturas.net/projects/itemeditor/storage/{uuid} <ol class="info-steps">
<li>Install <strong>Python 3.10+</strong> and <strong>Flask</strong> on your server</li>
Response: <li>Deploy the Flask app using a production WSGI server like <strong>Gunicorn</strong> or <strong>uWSGI</strong></li>
<li>Use a reverse proxy (e.g. <strong>Nginx</strong> or <strong>Apache</strong>) to route traffic to the Flask app</li>
<li>Optional: Use <strong>Docker</strong> for easy deployment (see <code>Dockerfile</code> in the project)</li>
<li>Access via: <br><code>https://your-domain/projects/itemeditor/storage</code></li>
<li>API endpoint: <br><code>https://your-domain/projects/itemeditor/storage/&lt;uuid&gt;</code></li>
</ol>
<p class="code-block">GET https://your-domain/projects/itemeditor/storage/&lt;uuid&gt;
{ {
"command": "your command here", "command": "your command here",
"created_at": "2026-01-07T12:00:00", "created_at": "...",
"expires_at": "2026-01-07T12:30:00" "expires_at": "..."
}</pre> }</p>
<p class="code-description">For best performance and security, do <strong>not</strong> use the Flask development server in production. Use Gunicorn + Nginx or Docker for real deployments.</p>
</div> </div>
</div> </div>
</div> </div>
@@ -489,6 +496,12 @@ function startCountdown(expiresAt) {
const expiryTime = document.getElementById('expiryTime'); const expiryTime = document.getElementById('expiryTime');
const endTime = new Date(expiresAt).getTime(); const endTime = new Date(expiresAt).getTime();
// If expiry is in the past, show expired immediately
if (endTime < new Date().getTime()) {
expiryTime.innerHTML = '<span style="color: #ff5555;">Expired</span>';
return;
}
const interval = setInterval(() => { const interval = setInterval(() => {
const now = new Date().getTime(); const now = new Date().getTime();
const distance = endTime - now; const distance = endTime - now;
@@ -501,7 +514,6 @@ function startCountdown(expiresAt) {
const minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60)); const minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
const seconds = Math.floor((distance % (1000 * 60)) / 1000); const seconds = Math.floor((distance % (1000 * 60)) / 1000);
expiryTime.textContent = `${minutes}m ${seconds}s`; expiryTime.textContent = `${minutes}m ${seconds}s`;
}, 1000); }, 1000);
} }