"keep data on the server" opt-in/out

This commit is contained in:
Davide Scaini
2026-04-10 13:01:21 +02:00
parent 5170afa9e8
commit 469a5954cc
6 changed files with 77 additions and 15 deletions
+22 -4
View File
@@ -175,6 +175,7 @@ try {
{mobileApp && (
<a href={`${baseUrl}convert/`} class="text-sm text-zinc-400 hover:text-white transition-colors">Convert</a>
)}
<a href={`${baseUrl}about/`} class="text-sm text-zinc-400 hover:text-white transition-colors">About</a>
</>
)}
@@ -259,6 +260,17 @@ try {
<div id="upload-label">Drop FIT, GPX, or TCX files<br/>or click to browse</div>
<input id="upload-input" type="file" accept=".fit,.gpx,.tcx,.fit.gz,.gpx.gz,.tcx.gz" class="hidden" multiple />
</div>
<label class="flex items-start gap-2 mt-3 cursor-pointer group">
<input
id="upload-keep-original"
type="checkbox"
class="mt-0.5 accent-blue-500 shrink-0"
/>
<span class="text-xs text-zinc-500 group-hover:text-zinc-300 transition-colors leading-snug">
Keep original file on server
<span class="text-zinc-600 block mt-0.5">Lets you reprocess if the format changes. See the <a href={`${baseUrl}about/`} class="underline hover:text-zinc-400">About page</a> for details.</span>
</span>
</label>
<p id="upload-status" class="mt-3 text-xs text-center" style="color: var(--text-5); min-height: 1.25rem"></p>
</div>
@@ -366,6 +378,10 @@ try {
// Show logout button
const logoutEl = document.getElementById('nav-logout');
if (logoutEl) logoutEl.style.display = '';
// Pre-populate the "keep original" checkbox from the instance default
const chk = document.getElementById('upload-keep-original');
if (chk && user.store_originals_default) chk.checked = true;
} catch (_) {}
})();
@@ -388,10 +404,11 @@ try {
const chooseStrava = document.getElementById('upload-choose-strava');
const backFile = document.getElementById('upload-back-file');
const backStrava = document.getElementById('upload-back-strava');
const drop = document.getElementById('upload-drop');
const input = document.getElementById('upload-input');
const label = document.getElementById('upload-label');
const fileStatus = document.getElementById('upload-status');
const drop = document.getElementById('upload-drop');
const input = document.getElementById('upload-input');
const label = document.getElementById('upload-label');
const keepOriginalChk = document.getElementById('upload-keep-original');
const fileStatus = document.getElementById('upload-status');
const stravaStatus = document.getElementById('strava-status');
const stravaConnect = document.getElementById('strava-connect-area');
const stravaSync = document.getElementById('strava-sync-area');
@@ -449,6 +466,7 @@ try {
drop.style.pointerEvents = 'none';
const fd = new FormData();
for (const f of files) fd.append('files', f);
fd.append('store_original', keepOriginalChk?.checked ? 'true' : 'false');
try {
const r = await fetch(`${editUrl}/api/upload`, { method: 'POST', credentials: 'include', body: fd });
if (!r.ok) throw new Error(await r.text());