option to keep all activities private from strava zip, fix copy of register link

This commit is contained in:
Davide Scaini
2026-04-10 22:51:29 +02:00
parent da622131fd
commit bc30e0a2fc
5 changed files with 41 additions and 7 deletions
+7
View File
@@ -338,6 +338,11 @@ try {
<div id="zip-label">Drop your Strava export .zip<br/>or click to browse</div>
<input id="zip-input" type="file" accept=".zip" class="hidden" />
</div>
<label class="flex items-center gap-2 mt-3 text-xs text-zinc-400 cursor-pointer select-none">
<input id="zip-private" type="checkbox" class="accent-blue-500" />
Mark all imported activities as private
<span class="text-zinc-600">(Strava export doesn't include privacy settings)</span>
</label>
<p id="zip-status" class="mt-3 text-xs text-center leading-relaxed" style="min-height: 1.25rem"></p>
</div>
</div>
@@ -447,6 +452,7 @@ try {
const zipInput = document.getElementById('zip-input');
const zipLabel = document.getElementById('zip-label');
const zipStatus = document.getElementById('zip-status');
const zipPrivate = document.getElementById('zip-private');
const drop = document.getElementById('upload-drop');
const input = document.getElementById('upload-input');
const label = document.getElementById('upload-label');
@@ -690,6 +696,7 @@ try {
const fd = new FormData();
fd.append('file', file);
fd.append('private', zipPrivate?.checked ? 'true' : 'false');
// POST the file; server responds with SSE stream immediately after receiving body
const xhr = new XMLHttpRequest();
+21 -3
View File
@@ -47,6 +47,17 @@ import Base from '../../layouts/Base.astro';
return li;
}
function fallbackCopy(text: string, done: () => void) {
const ta = document.createElement('textarea');
ta.value = text;
ta.style.cssText = 'position:fixed;opacity:0;top:0;left:0';
document.body.appendChild(ta);
ta.focus();
ta.select();
try { document.execCommand('copy'); done(); } catch (_) {}
document.body.removeChild(ta);
}
async function loadInvites() {
try {
const r = await fetch('/api/invites', { credentials: 'include' });
@@ -66,9 +77,16 @@ import Base from '../../layouts/Base.astro';
// Copy link buttons
listEl.querySelectorAll('.copy-btn').forEach(btn => {
btn.addEventListener('click', () => {
navigator.clipboard.writeText((btn as HTMLElement).dataset.link ?? '');
btn.textContent = 'Copied!';
setTimeout(() => { btn.textContent = 'Copy link'; }, 2000);
const text = (btn as HTMLElement).dataset.link ?? '';
const done = () => {
btn.textContent = 'Copied!';
setTimeout(() => { btn.textContent = 'Copy link'; }, 2000);
};
if (navigator.clipboard) {
navigator.clipboard.writeText(text).then(done).catch(() => fallbackCopy(text, done));
} else {
fallbackCopy(text, done);
}
});
});
} catch (e: any) {