Templating
This commit is contained in:
35
views/partials/api-endpoints.html
Normal file
35
views/partials/api-endpoints.html
Normal file
@@ -0,0 +1,35 @@
|
||||
{{define "api-endpoints"}}
|
||||
<h2>📋 API endpoints</h2>
|
||||
|
||||
<div class="endpoint">
|
||||
<button class="copy-btn" onclick="copyToClipboard('curl -X POST -F "file=@/path/to/your/file.txt" {{.BaseURL}}/upload')">📋 Copy</button>
|
||||
<h3><span class="method post">POST</span>/upload</h3>
|
||||
<p><strong>Description:</strong> Upload a file</p>
|
||||
<p><strong>cURL example:</strong></p>
|
||||
<pre><code>curl -X POST -F "file=@/path/to/your/file.txt" {{.BaseURL}}/upload</code></pre>
|
||||
</div>
|
||||
|
||||
<div class="endpoint">
|
||||
<button class="copy-btn" onclick="copyToClipboard('curl -O {{.BaseURL}}/uploads/{fileID}/{filename}')">📋 Copy</button>
|
||||
<h3><span class="method get">GET</span>/uploads/{fileID}/{filename}</h3>
|
||||
<p><strong>Description:</strong> Download a file using the ID and filename from upload response</p>
|
||||
<p><strong>cURL example:</strong></p>
|
||||
<pre><code>curl -O {{.BaseURL}}/uploads/{fileID}/{filename}</code></pre>
|
||||
</div>
|
||||
|
||||
<div class="endpoint">
|
||||
<button class="copy-btn" onclick="copyToClipboard('curl {{.BaseURL}}/storage')">📋 Copy</button>
|
||||
<h3><span class="method get">GET</span>/storage</h3>
|
||||
<p><strong>Description:</strong> Check storage usage and capacity</p>
|
||||
<p><strong>cURL example:</strong></p>
|
||||
<pre><code>curl {{.BaseURL}}/storage</code></pre>
|
||||
</div>
|
||||
|
||||
<div class="endpoint">
|
||||
<button class="copy-btn" onclick="copyToClipboard('curl {{.BaseURL}}/health')">📋 Copy</button>
|
||||
<h3><span class="method get">GET</span>/health</h3>
|
||||
<p><strong>Description:</strong> Check service health</p>
|
||||
<p><strong>cURL example:</strong></p>
|
||||
<pre><code>curl {{.BaseURL}}/health</code></pre>
|
||||
</div>
|
||||
{{end}}
|
||||
15
views/partials/changelog.html
Normal file
15
views/partials/changelog.html
Normal file
@@ -0,0 +1,15 @@
|
||||
{{define "changelog"}}
|
||||
<div class="changelog-wrapper">
|
||||
<div class="changelog-section">
|
||||
<h2>📝 Changelog</h2>
|
||||
|
||||
<div class="changelog-entry">
|
||||
<div class="version">v1.0.0</div>
|
||||
<div class="date">2024-12-01</div>
|
||||
<ul>
|
||||
<li>Initial release</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{end}}
|
||||
6
views/partials/header.html
Normal file
6
views/partials/header.html
Normal file
@@ -0,0 +1,6 @@
|
||||
{{define "header"}}
|
||||
<h1>🚀 FITRA - File transfer API</h1>
|
||||
<div class="version-badge">Version 1.0.0</div>
|
||||
<p>Simple file upload and download service for developers using HTTP requests in CLI.</p>
|
||||
<p>Contact me on Matrix: <b>@root@adhd.sh</b> or via Discord: <b>nu11ed</b></p>
|
||||
{{end}}
|
||||
16
views/partials/storage-info.html
Normal file
16
views/partials/storage-info.html
Normal file
@@ -0,0 +1,16 @@
|
||||
{{define "storage-info"}}
|
||||
<div class="storage-info">
|
||||
<h3>💾 Todays storage usage</h3>
|
||||
<p>
|
||||
<small>This resets after 24h</small>
|
||||
</p>
|
||||
<div class="progress-bar">
|
||||
<div class="progress-fill" id="progress-fill" style="width: 0%"></div>
|
||||
</div>
|
||||
<div class="storage-stats">
|
||||
<span id="storage-used">Loading...</span>
|
||||
<span id="storage-percent">Loading...</span>
|
||||
<span id="storage-total">Loading...</span>
|
||||
</div>
|
||||
</div>
|
||||
{{end}}
|
||||
26
views/partials/usage-examples.html
Normal file
26
views/partials/usage-examples.html
Normal file
@@ -0,0 +1,26 @@
|
||||
{{define "usage-examples"}}
|
||||
<h2>🔄 Usage</h2>
|
||||
<div class="step">
|
||||
<strong>Step 1:</strong> Upload a file using POST /upload with form-data 'file' parameter
|
||||
</div>
|
||||
<div class="step">
|
||||
<strong>Step 2:</strong> Use the returned 'id' and 'filename' to construct download URL
|
||||
</div>
|
||||
<div class="step">
|
||||
<strong>Step 3:</strong> Download the file using GET /uploads/{id}/{filename}
|
||||
</div>
|
||||
|
||||
<h2>💡 Examples</h2>
|
||||
<pre><code># 1. Upload a file
|
||||
curl -X POST -F "file=@myfile.txt" {{.BaseURL}}/upload
|
||||
|
||||
# Response will include:
|
||||
# {
|
||||
# "id": "abc123...",
|
||||
# "filename": "myfile.txt",
|
||||
# "url": "{{.BaseURL}}/uploads/abc123.../myfile.txt"
|
||||
# }
|
||||
|
||||
# 2. Download the file
|
||||
curl -O {{.BaseURL}}/uploads/abc123.../myfile.txt</code></pre>
|
||||
{{end}}
|
||||
Reference in New Issue
Block a user