BlueGit

timfa filemanager

chore: enforce British English and translate share/conflict UI copy

timfa Tim Falken · pushed by timfa

Authored 2026-05-07 · 6 months ago

Hash
8a66a2b51d6512f8c3416de5694567e7bf35e340
Parent
fffc2d3b
4 files changed +72 −68
.github/copilot-instructions.md +35 −31
@@ -1,31 +1,35 @@
1 # AI Coding Agent Instructions for Filemanager
2
3 ## Architecture Essentials
4
5 ### Technical Specifications
6 - For every file and implementation, log the file and all of its classes and functions in `.github/technical-reference.md`
7 - When functionality is modified or added, update that file.
8 - Reference the file before making changes to ensure no duplicate functionality is made
9 - the file serves as an index and reference for the code architecture, as well as individual classes and methods.
10 - Keep it short and specific; no paragraphs of explanation, only a simple notation of a file, class or method and a one-line description of what it does, what it should be used for, and what to keep into account when using it.
11 - `.github/tests.md` is an index of every test file and every test name inside it. Keep it up to date whenever tests are added, removed, or renamed. Reference it to understand existing coverage before deciding whether to add a new test.
12
13
14 ## Developer Workflows
15
16 ### Git authoring
17 - When starting work on something, create a feature or fix branch
18 - When concrete, complete steps are made, create a commit in that branch
19 - Try to commit frequently, chunking work into individual steps
20 - When all work is done, merge the branch into master, and then delete it so only master remains
21 - Ensure you don't leave old branches you've made in git and that everything is merged neatly.
22 - Always run the full test suite and fix any issues (including unrelated to your work) before merging to master.
23
24 ## Testing Expectations
25 - **Default rule:** every new feature should receive a test that verifies it behaves as requested.
26 - If a very similar test already exists, expand or adapt that test instead of creating duplicate coverage.
27 - When a change affects an area that existing tests are meant to cover, update those tests so the new behavior is validated too.
28 - After modifying any function or module, check `tests.md` for tests that exercise that code path — directly or indirectly — and verify those tests still reflect the current behavior. If they no longer do, update them before finishing.
29 - When encountering existing functionality that is not covered by tests, automatically add coverage for it unless it is extremely simple; for extremely simple cases, ask the user first before skipping the test.
30 - Only skip adding a test, or ask the user first, when the change is truly tiny or not behaviorally meaningful (for example: wording-only copy edits, comments, or other negligible changes).
31 - Prefer reusing production helpers and real code paths in tests rather than duplicating business logic in test-only code.
1 # AI Coding Agent Instructions for Filemanager
2
3 ## Architecture Essentials
4
5 ### Language & Copy
6 - User-facing website copy must be in British English.
7 - New or modified UI text (buttons, labels, dialogs, errors, tooltips, share pages) must be in British English.
8
9 ### Technical Specifications
10 - For every file and implementation, log the file and all of its classes and functions in `.github/technical-reference.md`
11 - When functionality is modified or added, update that file.
12 - Reference the file before making changes to ensure no duplicate functionality is made
13 - the file serves as an index and reference for the code architecture, as well as individual classes and methods.
14 - Keep it short and specific; no paragraphs of explanation, only a simple notation of a file, class or method and a one-line description of what it does, what it should be used for, and what to keep into account when using it.
15 - `.github/tests.md` is an index of every test file and every test name inside it. Keep it up to date whenever tests are added, removed, or renamed. Reference it to understand existing coverage before deciding whether to add a new test.
16
17
18 ## Developer Workflows
19
20 ### Git authoring
21 - When starting work on something, create a feature or fix branch
22 - When concrete, complete steps are made, create a commit in that branch
23 - Try to commit frequently, chunking work into individual steps
24 - When all work is done, merge the branch into master, and then delete it so only master remains
25 - Ensure you don't leave old branches you've made in git and that everything is merged neatly.
26 - Always run the full test suite and fix any issues (including unrelated to your work) before merging to master.
27
28 ## Testing Expectations
29 - **Default rule:** every new feature should receive a test that verifies it behaves as requested.
30 - If a very similar test already exists, expand or adapt that test instead of creating duplicate coverage.
31 - When a change affects an area that existing tests are meant to cover, update those tests so the new behavior is validated too.
32 - After modifying any function or module, check `tests.md` for tests that exercise that code path — directly or indirectly — and verify those tests still reflect the current behavior. If they no longer do, update them before finishing.
33 - When encountering existing functionality that is not covered by tests, automatically add coverage for it unless it is extremely simple; for extremely simple cases, ask the user first before skipping the test.
34 - Only skip adding a test, or ask the user first, when the change is truly tiny or not behaviorally meaningful (for example: wording-only copy edits, comments, or other negligible changes).
35 - Prefer reusing production helpers and real code paths in tests rather than duplicating business logic in test-only code.
@@ -1,31 +1,35 @@
1# AI Coding Agent Instructions for Filemanager
1# AI Coding Agent Instructions for Filemanager
2
2
3## Architecture Essentials
3## Architecture Essentials
4
4
5### Technical Specifications
5### Language & Copy
6- For every file and implementation, log the file and all of its classes and functions in `.github/technical-reference.md`
6- User-facing website copy must be in British English.
7- When functionality is modified or added, update that file.
7- New or modified UI text (buttons, labels, dialogs, errors, tooltips, share pages) must be in British English.
8- Reference the file before making changes to ensure no duplicate functionality is made
8
9- the file serves as an index and reference for the code architecture, as well as individual classes and methods.
9### Technical Specifications
10- Keep it short and specific; no paragraphs of explanation, only a simple notation of a file, class or method and a one-line description of what it does, what it should be used for, and what to keep into account when using it.
10- For every file and implementation, log the file and all of its classes and functions in `.github/technical-reference.md`
11- `.github/tests.md` is an index of every test file and every test name inside it. Keep it up to date whenever tests are added, removed, or renamed. Reference it to understand existing coverage before deciding whether to add a new test.
11- When functionality is modified or added, update that file.
12
12- Reference the file before making changes to ensure no duplicate functionality is made
13
13- the file serves as an index and reference for the code architecture, as well as individual classes and methods.
14## Developer Workflows
14- Keep it short and specific; no paragraphs of explanation, only a simple notation of a file, class or method and a one-line description of what it does, what it should be used for, and what to keep into account when using it.
15
15- `.github/tests.md` is an index of every test file and every test name inside it. Keep it up to date whenever tests are added, removed, or renamed. Reference it to understand existing coverage before deciding whether to add a new test.
16### Git authoring
16
17- When starting work on something, create a feature or fix branch
17
18- When concrete, complete steps are made, create a commit in that branch
18## Developer Workflows
19- Try to commit frequently, chunking work into individual steps
19
20- When all work is done, merge the branch into master, and then delete it so only master remains
20### Git authoring
21- Ensure you don't leave old branches you've made in git and that everything is merged neatly.
21- When starting work on something, create a feature or fix branch
22- Always run the full test suite and fix any issues (including unrelated to your work) before merging to master.
22- When concrete, complete steps are made, create a commit in that branch
23
23- Try to commit frequently, chunking work into individual steps
24## Testing Expectations
24- When all work is done, merge the branch into master, and then delete it so only master remains
25- **Default rule:** every new feature should receive a test that verifies it behaves as requested.
25- Ensure you don't leave old branches you've made in git and that everything is merged neatly.
26- If a very similar test already exists, expand or adapt that test instead of creating duplicate coverage.
26- Always run the full test suite and fix any issues (including unrelated to your work) before merging to master.
27- When a change affects an area that existing tests are meant to cover, update those tests so the new behavior is validated too.
27
28- After modifying any function or module, check `tests.md` for tests that exercise that code path — directly or indirectly — and verify those tests still reflect the current behavior. If they no longer do, update them before finishing.
28## Testing Expectations
29- When encountering existing functionality that is not covered by tests, automatically add coverage for it unless it is extremely simple; for extremely simple cases, ask the user first before skipping the test.
29- **Default rule:** every new feature should receive a test that verifies it behaves as requested.
30- Only skip adding a test, or ask the user first, when the change is truly tiny or not behaviorally meaningful (for example: wording-only copy edits, comments, or other negligible changes).
30- If a very similar test already exists, expand or adapt that test instead of creating duplicate coverage.
31- Prefer reusing production helpers and real code paths in tests rather than duplicating business logic in test-only code.
31- When a change affects an area that existing tests are meant to cover, update those tests so the new behavior is validated too.
32- After modifying any function or module, check `tests.md` for tests that exercise that code path — directly or indirectly — and verify those tests still reflect the current behavior. If they no longer do, update them before finishing.
33- When encountering existing functionality that is not covered by tests, automatically add coverage for it unless it is extremely simple; for extremely simple cases, ask the user first before skipping the test.
34- Only skip adding a test, or ask the user first, when the change is truly tiny or not behaviorally meaningful (for example: wording-only copy edits, comments, or other negligible changes).
35- Prefer reusing production helpers and real code paths in tests rather than duplicating business logic in test-only code.
public/app.js +12 −12
@@ -563,10 +563,10 @@ function showFileConflictChoice (filename, renameTo, mode = 'upload')
563 563 const btnRename = document.getElementById('file-conflict-rename-btn');
564 564 const btnCancel = document.getElementById('file-conflict-cancel');
565 565
566 title.textContent = mode === 'move' ? 'Bestand verplaatsen' : 'Bestand uploaden';
566 title.textContent = mode === 'move' ? 'Move file' : 'Upload file';
567 567 fileEl.textContent = filename;
568 568 renameEl.textContent = renameTo;
569 btnRename.textContent = `Hernoemen (${renameTo})`;
569 btnRename.textContent = `Rename (${renameTo})`;
570 570
571 571 overlay.classList.remove('hidden');
572 572
@@ -603,9 +603,9 @@ async function openShareModal (item)
603 603 const closeBtn = document.getElementById('share-modal-close');
604 604 const msgEl = document.getElementById('share-modal-msg');
605 605
606 urlInput.value = 'Link aanmaken…';
606 urlInput.value = 'Creating link...';
607 607 copyBtn.disabled = true;
608 msgEl.textContent = 'De link is 24 uur geldig.';
608 msgEl.textContent = 'This link is valid for 24 hours.';
609 609 overlay.classList.remove('hidden');
610 610
611 611 let data;
@@ -614,14 +614,14 @@ async function openShareModal (item)
614 614 data = await api('POST', '/share/create', { filePath: item.path });
615 615 } catch (err)
616 616 {
617 msgEl.textContent = 'Fout: ' + (err.message || 'Kon geen link aanmaken.');
617 msgEl.textContent = 'Error: ' + (err.message || 'Could not create link.');
618 618 urlInput.value = '';
619 619 return;
620 620 }
621 621
622 622 if (!data || !data.token)
623 623 {
624 msgEl.textContent = 'Onbekende fout bij aanmaken van de link.';
624 msgEl.textContent = 'Unknown error while creating link.';
625 625 urlInput.value = '';
626 626 return;
627 627 }
@@ -643,7 +643,7 @@ async function openShareModal (item)
643 643 navigator.clipboard.writeText(shareUrl).then(() =>
644 644 {
645 645 const orig = copyBtn.textContent;
646 copyBtn.textContent = 'Gekopieerd!';
646 copyBtn.textContent = 'Copied!';
647 647 setTimeout(() => { copyBtn.textContent = orig; }, 1500);
648 648 }).catch(() =>
649 649 {
@@ -1275,7 +1275,7 @@ async function openSidebar (item)
1275 1275
1276 1276 // Share button (file)
1277 1277 const btnShareFile = document.createElement('button');
1278 btnShareFile.textContent = 'Delen';
1278 btnShareFile.textContent = 'Share';
1279 1279 btnShareFile.addEventListener('click', () => openShareModal(item));
1280 1280 actions.appendChild(btnShareFile);
1281 1281 } else
@@ -1316,11 +1316,11 @@ async function openSidebar (item)
1316 1316
1317 1317 // Download as zip button (folder)
1318 1318 const btnZip = document.createElement('button');
1319 btnZip.textContent = 'Download als zip';
1319 btnZip.textContent = 'Download as zip';
1320 1320 btnZip.addEventListener('click', () =>
1321 1321 {
1322 1322 btnZip.disabled = true;
1323 btnZip.textContent = 'Bezig…';
1323 btnZip.textContent = 'Working...';
1324 1324 const url = `/api/files/download-zip?dir=${encodeURIComponent(item.path)}`;
1325 1325 const headers = {
1326 1326 Authorization: 'Bearer ' + STATE.token,
@@ -1345,14 +1345,14 @@ async function openSidebar (item)
1345 1345 .finally(() =>
1346 1346 {
1347 1347 btnZip.disabled = false;
1348 btnZip.textContent = 'Download als zip';
1348 btnZip.textContent = 'Download as zip';
1349 1349 });
1350 1350 });
1351 1351 actions.appendChild(btnZip);
1352 1352
1353 1353 // Share button (folder)
1354 1354 const btnShareFolder = document.createElement('button');
1355 btnShareFolder.textContent = 'Delen';
1355 btnShareFolder.textContent = 'Share';
1356 1356 btnShareFolder.addEventListener('click', () => openShareModal(item));
1357 1357 actions.appendChild(btnShareFolder);
1358 1358
@@ -563,10 +563,10 @@ function showFileConflictChoice (filename, renameTo, mode = 'upload')
563 const btnRename = document.getElementById('file-conflict-rename-btn');
563 const btnRename = document.getElementById('file-conflict-rename-btn');
564 const btnCancel = document.getElementById('file-conflict-cancel');
564 const btnCancel = document.getElementById('file-conflict-cancel');
565
565
566 title.textContent = mode === 'move' ? 'Bestand verplaatsen' : 'Bestand uploaden';
566 title.textContent = mode === 'move' ? 'Move file' : 'Upload file';
567 fileEl.textContent = filename;
567 fileEl.textContent = filename;
568 renameEl.textContent = renameTo;
568 renameEl.textContent = renameTo;
569 btnRename.textContent = `Hernoemen (${renameTo})`;
569 btnRename.textContent = `Rename (${renameTo})`;
570
570
571 overlay.classList.remove('hidden');
571 overlay.classList.remove('hidden');
572
572
@@ -603,9 +603,9 @@ async function openShareModal (item)
603 const closeBtn = document.getElementById('share-modal-close');
603 const closeBtn = document.getElementById('share-modal-close');
604 const msgEl = document.getElementById('share-modal-msg');
604 const msgEl = document.getElementById('share-modal-msg');
605
605
606 urlInput.value = 'Link aanmaken…';
606 urlInput.value = 'Creating link...';
607 copyBtn.disabled = true;
607 copyBtn.disabled = true;
608 msgEl.textContent = 'De link is 24 uur geldig.';
608 msgEl.textContent = 'This link is valid for 24 hours.';
609 overlay.classList.remove('hidden');
609 overlay.classList.remove('hidden');
610
610
611 let data;
611 let data;
@@ -614,14 +614,14 @@ async function openShareModal (item)
614 data = await api('POST', '/share/create', { filePath: item.path });
614 data = await api('POST', '/share/create', { filePath: item.path });
615 } catch (err)
615 } catch (err)
616 {
616 {
617 msgEl.textContent = 'Fout: ' + (err.message || 'Kon geen link aanmaken.');
617 msgEl.textContent = 'Error: ' + (err.message || 'Could not create link.');
618 urlInput.value = '';
618 urlInput.value = '';
619 return;
619 return;
620 }
620 }
621
621
622 if (!data || !data.token)
622 if (!data || !data.token)
623 {
623 {
624 msgEl.textContent = 'Onbekende fout bij aanmaken van de link.';
624 msgEl.textContent = 'Unknown error while creating link.';
625 urlInput.value = '';
625 urlInput.value = '';
626 return;
626 return;
627 }
627 }
@@ -643,7 +643,7 @@ async function openShareModal (item)
643 navigator.clipboard.writeText(shareUrl).then(() =>
643 navigator.clipboard.writeText(shareUrl).then(() =>
644 {
644 {
645 const orig = copyBtn.textContent;
645 const orig = copyBtn.textContent;
646 copyBtn.textContent = 'Gekopieerd!';
646 copyBtn.textContent = 'Copied!';
647 setTimeout(() => { copyBtn.textContent = orig; }, 1500);
647 setTimeout(() => { copyBtn.textContent = orig; }, 1500);
648 }).catch(() =>
648 }).catch(() =>
649 {
649 {
@@ -1275,7 +1275,7 @@ async function openSidebar (item)
1275
1275
1276 // Share button (file)
1276 // Share button (file)
1277 const btnShareFile = document.createElement('button');
1277 const btnShareFile = document.createElement('button');
1278 btnShareFile.textContent = 'Delen';
1278 btnShareFile.textContent = 'Share';
1279 btnShareFile.addEventListener('click', () => openShareModal(item));
1279 btnShareFile.addEventListener('click', () => openShareModal(item));
1280 actions.appendChild(btnShareFile);
1280 actions.appendChild(btnShareFile);
1281 } else
1281 } else
@@ -1316,11 +1316,11 @@ async function openSidebar (item)
1316
1316
1317 // Download as zip button (folder)
1317 // Download as zip button (folder)
1318 const btnZip = document.createElement('button');
1318 const btnZip = document.createElement('button');
1319 btnZip.textContent = 'Download als zip';
1319 btnZip.textContent = 'Download as zip';
1320 btnZip.addEventListener('click', () =>
1320 btnZip.addEventListener('click', () =>
1321 {
1321 {
1322 btnZip.disabled = true;
1322 btnZip.disabled = true;
1323 btnZip.textContent = 'Bezig…';
1323 btnZip.textContent = 'Working...';
1324 const url = `/api/files/download-zip?dir=${encodeURIComponent(item.path)}`;
1324 const url = `/api/files/download-zip?dir=${encodeURIComponent(item.path)}`;
1325 const headers = {
1325 const headers = {
1326 Authorization: 'Bearer ' + STATE.token,
1326 Authorization: 'Bearer ' + STATE.token,
@@ -1345,14 +1345,14 @@ async function openSidebar (item)
1345 .finally(() =>
1345 .finally(() =>
1346 {
1346 {
1347 btnZip.disabled = false;
1347 btnZip.disabled = false;
1348 btnZip.textContent = 'Download als zip';
1348 btnZip.textContent = 'Download as zip';
1349 });
1349 });
1350 });
1350 });
1351 actions.appendChild(btnZip);
1351 actions.appendChild(btnZip);
1352
1352
1353 // Share button (folder)
1353 // Share button (folder)
1354 const btnShareFolder = document.createElement('button');
1354 const btnShareFolder = document.createElement('button');
1355 btnShareFolder.textContent = 'Delen';
1355 btnShareFolder.textContent = 'Share';
1356 btnShareFolder.addEventListener('click', () => openShareModal(item));
1356 btnShareFolder.addEventListener('click', () => openShareModal(item));
1357 actions.appendChild(btnShareFolder);
1357 actions.appendChild(btnShareFolder);
1358
1358
public/index.html +10 −10
@@ -253,17 +253,17 @@
253 253 <div id="file-conflict-modal" class="modal-overlay hidden" role="dialog" aria-modal="true"
254 254 aria-labelledby="file-conflict-title">
255 255 <div class="modal small">
256 <h2 id="file-conflict-title">Bestand conflict</h2>
256 <h2 id="file-conflict-title">File conflict</h2>
257 257 <p class="dialog-message">
258 <strong id="file-conflict-filename"></strong> bestaat al in de doelmap.
258 <strong id="file-conflict-filename"></strong> already exists in the destination folder.
259 259 </p>
260 260 <p class="dialog-message">
261 Hernoemen naar <strong id="file-conflict-rename"></strong>?
261 Rename to <strong id="file-conflict-rename"></strong>?
262 262 </p>
263 263 <div class="dialog-actions">
264 <button id="file-conflict-cancel">Annuleren</button>
265 <button id="file-conflict-overwrite" class="primary">Overschrijven</button>
266 <button id="file-conflict-rename-btn" class="primary">Hernoemen</button>
264 <button id="file-conflict-cancel">Cancel</button>
265 <button id="file-conflict-overwrite" class="primary">Overwrite</button>
266 <button id="file-conflict-rename-btn" class="primary">Rename</button>
267 267 </div>
268 268 </div>
269 269 </div>
@@ -276,13 +276,13 @@
276 276 <div id="share-modal" class="modal-overlay hidden" role="dialog" aria-modal="true"
277 277 aria-labelledby="share-modal-title">
278 278 <div class="modal small">
279 <button class="modal-close" id="share-modal-close" aria-label="Sluiten">✕</button>
280 <h2 id="share-modal-title">Delen</h2>
281 <p class="dialog-message" id="share-modal-msg">De link is 24 uur geldig.</p>
279 <button class="modal-close" id="share-modal-close" aria-label="Close">✕</button>
280 <h2 id="share-modal-title">Share</h2>
281 <p class="dialog-message" id="share-modal-msg">This link is valid for 24 hours.</p>
282 282 <div id="share-url-row" style="display:flex;gap:0.5rem;margin:0.8rem 0">
283 283 <input id="share-url-input" type="text" readonly
284 284 style="flex:1;font-size:0.82rem;background:var(--surface2);border:1px solid var(--border);border-radius:6px;padding:0.45rem 0.65rem;color:var(--text);min-width:0" />
285 <button id="share-copy-btn" title="Kopieer link">Kopieer</button>
285 <button id="share-copy-btn" title="Copy link">Copy</button>
286 286 </div>
287 287 <div class="dialog-actions">
288 288 <button class="primary" id="share-modal-ok">OK</button>
@@ -253,17 +253,17 @@
253 <div id="file-conflict-modal" class="modal-overlay hidden" role="dialog" aria-modal="true"
253 <div id="file-conflict-modal" class="modal-overlay hidden" role="dialog" aria-modal="true"
254 aria-labelledby="file-conflict-title">
254 aria-labelledby="file-conflict-title">
255 <div class="modal small">
255 <div class="modal small">
256 <h2 id="file-conflict-title">Bestand conflict</h2>
256 <h2 id="file-conflict-title">File conflict</h2>
257 <p class="dialog-message">
257 <p class="dialog-message">
258 <strong id="file-conflict-filename"></strong> bestaat al in de doelmap.
258 <strong id="file-conflict-filename"></strong> already exists in the destination folder.
259 </p>
259 </p>
260 <p class="dialog-message">
260 <p class="dialog-message">
261 Hernoemen naar <strong id="file-conflict-rename"></strong>?
261 Rename to <strong id="file-conflict-rename"></strong>?
262 </p>
262 </p>
263 <div class="dialog-actions">
263 <div class="dialog-actions">
264 <button id="file-conflict-cancel">Annuleren</button>
264 <button id="file-conflict-cancel">Cancel</button>
265 <button id="file-conflict-overwrite" class="primary">Overschrijven</button>
265 <button id="file-conflict-overwrite" class="primary">Overwrite</button>
266 <button id="file-conflict-rename-btn" class="primary">Hernoemen</button>
266 <button id="file-conflict-rename-btn" class="primary">Rename</button>
267 </div>
267 </div>
268 </div>
268 </div>
269 </div>
269 </div>
@@ -276,13 +276,13 @@
276 <div id="share-modal" class="modal-overlay hidden" role="dialog" aria-modal="true"
276 <div id="share-modal" class="modal-overlay hidden" role="dialog" aria-modal="true"
277 aria-labelledby="share-modal-title">
277 aria-labelledby="share-modal-title">
278 <div class="modal small">
278 <div class="modal small">
279 <button class="modal-close" id="share-modal-close" aria-label="Sluiten">✕</button>
279 <button class="modal-close" id="share-modal-close" aria-label="Close">✕</button>
280 <h2 id="share-modal-title">Delen</h2>
280 <h2 id="share-modal-title">Share</h2>
281 <p class="dialog-message" id="share-modal-msg">De link is 24 uur geldig.</p>
281 <p class="dialog-message" id="share-modal-msg">This link is valid for 24 hours.</p>
282 <div id="share-url-row" style="display:flex;gap:0.5rem;margin:0.8rem 0">
282 <div id="share-url-row" style="display:flex;gap:0.5rem;margin:0.8rem 0">
283 <input id="share-url-input" type="text" readonly
283 <input id="share-url-input" type="text" readonly
284 style="flex:1;font-size:0.82rem;background:var(--surface2);border:1px solid var(--border);border-radius:6px;padding:0.45rem 0.65rem;color:var(--text);min-width:0" />
284 style="flex:1;font-size:0.82rem;background:var(--surface2);border:1px solid var(--border);border-radius:6px;padding:0.45rem 0.65rem;color:var(--text);min-width:0" />
285 <button id="share-copy-btn" title="Kopieer link">Kopieer</button>
285 <button id="share-copy-btn" title="Copy link">Copy</button>
286 </div>
286 </div>
287 <div class="dialog-actions">
287 <div class="dialog-actions">
288 <button class="primary" id="share-modal-ok">OK</button>
288 <button class="primary" id="share-modal-ok">OK</button>
public/share.html +15 −15
@@ -1,10 +1,10 @@
1 1 <!DOCTYPE html>
2 <html lang="nl">
2 <html lang="en-GB">
3 3
4 4 <head>
5 5 <meta charset="UTF-8" />
6 6 <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7 <title>Gedeeld bestand</title>
7 <title>Shared file</title>
8 8 <style>
9 9 *,
10 10 *::before,
@@ -199,15 +199,15 @@
199 199 <body>
200 200
201 201 <div id="timer-bar" style="display:none">
202 <span>Geldig voor</span>
202 <span>Valid for</span>
203 203 <span id="timer-clock" class="timer-clock">--:--:--</span>
204 204 </div>
205 205
206 206 <div id="main">
207 <div id="loading">Laden…</div>
207 <div id="loading">Loading...</div>
208 208 <div id="error-state" style="display:none">
209 <h2 id="error-title">Niet gevonden</h2>
210 <p id="error-msg">De link bestaat niet of is verlopen.</p>
209 <h2 id="error-title">Not found</h2>
210 <p id="error-msg">This link does not exist or has expired.</p>
211 211 </div>
212 212
213 213 <div id="content" style="display:none">
@@ -221,7 +221,7 @@
221 221 <polyline points="7 10 12 15 17 10" />
222 222 <line x1="12" y1="15" x2="12" y2="3" />
223 223 </svg>
224 <span id="btn-download-label">Downloaden</span>
224 <span id="btn-download-label">Download</span>
225 225 </a>
226 226 </div>
227 227
@@ -252,7 +252,7 @@
252 252 {
253 253 clock.textContent = '00:00:00';
254 254 bar.classList.add('expired');
255 bar.querySelector('span').textContent = 'Verlopen —';
255 bar.querySelector('span').textContent = 'Expired —';
256 256 const dlBtn = document.getElementById('btn-download');
257 257 if (dlBtn) dlBtn.setAttribute('disabled', 'disabled');
258 258 clearInterval(timerInterval);
@@ -323,7 +323,7 @@
323 323 return; // no preview
324 324 }
325 325
326 el.addEventListener('error', () => { wrap.innerHTML = '<div class="no-preview">Geen voorbeeldweergave beschikbaar.</div>'; wrap.style.display = ''; });
326 el.addEventListener('error', () => { wrap.innerHTML = '<div class="no-preview">No preview available.</div>'; wrap.style.display = ''; });
327 327 wrap.innerHTML = '';
328 328 wrap.appendChild(el);
329 329 wrap.style.display = '';
@@ -356,12 +356,12 @@
356 356
357 357 if (status === 410)
358 358 {
359 showError('Link verlopen', 'Deze deellink is niet meer geldig.');
359 showError('Link expired', 'This share link is no longer valid.');
360 360 return;
361 361 }
362 362 if (!ok)
363 363 {
364 showError('Niet gevonden', data.error || 'De link bestaat niet.');
364 showError('Not found', data.error || 'This link does not exist.');
365 365 return;
366 366 }
367 367
@@ -369,18 +369,18 @@
369 369 startTimer();
370 370
371 371 document.getElementById('file-name').textContent = data.name;
372 const metaLine = data.isDir ? 'Map (download als .zip)' : 'Bestand';
372 const metaLine = data.isDir ? 'Folder (download as .zip)' : 'File';
373 373 document.getElementById('file-meta').textContent = metaLine;
374 374
375 375 const dlBtn = document.getElementById('btn-download');
376 376 dlBtn.href = `/api/share/download/${token}`;
377 377 if (data.isDir)
378 378 {
379 document.getElementById('btn-download-label').textContent = 'Downloaden als .zip';
379 document.getElementById('btn-download-label').textContent = 'Download as .zip';
380 380 dlBtn.download = data.name + '.zip';
381 381 } else
382 382 {
383 document.getElementById('btn-download-label').textContent = 'Downloaden';
383 document.getElementById('btn-download-label').textContent = 'Download';
384 384 dlBtn.download = data.name;
385 385 }
386 386
@@ -390,7 +390,7 @@
390 390 })
391 391 .catch(() =>
392 392 {
393 showError('Fout', 'Kon de server niet bereiken.');
393 showError('Error', 'Could not reach the server.');
394 394 });
395 395 }());
396 396 </script>
@@ -1,10 +1,10 @@
1<!DOCTYPE html>
1<!DOCTYPE html>
2<html lang="nl">
2<html lang="en-GB">
3
3
4<head>
4<head>
5 <meta charset="UTF-8" />
5 <meta charset="UTF-8" />
6 <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6 <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7 <title>Gedeeld bestand</title>
7 <title>Shared file</title>
8 <style>
8 <style>
9 *,
9 *,
10 *::before,
10 *::before,
@@ -199,15 +199,15 @@
199<body>
199<body>
200
200
201 <div id="timer-bar" style="display:none">
201 <div id="timer-bar" style="display:none">
202 <span>Geldig voor</span>
202 <span>Valid for</span>
203 <span id="timer-clock" class="timer-clock">--:--:--</span>
203 <span id="timer-clock" class="timer-clock">--:--:--</span>
204 </div>
204 </div>
205
205
206 <div id="main">
206 <div id="main">
207 <div id="loading">Laden…</div>
207 <div id="loading">Loading...</div>
208 <div id="error-state" style="display:none">
208 <div id="error-state" style="display:none">
209 <h2 id="error-title">Niet gevonden</h2>
209 <h2 id="error-title">Not found</h2>
210 <p id="error-msg">De link bestaat niet of is verlopen.</p>
210 <p id="error-msg">This link does not exist or has expired.</p>
211 </div>
211 </div>
212
212
213 <div id="content" style="display:none">
213 <div id="content" style="display:none">
@@ -221,7 +221,7 @@
221 <polyline points="7 10 12 15 17 10" />
221 <polyline points="7 10 12 15 17 10" />
222 <line x1="12" y1="15" x2="12" y2="3" />
222 <line x1="12" y1="15" x2="12" y2="3" />
223 </svg>
223 </svg>
224 <span id="btn-download-label">Downloaden</span>
224 <span id="btn-download-label">Download</span>
225 </a>
225 </a>
226 </div>
226 </div>
227
227
@@ -252,7 +252,7 @@
252 {
252 {
253 clock.textContent = '00:00:00';
253 clock.textContent = '00:00:00';
254 bar.classList.add('expired');
254 bar.classList.add('expired');
255 bar.querySelector('span').textContent = 'Verlopen —';
255 bar.querySelector('span').textContent = 'Expired —';
256 const dlBtn = document.getElementById('btn-download');
256 const dlBtn = document.getElementById('btn-download');
257 if (dlBtn) dlBtn.setAttribute('disabled', 'disabled');
257 if (dlBtn) dlBtn.setAttribute('disabled', 'disabled');
258 clearInterval(timerInterval);
258 clearInterval(timerInterval);
@@ -323,7 +323,7 @@
323 return; // no preview
323 return; // no preview
324 }
324 }
325
325
326 el.addEventListener('error', () => { wrap.innerHTML = '<div class="no-preview">Geen voorbeeldweergave beschikbaar.</div>'; wrap.style.display = ''; });
326 el.addEventListener('error', () => { wrap.innerHTML = '<div class="no-preview">No preview available.</div>'; wrap.style.display = ''; });
327 wrap.innerHTML = '';
327 wrap.innerHTML = '';
328 wrap.appendChild(el);
328 wrap.appendChild(el);
329 wrap.style.display = '';
329 wrap.style.display = '';
@@ -356,12 +356,12 @@
356
356
357 if (status === 410)
357 if (status === 410)
358 {
358 {
359 showError('Link verlopen', 'Deze deellink is niet meer geldig.');
359 showError('Link expired', 'This share link is no longer valid.');
360 return;
360 return;
361 }
361 }
362 if (!ok)
362 if (!ok)
363 {
363 {
364 showError('Niet gevonden', data.error || 'De link bestaat niet.');
364 showError('Not found', data.error || 'This link does not exist.');
365 return;
365 return;
366 }
366 }
367
367
@@ -369,18 +369,18 @@
369 startTimer();
369 startTimer();
370
370
371 document.getElementById('file-name').textContent = data.name;
371 document.getElementById('file-name').textContent = data.name;
372 const metaLine = data.isDir ? 'Map (download als .zip)' : 'Bestand';
372 const metaLine = data.isDir ? 'Folder (download as .zip)' : 'File';
373 document.getElementById('file-meta').textContent = metaLine;
373 document.getElementById('file-meta').textContent = metaLine;
374
374
375 const dlBtn = document.getElementById('btn-download');
375 const dlBtn = document.getElementById('btn-download');
376 dlBtn.href = `/api/share/download/${token}`;
376 dlBtn.href = `/api/share/download/${token}`;
377 if (data.isDir)
377 if (data.isDir)
378 {
378 {
379 document.getElementById('btn-download-label').textContent = 'Downloaden als .zip';
379 document.getElementById('btn-download-label').textContent = 'Download as .zip';
380 dlBtn.download = data.name + '.zip';
380 dlBtn.download = data.name + '.zip';
381 } else
381 } else
382 {
382 {
383 document.getElementById('btn-download-label').textContent = 'Downloaden';
383 document.getElementById('btn-download-label').textContent = 'Download';
384 dlBtn.download = data.name;
384 dlBtn.download = data.name;
385 }
385 }
386
386
@@ -390,7 +390,7 @@
390 })
390 })
391 .catch(() =>
391 .catch(() =>
392 {
392 {
393 showError('Fout', 'Kon de server niet bereiken.');
393 showError('Error', 'Could not reach the server.');
394 });
394 });
395 }());
395 }());
396 </script>
396 </script>