.app-icon {
+ margin-inline-end: 0.4em;
+ color: var(--blue);
}
.file-list li[aria-selected="true"]:before {
@@ -434,7 +429,7 @@ body.rtl .card .card-action {
color: var(--textPrimary);
}
-.collapsible > label i {
+.collapsible > label .app-icon {
transition: 0.2s ease transform;
user-select: none;
}
@@ -451,7 +446,7 @@ body.rtl .card .card-action {
max-height: 20em;
}
-.collapsible > input:checked ~ label i {
+.collapsible > input:checked ~ label .app-icon {
transform: rotate(180deg);
}
@@ -486,7 +481,7 @@ body.rtl .card .card-action {
margin: 0 0.25em 0.5em;
}
-.card .card-action.full .action i {
+.card .card-action.full .action .app-icon {
display: block;
padding: 0;
margin-bottom: 0.25em;
diff --git a/frontend/src/css/explorer.css b/frontend/src/css/explorer.css
index b4db7f9a..1767ee1d 100644
--- a/frontend/src/css/explorer.css
+++ b/frontend/src/css/explorer.css
@@ -51,8 +51,8 @@ nav.workspace-sidebar {
opacity: 0.35;
cursor: default;
}
-.sidebar-section-title i,
-.bookmark-row > button i {
+.sidebar-section-title .app-icon,
+.bookmark-row > button .app-icon {
font-size: 18px;
}
.explorer-link {
@@ -70,7 +70,7 @@ nav.workspace-sidebar {
overflow: hidden;
text-overflow: ellipsis;
}
-.explorer-link i {
+.explorer-link .app-icon {
font-size: 19px;
color: var(--blue);
}
@@ -118,7 +118,7 @@ nav.workspace-sidebar {
padding: 3px 0;
flex-shrink: 0;
}
-.folder-expand i {
+.folder-expand .app-icon {
font-size: 18px;
}
.folder-row a {
@@ -135,7 +135,7 @@ nav.workspace-sidebar {
text-overflow: ellipsis;
white-space: nowrap;
}
-.folder-row a i {
+.folder-row a .app-icon {
color: var(--blue);
font-size: 19px;
flex-shrink: 0;
@@ -206,7 +206,7 @@ nav.workspace-sidebar {
font-size: 10px;
color: var(--textPrimary);
}
-.account-button > i {
+.account-button > .app-icon {
font-size: 20px;
}
.account-menu {
@@ -233,7 +233,7 @@ nav.workspace-sidebar {
font-size: 12px;
line-height: 1.4;
}
-.account-menu i {
+.account-menu .app-icon {
font-size: 19px;
flex-shrink: 0;
}
@@ -247,21 +247,6 @@ nav.workspace-sidebar {
align-items: center;
justify-content: center;
}
-.dicom-file-icon {
- width: 56px;
- height: 64px;
- color: var(--blue);
- margin-inline-end: 6px;
- flex-shrink: 0;
-}
-#listing.list .dicom-file-icon {
- width: 28px;
- height: 34px;
-}
-#listing.mosaic.gallery .dicom-file-icon {
- width: 80px;
- height: 96px;
-}
@media (max-width: 736px) {
.workspace-sidebar .sidebar-bottom {
padding-bottom: env(safe-area-inset-bottom, 0px);
diff --git a/frontend/src/css/fonts.css b/frontend/src/css/fonts.css
index fdad54b9..0a0faa14 100644
--- a/frontend/src/css/fonts.css
+++ b/frontend/src/css/fonts.css
@@ -1,5 +1,3 @@
-@import "material-icons/iconfont/filled.css";
-
@font-face {
font-family: "Roboto";
font-style: normal;
@@ -239,7 +237,3 @@
U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F,
U+2074, U+20AC, U+2212, U+2215, U+E0FF, U+EFFD, U+F000;
}
-
-.material-icons {
- font-size: 1.5rem;
-}
diff --git a/frontend/src/css/header.css b/frontend/src/css/header.css
index 7a427b0a..2181269f 100644
--- a/frontend/src/css/header.css
+++ b/frontend/src/css/header.css
@@ -108,13 +108,13 @@ header .menu-button {
border-radius: 0 !important;
}
-#search.active i,
+#search.active .app-icon,
#search.active input {
color: var(--textPrimary);
}
#search #input > .action,
-#search #input > i {
+#search #input > .app-icon {
margin-right: 0.3em;
user-select: none;
}
@@ -192,11 +192,11 @@ html[dir="rtl"] #search #result ul > * {
display: block;
}
-#search.active #result i {
+#search.active #result .app-icon {
color: var(--iconTertiary);
}
-#search.active #result > p > i {
+#search.active #result > p > .app-icon {
text-align: center;
margin: 0 auto;
display: table;
@@ -208,7 +208,7 @@ html[dir="rtl"] #search #result ul > * {
padding: 0.3em 0;
}
-#search.active #result ul li a i {
+#search.active #result ul li a .app-icon {
margin-right: 0.3em;
}
@@ -273,7 +273,7 @@ html[dir="rtl"] #search .boxes h3 {
margin: 1em 0 0;
}
-#search .boxes i {
+#search .boxes .app-icon {
color: #fff !important;
font-size: 3.5em;
}
diff --git a/frontend/src/css/listing-icons.css b/frontend/src/css/listing-icons.css
index d0bdb043..9f539ee5 100644
--- a/frontend/src/css/listing-icons.css
+++ b/frontend/src/css/listing-icons.css
@@ -1,253 +1,28 @@
-/* Icons */
-
-/* General */
-
-.file-icons [aria-label^="."] {
- opacity: 0.33;
+.app-icon {
+ display: inline-block;
+ width: 1em;
+ height: 1em;
+ font-size: 24px;
+ vertical-align: middle;
+ flex-shrink: 0;
+ overflow: visible;
}
+.file-icon {
+ color: var(--blue);
+}
+.file-icons [aria-label^="."],
.file-icons [data-ext=".bak"] {
- opacity: 0.33;
+ opacity: 0.55;
}
-
-.file-icons [data-type="audio"] i::before {
- content: "volume_up";
+.file-icons [aria-selected="true"] .file-icon {
+ color: inherit;
}
-.file-icons [data-type="blob"] i::before {
- content: "insert_drive_file";
+#listing .item .file-icon {
+ font-size: 56px;
}
-.file-icons [data-type="image"] i::before {
- content: "image";
+#listing.list .item .file-icon {
+ font-size: 32px;
}
-.file-icons [data-type="pdf"] i::before {
- content: "description";
-}
-.file-icons [data-type="text"] i::before {
- content: "description";
-}
-.file-icons [data-type="video"] i::before {
- content: "movie";
-}
-.file-icons [data-type="invalid_link"] i::before {
- content: "link_off";
-}
-
-/* #f90 - Image */
-
-.file-icons [data-ext=".ai"] i::before,
-.file-icons [data-ext=".odg"] i::before,
-.file-icons [data-ext=".xcf"] i::before {
- content: "image";
-}
-
-/* #f90 - Presentation */
-
-.file-icons [data-ext=".odp"] i::before,
-.file-icons [data-ext=".ppt"] i::before,
-.file-icons [data-ext=".pptx"] i::before {
- content: "slideshow";
-}
-
-/* #0f0 - Spreadsheet/Database */
-
-.file-icons [data-ext=".csv"] i::before,
-.file-icons [data-ext=".db"] i::before,
-.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 {
- content: "border_all";
-}
-
-/* #00f - Document */
-
-.file-icons [data-ext=".doc"] i::before,
-.file-icons [data-ext=".docx"] i::before,
-.file-icons [data-ext=".log"] i::before,
-.file-icons [data-ext=".odt"] i::before,
-.file-icons [data-ext=".rtf"] i::before {
- content: "description";
-}
-
-/* #999 - Code */
-
-.file-icons [data-ext=".c"] i::before,
-.file-icons [data-ext=".cpp"] i::before,
-.file-icons [data-ext=".cs"] i::before,
-.file-icons [data-ext=".css"] i::before,
-.file-icons [data-ext=".go"] i::before,
-.file-icons [data-ext=".h"] i::before,
-.file-icons [data-ext=".html"] i::before,
-.file-icons [data-ext=".java"] i::before,
-.file-icons [data-ext=".js"] i::before,
-.file-icons [data-ext=".json"] i::before,
-.file-icons [data-ext=".kt"] i::before,
-.file-icons [data-ext=".php"] i::before,
-.file-icons [data-ext=".py"] i::before,
-.file-icons [data-ext=".rb"] i::before,
-.file-icons [data-ext=".rs"] i::before,
-.file-icons [data-ext=".vue"] i::before,
-.file-icons [data-ext=".xml"] i::before,
-.file-icons [data-ext=".yml"] i::before {
- content: "code";
-}
-
-/* #999 - Executable */
-
-.file-icons [data-ext=".apk"] i::before,
-.file-icons [data-ext=".bat"] i::before,
-.file-icons [data-ext=".exe"] i::before,
-.file-icons [data-ext=".jar"] i::before,
-.file-icons [data-ext=".ps1"] i::before,
-.file-icons [data-ext=".sh"] i::before {
- content: "web_asset";
-}
-
-/* #999 - Installer */
-
-.file-icons [data-ext=".deb"] i::before,
-.file-icons [data-ext=".msi"] i::before,
-.file-icons [data-ext=".pkg"] i::before,
-.file-icons [data-ext=".rpm"] i::before {
- content: "archive";
-}
-
-/* #999 - Compressed */
-
-.file-icons [data-ext=".7z"] i::before,
-.file-icons [data-ext=".bz2"] i::before,
-.file-icons [data-ext=".cab"] i::before,
-.file-icons [data-ext=".gz"] i::before,
-.file-icons [data-ext=".rar"] i::before,
-.file-icons [data-ext=".tar"] i::before,
-.file-icons [data-ext=".xz"] i::before,
-.file-icons [data-ext=".zip"] i::before,
-.file-icons [data-ext=".zst"] i::before {
- content: "folder_zip";
-}
-
-/* #999 - Disk */
-
-.file-icons [data-ext=".ccd"] i::before,
-.file-icons [data-ext=".dmg"] i::before,
-.file-icons [data-ext=".iso"] i::before,
-.file-icons [data-ext=".mdf"] i::before,
-.file-icons [data-ext=".vdi"] i::before,
-.file-icons [data-ext=".vhd"] i::before,
-.file-icons [data-ext=".vmdk"] i::before,
-.file-icons [data-ext=".wim"] i::before {
- content: "album";
-}
-
-/* #999 - Font */
-
-.file-icons [data-ext=".otf"] i::before,
-.file-icons [data-ext=".ttf"] i::before,
-.file-icons [data-ext=".woff"] i::before,
-.file-icons [data-ext=".woff2"] i::before {
- content: "font_download";
-}
-
-/* Colors */
-
-/* General */
-
-.file-icons [data-type="audio"] i {
- color: var(--icon-yellow);
-}
-.file-icons [data-type="image"] i {
- color: var(--icon-orange);
-}
-.file-icons [data-type="video"] i {
- color: var(--icon-violet);
-}
-.file-icons [data-type="invalid_link"] i {
- color: var(--icon-red);
-}
-
-/* #f00 - Adobe/Oracle */
-
-.file-icons [data-ext=".ai"] i,
-.file-icons [data-ext=".java"] i,
-.file-icons [data-ext=".jar"] i,
-.file-icons [data-ext=".psd"] i,
-.file-icons [data-ext=".rb"] i,
-.file-icons [data-ext=".pdf"] i {
- color: var(--icon-red);
-}
-
-/* #f90 - Image/Presentation */
-
-.file-icons [data-ext=".html"] i,
-.file-icons [data-ext=".odg"] i,
-.file-icons [data-ext=".odp"] i,
-.file-icons [data-ext=".ppt"] i,
-.file-icons [data-ext=".pptx"] i,
-.file-icons [data-ext=".vue"] i,
-.file-icons [data-ext=".xcf"] i {
- color: var(--icon-orange);
-}
-
-/* #ff0 - Various */
-
-.file-icons [data-ext=".css"] i,
-.file-icons [data-ext=".js"] i,
-.file-icons [data-ext=".json"] i,
-.file-icons [data-ext=".zip"] i {
- color: var(--icon-yellow);
-}
-
-/* #0f0 - Spreadsheet/Google */
-
-.file-icons [data-ext=".apk"] i,
-.file-icons [data-ext=".dex"] i,
-.file-icons [data-ext=".go"] i,
-.file-icons [data-ext=".ods"] i,
-.file-icons [data-ext=".xls"] i,
-.file-icons [data-ext=".xlsx"] i {
- color: var(--icon-green);
-}
-
-/* #00f - Document/Microsoft/Apple/Closed */
-
-.file-icons [data-ext=".aac"] i,
-.file-icons [data-ext=".bat"] i,
-.file-icons [data-ext=".cab"] i,
-.file-icons [data-ext=".cs"] i,
-.file-icons [data-ext=".dmg"] i,
-.file-icons [data-ext=".doc"] i,
-.file-icons [data-ext=".docx"] i,
-.file-icons [data-ext=".emf"] i,
-.file-icons [data-ext=".exe"] i,
-.file-icons [data-ext=".ico"] i,
-.file-icons [data-ext=".mp2"] i,
-.file-icons [data-ext=".mp3"] i,
-.file-icons [data-ext=".mp4"] i,
-.file-icons [data-ext=".mpg"] i,
-.file-icons [data-ext=".msi"] i,
-.file-icons [data-ext=".odt"] i,
-.file-icons [data-ext=".ps1"] i,
-.file-icons [data-ext=".rtf"] i,
-.file-icons [data-ext=".vob"] i,
-.file-icons [data-ext=".wim"] i {
- color: var(--icon-blue);
-}
-
-/* #60f - Various */
-
-.file-icons [data-ext=".iso"] i,
-.file-icons [data-ext=".php"] i,
-.file-icons [data-ext=".rar"] i {
- color: var(--icon-violet);
-}
-
-/* Overrides */
-
-.file-icons [data-dir="true"] i {
- color: var(--icon-blue);
-}
-.file-icons [data-dir="true"] i::before {
- content: "folder";
-}
-.file-icons [aria-selected="true"] i {
- color: var(--iconSecondary);
+#listing.mosaic.gallery .item .file-icon {
+ font-size: 96px;
}
diff --git a/frontend/src/css/listing.css b/frontend/src/css/listing.css
index d55fe67c..99ffe765 100644
--- a/frontend/src/css/listing.css
+++ b/frontend/src/css/listing.css
@@ -54,7 +54,7 @@ html[dir="rtl"] #listing {
font-weight: bold;
}
-#listing .item i {
+#listing .item .app-icon {
font-size: 4em;
margin-right: 0.1em;
vertical-align: bottom;
@@ -78,7 +78,7 @@ html[dir="rtl"] #listing {
font-weight: 500;
}
-.message i {
+.message .app-icon {
font-size: 2.5em;
margin-bottom: 0.2em;
display: block;
@@ -135,7 +135,7 @@ html[dir="rtl"] #listing {
background: linear-gradient(#0000, #0009);
}
-#listing.mosaic.gallery .item i {
+#listing.mosaic.gallery .item .app-icon {
width: 100%;
margin-right: 0;
font-size: 8em;
@@ -180,7 +180,7 @@ html[dir="rtl"] #listing {
width: 3em;
}
-#listing.list .item div:first-of-type i {
+#listing.list .item div:first-of-type .app-icon {
font-size: 2em;
}
@@ -208,7 +208,7 @@ html[dir="rtl"] #listing {
background-color: var(--iconTertiary);
}
-#listing.list .header i {
+#listing.list .header .app-icon {
font-size: 1.5em;
vertical-align: middle;
margin-left: 0.2em;
@@ -246,13 +246,13 @@ html[dir="rtl"] #listing {
vertical-align: middle;
}
-#listing.list .header i {
+#listing.list .header .app-icon {
opacity: 0;
transition: 0.1s ease all;
}
-#listing.list .header p:hover i,
-#listing.list .header .active i {
+#listing.list .header p:hover .app-icon,
+#listing.list .header .active .app-icon {
opacity: 1;
}
@@ -278,6 +278,6 @@ html[dir="rtl"] #listing {
}
#listing #multiple-selection p,
-#listing #multiple-selection i {
+#listing #multiple-selection .app-icon {
color: var(--iconSecondary);
}
diff --git a/frontend/src/css/notifications.css b/frontend/src/css/notifications.css
index c3913ff3..88122be6 100644
--- a/frontend/src/css/notifications.css
+++ b/frontend/src/css/notifications.css
@@ -24,12 +24,12 @@
gap: 12px;
min-width: 0;
}
-.notification-content > i {
+.notification-content > .app-icon {
font-size: 22px;
color: var(--icon-green);
flex-shrink: 0;
}
-.notification-content.error > i {
+.notification-content.error > .app-icon {
color: var(--red);
}
.notification-content > div {
diff --git a/frontend/src/css/resource-preview.css b/frontend/src/css/resource-preview.css
new file mode 100644
index 00000000..5617f81e
--- /dev/null
+++ b/frontend/src/css/resource-preview.css
@@ -0,0 +1,274 @@
+.workspace-brand .app-icon {
+ box-sizing: content-box;
+}
+.share {
+ display: grid;
+ grid-template-columns: minmax(0, 1fr);
+ gap: 16px;
+ align-items: start;
+ min-width: 0;
+}
+.share.share-with-preview,
+.share.share-directory {
+ grid-template-columns: minmax(240px, 320px) minmax(0, 1fr);
+}
+.share > .share__box {
+ margin: 0;
+ min-width: 0;
+ width: 100%;
+}
+.share > .share-info {
+ width: 100%;
+ max-width: 680px;
+ justify-self: center;
+ border: 1px solid var(--borderPrimary);
+ border-radius: 12px;
+}
+.share-with-preview > .share-info,
+.share-directory > .share-info {
+ position: sticky;
+ top: 80px;
+ max-height: calc(100vh - 100px);
+ overflow-y: auto;
+}
+.share-file-symbol {
+ display: flex;
+ justify-content: center;
+ padding: 24px;
+ border-top: 1px solid var(--borderPrimary);
+}
+.share-file-symbol .file-icon {
+ font-size: 88px;
+}
+.share-file-details {
+ margin: 0;
+}
+.share-file-details > div {
+ padding: 15px 18px;
+ border-top: 1px solid var(--borderPrimary);
+ min-width: 0;
+}
+.share-file-details dt {
+ margin-bottom: 6px;
+ font-size: 11px;
+ font-weight: 500;
+ color: var(--textPrimary);
+}
+.share-file-details dd {
+ margin: 0;
+ font-size: 13px;
+ line-height: 1.5;
+ overflow-wrap: anywhere;
+ word-break: break-word;
+ color: var(--textSecondary);
+}
+.share-info .share-download-actions {
+ padding: 18px;
+ border-top: 1px solid var(--borderPrimary);
+}
+.share-info .share-download-primary {
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ gap: 9px;
+ width: 100%;
+ min-height: 44px;
+ padding: 12px;
+ white-space: normal;
+ text-align: center;
+}
+.share-info .share-download-primary .app-icon {
+ font-size: 20px;
+}
+.public-document {
+ height: 75vh;
+ min-height: 320px;
+ border: 1px solid var(--borderPrimary);
+ border-radius: 12px;
+ overflow: hidden;
+}
+.resource-preview {
+ display: flex;
+ flex-direction: column;
+ align-items: stretch;
+ width: 100%;
+ height: 100%;
+ min-height: 0;
+ min-width: 0;
+ overflow: auto;
+ background: var(--background);
+}
+.resource-image {
+ display: block;
+ width: 100%;
+ height: 100%;
+ object-fit: contain;
+ min-height: 0;
+}
+.resource-preview audio {
+ width: 100%;
+ max-width: 520px;
+ margin: auto;
+}
+.resource-preview video {
+ width: 100%;
+ height: 100%;
+ object-fit: contain;
+ background: #080a10;
+}
+.resource-epub {
+ width: 100%;
+ height: 100%;
+ min-height: 0;
+ position: relative;
+}
+.resource-text {
+ flex: 1;
+ min-height: 0;
+ overflow: auto;
+ margin: 0;
+ padding: 20px;
+ font-size: 13px;
+ line-height: 1.6;
+ text-align: start;
+}
+pre.resource-text {
+ white-space: pre;
+ tab-size: 4;
+}
+.resource-preview .document-tools {
+ flex-shrink: 0;
+ justify-content: flex-start;
+}
+.resource-preview .csv-viewer {
+ height: 100%;
+ min-height: 0;
+}
+.preview-unavailable {
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ justify-content: center;
+ gap: 14px;
+ flex: 1;
+ padding: 24px;
+ min-height: 180px;
+ text-align: center;
+}
+.preview-unavailable .file-icon {
+ font-size: 80px;
+}
+.preview-unavailable p {
+ margin: 0;
+ font-size: 13px;
+}
+.preview-unavailable small {
+ font-size: 11px;
+ overflow-wrap: anywhere;
+}
+.pdf-open-native {
+ display: inline-flex;
+ gap: 7px;
+ align-items: center;
+ margin-inline-start: auto;
+ padding: 8px 10px;
+ border: 1px solid var(--borderPrimary);
+ border-radius: 7px;
+ color: var(--blue);
+ font-size: 12px;
+ white-space: nowrap;
+}
+.pdf-open-native .app-icon {
+ font-size: 17px;
+}
+.pdf-open-native:hover {
+ background: var(--hover);
+}
+#previewer .info .file-icon {
+ font-size: 72px;
+ display: block;
+ margin: 0 auto 16px;
+}
+@media (max-width: 1000px) {
+ .share.share-with-preview,
+ .share.share-directory {
+ grid-template-columns: minmax(0, 1fr);
+ }
+ .share-with-preview > .share-info,
+ .share-directory > .share-info {
+ position: static;
+ max-height: none;
+ max-width: none;
+ }
+}
+@media (max-width: 600px) {
+ .document-tools {
+ gap: 8px;
+ padding: 10px;
+ }
+ .document-tools input {
+ width: 62px;
+ }
+ .document-tools label {
+ flex-wrap: wrap;
+ }
+ .pdf-open-native {
+ margin-inline-start: 0;
+ }
+ .resource-text {
+ padding: 12px;
+ font-size: 12px;
+ }
+ .share-file-details > div {
+ padding: 12px 16px;
+ }
+}
+.zip-preview {
+ height: 100%;
+ min-height: 0;
+ overflow: auto;
+ padding: 16px;
+ text-align: start;
+}
+.zip-preview-note {
+ font-size: 12px;
+ color: var(--textSecondary);
+ margin: 0 0 12px;
+}
+.zip-tree-row {
+ min-height: 32px;
+ display: flex;
+ align-items: center;
+}
+.zip-tree-row button,
+.zip-tree-file {
+ display: flex;
+ align-items: center;
+ gap: 8px;
+ min-width: 0;
+ padding: 5px 0;
+ color: var(--textPrimary);
+ font-size: 13px;
+ text-align: start;
+}
+.zip-tree-row button {
+ background: none;
+ border: 0;
+ cursor: pointer;
+ width: 100%;
+}
+.zip-tree-row button:hover {
+ color: var(--blue);
+}
+.zip-tree-row .app-icon,
+.zip-tree-row .file-icon {
+ flex-shrink: 0;
+ font-size: 20px;
+}
+.zip-tree-file {
+ padding-inline-start: 28px;
+}
+.zip-tree-row span span,
+.zip-tree-row button span {
+ overflow-wrap: anywhere;
+}
diff --git a/frontend/src/css/settings.css b/frontend/src/css/settings.css
index 544728c1..777e8c07 100644
--- a/frontend/src/css/settings.css
+++ b/frontend/src/css/settings.css
@@ -53,7 +53,7 @@
background: var(--surfaceSecondary);
color: var(--blue);
}
-.settings-tabs i {
+.settings-tabs .app-icon {
font-size: 19px;
}
.preferences-form {
@@ -82,7 +82,7 @@
font-size: 16px;
font-weight: 600;
}
-.settings-section h2 > i {
+.settings-section h2 > .app-icon {
font-size: 21px;
color: var(--blue);
}
@@ -199,7 +199,7 @@
padding: 10px 14px;
flex-shrink: 0;
}
-.account-management i {
+.account-management .app-icon {
font-size: 16px;
}
.account-summary {
@@ -281,7 +281,7 @@
min-width: 0;
font-size: 12px;
}
- .settings-tabs i {
+ .settings-tabs .app-icon {
flex-shrink: 0;
}
}
@@ -331,7 +331,7 @@
.user-edit:hover {
background: var(--hover);
}
-.user-edit i {
+.user-edit .app-icon {
font-size: 19px;
}
@media (max-width: 480px) {
diff --git a/frontend/src/css/styles.css b/frontend/src/css/styles.css
index a7fca2ed..d6434e55 100644
--- a/frontend/src/css/styles.css
+++ b/frontend/src/css/styles.css
@@ -21,6 +21,7 @@
@import "./explorer.css";
@import "./settings.css";
@import "./notifications.css";
+@import "./resource-preview.css";
/* For testing only
:focus {
@@ -107,7 +108,7 @@ main .spinner .bounce2 {
cursor: not-allowed;
}
-.action i {
+.action .app-icon {
padding: 0.4em;
transition: 0.1s ease-in-out all;
border-radius: 50%;
@@ -190,7 +191,7 @@ main .spinner .bounce2 {
z-index: 19999;
}
-#previewer header > .action i {
+#previewer header > .action .app-icon {
color: #fff;
text-shadow: 1px 1px 1px #000000;
}
@@ -201,7 +202,7 @@ main .spinner .bounce2 {
}
@media (min-width: 738px) {
- #previewer header #dropdown .action i {
+ #previewer header #dropdown .action .app-icon {
color: #fff;
text-shadow: 1px 1px 1px #000000;
}
@@ -256,7 +257,7 @@ main .spinner .bounce2 {
#previewer .preview .info .title {
margin-bottom: 1em;
}
-#previewer .preview .info .title i {
+#previewer .preview .info .title .app-icon {
display: block;
margin-bottom: 0.1em;
font-size: 4em;
@@ -267,7 +268,7 @@ main .spinner .bounce2 {
#previewer .preview .info .button:hover {
background-color: rgba(255, 255, 255, 0.2);
}
-#previewer .preview .info .button i {
+#previewer .preview .info .button .app-icon {
display: block;
margin-bottom: 4px;
font-size: 1.3em;
@@ -303,7 +304,7 @@ main .spinner .bounce2 {
visibility: hidden;
}
-#previewer > button > i {
+#previewer > button > .app-icon {
padding: 0.4em;
}
@@ -370,7 +371,7 @@ html[dir="rtl"] .breadcrumbs .chevron {
font-size: 0.75rem;
}
-#editor-container .breadcrumbs i {
+#editor-container .breadcrumbs .app-icon {
font-size: 1rem;
}
diff --git a/frontend/src/css/upload-files.css b/frontend/src/css/upload-files.css
index ce864182..ca1a1c48 100644
--- a/frontend/src/css/upload-files.css
+++ b/frontend/src/css/upload-files.css
@@ -17,7 +17,7 @@
align-items: center;
}
-.upload-files .file .file-name i {
+.upload-files .file .file-name .app-icon {
margin-right: 5px;
}
diff --git a/frontend/src/css/workspace.css b/frontend/src/css/workspace.css
index 351194e3..e5895c1d 100644
--- a/frontend/src/css/workspace.css
+++ b/frontend/src/css/workspace.css
@@ -281,7 +281,7 @@
color: var(--surfacePrimary);
text-decoration: none;
}
-.share__box__element .share-download-primary i {
+.share__box__element .share-download-primary .app-icon {
display: block;
margin: 0;
font-size: 24px;
@@ -359,7 +359,7 @@
overflow-wrap: anywhere;
word-break: break-word;
}
-.managed-share-meta i {
+.managed-share-meta .app-icon {
font-size: 16px;
vertical-align: middle;
}
@@ -493,7 +493,7 @@ nav .disk-usage {
margin-top: 7px;
color: var(--textPrimary);
}
-.share-link-details small i {
+.share-link-details small .app-icon {
font-size: 16px;
}
.share-link-actions {
@@ -514,7 +514,7 @@ nav .disk-usage {
padding: 0;
line-height: 1;
}
-.share-link-actions .action i {
+.share-link-actions .action .app-icon {
position: static;
display: block;
transform: none;
@@ -561,7 +561,7 @@ nav .disk-usage {
background: white;
border-radius: 10px;
}
-.share__box__icon i {
+.share__box__icon .app-icon {
font-size: 80px;
}
:root {
@@ -635,7 +635,7 @@ header img {
font-weight: 650;
letter-spacing: -0.4px;
}
-.workspace-brand i {
+.workspace-brand .app-icon {
padding: 7px;
border-radius: 9px;
background: var(--hover);
@@ -686,7 +686,7 @@ nav .action {
margin-block: 3px;
text-align: start;
}
-nav .action i {
+nav .action .app-icon {
font-size: 21px;
margin-inline-end: 10px;
}
@@ -760,7 +760,7 @@ main #listing.list {
box-shadow: none !important;
border-color: var(--blue);
}
-#listing.mosaic .item i {
+#listing.mosaic .item .app-icon {
font-size: 42px;
}
@supports (content-visibility: auto) {
@@ -862,7 +862,7 @@ select:focus {
background: var(--hover);
color: var(--blue);
}
-.sso-symbol i {
+.sso-symbol .app-icon {
font-size: 34px;
}
.eyebrow {
@@ -918,7 +918,7 @@ select:focus {
min-width: 0;
font-size: 14px;
}
- .workspace-brand i {
+ .workspace-brand .app-icon {
display: none;
}
.workspace-overview {
diff --git a/frontend/src/i18n/en.json b/frontend/src/i18n/en.json
index b61bd200..5552fd0b 100644
--- a/frontend/src/i18n/en.json
+++ b/frontend/src/i18n/en.json
@@ -343,15 +343,22 @@
},
"documents": {
"frame": "Frame",
- "window": "Window width",
- "level": "Window center",
+ "window": "Contrast (window width)",
+ "level": "Brightness (window level)",
"reset": "Reset",
"page": "Page",
"zoom": "Zoom",
"dicomImage": "DICOM image",
"pdfPage": "PDF page",
"tooLarge": "File too large for preview (64 MiB maximum).",
- "loadFailed": "Unable to display this file"
+ "loadFailed": "Unable to display this file",
+ "openNewTab": "Open in new tab",
+ "textTooLarge": "This file is too large for preview.",
+ "zipTreeOnly": "Archive contents — files are not extracted",
+ "zipEmpty": "Empty archive",
+ "zipVisibleLimit": "Showing the first 1000 rows. Collapse folders to see other entries.",
+ "zipLimit": "The file list exceeds safe preview limits.",
+ "zipUnavailable": "Unable to read the file list. A standard ZIP and server support for range requests are required."
},
"fileInfo": {
"dicom": "DICOM metadata",
diff --git a/frontend/src/i18n/ru.json b/frontend/src/i18n/ru.json
index 4ac401f2..107ed417 100644
--- a/frontend/src/i18n/ru.json
+++ b/frontend/src/i18n/ru.json
@@ -340,15 +340,22 @@
},
"documents": {
"frame": "Кадр",
- "window": "Ширина окна",
- "level": "Уровень",
+ "window": "Контраст (ширина окна)",
+ "level": "Яркость (уровень окна)",
"reset": "Сбросить",
"page": "Страница",
"zoom": "Масштаб",
"dicomImage": "Изображение DICOM",
"pdfPage": "Страница PDF",
"tooLarge": "Файл слишком большой для предпросмотра (максимум 64 МиБ).",
- "loadFailed": "Не удалось отобразить файл"
+ "loadFailed": "Не удалось отобразить файл",
+ "openNewTab": "Открыть в новой вкладке",
+ "textTooLarge": "Файл слишком большой для предпросмотра.",
+ "zipTreeOnly": "Содержимое архива — без распаковки файлов",
+ "zipEmpty": "Архив пуст",
+ "zipVisibleLimit": "Показаны первые 1000 строк. Сверните папки, чтобы увидеть остальные.",
+ "zipLimit": "Список файлов превышает безопасные лимиты предпросмотра.",
+ "zipUnavailable": "Не удалось прочитать список файлов. Требуется обычный ZIP и поддержка частичного скачивания сервером."
},
"fileInfo": {
"dicom": "Метаданные DICOM",
diff --git a/frontend/src/main.ts b/frontend/src/main.ts
index fe59d769..8f4fa7d3 100644
--- a/frontend/src/main.ts
+++ b/frontend/src/main.ts
@@ -11,6 +11,7 @@ import router from "@/router";
import i18n, { isRtl } from "@/i18n";
import App from "@/App.vue";
import CustomToast from "@/components/CustomToast.vue";
+import AppIcon from "@/components/AppIcon.vue";
import dayjs from "dayjs";
import localizedFormat from "dayjs/plugin/localizedFormat";
@@ -27,6 +28,7 @@ dayjs.extend(duration);
const pinia = createPinia(router);
const app = createApp(App);
+app.component("AppIcon", AppIcon);
app.component(VueNumberInput.name || "vue-number-input", VueNumberInput);
app.use(VueLazyload);
diff --git a/frontend/src/types/api.d.ts b/frontend/src/types/api.d.ts
index f4864724..73cec5c9 100644
--- a/frontend/src/types/api.d.ts
+++ b/frontend/src/types/api.d.ts
@@ -1,10 +1,7 @@
type ApiMethod = "GET" | "POST" | "PUT" | "DELETE" | "PATCH";
type ApiContent =
- | Blob
- | File
- | Pick
, "read">
- | "";
+ Blob | File | Pick, "read"> | "";
interface ApiOpts {
method?: ApiMethod;
diff --git a/frontend/src/types/components.d.ts b/frontend/src/types/components.d.ts
new file mode 100644
index 00000000..ce3986c0
--- /dev/null
+++ b/frontend/src/types/components.d.ts
@@ -0,0 +1,6 @@
+export {};
+declare module "vue" {
+ export interface GlobalComponents {
+ AppIcon: (typeof import("../components/AppIcon.vue"))["default"];
+ }
+}
diff --git a/frontend/src/utils/__tests__/preview.test.ts b/frontend/src/utils/__tests__/preview.test.ts
new file mode 100644
index 00000000..9478a372
--- /dev/null
+++ b/frontend/src/utils/__tests__/preview.test.ts
@@ -0,0 +1,42 @@
+import { afterEach, expect, it, vi } from "vitest";
+import { previewBuffer, previewKind } from "../preview";
+afterEach(() => vi.unstubAllGlobals());
+it("classifies supported previews before server fallback types", () => {
+ for (const [name, kind] of [
+ ["a.ZIP", "zip"],
+ ["a.dcm", "dicom"],
+ ["a.pdf", "pdf"],
+ ["a.csv", "csv"],
+ ["a.md", "markdown"],
+ ["a.tif", "tiff"],
+ ["a.mp3", "audio"],
+ ["a.mp4", "video"],
+ ["a.png", "image"],
+ ["a.epub", "epub"],
+ ["a.html", "text"],
+ ])
+ expect(previewKind(name, "blob")).toBe(kind);
+ expect(previewKind("installer.msi", "blob")).toBeNull();
+ expect(previewKind("folder.zip", "", true)).toBeNull();
+});
+it("bounds preview data even without Content-Length", async () => {
+ const cancel = vi.fn();
+ vi.stubGlobal(
+ "fetch",
+ vi.fn(
+ async () =>
+ new Response(
+ new ReadableStream({
+ start(controller) {
+ controller.enqueue(new Uint8Array(11));
+ },
+ cancel,
+ })
+ )
+ )
+ );
+ await expect(
+ previewBuffer("/raw", new AbortController().signal, 10)
+ ).rejects.toThrow("PREVIEW_TOO_LARGE");
+ expect(cancel).toHaveBeenCalledOnce();
+});
diff --git a/frontend/src/utils/__tests__/zip-preview.test.ts b/frontend/src/utils/__tests__/zip-preview.test.ts
new file mode 100644
index 00000000..09b84dba
--- /dev/null
+++ b/frontend/src/utils/__tests__/zip-preview.test.ts
@@ -0,0 +1,159 @@
+import { afterEach, describe, expect, it, vi } from "vitest";
+import { zipDirectory, zipTree } from "../zip-preview";
+function central(names: string[]) {
+ const records = names.map((name) => {
+ const text = new TextEncoder().encode(name),
+ data = new Uint8Array(46 + text.length),
+ view = new DataView(data.buffer);
+ view.setUint32(0, 0x02014b50, true);
+ view.setUint16(28, text.length, true);
+ // Huge claimed inflated sizes must never cause allocation or extraction.
+ view.setUint32(24, 0xffffffff, true);
+ data.set(text, 46);
+ return data;
+ });
+ const result = new Uint8Array(records.reduce((n, row) => n + row.length, 0));
+ let offset = 0;
+ for (const row of records) {
+ result.set(row, offset);
+ offset += row.length;
+ }
+ return result;
+}
+function archive(names: string[]) {
+ const directory = central(names),
+ data = new Uint8Array(100000 + directory.length + 22);
+ data.set(directory, 100000);
+ const end = new DataView(data.buffer, data.length - 22);
+ end.setUint32(0, 0x06054b50, true);
+ end.setUint16(8, names.length, true);
+ end.setUint16(10, names.length, true);
+ end.setUint32(12, directory.length, true);
+ end.setUint32(16, 100000, true);
+ return data;
+}
+afterEach(() => vi.unstubAllGlobals());
+describe("ZIP listing without extraction", () => {
+ it("fetches a larger central directory separately without reading file data", async () => {
+ const names = Array.from(
+ { length: 2000 },
+ (_, index) => `folder/file-${index}.txt`
+ );
+ const data = archive(names);
+ const fetcher = vi.fn(async (_source: string, options: RequestInit) => {
+ const [, start, end] = /bytes=(\d+)-(\d+)/.exec(
+ (options.headers as Record).Range
+ )!;
+ expect(Number(start)).toBeGreaterThanOrEqual(100000);
+ return new Response(data.slice(Number(start), Number(end) + 1), {
+ status: 206,
+ headers: { "Content-Range": `bytes ${start}-${end}/${data.length}` },
+ });
+ });
+ vi.stubGlobal("fetch", fetcher);
+ expect(
+ (await zipTree("/zip", data.length, new AbortController().signal))[0]
+ .children
+ ).toHaveLength(2000);
+ expect(fetcher).toHaveBeenCalledTimes(2);
+ });
+ it("builds directories, merges explicit parents and sorts folders first", () => {
+ const rows = zipDirectory(central(["z.txt", "scans/a.dcm", "scans/"]), 3);
+ expect(rows.map((node) => node.name)).toEqual(["scans", "z.txt"]);
+ expect(rows[0].children[0].name).toBe("a.dcm");
+ });
+ it("rejects traversal, conflicting paths, deep trees and truncated records", () => {
+ for (const name of ["../a", "/a", "a/./b", "a\u0000b", "a/".repeat(33)])
+ expect(() => zipDirectory(central([name]), 1)).toThrow();
+ expect(() => zipDirectory(central(["a", "a/b"]), 2)).toThrow();
+ expect(() => zipDirectory(central(["a"]).subarray(0, 45), 1)).toThrow();
+ expect(() => zipDirectory(new Uint8Array(), 10001)).toThrow("ZIP_LIMIT");
+ expect(() => zipDirectory(new Uint8Array(4 * 1024 * 1024 + 1), 0)).toThrow(
+ "ZIP_LIMIT"
+ );
+ });
+ it("reads only the bounded tail and central directory, never local entries", async () => {
+ const data = archive(["a.dcm"]);
+ const fetcher = vi.fn(async (_source: string, options: RequestInit) => {
+ const header = (options.headers as Record).Range;
+ const [, start, end] = /bytes=(\d+)-(\d+)/.exec(header)!;
+ expect(Number(start)).toBeGreaterThan(0);
+ return new Response(data.slice(Number(start), Number(end) + 1), {
+ status: 206,
+ headers: { "Content-Range": `bytes ${start}-${end}/${data.length}` },
+ });
+ });
+ vi.stubGlobal("fetch", fetcher);
+ expect(
+ (
+ await zipTree("/raw/a.zip", data.length, new AbortController().signal)
+ )[0].name
+ ).toBe("a.dcm");
+ expect(fetcher).toHaveBeenCalledTimes(1);
+ });
+ it("refuses full responses instead of downloading the archive", async () => {
+ const cancel = vi.fn();
+ vi.stubGlobal(
+ "fetch",
+ vi.fn(
+ async () =>
+ new Response(new ReadableStream({ cancel }), { status: 200 })
+ )
+ );
+ await expect(
+ zipTree("/zip", 100000, new AbortController().signal)
+ ).rejects.toThrow("ZIP_RANGE");
+ expect(cancel).toHaveBeenCalledOnce();
+ });
+ it("rejects ZIP64 and oversized central directories before a second request", async () => {
+ for (const field of ["zip64", "directory", "entries"]) {
+ const data = archive(["a"]),
+ end = new DataView(data.buffer, data.length - 22);
+ if (field === "zip64") end.setUint32(16, 0xffffffff, true);
+ if (field === "directory") end.setUint32(12, 5 * 1024 * 1024, true);
+ if (field === "entries") {
+ end.setUint16(8, 10001, true);
+ end.setUint16(10, 10001, true);
+ }
+ const fetcher = vi.fn(
+ async () =>
+ new Response(data.slice(data.length - 65557), {
+ status: 206,
+ headers: {
+ "Content-Range": `bytes ${data.length - 65557}-${data.length - 1}/${data.length}`,
+ },
+ })
+ );
+ vi.stubGlobal("fetch", fetcher);
+ await expect(
+ zipTree("/zip", data.length, new AbortController().signal)
+ ).rejects.toThrow();
+ expect(fetcher).toHaveBeenCalledOnce();
+ }
+ });
+ it("cancels a range response exceeding its declared size", async () => {
+ const cancel = vi.fn();
+ vi.stubGlobal(
+ "fetch",
+ vi.fn(
+ async () =>
+ new Response(
+ new ReadableStream({
+ start(controller) {
+ controller.enqueue(new Uint8Array(65558));
+ },
+ cancel,
+ }),
+ {
+ status: 206,
+ headers: { "Content-Range": "bytes 34443-99999/100000" },
+ }
+ )
+ )
+ );
+ await expect(
+ zipTree("/zip", 100000, new AbortController().signal)
+ ).rejects.toThrow("ZIP_LIMIT");
+ expect(cancel).toHaveBeenCalledOnce();
+ });
+});
diff --git a/frontend/src/utils/icons.ts b/frontend/src/utils/icons.ts
new file mode 100644
index 00000000..9d62951b
--- /dev/null
+++ b/frontend/src/utils/icons.ts
@@ -0,0 +1,171 @@
+// Native SVG paths: one stroke weight, rounded ends and no icon font requests.
+const paths: Record = {
+ file: "M6 3h8l4 4v14H6z M14 3v5h4 M9 12h6 M9 16h6",
+ folder: "M3 7V5h7l2 2h9v13H3z",
+ folderOpen: "M3 10V5h7l2 2h9v3 M3 10h19l-3 10H3z",
+ home: "m3 10 9-7 9 7 M5 9v12h5v-7h4v7h5V9",
+ search: "M20 20l-5-5 M17 10a7 7 0 1 1-14 0 7 7 0 0 1 14 0",
+ close: "m6 6 12 12 M6 18 18 6",
+ add: "M12 5v14 M5 12h14",
+ remove: "M5 12h14",
+ right: "m9 5 7 7-7 7",
+ left: "m15 5-7 7 7 7",
+ down: "m5 9 7 7 7-7",
+ up: "m5 15 7-7 7 7",
+ download: "M12 3v12 m-5-5 5 5 5-5 M4 16v5h16v-5",
+ upload: "M12 16V4 m-5 5 5-5 5 5 M4 16v5h16v-5",
+ trash: "M3 6h18 M9 6V3h6v3 M5 6l1 15h12l1-15 M10 10v7 M14 10v7",
+ edit: "m15 4 5 5 M4 20l5-1L21 7l-5-5L4 14z",
+ copy: "M8 8h12v13H8z M4 16H2V2h13v2",
+ paste: "M9 4H5v17h14V4h-4 M9 2h6v5H9z M8 11h8 M8 15h8",
+ cut: "M9 8 20 20 M9 16 20 4 M9 7a3 3 0 1 1-6 0 3 3 0 0 1 6 0 M9 17a3 3 0 1 1-6 0 3 3 0 0 1 6 0",
+ settings:
+ "M12 3v3 M12 18v3 M3 12h3 M18 12h3 M5.5 5.5l2 2 M16.5 16.5l2 2 M5.5 18.5l2-2 M16.5 7.5l2-2 M17 12a5 5 0 1 1-10 0 5 5 0 0 1 10 0",
+ sliders: "M4 7h3 M11 7h9 M4 17h9 M17 17h3 M7 4h4v6H7z M13 14h4v6h-4z",
+ user: "M16 7a4 4 0 1 1-8 0 4 4 0 0 1 8 0 M4 21v-3a8 5 0 0 1 16 0v3",
+ users:
+ "M14 7a4 4 0 1 1-8 0 4 4 0 0 1 8 0 M2 21v-3a8 5 0 0 1 16 0v3 M17 3a4 4 0 0 1 0 8 M20 15a4 4 0 0 1 2 4v2",
+ link: "m9 15 6-6 M8 16l-1 1a4 4 0 0 1-6-6l5-5a4 4 0 0 1 6 0 M16 8l1-1a4 4 0 0 1 6 6l-5 5a4 4 0 0 1-6 0",
+ external: "M14 3h7v7 M21 3 10 14 M10 3H3v18h18v-7",
+ back: "M20 12H4 m6-6-6 6 6 6",
+ more: "M5 12h.01 M12 12h.01 M19 12h.01",
+ moreVertical: "M12 5v.01 M12 12v.01 M12 19v.01",
+ menu: "M3 6h18 M3 12h18 M3 18h18",
+ info: "M12 11v6 M12 7v.01 M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0",
+ warning: "m12 3 10 18H2z M12 9v5 M12 17v.01",
+ check: "m4 12 5 5L20 6",
+ checkCircle: "m8 12 3 3 5-6 M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0",
+ refresh: "M20 8a8 8 0 1 0 0 8 M20 3v5h-5",
+ undo: "m8 4-5 5 5 5 M3 9h11a6 6 0 0 1 0 12",
+ save: "M4 3h13l4 4v14H3V3z M7 3v6h9V3 M7 21v-8h10v8",
+ login: "M13 3h8v18h-8 M3 12h13 m-5-5 5 5-5 5",
+ logout: "M11 3H3v18h8 M9 12h12 m-5-5 5 5-5 5",
+ eye: "M2 12s4-7 10-7 10 7 10 7-4 7-10 7S2 12 2 12 M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0",
+ image: "M3 3h18v18H3z m0 14 6-6 5 5 3-3 4 4 M16 7h.01",
+ music:
+ "M10 17V5l10-2v12 M10 17a3 3 0 1 1-6 0 3 3 0 0 1 6 0 M20 15a3 3 0 1 1-6 0 3 3 0 0 1 6 0",
+ video: "M3 5h12v14H3z m12 5 7-4v12l-7-4",
+ table: "M3 4h18v16H3z M3 9h18 M3 14h18 M9 4v16 M15 4v16",
+ code: "m8 6-6 6 6 6 m8-12 6 6-6 6 M14 3l-4 18",
+ archive: "M3 4h18v5H3z M5 9v12h14V9 M10 13h4",
+ disc: "M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0 M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0",
+ package: "m3 7 9-4 9 4-9 4z M3 7v10l9 4 9-4V7 M12 11v10 M7 5l10 4",
+ calendar: "M4 5h16v16H4z M8 3v4 M16 3v4 M4 10h16 M8 14h2 M14 14h2",
+ server: "M3 3h18v7H3z M3 14h18v7H3z M7 6.5h.01 M7 17.5h.01",
+ globe:
+ "M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0 M3 12h18 M12 3c5 5 5 13 0 18-5-5-5-13 0-18",
+ bookmark: "M6 3h12v18l-6-4-6 4z",
+ star: "m12 3 3 6 7 1-5 5 1 7-6-3-6 3 1-7-5-5 7-1z",
+ mouse: "M5 10a7 7 0 0 1 14 0v5a7 7 0 0 1-14 0z M12 3v7 M5 10h14",
+ contrast: "M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0 M12 3v18 M16 6v12",
+ lock: "M5 10h14v11H5z M8 10V6a4 4 0 0 1 8 0v4 M12 14v3",
+ shield: "M12 2 3 6v6c0 5 9 10 9 10s9-5 9-10V6z m-5 10 3 3 5-6",
+ palette:
+ "M12 3a9 9 0 1 0 0 18c3 0 1-4 3-4h3c5 0 4-14-6-14 M7 10h.01 M10 6h.01 M15 7h.01 M18 11h.01",
+ share:
+ "M8 12 17 6 M8 12l9 6 M8 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0 M22 5a3 3 0 1 1-6 0 3 3 0 0 1 6 0 M22 19a3 3 0 1 1-6 0 3 3 0 0 1 6 0",
+};
+const aliases: Record = {
+ cloud_off: "warning",
+ gps_off: "search",
+ edit_note: "edit",
+ view_module: "table",
+ grid_view: "table",
+ view_list: "menu",
+ insert_drive_file: "file",
+ description: "file",
+ note_add: "file",
+ picture_as_pdf: "file",
+ article: "file",
+ font_download: "file",
+ web_asset: "package",
+ folder_open: "folderOpen",
+ folder_copy: "folder",
+ folder_shared: "folder",
+ create_new_folder: "folder",
+ folder_zip: "archive",
+ insert_photo: "image",
+ volume_up: "music",
+ movie: "video",
+ slideshow: "video",
+ border_all: "table",
+ album: "disc",
+ clear: "close",
+ cancel: "close",
+ delete: "trash",
+ delete_outline: "trash",
+ mode_edit: "edit",
+ content_copy: "copy",
+ content_paste: "paste",
+ content_cut: "cut",
+ settings_applications: "settings",
+ manage_accounts: "user",
+ account_circle: "user",
+ person: "user",
+ person_add: "user",
+ group: "users",
+ tune: "sliders",
+ open_in_new: "external",
+ north_east: "external",
+ arrow_back: "back",
+ forward: "right",
+ chevron_right: "right",
+ keyboard_arrow_right: "right",
+ chevron_left: "left",
+ keyboard_arrow_left: "left",
+ expand_more: "down",
+ keyboard_arrow_down: "down",
+ expand_less: "up",
+ keyboard_arrow_up: "up",
+ arrow_upward: "up",
+ arrow_downward: "down",
+ arrow_drop_up: "up",
+ arrow_drop_down: "down",
+ sort: "sliders",
+ file_download: "download",
+ file_upload: "upload",
+ cloud_upload: "upload",
+ exit_to_app: "logout",
+ more_horiz: "more",
+ more_vert: "moreVertical",
+ info_outline: "info",
+ feedback: "info",
+ error_outline: "warning",
+ error: "warning",
+ sentiment_dissatisfied: "info",
+ check_circle: "checkCircle",
+ done: "check",
+ done_all: "check",
+ checklist: "check",
+ select_all: "check",
+ check_box: "check",
+ autorenew: "refresh",
+ replay: "refresh",
+ refresh: "refresh",
+ bookmark_add: "bookmark",
+ star_outline: "star",
+ public: "globe",
+ language: "globe",
+ dns: "server",
+ storage: "server",
+ policy: "shield",
+ security: "shield",
+ help: "info",
+ visibility: "eye",
+ visibility_off: "eye",
+ preview: "eye",
+ photo_size_select_large: "image",
+ hd: "image",
+ zoom_in: "add",
+ zoom_out: "remove",
+ stop_circle: "close",
+ schedule: "calendar",
+ link_off: "link",
+ add_link: "link",
+};
+export function iconPath(name = "file"): string {
+ return paths[aliases[name] || name] || paths.file;
+}
+export function hasIcon(name: string): boolean {
+ return !!(paths[name] || paths[aliases[name]]);
+}
diff --git a/frontend/src/utils/preview.ts b/frontend/src/utils/preview.ts
new file mode 100644
index 00000000..bf99d367
--- /dev/null
+++ b/frontend/src/utils/preview.ts
@@ -0,0 +1,118 @@
+export type PreviewKind =
+ | "zip"
+ | "pdf"
+ | "dicom"
+ | "image"
+ | "tiff"
+ | "audio"
+ | "video"
+ | "text"
+ | "markdown"
+ | "csv"
+ | "epub";
+export function previewKind(
+ name: string,
+ type = "",
+ directory = false
+): PreviewKind | null {
+ if (directory) return null;
+ const ext = name.split(".").pop()?.toLowerCase() || "";
+ if (["dcm", "dicom"].includes(ext)) return "dicom";
+ if (ext === "pdf") return "pdf";
+ if (ext === "zip") return "zip";
+ if (ext === "csv") return "csv";
+ if (["md", "markdown"].includes(ext)) return "markdown";
+ if (ext === "epub") return "epub";
+ if (["tif", "tiff", "dng", "cr2", "nef"].includes(ext)) return "tiff";
+ if (
+ [
+ "png",
+ "jpg",
+ "jpeg",
+ "jfif",
+ "gif",
+ "webp",
+ "avif",
+ "bmp",
+ "ico",
+ "svg",
+ ].includes(ext) ||
+ type === "image"
+ )
+ return "image";
+ if (
+ ["mp3", "wav", "ogg", "oga", "flac", "m4a", "aac", "opus"].includes(ext) ||
+ type === "audio"
+ )
+ return "audio";
+ if (["mp4", "m4v", "webm", "ogv", "mov"].includes(ext) || type === "video")
+ return "video";
+ if (
+ [
+ "txt",
+ "tsv",
+ "log",
+ "json",
+ "xml",
+ "yaml",
+ "yml",
+ "toml",
+ "ini",
+ "conf",
+ "css",
+ "js",
+ "ts",
+ "jsx",
+ "tsx",
+ "html",
+ "htm",
+ "sh",
+ "bat",
+ "ps1",
+ "py",
+ "go",
+ "rs",
+ "c",
+ "cpp",
+ "h",
+ "java",
+ "sql",
+ ].includes(ext) ||
+ ["text", "textImmutable"].includes(type)
+ )
+ return "text";
+ return null;
+}
+export async function previewBuffer(
+ source: string,
+ signal: AbortSignal,
+ limit = 5 * 1024 * 1024
+): Promise {
+ const response = await fetch(source, { credentials: "same-origin", signal });
+ if (!response.ok) throw new Error(`HTTP ${response.status}`);
+ if (Number(response.headers.get("Content-Length")) > limit) {
+ await response.body?.cancel();
+ throw new Error("PREVIEW_TOO_LARGE");
+ }
+ const reader = response.body?.getReader();
+ if (!reader) throw new Error("Empty response");
+ const chunks: Uint8Array[] = [];
+ let length = 0;
+ while (true) {
+ const result = await reader.read();
+ if (result.done) break;
+ length += result.value.length;
+ if (length > limit) {
+ await reader.cancel();
+ throw new Error("PREVIEW_TOO_LARGE");
+ }
+ chunks.push(result.value);
+ }
+ const data = new Uint8Array(length);
+ let offset = 0;
+ for (const chunk of chunks) {
+ data.set(chunk, offset);
+ offset += chunk.length;
+ }
+ return data.buffer;
+}
diff --git a/frontend/src/utils/zip-preview.ts b/frontend/src/utils/zip-preview.ts
new file mode 100644
index 00000000..f7dfc233
--- /dev/null
+++ b/frontend/src/utils/zip-preview.ts
@@ -0,0 +1,155 @@
+// List the central directory only. Never read, inflate or follow file entries.
+const MAX_DIRECTORY = 4 * 1024 * 1024;
+const MAX_ENTRIES = 10000;
+const MAX_NODES = 20000;
+export interface ZipNode {
+ name: string;
+ directory: boolean;
+ children: ZipNode[];
+}
+export function zipDirectory(data: Uint8Array, expected: number): ZipNode[] {
+ if (data.length > MAX_DIRECTORY || expected > MAX_ENTRIES)
+ throw new Error("ZIP_LIMIT");
+ const view = new DataView(data.buffer, data.byteOffset, data.byteLength);
+ const root: ZipNode = { name: "", directory: true, children: [] };
+ const nodes = new Map();
+ let offset = 0;
+ for (let index = 0; index < expected; index++) {
+ if (
+ offset + 46 > data.length ||
+ view.getUint32(offset, true) !== 0x02014b50
+ )
+ throw new Error("ZIP_INVALID");
+ const length = view.getUint16(offset + 28, true);
+ const end = offset + 46 + length;
+ const next =
+ end +
+ view.getUint16(offset + 30, true) +
+ view.getUint16(offset + 32, true);
+ if (!length || length > 1024 || next > data.length)
+ throw new Error("ZIP_LIMIT");
+ // Filenames are rendered as text, never used as filesystem paths or URLs.
+ const name = new TextDecoder("utf-8").decode(
+ data.subarray(offset + 46, end)
+ );
+ const parts = name.replace(/\\/g, "/").split("/");
+ const directory = parts[parts.length - 1] === "";
+ if (directory) parts.pop();
+ if (
+ parts.length > 32 ||
+ parts.some(
+ (part) =>
+ !part ||
+ part === "." ||
+ part === ".." ||
+ /[\u0000-\u001f\u007f]/.test(part)
+ )
+ )
+ throw new Error("ZIP_INVALID");
+ let parent = root,
+ key = "";
+ for (let i = 0; i < parts.length; i++) {
+ key += "/" + parts[i];
+ const isDirectory = i < parts.length - 1 || directory;
+ let node = nodes.get(key);
+ if (!node) {
+ if (nodes.size >= MAX_NODES) throw new Error("ZIP_LIMIT");
+ node = { name: parts[i], directory: isDirectory, children: [] };
+ nodes.set(key, node);
+ parent.children.push(node);
+ } else if (node.directory !== isDirectory) throw new Error("ZIP_INVALID");
+ parent = node;
+ }
+ offset = next;
+ }
+ if (offset !== data.length) throw new Error("ZIP_INVALID");
+ function sort(node: ZipNode) {
+ node.children.sort(
+ (a, b) =>
+ Number(b.directory) - Number(a.directory) ||
+ a.name.localeCompare(b.name)
+ );
+ node.children.forEach(sort);
+ }
+ sort(root);
+ return root.children;
+}
+async function range(
+ source: string,
+ start: number,
+ end: number,
+ size: number,
+ signal: AbortSignal
+) {
+ const response = await fetch(source, {
+ credentials: "same-origin",
+ signal,
+ headers: { Range: `bytes=${start}-${end}` },
+ });
+ const expected = end - start + 1;
+ if (
+ response.status !== 206 ||
+ response.headers.get("Content-Range") !== `bytes ${start}-${end}/${size}` ||
+ (response.headers.has("Content-Length") &&
+ Number(response.headers.get("Content-Length")) !== expected)
+ ) {
+ await response.body?.cancel();
+ throw new Error("ZIP_RANGE");
+ }
+ const reader = response.body?.getReader();
+ if (!reader) throw new Error("ZIP_INVALID");
+ const bytes = new Uint8Array(expected);
+ let offset = 0;
+ while (true) {
+ const { value, done } = await reader.read();
+ if (done) break;
+ if (offset + value.length > expected) {
+ await reader.cancel();
+ throw new Error("ZIP_LIMIT");
+ }
+ bytes.set(value, offset);
+ offset += value.length;
+ }
+ if (offset !== expected) throw new Error("ZIP_INVALID");
+ return bytes;
+}
+export async function zipTree(
+ source: string,
+ size: number,
+ signal: AbortSignal
+): Promise {
+ if (!Number.isSafeInteger(size) || size < 22) throw new Error("ZIP_INVALID");
+ const start = Math.max(0, size - 65557);
+ const tail = await range(source, start, size - 1, size, signal);
+ const view = new DataView(tail.buffer);
+ for (let at = tail.length - 22; at >= 0; at--) {
+ if (
+ view.getUint32(at, true) !== 0x06054b50 ||
+ at + 22 + view.getUint16(at + 20, true) !== tail.length
+ )
+ continue;
+ const entries = view.getUint16(at + 10, true);
+ const length = view.getUint32(at + 12, true);
+ const offset = view.getUint32(at + 16, true);
+ if (
+ view.getUint16(at + 4, true) ||
+ view.getUint16(at + 6, true) ||
+ view.getUint16(at + 8, true) !== entries ||
+ entries === 65535 ||
+ length === 0xffffffff ||
+ offset === 0xffffffff
+ )
+ throw new Error("ZIP_UNSUPPORTED");
+ if (entries > MAX_ENTRIES || length > MAX_DIRECTORY)
+ throw new Error("ZIP_LIMIT");
+ if (offset + length !== start + at) throw new Error("ZIP_INVALID");
+ if (!entries && !length) return [];
+ if (!length) throw new Error("ZIP_INVALID");
+ const data =
+ offset >= start
+ ? tail.subarray(offset - start, offset - start + length)
+ : await range(source, offset, offset + length - 1, size, signal);
+ return zipDirectory(data, entries);
+ }
+ throw new Error("ZIP_INVALID");
+}
diff --git a/frontend/src/views/Errors.vue b/frontend/src/views/Errors.vue
index a895ea9e..04feeb7f 100644
--- a/frontend/src/views/Errors.vue
+++ b/frontend/src/views/Errors.vue
@@ -3,7 +3,7 @@
- {{ info.icon }}
+
{{ t(info.message) }}
diff --git a/frontend/src/views/Files.vue b/frontend/src/views/Files.vue
index bca59817..aee0b887 100644
--- a/frontend/src/views/Files.vue
+++ b/frontend/src/views/Files.vue
@@ -67,24 +67,13 @@ const currentView = computed(() => {
if (fileStore.req.isDir) {
return FileListing;
- } else if (
- [".dcm", ".dicom", ".pdf"].includes(fileStore.req.extension.toLowerCase())
- ) {
- return Preview;
- } else if (fileStore.req.extension.toLowerCase() === ".csv") {
- // CSV files use Preview for table view, unless ?edit=true
- if (route.query.edit === "true") {
- return Editor;
- }
- return Preview;
- } else if (
- fileStore.req.type === "text" ||
- fileStore.req.type === "textImmutable"
- ) {
- return Editor;
- } else {
- return Preview;
}
+ if (
+ route.query.edit === "true" &&
+ ["text", "textImmutable"].includes(fileStore.req.type)
+ )
+ return Editor;
+ return Preview;
});
// Define hooks
diff --git a/frontend/src/views/Login.vue b/frontend/src/views/Login.vue
index 30c5190e..f2ab83e3 100644
--- a/frontend/src/views/Login.vue
+++ b/frontend/src/views/Login.vue
@@ -1,13 +1,13 @@
diff --git a/frontend/src/views/Settings.vue b/frontend/src/views/Settings.vue
index c60e5efb..632491d1 100644
--- a/frontend/src/views/Settings.vue
+++ b/frontend/src/views/Settings.vue
@@ -6,20 +6,16 @@