diff --git a/expressjs/src/server.js b/expressjs/src/server.js
index 90e9fd1..70d7718 100644
--- a/expressjs/src/server.js
+++ b/expressjs/src/server.js
@@ -411,6 +411,7 @@ app.get(`${basePath}/dashboard`, requireAuthPage, async (req, res) => {
Noch ${formatCountdown(item.expires_at)}
+
@@ -474,6 +475,7 @@ app.get(`${basePath}/dashboard`, requireAuthPage, async (req, res) => {
const uploadForm = document.getElementById('upload-form');
const progress = document.getElementById('upload-progress');
const status = document.getElementById('upload-status');
+ const copyButtons = document.querySelectorAll('.copy-link');
uploadForm.addEventListener('submit', (event) => {
event.preventDefault();
status.textContent = '';
@@ -498,6 +500,25 @@ app.get(`${basePath}/dashboard`, requireAuthPage, async (req, res) => {
});
xhr.send(new FormData(uploadForm));
});
+
+ copyButtons.forEach((button) => {
+ button.addEventListener('click', async () => {
+ const path = button.dataset.path || '';
+ const url = window.location.origin + path;
+ try {
+ await navigator.clipboard.writeText(url);
+ status.textContent = 'Link kopiert.';
+ } catch (err) {
+ const helper = document.createElement('textarea');
+ helper.value = url;
+ document.body.appendChild(helper);
+ helper.select();
+ document.execCommand('copy');
+ document.body.removeChild(helper);
+ status.textContent = 'Link kopiert.';
+ }
+ });
+ });
`;
|