diff --git a/frontend/package-lock.json b/frontend/package-lock.json index ce3dcc31..dcab386e 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -3725,12 +3725,12 @@ } }, "node_modules/braces": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", - "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", + "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", "dev": true, "dependencies": { - "fill-range": "^7.0.1" + "fill-range": "^7.1.1" }, "engines": { "node": ">=8" @@ -4822,9 +4822,9 @@ } }, "node_modules/fill-range": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", - "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", + "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", "dev": true, "dependencies": { "to-regex-range": "^5.0.1" @@ -7574,9 +7574,9 @@ "dev": true }, "node_modules/ws": { - "version": "8.16.0", - "resolved": "https://registry.npmjs.org/ws/-/ws-8.16.0.tgz", - "integrity": "sha512-HS0c//TP7Ina87TfiPUz1rQzMhHrl/SG2guqRcTOIUYD2q8uhUdNHZYJUaQ8aTGPzCh+c6oawMKW35nFl1dxyQ==", + "version": "8.17.1", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.17.1.tgz", + "integrity": "sha512-6XQFvXTkbfUOZOKKILFG1PDK2NDQs4azKQl26T0YS5CxqWLgXajbPZ+h4gZekJyRqFU8pvnbAbbs/3TgRPy+GQ==", "dev": true, "engines": { "node": ">=10.0.0" diff --git a/frontend/src/components/files/ListingItem.vue b/frontend/src/components/files/ListingItem.vue index 1798ce5e..01937c8a 100644 --- a/frontend/src/components/files/ListingItem.vue +++ b/frontend/src/components/files/ListingItem.vue @@ -275,12 +275,10 @@ const open = () => { }; const getExtension = (fileName: string): string => { - const lastDotIndex = fileName.lastIndexOf('.'); + const lastDotIndex = fileName.lastIndexOf("."); if (lastDotIndex === -1) { return fileName; } - return fileName.substring(lastDotIndex ); + return fileName.substring(lastDotIndex); }; - - diff --git a/frontend/src/components/files/VideoPlayer.vue b/frontend/src/components/files/VideoPlayer.vue index cc9bca84..6cb3299d 100644 --- a/frontend/src/components/files/VideoPlayer.vue +++ b/frontend/src/components/files/VideoPlayer.vue @@ -1,8 +1,14 @@ \ No newline at end of file + diff --git a/frontend/src/css/listing-icons.css b/frontend/src/css/listing-icons.css index 1140b8c8..d0bdb043 100644 --- a/frontend/src/css/listing-icons.css +++ b/frontend/src/css/listing-icons.css @@ -5,7 +5,7 @@ .file-icons [aria-label^="."] { opacity: 0.33; } -.file-icons [aria-label$=".bak"] { +.file-icons [data-ext=".bak"] { opacity: 0.33; } @@ -47,7 +47,6 @@ content: "slideshow"; } - /* #0f0 - Spreadsheet/Database */ .file-icons [data-ext=".csv"] i::before, @@ -55,7 +54,7 @@ .file-icons [data-ext=".odb"] i::before, .file-icons [data-ext=".ods"] i::before, .file-icons [data-ext=".xls"] i::before, -.file-icons [data-ext=".xlsx"] i::before { +.file-icons [data-ext=".xlsx"] i::before { content: "border_all"; } @@ -152,16 +151,16 @@ /* General */ -.file-icons [data-ext="audio"] i { +.file-icons [data-type="audio"] i { color: var(--icon-yellow); } -.file-icons [data-ext="image"] i { +.file-icons [data-type="image"] i { color: var(--icon-orange); } -.file-icons [data-ext="video"] i { +.file-icons [data-type="video"] i { color: var(--icon-violet); } -.file-icons [data-ext="invalid_link"] i { +.file-icons [data-type="invalid_link"] i { color: var(--icon-red); } @@ -172,7 +171,7 @@ .file-icons [data-ext=".jar"] i, .file-icons [data-ext=".psd"] i, .file-icons [data-ext=".rb"] i, -.file-icons [data-ext="pdf"] i { +.file-icons [data-ext=".pdf"] i { color: var(--icon-red); } @@ -204,8 +203,7 @@ .file-icons [data-ext=".go"] i, .file-icons [data-ext=".ods"] i, .file-icons [data-ext=".xls"] i, -.file-icons [data-ext=".xlsx"] i , -.file-icons [data-ext="xlsx"] i::before{ +.file-icons [data-ext=".xlsx"] i { color: var(--icon-green); } diff --git a/frontend/src/css/listing.css b/frontend/src/css/listing.css index 565815a4..d1423e47 100644 --- a/frontend/src/css/listing.css +++ b/frontend/src/css/listing.css @@ -241,6 +241,9 @@ html[dir="rtl"] #listing { #listing.list .name { font-weight: normal; + word-wrap: break-word; + word-break: break-all; + white-space: pre-wrap; } #listing.list .item.header .name { diff --git a/frontend/src/css/styles.css b/frontend/src/css/styles.css index 8eed50fc..f8d4ef9d 100644 --- a/frontend/src/css/styles.css +++ b/frontend/src/css/styles.css @@ -269,7 +269,7 @@ main .spinner .bounce2 { #previewer .pdf { width: 100%; height: 100%; - margin-top: 4em; + padding-top: 4em; } #previewer h2.message { diff --git a/frontend/src/utils/auth.ts b/frontend/src/utils/auth.ts index e30f6556..b5f84638 100644 --- a/frontend/src/utils/auth.ts +++ b/frontend/src/utils/auth.ts @@ -101,6 +101,6 @@ export function logout() { if (noAuth) { window.location.reload(); } else { - router.push({path: "/login"}); + router.push({ path: "/login" }); } } diff --git a/frontend/src/utils/clipboard.ts b/frontend/src/utils/clipboard.ts index 3a89a68a..136f1ad4 100644 --- a/frontend/src/utils/clipboard.ts +++ b/frontend/src/utils/clipboard.ts @@ -1,9 +1,11 @@ -// Based on code provided by Amir Fo +// Based on code by the following links: // https://stackoverflow.com/a/74528564 +// https://web.dev/articles/async-clipboard export function copy(text: string) { return new Promise((resolve, reject) => { if ( - typeof navigator !== "undefined" && + // Clipboard API requires secure context + window.isSecureContext && typeof navigator.clipboard !== "undefined" && // @ts-ignore navigator.permissions !== "undefined" @@ -13,10 +15,8 @@ export function copy(text: string) { .query({ name: "clipboard-write" }) .then((permission) => { if (permission.state === "granted" || permission.state === "prompt") { - const type = "text/plain"; - const blob = new Blob([text], { type }); - const data = [new ClipboardItem({ [type]: blob })]; - navigator.clipboard.write(data).then(resolve).catch(reject); + // simple writeText should work for all modern browsers + navigator.clipboard.writeText(text).then(resolve).catch(reject); } else { reject(new Error("Permission not granted!")); } @@ -66,13 +66,13 @@ const styles = { border: "none", outline: "none", boxShadow: "none", - background: "transparent" + background: "transparent", }; -const createTemporaryTextarea = (text:string) => { +const createTemporaryTextarea = (text: string) => { const textarea = document.createElement("textarea"); textarea.value = text; textarea.setAttribute("readonly", ""); Object.assign(textarea.style, styles); return textarea; -}; \ No newline at end of file +}; diff --git a/frontend/src/views/Files.vue b/frontend/src/views/Files.vue index 4d5879cb..e05dbed9 100644 --- a/frontend/src/views/Files.vue +++ b/frontend/src/views/Files.vue @@ -151,7 +151,6 @@ const fetchData = async () => { fileStore.updateRequest(res); document.title = `${res.name} - ${t("files.files")} - ${name}`; - } catch (err) { if (err instanceof Error) { error.value = err; diff --git a/frontend/src/views/files/Preview.vue b/frontend/src/views/files/Preview.vue index 879ca69d..3e63768b 100644 --- a/frontend/src/views/files/Preview.vue +++ b/frontend/src/views/files/Preview.vue @@ -6,7 +6,7 @@ @mousemove="toggleNavigation" @touchstart="toggleNavigation" > - + {{ name }} - +
feedback @@ -189,6 +185,8 @@ const raw = computed(() => { return downloadUrl.value; }); +const isPdf = computed(() => fileStore.req?.extension.toLowerCase() == ".pdf"); + const isResizeEnabled = computed(() => resizePreview); const subtitles = computed(() => { diff --git a/go.mod b/go.mod index 18bd5895..1219a742 100644 --- a/go.mod +++ b/go.mod @@ -25,8 +25,8 @@ require ( github.com/tomasen/realip v0.0.0-20180522021738-f0c99a92ddce go.etcd.io/bbolt v1.3.9 golang.org/x/crypto v0.21.0 - golang.org/x/image v0.15.0 - golang.org/x/text v0.14.0 + golang.org/x/image v0.18.0 + golang.org/x/text v0.16.0 gopkg.in/natefinch/lumberjack.v2 v2.2.1 gopkg.in/yaml.v2 v2.4.0 ) diff --git a/go.sum b/go.sum index 8287feff..33bef8a6 100644 --- a/go.sum +++ b/go.sum @@ -192,8 +192,8 @@ golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOM golang.org/x/exp v0.0.0-20240325151524-a685a6edb6d8 h1:aAcj0Da7eBAtrTp03QXWvm88pSyOt+UgdZw2BFZ+lEw= golang.org/x/exp v0.0.0-20240325151524-a685a6edb6d8/go.mod h1:CQ1k9gNrJ50XIzaKCRR2hssIjF07kZFEiieALBM/ARQ= golang.org/x/image v0.0.0-20191009234506-e7c1f5e7dbb8/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= -golang.org/x/image v0.15.0 h1:kOELfmgrmJlw4Cdb7g/QGuB3CvDrXbqEIww/pNtNBm8= -golang.org/x/image v0.15.0/go.mod h1:HUYqC05R2ZcZ3ejNQsIHQDQiwWM4JBqmm6MKANTp4LE= +golang.org/x/image v0.18.0 h1:jGzIakQa/ZXI1I0Fxvaa9W7yP25TqT6cHIHn+6CqvSQ= +golang.org/x/image v0.18.0/go.mod h1:4yyo5vMFQjVjUcVk4jEQcU9MGy/rulF5WvUILseCM2E= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= golang.org/x/net v0.0.0-20191105084925-a882066a44e0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= @@ -205,8 +205,8 @@ golang.org/x/net v0.0.0-20200904194848-62affa334b73/go.mod h1:/O7V0waA8r7cgGh81R golang.org/x/net v0.0.0-20221002022538-bcab6841153b/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= golang.org/x/net v0.23.0 h1:7EYJ93RZ9vYSZAIb2x3lnuvqO5zneoD6IvWjuhfxjTs= golang.org/x/net v0.23.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= -golang.org/x/sync v0.5.0 h1:60k92dhOjHxJkrqnwsfl8KuaHbn/5dl0lUPUklKo3qE= -golang.org/x/sync v0.5.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M= +golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -225,8 +225,8 @@ golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuX golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= -golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4= +golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=