Compare commits
20
Commits
9a7ed0a347
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ca5342d7fa | ||
|
|
ee06b91b92 | ||
|
|
b423446412 | ||
|
|
5788f5a8b4 | ||
|
|
672a19f8f6 | ||
|
|
1956790dde | ||
|
|
ebb72c7f24 | ||
|
|
5b32f3dca7 | ||
|
|
9f8a985c63 | ||
|
|
8a41307700 | ||
|
|
e3e8a1db1a | ||
|
|
a50ac7310f | ||
|
|
1f7238841a | ||
|
|
f3738cbc4d | ||
|
|
6f0f58d2d9 | ||
|
|
93d5583940 | ||
|
|
a513e731c4 | ||
|
|
d5772c24e5 | ||
|
|
09fa193e9a | ||
|
|
f5b9f543c6 |
No files matched your search
@@ -1,6 +1,6 @@
|
||||
module fornaxian.tech/nova_web
|
||||
|
||||
go 1.26
|
||||
go 1.27
|
||||
|
||||
replace (
|
||||
fornaxian.tech/nova_server => ../nova_server
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 103 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 75 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 73 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 38 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 65 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 79 KiB |
Binary file not shown.
@@ -0,0 +1,107 @@
|
||||
/* Generated by svelte/icons.js */
|
||||
.i_account_balance_wallet{--icon:url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'><path d='M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760H520q-71 0-115.5 44.5T360-600v240q0 71 44.5 115.5T520-200h320q0 33-23.5 56.5T760-120H200Zm320-160q-33 0-56.5-23.5T440-360v-240q0-33 23.5-56.5T520-680h280q33 0 56.5 23.5T880-600v240q0 33-23.5 56.5T800-280H520Zm163-157q17-17 17-43t-17-43q-17-17-43-17t-43 17q-17 17-17 43t17 43q17 17 43 17t43-17Z'/></svg>")}
|
||||
.i_add{--icon:url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'><path d='M440-440H200v-80h240v-240h80v240h240v80H520v240h-80v-240Z'/></svg>")}
|
||||
.i_admin_panel_settings{--icon:url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'><path d='M680-80q-83 0-141.5-58.5T480-280q0-83 58.5-141.5T680-480q83 0 141.5 58.5T880-280q0 83-58.5 141.5T680-80Zm-200 0q-139-35-229.5-159.5T160-516v-244l320-120 320 120v227q-26-13-58.5-20t-61.5-7q-116 0-198 82t-82 198q0 62 23.5 112T483-81q-1 0-1.5.5t-1.5.5Zm242.5-217.5Q740-315 740-340t-17.5-42.5Q705-400 680-400t-42.5 17.5Q620-365 620-340t17.5 42.5Q655-280 680-280t42.5-17.5ZM680-160q31 0 57-14.5t42-38.5q-22-13-47-20t-52-7q-27 0-52 7t-47 20q16 24 42 38.5t57 14.5Z'/></svg>")}
|
||||
.i_app_registration{--icon:url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'><path d='M183.5-183.5Q160-207 160-240t23.5-56.5Q207-320 240-320t56.5 23.5Q320-273 320-240t-23.5 56.5Q273-160 240-160t-56.5-23.5Zm0-240Q160-447 160-480t23.5-56.5Q207-560 240-560t56.5 23.5Q320-513 320-480t-23.5 56.5Q273-400 240-400t-56.5-23.5Zm0-240Q160-687 160-720t23.5-56.5Q207-800 240-800t56.5 23.5Q320-753 320-720t-23.5 56.5Q273-640 240-640t-56.5-23.5Zm240 0Q400-687 400-720t23.5-56.5Q447-800 480-800t56.5 23.5Q560-753 560-720t-23.5 56.5Q513-640 480-640t-56.5-23.5Zm240 0Q640-687 640-720t23.5-56.5Q687-800 720-800t56.5 23.5Q800-753 800-720t-23.5 56.5Q753-640 720-640t-56.5-23.5Zm-240 240Q400-447 400-480t23.5-56.5Q447-560 480-560t56.5 23.5Q560-513 560-480t-23.5 56.5Q513-400 480-400t-56.5-23.5ZM520-160v-123l221-220q9-9 20-13t22-4q12 0 23 4.5t20 13.5l37 37q8 9 12.5 20t4.5 22q0 11-4 22.5T863-380L643-160H520Zm263-224 37-39-37-37-38 38 38 38Z'/></svg>")}
|
||||
.i_apps{--icon:url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'><path d='M183.5-183.5Q160-207 160-240t23.5-56.5Q207-320 240-320t56.5 23.5Q320-273 320-240t-23.5 56.5Q273-160 240-160t-56.5-23.5Zm240 0Q400-207 400-240t23.5-56.5Q447-320 480-320t56.5 23.5Q560-273 560-240t-23.5 56.5Q513-160 480-160t-56.5-23.5Zm240 0Q640-207 640-240t23.5-56.5Q687-320 720-320t56.5 23.5Q800-273 800-240t-23.5 56.5Q753-160 720-160t-56.5-23.5Zm-480-240Q160-447 160-480t23.5-56.5Q207-560 240-560t56.5 23.5Q320-513 320-480t-23.5 56.5Q273-400 240-400t-56.5-23.5Zm240 0Q400-447 400-480t23.5-56.5Q447-560 480-560t56.5 23.5Q560-513 560-480t-23.5 56.5Q513-400 480-400t-56.5-23.5Zm240 0Q640-447 640-480t23.5-56.5Q687-560 720-560t56.5 23.5Q800-513 800-480t-23.5 56.5Q753-400 720-400t-56.5-23.5Zm-480-240Q160-687 160-720t23.5-56.5Q207-800 240-800t56.5 23.5Q320-753 320-720t-23.5 56.5Q273-640 240-640t-56.5-23.5Zm240 0Q400-687 400-720t23.5-56.5Q447-800 480-800t56.5 23.5Q560-753 560-720t-23.5 56.5Q513-640 480-640t-56.5-23.5Zm240 0Q640-687 640-720t23.5-56.5Q687-800 720-800t56.5 23.5Q800-753 800-720t-23.5 56.5Q753-640 720-640t-56.5-23.5Z'/></svg>")}
|
||||
.i_area_chart{--icon:url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'><path d='M840-320 464-614 305-395 120-540v-140l160 120 200-280 200 160h160v360ZM120-160v-280l200 160 160-220 360 281v59H120Z'/></svg>")}
|
||||
.i_arrow_back{--icon:url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'><path d='m313-440 224 224-57 56-320-320 320-320 57 56-224 224h487v80H313Z'/></svg>")}
|
||||
.i_arrow_drop_down{--icon:url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'><path d='M480-360 280-560h400L480-360Z'/></svg>")}
|
||||
.i_arrow_forward{--icon:url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'><path d='M647-440H160v-80h487L423-744l57-56 320 320-320 320-57-56 224-224Z'/></svg>")}
|
||||
.i_arrow_right{--icon:url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'><path d='M400-280v-400l200 200-200 200Z'/></svg>")}
|
||||
.i_block{--icon:url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'><path d='M324-111.5Q251-143 197-197t-85.5-127Q80-397 80-480t31.5-156Q143-709 197-763t127-85.5Q397-880 480-880t156 31.5Q709-817 763-763t85.5 127Q880-563 880-480t-31.5 156Q817-251 763-197t-127 85.5Q563-80 480-80t-156-31.5ZM677-227q16-12 30-26t26-30L283-733q-16 12-30 26t-26 30l450 450Z'/></svg>")}
|
||||
.i_bolt{--icon:url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'><path d='m320-80 40-280H160l360-520h80l-40 320h240L400-80h-80Z'/></svg>")}
|
||||
.i_bookmark_add{--icon:url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'><path d='M200-120v-640q0-33 23.5-56.5T280-840h280q-20 30-30 57.5T520-720q0 72 45.5 127T680-524q23 3 40 3t40-3v404L480-240 200-120Zm480-480v-80h-80v-80h80v-80h80v80h80v80h-80v80h-80Z'/></svg>")}
|
||||
.i_bookmark_remove{--icon:url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'><path d='M840-680H600v-80h240v80ZM200-120v-640q0-33 23.5-56.5T280-840h280q-20 30-30 57.5T520-720q0 72 45.5 127T680-524q23 3 40 3t40-3v404L480-240 200-120Z'/></svg>")}
|
||||
.i_cancel{--icon:url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'><path d='m336-280 144-144 144 144 56-56-144-144 144-144-56-56-144 144-144-144-56 56 144 144-144 144 56 56ZM480-80q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Z'/></svg>")}
|
||||
.i_check{--icon:url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'><path d='M382-240 154-468l57-57 171 171 367-367 57 57-424 424Z'/></svg>")}
|
||||
.i_chevron_left{--icon:url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'><path d='M560-240 320-480l240-240 56 56-184 184 184 184-56 56Z'/></svg>")}
|
||||
.i_chevron_right{--icon:url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'><path d='M504-480 320-664l56-56 240 240-240 240-56-56 184-184Z'/></svg>")}
|
||||
.i_close{--icon:url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'><path d='m256-200-56-56 224-224-224-224 56-56 224 224 224-224 56 56-224 224 224 224-56 56-224-224-224 224Z'/></svg>")}
|
||||
.i_cloud_upload{--icon:url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'><path d='M440-160H260q-91 0-155.5-63T40-377q0-78 47-139t123-78q25-92 100-149t170-57q117 0 198.5 81.5T760-520q69 8 114.5 59.5T920-340q0 75-52.5 127.5T740-160H520v-286l64 62 56-56-160-160-160 160 56 56 64-62v286Z'/></svg>")}
|
||||
.i_collections{--icon:url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'><path d='M360-400h400L622-580l-92 120-62-80-108 140Zm-40 160q-33 0-56.5-23.5T240-320v-480q0-33 23.5-56.5T320-880h480q33 0 56.5 23.5T880-800v480q0 33-23.5 56.5T800-240H320ZM160-80q-33 0-56.5-23.5T80-160v-560h80v560h560v80H160Z'/></svg>")}
|
||||
.i_content_copy{--icon:url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'><path d='M360-240q-33 0-56.5-23.5T280-320v-480q0-33 23.5-56.5T360-880h360q33 0 56.5 23.5T800-800v480q0 33-23.5 56.5T720-240H360ZM200-80q-33 0-56.5-23.5T120-160v-560h80v560h440v80H200Z'/></svg>")}
|
||||
.i_create{--icon:url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'><path d='M120-120v-170l528-527q12-11 26.5-17t30.5-6q16 0 31 6t26 18l55 56q12 11 17.5 26t5.5 30q0 16-5.5 30.5T817-647L290-120H120Zm584-528 56-56-56-56-56 56 56 56Z'/></svg>")}
|
||||
.i_create_new_folder{--icon:url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'><path d='M560-320h80v-80h80v-80h-80v-80h-80v80h-80v80h80v80ZM160-160q-33 0-56.5-23.5T80-240v-480q0-33 23.5-56.5T160-800h240l80 80h320q33 0 56.5 23.5T880-640v400q0 33-23.5 56.5T800-160H160Z'/></svg>")}
|
||||
.i_dashboard{--icon:url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'><path d='M520-600v-240h320v240H520ZM120-440v-400h320v400H120Zm400 320v-400h320v400H520Zm-400 0v-240h320v240H120Z'/></svg>")}
|
||||
.i_data_usage{--icon:url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'><path d='M480-80q-83 0-156-31.5t-127-86Q143-252 111.5-325T80-480q0-157 104-270t256-128v120q-103 14-171.5 92.5T200-480q0 116 82 198t198 82q66 0 123.5-28t96.5-76l104 60q-54 75-139 119.5T480-80Zm366-238-104-60q9-24 13.5-49.5T760-480q0-107-68.5-185.5T520-758v-120q152 15 256 128t104 270q0 44-8 85t-26 77Z'/></svg>")}
|
||||
.i_delete{--icon:url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'><path d='M280-120q-33 0-56.5-23.5T200-200v-520h-40v-80h200v-40h240v40h200v80h-40v520q0 33-23.5 56.5T680-120H280Zm80-160h80v-360h-80v360Zm160 0h80v-360h-80v360Z'/></svg>")}
|
||||
.i_delete_forever{--icon:url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'><path d='m376-300 104-104 104 104 56-56-104-104 104-104-56-56-104 104-104-104-56 56 104 104-104 104 56 56Zm-96 180q-33 0-56.5-23.5T200-200v-520h-40v-80h200v-40h240v40h200v80h-40v520q0 33-23.5 56.5T680-120H280Z'/></svg>")}
|
||||
.i_description{--icon:url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'><path d='M320-240h320v-80H320v80Zm0-160h320v-80H320v80ZM240-80q-33 0-56.5-23.5T160-160v-640q0-33 23.5-56.5T240-880h320l240 240v480q0 33-23.5 56.5T720-80H240Zm280-520h200L520-800v200Z'/></svg>")}
|
||||
.i_done{--icon:url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'><path d='M382-240 154-468l57-57 171 171 367-367 57 57-424 424Z'/></svg>")}
|
||||
.i_download{--icon:url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'><path d='M480-320 280-520l56-58 104 104v-326h80v326l104-104 56 58-200 200ZM240-160q-33 0-56.5-23.5T160-240v-120h80v120h480v-120h80v120q0 33-23.5 56.5T720-160H240Z'/></svg>")}
|
||||
.i_drag_indicator{--icon:url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'><path d='M360-160q-33 0-56.5-23.5T280-240q0-33 23.5-56.5T360-320q33 0 56.5 23.5T440-240q0 33-23.5 56.5T360-160Zm240 0q-33 0-56.5-23.5T520-240q0-33 23.5-56.5T600-320q33 0 56.5 23.5T680-240q0 33-23.5 56.5T600-160ZM360-400q-33 0-56.5-23.5T280-480q0-33 23.5-56.5T360-560q33 0 56.5 23.5T440-480q0 33-23.5 56.5T360-400Zm240 0q-33 0-56.5-23.5T520-480q0-33 23.5-56.5T600-560q33 0 56.5 23.5T680-480q0 33-23.5 56.5T600-400ZM360-640q-33 0-56.5-23.5T280-720q0-33 23.5-56.5T360-800q33 0 56.5 23.5T440-720q0 33-23.5 56.5T360-640Zm240 0q-33 0-56.5-23.5T520-720q0-33 23.5-56.5T600-800q33 0 56.5 23.5T680-720q0 33-23.5 56.5T600-640Z'/></svg>")}
|
||||
.i_drive_file_move{--icon:url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'><path d='M160-160q-33 0-56.5-23.5T80-240v-480q0-33 23.5-56.5T160-800h240l80 80h320q33 0 56.5 23.5T880-640v400q0 33-23.5 56.5T800-160H160Zm328-240-65 65 56 56 161-161-161-161-56 56 65 65H320v80h168Z'/></svg>")}
|
||||
.i_east{--icon:url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'><path d='m600-200-57-56 184-184H80v-80h647L544-704l56-56 280 280-280 280Z'/></svg>")}
|
||||
.i_edit{--icon:url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'><path d='M120-120v-170l528-527q12-11 26.5-17t30.5-6q16 0 31 6t26 18l55 56q12 11 17.5 26t5.5 30q0 16-5.5 30.5T817-647L290-120H120Zm584-528 56-56-56-56-56 56 56 56Z'/></svg>")}
|
||||
.i_email{--icon:url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'><path d='M160-160q-33 0-56.5-23.5T80-240v-480q0-33 23.5-56.5T160-800h640q33 0 56.5 23.5T880-720v480q0 33-23.5 56.5T800-160H160Zm320-280 320-200v-80L480-520 160-720v80l320 200Z'/></svg>")}
|
||||
.i_expand_less{--icon:url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'><path d='m296-345-56-56 240-240 240 240-56 56-184-184-184 184Z'/></svg>")}
|
||||
.i_expand_more{--icon:url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'><path d='M480-345 240-585l56-56 184 184 184-184 56 56-240 240Z'/></svg>")}
|
||||
.i_flag{--icon:url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'><path d='M200-120v-680h360l16 80h224v400H520l-16-80H280v280h-80Z'/></svg>")}
|
||||
.i_folder{--icon:url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'><path d='M160-160q-33 0-56.5-23.5T80-240v-480q0-33 23.5-56.5T160-800h240l80 80h320q33 0 56.5 23.5T880-640v400q0 33-23.5 56.5T800-160H160Z'/></svg>")}
|
||||
.i_folder_open{--icon:url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'><path d='M160-160q-33 0-56.5-23.5T80-240v-480q0-33 23.5-56.5T160-800h240l80 80h320q33 0 56.5 23.5T880-640H160v400l96-320h684L837-217q-8 26-29.5 41.5T760-160H160Z'/></svg>")}
|
||||
.i_forward_10{--icon:url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'><path d='M360-320v-180h-60v-60h120v240h-60Zm140 0q-17 0-28.5-11.5T460-360v-160q0-17 11.5-28.5T500-560h80q17 0 28.5 11.5T620-520v160q0 17-11.5 28.5T580-320h-80Zm20-60h40v-120h-40v120ZM339.5-108.5q-65.5-28.5-114-77t-77-114Q120-365 120-440t28.5-140.5q28.5-65.5 77-114t114-77Q405-800 480-800h6l-62-62 56-58 160 160-160 160-56-58 62-62h-6q-117 0-198.5 81.5T200-440q0 117 81.5 198.5T480-160q117 0 198.5-81.5T760-440h80q0 75-28.5 140.5t-77 114q-48.5 48.5-114 77T480-80q-75 0-140.5-28.5Z'/></svg>")}
|
||||
.i_fullscreen{--icon:url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'><path d='M120-120v-200h80v120h120v80H120Zm520 0v-80h120v-120h80v200H640ZM120-640v-200h200v80H200v120h-80Zm640 0v-120H640v-80h200v200h-80Z'/></svg>")}
|
||||
.i_help{--icon:url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'><path d='M513.5-254.5Q528-269 528-290t-14.5-35.5Q499-340 478-340t-35.5 14.5Q428-311 428-290t14.5 35.5Q457-240 478-240t35.5-14.5ZM442-394h74q0-33 7.5-52t42.5-52q26-26 41-49.5t15-56.5q0-56-41-86t-97-30q-57 0-92.5 30T342-618l66 26q5-18 22.5-39t53.5-21q32 0 48 17.5t16 38.5q0 20-12 37.5T506-526q-44 39-54 59t-10 73Zm38 314q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Z'/></svg>")}
|
||||
.i_home{--icon:url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'><path d='M160-120v-480l320-240 320 240v480H560v-280H400v280H160Z'/></svg>")}
|
||||
.i_how_to_reg{--icon:url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'><path d='M622-144 484-282l56-56 82 82 202-202 56 56-258 258ZM287-527q-47-47-47-113t47-113q47-47 113-47t113 47q47 47 47 113t-47 113q-47 47-113 47t-113-47Zm227 99L368-282l122 122H80v-112q0-33 17-62t47-44q51-26 115-44t141-18q30 0 58.5 3t55.5 9Z'/></svg>")}
|
||||
.i_hub{--icon:url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'><path d='M155-75q-35-35-35-85t35-85q35-35 85-35 14 0 26 3t23 8l57-71q-28-31-39-70t-5-78l-81-27q-17 25-43 40t-58 15q-50 0-85-35T0-580q0-50 35-85t85-35q50 0 85 35t35 85v8l81 28q20-36 53.5-61t75.5-32v-87q-39-11-64.5-42.5T360-840q0-50 35-85t85-35q50 0 85 35t35 85q0 42-26 73.5T510-724v87q42 7 75.5 32t53.5 61l81-28v-8q0-50 35-85t85-35q50 0 85 35t35 85q0 50-35 85t-85 35q-32 0-58.5-15T739-515l-81 27q6 39-5 77.5T614-340l57 70q11-5 23-7.5t26-2.5q50 0 85 35t35 85q0 50-35 85t-85 35q-50 0-85-35t-35-85q0-20 6.5-38.5T624-232l-57-71q-41 23-87.5 23T392-303l-56 71q11 15 17.5 33.5T360-160q0 50-35 85t-85 35q-50 0-85-35Z'/></svg>")}
|
||||
.i_image{--icon:url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'><path d='M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm40-160h480L570-480 450-320l-90-120-120 160Z'/></svg>")}
|
||||
.i_info{--icon:url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'><path d='M440-280h80v-240h-80v240Zm68.5-331.5Q520-623 520-640t-11.5-28.5Q497-680 480-680t-28.5 11.5Q440-657 440-640t11.5 28.5Q463-600 480-600t28.5-11.5ZM480-80q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Z'/></svg>")}
|
||||
.i_key{--icon:url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'><path d='M365-395q35-35 35-85t-35-85q-35-35-85-35t-85 35q-35 35-35 85t35 85q35 35 85 35t85-35Zm-85 155q-100 0-170-70T40-480q0-100 70-170t170-70q81 0 141.5 46T506-560h335l79 79-140 160-100-79-80 80-80-80h-14q-25 72-87 116t-139 44Z'/></svg>")}
|
||||
.i_list{--icon:url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'><path d='M280-600v-80h560v80H280Zm0 160v-80h560v80H280Zm0 160v-80h560v80H280ZM160-600q-17 0-28.5-11.5T120-640q0-17 11.5-28.5T160-680q17 0 28.5 11.5T200-640q0 17-11.5 28.5T160-600Zm0 160q-17 0-28.5-11.5T120-480q0-17 11.5-28.5T160-520q17 0 28.5 11.5T200-480q0 17-11.5 28.5T160-440Zm0 160q-17 0-28.5-11.5T120-320q0-17 11.5-28.5T160-360q17 0 28.5 11.5T200-320q0 17-11.5 28.5T160-280Z'/></svg>")}
|
||||
.i_lock_open{--icon:url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'><path d='M240-640h360v-80q0-50-35-85t-85-35q-50 0-85 35t-35 85h-80q0-83 58.5-141.5T480-920q83 0 141.5 58.5T680-720v80h40q33 0 56.5 23.5T800-560v400q0 33-23.5 56.5T720-80H240q-33 0-56.5-23.5T160-160v-400q0-33 23.5-56.5T240-640Zm296.5 336.5Q560-327 560-360t-23.5-56.5Q513-440 480-440t-56.5 23.5Q400-393 400-360t23.5 56.5Q447-280 480-280t56.5-23.5Z'/></svg>")}
|
||||
.i_login{--icon:url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'><path d='M480-120v-80h280v-560H480v-80h280q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H480Zm-80-160-55-58 102-102H120v-80h327L345-622l55-58 200 200-200 200Z'/></svg>")}
|
||||
.i_logout{--icon:url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'><path d='M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h280v80H200v560h280v80H200Zm440-160-55-58 102-102H360v-80h327L585-622l55-58 200 200-200 200Z'/></svg>")}
|
||||
.i_menu{--icon:url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'><path d='M120-240v-80h720v80H120Zm0-200v-80h720v80H120Zm0-200v-80h720v80H120Z'/></svg>")}
|
||||
.i_more_time{--icon:url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'><path d='M299.5-148Q234-176 185-225t-77-114.5Q80-405 80-480t28-140.5Q136-686 185-735t114.5-77Q365-840 440-840q21 0 40.5 2.5T520-830v82q-20-6-39.5-9t-40.5-3q-118 0-199 81t-81 199q0 118 81 199t199 81q118 0 199-81t81-199q0-11-1-20t-3-20h82q2 11 2 20v20q0 75-28 140.5T695-225q-49 49-114.5 77T440-120q-75 0-140.5-28ZM552-312 400-464v-216h80v184l128 128-56 56Zm168-288v-120H600v-80h120v-120h80v120h120v80H800v120h-80Z'/></svg>")}
|
||||
.i_north{--icon:url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'><path d='M440-80v-647L256-544l-56-56 280-280 280 280-56 57-184-184v647h-80Z'/></svg>")}
|
||||
.i_open_in_new{--icon:url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'><path d='M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h280v80H200v560h560v-280h80v280q0 33-23.5 56.5T760-120H200Zm188-212-56-56 372-372H560v-80h280v280h-80v-144L388-332Z'/></svg>")}
|
||||
.i_paid{--icon:url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'><path d='M444-200h70v-50q50-9 86-39t36-89q0-42-24-77t-96-61q-60-20-83-35t-23-41q0-26 18.5-41t53.5-15q32 0 50 15.5t26 38.5l64-26q-11-35-40.5-61T516-710v-50h-70v50q-50 11-78 44t-28 74q0 47 27.5 76t86.5 50q63 23 87.5 41t24.5 47q0 33-23.5 48.5T486-314q-33 0-58.5-20.5T390-396l-66 26q14 48 43.5 77.5T444-252v52Zm36 120q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Z'/></svg>")}
|
||||
.i_palette{--icon:url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'><path d='M480-80q-82 0-155-31.5t-127.5-86Q143-252 111.5-325T80-480q0-83 32.5-156t88-127Q256-817 330-848.5T488-880q80 0 151 27.5t124.5 76q53.5 48.5 85 115T880-518q0 115-70 176.5T640-280h-74q-9 0-12.5 5t-3.5 11q0 12 15 34.5t15 51.5q0 50-27.5 74T480-80ZM303-457q17-17 17-43t-17-43q-17-17-43-17t-43 17q-17 17-17 43t17 43q17 17 43 17t43-17Zm120-160q17-17 17-43t-17-43q-17-17-43-17t-43 17q-17 17-17 43t17 43q17 17 43 17t43-17Zm200 0q17-17 17-43t-17-43q-17-17-43-17t-43 17q-17 17-17 43t17 43q17 17 43 17t43-17Zm120 160q17-17 17-43t-17-43q-17-17-43-17t-43 17q-17 17-17 43t17 43q17 17 43 17t43-17Z'/></svg>")}
|
||||
.i_pause{--icon:url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'><path d='M560-200v-560h160v560H560Zm-320 0v-560h160v560H240Z'/></svg>")}
|
||||
.i_payments{--icon:url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'><path d='M120-160q-33 0-56.5-23.5T40-240v-440h80v440h680v80H120Zm160-160q-33 0-56.5-23.5T200-400v-320q0-33 23.5-56.5T280-800h560q33 0 56.5 23.5T920-720v320q0 33-23.5 56.5T840-320H280Zm80-80q0-33-23.5-56.5T280-480v80h80Zm400 0h80v-80q-33 0-56.5 23.5T760-400Zm-200-40q50 0 85-35t35-85q0-50-35-85t-85-35q-50 0-85 35t-35 85q0 50 35 85t85 35ZM280-640q33 0 56.5-23.5T360-720h-80v80Zm560 0v-80h-80q0 33 23.5 56.5T840-640Z'/></svg>")}
|
||||
.i_person{--icon:url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'><path d='M367-527q-47-47-47-113t47-113q47-47 113-47t113 47q47 47 47 113t-47 113q-47 47-113 47t-113-47ZM160-160v-112q0-34 17.5-62.5T224-378q62-31 126-46.5T480-440q66 0 130 15.5T736-378q29 15 46.5 43.5T800-272v112H160Z'/></svg>")}
|
||||
.i_person_remove{--icon:url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'><path d='M640-520v-80h240v80H640Zm-393-7q-47-47-47-113t47-113q47-47 113-47t113 47q47 47 47 113t-47 113q-47 47-113 47t-113-47ZM40-160v-112q0-34 17.5-62.5T104-378q62-31 126-46.5T360-440q66 0 130 15.5T616-378q29 15 46.5 43.5T680-272v112H40Z'/></svg>")}
|
||||
.i_photo_library{--icon:url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'><path d='M360-400h400L622-580l-92 120-62-80-108 140Zm-40 160q-33 0-56.5-23.5T240-320v-480q0-33 23.5-56.5T320-880h480q33 0 56.5 23.5T880-800v480q0 33-23.5 56.5T800-240H320ZM160-80q-33 0-56.5-23.5T80-160v-560h80v560h560v80H160Z'/></svg>")}
|
||||
.i_play_arrow{--icon:url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'><path d='M320-200v-560l440 280-440 280Z'/></svg>")}
|
||||
.i_priority_high{--icon:url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'><path d='M480-120q-33 0-56.5-23.5T400-200q0-33 23.5-56.5T480-280q33 0 56.5 23.5T560-200q0 33-23.5 56.5T480-120Zm-80-240v-480h160v480H400Z'/></svg>")}
|
||||
.i_public{--icon:url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'><path d='M324-111.5Q251-143 197-197t-85.5-127Q80-397 80-480t31.5-156Q143-709 197-763t127-85.5Q397-880 480-880t156 31.5Q709-817 763-763t85.5 127Q880-563 880-480t-31.5 156Q817-251 763-197t-127 85.5Q563-80 480-80t-156-31.5ZM440-162v-78q-33 0-56.5-23.5T360-320v-40L168-552q-3 18-5.5 36t-2.5 36q0 121 79.5 212T440-162Zm276-102q41-45 62.5-100.5T800-480q0-98-54.5-179T600-776v16q0 33-23.5 56.5T520-680h-80v80q0 17-11.5 28.5T400-560h-80v80h240q17 0 28.5 11.5T600-440v120h40q26 0 47 15.5t29 40.5Z'/></svg>")}
|
||||
.i_receipt{--icon:url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'><path d='M120-80v-800l60 60 60-60 60 60 60-60 60 60 60-60 60 60 60-60 60 60 60-60 60 60 60-60v800l-60-60-60 60-60-60-60 60-60-60-60 60-60-60-60 60-60-60-60 60-60-60-60 60Zm120-200h480v-80H240v80Zm0-160h480v-80H240v80Zm0-160h480v-80H240v80Z'/></svg>")}
|
||||
.i_refresh{--icon:url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'><path d='M480-160q-134 0-227-93t-93-227q0-134 93-227t227-93q69 0 132 28.5T720-690v-110h80v280H520v-80h168q-32-56-87.5-88T480-720q-100 0-170 70t-70 170q0 100 70 170t170 70q77 0 139-44t87-116h84q-28 106-114 173t-196 67Z'/></svg>")}
|
||||
.i_replay_10{--icon:url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'><path d='M339.5-108.5q-65.5-28.5-114-77t-77-114Q120-365 120-440h80q0 117 81.5 198.5T480-160q117 0 198.5-81.5T760-440q0-117-81.5-198.5T480-720h-6l62 62-56 58-160-160 160-160 56 58-62 62h6q75 0 140.5 28.5t114 77q48.5 48.5 77 114T840-440q0 75-28.5 140.5t-77 114q-48.5 48.5-114 77T480-80q-75 0-140.5-28.5ZM360-320v-180h-60v-60h120v240h-60Zm140 0q-17 0-28.5-11.5T460-360v-160q0-17 11.5-28.5T500-560h80q17 0 28.5 11.5T620-520v160q0 17-11.5 28.5T580-320h-80Zm20-60h40v-120h-40v120Z'/></svg>")}
|
||||
.i_restart_alt{--icon:url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'><path d='M440-122q-121-15-200.5-105.5T160-440q0-66 26-126.5T260-672l57 57q-38 34-57.5 79T240-440q0 88 56 155.5T440-202v80Zm80 0v-80q87-16 143.5-83T720-440q0-100-70-170t-170-70h-3l44 44-56 56-140-140 140-140 56 56-44 44h3q134 0 227 93t93 227q0 121-79.5 211.5T520-122Z'/></svg>")}
|
||||
.i_restore_from_trash{--icon:url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'><path d='M440-320h80v-166l64 62 56-56-160-160-160 160 56 56 64-62v166ZM280-120q-33 0-56.5-23.5T200-200v-520h-40v-80h200v-40h240v40h200v80h-40v520q0 33-23.5 56.5T680-120H280Z'/></svg>")}
|
||||
.i_save{--icon:url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'><path d='M840-680v480q0 33-23.5 56.5T760-120H200q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h480l160 160ZM565-275q35-35 35-85t-35-85q-35-35-85-35t-85 35q-35 35-35 85t35 85q35 35 85 35t85-35ZM240-560h360v-160H240v160Z'/></svg>")}
|
||||
.i_search{--icon:url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'><path d='M784-120 532-372q-30 24-69 38t-83 14q-109 0-184.5-75.5T120-580q0-109 75.5-184.5T380-840q109 0 184.5 75.5T640-580q0 44-14 83t-38 69l252 252-56 56ZM380-400q75 0 127.5-52.5T560-580q0-75-52.5-127.5T380-760q-75 0-127.5 52.5T200-580q0 75 52.5 127.5T380-400Z'/></svg>")}
|
||||
.i_select_all{--icon:url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'><path d='M280-280v-400h400v400H280Zm80-80h240v-240H360v240ZM200-200v80q-33 0-56.5-23.5T120-200h80Zm-80-80v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm80-160h-80q0-33 23.5-56.5T200-840v80Zm80 640v-80h80v80h-80Zm0-640v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-640v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-640v-80h80v80h-80Zm160 640v-80h80q0 33-23.5 56.5T760-120Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80q33 0 56.5 23.5T840-760h-80Z'/></svg>")}
|
||||
.i_send{--icon:url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'><path d='M120-160v-240l320-80-320-80v-240l760 320-760 320Z'/></svg>")}
|
||||
.i_settings{--icon:url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'><path d='m370-80-16-128q-13-5-24.5-12T307-235l-119 50L78-375l103-78q-1-7-1-13.5v-27q0-6.5 1-13.5L78-585l110-190 119 50q11-8 23-15t24-12l16-128h220l16 128q13 5 24.5 12t22.5 15l119-50 110 190-103 78q1 7 1 13.5v27q0 6.5-2 13.5l103 78-110 190-118-50q-11 8-23 15t-24 12L590-80H370Zm112-260q58 0 99-41t41-99q0-58-41-99t-99-41q-59 0-99.5 41T342-480q0 58 40.5 99t99.5 41Z'/></svg>")}
|
||||
.i_share{--icon:url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'><path d='M680-80q-50 0-85-35t-35-85q0-6 3-28L282-392q-16 15-37 23.5t-45 8.5q-50 0-85-35t-35-85q0-50 35-85t85-35q24 0 45 8.5t37 23.5l281-164q-2-7-2.5-13.5T560-760q0-50 35-85t85-35q50 0 85 35t35 85q0 50-35 85t-85 35q-24 0-45-8.5T598-672L317-508q2 7 2.5 13.5t.5 14.5q0 8-.5 14.5T317-452l281 164q16-15 37-23.5t45-8.5q50 0 85 35t35 85q0 50-35 85t-85 35Z'/></svg>")}
|
||||
.i_shopping_cart{--icon:url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'><path d='M223.5-103.5Q200-127 200-160t23.5-56.5Q247-240 280-240t56.5 23.5Q360-193 360-160t-23.5 56.5Q313-80 280-80t-56.5-23.5Zm400 0Q600-127 600-160t23.5-56.5Q647-240 680-240t56.5 23.5Q760-193 760-160t-23.5 56.5Q713-80 680-80t-56.5-23.5ZM208-800h590q23 0 35 20.5t1 41.5L692-482q-11 20-29.5 31T622-440H324l-44 80h480v80H280q-45 0-68-39.5t-2-78.5l54-98-144-304H40v-80h130l38 80Z'/></svg>")}
|
||||
.i_shuffle{--icon:url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'><path d='M560-160v-80h104L537-367l57-57 126 126v-102h80v240H560Zm-344 0-56-56 504-504H560v-80h240v240h-80v-104L216-160Zm151-377L160-744l56-56 207 207-56 56Z'/></svg>")}
|
||||
.i_skip_next{--icon:url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'><path d='M660-240v-480h80v480h-80Zm-440 0v-480l360 240-360 240Z'/></svg>")}
|
||||
.i_skip_previous{--icon:url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'><path d='M220-240v-480h80v480h-80Zm520 0L380-480l360-240v480Z'/></svg>")}
|
||||
.i_speed{--icon:url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'><path d='M418-340q25 25 63 23.5t55-27.5l224-336-336 224q-26 18-28.5 54.5T418-340ZM204-160q-22 0-40.5-9.5T134-198q-26-47-40-97.5T80-400q0-83 31.5-156T197-683q54-54 127-85.5T480-800q82 0 154 31t126 84.5q54 53.5 86 125T879-406q1 55-12.5 107.5T825-198q-11 19-29.5 28.5T755-160H204Z'/></svg>")}
|
||||
.i_star{--icon:url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'><path d='m233-120 65-281L80-590l288-25 112-265 112 265 288 25-218 189 65 281-247-149-247 149Z'/></svg>")}
|
||||
.i_stop{--icon:url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'><path d='M240-240v-480h480v480H240Z'/></svg>")}
|
||||
.i_storage{--icon:url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'><path d='M120-160v-160h720v160H120Zm80-40h80v-80h-80v80Zm-80-440v-160h720v160H120Zm80-40h80v-80h-80v80Zm-80 280v-160h720v160H120Zm80-40h80v-80h-80v80Z'/></svg>")}
|
||||
.i_swap_horiz{--icon:url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'><path d='M280-160 80-360l200-200 56 57-103 103h287v80H233l103 103-56 57Zm400-240-56-57 103-103H440v-80h287L624-743l56-57 200 200-200 200Z'/></svg>")}
|
||||
.i_sync_alt{--icon:url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'><path d='M280-120 80-320l200-200 57 56-104 104h607v80H233l104 104-57 56Zm400-320-57-56 104-104H120v-80h607L623-784l57-56 200 200-200 200Z'/></svg>")}
|
||||
.i_text_snippet{--icon:url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'><path d='M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h400l240 240v400q0 33-23.5 56.5T760-120H200Zm80-160h400v-80H280v80Zm0-160h400v-80H280v80Zm0-160h280v-80H280v80Z'/></svg>")}
|
||||
.i_touch_app{--icon:url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'><path d='M419-80q-28 0-52.5-12T325-126L107-403l19-20q20-21 48-25t52 11l74 45v-328q0-17 11.5-28.5T340-760q17 0 29 11.5t12 28.5v200h299q50 0 85 35t35 85v160q0 66-47 113T640-80H419ZM167-620q-13-22-20-47.5t-7-52.5q0-83 58.5-141.5T340-920q83 0 141.5 58.5T540-720q0 27-7 52.5T513-620l-69-40q8-14 12-28.5t4-31.5q0-50-35-85t-85-35q-50 0-85 35t-35 85q0 17 4 31.5t12 28.5l-69 40Z'/></svg>")}
|
||||
.i_undo{--icon:url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'><path d='M280-200v-80h284q63 0 109.5-40T720-420q0-60-46.5-100T564-560H312l104 104-56 56-200-200 200-200 56 56-104 104h252q97 0 166.5 63T800-420q0 94-69.5 157T564-200H280Z'/></svg>")}
|
||||
.i_unfold_less{--icon:url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'><path d='m356-160-56-56 180-180 180 180-56 56-124-124-124 124Zm124-404L300-744l56-56 124 124 124-124 56 56-180 180Z'/></svg>")}
|
||||
.i_unfold_more{--icon:url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'><path d='M480-120 300-300l58-58 122 122 122-122 58 58-180 180ZM358-598l-58-58 180-180 180 180-58 58-122-122-122 122Z'/></svg>")}
|
||||
.i_upload{--icon:url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'><path d='M440-320v-326L336-542l-56-58 200-200 200 200-56 58-104-104v326h-80ZM240-160q-33 0-56.5-23.5T160-240v-120h80v120h480v-120h80v120q0 33-23.5 56.5T720-160H240Z'/></svg>")}
|
||||
.i_verified_user{--icon:url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'><path d='m438-338 226-226-57-57-169 169-84-84-57 57 141 141Zm42 258q-139-35-229.5-159.5T160-516v-244l320-120 320 120v244q0 152-90.5 276.5T480-80Z'/></svg>")}
|
||||
.i_view_compact{--icon:url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'><path d='M880-170v-620 620ZM80-610v-180h170v180H80Zm210 0v-180h170v180H290Zm210 0v-180h170v180H500Zm210 0v-180h170v180H710Zm0 220v-180h170v180H710Zm-210 0v-180h170v180H500Zm-210 0v-180h170v180H290Zm-210 0v-180h170v180H80Zm630 220v-180h170v180H710Zm-210 0v-180h170v180H500Zm-210 0v-180h170v180H290Zm-210 0v-180h170v180H80Z'/></svg>")}
|
||||
.i_visibility{--icon:url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'><path d='M607.5-372.5Q660-425 660-500t-52.5-127.5Q555-680 480-680t-127.5 52.5Q300-575 300-500t52.5 127.5Q405-320 480-320t127.5-52.5Zm-204-51Q372-455 372-500t31.5-76.5Q435-608 480-608t76.5 31.5Q588-545 588-500t-31.5 76.5Q525-392 480-392t-76.5-31.5ZM214-281.5Q94-363 40-500q54-137 174-218.5T480-800q146 0 266 81.5T920-500q-54 137-174 218.5T480-200q-146 0-266-81.5Z'/></svg>")}
|
||||
.i_visibility_off{--icon:url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'><path d='M792-56 624-222q-35 11-70.5 16.5T480-200q-151 0-269-83.5T40-500q21-53 53-98.5t73-81.5L56-792l56-56 736 736-56 56ZM480-320q11 0 20.5-1t20.5-4L305-541q-3 11-4 20.5t-1 20.5q0 75 52.5 127.5T480-320Zm292 18L645-428q7-17 11-34.5t4-37.5q0-75-52.5-127.5T480-680q-20 0-37.5 4T408-664L306-766q41-17 84-25.5t90-8.5q151 0 269 83.5T920-500q-23 59-60.5 109.5T772-302ZM587-486 467-606q28-5 51.5 4.5T559-574q17 18 24.5 41.5T587-486Z'/></svg>")}
|
||||
.i_volume_off{--icon:url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'><path d='M792-56 671-177q-25 16-53 27.5T560-131v-82q14-5 27.5-10t25.5-12L480-368v208L280-360H120v-240h128L56-792l56-56 736 736-56 56Zm-8-232-58-58q17-31 25.5-65t8.5-70q0-94-55-168T560-749v-82q124 28 202 125.5T840-481q0 53-14.5 102T784-288ZM650-422l-90-90v-130q47 22 73.5 66t26.5 96q0 15-2.5 29.5T650-422ZM480-592 376-696l104-104v208Z'/></svg>")}
|
||||
.i_volume_up{--icon:url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'><path d='M560-131v-82q90-26 145-100t55-168q0-94-55-168T560-749v-82q124 28 202 125.5T840-481q0 127-78 224.5T560-131ZM120-360v-240h160l200-200v640L280-360H120Zm440 40v-322q47 22 73.5 66t26.5 96q0 51-26.5 94.5T560-320Z'/></svg>")}
|
||||
.i_vpn_key{--icon:url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'><path d='M280-240q-100 0-170-70T40-480q0-100 70-170t170-70q81 0 141.5 45.5T506-560h414v160h-80v160H680v-160H506q-24 69-84.5 114.5T280-240Zm0-160q33 0 56.5-23.5T360-480q0-33-23.5-56.5T280-560q-33 0-56.5 23.5T200-480q0 33 23.5 56.5T280-400Z'/></svg>")}
|
||||
.i_warning{--icon:url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'><path d='m40-120 440-760 440 760H40Zm468.5-131.5Q520-263 520-280t-11.5-28.5Q497-320 480-320t-28.5 11.5Q440-297 440-280t11.5 28.5Q463-240 480-240t28.5-11.5ZM440-360h80v-200h-80v200Z'/></svg>")}
|
||||
.i_west{--icon:url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'><path d='M360-200 80-480l280-280 56 56-183 184h647v80H233l184 184-57 56Z'/></svg>")}
|
||||
.i_zoom_in{--icon:url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'><path d='M784-120 532-372q-30 24-69 38t-83 14q-109 0-184.5-75.5T120-580q0-109 75.5-184.5T380-840q109 0 184.5 75.5T640-580q0 44-14 83t-38 69l252 252-56 56ZM380-400q75 0 127.5-52.5T560-580q0-75-52.5-127.5T380-760q-75 0-127.5 52.5T200-580q0 75 52.5 127.5T380-400Zm-40-60v-80h-80v-80h80v-80h80v80h80v80h-80v80h-80Z'/></svg>")}
|
||||
.i_zoom_out{--icon:url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'><path d='M784-120 532-372q-30 24-69 38t-83 14q-109 0-184.5-75.5T120-580q0-109 75.5-184.5T380-840q109 0 184.5 75.5T640-580q0 44-14 83t-38 69l252 252-56 56ZM380-400q75 0 127.5-52.5T560-580q0-75-52.5-127.5T380-760q-75 0-127.5 52.5T200-580q0 75 52.5 127.5T380-400ZM280-540v-80h200v80H280Z'/></svg>")}
|
||||
+12
-21
@@ -94,31 +94,22 @@ body {
|
||||
accent-color: var(--accent_color);
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'Material Icons';
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
font-display: block;
|
||||
src: local('Material Icons'),
|
||||
local('MaterialIcons-Regular'),
|
||||
url(/res/misc/MaterialIcons.woff2) format('woff2');
|
||||
}
|
||||
|
||||
/* Material Symbols, used like <i class="icon i_delete"></i>. The i_ classes
|
||||
are generated into icons.css by svelte/icons.js. The glyph is a mask on a
|
||||
pseudo element so backgrounds and padding on the icon itself still work */
|
||||
.icon {
|
||||
font-family: 'Material Icons';
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
font-size: 1.5em;
|
||||
display: inline-block;
|
||||
line-height: 1em;
|
||||
text-transform: none;
|
||||
letter-spacing: normal;
|
||||
word-wrap: normal;
|
||||
white-space: nowrap;
|
||||
direction: ltr;
|
||||
text-rendering: optimizeLegibility;
|
||||
vertical-align: middle;
|
||||
font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24;
|
||||
}
|
||||
.icon::before {
|
||||
content: "";
|
||||
display: block;
|
||||
width: 1em;
|
||||
height: 1em;
|
||||
background-color: currentColor;
|
||||
-webkit-mask: var(--icon) center / contain no-repeat;
|
||||
mask: var(--icon) center / contain no-repeat;
|
||||
}
|
||||
|
||||
.icon_unicode {
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
||||
|
||||
<link rel="stylesheet" href="/res/style/layout.css?v{{.CacheID}}"/>
|
||||
<link rel="preload" href="/res/misc/MaterialIcons.woff2" as="font" type="font/woff2" crossorigin/>
|
||||
<link rel="stylesheet" href="/res/style/icons.css?v{{.CacheID}}"/>
|
||||
|
||||
<link rel="icon" href="/favicon.ico" sizes="32x32"/>
|
||||
<link rel="icon" href="/res/img/nova.svg" type="image/svg+xml"/>
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
// Writes the Material Symbols used in the source to icons.css. Icons are found
|
||||
// by their i_<name> classes and by the icon props of Button, ToggleButton and
|
||||
// TabMenu: icon="name", icon: "name" and icon={a ? "name" : "other"}. Icons
|
||||
// which are already in icons.css are not downloaded again
|
||||
import { globSync, readFileSync, writeFileSync } from "node:fs"
|
||||
|
||||
const css_file = "../res/static/style/icons.css"
|
||||
|
||||
const names = new Set()
|
||||
for (const file of globSync(["src/**/*.svelte", "../res/template/**/*.html"])) {
|
||||
const src = readFileSync(file, "utf8")
|
||||
for (const [, name] of src.matchAll(/\bi_([a-z0-9_]+)/g)) {
|
||||
names.add(name)
|
||||
}
|
||||
for (const [, prop] of src.matchAll(/\bicon(?:_on|_off)?(?:=|:\s*)("[^"]*"|\{[^}]*\})/g)) {
|
||||
for (const [, name] of prop.matchAll(/"([a-z0-9_]+)"/g)) {
|
||||
names.add(name)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const cached = new Map(
|
||||
readFileSync(css_file, "utf8").matchAll(/^\.i_([a-z0-9_]+)\{.*$/gm).map(m => [m[1], m[0]])
|
||||
)
|
||||
|
||||
const rules = await Promise.all([...names].sort().map(async name => {
|
||||
if (cached.has(name)) {
|
||||
return cached.get(name)
|
||||
}
|
||||
|
||||
const url = `https://fonts.gstatic.com/s/i/short-term/release/materialsymbolsoutlined/${name}/fill1/24px.svg`
|
||||
const resp = await fetch(url)
|
||||
if (!resp.ok) {
|
||||
throw new Error(`Icon ${name} not found: ${resp.status} ${url}`)
|
||||
}
|
||||
const svg = await resp.text()
|
||||
const path = svg.match(/^<svg [^>]*viewBox="0 -960 960 960"[^>]*><path d="([^"]+)"\/><\/svg>$/)
|
||||
if (path === null) {
|
||||
throw new Error(`Icon ${name} has an unexpected format: ${svg}`)
|
||||
}
|
||||
return `.i_${name}{--icon:url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'><path d='${path[1]}'/></svg>")}`
|
||||
}))
|
||||
|
||||
writeFileSync(css_file, "/* Generated by svelte/icons.js */\n" + rules.join("\n") + "\n")
|
||||
+2
-2
@@ -3,8 +3,8 @@
|
||||
"version": "1.0.0",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"build": "NODE_ENV=production vite build",
|
||||
"dev": "NODE_ENV=development vite build --watch"
|
||||
"build": "node icons.js && NODE_ENV=production vite build",
|
||||
"dev": "node icons.js && NODE_ENV=development vite build --watch"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@rollup/plugin-node-resolve": "^15.3.1",
|
||||
|
||||
@@ -1,12 +1,17 @@
|
||||
<script lang="ts">
|
||||
import { formatDate, formatNumber } from "util/Formatting";
|
||||
import Expandable from "util/Expandable.svelte";
|
||||
import { createEventDispatcher } from "svelte";
|
||||
let dispatch = createEventDispatcher()
|
||||
|
||||
let {
|
||||
report,
|
||||
ip_report_count
|
||||
ip_report_count,
|
||||
on_resolve_report,
|
||||
on_resolve_by_ip,
|
||||
}: {
|
||||
report: any
|
||||
ip_report_count: {[key: string]: number}
|
||||
on_resolve_report: (action: string, report_type: string) => void
|
||||
on_resolve_by_ip: (ip: string, action: string) => void
|
||||
} = $props();
|
||||
let preview = $state(false)
|
||||
|
||||
@@ -14,7 +19,7 @@ let can_grant = $derived(report.status !== "granted")
|
||||
let can_reject = $derived(report.status !== "rejected")
|
||||
|
||||
let set_status = async (action: string, report_type: string) => {
|
||||
dispatch("resolve_report", {action: action, report_type: report_type})
|
||||
on_resolve_report(action, report_type)
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -47,19 +52,19 @@ let set_status = async (action: string, report_type: string) => {
|
||||
<div class="toolbar">
|
||||
<div class="action_list">
|
||||
<a class="button" target="_blank" href={"/u/"+report.file.id} rel="noreferrer">
|
||||
<i class="icon">open_in_new</i> Open file
|
||||
<i class="icon i_open_in_new"></i> Open file
|
||||
</a>
|
||||
<button class:button_highlight={preview} onclick={() => {preview = !preview}}>
|
||||
<i class="icon">visibility</i> Preview
|
||||
<i class="icon i_visibility"></i> Preview
|
||||
</button>
|
||||
{#if can_grant}
|
||||
<button class="button_highlight" onclick={() => {set_status("grant", report.type)}}>
|
||||
<i class="icon">done</i> Block ({report.type})
|
||||
<i class="icon i_done"></i> Block ({report.type})
|
||||
</button>
|
||||
{/if}
|
||||
{#if can_reject}
|
||||
<button class="button_red" onclick={() => {set_status("reject", "")}}>
|
||||
<i class="icon">delete</i> Ignore
|
||||
<i class="icon i_delete"></i> Ignore
|
||||
</button>
|
||||
{/if}
|
||||
</div>
|
||||
@@ -105,12 +110,12 @@ let set_status = async (action: string, report_type: string) => {
|
||||
<td>{ip_report_count[user_report.ip_address]}</td>
|
||||
<td>
|
||||
{#if can_grant}
|
||||
<button onclick={() => dispatch("resolve_by_ip", {ip: user_report.ip_address, action: "grant"})}>
|
||||
<button onclick={() => on_resolve_by_ip(user_report.ip_address, "grant")}>
|
||||
Accept all
|
||||
</button>
|
||||
{/if}
|
||||
{#if can_reject}
|
||||
<button onclick={() => dispatch("resolve_by_ip", {ip: user_report.ip_address, action: "reject"})}>
|
||||
<button onclick={() => on_resolve_by_ip(user_report.ip_address, "reject")}>
|
||||
Ignore all
|
||||
</button>
|
||||
{/if}
|
||||
|
||||
@@ -168,15 +168,15 @@ onMount(() => {
|
||||
|
||||
<div class="tab_bar">
|
||||
<button onclick={() => {tab = "pending"; get_reports()}} class:button_highlight={tab === "pending"}>
|
||||
<i class="icon">flag</i>
|
||||
<i class="icon i_flag"></i>
|
||||
Pending
|
||||
</button>
|
||||
<button onclick={() => {tab = "granted"; get_reports()}} class:button_highlight={tab === "granted"}>
|
||||
<i class="icon">flag</i>
|
||||
<i class="icon i_flag"></i>
|
||||
Granted
|
||||
</button>
|
||||
<button onclick={() => {tab = "rejected"; get_reports()}} class:button_highlight={tab === "rejected"}>
|
||||
<i class="icon">flag</i>
|
||||
<i class="icon i_flag"></i>
|
||||
Rejected
|
||||
</button>
|
||||
</div>
|
||||
@@ -185,8 +185,8 @@ onMount(() => {
|
||||
<AbuseReport
|
||||
report={report}
|
||||
ip_report_count={ip_report_count}
|
||||
on:resolve_report={e => resolve_report(report.id, e.detail.action, e.detail.report_type)}
|
||||
on:resolve_by_ip={e => resolve_by_ip(e.detail.ip, e.detail.action)}
|
||||
on_resolve_report={(action, report_type) => resolve_report(report.id, action, report_type)}
|
||||
on_resolve_by_ip={resolve_by_ip}
|
||||
/>
|
||||
{/each}
|
||||
</section>
|
||||
|
||||
@@ -31,7 +31,7 @@ let block_form = {
|
||||
default_value: "Anonymous",
|
||||
},
|
||||
],
|
||||
submit_label: `<i class="icon">send</i> Submit`,
|
||||
submit_label: `<i class="icon i_send"></i> Submit`,
|
||||
on_submit: async fields => {
|
||||
const form = new FormData()
|
||||
form.append("text", fields.text)
|
||||
|
||||
@@ -116,7 +116,6 @@ const delete_reporter = async (reporter: Reporter) => {
|
||||
const index = reporters.indexOf(reporter)
|
||||
if (index > -1) {
|
||||
reporters.splice(index, 1)
|
||||
reporters = reporters
|
||||
}
|
||||
|
||||
try {
|
||||
@@ -140,11 +139,11 @@ onMount(get_reporters);
|
||||
<section>
|
||||
<div class="toolbar" style="text-align: left;">
|
||||
<div class="toolbar_spacer"></div>
|
||||
<button onclick={() => get_reporters()}>
|
||||
<i class="icon">refresh</i>
|
||||
<button onclick={() => get_reporters()} title="Refresh">
|
||||
<i class="icon i_refresh"></i>
|
||||
</button>
|
||||
<button bind:this={edit_button} class:button_highlight={creating} onclick={() => {creating = !creating}}>
|
||||
<i class="icon">create</i> Add abuse reporter
|
||||
<i class="icon i_create"></i> Add abuse reporter
|
||||
</button>
|
||||
</div>
|
||||
{#if creating}
|
||||
@@ -164,7 +163,7 @@ onMount(get_reporters);
|
||||
<label for="reporter_status_2">Rejected</label>
|
||||
</div>
|
||||
<button class="button_highlight" type="submit">
|
||||
<i class="icon">save</i> Save
|
||||
<i class="icon i_save"></i> Save
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
@@ -175,29 +174,29 @@ onMount(get_reporters);
|
||||
<h2>Pending reporters ({reporters_pending.length})</h2>
|
||||
<EmailReportersTable
|
||||
reporters={reporters_pending}
|
||||
on:edit={e => edit_reporter(e.detail)}
|
||||
on:approve={e => approve_reporter(e.detail)}
|
||||
on:spam={e => spam_reporter(e.detail)}
|
||||
on:delete={e => delete_reporter(e.detail)}>
|
||||
on_edit={edit_reporter}
|
||||
on_approve={approve_reporter}
|
||||
on_spam={spam_reporter}
|
||||
on_delete={delete_reporter}>
|
||||
</EmailReportersTable>
|
||||
|
||||
|
||||
<h2>Trusted reporters ({reporters_trusted.length})</h2>
|
||||
<EmailReportersTable
|
||||
reporters={reporters_trusted}
|
||||
on:edit={e => edit_reporter(e.detail)}
|
||||
on:approve={e => approve_reporter(e.detail)}
|
||||
on:spam={e => spam_reporter(e.detail)}
|
||||
on:delete={e => delete_reporter(e.detail)}>
|
||||
on_edit={edit_reporter}
|
||||
on_approve={approve_reporter}
|
||||
on_spam={spam_reporter}
|
||||
on_delete={delete_reporter}>
|
||||
</EmailReportersTable>
|
||||
|
||||
<h2>Rejected reporters ({reporters_rejected.length})</h2>
|
||||
<EmailReportersTable
|
||||
reporters={reporters_rejected}
|
||||
on:edit={e => edit_reporter(e.detail)}
|
||||
on:approve={e => approve_reporter(e.detail)}
|
||||
on:spam={e => spam_reporter(e.detail)}
|
||||
on:delete={e => delete_reporter(e.detail)}>
|
||||
on_edit={edit_reporter}
|
||||
on_approve={approve_reporter}
|
||||
on_spam={spam_reporter}
|
||||
on_delete={delete_reporter}>
|
||||
</EmailReportersTable>
|
||||
<br/>
|
||||
|
||||
|
||||
@@ -1,45 +1,43 @@
|
||||
<script lang="ts">
|
||||
import { run, preventDefault } from 'svelte/legacy';
|
||||
import { createEventDispatcher } from "svelte";
|
||||
import { formatDate } from "util/Formatting";
|
||||
import Modal from "util/Modal.svelte"
|
||||
import SortButton from "layout/SortButton.svelte";
|
||||
import { flip } from "svelte/animate";
|
||||
|
||||
const dispatch = createEventDispatcher()
|
||||
|
||||
let { reporters = $bindable([]) } = $props();
|
||||
|
||||
const update_table = (reporters) => sort("")
|
||||
let { reporters = [], on_edit, on_approve, on_spam, on_delete }: {
|
||||
reporters?: any[];
|
||||
on_edit: (reporter: any) => void;
|
||||
on_approve: (reporter: any) => void;
|
||||
on_spam: (reporter: any) => void;
|
||||
on_delete: (reporter: any) => void;
|
||||
} = $props();
|
||||
|
||||
let sort_field = $state("last_used")
|
||||
let asc = $state(false)
|
||||
const sort = (field) => {
|
||||
if (field !== "" && field === sort_field) asc = !asc
|
||||
if (field === "") field = sort_field
|
||||
const sort = (field: string) => {
|
||||
if (field === sort_field) asc = !asc
|
||||
sort_field = field
|
||||
|
||||
console.log("sorting by", field, "asc", asc)
|
||||
reporters.sort((a, b) => {
|
||||
if (typeof (a[field]) === "number") {
|
||||
// Sort ints from high to low
|
||||
if (asc) {
|
||||
return a[field] - b[field]
|
||||
} else {
|
||||
return b[field] - a[field]
|
||||
}
|
||||
} else {
|
||||
// Sort strings alphabetically
|
||||
if (asc) {
|
||||
return a[field].localeCompare(b[field])
|
||||
} else {
|
||||
return b[field].localeCompare(a[field])
|
||||
}
|
||||
}
|
||||
})
|
||||
reporters = reporters
|
||||
}
|
||||
|
||||
let sorted = $derived([...reporters].sort((a, b) => {
|
||||
if (typeof (a[sort_field]) === "number") {
|
||||
// Sort ints from high to low
|
||||
if (asc) {
|
||||
return a[sort_field] - b[sort_field]
|
||||
} else {
|
||||
return b[sort_field] - a[sort_field]
|
||||
}
|
||||
} else {
|
||||
// Sort strings alphabetically
|
||||
if (asc) {
|
||||
return a[sort_field].localeCompare(b[sort_field])
|
||||
} else {
|
||||
return b[sort_field].localeCompare(a[sort_field])
|
||||
}
|
||||
}
|
||||
}))
|
||||
|
||||
let modal: Modal = $state()
|
||||
let preview_subject = $state("")
|
||||
let preview_html = $state("")
|
||||
@@ -50,9 +48,6 @@ const toggle_preview = (rep) => {
|
||||
preview_html = rep.last_message_html
|
||||
modal.show()
|
||||
}
|
||||
run(() => {
|
||||
update_table(reporters)
|
||||
});
|
||||
</script>
|
||||
|
||||
<div class="table_scroll">
|
||||
@@ -69,7 +64,7 @@ run(() => {
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{#each reporters as rep (rep.from_address)}
|
||||
{#each sorted as rep (rep.from_address)}
|
||||
<tr animate:flip={{duration: 500}}>
|
||||
<td>{rep.from_address}</td>
|
||||
<td>{rep.name}</td>
|
||||
@@ -78,24 +73,24 @@ run(() => {
|
||||
<td>{formatDate(rep.last_used, true, true, false)}</td>
|
||||
<td>{formatDate(rep.created, false, false, false)}</td>
|
||||
<td>
|
||||
<button onclick={preventDefault(() => toggle_preview(rep))} class="button round">
|
||||
<i class="icon">email</i>
|
||||
<button onclick={e => {e.preventDefault(); toggle_preview(rep)}} class="button round" title="Show last message">
|
||||
<i class="icon i_email"></i>
|
||||
</button>
|
||||
<button onclick={preventDefault(() => {dispatch("edit", rep)})} class="button round">
|
||||
<i class="icon">edit</i>
|
||||
<button onclick={e => {e.preventDefault(); on_edit(rep)}} class="button round" title="Edit">
|
||||
<i class="icon i_edit"></i>
|
||||
</button>
|
||||
{#if rep.status !== "trusted"}
|
||||
<button onclick={preventDefault(() => {dispatch("approve", rep)})} class="button button_highlight round">
|
||||
<i class="icon">check</i>
|
||||
<button onclick={e => {e.preventDefault(); on_approve(rep)}} class="button button_highlight round" title="Trust">
|
||||
<i class="icon i_check"></i>
|
||||
</button>
|
||||
{/if}
|
||||
{#if rep.status !== "rejected"}
|
||||
<button onclick={preventDefault(() => {dispatch("spam", rep)})} class="button button_red round">
|
||||
<i class="icon">block</i>
|
||||
<button onclick={e => {e.preventDefault(); on_spam(rep)}} class="button button_red round" title="Reject">
|
||||
<i class="icon i_block"></i>
|
||||
</button>
|
||||
{/if}
|
||||
<button onclick={preventDefault(() => {dispatch("delete", rep)})} class="button button_red round">
|
||||
<i class="icon">delete</i>
|
||||
<button onclick={e => {e.preventDefault(); on_delete(rep)}} class="button button_red round" title="Delete">
|
||||
<i class="icon i_delete"></i>
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -49,7 +49,7 @@ const date = (d: string) => (!d || d.startsWith("0001-")) ? "never" : formatDate
|
||||
<label for="hash_input">File hash (hex sha256)</label>
|
||||
<input id="hash_input" bind:value={hash} onclick={e => e.currentTarget.select()}/>
|
||||
<button type="submit" disabled={loading}>
|
||||
<i class="icon">search</i> Look up
|
||||
<i class="icon i_search"></i> Look up
|
||||
</button>
|
||||
</form>
|
||||
|
||||
|
||||
@@ -285,11 +285,11 @@ onMount(() => {
|
||||
|
||||
<h3>Cache nodes</h3>
|
||||
</section>
|
||||
<PeerTable peers={status.peers.reduce((acc, val) => {if (val.role === "cache") {acc.push(val)}; return acc}, [])}/>
|
||||
<PeerTable peers={status.peers.filter(peer => peer.services?.includes("cache"))}/>
|
||||
<section>
|
||||
<h3>Storage nodes</h3>
|
||||
</section>
|
||||
<PeerTable peers={status.peers.reduce((acc, val) => {if (val.role === "storage") {acc.push(val)}; return acc}, [])}/>
|
||||
<PeerTable peers={status.peers.filter(peer => peer.services?.includes("storage"))}/>
|
||||
<section>
|
||||
|
||||
<h3>Query statistics</h3>
|
||||
|
||||
@@ -55,6 +55,8 @@ const groups: {
|
||||
data_type: "duration",
|
||||
},
|
||||
{metric: "filesystem_index_walk_child", data_type: "number"},
|
||||
{metric: "s3_request", data_type: "number"},
|
||||
{metric: "s3_error_500", data_type: "number"},
|
||||
]
|
||||
}, {
|
||||
title: "Task scheduler", expanded: false,
|
||||
|
||||
@@ -161,13 +161,13 @@ let invoices_filtered: Invoice[] = $state([])
|
||||
<h3>{year + "-" + ("00"+(month)).slice(-2)}</h3>
|
||||
<div class="toolbar">
|
||||
<button onclick={last_month}>
|
||||
<i class="icon">chevron_left</i>
|
||||
<i class="icon i_chevron_left"></i>
|
||||
Previous month
|
||||
</button>
|
||||
<div class="toolbar_spacer"></div>
|
||||
<button onclick={next_month}>
|
||||
Next month
|
||||
<i class="icon">chevron_right</i>
|
||||
<i class="icon i_chevron_right"></i>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ import { loading_finish, loading_start } from "lib/Loading";
|
||||
let { settlement = {} } = $props();
|
||||
let payments = $state([])
|
||||
|
||||
let per_country = $state({})
|
||||
let per_country: {[country: string]: any} = $state({})
|
||||
let totals = $state({
|
||||
count: 0,
|
||||
vat: 0,
|
||||
@@ -79,7 +79,7 @@ const get_payments = async () => {
|
||||
{}
|
||||
)
|
||||
|
||||
console.log(per_country)
|
||||
console.log($state.snapshot(per_country))
|
||||
} catch (err) {
|
||||
alert(err);
|
||||
} finally {
|
||||
|
||||
@@ -115,8 +115,8 @@ const decommission = (id: string) => {
|
||||
<td>{formatDataVolume(peer.min_free_space, 3)}</td>
|
||||
{#if !all_reachable}
|
||||
<td>
|
||||
<button class="button flat delete" onclick={() => decommission(peer.id)}>
|
||||
<i class="icon small">delete</i>
|
||||
<button class="button flat delete" onclick={() => decommission(peer.id)} title="Decommission">
|
||||
<i class="icon small i_delete"></i>
|
||||
</button>
|
||||
</td>
|
||||
{/if}
|
||||
|
||||
@@ -67,7 +67,7 @@ let pages = [
|
||||
}, {
|
||||
path: "/admin/paypal_taxes",
|
||||
title: "Paypal Taxes",
|
||||
icon: "paypal",
|
||||
icon: "payments",
|
||||
component: PayPalTaxes,
|
||||
}, {
|
||||
path: "/admin/invoices",
|
||||
|
||||
@@ -26,7 +26,7 @@ let credit_form = {
|
||||
default_value: 0,
|
||||
},
|
||||
],
|
||||
submit_label: `<i class="icon">send</i> Submit`,
|
||||
submit_label: `<i class="icon i_send"></i> Submit`,
|
||||
on_submit: async fields => {
|
||||
const form = new FormData()
|
||||
form.append("id", fields.user_id)
|
||||
@@ -71,7 +71,7 @@ let impersonate_form = {
|
||||
default_value: "",
|
||||
},
|
||||
],
|
||||
submit_label: `<i class="icon">send</i> Submit`,
|
||||
submit_label: `<i class="icon i_send"></i> Submit`,
|
||||
on_submit: async fields => {
|
||||
const form = new FormData()
|
||||
form.append("id", fields.user_id)
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<script>
|
||||
import { stopPropagation } from 'svelte/legacy';
|
||||
import { onMount } from "svelte";
|
||||
import { formatDate } from "util/Formatting";
|
||||
import Expandable from "util/Expandable.svelte";
|
||||
@@ -116,9 +115,9 @@ onMount(get_bans);
|
||||
<div class="toolbar_spacer"></div>
|
||||
<button class:button_highlight={expanded} onclick={() => {expanded = !expanded}}>
|
||||
{#if expanded}
|
||||
<i class="icon">unfold_less</i> Collapse all
|
||||
<i class="icon i_unfold_less"></i> Collapse all
|
||||
{:else}
|
||||
<i class="icon">unfold_more</i> Expand all
|
||||
<i class="icon i_unfold_more"></i> Expand all
|
||||
{/if}
|
||||
</button>
|
||||
</div>
|
||||
@@ -142,8 +141,8 @@ onMount(get_bans);
|
||||
Date<br/>
|
||||
{formatDate(row.offences[0].ban_time, false, false, false)}
|
||||
</div>
|
||||
<button onclick={stopPropagation(() => {delete_ban(row.user_id)})} class="button button_red" style="align-self: center;">
|
||||
<i class="icon">delete</i>
|
||||
<button onclick={e => {e.stopPropagation(); delete_ban(row.user_id)}} class="button button_red" style="align-self: center;" title="Delete ban">
|
||||
<i class="icon i_delete"></i>
|
||||
</button>
|
||||
</div>
|
||||
{/snippet}
|
||||
@@ -152,7 +151,7 @@ onMount(get_bans);
|
||||
<Button click={() => impersonate(row.user_id)} icon="login" label="Impersonate user"/>
|
||||
<div class="toolbar_spacer"></div>
|
||||
<div class="toolbar_label">
|
||||
<i class="icon">block</i> Block all files
|
||||
<i class="icon i_block"></i> Block all files
|
||||
<select bind:value={row.select_abuse_type}>
|
||||
<option>copyright</option>
|
||||
<option>child_abuse</option>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { fs_encode_path } from "lib/FilesystemAPI.svelte";
|
||||
import { path_link, type FSNavigator } from "./FSNavigator";
|
||||
import { move_target, path_link, type FSNavigator } from "./FSNavigator";
|
||||
import FileMenu from "./filemanager/FileMenu.svelte";
|
||||
import EditWindow from "./edit_window/EditWindow.svelte";
|
||||
import { onMount } from "svelte";
|
||||
@@ -29,19 +29,20 @@ onMount(() => {
|
||||
href={"/d"+fs_encode_path(node.path)}
|
||||
class="breadcrumb button flat"
|
||||
use:path_link={{nav: nav, node: node}}
|
||||
use:move_target={{nav, node: () => node}}
|
||||
oncontextmenu={e => file_menu.open(node, e.target, e)}
|
||||
>
|
||||
{#if node.abuse_type !== undefined}
|
||||
<i class="icon small">block</i>
|
||||
<i class="icon small i_block"></i>
|
||||
{:else if node.is_shared()}
|
||||
<i class="icon small">share</i>
|
||||
<i class="icon small i_share"></i>
|
||||
{/if}
|
||||
<div class="node_name" class:base={$nav.base_index === i} class:small={$nav.path.length > 10}>
|
||||
{node.name}
|
||||
</div>
|
||||
</a>
|
||||
{#if $nav.base_index !== i}
|
||||
<i class="icon">chevron_right</i>
|
||||
<i class="icon i_chevron_right"></i>
|
||||
{/if}
|
||||
{/each}
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ import { fs_path_url, fs_share_hotlink_url, fs_share_url, fs_timeseries, type FS
|
||||
import { color_by_name } from "util/Util";
|
||||
import CopyButton from "layout/CopyButton.svelte";
|
||||
import type { FSNavigator } from "./FSNavigator";
|
||||
import { untrack } from "svelte";
|
||||
|
||||
let {
|
||||
nav,
|
||||
@@ -19,9 +20,12 @@ export const toggle = () => visible = !visible
|
||||
|
||||
$effect(() => {
|
||||
// Only update the chart if the details modal is open. Else the chart is
|
||||
// rendered for nothing
|
||||
if (visible) {
|
||||
update_chart($nav.base, chart_timespan, chart_interval)
|
||||
// rendered for nothing. The chart is not there until it's downloaded,
|
||||
// reading it here makes this run again when it's ready. The timespan is not
|
||||
// a dependency, update_chart sets it and that would fetch the data twice
|
||||
if (visible && chart) {
|
||||
const base = $nav.base
|
||||
untrack(() => update_chart(base, chart_timespan, chart_interval))
|
||||
}
|
||||
})
|
||||
|
||||
@@ -42,8 +46,6 @@ let total_downloads = $state(0)
|
||||
let total_egress = $state(0)
|
||||
|
||||
let update_chart = async (base: FSNode, timespan: number, interval: number) => {
|
||||
// The chart is not there until it's downloaded. The $effect above reads it
|
||||
// through this function, so it calls this function again when it's ready
|
||||
if (!visible || base.type !== "file" || !chart) {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<script lang="ts">
|
||||
import TextBlock from "layout/TextBlock.svelte";
|
||||
import Button from "layout/Button.svelte";
|
||||
import { type FSNavigator } from "./FSNavigator";
|
||||
import { onMount } from "svelte";
|
||||
import { breadcrumbs_store } from "wrap/HeaderStore";
|
||||
@@ -17,6 +18,16 @@ onMount(() => {
|
||||
|
||||
|
||||
})
|
||||
|
||||
let password = $state("")
|
||||
let wrong_password = $state(false)
|
||||
const submit_password = async (e: SubmitEvent) => {
|
||||
e.preventDefault()
|
||||
await nav.navigate(nav.last_requested_path, false, password)
|
||||
|
||||
// This page is gone if the password was right
|
||||
wrong_password = true
|
||||
}
|
||||
</script>
|
||||
|
||||
{#snippet breadcrumbs()}
|
||||
@@ -29,6 +40,23 @@ onMount(() => {
|
||||
<p>
|
||||
This page could not be found.
|
||||
</p>
|
||||
{:else if $nav.navigation_error === "password_required"}
|
||||
<h1>Password required</h1>
|
||||
<p>
|
||||
This directory is protected with a password.
|
||||
</p>
|
||||
<form onsubmit={submit_password}>
|
||||
<!-- Password managers take the directory for the username. Without
|
||||
this they fill in the password of the visitor's Nova account. The
|
||||
hidden attribute does not work, the stylesheet overrides it -->
|
||||
<input type="text" autocomplete="username" value={$nav.last_requested_path.split("/")[1]} style="display: none;">
|
||||
<!-- svelte-ignore a11y_autofocus -->
|
||||
<input type="password" bind:value={password} placeholder="Password" required autofocus>
|
||||
<Button type="submit" icon="lock_open" label="Open"/>
|
||||
</form>
|
||||
{#if wrong_password}
|
||||
<p>This password is not correct.</p>
|
||||
{/if}
|
||||
{:else if $nav.navigation_error === "permission_denied" || $nav.navigation_error === "forbidden"}
|
||||
<h1>Permission denied</h1>
|
||||
<p>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { loading_finish, loading_start } from "lib/Loading";
|
||||
import { fs_get_node, fs_encode_path, fs_split_path, fs_path_from_json } from "lib/FilesystemAPI.svelte";
|
||||
import { loading_finish, loading_run, loading_start } from "lib/Loading";
|
||||
import { fs_get_node, fs_encode_path, fs_split_path, fs_path_from_json, fs_path_url, fs_rename } from "lib/FilesystemAPI.svelte";
|
||||
import type { FSNode, FSPath, FSPermissions, FSContext } from "lib/FilesystemAPI.svelte";
|
||||
|
||||
export class FSNavigator {
|
||||
@@ -16,6 +16,10 @@ export class FSNavigator {
|
||||
// Initialized will be set to true when the first file or directory is loaded
|
||||
initialized = false
|
||||
shuffle = false
|
||||
toggle_shuffle = () => {
|
||||
this.shuffle = !this.shuffle
|
||||
this.notify_subscribers()
|
||||
}
|
||||
|
||||
// Whether navigation events should update the browser history
|
||||
history_enabled = true
|
||||
@@ -45,8 +49,8 @@ export class FSNavigator {
|
||||
|
||||
last_requested_path: string = ""
|
||||
navigation_error: string = ""
|
||||
navigate = async (path: string, push_history: boolean) => {
|
||||
if (path === this.last_requested_path) {
|
||||
navigate = async (path: string, push_history: boolean, password?: string) => {
|
||||
if (path === this.last_requested_path && password === undefined) {
|
||||
console.debug("FSNavigator: Requested path ", path, " is equal to current path. Debouncing")
|
||||
return
|
||||
}
|
||||
@@ -56,6 +60,18 @@ export class FSNavigator {
|
||||
path = "/" + path
|
||||
}
|
||||
|
||||
// The password of a shared directory is entered by the visitor, or it's
|
||||
// in the link they opened. It's sent in a cookie, which is the only way
|
||||
// to get it into the requests for images, videos and downloads. The
|
||||
// cookie's path is the directory, so each directory has its own password
|
||||
if (password === undefined && this.history_enabled) {
|
||||
password = new URLSearchParams(window.location.search).get("password")
|
||||
}
|
||||
if (password) {
|
||||
document.cookie = "nova_fs_password=" + encodeURIComponent(password) +
|
||||
"; path=" + fs_path_url(path.split("/")[1]) + "; samesite=lax"
|
||||
}
|
||||
|
||||
console.debug("FSNavigator: Navigating to path", path, push_history)
|
||||
|
||||
try {
|
||||
@@ -70,9 +86,9 @@ export class FSNavigator {
|
||||
this.open_node(resp, push_history)
|
||||
} catch (err: any) {
|
||||
if (err.value !== undefined && err.value === "path_not_found") {
|
||||
if (path !== this.path[0].path && path !== "/" && path !== "") {
|
||||
if (path !== this.path[0]?.path && path !== "/" && path !== "") {
|
||||
console.debug("Path", path, "was not found, trying to navigate to parent")
|
||||
this.navigate(fs_split_path(path).parent, push_history)
|
||||
this.navigate(fs_split_path(path).parent, push_history, password)
|
||||
}
|
||||
} else if (err.value !== undefined) {
|
||||
this.navigation_error = err.value
|
||||
@@ -251,6 +267,105 @@ export class FSNavigator {
|
||||
// the reactivity
|
||||
this.notify_subscribers()
|
||||
}
|
||||
|
||||
// The selection is kept by path, so it survives reloads and navigating to
|
||||
// other directories. The directory views look each entry up in it
|
||||
selecting = false
|
||||
selection = new Map<string, FSNode>()
|
||||
last_selected = ""
|
||||
|
||||
// Leaving selection mode clears the selection
|
||||
set_selecting = (on: boolean) => {
|
||||
this.selecting = on
|
||||
if (!on) {
|
||||
this.selection.clear()
|
||||
}
|
||||
this.notify_subscribers()
|
||||
}
|
||||
|
||||
// Toggles a node. With range, everything between it and the node which was
|
||||
// toggled before it is selected. Hidden nodes are left out of the range when
|
||||
// the view doesn't show them
|
||||
select = (node: FSNode, range = false, hidden = true) => {
|
||||
const from = range ? this.children.findIndex(c => c.path === this.last_selected) : -1
|
||||
if (from !== -1) {
|
||||
const to = this.children.indexOf(node)
|
||||
for (let i = Math.min(from, to); i <= Math.max(from, to); i++) {
|
||||
if (hidden || !this.children[i].is_hidden()) {
|
||||
this.selection.set(this.children[i].path, this.children[i])
|
||||
}
|
||||
}
|
||||
} else if (!this.selection.delete(node.path)) {
|
||||
this.selection.set(node.path, node)
|
||||
}
|
||||
this.last_selected = node.path
|
||||
this.set_selecting(true)
|
||||
}
|
||||
|
||||
// Downloads the selection, or the open node if nothing is selected. More
|
||||
// than one node is zipped by the closest directory which they are all in
|
||||
download = () => {
|
||||
const nodes = [...this.selection.values()]
|
||||
if (nodes.length < 2) {
|
||||
return (nodes[0] ?? this.base).download()
|
||||
}
|
||||
|
||||
let dir = nodes[0].path
|
||||
do {
|
||||
dir = dir.slice(0, dir.lastIndexOf("/"))
|
||||
} while (!nodes.every(n => n.path.startsWith(dir + "/")))
|
||||
|
||||
const a = document.createElement("a")
|
||||
a.href = fs_path_url(dir) + "?bulk_download&" + new URLSearchParams(
|
||||
nodes.map(n => ["include", n.path.slice(dir.length + 1)])
|
||||
)
|
||||
a.download = ""
|
||||
a.dispatchEvent(new MouseEvent("click"))
|
||||
}
|
||||
|
||||
// A directory can't be moved into itself, and there has to be at least one
|
||||
// node which is not in dir already
|
||||
can_move = (dir: string) => {
|
||||
let moves = false
|
||||
for (const node of this.selection.values()) {
|
||||
if ((dir + "/").startsWith(node.path + "/")) {
|
||||
return false
|
||||
}
|
||||
moves ||= node.path !== dir + "/" + node.name
|
||||
}
|
||||
return moves
|
||||
}
|
||||
|
||||
move_selection = async (dir: string) => {
|
||||
try {
|
||||
await loading_run(() => Promise.all(
|
||||
[...this.selection.values()]
|
||||
.filter(node => node.path !== dir + "/" + node.name)
|
||||
.map(node => fs_rename(node.path, dir + "/" + node.name))
|
||||
))
|
||||
} catch (err: any) {
|
||||
console.error(err)
|
||||
alert("Move failed: " + err.message + " (" + err.value + ")")
|
||||
}
|
||||
this.set_selecting(false)
|
||||
await this.reload()
|
||||
}
|
||||
|
||||
// Dragging a node drags the whole selection. The drag itself only carries a
|
||||
// marker, as the selection outlives the element which is being dragged when
|
||||
// the user navigates during the drag
|
||||
drag_start = (e: DragEvent, node: FSNode) => {
|
||||
e.dataTransfer.setData(drag_type, node.path)
|
||||
e.dataTransfer.effectAllowed = "move"
|
||||
|
||||
if (!this.selecting) {
|
||||
// The drag started the selection, so it ends it as well
|
||||
e.target.addEventListener("dragend", () => this.set_selecting(false), { once: true })
|
||||
}
|
||||
if (!this.selection.has(node.path)) {
|
||||
this.select(node)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const sort_children = (children: FSNode[], field: string, asc: boolean) => {
|
||||
@@ -287,7 +402,55 @@ const sort_children = (children: FSNode[], field: string, asc: boolean) => {
|
||||
|
||||
export let global_navigator = new FSNavigator(true)
|
||||
|
||||
const drag_type = "application/x-nova-selection"
|
||||
const is_drag = (e: DragEvent) => e.dataTransfer.types.includes(drag_type)
|
||||
|
||||
// Moves the selection into a directory when it's dropped on the element. The
|
||||
// node is a function because an action only gets its parameters once. Bookmarks
|
||||
// have no type, the server refuses the move if one turns out to be a file
|
||||
export const move_target = (
|
||||
el: HTMLElement,
|
||||
data: { nav: FSNavigator, node: () => { path: string, type?: string } },
|
||||
) => {
|
||||
const accepts = (e: DragEvent) => {
|
||||
if (!is_drag(e) || data.node().type === "file" || !data.nav.can_move(data.node().path)) {
|
||||
return false
|
||||
}
|
||||
e.preventDefault()
|
||||
e.stopPropagation()
|
||||
return true
|
||||
}
|
||||
el.addEventListener("dragover", e => {
|
||||
if (accepts(e)) {
|
||||
el.style.boxShadow = "var(--accent_color) 0 0 0 2px inset"
|
||||
}
|
||||
})
|
||||
el.addEventListener("dragleave", () => el.style.boxShadow = "")
|
||||
el.addEventListener("drop", e => {
|
||||
el.style.boxShadow = ""
|
||||
if (accepts(e)) {
|
||||
data.nav.move_selection(data.node().path)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// Clicks the element when the selection is held over it, so the navigation
|
||||
// buttons work during a drag
|
||||
export const drag_click = (el: HTMLElement) => {
|
||||
let timer: number
|
||||
el.addEventListener("dragenter", e => {
|
||||
if (is_drag(e)) {
|
||||
clearTimeout(timer)
|
||||
timer = window.setTimeout(() => el.click(), 500)
|
||||
}
|
||||
})
|
||||
el.addEventListener("dragleave", e => {
|
||||
// Moving onto a child of the element is not leaving it
|
||||
if (!el.contains(e.relatedTarget as Node)) {
|
||||
clearTimeout(timer)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
export const path_link = (node: HTMLAnchorElement, data: { nav: FSNavigator, node: FSNode }) => {
|
||||
// Set url
|
||||
|
||||
@@ -115,11 +115,11 @@ const toggle_expand_keyboard = (e: KeyboardEvent) => {
|
||||
</script>
|
||||
|
||||
<div class="container" onclick={toggle_expand} onkeypress={toggle_expand_keyboard} role="presentation">
|
||||
<button class="button_expand hidden_vertical" onclick={toggle_expand}>
|
||||
<button class="button_expand hidden_vertical" onclick={toggle_expand} title={expanded ? "Collapse" : "Expand"}>
|
||||
{#if expanded}
|
||||
<i class="icon">expand_more</i>
|
||||
<i class="icon i_expand_more"></i>
|
||||
{:else}
|
||||
<i class="icon">expand_less</i>
|
||||
<i class="icon i_expand_less"></i>
|
||||
{/if}
|
||||
</button>
|
||||
|
||||
|
||||
@@ -5,23 +5,19 @@ import Toolbar from "./Toolbar.svelte";
|
||||
import Breadcrumbs from "./Breadcrumbs.svelte";
|
||||
import DetailsWindow from "./DetailsWindow.svelte";
|
||||
import FilePreview from "./viewers/FilePreview.svelte";
|
||||
import FSUploadWidget from "./upload_widget/FSUploadWidget.svelte";
|
||||
import { global_navigator } from "./FSNavigator"
|
||||
import { css_from_path } from "filesystem/edit_window/Branding";
|
||||
import { update_favicon } from "util/NovaLogo.svelte";
|
||||
import AffiliatePrompt from "user_home/AffiliatePrompt.svelte";
|
||||
import { current_page_store } from "wrap/RouterStore";
|
||||
import SearchBar from "./SearchBar.svelte";
|
||||
import ErrorPage from "./ErrorPage.svelte";
|
||||
|
||||
let file_preview: FilePreview = $state()
|
||||
let toolbar: Toolbar = $state()
|
||||
let upload_widget: FSUploadWidget = $state()
|
||||
let details_visible = $state(false)
|
||||
let edit_window: EditWindow = $state()
|
||||
let edit_visible = $state(false)
|
||||
let details_window: DetailsWindow = $state()
|
||||
let search_bar: SearchBar = $state()
|
||||
|
||||
const nav = global_navigator
|
||||
|
||||
@@ -60,13 +56,7 @@ onMount(() => {
|
||||
const keydown = (e: KeyboardEvent) => {
|
||||
if (e.ctrlKey || e.altKey || e.metaKey) {
|
||||
return // prevent custom shortcuts from interfering with system shortcuts
|
||||
} else if (
|
||||
(document.activeElement as any).type !== undefined &&
|
||||
(
|
||||
(document.activeElement as any).type === "text" ||
|
||||
(document.activeElement as any).type === "textarea"
|
||||
)
|
||||
) {
|
||||
} else if (["text", "password", "textarea"].includes((document.activeElement as any).type)) {
|
||||
return // Prevent shortcuts from interfering with input fields
|
||||
}
|
||||
|
||||
@@ -86,13 +76,10 @@ const keydown = (e: KeyboardEvent) => {
|
||||
}
|
||||
break;
|
||||
case "s":
|
||||
nav.base.download()
|
||||
nav.download()
|
||||
break;
|
||||
case "r":
|
||||
nav.shuffle = !nav.shuffle
|
||||
break;
|
||||
case "/":
|
||||
search_bar.open()
|
||||
nav.toggle_shuffle()
|
||||
break;
|
||||
case "a":
|
||||
case "ArrowLeft":
|
||||
@@ -153,10 +140,8 @@ const keydown = (e: KeyboardEvent) => {
|
||||
<FilePreview
|
||||
bind:this={file_preview}
|
||||
nav={nav}
|
||||
upload_widget={upload_widget}
|
||||
edit_window={edit_window}
|
||||
details_window={details_window}
|
||||
search_bar={search_bar}
|
||||
/>
|
||||
</div>
|
||||
|
||||
@@ -173,16 +158,10 @@ const keydown = (e: KeyboardEvent) => {
|
||||
<ErrorPage nav={nav} />
|
||||
{/if}
|
||||
|
||||
<SearchBar bind:this={search_bar} nav={nav}/>
|
||||
|
||||
<DetailsWindow nav={nav} bind:this={details_window} bind:visible={details_visible} />
|
||||
|
||||
<EditWindow nav={nav} bind:this={edit_window} bind:visible={edit_visible} />
|
||||
|
||||
<!-- This one is included at the highest level so uploads can keep running
|
||||
even when the user navigates to a different directory -->
|
||||
<FSUploadWidget nav={nav} bind:this={upload_widget} />
|
||||
|
||||
<AffiliatePrompt/>
|
||||
|
||||
<style>
|
||||
|
||||
@@ -1,13 +1,17 @@
|
||||
<script lang="ts" module>
|
||||
// The search bar is mounted once, in App.svelte. It sets this function when it
|
||||
// mounts, so that other components can open it
|
||||
export let open_search: () => void
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
import { onMount, tick } from "svelte";
|
||||
import { fs_search, fs_encode_path, fs_thumbnail_url, FSNode } from "lib/FilesystemAPI.svelte";
|
||||
import type { FSNavigator } from "filesystem/FSNavigator";
|
||||
import { global_navigator as nav } from "filesystem/FSNavigator";
|
||||
import { loading_finish, loading_start } from "lib/Loading";
|
||||
import { user } from "lib/UserStore";
|
||||
import Modal from "util/Modal.svelte";
|
||||
|
||||
let { nav }: {
|
||||
nav: FSNavigator;
|
||||
} = $props();
|
||||
import { navigate } from "wrap/Router.svelte";
|
||||
|
||||
let modal: Modal
|
||||
let search_bar: HTMLInputElement = $state()
|
||||
@@ -32,8 +36,23 @@ onMount(() => {
|
||||
})
|
||||
})
|
||||
|
||||
export const open = async () => {
|
||||
search_prefix_node = nav.base
|
||||
// The path of the directory to search. Outside of the filesystem page the
|
||||
// navigator is stale or empty, there it's the home directory of the user.
|
||||
// Visitors who are not logged in don't have one, then the path is empty
|
||||
const search_path = (): FSNode[] => {
|
||||
if (nav.initialized && window.location.pathname.startsWith("/d/")) {
|
||||
// If the base is not a directory, we use the parent
|
||||
return nav.base.type === "dir" ? nav.path : nav.path.slice(0, -1)
|
||||
}
|
||||
return $user === null ? [] : [{name: $user.username, path: "/me"} as FSNode]
|
||||
}
|
||||
|
||||
open_search = async () => {
|
||||
const path = search_path()
|
||||
if (path.length === 0) {
|
||||
return
|
||||
}
|
||||
search_prefix_node = path[path.length-1]
|
||||
modal.show()
|
||||
await tick()
|
||||
search_bar.focus()
|
||||
@@ -62,18 +81,14 @@ const search = async (limit = 10) => {
|
||||
|
||||
try {
|
||||
loading_start()
|
||||
let search_node = nav.base
|
||||
// If the base is not a directory, we use the parent
|
||||
if (search_node.type !== "dir") {
|
||||
search_node = nav.path[nav.path.length-2]
|
||||
}
|
||||
|
||||
const path = search_path()
|
||||
let search_node = path[path.length-1]
|
||||
let search_results_tmp = await fs_search(search_node.path, search_term, limit)
|
||||
|
||||
// If there are no results, and we are not searching the filesystem
|
||||
// root, we will search the filesystem root
|
||||
if (search_results_tmp.length === 0 && search_node.path != nav.path[0].path) {
|
||||
search_node = nav.path[0]
|
||||
if (search_results_tmp.length === 0 && path.length > 1) {
|
||||
search_node = path[0]
|
||||
search_results_tmp = await fs_search(search_node.path, search_term, limit)
|
||||
}
|
||||
|
||||
@@ -158,14 +173,14 @@ const open_result = (index: number, e?: MouseEvent) => {
|
||||
if (e !== undefined) {
|
||||
e.preventDefault()
|
||||
}
|
||||
nav.navigate(search_results[index], true)
|
||||
navigate("/d" + fs_encode_path(search_results[index]))
|
||||
clear_search(false)
|
||||
}
|
||||
|
||||
const window_keydown = (e: KeyboardEvent) => {
|
||||
if (e.ctrlKey || e.altKey || e.metaKey) {
|
||||
return // prevent custom shortcuts from interfering with system shortcuts
|
||||
} else if ((document.activeElement as any).type !== undefined && (document.activeElement as any).type === "text") {
|
||||
} else if (document.activeElement.matches("input, textarea, select")) {
|
||||
return // Prevent shortcuts from interfering with input fields
|
||||
}
|
||||
|
||||
@@ -175,9 +190,7 @@ const window_keydown = (e: KeyboardEvent) => {
|
||||
} else if (e.key === "/" || e.key === "f") {
|
||||
e.preventDefault()
|
||||
e.stopPropagation()
|
||||
// search_bar.focus()
|
||||
open()
|
||||
return
|
||||
open_search()
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -200,7 +213,7 @@ const window_keydown = (e: KeyboardEvent) => {
|
||||
{/if}
|
||||
<div class="center">
|
||||
<form class="search_form" onsubmit={submit_search}>
|
||||
<i class="icon">search</i>
|
||||
<i class="icon i_search"></i>
|
||||
<input
|
||||
bind:this={search_bar}
|
||||
class="term"
|
||||
@@ -237,7 +250,7 @@ const window_keydown = (e: KeyboardEvent) => {
|
||||
<div class="node">
|
||||
<div class="node_name" style="text-align: center;">
|
||||
<button onclick={() => {search(last_limit + 100)}}>
|
||||
<i class="icon">expand_more</i>
|
||||
<i class="icon i_expand_more"></i>
|
||||
More results
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@@ -41,37 +41,37 @@ export const copy_link = () => {
|
||||
|
||||
<div class="grid" class:hide={!toolbar_expanded}>
|
||||
<div class="button_row">
|
||||
<button onclick={() => {nav.open_sibling(-1)}}>
|
||||
<i class="icon">skip_previous</i>
|
||||
<button onclick={() => {nav.open_sibling(-1)}} title="Previous file">
|
||||
<i class="icon i_skip_previous"></i>
|
||||
</button>
|
||||
<button onclick={() => {nav.shuffle = !nav.shuffle}} class:button_highlight={nav.shuffle}>
|
||||
<i class="icon">shuffle</i>
|
||||
<button onclick={nav.toggle_shuffle} class:button_highlight={$nav.shuffle} title="Shuffle">
|
||||
<i class="icon i_shuffle"></i>
|
||||
</button>
|
||||
<button onclick={() => {nav.open_sibling(1)}}>
|
||||
<i class="icon">skip_next</i>
|
||||
<button onclick={() => {nav.open_sibling(1)}} title="Next file">
|
||||
<i class="icon i_skip_next"></i>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<button onclick={() => $nav.base.download()}>
|
||||
<i class="icon">save</i>
|
||||
<button onclick={() => nav.download()}>
|
||||
<i class="icon i_save"></i>
|
||||
<span>Download</span>
|
||||
</button>
|
||||
|
||||
{#if is_bookmark($bookmarks_store, $nav.base.id)}
|
||||
<button onclick={() => bookmark_del($nav.base.id)}>
|
||||
<i class="icon">bookmark_remove</i>
|
||||
<i class="icon i_bookmark_remove"></i>
|
||||
<span>Bookmark</span>
|
||||
</button>
|
||||
{:else}
|
||||
<button onclick={() => bookmark_add($nav.base)}>
|
||||
<i class="icon">bookmark_add</i>
|
||||
<i class="icon i_bookmark_add"></i>
|
||||
<span>Bookmark</span>
|
||||
</button>
|
||||
{/if}
|
||||
|
||||
{#if path_is_shared($nav.path)}
|
||||
<button onclick={copy_link} class:button_highlight={link_copied}>
|
||||
<i class="icon">content_copy</i>
|
||||
<i class="icon i_content_copy"></i>
|
||||
{#if link_copied}
|
||||
<span>Link copied!</span>
|
||||
{:else}
|
||||
@@ -83,19 +83,19 @@ export const copy_link = () => {
|
||||
<!-- Share button is enabled when: The browser has a sharing API, or the user can edit the file (to enable sharing)-->
|
||||
{#if navigator.share !== undefined || $nav.permissions.write === true}
|
||||
<button onclick={(e) => share_dialog.open(e, nav.path)}>
|
||||
<i class="icon">share</i>
|
||||
<i class="icon i_share"></i>
|
||||
<span>Share</span>
|
||||
</button>
|
||||
{/if}
|
||||
|
||||
<button onclick={() => details_visible = !details_visible} class:button_highlight={details_visible}>
|
||||
<i class="icon">help</i>
|
||||
<i class="icon i_help"></i>
|
||||
<span>Deta<u>i</u>ls</span>
|
||||
</button>
|
||||
|
||||
{#if $nav.base.id !== "me" && $nav.permissions.write === true}
|
||||
<button onclick={() => edit_window.edit(nav.base, true, "file")} class:button_highlight={edit_visible}>
|
||||
<i class="icon">edit</i>
|
||||
<i class="icon i_edit"></i>
|
||||
<span><u>E</u>dit</span>
|
||||
</button>
|
||||
{/if}
|
||||
|
||||
@@ -22,7 +22,6 @@ const add_user = (e: SubmitEvent) => {
|
||||
}
|
||||
const del_user = (id: string) => {
|
||||
delete options.user_permissions[id]
|
||||
options.user_permissions = options.user_permissions
|
||||
}
|
||||
|
||||
let new_password = $state("")
|
||||
@@ -49,7 +48,6 @@ const generate_password = () => {
|
||||
let revealed: {[password: string]: boolean} = $state({})
|
||||
const del_password = (pass: string) => {
|
||||
delete options.password_permissions[pass]
|
||||
options.password_permissions = options.password_permissions
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -95,7 +93,7 @@ const del_password = (pass: string) => {
|
||||
{#if options.user_permissions !== undefined}
|
||||
{#each Object.keys(options.user_permissions) as id (id)}
|
||||
<div class="row">
|
||||
<Button click={() => del_user(id)} icon="delete"/>
|
||||
<Button click={() => del_user(id)} icon="delete" title="Remove"/>
|
||||
<div class="grow id">
|
||||
{id}
|
||||
</div>
|
||||
@@ -135,9 +133,9 @@ const del_password = (pass: string) => {
|
||||
{#if options.password_permissions !== undefined}
|
||||
{#each Object.keys(options.password_permissions) as password (password)}
|
||||
<div class="row">
|
||||
<Button click={() => del_password(password)} icon="delete"/>
|
||||
<Button click={() => del_password(password)} icon="delete" title="Remove"/>
|
||||
<input type="text" bind:value={options.password_permissions[password].label} placeholder="Label" class="grow" maxlength="100" size="1">
|
||||
<ToggleButton bind:on={revealed[password]} icon_on="visibility" icon_off="visibility_off"/>
|
||||
<ToggleButton bind:on={revealed[password]} icon_on="visibility" icon_off="visibility_off" title="Reveal password"/>
|
||||
<div class="grow id">
|
||||
{revealed[password] ? password : "••••••••••••••••"}
|
||||
</div>
|
||||
|
||||
@@ -151,7 +151,7 @@ let accent_info = $state(false)
|
||||
</p>
|
||||
<div>Header image ID</div>
|
||||
<button onclick={() => pick_image("brand_header_image")}>
|
||||
<i class="icon">folder_open</i>
|
||||
<i class="icon i_folder_open"></i>
|
||||
Pick
|
||||
</button>
|
||||
<input type="text" bind:value={options.brand_header_image}/>
|
||||
@@ -159,7 +159,7 @@ let accent_info = $state(false)
|
||||
<input class="span2" type="text" bind:value={options.brand_header_link}/>
|
||||
<div>Background image ID</div>
|
||||
<button onclick={() => pick_image("brand_background_image")}>
|
||||
<i class="icon">folder_open</i>
|
||||
<i class="icon i_folder_open"></i>
|
||||
Pick
|
||||
</button>
|
||||
<input type="text" bind:value={options.brand_background_image}/>
|
||||
@@ -182,9 +182,9 @@ let accent_info = $state(false)
|
||||
<hr/>
|
||||
|
||||
<div class="example_button_row">
|
||||
<button type="button"><i class="icon">touch_app</i>Normal</button>
|
||||
<button type="button" class="button_highlight"><i class="icon">priority_high</i>Important</button>
|
||||
<button type="button" class="button_red"><i class="icon">warning</i>Dangerous</button>
|
||||
<button type="button"><i class="icon i_touch_app"></i>Normal</button>
|
||||
<button type="button" class="button_highlight"><i class="icon i_priority_high"></i>Important</button>
|
||||
<button type="button" class="button_red"><i class="icon i_warning"></i>Dangerous</button>
|
||||
</div>
|
||||
|
||||
<div class="example_button_row">
|
||||
|
||||
@@ -35,7 +35,7 @@ export const edit = (f: FSNode, oae = false, open_tab = "") => {
|
||||
tab = open_tab
|
||||
}
|
||||
|
||||
console.log("Editing file", file)
|
||||
console.log("Editing file", $state.snapshot(file))
|
||||
|
||||
// We save the name in a separate field because we need both the original
|
||||
// name and the new name for the rename operation
|
||||
@@ -111,15 +111,15 @@ const save = async (e: SubmitEvent) => {
|
||||
<Modal bind:visible={visible} title="Edit {file.name}" width="800px" form="edit_form" style="color: var(--body_text_color); {custom_css}">
|
||||
<div class="tab_bar">
|
||||
<button class:button_highlight={tab === "file"} onclick={() => tab = "file"}>
|
||||
<i class="icon">edit</i>
|
||||
<i class="icon i_edit"></i>
|
||||
Properties
|
||||
</button>
|
||||
<button class:button_highlight={tab === "share"} onclick={() => tab = "share"}>
|
||||
<i class="icon">share</i>
|
||||
<i class="icon i_share"></i>
|
||||
Sharing
|
||||
</button>
|
||||
<button class:button_highlight={tab === "branding"} onclick={() => tab = "branding"}>
|
||||
<i class="icon">palette</i>
|
||||
<i class="icon i_palette"></i>
|
||||
Branding
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@@ -45,6 +45,16 @@ const toggle_example = () => {
|
||||
|
||||
let share_link = $derived(window.location.protocol+"//"+window.location.host+"/d/"+file.id)
|
||||
const s3_endpoint = window.location.protocol+"//s3."+window.location.host
|
||||
|
||||
// S3 clients know the directory by its UUID, which is what the ID is when it's
|
||||
// decoded from base58. Clients like Proxmox Backup Server only accept lowercase
|
||||
// bucket names
|
||||
const base58 = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"
|
||||
let s3_bucket = $derived(
|
||||
[...file.id].reduce((n, c) => n * 58n + BigInt(base58.indexOf(c)), 0n)
|
||||
.toString(16).padStart(32, "0")
|
||||
.replace(/^(.{8})(.{4})(.{4})(.{4})/, "$1-$2-$3-$4-")
|
||||
)
|
||||
</script>
|
||||
|
||||
{#if $user.subscription.file_sharing === false}
|
||||
@@ -79,15 +89,27 @@ const s3_endpoint = window.location.protocol+"//s3."+window.location.host
|
||||
<legend>S3 access</legend>
|
||||
<p>
|
||||
This directory can be used as a bucket by backup tools and other
|
||||
software which supports Amazon S3. The directory ID is the access key,
|
||||
and the passwords above are the secret keys. Each password's permissions
|
||||
decide what it can do.
|
||||
software which supports Amazon S3. The name of the bucket is also the
|
||||
access key, and the passwords above are the secret keys. Each password's
|
||||
permissions decide what it can do.
|
||||
</p>
|
||||
<table>
|
||||
<tbody>
|
||||
<tr><td>Endpoint</td><td>{s3_endpoint}</td><td><CopyButton text={s3_endpoint}>Copy</CopyButton></td></tr>
|
||||
<tr><td>Bucket and access key</td><td>{file.id}</td><td><CopyButton text={file.id}>Copy</CopyButton></td></tr>
|
||||
<tr><td>Region</td><td>us-east-1 (any region works)</td><td></td></tr>
|
||||
<tr>
|
||||
<td>Endpoint</td>
|
||||
<td>{s3_endpoint}</td>
|
||||
<td><CopyButton text={s3_endpoint}>Copy</CopyButton></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Bucket ID / Access key</td>
|
||||
<td>{s3_bucket}</td>
|
||||
<td><CopyButton text={s3_bucket}>Copy</CopyButton></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Region</td>
|
||||
<td>us-east-1 (any region works)</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</fieldset>
|
||||
@@ -110,7 +132,7 @@ const s3_endpoint = window.location.protocol+"//s3."+window.location.host
|
||||
<br/>
|
||||
<CopyButton text={embed_html} disabled={!is_shared}>Copy HTML</CopyButton>
|
||||
<button onclick={toggle_example} class:button_highlight={example} disabled={!is_shared}>
|
||||
<i class="icon">visibility</i> Show example
|
||||
<i class="icon i_visibility"></i> Show example
|
||||
</button>
|
||||
</div>
|
||||
<hr/>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { fs_encode_path, fs_node_icon } from "lib/FilesystemAPI.svelte"
|
||||
import type { FSNavigator } from "filesystem/FSNavigator";
|
||||
import { move_target, type FSNavigator } from "filesystem/FSNavigator";
|
||||
import { FileAction, type FileActionHandler } from "./FileManagerLib";
|
||||
|
||||
let {
|
||||
@@ -24,25 +24,28 @@ let {
|
||||
href={"/d"+fs_encode_path(child.path)}
|
||||
onclick={e => file_event(FileAction.Click, index, e)}
|
||||
oncontextmenu={e => file_event(FileAction.Context, index, e)}
|
||||
ondragstart={e => file_event(FileAction.Drag, index, e)}
|
||||
use:move_target={{nav, node: () => child}}
|
||||
class="node"
|
||||
class:node_selected={child.fm_selected}
|
||||
class:node_selected={$nav.selection.has(child.path)}
|
||||
class:hidden={child.name.startsWith(".") && !show_hidden}
|
||||
>
|
||||
<img src={fs_node_icon(child, 64, 64)} class="node_icon" class:large_icons loading="lazy" alt="icon"/>
|
||||
<img src={fs_node_icon(child, 64, 64)} class="node_icon" class:large_icons loading="lazy" alt="icon" draggable="false"/>
|
||||
<div class="node_name">
|
||||
{child.name}
|
||||
</div>
|
||||
|
||||
{#if child.is_shared()}
|
||||
<i class="icon" title="This file / directory is shared. Click to open public link">share</i>
|
||||
<i class="icon i_share" title="This file / directory is shared. Click to open public link"></i>
|
||||
{/if}
|
||||
|
||||
{#if !hide_edit}
|
||||
<button
|
||||
class="action_button flat"
|
||||
onclick={e => file_event(FileAction.Menu, index, e)}
|
||||
title="Menu"
|
||||
>
|
||||
<i class="icon">menu</i>
|
||||
<i class="icon i_menu"></i>
|
||||
</button>
|
||||
{/if}
|
||||
</a>
|
||||
|
||||
@@ -5,7 +5,7 @@ const scroll_positions = new Map<string, number>()
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
import { fs_rename, fs_trash, FSNode } from "lib/FilesystemAPI.svelte"
|
||||
import { fs_trash } from "lib/FilesystemAPI.svelte"
|
||||
import CreateDirectory from "./CreateDirectory.svelte"
|
||||
import ListView from "./ListView.svelte"
|
||||
import GalleryView from "./GalleryView.svelte"
|
||||
@@ -13,36 +13,32 @@ import CompactView from "./CompactView.svelte"
|
||||
import Button from "layout/Button.svelte";
|
||||
import { formatDate } from "util/Formatting";
|
||||
import { drop_target } from "lib/DropTarget"
|
||||
import type { FSNavigator } from "filesystem/FSNavigator";
|
||||
import FsUploadWidget from "filesystem/upload_widget/FSUploadWidget.svelte";
|
||||
import { drag_click, move_target, type FSNavigator } from "filesystem/FSNavigator";
|
||||
import { pick_files, upload_files } from "filesystem/upload_widget/FSUploadWidget.svelte";
|
||||
import EditWindow from "filesystem/edit_window/EditWindow.svelte";
|
||||
import { FileAction, type FileActionHandler } from "./FileManagerLib";
|
||||
import FileMenu from "./FileMenu.svelte";
|
||||
import { loading_finish, loading_start } from "lib/Loading";
|
||||
import SearchBar from "../SearchBar.svelte";
|
||||
import type { GenericResponse } from "lib/NovaAPI";
|
||||
import { open_search } from "../SearchBar.svelte";
|
||||
import { onMount } from "svelte";
|
||||
import { toolbar_store } from "wrap/HeaderStore";
|
||||
|
||||
let {
|
||||
nav = $bindable(),
|
||||
upload_widget,
|
||||
edit_window = $bindable(),
|
||||
search_bar = $bindable(),
|
||||
directory_view = $bindable(localStorage.getItem("directory_view") || "list"),
|
||||
children
|
||||
}: {
|
||||
nav: FSNavigator;
|
||||
upload_widget: FsUploadWidget;
|
||||
edit_window: EditWindow;
|
||||
search_bar: SearchBar;
|
||||
directory_view?: string;
|
||||
children?: import('svelte').Snippet;
|
||||
} = $props();
|
||||
|
||||
let large_icons = $state(localStorage.getItem("large_icons") === "true")
|
||||
let uploader!: FsUploadWidget
|
||||
let mode = $state("viewing")
|
||||
// In selection mode a click selects. Moving is the part of selection mode where
|
||||
// the user browses to the directory which the selection has to go to
|
||||
let moving = $state(false)
|
||||
let creating_dir = $state(false)
|
||||
let show_hidden = $state(false)
|
||||
let file_menu!: FileMenu
|
||||
@@ -50,12 +46,17 @@ $effect(() => {
|
||||
window.scrollTo(0, scroll_positions.get($nav.base.path) ?? 0)
|
||||
})
|
||||
|
||||
export const upload = (files: File[]) => {
|
||||
return uploader.upload_files(files)
|
||||
}
|
||||
|
||||
// Navigation functions
|
||||
const file_event: FileActionHandler = (action: FileAction, index: number, orig: Event) => {
|
||||
const node = nav.children[index]
|
||||
if (action === FileAction.Drag) {
|
||||
// Without write access it stays a normal drag of the link
|
||||
if (nav.permissions.write) {
|
||||
nav.drag_start(orig as DragEvent, node)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
orig.preventDefault()
|
||||
orig.stopPropagation()
|
||||
|
||||
@@ -63,42 +64,34 @@ const file_event: FileActionHandler = (action: FileAction, index: number, orig:
|
||||
case FileAction.Click:
|
||||
creating_dir = false
|
||||
|
||||
if (mode === "viewing") {
|
||||
nav.navigate(nav.children[index].path, true)
|
||||
} else if (mode === "moving") {
|
||||
if (!nav.selecting) {
|
||||
nav.navigate(node.path, true)
|
||||
} else if (!moving) {
|
||||
nav.select(node, (orig as MouseEvent).shiftKey, show_hidden)
|
||||
} else if (node.type === "dir" && !nav.selection.has(node.path)) {
|
||||
// If we are moving files we can only enter directories, and only if
|
||||
// they're not selected. That last requirement prevents people from
|
||||
// moving a directory into itself
|
||||
if (nav.children[index].type === "dir" && !nav.children[index].fm_selected) {
|
||||
nav.navigate(nav.children[index].path, true)
|
||||
}
|
||||
} else if (mode === "selecting") {
|
||||
select_node(index)
|
||||
nav.navigate(node.path, true)
|
||||
}
|
||||
break
|
||||
case FileAction.Context:
|
||||
// If this is a touch event we will select the item
|
||||
if (navigator.maxTouchPoints && navigator.maxTouchPoints > 0) {
|
||||
select_node(index)
|
||||
nav.select(node)
|
||||
} else {
|
||||
file_menu.open(nav.children[index], orig.target, orig)
|
||||
file_menu.open(node, orig.target, orig)
|
||||
}
|
||||
break
|
||||
case FileAction.Edit:
|
||||
edit_window.edit(nav.children[index], false, "file")
|
||||
break
|
||||
case FileAction.Share:
|
||||
creating_dir = false
|
||||
edit_window.edit(nav.children[index], false, "share")
|
||||
edit_window.edit(node, false, "share")
|
||||
break
|
||||
case FileAction.Branding:
|
||||
edit_window.edit(nav.children[index], false, "branding")
|
||||
break
|
||||
case FileAction.Select:
|
||||
select_node(index)
|
||||
edit_window.edit(node, false, "branding")
|
||||
break
|
||||
case FileAction.Menu:
|
||||
file_menu.open(nav.children[index], orig.target, orig)
|
||||
file_menu.open(node, orig.target, orig)
|
||||
break
|
||||
}
|
||||
}
|
||||
@@ -114,45 +107,17 @@ const delete_selected = async () => {
|
||||
try {
|
||||
loading_start()
|
||||
|
||||
// Save all promises with deletion requests in an array
|
||||
let promises: Promise<GenericResponse>[] = []
|
||||
nav.children.forEach(child => {
|
||||
if (!child.fm_selected) {
|
||||
return
|
||||
}
|
||||
promises.push(fs_trash(child.path))
|
||||
})
|
||||
|
||||
// Wait for all the promises to finish
|
||||
await Promise.all(promises)
|
||||
await Promise.all([...nav.selection.values()].map(node => fs_trash(node.path)))
|
||||
} catch (err) {
|
||||
console.log(err)
|
||||
alert("Delete failed: " + err.message + " ("+err.value+")")
|
||||
} finally {
|
||||
viewing_mode()
|
||||
nav.set_selecting(false)
|
||||
loading_finish()
|
||||
await nav.reload()
|
||||
}
|
||||
}
|
||||
|
||||
// Mode switches
|
||||
|
||||
const selecting_mode = () => {
|
||||
mode = "selecting"
|
||||
}
|
||||
const viewing_mode = () => {
|
||||
// Remove any items which we were moving
|
||||
moving_items = []
|
||||
|
||||
// Unmark all the selected files and return to viewing mode
|
||||
nav.children.forEach((child, i) => {
|
||||
if (child.fm_selected) {
|
||||
nav.children[i].fm_selected = false
|
||||
}
|
||||
})
|
||||
mode = "viewing"
|
||||
}
|
||||
|
||||
const toggle_view = () => {
|
||||
if (directory_view === "list") {
|
||||
directory_view = "gallery"
|
||||
@@ -169,14 +134,7 @@ const toggle_large_icons = () => {
|
||||
localStorage.setItem("large_icons", JSON.stringify(large_icons))
|
||||
}
|
||||
|
||||
// Moving functions
|
||||
|
||||
let moving_items: FSNode[] = []
|
||||
|
||||
// We need to detect if shift is pressed so we can select multiple items
|
||||
let shift_pressed = false
|
||||
let last_selected_node = -1
|
||||
const keypress = (e: KeyboardEvent) => {
|
||||
const keydown = (e: KeyboardEvent) => {
|
||||
if (
|
||||
(document.activeElement as any).type !== undefined &&
|
||||
(document.activeElement as any).type === "text"
|
||||
@@ -184,102 +142,32 @@ const keypress = (e: KeyboardEvent) => {
|
||||
return // Prevent shortcuts from interfering with input fields
|
||||
}
|
||||
|
||||
if (e.key === "Shift") {
|
||||
shift_pressed = e.type === "keydown"
|
||||
} else if (e.type === "keydown" && e.key === "a" && e.ctrlKey) {
|
||||
// CTRL + A selects all files
|
||||
selecting_mode()
|
||||
for (let i = 0; i < nav.children.length; i++) {
|
||||
nav.children[i].fm_selected = true
|
||||
if (e.key === "a" && e.ctrlKey) {
|
||||
// CTRL + A selects all files which are visible
|
||||
for (const child of nav.children) {
|
||||
if (show_hidden || !child.is_hidden()) {
|
||||
nav.selection.set(child.path, child)
|
||||
}
|
||||
}
|
||||
nav.set_selecting(true)
|
||||
e.preventDefault()
|
||||
} else if (e.type === "keydown" && e.key === "Escape" && (mode !== "viewing" || creating_dir)) {
|
||||
} else if (e.key === "Escape" && (nav.selecting || creating_dir)) {
|
||||
// When escape is pressed we return to viewing mode
|
||||
viewing_mode()
|
||||
nav.set_selecting(false)
|
||||
creating_dir = false
|
||||
e.preventDefault()
|
||||
e.stopPropagation()
|
||||
}
|
||||
}
|
||||
|
||||
const select_node = (index: number) => {
|
||||
mode = "selecting"
|
||||
if (shift_pressed) {
|
||||
// If shift is pressed we do a range select. We select all files between
|
||||
// the last selected file and the file that is being selected now
|
||||
let id_low = Math.min(last_selected_node, index)
|
||||
let id_high = Math.max(last_selected_node, index)
|
||||
|
||||
for (let i = id_low; i <= id_high; i++) {
|
||||
if (i != last_selected_node) {
|
||||
nav.children[i].fm_selected = !nav.children[i].fm_selected
|
||||
}
|
||||
}
|
||||
} else {
|
||||
nav.children[index].fm_selected = !nav.children[index].fm_selected
|
||||
}
|
||||
|
||||
last_selected_node = index
|
||||
}
|
||||
|
||||
// When the directory is reloaded we want to keep our selection, so this
|
||||
// function watches the children array for changes and updates the selection
|
||||
// when it changes
|
||||
// Runs every time the navigator changes
|
||||
$effect.pre(() => {
|
||||
if (!$nav.selecting) {
|
||||
moving = false
|
||||
}
|
||||
creating_dir = false
|
||||
|
||||
// Highlight the files which were previously selected
|
||||
for (let i = 0; i < $nav.children.length; i++) {
|
||||
for (let j = 0; j < moving_items.length; j++) {
|
||||
if (moving_items[j].path === $nav.children[i].path) {
|
||||
$nav.children[i].fm_selected = true
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
let moving_files = $state(0)
|
||||
let moving_directories = $state(0)
|
||||
const move_start = () => {
|
||||
moving_files = 0
|
||||
moving_directories = 0
|
||||
moving_items = nav.children.reduce((acc, child) => {
|
||||
if (child.fm_selected) {
|
||||
if (child.type === "file") {
|
||||
moving_files++
|
||||
} else if (child.type === "dir") {
|
||||
moving_directories++
|
||||
}
|
||||
acc.push(child)
|
||||
}
|
||||
return acc
|
||||
}, [])
|
||||
mode = "moving"
|
||||
}
|
||||
|
||||
const move_here = async () => {
|
||||
const target_dir = nav.base.path + "/"
|
||||
try {
|
||||
loading_start()
|
||||
|
||||
let promises = []
|
||||
moving_items.forEach(item => {
|
||||
console.log("moving", item.path, "to", target_dir + item.name)
|
||||
promises.push(fs_rename(item.path, target_dir + item.name))
|
||||
})
|
||||
|
||||
// Wait for all the promises to finish
|
||||
await Promise.all(promises)
|
||||
} catch (err) {
|
||||
console.log(err)
|
||||
alert("Move failed: " + err.message + " ("+err.value+")")
|
||||
} finally {
|
||||
viewing_mode()
|
||||
nav.reload()
|
||||
loading_finish()
|
||||
}
|
||||
}
|
||||
|
||||
// The toolbar is shown in the bar at the top of the page, under the breadcrumbs.
|
||||
// Other pages don't have it
|
||||
onMount(() => {
|
||||
@@ -289,95 +177,106 @@ onMount(() => {
|
||||
</script>
|
||||
|
||||
<svelte:window
|
||||
onkeydown={keypress}
|
||||
onkeyup={keypress}
|
||||
onkeydown={keydown}
|
||||
onscroll={() => scroll_positions.set(nav.base.path, window.scrollY)}
|
||||
/>
|
||||
|
||||
{#snippet nav_buttons()}
|
||||
<button onclick={navigate_back} use:drag_click title="Back">
|
||||
<i class="icon i_arrow_back"></i>
|
||||
</button>
|
||||
<button onclick={() => nav.navigate_up()} use:drag_click disabled={$nav.path.length <= 1} title="Up">
|
||||
<i class="icon i_north"></i>
|
||||
</button>
|
||||
<button onclick={() => nav.reload()} use:drag_click title="Refresh directory listing">
|
||||
<i class="icon i_refresh"></i>
|
||||
</button>
|
||||
{/snippet}
|
||||
|
||||
{#snippet toolbar()}
|
||||
{#if mode === "viewing"}
|
||||
{#if !$nav.selecting}
|
||||
<div class="toolbar">
|
||||
<div class="toolbar_left">
|
||||
<button onclick={() => {search_bar.open()}} title="Press / to search">
|
||||
<i class="icon">search</i>
|
||||
</button>
|
||||
<button onclick={navigate_back} title="Back">
|
||||
<i class="icon">arrow_back</i>
|
||||
</button>
|
||||
<button onclick={() => nav.navigate_up()} disabled={$nav.path.length <= 1} title="Up">
|
||||
<i class="icon">north</i>
|
||||
</button>
|
||||
<button onclick={() => nav.reload()} title="Refresh directory listing">
|
||||
<i class="icon">refresh</i>
|
||||
<button onclick={() => open_search()} title="Press / to search">
|
||||
<i class="icon i_search"></i>
|
||||
</button>
|
||||
{@render nav_buttons()}
|
||||
{#if $nav.children.some(c => c.name === ".Trash" && c.type === "dir")}
|
||||
<button
|
||||
onclick={() => nav.navigate($nav.children.find(c => c.name === ".Trash").path, true)}
|
||||
title="Open trash bin"
|
||||
>
|
||||
<i class="icon">delete</i>
|
||||
<i class="icon i_delete"></i>
|
||||
</button>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<div class="toolbar_middle">
|
||||
<button onclick={() => toggle_view()} title="Switch between gallery, list and compact view">
|
||||
<i class="icon" class:button_highlight={directory_view === "list"}>list</i>
|
||||
<i class="icon" class:button_highlight={directory_view === "gallery"}>collections</i>
|
||||
<i class="icon" class:button_highlight={directory_view === "compact"}>view_compact</i>
|
||||
<i class="icon i_list" class:button_highlight={directory_view === "list"}></i>
|
||||
<i class="icon i_collections" class:button_highlight={directory_view === "gallery"}></i>
|
||||
<i class="icon i_view_compact" class:button_highlight={directory_view === "compact"}></i>
|
||||
</button>
|
||||
|
||||
<button class="button_large_icons" onclick={() => toggle_large_icons()} title="Switch between large and small icons">
|
||||
{#if large_icons}
|
||||
<i class="icon">zoom_out</i>
|
||||
<i class="icon i_zoom_out"></i>
|
||||
{:else}
|
||||
<i class="icon">zoom_in</i>
|
||||
<i class="icon i_zoom_in"></i>
|
||||
{/if}
|
||||
</button>
|
||||
|
||||
<button onclick={() => {show_hidden = !show_hidden}} title="Toggle hidden files">
|
||||
{#if show_hidden}
|
||||
<i class="icon">visibility_off</i>
|
||||
<i class="icon i_visibility_off"></i>
|
||||
{:else}
|
||||
<i class="icon">visibility</i>
|
||||
<i class="icon i_visibility"></i>
|
||||
{/if}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="toolbar_right">
|
||||
{#if $nav.permissions.write}
|
||||
<button onclick={() => upload_widget.pick_files()} title="Upload files to this directory">
|
||||
<i class="icon">cloud_upload</i>
|
||||
<button onclick={() => pick_files()} title="Upload files to this directory">
|
||||
<i class="icon i_cloud_upload"></i>
|
||||
</button>
|
||||
|
||||
<Button click={() => {creating_dir = !creating_dir}} highlight={creating_dir} icon="create_new_folder" title="Make folder"/>
|
||||
|
||||
<button onclick={selecting_mode} title="Select and delete files">
|
||||
<i class="icon">select_all</i>
|
||||
<button onclick={() => nav.set_selecting(true)} title="Select and delete files">
|
||||
<i class="icon i_select_all"></i>
|
||||
</button>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{:else if mode === "selecting"}
|
||||
{:else}
|
||||
<div class="toolbar toolbar_edit">
|
||||
<Button click={viewing_mode} icon="close"/>
|
||||
<div class="toolbar_spacer">Selecting files</div>
|
||||
<Button click={move_start} icon="drive_file_move" label="Move"/>
|
||||
<button onclick={delete_selected} class="button_red">
|
||||
<i class="icon">delete</i>
|
||||
Delete
|
||||
</button>
|
||||
</div>
|
||||
{:else if mode === "moving"}
|
||||
<div class="toolbar toolbar_edit">
|
||||
<Button click={viewing_mode} icon="close"/>
|
||||
<Button click={() => nav.navigate_up()} disabled={$nav.path.length <= 1} icon="north"/>
|
||||
<div class="toolbar_spacer">
|
||||
Moving {moving_files} files and {moving_directories} directories
|
||||
<div>
|
||||
<Button click={() => nav.set_selecting(false)} icon="close" title="Clear selection"/>
|
||||
{@render nav_buttons()}
|
||||
</div>
|
||||
<div class="toolbar_spacer">
|
||||
{moving ? "Moving" : "Selected"} {$nav.selection.size} items
|
||||
</div>
|
||||
<div>
|
||||
{#if moving}
|
||||
<Button click={() => {creating_dir = !creating_dir}} highlight={creating_dir} icon="create_new_folder" title="Make folder"/>
|
||||
<Button
|
||||
click={() => nav.move_selection(nav.base.path)}
|
||||
disabled={!$nav.can_move($nav.base.path)}
|
||||
highlight
|
||||
icon="done"
|
||||
label="Move here"
|
||||
/>
|
||||
{:else}
|
||||
<Button click={() => {moving = true}} icon="drive_file_move" label="Move"/>
|
||||
<button onclick={delete_selected} class="button_red">
|
||||
<i class="icon i_delete"></i>
|
||||
Delete
|
||||
</button>
|
||||
{/if}
|
||||
</div>
|
||||
<Button click={() => {creating_dir = !creating_dir}} highlight={creating_dir} icon="create_new_folder" title="Make folder"/>
|
||||
<Button click={move_here} highlight icon="done" label="Move here"/>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
@@ -388,8 +287,9 @@ onMount(() => {
|
||||
|
||||
<div
|
||||
class="container"
|
||||
use:move_target={{nav, node: () => nav.base}}
|
||||
use:drop_target={{
|
||||
upload: (files) => upload_widget.upload_files(files),
|
||||
upload: files => upload_files(files),
|
||||
shadow: "var(--accent_color) 0 0 10px 2px inset",
|
||||
}}
|
||||
>
|
||||
|
||||
@@ -1,17 +1,10 @@
|
||||
export type FileEvent = {
|
||||
index: number,
|
||||
action: FileAction,
|
||||
original: MouseEvent,
|
||||
}
|
||||
export enum FileAction {
|
||||
Click,
|
||||
Context,
|
||||
Edit,
|
||||
Share,
|
||||
Branding,
|
||||
Select,
|
||||
Download,
|
||||
Menu,
|
||||
Drag,
|
||||
}
|
||||
export type FileActionHandler = (
|
||||
action: FileAction,
|
||||
|
||||
@@ -63,6 +63,9 @@ const delete_node = async () => {
|
||||
<Button click={() => {dialog.close(); bookmark_add(node)}} icon="bookmark_add" label="Add bookmark"/>
|
||||
{/if}
|
||||
{#if $nav.permissions.write}
|
||||
{#if $nav.children.includes(node)}
|
||||
<Button click={() => {dialog.close(); nav.select(node)}} icon="select_all" label="Select"/>
|
||||
{/if}
|
||||
<Button click={() => {dialog.close(); delete_node()}} icon="delete" label="Delete"/>
|
||||
{#if edit_window !== null}
|
||||
<Button click={() => {dialog.close(); edit_window.edit(node, false, "file")}} icon="edit" label="Edit"/>
|
||||
|
||||
@@ -7,33 +7,33 @@ import Modal from "util/Modal.svelte";
|
||||
import { FSNavigator, path_link } from "filesystem/FSNavigator";
|
||||
import { fs_encode_path, type FSNode } from "lib/FilesystemAPI.svelte";
|
||||
import { FileAction, type FileActionHandler } from "./FileManagerLib";
|
||||
import CreateDirectory from "./CreateDirectory.svelte";
|
||||
|
||||
let nav = $state(new FSNavigator(false))
|
||||
let modal: Modal = $state()
|
||||
let directory_view = $state("")
|
||||
let large_icons = $state(false)
|
||||
let show_hidden = $state(false)
|
||||
let creating_dir = $state(false)
|
||||
|
||||
let {
|
||||
callback,
|
||||
select_multiple = false
|
||||
select_multiple = false,
|
||||
directories = false,
|
||||
}: {
|
||||
callback: (files: FSNode[]) => void
|
||||
select_multiple?: boolean
|
||||
// Picks the directory which is open, instead of files in it
|
||||
directories?: boolean
|
||||
} = $props();
|
||||
|
||||
export const open = (path: string) => {
|
||||
creating_dir = false
|
||||
modal.show()
|
||||
nav.set_selecting(false)
|
||||
nav.navigate(path, false)
|
||||
}
|
||||
|
||||
let selected_files = $derived($nav.children.reduce((acc, file) => {
|
||||
if (file.fm_selected) {
|
||||
acc++
|
||||
}
|
||||
return acc
|
||||
}, 0))
|
||||
|
||||
// Navigation functions
|
||||
|
||||
const file_event: FileActionHandler = (action: FileAction, index: number, orig: Event) => {
|
||||
@@ -42,21 +42,17 @@ const file_event: FileActionHandler = (action: FileAction, index: number, orig:
|
||||
orig.preventDefault()
|
||||
if (nav.children[index].type === "dir") {
|
||||
nav.navigate(nav.children[index].path, true)
|
||||
} else {
|
||||
select_node(index)
|
||||
} else if (!directories) {
|
||||
select_node(index, orig)
|
||||
}
|
||||
break
|
||||
case FileAction.Context:
|
||||
// If this is a touch event we will select the item
|
||||
if (navigator.maxTouchPoints && navigator.maxTouchPoints > 0) {
|
||||
if (!directories && navigator.maxTouchPoints && navigator.maxTouchPoints > 0) {
|
||||
orig.preventDefault()
|
||||
select_node(index)
|
||||
select_node(index, orig)
|
||||
}
|
||||
break
|
||||
case FileAction.Select:
|
||||
orig.preventDefault()
|
||||
nav.children[index].fm_selected = !nav.children[index].fm_selected
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,50 +68,18 @@ const toggle_view = () => {
|
||||
localStorage.setItem("directory_view", directory_view)
|
||||
}
|
||||
|
||||
// We need to detect if shift is pressed so we can select multiple items
|
||||
let shift_pressed = false
|
||||
let last_selected_node = -1
|
||||
const detect_shift = (e: KeyboardEvent) => {
|
||||
if (e.key === "Shift") {
|
||||
shift_pressed = e.type === "keydown"
|
||||
const select_node = (index: number, e: Event) => {
|
||||
if (!select_multiple) {
|
||||
nav.selection.clear()
|
||||
}
|
||||
}
|
||||
|
||||
const select_node = (index: number) => {
|
||||
if (select_multiple && shift_pressed) {
|
||||
// If shift is pressed we do a range select. We select all files between
|
||||
// the last selected file and the file that is being selected now
|
||||
let id_low = Math.min(last_selected_node, index)
|
||||
let id_high = Math.max(last_selected_node, index)
|
||||
|
||||
for (let i = id_low; i <= id_high; i++) {
|
||||
if (i != last_selected_node) {
|
||||
nav.children[i].fm_selected = !nav.children[i].fm_selected
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Deselect all other entries first
|
||||
if (!select_multiple) {
|
||||
for (let i = 0; i < nav.children.length; i++) {
|
||||
nav.children[i].fm_selected = false
|
||||
}
|
||||
}
|
||||
nav.children[index].fm_selected = !nav.children[index].fm_selected
|
||||
}
|
||||
|
||||
last_selected_node = index
|
||||
nav.select(nav.children[index], select_multiple && (e as MouseEvent).shiftKey, show_hidden)
|
||||
}
|
||||
|
||||
let done = () => {
|
||||
let selected_files: FSNode[] = []
|
||||
for (let i = 0; i < nav.children.length; i++) {
|
||||
if (nav.children[i].fm_selected) {
|
||||
selected_files.push(nav.children[i])
|
||||
}
|
||||
}
|
||||
|
||||
if (selected_files.length > 0) {
|
||||
callback(selected_files)
|
||||
if (directories) {
|
||||
callback([nav.base])
|
||||
} else if (nav.selection.size > 0) {
|
||||
callback([...nav.selection.values()])
|
||||
}
|
||||
modal.hide()
|
||||
}
|
||||
@@ -131,41 +95,48 @@ onMount(() => {
|
||||
})
|
||||
</script>
|
||||
|
||||
<svelte:window onkeydown={detect_shift} onkeyup={detect_shift} />
|
||||
|
||||
<Modal bind:this={modal} width="900px">
|
||||
{#snippet header()}
|
||||
<div class="header" >
|
||||
<button class="button round" onclick={modal.hide}>
|
||||
<i class="icon">close</i>
|
||||
<button class="button round" onclick={modal.hide} title="Close">
|
||||
<i class="icon i_close"></i>
|
||||
</button>
|
||||
<button onclick={() => nav.navigate_up()} disabled={$nav.path.length <= 1} title="Up">
|
||||
<i class="icon">north</i>
|
||||
<i class="icon i_north"></i>
|
||||
</button>
|
||||
<button onclick={() => nav.reload()} title="Refresh directory listing">
|
||||
<i class="icon">refresh</i>
|
||||
<i class="icon i_refresh"></i>
|
||||
</button>
|
||||
|
||||
<div class="title">
|
||||
Selected {selected_files} files
|
||||
{#if directories}
|
||||
Open the directory to pick
|
||||
{:else}
|
||||
Selected {$nav.selection.size} files
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
{#if $nav.permissions.write}
|
||||
<button onclick={() => creating_dir = !creating_dir} class:button_highlight={creating_dir} title="Make folder">
|
||||
<i class="icon i_create_new_folder"></i>
|
||||
</button>
|
||||
{/if}
|
||||
<button onclick={() => {show_hidden = !show_hidden}} title="Toggle hidden files">
|
||||
{#if show_hidden}
|
||||
<i class="icon">visibility_off</i>
|
||||
<i class="icon i_visibility_off"></i>
|
||||
{:else}
|
||||
<i class="icon">visibility</i>
|
||||
<i class="icon i_visibility"></i>
|
||||
{/if}
|
||||
</button>
|
||||
|
||||
<button onclick={() => toggle_view()} title="Switch between gallery, list and compact view">
|
||||
<i class="icon" class:button_highlight={directory_view === "list"}>list</i>
|
||||
<i class="icon" class:button_highlight={directory_view === "gallery"}>collections</i>
|
||||
<i class="icon" class:button_highlight={directory_view === "compact"}>view_compact</i>
|
||||
<i class="icon i_list" class:button_highlight={directory_view === "list"}></i>
|
||||
<i class="icon i_collections" class:button_highlight={directory_view === "gallery"}></i>
|
||||
<i class="icon i_view_compact" class:button_highlight={directory_view === "compact"}></i>
|
||||
</button>
|
||||
|
||||
<button class="button button_highlight round" onclick={done}>
|
||||
<i class="icon">done</i> Pick
|
||||
<i class="icon i_done"></i> Pick
|
||||
</button>
|
||||
</div>
|
||||
{/snippet}
|
||||
@@ -177,20 +148,24 @@ onMount(() => {
|
||||
use:path_link={{nav: nav, node: node}}
|
||||
>
|
||||
{#if node.abuse_type !== undefined}
|
||||
<i class="icon small">block</i>
|
||||
<i class="icon small i_block"></i>
|
||||
{:else if node.is_shared()}
|
||||
<i class="icon small">share</i>
|
||||
<i class="icon small i_share"></i>
|
||||
{/if}
|
||||
<div class="node_name" class:base={$nav.base_index === i}>
|
||||
{node.name}
|
||||
</div>
|
||||
</a>
|
||||
{#if $nav.base_index !== i}
|
||||
<i class="icon">chevron_right</i>
|
||||
<i class="icon i_chevron_right"></i>
|
||||
{/if}
|
||||
{/each}
|
||||
|
||||
|
||||
{#if creating_dir}
|
||||
<CreateDirectory nav={nav}/>
|
||||
{/if}
|
||||
|
||||
{#if directory_view === "list"}
|
||||
<ListView
|
||||
nav={nav}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { fs_node_icon, fs_node_type, fs_encode_path } from "lib/FilesystemAPI.svelte";
|
||||
import type { FSNavigator } from "filesystem/FSNavigator";
|
||||
import { move_target, type FSNavigator } from "filesystem/FSNavigator";
|
||||
import { FileAction, type FileActionHandler } from "./FileManagerLib";
|
||||
|
||||
let {
|
||||
@@ -22,7 +22,9 @@ let {
|
||||
href={"/d"+fs_encode_path(child.path)}
|
||||
onclick={e => file_event(FileAction.Click, index, e)}
|
||||
oncontextmenu={e => file_event(FileAction.Context, index, e)}
|
||||
class:selected={child.fm_selected}
|
||||
ondragstart={e => file_event(FileAction.Drag, index, e)}
|
||||
use:move_target={{nav, node: () => child}}
|
||||
class:selected={$nav.selection.has(child.path)}
|
||||
class:hidden={child.name.startsWith(".") && !show_hidden}
|
||||
class:large_icons
|
||||
title={child.name}
|
||||
@@ -33,6 +35,7 @@ let {
|
||||
src={fs_node_icon(child, 256, 256)}
|
||||
loading="lazy"
|
||||
alt=""
|
||||
draggable="false"
|
||||
/>
|
||||
<div class="node_name">
|
||||
{child.name}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<script lang="ts">
|
||||
import { formatDataVolume, formatDate, formatThousands } from "util/Formatting";
|
||||
import { fs_encode_path, fs_node_icon } from "lib/FilesystemAPI.svelte"
|
||||
import type { FSNavigator } from "filesystem/FSNavigator";
|
||||
import { move_target, type FSNavigator } from "filesystem/FSNavigator";
|
||||
import SortButton from "layout/SortButton.svelte";
|
||||
import { FileAction, type FileActionHandler } from "./FileManagerLib";
|
||||
import Dialog from "layout/Dialog.svelte";
|
||||
@@ -15,7 +15,8 @@ let {
|
||||
show_hidden = false,
|
||||
large_icons = false,
|
||||
hide_edit = false,
|
||||
hide_branding = false
|
||||
hide_branding = false,
|
||||
trash = false
|
||||
}: {
|
||||
nav: FSNavigator
|
||||
file_event: FileActionHandler
|
||||
@@ -23,6 +24,7 @@ let {
|
||||
large_icons?: boolean
|
||||
hide_edit?: boolean
|
||||
hide_branding?: boolean
|
||||
trash?: boolean
|
||||
} = $props();
|
||||
|
||||
let dialog: Dialog = $state()
|
||||
@@ -78,6 +80,18 @@ onMount(load_settings)
|
||||
Name
|
||||
</SortButton>
|
||||
</td>
|
||||
{#if trash}
|
||||
<td class="hide_small">
|
||||
<SortButton active_field={$nav.sort_last_field} asc={$nav.sort_asc} sort_func={nav.sort_children} field="original_path">
|
||||
Original location
|
||||
</SortButton>
|
||||
</td>
|
||||
<td class="hide_small">
|
||||
<SortButton active_field={$nav.sort_last_field} asc={$nav.sort_asc} sort_func={nav.sort_children} field="deletion_date">
|
||||
Deleted on
|
||||
</SortButton>
|
||||
</td>
|
||||
{/if}
|
||||
{#each columns as col}
|
||||
<td class="hide_small" class:hidden={!config[col.field]}>
|
||||
<SortButton active_field={$nav.sort_last_field} asc={$nav.sort_asc} sort_func={nav.sort_children} field={col.field}>
|
||||
@@ -86,7 +100,7 @@ onMount(load_settings)
|
||||
</td>
|
||||
{/each}
|
||||
<td class="node_icons icons_wrap">
|
||||
<Button flat icon="settings" click={e => dialog.open(e)} />
|
||||
<Button flat icon="settings" click={e => dialog.open(e)} title="Columns"/>
|
||||
</td>
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -95,18 +109,27 @@ onMount(load_settings)
|
||||
<tr
|
||||
onclick={e => file_event(FileAction.Click, index, e)}
|
||||
oncontextmenu={e => file_event(FileAction.Context, index, e)}
|
||||
ondragstart={e => file_event(FileAction.Drag, index, e)}
|
||||
use:move_target={{nav, node: () => child}}
|
||||
draggable="true"
|
||||
class="node"
|
||||
class:node_selected={child.fm_selected}
|
||||
class:node_selected={$nav.selection.has(child.path)}
|
||||
class:hidden={child.name.startsWith(".") && !show_hidden}
|
||||
>
|
||||
<td>
|
||||
<img src={fs_node_icon(child, 64, 64)} class="node_icon" class:large_icons loading="lazy" alt="icon"/>
|
||||
<img src={fs_node_icon(child, 64, 64)} class="node_icon" class:large_icons loading="lazy" alt="icon" draggable="false"/>
|
||||
</td>
|
||||
<td class="node_name">
|
||||
<a class="title_link" href={"/d"+fs_encode_path(child.path)}>
|
||||
<td class="node_name" class:half={trash}>
|
||||
<a class="title_link" href={"/d"+fs_encode_path(child.path)} draggable="false">
|
||||
{child.name}
|
||||
</a>
|
||||
</td>
|
||||
{#if trash}
|
||||
<td class="node_name half hide_small">{child.original_path}</td>
|
||||
<td class="node_size hide_small">
|
||||
{formatDate(child.deletion_date, true, true, false)}
|
||||
</td>
|
||||
{/if}
|
||||
<td class="node_size hide_small" class:hidden={!config.modified}>
|
||||
{formatDate(child.modified, true, true, false)}
|
||||
</td>
|
||||
@@ -139,24 +162,25 @@ onMount(load_settings)
|
||||
<td class="node_icons">
|
||||
<div class="icons_wrap">
|
||||
{#if child.abuse_type !== undefined}
|
||||
<i class="icon" title="This file / directory has received an abuse report. It cannot be shared">block</i>
|
||||
<i class="icon i_block" title="This file / directory has received an abuse report. It cannot be shared"></i>
|
||||
{:else if child.is_shared()}
|
||||
<a
|
||||
href="/d/{child.id}"
|
||||
onclick={e => file_event(FileAction.Share, index, e)}
|
||||
class="button action_button"
|
||||
title="This file / directory is shared. Click to open public link"
|
||||
>
|
||||
<i class="icon" title="This file / directory is shared. Click to open public link">share</i>
|
||||
<i class="icon i_share"></i>
|
||||
</a>
|
||||
{/if}
|
||||
{#if child.properties !== undefined && child.properties.branding_enabled === "true" && !hide_branding}
|
||||
<button class="action_button" onclick={e => file_event(FileAction.Branding, index, e)}>
|
||||
<i class="icon">palette</i>
|
||||
<button class="action_button" onclick={e => file_event(FileAction.Branding, index, e)} title="Edit branding">
|
||||
<i class="icon i_palette"></i>
|
||||
</button>
|
||||
{/if}
|
||||
{#if !hide_edit}
|
||||
<button class="action_button" onclick={e => file_event(FileAction.Menu, index, e)}>
|
||||
<i class="icon">menu</i>
|
||||
<button class="action_button" onclick={e => file_event(FileAction.Menu, index, e)} title="Menu">
|
||||
<i class="icon i_menu"></i>
|
||||
</button>
|
||||
{/if}
|
||||
</div>
|
||||
@@ -176,7 +200,7 @@ onMount(load_settings)
|
||||
</div>
|
||||
{/each}
|
||||
<button type="submit">
|
||||
<i class="icon">save</i>
|
||||
<i class="icon i_save"></i>
|
||||
Save
|
||||
</button>
|
||||
</form>
|
||||
@@ -213,8 +237,8 @@ td {
|
||||
text-decoration: none;
|
||||
}
|
||||
.node.node_selected {
|
||||
background-color: var(--accent_color) !important;
|
||||
color: var(--accent_text_color);
|
||||
background-color: var(--accent_shade) !important;
|
||||
color: var(--link_color);
|
||||
}
|
||||
td {
|
||||
vertical-align: middle;
|
||||
@@ -231,9 +255,13 @@ td {
|
||||
line-height: 1.2em;
|
||||
word-break: break-all;
|
||||
}
|
||||
/* In the trash the name shares its width with the original location */
|
||||
.half {
|
||||
width: 50%;
|
||||
}
|
||||
.title_link {
|
||||
text-decoration: none;
|
||||
color: var(--body_text_color);
|
||||
color: unset;
|
||||
}
|
||||
.node_size {
|
||||
min-width: 5em;
|
||||
@@ -265,5 +293,8 @@ td {
|
||||
.hide_small {
|
||||
display: none;
|
||||
}
|
||||
.half {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,10 +1,13 @@
|
||||
<script lang="ts">
|
||||
import { formatDataVolume, formatDate } from "util/Formatting";
|
||||
import { fs_check_response, fs_encode_path, fs_get_trash, fs_node_icon, fs_path_url, type TrashEntry } from "lib/FilesystemAPI.svelte";
|
||||
import { loading_finish, loading_run, loading_start, loading_store } from "lib/Loading";
|
||||
import { formatDataVolume } from "util/Formatting";
|
||||
import { fs_check_response, fs_get_trash, fs_path_url, fs_rename, fs_trash, type FSNode } from "lib/FilesystemAPI.svelte";
|
||||
import { loading_run } from "lib/Loading";
|
||||
import { onMount } from "svelte";
|
||||
import { breadcrumbs_store } from "wrap/HeaderStore";
|
||||
import { toolbar_store } from "wrap/HeaderStore";
|
||||
import { FSNavigator } from "filesystem/FSNavigator";
|
||||
import Button from "layout/Button.svelte";
|
||||
import ListView from "./ListView.svelte";
|
||||
import { FileAction, type FileActionHandler } from "./FileManagerLib";
|
||||
|
||||
let {
|
||||
nav,
|
||||
@@ -14,214 +17,157 @@ let {
|
||||
root_path?: string
|
||||
} = $props();
|
||||
|
||||
let entries: TrashEntry[] = $state([]);
|
||||
let error: string = $state("");
|
||||
// The trash entries are not the children of the .Trash directory, so they get a
|
||||
// navigator of their own for the ListView to list and sort
|
||||
const trash = new FSNavigator(false)
|
||||
|
||||
const load = async () => {
|
||||
loading_run(async () => {
|
||||
try {
|
||||
entries = await fs_get_trash(root_path)
|
||||
error = "";
|
||||
} catch (err: any) {
|
||||
error = err?.message ?? JSON.stringify(err);
|
||||
let size = $derived($trash.children.reduce(
|
||||
(acc, node) => acc + (node.type === "dir" ? node.recursive_size : node.file_size), 0
|
||||
))
|
||||
|
||||
const load = () => loading_run(async () => {
|
||||
try {
|
||||
trash.children = await fs_get_trash(root_path)
|
||||
} catch (err: any) {
|
||||
alert("Failed to load the trash bin: " + (err.message ?? err))
|
||||
}
|
||||
trash.selecting = false
|
||||
trash.selection.clear()
|
||||
trash.sort_children("")
|
||||
})
|
||||
|
||||
const file_event: FileActionHandler = (action, index, e) => {
|
||||
if (action === FileAction.Drag) {
|
||||
return
|
||||
} else if (action === FileAction.Context) {
|
||||
// On a touch screen a long press starts selecting, like in the file
|
||||
// manager. A right click is left to the browser's own menu
|
||||
if (!navigator.maxTouchPoints) {
|
||||
return
|
||||
}
|
||||
})
|
||||
};
|
||||
trash.selecting = true
|
||||
}
|
||||
e.preventDefault()
|
||||
e.stopPropagation()
|
||||
|
||||
const delete_entry = async (entry: TrashEntry) => {
|
||||
if (!confirm(`Permanently delete "${entry.node.name}"?`)) return;
|
||||
try {
|
||||
loading_start();
|
||||
await fs_check_response(
|
||||
await fetch(fs_path_url(entry.node.path) + "?trash", { method: "DELETE" })
|
||||
);
|
||||
entries = entries.filter(e => e.node.id !== entry.node.id);
|
||||
} catch (err: any) {
|
||||
alert(err?.message ?? JSON.stringify(err));
|
||||
} finally {
|
||||
loading_finish();
|
||||
if (trash.selecting) {
|
||||
trash.select(trash.children[index], (e as MouseEvent).shiftKey)
|
||||
} else {
|
||||
nav.navigate(trash.children[index].path, true)
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
const restore_entry = async (entry: TrashEntry) => {
|
||||
if (!entry.original_path) {
|
||||
alert("Original path is not known, cannot restore this file.");
|
||||
return;
|
||||
const selected = () => [...trash.selection.values()]
|
||||
|
||||
// Runs an action on all the selected entries and reloads the listing
|
||||
const run_selected = async (action: (node: FSNode) => Promise<any>) => {
|
||||
const results = await loading_run(() => Promise.allSettled(selected().map(action)))
|
||||
const failed = results.filter(r => r.status === "rejected") as PromiseRejectedResult[]
|
||||
if (failed.length !== 0) {
|
||||
alert(
|
||||
failed.length + " of " + results.length + " failed: " +
|
||||
(failed[0].reason.message ?? failed[0].reason)
|
||||
)
|
||||
}
|
||||
try {
|
||||
loading_start();
|
||||
const form = new FormData();
|
||||
form.append("action", "rename");
|
||||
form.append("target", "/me" + entry.original_path);
|
||||
await fs_check_response(
|
||||
await fetch(fs_path_url(entry.node.path), { method: "POST", body: form })
|
||||
);
|
||||
entries = entries.filter(e => e.node.id !== entry.node.id);
|
||||
} catch (err: any) {
|
||||
alert(err?.message ?? JSON.stringify(err));
|
||||
} finally {
|
||||
loading_finish();
|
||||
await load()
|
||||
}
|
||||
|
||||
const restore = () => run_selected(async node => {
|
||||
if (!node.original_path) {
|
||||
throw new Error("the original location of " + node.name + " is not known")
|
||||
}
|
||||
};
|
||||
return fs_rename(node.path, root_path + node.original_path)
|
||||
})
|
||||
|
||||
const delete_selected = () => {
|
||||
if (confirm(`Permanently delete ${selected().length} of the items in the trash?`)) {
|
||||
run_selected(node => fs_trash(node.path))
|
||||
}
|
||||
}
|
||||
|
||||
const empty_trash = async () => {
|
||||
if (!confirm("Permanently delete all items in the trash?")) return;
|
||||
try {
|
||||
loading_start();
|
||||
await fs_check_response(
|
||||
await fetch(fs_path_url(root_path) + "?empty_trash", { method: "DELETE" })
|
||||
);
|
||||
entries = [];
|
||||
} catch (err: any) {
|
||||
alert(err?.message ?? JSON.stringify(err));
|
||||
} finally {
|
||||
loading_finish();
|
||||
if (!confirm("Permanently delete all items in the trash?")) {
|
||||
return
|
||||
}
|
||||
};
|
||||
try {
|
||||
await loading_run(async () => fs_check_response(
|
||||
await fetch(fs_path_url(root_path) + "?empty_trash", { method: "DELETE" })
|
||||
))
|
||||
} catch (err: any) {
|
||||
alert(err.message ?? err)
|
||||
}
|
||||
await load()
|
||||
}
|
||||
|
||||
onMount(() => {
|
||||
breadcrumbs_store.set(breadcrumbs)
|
||||
|
||||
toolbar_store.set(toolbar)
|
||||
load()
|
||||
});
|
||||
return () => toolbar_store.set(null)
|
||||
})
|
||||
</script>
|
||||
|
||||
|
||||
{#snippet breadcrumbs()}
|
||||
<i class="icon">delete</i>
|
||||
<div>
|
||||
Trash bin
|
||||
{#if $loading_store === 0 && entries.length === 0}
|
||||
(empty)
|
||||
{:else if entries.length !== 0}
|
||||
({formatDataVolume(entries.reduce(
|
||||
(acc, entry) => acc + entry.node.file_size, 0
|
||||
), 3)})
|
||||
{/if}
|
||||
</div>
|
||||
<div class="separator"></div>
|
||||
<button onclick={() => window.history.back()} title="Back">
|
||||
<i class="icon">arrow_back</i>
|
||||
</button>
|
||||
<button onclick={() => nav.navigate_up()} disabled={$nav.path.length <= 1} title="Up">
|
||||
<i class="icon">north</i>
|
||||
</button>
|
||||
<button onclick={() => nav.reload()} title="Refresh directory listing">
|
||||
<i class="icon">refresh</i>
|
||||
</button>
|
||||
{#if entries.length !== 0}
|
||||
<button class="button button_red" onclick={empty_trash}>
|
||||
<i class="icon">delete_forever</i>
|
||||
<span>Delete all</span>
|
||||
{#snippet toolbar()}
|
||||
{#if $trash.selecting}
|
||||
<div class="toolbar toolbar_edit">
|
||||
<Button icon="close" click={() => trash.set_selecting(false)} title="Stop selecting"/>
|
||||
<div class="toolbar_spacer">Selecting files</div>
|
||||
<Button click={restore} icon="restore_from_trash" label="Restore"/>
|
||||
<button onclick={delete_selected} class="button_red">
|
||||
<i class="icon i_delete_forever"></i>
|
||||
Delete
|
||||
</button>
|
||||
{/if}
|
||||
</div>
|
||||
{:else}
|
||||
<div class="toolbar">
|
||||
<div>
|
||||
<button onclick={() => history.back()} title="Back">
|
||||
<i class="icon i_arrow_back"></i>
|
||||
</button>
|
||||
<button onclick={() => nav.navigate_up()} title="Up">
|
||||
<i class="icon i_north"></i>
|
||||
</button>
|
||||
<button onclick={load} title="Refresh trash bin">
|
||||
<i class="icon i_refresh"></i>
|
||||
</button>
|
||||
</div>
|
||||
<div>Trash bin ({formatDataVolume(size, 3)})</div>
|
||||
<div>
|
||||
{#if $trash.children.length !== 0}
|
||||
<button onclick={() => trash.set_selecting(true)} title="Select files to restore or delete">
|
||||
<i class="icon i_select_all"></i>
|
||||
</button>
|
||||
<button onclick={empty_trash} class="button_red">
|
||||
<i class="icon i_delete_forever"></i>
|
||||
Delete all
|
||||
</button>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
{/snippet}
|
||||
|
||||
{#if error}
|
||||
<p class="error">{error}</p>
|
||||
{:else if entries.length > 0}
|
||||
<table class="trash_table">
|
||||
<thead>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>Name</td>
|
||||
<td class="hide_small">Original location</td>
|
||||
<td class="hide_small">Deleted at</td>
|
||||
<td class="hide_small">Size</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{#each entries as entry (entry.node.id)}
|
||||
<tr class="entry">
|
||||
<td class="icon_cell">
|
||||
<img
|
||||
src={fs_node_icon(entry.node, 32, 32)}
|
||||
class="node_icon"
|
||||
alt="icon"
|
||||
/>
|
||||
</td>
|
||||
<td class="name_cell">
|
||||
<a class="entry_link" href={"/d" + fs_encode_path(entry.node.path)}>
|
||||
{entry.node.name}
|
||||
</a>
|
||||
</td>
|
||||
<td class="hide_small">
|
||||
{entry.original_path ? entry.original_path.slice(0, -entry.node.name.length) : "—"}
|
||||
</td>
|
||||
<td class="hide_small">
|
||||
{entry.deletion_date ? formatDate(entry.deletion_date) : "—"}
|
||||
</td>
|
||||
<td class="hide_small">
|
||||
{#if entry.node.type === "file"}
|
||||
{formatDataVolume(entry.node.file_size, 3)}
|
||||
{/if}
|
||||
</td>
|
||||
<td>
|
||||
<div class="row_actions">
|
||||
<button title="Restore to original location" onclick={() => restore_entry(entry)}>
|
||||
<i class="icon">restore_from_trash</i>
|
||||
</button>
|
||||
<button class="button button_red" title="Delete permanently" onclick={() => delete_entry(entry)}>
|
||||
<i class="icon">delete_forever</i>
|
||||
</button>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{/each}
|
||||
</tbody>
|
||||
</table>
|
||||
{/if}
|
||||
<ListView nav={trash} file_event={file_event} show_hidden hide_edit hide_branding trash/>
|
||||
|
||||
<style>
|
||||
.separator {
|
||||
flex: 1 1 auto;
|
||||
}
|
||||
.error {
|
||||
color: var(--red_color);
|
||||
}
|
||||
.trash_table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
background: var(--body_background);
|
||||
border-radius: 8px;
|
||||
}
|
||||
.trash_table td {
|
||||
padding: 0;
|
||||
}
|
||||
.entry {
|
||||
cursor: default;
|
||||
/* Same as the toolbar of the file manager */
|
||||
.toolbar {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
flex-wrap: wrap;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
border-top: 1px solid var(--separator);
|
||||
}
|
||||
.entry:hover {
|
||||
background: var(--input_hover_background);
|
||||
}
|
||||
.icon_cell {
|
||||
width: 2.5em;
|
||||
}
|
||||
.node_icon {
|
||||
display: block;
|
||||
width: 2em;
|
||||
height: 2em;
|
||||
object-fit: contain;
|
||||
}
|
||||
.name_cell {
|
||||
word-break: break-all;
|
||||
}
|
||||
.entry_link {
|
||||
color: var(--body_text_color);
|
||||
text-decoration: none;
|
||||
}
|
||||
.entry_link:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
.row_actions {
|
||||
.toolbar > * {
|
||||
flex: 0 0 content;
|
||||
display: flex;
|
||||
gap: 0.25em;
|
||||
flex-direction: row;
|
||||
}
|
||||
@media (max-width: 600px) {
|
||||
.hide_small {
|
||||
display: none;
|
||||
}
|
||||
.toolbar_spacer {
|
||||
flex: 1 1 auto;
|
||||
text-align: center;
|
||||
}
|
||||
.toolbar_edit {
|
||||
background-color: var(--green_tint);
|
||||
}
|
||||
</style>
|
||||
@@ -1,157 +1,363 @@
|
||||
<script lang="ts" module>
|
||||
export type UploadJob = {
|
||||
task_id: number,
|
||||
file: File,
|
||||
path: string,
|
||||
component: UploadProgress,
|
||||
status: string,
|
||||
total_size: number,
|
||||
loaded_size: number,
|
||||
};
|
||||
// A file, and its path relative to the directory which it is uploaded to
|
||||
export type Upload = { file: File, path: string }
|
||||
|
||||
// The widget is mounted once, in App.svelte, so that uploads keep running when
|
||||
// the user opens another page. It sets these functions when it mounts
|
||||
export let upload_files: (files: Upload[] | Promise<Upload[]>) => void
|
||||
export let pick_files: () => void
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
import { tick } from "svelte";
|
||||
import UploadProgress from "./UploadProgress.svelte";
|
||||
import type { FSNavigator } from "filesystem/FSNavigator";
|
||||
import { global_navigator as nav } from "filesystem/FSNavigator";
|
||||
import { fs_path_url } from "lib/FilesystemAPI.svelte";
|
||||
import { loading_run } from "lib/Loading";
|
||||
import { user } from "lib/UserStore";
|
||||
import { formatDataVolume, formatDuration } from "util/Formatting";
|
||||
import ProgressBar from "util/ProgressBar.svelte";
|
||||
import Button from "layout/Button.svelte";
|
||||
|
||||
let { nav }: {
|
||||
nav: FSNavigator;
|
||||
} = $props();
|
||||
|
||||
let file_input_field: HTMLInputElement = $state()
|
||||
let file_input_change = (e: Event) => {
|
||||
// Start uploading the files async
|
||||
upload_files((e.target as HTMLInputElement).files)
|
||||
|
||||
// This resets the file input field
|
||||
file_input_field.nodeValue = ""
|
||||
}
|
||||
export const pick_files = () => {
|
||||
file_input_field.click()
|
||||
}
|
||||
|
||||
let visible = $state(false)
|
||||
let upload_queue: UploadJob[] = $state([]);
|
||||
let task_id_counter = 0
|
||||
|
||||
export const upload_files = async (files: File[]|FileList) => {
|
||||
if (files.length === 0) {
|
||||
return
|
||||
} else if (nav.base.type !== "dir") {
|
||||
alert("Can only upload to directory")
|
||||
return
|
||||
}
|
||||
|
||||
// Add files to the queue
|
||||
for (let i = 0; i < files.length; i++) {
|
||||
await upload_file(files[i])
|
||||
}
|
||||
}
|
||||
|
||||
export const upload_file = async (file: File) => {
|
||||
if (nav.base.type !== "dir") {
|
||||
alert("Can only upload to directory")
|
||||
return
|
||||
} else if (file.type === "" && file.size === 0) {
|
||||
return
|
||||
}
|
||||
|
||||
let path = nav.base.path + "/"
|
||||
if (file.webkitRelativePath) {
|
||||
path += file.webkitRelativePath
|
||||
} else {
|
||||
path += file.name
|
||||
}
|
||||
|
||||
upload_queue.push({
|
||||
task_id: task_id_counter,
|
||||
file: file,
|
||||
path: path,
|
||||
component: null,
|
||||
status: "queued",
|
||||
total_size: file.size,
|
||||
loaded_size: 0,
|
||||
})
|
||||
task_id_counter++
|
||||
|
||||
// Reassign array and wait for tick to complete. After the tick is completed
|
||||
// each upload progress bar will have bound itself to its array item
|
||||
upload_queue = upload_queue
|
||||
|
||||
if (active_uploads === 0 && status !== "uploading") {
|
||||
status = "uploading"
|
||||
visible = true
|
||||
await tick()
|
||||
await start_upload()
|
||||
}
|
||||
type Job = Upload & {
|
||||
dir: string,
|
||||
loaded: number,
|
||||
// What loaded was at the previous update, the difference gives the speed
|
||||
prev: number,
|
||||
speed: number,
|
||||
xhr?: XMLHttpRequest,
|
||||
}
|
||||
|
||||
const min_uploads = 2
|
||||
const max_uploads = 20
|
||||
// Milliseconds between two updates of the widget. The progress bars take as
|
||||
// long to move to their new position
|
||||
const update_interval = 250
|
||||
|
||||
let active_uploads = 0
|
||||
let status = $state("idle")
|
||||
// The uploads are deliberately not reactive. A dropped directory can hold
|
||||
// hundreds of thousands of files, and every running upload reports progress
|
||||
// many times per second. Every update_interval, update() copies what the
|
||||
// widget shows to view, so the cost of rendering does not depend on the size of
|
||||
// the queue
|
||||
let queue: Job[] = []
|
||||
let active: Job[] = []
|
||||
let failed: { path: string, message: string }[] = []
|
||||
let files_total = 0
|
||||
let files_done = 0
|
||||
// In bytes. Files which failed or were cancelled are taken off the total
|
||||
let size_total = 0
|
||||
let size_done = 0
|
||||
// Every byte which was sent, also for uploads which were aborted later
|
||||
let transferred = 0
|
||||
let transferred_prev = 0
|
||||
let speed = 0
|
||||
let updated = 0
|
||||
let timer = 0
|
||||
// What was transferred at each update of the last ten seconds, and how many
|
||||
// bytes the running uploads may have left to send together, see schedule()
|
||||
let samples: { time: number, sent: number }[] = []
|
||||
let threshold = 0
|
||||
// The title which the page set, and the one we replaced it with
|
||||
let page_title = ""
|
||||
let title = ""
|
||||
|
||||
const start_upload = async () => {
|
||||
active_uploads = 0
|
||||
let uploading_size = 0
|
||||
for (let i = 0; i < upload_queue.length; i++) {
|
||||
if (upload_queue[i]) {
|
||||
// If this file is queued, start the upload
|
||||
if (upload_queue[i].status === "queued") {
|
||||
upload_queue[i].component.start()
|
||||
upload_queue[i].status = "uploading"
|
||||
}
|
||||
let visible = $state(false)
|
||||
let collapsed = $state(false)
|
||||
let paused = $state(false)
|
||||
// The timer which waits to try again after the connection was lost
|
||||
let retry = $state(0)
|
||||
let view = $state.raw({
|
||||
uploading: false,
|
||||
running: 0,
|
||||
percent: 0,
|
||||
loaded: 0,
|
||||
total: 0,
|
||||
speed: 0,
|
||||
eta: "",
|
||||
files_done: 0,
|
||||
files_total: 0,
|
||||
rows: [] as { job: Job, loaded: number, speed: number, queued: boolean }[],
|
||||
failed,
|
||||
failed_count: 0,
|
||||
})
|
||||
|
||||
// If this file is already uploading (or just started), count it
|
||||
if (upload_queue[i].status === "uploading") {
|
||||
uploading_size += upload_queue[i].total_size
|
||||
active_uploads++
|
||||
}
|
||||
let file_input: HTMLInputElement
|
||||
pick_files = () => file_input.click()
|
||||
const file_input_change = () => {
|
||||
upload_files(Array.from(file_input.files, file => ({ file, path: file.name })))
|
||||
|
||||
// If the size threshold or the concurrent upload limit is reached
|
||||
// we break the loop. The system tries to keep an upload queue of
|
||||
// 100 MB and a minimum of two concurrent uploads.
|
||||
if (
|
||||
(uploading_size >= 100e6 && active_uploads >= min_uploads) ||
|
||||
active_uploads >= max_uploads
|
||||
) {
|
||||
console.debug("Current uploads", active_uploads, "uploads size", uploading_size)
|
||||
break
|
||||
}
|
||||
}
|
||||
// Without this the same file can't be picked twice in a row
|
||||
file_input.value = ""
|
||||
}
|
||||
|
||||
upload_files = async files => {
|
||||
// Reading a large directory takes a while. The files go to the directory
|
||||
// which they were dropped on, also if the user has left it by then
|
||||
const dir = nav.base.path
|
||||
try {
|
||||
files = await loading_run(async () => files)
|
||||
} catch (err) {
|
||||
alert("Failed to read the files: " + err)
|
||||
return
|
||||
}
|
||||
if (files.length === 0) {
|
||||
return
|
||||
}
|
||||
|
||||
if (active_uploads === 0) {
|
||||
status = "finished"
|
||||
nav.reload()
|
||||
if (active.length + queue.length === 0) {
|
||||
files_total = files_done = size_total = size_done = speed = 0
|
||||
timer = window.setInterval(() => {
|
||||
update()
|
||||
schedule()
|
||||
}, update_interval)
|
||||
}
|
||||
|
||||
// Empty the queue to free any references to lingering components
|
||||
upload_queue = []
|
||||
const limit = $user?.subscription.file_size_limit || 20e9
|
||||
for (const { file, path } of files) {
|
||||
if (file.size > limit) {
|
||||
failed.push({ path, message: "This file is too large. Check out " +
|
||||
"the Pro subscription to increase the file size limit" })
|
||||
continue
|
||||
}
|
||||
queue.push({ file, path, dir, loaded: 0, prev: 0, speed: 0 })
|
||||
files_total++
|
||||
size_total += file.size
|
||||
}
|
||||
|
||||
// In ten seconds we close the popup
|
||||
visible = true
|
||||
schedule()
|
||||
update()
|
||||
}
|
||||
|
||||
// Starts queued uploads until enough are running: at least two, and as many
|
||||
// as it takes to have ten seconds of work at the speed of the last ten seconds.
|
||||
// Small files are sent in large numbers at a time that way, and a slow
|
||||
// connection is not divided over more large files than it can handle. A new
|
||||
// connection starts with two uploads, and gets more as its speed shows
|
||||
const schedule = () => {
|
||||
let size = 0
|
||||
for (const job of active) {
|
||||
size += job.file.size - job.loaded
|
||||
}
|
||||
|
||||
// Empty files don't count towards the speed, a directory full of them
|
||||
// never gets over a threshold of zero. Hence the <=
|
||||
while (
|
||||
!paused && retry === 0 &&
|
||||
queue.length > 0 && active.length < max_uploads &&
|
||||
(size <= threshold || active.length < min_uploads)
|
||||
) {
|
||||
const job = queue.shift()
|
||||
size += job.file.size
|
||||
active.push(job)
|
||||
|
||||
// Takes the job off the running uploads. Without an error it's done
|
||||
const end = (error?: string) => {
|
||||
job.xhr = undefined
|
||||
active.splice(active.indexOf(job), 1)
|
||||
if (error === undefined) {
|
||||
transferred += job.file.size - job.loaded
|
||||
files_done++
|
||||
size_done += job.file.size
|
||||
} else {
|
||||
failed.push({ path: job.path, message: error })
|
||||
files_total--
|
||||
size_total -= job.file.size
|
||||
}
|
||||
schedule()
|
||||
}
|
||||
|
||||
const xhr = job.xhr = new XMLHttpRequest()
|
||||
xhr.open("PUT", fs_path_url(job.dir + "/" + job.path) + "?make_parents=true")
|
||||
xhr.upload.onprogress = e => {
|
||||
transferred += e.loaded - job.loaded
|
||||
job.loaded = e.loaded
|
||||
}
|
||||
xhr.onloadend = () => {
|
||||
if (job.xhr !== xhr) {
|
||||
return // Aborted by stop or cancel
|
||||
} else if (xhr.status >= 400) {
|
||||
// A proxy in front of the API does not answer with JSON
|
||||
let error = xhr.statusText
|
||||
try {
|
||||
error = JSON.parse(xhr.response).message
|
||||
} catch {}
|
||||
end(error)
|
||||
} else if (xhr.status !== 0) {
|
||||
end()
|
||||
} else {
|
||||
// No response, the connection is gone. The file goes back to
|
||||
// the front of the queue, and the queue waits. Without the
|
||||
// wait every file in it would fail within seconds
|
||||
job.xhr = undefined
|
||||
active.splice(active.indexOf(job), 1)
|
||||
job.loaded = job.prev = job.speed = 0
|
||||
queue.unshift(job)
|
||||
clearTimeout(retry)
|
||||
retry = window.setTimeout(() => {
|
||||
retry = 0
|
||||
schedule()
|
||||
}, 10e3)
|
||||
}
|
||||
}
|
||||
|
||||
// Firefox never ends the request for a file which was removed or
|
||||
// truncated after it was picked: there is no error, it hangs. Reading
|
||||
// the last byte of the file first shows if all of it is still there.
|
||||
// Chromium refuses to read a file which changed in any way, with a
|
||||
// NotReadableError, but does upload it. That one is not a reason to
|
||||
// give up
|
||||
job.file.slice(-1).arrayBuffer().then(
|
||||
last => last.byteLength === Math.min(1, job.file.size),
|
||||
err => err.name === "NotReadableError",
|
||||
).then(readable => {
|
||||
if (job.xhr !== xhr) {
|
||||
return
|
||||
} else if (readable) {
|
||||
xhr.send(job.file)
|
||||
} else {
|
||||
end("The file was changed or removed after it was added")
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
if (timer !== 0 && active.length + queue.length === 0) {
|
||||
clearInterval(timer)
|
||||
timer = 0
|
||||
paused = false
|
||||
update()
|
||||
|
||||
// Show the new files. The other pages don't use the navigator, there a
|
||||
// reload would put the directory in the address bar
|
||||
if (window.location.pathname.startsWith("/d/")) {
|
||||
nav.reload()
|
||||
}
|
||||
|
||||
// Errors stay until the user has closed them
|
||||
setTimeout(() => {
|
||||
if (status === "finished") {
|
||||
if (timer === 0 && failed.length === 0) {
|
||||
visible = false
|
||||
}
|
||||
}, 10000)
|
||||
} else {
|
||||
status = "uploading"
|
||||
}, 10e3)
|
||||
}
|
||||
}
|
||||
|
||||
const finish_upload = () => {
|
||||
// Update the queue so the status updates are properly rendered
|
||||
upload_queue = upload_queue
|
||||
start_upload()
|
||||
// The request is taken off the job first, that is how its loadend handler knows
|
||||
// that it was aborted on purpose
|
||||
const abort = (job: Job) => {
|
||||
const xhr = job.xhr
|
||||
job.xhr = undefined
|
||||
xhr.abort()
|
||||
}
|
||||
|
||||
// A pause only holds the queue, the uploads which are running finish
|
||||
const toggle_pause = () => {
|
||||
paused = !paused
|
||||
schedule()
|
||||
update()
|
||||
}
|
||||
|
||||
const stop = () => {
|
||||
clearTimeout(retry)
|
||||
retry = 0
|
||||
active.forEach(abort)
|
||||
active = []
|
||||
queue = []
|
||||
failed = []
|
||||
visible = false
|
||||
schedule()
|
||||
}
|
||||
|
||||
const cancel = (job: Job) => {
|
||||
const list = job.xhr === undefined ? queue : active
|
||||
const index = list.indexOf(job)
|
||||
if (index === -1) {
|
||||
return // The row is older than the job, it has finished since
|
||||
}
|
||||
if (list === active) {
|
||||
abort(job)
|
||||
}
|
||||
list.splice(index, 1)
|
||||
files_total--
|
||||
size_total -= job.file.size
|
||||
schedule()
|
||||
update()
|
||||
}
|
||||
|
||||
const update = () => {
|
||||
const now = performance.now()
|
||||
const dt = (now - updated) / 1000
|
||||
updated = now
|
||||
|
||||
// Speeds are moving averages over about the last three seconds. A sample
|
||||
// weighs as much as the time which it covers, because the timer is not
|
||||
// steady: browsers slow it down in a background tab, to once per minute even
|
||||
const weight = 1 - Math.exp(-dt / 3)
|
||||
const average = (speed: number, bytes: number) =>
|
||||
dt > 0 ? speed + (bytes / dt - speed) * weight : speed
|
||||
|
||||
speed = average(speed, transferred - transferred_prev)
|
||||
transferred_prev = transferred
|
||||
|
||||
// Ten seconds at the average speed of the last ten seconds is what was
|
||||
// sent in that time. One sample from before it stays as the start of the
|
||||
// period: in a background tab the timer runs as little as once per minute,
|
||||
// and the period would be empty. It is longer than ten seconds then, so
|
||||
// the amount is scaled back to ten
|
||||
samples.push({ time: now, sent: transferred })
|
||||
while (samples.length > 2 && now - samples[1].time >= 10e3) {
|
||||
samples.shift()
|
||||
}
|
||||
threshold = (transferred - samples[0].sent) * 10e3 /
|
||||
Math.max(10e3, now - samples[0].time)
|
||||
|
||||
let loaded = size_done
|
||||
const rows = active.map(job => {
|
||||
job.speed = average(job.speed, job.loaded - job.prev)
|
||||
job.prev = job.loaded
|
||||
loaded += job.loaded
|
||||
return { job, loaded: job.loaded, speed: job.speed, queued: false }
|
||||
})
|
||||
// The start of the queue is shown too. With only the running uploads the
|
||||
// list changes height all the time, and the widget jumps with it
|
||||
for (const job of queue.slice(0, 50)) {
|
||||
rows.push({ job, loaded: 0, speed: 0, queued: true })
|
||||
}
|
||||
|
||||
const uploading = active.length + queue.length > 0
|
||||
const percent = Math.floor(loaded / size_total * 100) || 0
|
||||
// There is no sensible estimate while nothing is being sent, nor when it
|
||||
// is over a hundred days, which is what a stalled connection gives.
|
||||
// ponytail: estimated from bytes alone, which is too low when small files
|
||||
// with their overhead per request are mixed with large ones. Weigh in the
|
||||
// files per second if that turns out to matter
|
||||
const left = (Math.floor((size_total - loaded) / speed) + 1) * 1000
|
||||
const eta = !paused && active.length > 0 && left < 100 * 86400e3
|
||||
? formatDuration(left, left < 60e3 ? 1 : 2)
|
||||
: ""
|
||||
|
||||
view = {
|
||||
uploading, percent, loaded, speed, eta, rows, files_done, files_total,
|
||||
running: active.length,
|
||||
total: size_total,
|
||||
failed: failed.slice(0, 100),
|
||||
failed_count: failed.length,
|
||||
}
|
||||
|
||||
// Pages set the title when the user navigates. A title which is not the one
|
||||
// we set is a new one, the progress goes in front of it
|
||||
if (document.title !== title) {
|
||||
page_title = document.title
|
||||
}
|
||||
document.title = !uploading ? page_title
|
||||
: (paused ? `Paused ${percent}% ` : `${percent}% ${eta}`) + "/ " + page_title
|
||||
|
||||
// The browser collapses the whitespace in a title, so what we get back
|
||||
// is not always what we set
|
||||
title = document.title
|
||||
}
|
||||
|
||||
const leave_confirmation = (e: BeforeUnloadEvent) => {
|
||||
if (status === "uploading") {
|
||||
if (active.length + queue.length > 0) {
|
||||
e.preventDefault()
|
||||
return "If you close this page your files will stop uploading. Do you want to continue?"
|
||||
} else {
|
||||
return null
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -159,33 +365,94 @@ const leave_confirmation = (e: BeforeUnloadEvent) => {
|
||||
<svelte:window onbeforeunload={leave_confirmation} />
|
||||
|
||||
<input
|
||||
bind:this={file_input_field}
|
||||
bind:this={file_input}
|
||||
onchange={file_input_change}
|
||||
class="upload_input" type="file" name="file" multiple
|
||||
/>
|
||||
|
||||
{#if visible}
|
||||
<div class="upload_widget">
|
||||
<div class="upload_widget bubble">
|
||||
<div class="header">
|
||||
{#if status === "idle"}
|
||||
Waiting for files
|
||||
{:else if status === "uploading"}
|
||||
Uploading files...
|
||||
{:else if status === "finished"}
|
||||
Done
|
||||
<div class="grow">
|
||||
<div class="ellipsis">
|
||||
{#if !view.uploading}
|
||||
Done{#if view.failed_count > 0}, {view.failed_count} failed{/if}
|
||||
{:else}
|
||||
{retry !== 0 ? "Connection lost" : paused ? "Paused" : "Uploading"}
|
||||
{view.percent}%{#if view.running > 0}, {formatDataVolume(view.speed, 3)}/s{/if}{#if view.eta !== ""}, {view.eta}left{/if}
|
||||
{/if}
|
||||
</div>
|
||||
<ProgressBar total={view.total} used={view.loaded} speed={update_interval} animation="linear"/>
|
||||
</div>
|
||||
{#if view.uploading}
|
||||
<Button
|
||||
flat
|
||||
icon={paused ? "play_arrow" : "pause"}
|
||||
title={paused
|
||||
? "Resume: start uploading the files in the queue again"
|
||||
: "Pause: finish the uploads which are running, but don't start the files in the queue"}
|
||||
click={toggle_pause}
|
||||
/>
|
||||
<Button
|
||||
flat icon="stop"
|
||||
title="Stop: abort the uploads which are running and empty the queue"
|
||||
click={stop}
|
||||
/>
|
||||
{:else}
|
||||
<Button flat icon="close" title="Close" click={stop}/>
|
||||
{/if}
|
||||
<Button
|
||||
flat
|
||||
icon={collapsed ? "expand_less" : "expand_more"}
|
||||
title={collapsed ? "Expand" : "Collapse"}
|
||||
click={() => collapsed = !collapsed}
|
||||
/>
|
||||
</div>
|
||||
<div class="body">
|
||||
{#each upload_queue as job, i}
|
||||
{#if job.status !== "finished"}
|
||||
<UploadProgress
|
||||
bind:this={upload_queue[i].component}
|
||||
bind:job={upload_queue[i]}
|
||||
finish={finish_upload}
|
||||
/>
|
||||
|
||||
{#if !collapsed}
|
||||
<div class="stats">
|
||||
{view.files_done} / {view.files_total} files,
|
||||
{formatDataVolume(view.loaded, 3)} /
|
||||
{formatDataVolume(view.total, 3)}
|
||||
{#if retry !== 0}
|
||||
<br/>
|
||||
Trying again every 10 seconds
|
||||
{/if}
|
||||
{/each}
|
||||
</div>
|
||||
</div>
|
||||
<div class="body">
|
||||
{#each view.rows as row (row.job)}
|
||||
<div class="row" class:queued={row.queued}>
|
||||
<div class="grow">
|
||||
<div class="ellipsis path" title={row.job.path}>
|
||||
<span dir="ltr">{row.job.path}</span>
|
||||
</div>
|
||||
{#if row.queued}
|
||||
{formatDataVolume(row.job.file.size, 3)}
|
||||
{:else}
|
||||
{formatDataVolume(row.loaded, 3)} /
|
||||
{formatDataVolume(row.job.file.size, 3)},
|
||||
{formatDataVolume(row.speed, 3)}/s
|
||||
<ProgressBar total={row.job.file.size} used={row.loaded} speed={update_interval} animation="linear"/>
|
||||
{/if}
|
||||
</div>
|
||||
<Button icon="cancel" title="Cancel" click={() => cancel(row.job)}/>
|
||||
</div>
|
||||
{/each}
|
||||
{#each view.failed as file}
|
||||
<div class="error">
|
||||
<div class="ellipsis path" title={file.path}>
|
||||
<span dir="ltr">{file.path}</span>
|
||||
</div>
|
||||
{file.message}
|
||||
</div>
|
||||
{/each}
|
||||
{#if view.failed_count > view.failed.length}
|
||||
<div class="error">
|
||||
And {view.failed_count - view.failed.length} more
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
@@ -200,34 +467,59 @@ const leave_confirmation = (e: BeforeUnloadEvent) => {
|
||||
position: fixed;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
width: auto;
|
||||
min-width: 400px;
|
||||
max-width: 80%;
|
||||
height: auto;
|
||||
width: 600px;
|
||||
max-width: calc(100% - 40px);
|
||||
max-height: 50%;
|
||||
right: 20px;
|
||||
bottom: 20px;
|
||||
border-radius: 8px;
|
||||
overflow: hidden;
|
||||
color: var(--body_text_color);
|
||||
box-shadow: 1px 1px 8px var(--shadow_color);
|
||||
}
|
||||
|
||||
.header {
|
||||
flex: 0 0 auto;
|
||||
background: var(--background_color);
|
||||
color: var(--background_text_color);
|
||||
text-align: center;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 0 0 0 8px;
|
||||
border-bottom: 1px solid var(--separator);
|
||||
}
|
||||
.header .ellipsis {
|
||||
font-size: 1.2em;
|
||||
padding: 4px;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
}
|
||||
.stats {
|
||||
flex: 0 0 auto;
|
||||
padding: 4px 8px;
|
||||
text-align: center;
|
||||
}
|
||||
.body {
|
||||
flex: 1 1 auto;
|
||||
background: var(--body_color);
|
||||
color: var(--body_text_color);
|
||||
overflow-y: auto;
|
||||
}
|
||||
.row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 2px 8px;
|
||||
}
|
||||
.grow {
|
||||
flex: 1 1 auto;
|
||||
min-width: 0;
|
||||
}
|
||||
.ellipsis {
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
/* A path which does not fit loses its start, the file name is the part which
|
||||
matters. Text is cut off where it overflows, which is on the left in a box
|
||||
which runs from right to left. The path inside it still runs left to right */
|
||||
.path {
|
||||
direction: rtl;
|
||||
text-align: left;
|
||||
}
|
||||
.error {
|
||||
padding: 2px 8px;
|
||||
background: var(--red_tint);
|
||||
color: var(--red_color);
|
||||
overflow-wrap: break-word;
|
||||
}
|
||||
</style>
|
||||
@@ -1,83 +0,0 @@
|
||||
// Uploads a file to the logged in user's Nova account. If no user is
|
||||
// logged in the file is uploaded anonymously.
|
||||
//
|
||||
// on_progress reports progress on the file upload, parameter 1 is the uploaded
|
||||
// file size and parameter 2 is the total file size
|
||||
//
|
||||
// on_success is called when the upload is done, the only parameter is the file
|
||||
// ID
|
||||
//
|
||||
// on_error is called when the upload has failed. The parameters are the error
|
||||
|
||||
import { fs_path_url, type GenericResponse } from "lib/FilesystemAPI.svelte"
|
||||
import { get_user } from "lib/NovaAPI"
|
||||
|
||||
// code and an error message
|
||||
export const upload_file = async (
|
||||
file: Blob,
|
||||
path: string,
|
||||
on_progress: (loaded: number, total: number) => void,
|
||||
on_success: (id: string) => void,
|
||||
on_error: (code: string, message: string) => void,
|
||||
) => {
|
||||
const user = await get_user()
|
||||
// Check the file size limit. For free accounts it's 20 GB
|
||||
if (user !== null && user.subscription.file_size_limit === 0) {
|
||||
user.subscription.file_size_limit = 20e9
|
||||
}
|
||||
|
||||
if (file.size > user.subscription.file_size_limit) {
|
||||
on_error(
|
||||
"file_too_large",
|
||||
"This file is too large. Check out the Pro subscription to increase the file size limit"
|
||||
)
|
||||
return
|
||||
}
|
||||
|
||||
console.debug("Uploading file to", fs_path_url(path))
|
||||
|
||||
let xhr = new XMLHttpRequest();
|
||||
xhr.open("PUT", fs_path_url(path) + "?make_parents=true", true);
|
||||
xhr.timeout = 86400000; // 24 hours, to account for slow connections
|
||||
|
||||
xhr.upload.addEventListener("progress", evt => {
|
||||
if (on_progress && evt.lengthComputable) {
|
||||
on_progress(evt.loaded, evt.total)
|
||||
}
|
||||
});
|
||||
|
||||
xhr.onreadystatechange = () => {
|
||||
// readystate 4 means the upload is done
|
||||
if (xhr.readyState !== 4) {
|
||||
return
|
||||
}
|
||||
|
||||
if (xhr.status >= 100 && xhr.status < 400) {
|
||||
// Request is a success
|
||||
on_success(JSON.parse(xhr.response).id)
|
||||
} else if (xhr.status >= 400) {
|
||||
// Request failed
|
||||
console.log("Upload error. status: " + xhr.status + " response: " + xhr.response);
|
||||
|
||||
let resp: GenericResponse
|
||||
if (xhr.status === 429) {
|
||||
resp = {
|
||||
value: "too_many_requests",
|
||||
message: "Too many requests. Please wait a few seconds",
|
||||
}
|
||||
} else {
|
||||
resp = JSON.parse(xhr.response) as GenericResponse
|
||||
}
|
||||
|
||||
on_error(resp.value, resp.message)
|
||||
} else if (xhr.status === 0) {
|
||||
on_error("request_failed", "Your request did not arrive, check your network connection")
|
||||
} else {
|
||||
on_error(xhr.responseText, xhr.responseText)
|
||||
}
|
||||
};
|
||||
|
||||
xhr.send(file);
|
||||
|
||||
return xhr
|
||||
}
|
||||
@@ -1,105 +0,0 @@
|
||||
<script lang="ts">
|
||||
import { upload_file } from "./UploadFunc";
|
||||
import ProgressBar from "util/ProgressBar.svelte";
|
||||
import Button from "layout/Button.svelte"
|
||||
import type { UploadJob } from "./FSUploadWidget.svelte";
|
||||
|
||||
let {
|
||||
job = $bindable(),
|
||||
total = $bindable(0),
|
||||
loaded = $bindable(0),
|
||||
finish,
|
||||
}: {
|
||||
job: UploadJob
|
||||
total?: number
|
||||
loaded?: number
|
||||
finish: () => void
|
||||
} = $props();
|
||||
|
||||
let error_code = $state("")
|
||||
let error_message = $state("")
|
||||
let xhr: XMLHttpRequest = null
|
||||
|
||||
export const start = () => {
|
||||
upload_file(
|
||||
job.file,
|
||||
job.path,
|
||||
(prog_loaded, prog_total) => {
|
||||
loaded = prog_loaded
|
||||
total = prog_total
|
||||
},
|
||||
async () => {
|
||||
job.status = "finished"
|
||||
finish()
|
||||
},
|
||||
(code, message) => {
|
||||
if (job.status === "finished") {
|
||||
return
|
||||
}
|
||||
|
||||
console.log("Upload error", code, message)
|
||||
error_code = code
|
||||
error_message = message
|
||||
job.status = "error"
|
||||
|
||||
// We don't send the finished signal so the user can read the error
|
||||
// messsage and manually dismiss it through the cancel button
|
||||
},
|
||||
).then(result => {
|
||||
xhr = result
|
||||
job.status = "uploading"
|
||||
})
|
||||
}
|
||||
|
||||
const cancel = () => {
|
||||
job.status = "finished"
|
||||
|
||||
if (xhr && xhr.abort) {
|
||||
xhr.abort()
|
||||
}
|
||||
|
||||
xhr = null
|
||||
finish()
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="prog" class:error={job.status === "error"}>
|
||||
<div class="bar">
|
||||
{job.file.name}<br/>
|
||||
{#if error_code !== ""}
|
||||
{error_message}<br/>
|
||||
{error_code}<br/>
|
||||
{/if}
|
||||
<ProgressBar total={total} used={loaded} speed={500}/>
|
||||
</div>
|
||||
<div class="cancel">
|
||||
<Button icon="cancel" click={cancel}/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.prog {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
width: 100%;
|
||||
overflow: hidden;
|
||||
}
|
||||
.bar {
|
||||
flex: 1 1 auto;
|
||||
padding: 2px 4px 1px 4px;
|
||||
margin: 4px;
|
||||
border-radius: 4px;
|
||||
overflow: hidden;
|
||||
line-break: anywhere;
|
||||
}
|
||||
.cancel {
|
||||
flex: 0 0 content;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center; /* Stop stretching the button */
|
||||
}
|
||||
.error {
|
||||
background: var(--red_tint);
|
||||
color: var(--red_color);
|
||||
}
|
||||
</style>
|
||||
@@ -128,17 +128,17 @@ onMount(() => {
|
||||
<track kind="captions"/>
|
||||
</audio>
|
||||
<div style="text-align: center;">
|
||||
<button onclick={() => change_track(-1)}><i class="icon">skip_previous</i></button>
|
||||
<button onclick={() => seek(-10)}><i class="icon">replay_10</i></button>
|
||||
<button onclick={toggle_playback}>
|
||||
<button onclick={() => change_track(-1)} title="Previous track"><i class="icon i_skip_previous"></i></button>
|
||||
<button onclick={() => seek(-10)} title="Back 10 seconds"><i class="icon i_replay_10"></i></button>
|
||||
<button onclick={toggle_playback} title={playing ? "Pause" : "Play"}>
|
||||
{#if playing}
|
||||
<i class="icon">pause</i>
|
||||
<i class="icon i_pause"></i>
|
||||
{:else}
|
||||
<i class="icon">play_arrow</i>
|
||||
<i class="icon i_play_arrow"></i>
|
||||
{/if}
|
||||
</button>
|
||||
<button onclick={() => seek(10)}><i class="icon">forward_10</i></button>
|
||||
<button onclick={() => change_track(1)}><i class="icon">skip_next</i></button>
|
||||
<button onclick={() => seek(10)} title="Forward 10 seconds"><i class="icon i_forward_10"></i></button>
|
||||
<button onclick={() => change_track(1)} title="Next track"><i class="icon i_skip_next"></i></button>
|
||||
</div>
|
||||
|
||||
<h2>Tracklist</h2>
|
||||
@@ -146,7 +146,7 @@ onMount(() => {
|
||||
{#if !sibling.is_hidden()}
|
||||
<a href={"/d"+fs_encode_path(sibling.path)} class="node" class:button_highlight={sibling.path === $nav.base.path}>
|
||||
{#if sibling.path === $nav.base.path}
|
||||
<i class="play_arrow icon">play_arrow</i>
|
||||
<i class="play_arrow icon i_play_arrow"></i>
|
||||
{:else}
|
||||
<img src={fs_node_icon(sibling, 64, 64)} class="node_icon" alt="icon"/>
|
||||
{/if}
|
||||
|
||||
@@ -1,14 +1,11 @@
|
||||
<script lang="ts">
|
||||
import type { FSNode } from 'lib/FilesystemAPI.svelte';
|
||||
import { run } from 'svelte/legacy';
|
||||
|
||||
let { path = [] }: {path: FSNode[]} = $props();
|
||||
|
||||
let image_uri: string = $state()
|
||||
let image_link: string = $state()
|
||||
const update_links = (path: FSNode[]) => {
|
||||
image_uri = null
|
||||
image_link = null
|
||||
let { image_uri, image_link } = $derived.by(() => {
|
||||
let image_uri: string = null
|
||||
let image_link: string = null
|
||||
for (let node of path) {
|
||||
if (node.properties && node.properties.branding_enabled === "true") {
|
||||
if (node.properties.brand_header_image) {
|
||||
@@ -19,10 +16,8 @@ const update_links = (path: FSNode[]) => {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
run(() => {
|
||||
update_links(path)
|
||||
});
|
||||
return { image_uri, image_link }
|
||||
})
|
||||
</script>
|
||||
|
||||
{#if image_uri}
|
||||
|
||||
@@ -37,11 +37,11 @@ let {
|
||||
</table>
|
||||
<hr/>
|
||||
<button class="button_highlight" onclick={() => node.download()}>
|
||||
<i class="icon">download</i>
|
||||
<i class="icon i_download"></i>
|
||||
<span>Download</span>
|
||||
</button>
|
||||
<button onclick={() => open_details()}>
|
||||
<i class="icon">help</i>
|
||||
<i class="icon i_help"></i>
|
||||
<span>Details</span>
|
||||
</button>
|
||||
</IconBlock>
|
||||
|
||||
@@ -14,23 +14,17 @@ import Torrent from "./Torrent.svelte";
|
||||
import Zip from "./Zip.svelte";
|
||||
import CustomBanner from "./CustomBanner.svelte";
|
||||
import type { FSNavigator } from "filesystem/FSNavigator";
|
||||
import FsUploadWidget from "filesystem/upload_widget/FSUploadWidget.svelte";
|
||||
import EditWindow from "filesystem/edit_window/EditWindow.svelte";
|
||||
import DetailsWindow from "filesystem/DetailsWindow.svelte";
|
||||
import SearchBar from "filesystem/SearchBar.svelte";
|
||||
|
||||
let {
|
||||
nav,
|
||||
upload_widget,
|
||||
edit_window,
|
||||
details_window,
|
||||
search_bar,
|
||||
}: {
|
||||
nav: FSNavigator
|
||||
upload_widget: FsUploadWidget
|
||||
edit_window: EditWindow
|
||||
details_window: DetailsWindow
|
||||
search_bar: SearchBar
|
||||
} = $props();
|
||||
|
||||
let viewer: any = $state()
|
||||
@@ -92,7 +86,7 @@ export const seek = (delta: number) => {
|
||||
{:else if viewer_type === "dir" && $nav.base.name === ".Trash"}
|
||||
<TrashBin nav={nav} root_path={$nav.path[$nav.path.length - 2].path}/>
|
||||
{:else if viewer_type === "dir"}
|
||||
<FileManager nav={nav} upload_widget={upload_widget} edit_window={edit_window} search_bar={search_bar}>
|
||||
<FileManager nav={nav} edit_window={edit_window}>
|
||||
<CustomBanner path={$nav.path}/>
|
||||
</FileManager>
|
||||
{:else if viewer_type === "audio"}
|
||||
|
||||
@@ -52,14 +52,12 @@ export const update = async () => {
|
||||
// Figure out if there are previous or next files. If not then we disable
|
||||
// swiping controls in that direction
|
||||
const siblings = await nav.get_siblings()
|
||||
for (let i = 0; i < siblings.length; i++) {
|
||||
if (siblings[i].name === nav.base.name) {
|
||||
swipe_prev = i > 0
|
||||
swipe_next = i < siblings.length-1
|
||||
preload(siblings[i-1])
|
||||
preload(siblings[i+1])
|
||||
break
|
||||
}
|
||||
const i = siblings.findIndex(s => s.name === nav.base.name)
|
||||
swipe_prev = i > 0
|
||||
swipe_next = i !== -1 && i < siblings.length-1
|
||||
if (i !== -1) {
|
||||
preload(siblings[i-1])
|
||||
preload(siblings[i+1])
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -96,7 +96,7 @@ let magnet = $state("")
|
||||
</p>
|
||||
{/if}
|
||||
<button onclick={() => node.download()} class="button">
|
||||
<i class="icon">download</i>
|
||||
<i class="icon i_download"></i>
|
||||
<span>Download torrent file</span>
|
||||
</button>
|
||||
</IconBlock>
|
||||
|
||||
@@ -118,35 +118,35 @@ const video_keydown = (e: KeyboardEvent) => {
|
||||
|
||||
<div class="controls">
|
||||
<div class="spacer"></div>
|
||||
<button onclick={() => open_sibling(-1)}>
|
||||
<i class="icon">skip_previous</i>
|
||||
<button onclick={() => open_sibling(-1)} title="Previous file">
|
||||
<i class="icon i_skip_previous"></i>
|
||||
</button>
|
||||
<button onclick={() => seek(-10)}>
|
||||
<i class="icon">replay_10</i>
|
||||
<button onclick={() => seek(-10)} title="Back 10 seconds">
|
||||
<i class="icon i_replay_10"></i>
|
||||
</button>
|
||||
<button onclick={toggle_playback} class="button_highlight">
|
||||
<button onclick={toggle_playback} class="button_highlight" title={playing ? "Pause" : "Play"}>
|
||||
{#if playing}
|
||||
<i class="icon">pause</i>
|
||||
<i class="icon i_pause"></i>
|
||||
{:else}
|
||||
<i class="icon">play_arrow</i>
|
||||
<i class="icon i_play_arrow"></i>
|
||||
{/if}
|
||||
</button>
|
||||
<button onclick={() => seek(10)}>
|
||||
<i class="icon">forward_10</i>
|
||||
<button onclick={() => seek(10)} title="Forward 10 seconds">
|
||||
<i class="icon i_forward_10"></i>
|
||||
</button>
|
||||
<button onclick={() => open_sibling(1)}>
|
||||
<i class="icon">skip_next</i>
|
||||
<button onclick={() => open_sibling(1)} title="Next file">
|
||||
<i class="icon i_skip_next"></i>
|
||||
</button>
|
||||
<div style="width: 16px; height: 8px;"></div>
|
||||
<button onclick={toggle_mute} class:button_red={player && player.muted}>
|
||||
<button onclick={toggle_mute} class:button_red={player && player.muted} title="Mute">
|
||||
{#if player && player.muted}
|
||||
<i class="icon">volume_off</i>
|
||||
<i class="icon i_volume_off"></i>
|
||||
{:else}
|
||||
<i class="icon">volume_up</i>
|
||||
<i class="icon i_volume_up"></i>
|
||||
{/if}
|
||||
</button>
|
||||
<button onclick={toggle_fullscreen}>
|
||||
<i class="icon">fullscreen</i>
|
||||
<button onclick={toggle_fullscreen} title="Fullscreen">
|
||||
<i class="icon i_fullscreen"></i>
|
||||
</button>
|
||||
<div class="spacer"></div>
|
||||
</div>
|
||||
|
||||
@@ -48,19 +48,22 @@ export const update = async () => {
|
||||
return
|
||||
}
|
||||
|
||||
zip = await resp.json() as ZipEntry
|
||||
const z = await resp.json() as ZipEntry
|
||||
|
||||
// Check if the zip has the property which allows separate files to be
|
||||
// downloaded. If so then we set the download URL for each file
|
||||
if (zip.properties !== undefined) {
|
||||
if (zip.properties.includes("read_individual_files")) {
|
||||
// downloaded. If so then we set the download URL for each file. This
|
||||
// happens before the zip becomes state, else every file in the archive
|
||||
// would get a state proxy instead of only the ones which are rendered
|
||||
if (z.properties !== undefined) {
|
||||
if (z.properties.includes("read_individual_files")) {
|
||||
// Set the download URL for each file in the zip
|
||||
recursive_set_url(fs_path_url(node.path)+"?zip_file=", zip)
|
||||
recursive_set_url(fs_path_url(node.path)+"?zip_file=", z)
|
||||
}
|
||||
truncated = zip.properties.includes("truncated")
|
||||
truncated = z.properties.includes("truncated")
|
||||
}
|
||||
|
||||
uncomp_size = recursive_size(zip)
|
||||
uncomp_size = recursive_size(z)
|
||||
zip = z
|
||||
comp_ratio = (uncomp_size / node.file_size)
|
||||
status = "finished"
|
||||
} catch (err) {
|
||||
@@ -125,7 +128,7 @@ const recursive_size = (file: ZipEntry) => {
|
||||
</table>
|
||||
<hr/>
|
||||
<button class="button_highlight" onclick={() => node.download()}>
|
||||
<i class="icon">download</i>
|
||||
<i class="icon i_download"></i>
|
||||
<span>Download</span>
|
||||
</button>
|
||||
</IconBlock>
|
||||
|
||||
@@ -13,6 +13,7 @@ let { item = {} as ZipEntry }: {
|
||||
{#if child.children}
|
||||
<details bind:open={child.details_open}>
|
||||
<summary>
|
||||
<i class="icon {child.details_open ? 'i_folder_open' : 'i_folder'}"></i>
|
||||
<div class="filename">
|
||||
{name}
|
||||
(
|
||||
@@ -37,6 +38,7 @@ let { item = {} as ZipEntry }: {
|
||||
{#each Object.entries(item.children) as [name, child]}
|
||||
{#if !child.children}
|
||||
<li>
|
||||
<i class="icon i_description"></i>
|
||||
<div class="filename">
|
||||
{name}
|
||||
(
|
||||
@@ -59,19 +61,13 @@ details {
|
||||
}
|
||||
details > summary {
|
||||
list-style-type: none;
|
||||
}
|
||||
details > summary, li {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
details > summary::before {
|
||||
font-family: 'Material Icons';
|
||||
content: 'folder';
|
||||
}
|
||||
details[open] > summary::before {
|
||||
font-family: 'Material Icons';
|
||||
content: 'folder_open';
|
||||
}
|
||||
li::before {
|
||||
font-family: 'Material Icons';
|
||||
content: 'description';
|
||||
.icon {
|
||||
font-size: 1em;
|
||||
}
|
||||
ul {
|
||||
list-style-type: none;
|
||||
@@ -80,7 +76,6 @@ ul {
|
||||
border-left: 2px solid var(--separator);
|
||||
}
|
||||
.filename {
|
||||
display: inline;
|
||||
margin-left: 0.5em;
|
||||
}
|
||||
</style>
|
||||
@@ -1,353 +0,0 @@
|
||||
<script>
|
||||
import Tooltip from "layout/Tooltip.svelte";
|
||||
import Euro from "util/Euro.svelte";
|
||||
import OtherPlans from "layout/checkout/SubscriptionPlans.svelte";
|
||||
import { user } from "lib/UserStore";
|
||||
</script>
|
||||
|
||||
<section>
|
||||
<p>
|
||||
Nova features two different payment modes. We offer a monthly
|
||||
subscription which is managed by Patreon, and a Prepaid subscription
|
||||
which supports a dozen different payment providers. With Prepaid you pay
|
||||
in advance to charge your credit, then usage will be subtracted from
|
||||
your account credit. For low usage Prepaid is usually better as the
|
||||
monthly fee is much lower.
|
||||
</p>
|
||||
</section>
|
||||
|
||||
<div class="horizontal_scroll">
|
||||
<div class="grid">
|
||||
<div></div>
|
||||
<div class="top_row free_feat">
|
||||
<span class="bold">Free</span>
|
||||
</div>
|
||||
<div class="top_row pro_feat">
|
||||
<span class="bold">Pro</span>
|
||||
</div>
|
||||
<div class="top_row prepaid_feat">
|
||||
<span class="bold">Prepaid</span>
|
||||
</div>
|
||||
|
||||
<div class="left_col">
|
||||
Recurring price
|
||||
</div>
|
||||
<div class="feature_cell free_feat">
|
||||
<span class="bold">None</span>
|
||||
</div>
|
||||
<div class="feature_cell pro_feat">
|
||||
<Tooltip>
|
||||
{#snippet label()}
|
||||
<span>
|
||||
<span class="bold">€4 / month</span> or
|
||||
<span class="bold">€40 / year</span>
|
||||
</span>
|
||||
{/snippet}
|
||||
The Pro subscription is managed by Patreon. Patreon's own fees
|
||||
and sales tax will be added to this price. After paying you need
|
||||
to link your Nova account to Patreon to activate the plan.
|
||||
</Tooltip>
|
||||
</div>
|
||||
<div class="feature_cell prepaid_feat">
|
||||
<Tooltip>
|
||||
{#snippet label()}
|
||||
<span class="bold">€1 / month minimum</span>
|
||||
{/snippet}
|
||||
<p>
|
||||
The minimum fee is only charged when usage is less than €1.
|
||||
This calculation is per day, the €1 amount is divided by the
|
||||
number of days in the month and if your usage is lower than
|
||||
that, you will be charged the minimum fee.
|
||||
</p>
|
||||
</Tooltip>
|
||||
</div>
|
||||
|
||||
<div class="left_col">
|
||||
<a href="/about#toc_3">Transfer limit</a>
|
||||
</div>
|
||||
<div class="feature_cell free_feat">
|
||||
<Tooltip>
|
||||
{#snippet label()}
|
||||
<span class="bold">6 GB per day</span>
|
||||
{/snippet}
|
||||
<p>
|
||||
Free users are limited to downloading 6 GB per day, this
|
||||
limit is linked to your IP address, even if you are logged
|
||||
in to an account.
|
||||
</p>
|
||||
<p>
|
||||
When the download limit is exceeded the download speed is
|
||||
reduced to 1 MiB/s. You can have at most three concurrent
|
||||
downloads running.
|
||||
</p>
|
||||
</Tooltip>
|
||||
</div>
|
||||
<div class="feature_cell pro_feat">
|
||||
<Tooltip>
|
||||
{#snippet label()}
|
||||
<span class="bold">4 TB per 30 days</span>
|
||||
{/snippet}
|
||||
<p>
|
||||
The transfer limit is used for downloading, sharing and
|
||||
hotlinking files.
|
||||
</p>
|
||||
<p>
|
||||
Paid plans do not have a concurrent connection limit.
|
||||
</p>
|
||||
</Tooltip>
|
||||
</div>
|
||||
<div class="feature_cell prepaid_feat">
|
||||
<Tooltip>
|
||||
{#snippet label()}
|
||||
<span class="bold">€1 per TB transferred</span>
|
||||
{/snippet}
|
||||
<p>
|
||||
Prepaid does not have a transfer limit, instead you are
|
||||
charged for what you use at a rate of €1 per terabyte
|
||||
downloaded. This applies to downloading your own files,
|
||||
other people's files and others downloading your files (if
|
||||
you have hotlinking enabled in your account settings).
|
||||
</p>
|
||||
<p>
|
||||
Paid plans do not have a concurrent connection limit.
|
||||
</p>
|
||||
</Tooltip>
|
||||
</div>
|
||||
|
||||
<div class="left_col">
|
||||
<a href="/about#toc_6">Hotlinking</a>
|
||||
</div>
|
||||
<div class="feature_cell free_feat">
|
||||
<span class="bold">Hotlinking not supported</span><br/>
|
||||
Hotlinked files get blocked
|
||||
</div>
|
||||
<div class="feature_cell span2 right pro_feat">
|
||||
<span class="bold">Hotlinking supported</span><br/>
|
||||
Hotlinking uses your transfer limit
|
||||
</div>
|
||||
|
||||
<div class="left_col">
|
||||
Storage
|
||||
</div>
|
||||
<div class="feature_cell span2 left pro_feat">
|
||||
<span class="bold">No limit</span><br/>
|
||||
Files expire when they are not downloaded
|
||||
</div>
|
||||
<div class="feature_cell prepaid_feat">
|
||||
<span class="bold">€4 / TB / month</span><br/>
|
||||
No limit, you pay for what you use
|
||||
</div>
|
||||
|
||||
<div class="left_col">
|
||||
<a href="/about#toc_1">File expiry</a>
|
||||
</div>
|
||||
<div class="feature_cell free_feat">
|
||||
<Tooltip>
|
||||
{#snippet label()}
|
||||
<span class="bold">120 days (4 months)</span>
|
||||
{/snippet}
|
||||
<p>
|
||||
Files expire when they have not been downloaded in the last
|
||||
120 days. A download is counted when more than 10% of the
|
||||
whole file was downloaded in a single request.
|
||||
</p>
|
||||
</Tooltip>
|
||||
</div>
|
||||
<div class="feature_cell pro_feat">
|
||||
<Tooltip>
|
||||
{#snippet label()}
|
||||
<span class="bold">240 days (8 months)</span>
|
||||
{/snippet}
|
||||
<p>
|
||||
The Pro plan has 240 day file expiry. The same rules apply
|
||||
as the free plan. Higher Patreon subscription plans are
|
||||
available where files do not expire at all.
|
||||
</p>
|
||||
</Tooltip>
|
||||
</div>
|
||||
<div class="feature_cell prepaid_feat">
|
||||
<Tooltip>
|
||||
{#snippet label()}
|
||||
<span class="bold">Files do not expire</span>
|
||||
{/snippet}
|
||||
<p>
|
||||
Files don't expire while your Prepaid plan is active. If
|
||||
your credit runs out you have one week to top up your
|
||||
balance. If you fail to do so your files will revert to the
|
||||
regular file expiry rules.
|
||||
</p>
|
||||
</Tooltip>
|
||||
</div>
|
||||
|
||||
<div class="left_col">
|
||||
Download page customization
|
||||
</div>
|
||||
<div class="feature_cell free_feat">
|
||||
<span class="bold">None</span>
|
||||
</div>
|
||||
<div class="feature_cell pro_feat">
|
||||
None
|
||||
</div>
|
||||
<div class="feature_cell prepaid_feat">
|
||||
Theme, background, header and footer image can be customized
|
||||
</div>
|
||||
|
||||
<div class="left_col">
|
||||
Max file size
|
||||
</div>
|
||||
<div class="feature_cell free_feat">
|
||||
<span class="bold">20 GB</span> per file
|
||||
</div>
|
||||
<div class="feature_cell span2 right pro_feat">
|
||||
<span class="bold">100 GB</span> per file
|
||||
</div>
|
||||
|
||||
<div class="left_col">
|
||||
Payment processors
|
||||
</div>
|
||||
<div class="feature_cell free_feat">
|
||||
<span class="bold">None</span>
|
||||
</div>
|
||||
<div class="feature_cell pro_feat">
|
||||
<span class="bold">PayPal</span>, <span class="bold">Credit/debit</span>
|
||||
</div>
|
||||
<div class="feature_cell prepaid_feat">
|
||||
<span class="bold">PayPal</span>,
|
||||
<span class="bold">Bitcoin</span>,
|
||||
<span class="bold">Litecoin</span>,
|
||||
<span class="bold">Monero</span>
|
||||
</div>
|
||||
|
||||
<div></div>
|
||||
<div class="bottom_row free_feat">
|
||||
Free
|
||||
</div>
|
||||
<div class="bottom_row pro_feat">
|
||||
{#if $user !== null && $user.subscription.id === "patreon_1"}
|
||||
You have this plan<br/>
|
||||
Thank you for supporting Nova!
|
||||
{:else}
|
||||
<a href="https://www.patreon.com/join/nova/checkout?rid=5736701&cadence=1" class="button button_highlight round">
|
||||
€ 4 per month
|
||||
</a>
|
||||
or
|
||||
<a href="https://www.patreon.com/join/nova/checkout?rid=5736701&cadence=12" class="button button_highlight round">
|
||||
€ 40 per year!
|
||||
</a>
|
||||
<br/>
|
||||
(Excluding tax)
|
||||
<br/>
|
||||
Subscription managed by Patreon
|
||||
{/if}
|
||||
</div>
|
||||
<div class="bottom_row prepaid_feat">
|
||||
{#if $user === null}
|
||||
<!-- User is not logged in -->
|
||||
Account required<br/>
|
||||
<a href="/login?redirect=/user/subscription/manage" class="button button_highlight round">
|
||||
<i class="icon">login</i>
|
||||
Log in
|
||||
</a>
|
||||
or
|
||||
<a href="/register?redirect=/user/subscription/manage" class="button button_highlight round">
|
||||
<i class="icon">how_to_reg</i>
|
||||
Register
|
||||
</a>
|
||||
<br/>
|
||||
Payments processed by Mollie<br/>
|
||||
No recurring payments
|
||||
{:else}
|
||||
<!-- User is logged in -->
|
||||
{#if $user.subscription.type === ""}
|
||||
<a href="/user/subscription/manage#deposit" class="button button_highlight round">
|
||||
Deposit credit
|
||||
</a>
|
||||
to activate Prepaid
|
||||
{:else if $user.subscription.type === "patreon"}
|
||||
Patreon subscription active. Prepaid cannot be activated
|
||||
{:else if $user.subscription.type === "prepaid"}
|
||||
Prepaid subscription is active<br/>
|
||||
Current balance <Euro amount={$user.balance_micro_eur}/>
|
||||
<br/>
|
||||
<a href="/user/subscription/manage#deposit" class="button button_highlight round">
|
||||
Top up my credit
|
||||
</a>
|
||||
{/if}
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<section>
|
||||
<h2>Other plans available on Patreon</h2>
|
||||
<OtherPlans/>
|
||||
</section>
|
||||
|
||||
<style>
|
||||
.bold {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.horizontal_scroll {
|
||||
overflow-x: scroll;
|
||||
overflow-y: hidden;
|
||||
width: 100%;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
.grid {
|
||||
display: grid;
|
||||
grid-auto-flow: row;
|
||||
grid-template-columns: 9em 1fr 1fr 1fr;
|
||||
min-width: 50em;
|
||||
max-width: 70em;
|
||||
gap: 5px;
|
||||
margin: auto;
|
||||
}
|
||||
.grid > div {
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
align-content: center;
|
||||
text-align: center;
|
||||
padding: 0.25em;
|
||||
min-height: 3em;
|
||||
}
|
||||
|
||||
.left_col {
|
||||
border-top-left-radius: 6px;
|
||||
border-bottom-left-radius: 6px;
|
||||
border: 1px solid var(--separator);
|
||||
}
|
||||
.top_row {
|
||||
border-top-left-radius: 6px;
|
||||
border-top-right-radius: 6px;
|
||||
}
|
||||
.bottom_row {
|
||||
border-bottom-left-radius: 6px;
|
||||
border-bottom-right-radius: 6px;
|
||||
border: 1px solid var(--separator);
|
||||
font-weight: bold;
|
||||
}
|
||||
.feature_cell {
|
||||
background-color: var(--card_color);
|
||||
border: 1px solid var(--background_color);
|
||||
}
|
||||
.pro_feat {
|
||||
border: 1px solid var(--accent_color);
|
||||
}
|
||||
.free_feat {
|
||||
border: 1px solid #ebcb8b;
|
||||
}
|
||||
.prepaid_feat {
|
||||
border: 1px solid #ec2cfa;
|
||||
}
|
||||
.span2 {
|
||||
grid-column: span 2;
|
||||
}
|
||||
.span2.left {
|
||||
border-image: linear-gradient(to right, #ebcb8b 0%, var(--accent_color) 100%) 1;
|
||||
}
|
||||
.span2.right {
|
||||
border-image: linear-gradient(to right, var(--accent_color) 0%, #ec2cfa 100%) 1;
|
||||
}
|
||||
</style>
|
||||
@@ -1,30 +0,0 @@
|
||||
<script lang="ts">
|
||||
import Checkout from "layout/checkout/Checkout.svelte";
|
||||
import { user } from "lib/UserStore";
|
||||
import LoginRegister from "login/LoginRegister.svelte";
|
||||
import Euro from "util/Euro.svelte";
|
||||
</script>
|
||||
|
||||
{#if $user !== null}
|
||||
<div class="page_content">
|
||||
<section>
|
||||
{#if $user.subscription.id !== ""}
|
||||
<p>
|
||||
You already have the {$user.subscription.name} plan active.
|
||||
Your account balance is <Euro
|
||||
amount={$user.balance_micro_eur}/>. Subscriptions are
|
||||
charged from this balance every day, use the form below to
|
||||
top it up or to switch to another plan.
|
||||
</p>
|
||||
{:else}
|
||||
<p>
|
||||
Pick a subscription plan to upgrade your account. Your
|
||||
account balance is <Euro amount={$user.balance_micro_eur}/>.
|
||||
</p>
|
||||
{/if}
|
||||
<Checkout/>
|
||||
</section>
|
||||
</div>
|
||||
{:else}
|
||||
<LoginRegister/>
|
||||
{/if}
|
||||
@@ -1,58 +1,86 @@
|
||||
<script>
|
||||
import Footer from "layout/Footer.svelte";
|
||||
import { drop_target } from "lib/DropTarget";
|
||||
import GetStarted from "./GetStarted.svelte";
|
||||
import Pricing from "./Pricing.svelte";
|
||||
<script lang="ts">
|
||||
import SubscriptionPlans from "layout/checkout/SubscriptionPlans.svelte";
|
||||
import NovaLogo from "util/NovaLogo.svelte";
|
||||
|
||||
let upload_widget
|
||||
import { user } from "lib/UserStore";
|
||||
import LoginRegister from "login/LoginRegister.svelte";
|
||||
import Showcase from "./Showcase.svelte";
|
||||
import Euro from "util/Euro.svelte";
|
||||
</script>
|
||||
|
||||
<header class="logo_header">
|
||||
<NovaLogo full style="display: block; height: 100px; max-width: 100%; margin: 50px auto;"/>
|
||||
<header class="hero">
|
||||
<NovaLogo full style="display: block; height: 100px; max-width: 100%; margin: 50px auto 0 auto;"/>
|
||||
</header>
|
||||
|
||||
<div class="page_content">
|
||||
<section>
|
||||
<div class="highlight_yellow">
|
||||
This is a development server. All files and accounts may be lost when
|
||||
the final product launches.
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<section>
|
||||
<p style="text-align: center;">
|
||||
Nova.storage is a platform for cost-effective cloud storage and content
|
||||
delivery. We store and serve your files at an extremely competitive
|
||||
rate.
|
||||
</p>
|
||||
</section>
|
||||
|
||||
<div class="highlights">
|
||||
<div class="bubble">
|
||||
<h3><i class="icon i_public"></i> Fully European</h3>
|
||||
<p>
|
||||
Nova.storage is a platform for cost-effective cloud storage and
|
||||
content delivery. We will store and serve your files at an extremely
|
||||
competitive rate.
|
||||
Nova is developed and operated entirely within Europe. With its
|
||||
headquarters in the Netherlands and hosting in Germany.
|
||||
</p>
|
||||
<h2>Features</h2>
|
||||
<ul>
|
||||
<li>
|
||||
Cloud storage with <a href="/filesystem#toc_7">rclone</a> and
|
||||
FTPS support
|
||||
</li>
|
||||
<li>
|
||||
Customizable download pages (custom branding colours, header and
|
||||
background images)
|
||||
</li>
|
||||
<li>
|
||||
Fault tolerance for up to four storage server failures
|
||||
</li>
|
||||
<li>
|
||||
Caching servers highly optimized for long-distance data transfer
|
||||
</li>
|
||||
</ul>
|
||||
<h3>What you don't get</h3>
|
||||
<ul>
|
||||
<li>
|
||||
Data backups - Please keep a local copy of everything you store
|
||||
in case of emergency
|
||||
</li>
|
||||
<li>
|
||||
Commercial support - I'm busy, please don't bother me
|
||||
</li>
|
||||
</ul>
|
||||
</section>
|
||||
</div>
|
||||
<div class="bubble">
|
||||
<h3><i class="icon i_storage"></i> Proven storage engine</h3>
|
||||
<p>
|
||||
Pixelstore, the storage engine behind Nova, has been running in
|
||||
production for more than ten years. It is fine-tuned for
|
||||
reliability and performance.
|
||||
</p>
|
||||
</div>
|
||||
<div class="bubble">
|
||||
<h3><i class="icon i_verified_user"></i> Fault-tolerant</h3>
|
||||
<p>
|
||||
The storage, database and caching layers all have redundancy built
|
||||
in. Your files stay available through up to four storage server
|
||||
failures.
|
||||
</p>
|
||||
</div>
|
||||
<div class="bubble">
|
||||
<h3>
|
||||
<i class="icon i_speed"></i>
|
||||
Highly optimised
|
||||
</h3>
|
||||
<p>
|
||||
Our servers are tuned for high performance transfers over long
|
||||
distances, so downloads stay fast no matter where you are in the
|
||||
world.
|
||||
</p>
|
||||
</div>
|
||||
<div class="bubble">
|
||||
<h3><i class="icon i_hub"></i> Easy integration</h3>
|
||||
<p>
|
||||
Connect with the
|
||||
<a href="https://docs.nova.storage/api/filesystem/">filesystem API</a>,
|
||||
<a href="https://docs.nova.storage/filesystem/#s3">S3</a>,
|
||||
<a href="https://docs.nova.storage/filesystem/#ftps">FTPS</a> or
|
||||
<a href="https://docs.nova.storage/filesystem/#rclone">rclone</a>.
|
||||
Backup tools, NAS devices and file managers work out of the box.
|
||||
</p>
|
||||
</div>
|
||||
<div class="bubble">
|
||||
<h3>
|
||||
<i class="icon i_edit"></i>
|
||||
Customizable</h3>
|
||||
<p>
|
||||
You can make Nova look however you want. Apply your brand colours,
|
||||
add a custom wallpaper, link back to your own site, you name it.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<header>
|
||||
@@ -60,19 +88,86 @@ let upload_widget
|
||||
</header>
|
||||
<SubscriptionPlans/>
|
||||
|
||||
<section>
|
||||
<p>
|
||||
Every plan includes a fixed amount of storage and egress. If you need
|
||||
more, you can turn on
|
||||
<a href="/user/subscription/metered_billing">usage based billing</a>.
|
||||
Usage above your plan is then charged from your account balance at these
|
||||
rates:
|
||||
</p>
|
||||
<div class="rates">
|
||||
<div class="bubble">
|
||||
<div class="rate"><Euro amount={4e6}/> / TB / month</div>
|
||||
Storage above your plan
|
||||
</div>
|
||||
<div class="bubble">
|
||||
<div class="rate"><Euro amount={1e6}/> / TB</div>
|
||||
Egress above your plan
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<header>
|
||||
<h1>Feature showcase</h1>
|
||||
</header>
|
||||
<Showcase/>
|
||||
|
||||
{#if $user === null}
|
||||
<header>
|
||||
<h1>Get started</h1>
|
||||
</header>
|
||||
<LoginRegister/>
|
||||
{/if}
|
||||
|
||||
<style>
|
||||
header {
|
||||
padding-top: 20px;
|
||||
padding-bottom: 20px;
|
||||
.hero {
|
||||
padding: 0 8px 20px 8px;
|
||||
}
|
||||
.logo_header {
|
||||
text-align: initial;
|
||||
padding-top: 0;
|
||||
padding-bottom: 0;
|
||||
.highlights {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(min(18em, 100%), 1fr));
|
||||
gap: 8px;
|
||||
width: 100%;
|
||||
max-width: 1000px;
|
||||
margin: 12px auto;
|
||||
padding: 0 4px;
|
||||
}
|
||||
.highlights > div {
|
||||
margin: 0;
|
||||
padding: 0 1em;
|
||||
}
|
||||
.highlights h3 {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.4em;
|
||||
font-size: 1.3em;
|
||||
border-bottom: none;
|
||||
}
|
||||
.highlights .icon {
|
||||
color: var(--accent_color);
|
||||
background: var(--accent_shade);
|
||||
border-radius: 8px;
|
||||
padding: 0.2em;
|
||||
}
|
||||
.rates {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: center;
|
||||
gap: 8px;
|
||||
}
|
||||
.rates > div {
|
||||
flex: 0 1 16em;
|
||||
margin: 0;
|
||||
padding: 0.5em;
|
||||
text-align: center;
|
||||
}
|
||||
.rate {
|
||||
font-size: 1.5em;
|
||||
line-height: 1.5;
|
||||
}
|
||||
header > h1 {
|
||||
margin-top: 30px;
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
|
||||
</style>
|
||||
@@ -1,182 +0,0 @@
|
||||
<script>
|
||||
import Euro from "util/Euro.svelte";
|
||||
import ProgressBar from "util/ProgressBar.svelte";
|
||||
|
||||
let nova_storage = $state(0)
|
||||
let nova_egress = $state(0)
|
||||
let nova_total = $state(0)
|
||||
let backblaze_storage = $state(0)
|
||||
let backblaze_egress = $state(0)
|
||||
let backblaze_api = $state(0)
|
||||
let backblaze_total = $state(0)
|
||||
let wasabi_storage = $state(0)
|
||||
let wasabi_total = $state(0)
|
||||
let price_max = $state(0)
|
||||
|
||||
let storage = $state(10) // TB
|
||||
let egress = $state(10) // TB
|
||||
let avg_file_size = $state(1000) // kB
|
||||
|
||||
$effect(() => {
|
||||
// Nova has a minimum file size of 10kB. Calculate the number of files from
|
||||
// storage and avg file size, then calculate storage usage based on that.
|
||||
nova_storage = Math.max(storage * 4, ((storage*10)/avg_file_size)*4)
|
||||
nova_egress = egress * 1
|
||||
nova_total = nova_storage + nova_egress
|
||||
|
||||
// Egress at Backblaze is free up to three times the amount of storage, then
|
||||
// it's $10/TB
|
||||
backblaze_storage = storage * 6
|
||||
backblaze_egress = Math.max(egress - (storage * 3), 0) * 10
|
||||
backblaze_api = ((egress * 1e12) / (avg_file_size * 1e3)) * 0.0000004
|
||||
backblaze_total = backblaze_storage + backblaze_egress + backblaze_api
|
||||
|
||||
// Wasabi does not have egress fees
|
||||
wasabi_storage = storage * 6.99
|
||||
wasabi_total = (egress > storage) ? 0 : wasabi_storage
|
||||
|
||||
price_max = Math.max(nova_total, backblaze_total, wasabi_total)
|
||||
});
|
||||
</script>
|
||||
|
||||
<h2>Price calculator</h2>
|
||||
<div class="inputs">
|
||||
<div>
|
||||
<div class="usage_label">Storage</div>
|
||||
<div class="usage_input">
|
||||
<input type="number" bind:value={storage}/>
|
||||
<div>TB / month</div>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<div class="usage_label">Egress</div>
|
||||
<div class="usage_input">
|
||||
<input type="number" bind:value={egress}/>
|
||||
<div>TB / month</div>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<div class="usage_label">Average file size</div>
|
||||
<div class="usage_input">
|
||||
<input type="number" bind:value={avg_file_size}/>
|
||||
<div>kB</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="bars">
|
||||
<div>
|
||||
<div>
|
||||
Nova.storage - <Euro amount={nova_total*1e6}/> / month<br/>
|
||||
<Euro amount={nova_storage*1e6}/> storage,
|
||||
<Euro amount={nova_egress*1e6}/> egress
|
||||
<ProgressBar used={nova_total} total={price_max}/>
|
||||
</div>
|
||||
{#if avg_file_size < 10}
|
||||
<div>
|
||||
Nova counts a minimum file size of 10 kB. Files smaller than that
|
||||
are rounded up to 10 kB.
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
<div>
|
||||
<div>
|
||||
Backblaze B2 - <Euro symbol="$" amount={backblaze_total*1e6}/> / month<br/>
|
||||
<Euro symbol="$" amount={backblaze_storage*1e6}/> storage,
|
||||
<Euro symbol="$" amount={backblaze_egress*1e6}/> egress,
|
||||
<Euro symbol="$" amount={backblaze_api*1e6}/> API calls
|
||||
<ProgressBar used={backblaze_total} total={price_max}/>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<div>
|
||||
Wasabi - <Euro symbol="$" amount={wasabi_total*1e6}/> / month<br/>
|
||||
<Euro symbol="$" amount={wasabi_storage*1e6}/> storage
|
||||
<ProgressBar used={wasabi_total} total={price_max}/>
|
||||
</div>
|
||||
{#if egress > storage}
|
||||
<div>
|
||||
Wasabi does not allow users to download more than their amount
|
||||
of stored data per month. For this reason Wasabi is excluded
|
||||
from price calculations when egress is higher than storage.
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p>
|
||||
Note that while Nova.storage might not seem to be the cheapest option in some
|
||||
cases, most cloud providers have extra hidden costs for API calls and
|
||||
region-specific prices. This makes it very hard to accurately compare the
|
||||
pricing of these platforms. Nova.storage includes no hidden costs, I only
|
||||
charge for storage and egress.
|
||||
</p>
|
||||
<p>
|
||||
Large cloud providers like Amazon, Microsoft and Google are excluded from
|
||||
this calculation because their pricing is too complex accurately compare
|
||||
them. Just assume that Nova wil be cheaper.
|
||||
</p>
|
||||
|
||||
<style>
|
||||
.inputs {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: center;
|
||||
gap: 10px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
@media(max-width: 700px) {
|
||||
.inputs {
|
||||
flex-direction: column;
|
||||
}
|
||||
}
|
||||
.inputs > div {
|
||||
flex: 1 1 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
border-radius: 6px;
|
||||
overflow: hidden;
|
||||
border: 2px solid var(--card_color);
|
||||
}
|
||||
.usage_label {
|
||||
flex: 1 1 auto;
|
||||
text-align: center;
|
||||
font-size: 1.3em;
|
||||
padding: 4px;
|
||||
}
|
||||
.usage_input {
|
||||
flex: 1 1 auto;
|
||||
background: var(--card_color);
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
}
|
||||
.usage_input > input {
|
||||
flex: 1 1 auto;
|
||||
background: var(--card_color);
|
||||
}
|
||||
.usage_input > div {
|
||||
flex: 0 0 auto;
|
||||
background: var(--card_color);
|
||||
}
|
||||
.bars {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
gap: 10px;
|
||||
}
|
||||
.bars > div {
|
||||
flex: 1 1 auto;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
border-radius: 6px;
|
||||
overflow: hidden;
|
||||
border: 2px solid var(--card_color);
|
||||
}
|
||||
.bars > div > div {
|
||||
padding: 4px;
|
||||
}
|
||||
.bars > div > div:first-child {
|
||||
background: var(--card_color);
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,119 @@
|
||||
<script lang="ts">
|
||||
const slides = [
|
||||
{
|
||||
image: "download_page",
|
||||
title: "Download pages",
|
||||
text: `Share files and directories with a link. Visitors get a fast
|
||||
download page in your own colours, with your header and background.`,
|
||||
}, {
|
||||
image: "access_control",
|
||||
title: "Access control",
|
||||
text: `Decide who can read, write and delete, per link, per user and per
|
||||
password. Passwords double as S3 credentials.`,
|
||||
}, {
|
||||
image: "branding",
|
||||
title: "Branding",
|
||||
text: `Start from one of the theme presets or pick your own colours,
|
||||
header image and background image.`,
|
||||
}, {
|
||||
image: "image_viewer",
|
||||
title: "File previews",
|
||||
text: `Images, videos, audio, PDFs and text files open right in the
|
||||
browser, and archives can be browsed before downloading.`,
|
||||
}, {
|
||||
image: "statistics",
|
||||
title: "Statistics",
|
||||
text: `Follow the downloads and data transfer of every file, from the
|
||||
last day up to five years back.`,
|
||||
}, {
|
||||
image: "remote_sync",
|
||||
title: "Remote sync",
|
||||
text: `Import from or export to S3, Backblaze B2, Azure, SFTP, FTP,
|
||||
WebDAV or pixeldrain. Syncs run on our servers, so you can close the
|
||||
page while they run.`,
|
||||
},
|
||||
]
|
||||
|
||||
let slider: HTMLDivElement
|
||||
let current = $state(0)
|
||||
const show = (i: number) => slider.scrollTo({
|
||||
left: ((i + slides.length) % slides.length) * slider.clientWidth,
|
||||
behavior: "smooth",
|
||||
})
|
||||
</script>
|
||||
|
||||
<div class="page_content showcase">
|
||||
<div
|
||||
class="slider"
|
||||
bind:this={slider}
|
||||
onscroll={() => current = Math.round(slider.scrollLeft / slider.clientWidth)}
|
||||
>
|
||||
{#each slides as slide (slide.image)}
|
||||
<figure>
|
||||
<img
|
||||
src="/res/img/home/{slide.image}.webp"
|
||||
alt={slide.title}
|
||||
width="2000"
|
||||
height="1250"
|
||||
loading="lazy"
|
||||
/>
|
||||
<figcaption>{slide.text}</figcaption>
|
||||
</figure>
|
||||
{/each}
|
||||
</div>
|
||||
<div class="slider_nav">
|
||||
<button onclick={() => show(current-1)} title="Previous">
|
||||
<i class="icon i_chevron_left"></i>
|
||||
</button>
|
||||
{#each slides as slide, i (slide.image)}
|
||||
<button class:button_highlight={i === current} onclick={() => show(i)}>
|
||||
{slide.title}
|
||||
</button>
|
||||
{/each}
|
||||
<button onclick={() => show(current+1)} title="Next">
|
||||
<i class="icon i_chevron_right"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
/* Lines up with the cards on the home page, which have 4px of padding on each
|
||||
side */
|
||||
.showcase {
|
||||
width: calc(100% - 8px);
|
||||
max-width: 992px;
|
||||
margin: 0 auto 12px auto;
|
||||
padding: 8px;
|
||||
}
|
||||
.slider {
|
||||
display: flex;
|
||||
overflow-x: auto;
|
||||
scroll-snap-type: x mandatory;
|
||||
overscroll-behavior-x: contain;
|
||||
scrollbar-width: none;
|
||||
}
|
||||
.slider::-webkit-scrollbar {
|
||||
display: none;
|
||||
}
|
||||
.slider > figure {
|
||||
flex: 0 0 100%;
|
||||
margin: 0;
|
||||
scroll-snap-align: center;
|
||||
}
|
||||
.slider img {
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: auto;
|
||||
border-radius: 6px;
|
||||
border: 1px solid var(--separator);
|
||||
}
|
||||
.slider figcaption {
|
||||
padding: 0.5em;
|
||||
text-align: center;
|
||||
}
|
||||
.slider_nav {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: center;
|
||||
}
|
||||
</style>
|
||||
@@ -1,4 +1,4 @@
|
||||
<i class="icon star" title="These options require a Persistence (€8) subscription or Prepaid plan to use">star</i>
|
||||
<i class="icon star i_star" title="These options require a Persistence (€8) subscription or Prepaid plan to use"></i>
|
||||
|
||||
<style>
|
||||
.star {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<i class="icon star" title="These options require a Pro (€4) subscription or Prepaid plan to use">star</i>
|
||||
<i class="icon star i_star" title="These options require a Pro (€4) subscription or Prepaid plan to use"></i>
|
||||
|
||||
<style>
|
||||
.star {
|
||||
|
||||
@@ -65,7 +65,7 @@ let click_int = (e: MouseEvent) => {
|
||||
disabled={disabled ? true:null}
|
||||
>
|
||||
{#if icon !== ""}
|
||||
<i class="icon" class:small={icon_small}>{icon}</i>
|
||||
<i class="icon i_{icon}" class:small={icon_small}></i>
|
||||
{/if}
|
||||
{#if label !== ""}
|
||||
<span>{label}</span>
|
||||
@@ -85,7 +85,7 @@ let click_int = (e: MouseEvent) => {
|
||||
style={style}
|
||||
>
|
||||
{#if icon !== ""}
|
||||
<i class="icon" class:small={icon_small}>{icon}</i>
|
||||
<i class="icon i_{icon}" class:small={icon_small}></i>
|
||||
{/if}
|
||||
{#if label !== ""}
|
||||
<span>{label}</span>
|
||||
|
||||
@@ -54,7 +54,7 @@ export const copy = (e: MouseEvent) => {
|
||||
title="Copy text to clipboard"
|
||||
disabled={disabled}
|
||||
>
|
||||
<i class="icon">content_copy</i>
|
||||
<i class="icon i_content_copy"></i>
|
||||
<span>
|
||||
{#if success}
|
||||
Copied!
|
||||
|
||||
@@ -10,8 +10,9 @@ let {
|
||||
class:button_highlight={toggle}
|
||||
style="margin: 0;"
|
||||
onclick={() => toggle = !toggle}
|
||||
title="Help"
|
||||
>
|
||||
<i class="icon">help</i>
|
||||
<i class="icon i_help"></i>
|
||||
</button>
|
||||
|
||||
<style>
|
||||
|
||||
@@ -23,30 +23,27 @@ import { formatDataVolume, formatDataVolumeBits, formatThousands } from "util/Fo
|
||||
|
||||
let {
|
||||
index_field = "",
|
||||
rows = $bindable([]),
|
||||
rows = [],
|
||||
columns = [],
|
||||
sort_field = $bindable(index_field),
|
||||
sort_field = index_field,
|
||||
totals = false
|
||||
}: {
|
||||
index_field?: string;
|
||||
rows?: any;
|
||||
rows?: any[];
|
||||
columns?: SortColumn[];
|
||||
sort_field?: any;
|
||||
sort_field?: string;
|
||||
totals?: boolean;
|
||||
} = $props();
|
||||
|
||||
let asc = $state(true)
|
||||
const sort = (field: string) => {
|
||||
if (field !== "" && field === sort_field) {
|
||||
if (field === sort_field) {
|
||||
asc = !asc
|
||||
}
|
||||
if (field === "") {
|
||||
field = sort_field
|
||||
}
|
||||
sort_field = field
|
||||
|
||||
console.log("sorting by", field, "asc", asc)
|
||||
rows.sort((a, b) => {
|
||||
rows = [...rows].sort((a, b) => {
|
||||
if (typeof (a[field]) === "number") {
|
||||
// Sort ints from high to low
|
||||
if (asc) {
|
||||
@@ -63,7 +60,6 @@ const sort = (field: string) => {
|
||||
}
|
||||
}
|
||||
})
|
||||
rows = rows
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ let {
|
||||
highlight = false,
|
||||
flat = false,
|
||||
action,
|
||||
title,
|
||||
children,
|
||||
}: {
|
||||
on?: boolean;
|
||||
@@ -20,6 +21,7 @@ let {
|
||||
highlight?: boolean;
|
||||
flat?: boolean;
|
||||
action?: (e: MouseEvent) => void;
|
||||
title?: string;
|
||||
children?: import('svelte').Snippet;
|
||||
} = $props();
|
||||
|
||||
@@ -34,6 +36,7 @@ const click = (e: MouseEvent) => {
|
||||
<button
|
||||
onclick={click}
|
||||
type="button"
|
||||
title={title}
|
||||
class="button"
|
||||
class:button_highlight={highlight}
|
||||
class:group_first
|
||||
@@ -42,9 +45,9 @@ const click = (e: MouseEvent) => {
|
||||
class:flat
|
||||
>
|
||||
{#if on}
|
||||
<i class="icon on">{icon_on}</i>
|
||||
<i class="icon on i_{icon_on}"></i>
|
||||
{:else}
|
||||
<i class="icon off">{icon_off}</i>
|
||||
<i class="icon off i_{icon_off}"></i>
|
||||
{/if}
|
||||
{@render children?.()}
|
||||
</button>
|
||||
|
||||
@@ -13,7 +13,7 @@ const open = () => dialog.open(button.getBoundingClientRect())
|
||||
</script>
|
||||
|
||||
<button bind:this={button} onclick={open} class="button round">
|
||||
<i class="icon">info</i>{@render label?.()}
|
||||
<i class="icon i_info"></i>{@render label?.()}
|
||||
</button>
|
||||
|
||||
<Dialog bind:this={dialog}>
|
||||
|
||||
@@ -171,7 +171,7 @@ const submit = async (e: SubmitEvent) => {
|
||||
{#if covered}
|
||||
|
||||
<button type="submit" class="button_highlight" style="flex-direction: column;">
|
||||
<i class="icon">shopping_cart</i>
|
||||
<i class="icon i_shopping_cart"></i>
|
||||
Activate plan {status.subscription.name}
|
||||
({status.months} month{status.months === 1 ? "" : "s"})
|
||||
</button>
|
||||
@@ -203,7 +203,7 @@ const submit = async (e: SubmitEvent) => {
|
||||
</div>
|
||||
|
||||
<button type="submit" class="button_highlight">
|
||||
<i class="icon">paid</i> Checkout
|
||||
<i class="icon i_paid"></i> Checkout
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@@ -259,10 +259,10 @@ const submit = async (e: SubmitEvent) => {
|
||||
</td>
|
||||
<td>
|
||||
{#if p.months === status.months}
|
||||
<i class="icon">check</i> Selected
|
||||
<i class="icon i_check"></i> Selected
|
||||
{:else}
|
||||
<button onclick={() => switch_period(p)}>
|
||||
<i class="icon">swap_horiz</i> Select
|
||||
<i class="icon i_swap_horiz"></i> Select
|
||||
</button>
|
||||
{/if}
|
||||
</td>
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<script lang="ts">
|
||||
import { preventDefault } from 'svelte/legacy';
|
||||
import { countries } from "country-data-list";
|
||||
import { get_misc_vat_rate, put_user } from "lib/NovaAPI";
|
||||
import { payment_providers, type CheckoutState } from "./CheckoutLib";
|
||||
@@ -59,7 +58,7 @@ const format_country = (c: typeof countries.all[0]) => {
|
||||
Please pick your country of residence
|
||||
</div>
|
||||
<div>
|
||||
<form onsubmit={preventDefault(set_country)} class="country_form">
|
||||
<form onsubmit={set_country} class="country_form">
|
||||
<div class="country_search">
|
||||
<datalist id="country_picker">
|
||||
{#each countries.all.filter(c => c.status === "assigned") as c}
|
||||
@@ -73,7 +72,7 @@ const format_country = (c: typeof countries.all[0]) => {
|
||||
placeholder="Search for country"
|
||||
style="flex: 1 1 auto;">
|
||||
<button type="submit" class="button_highlight" style="flex: 0 0 auto;">
|
||||
<i class="icon">send</i>
|
||||
<i class="icon i_send"></i>
|
||||
Continue
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@@ -30,7 +30,7 @@ const submit = async (e: SubmitEvent) => {
|
||||
|
||||
<button type="submit" class="button_highlight" style="align-self: end;">
|
||||
Continue
|
||||
<i class="icon">chevron_right</i>
|
||||
<i class="icon i_chevron_right"></i>
|
||||
</button>
|
||||
</form>
|
||||
<hr/>
|
||||
|
||||
@@ -67,11 +67,11 @@ const cancel = async () => {
|
||||
<SuccessMessage bind:this={cancel_message}/>
|
||||
<div class="options">
|
||||
<button onclick={extend}>
|
||||
<i class="icon">more_time</i>
|
||||
<i class="icon i_more_time"></i>
|
||||
Extend current plan (credit deposit)
|
||||
</button>
|
||||
<button onclick={cancel}>
|
||||
<i class="icon">cancel</i>
|
||||
<i class="icon i_cancel"></i>
|
||||
Cancel current plan and return to Free
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@@ -45,7 +45,7 @@ export type Peer = {
|
||||
ip: string
|
||||
port: number
|
||||
hostname: string
|
||||
role: string
|
||||
services: string[] | null
|
||||
reachable: boolean
|
||||
unreachable_count: number
|
||||
latency: number
|
||||
|
||||
@@ -12,13 +12,16 @@ export type Bookmark = {
|
||||
label: string,
|
||||
}
|
||||
|
||||
export let bookmarks_failed = writable(false)
|
||||
|
||||
export let bookmarks_store = writable<Bookmark[]>(
|
||||
[],
|
||||
(set: (value: Bookmark[]) => void) => {
|
||||
bookmarks_get().then((bm: Bookmark[]) => {
|
||||
set(bm)
|
||||
}).catch((err: any) => {
|
||||
alert("Could not fetch bookmarks:\n" + JSON.stringify(err))
|
||||
console.error("Could not fetch bookmarks", err)
|
||||
bookmarks_failed.set(true)
|
||||
})
|
||||
},
|
||||
)
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
import type { Upload } from "filesystem/upload_widget/FSUploadWidget.svelte"
|
||||
|
||||
export const drop_target = (
|
||||
node: HTMLElement,
|
||||
args: {
|
||||
upload: (files: File[]) => void,
|
||||
// Called as soon as the files are dropped, the promise resolves when
|
||||
// all the dropped directories have been read
|
||||
upload: (files: Promise<Upload[]>) => void,
|
||||
shadow: string | undefined,
|
||||
},
|
||||
) => {
|
||||
@@ -39,7 +43,7 @@ export const drop_target = (
|
||||
const dragleave = (e: DragEvent) => {
|
||||
node.style.boxShadow = ""
|
||||
}
|
||||
const drop = async (e: DragEvent) => {
|
||||
const drop = (e: DragEvent) => {
|
||||
node.style.boxShadow = ""
|
||||
|
||||
if (can_upload(e)) {
|
||||
@@ -49,39 +53,59 @@ export const drop_target = (
|
||||
return
|
||||
}
|
||||
|
||||
// if directory support is available
|
||||
if (e.dataTransfer && e.dataTransfer.items && e.dataTransfer.items.length > 0) {
|
||||
for (let i = 0; i < e.dataTransfer.items.length; i++) {
|
||||
const entry: FileSystemEntry | null = e.dataTransfer.items[i].webkitGetAsEntry();
|
||||
if (entry !== null) {
|
||||
read_dir_recursive(entry);
|
||||
continue
|
||||
}
|
||||
const file: File | null = e.dataTransfer.items[i].getAsFile();
|
||||
if (file !== null) {
|
||||
args.upload([file]);
|
||||
continue
|
||||
}
|
||||
// The items are only valid until this function returns, so every entry
|
||||
// has to be taken out of them before the first await
|
||||
const files: Upload[] = []
|
||||
const reads: Promise<void>[] = []
|
||||
for (let i = 0; i < e.dataTransfer.items.length; i++) {
|
||||
const entry = e.dataTransfer.items[i].webkitGetAsEntry()
|
||||
if (entry !== null) {
|
||||
reads.push(read_entry(entry, files))
|
||||
continue
|
||||
}
|
||||
} else if (e.dataTransfer && e.dataTransfer.files && e.dataTransfer.files.length > 0) {
|
||||
const files: File[] = []
|
||||
for (let i = 0; i < e.dataTransfer.files.length; i++) {
|
||||
files.push(e.dataTransfer.files[i])
|
||||
|
||||
// Files which are not on the disk have no entry, like an image
|
||||
// which is dragged out of another web page
|
||||
const file = e.dataTransfer.items[i].getAsFile()
|
||||
if (file !== null) {
|
||||
files.push({ file, path: file.name })
|
||||
}
|
||||
args.upload(files)
|
||||
}
|
||||
args.upload(Promise.all(reads).then(() => files))
|
||||
}
|
||||
const read_dir_recursive = (item: FileSystemEntry) => {
|
||||
if (item.isDirectory) {
|
||||
(item as FileSystemDirectoryEntry).createReader().readEntries(entries => {
|
||||
entries.forEach(entry => {
|
||||
read_dir_recursive(entry);
|
||||
});
|
||||
});
|
||||
} else {
|
||||
(item as FileSystemFileEntry).file(file => {
|
||||
args.upload([file])
|
||||
});
|
||||
|
||||
// Adds a file, or all the files in a directory, to the list. The path comes
|
||||
// from the entry. Firefox also puts it in the file's webkitRelativePath,
|
||||
// but Chromium leaves that empty for dropped files
|
||||
const read_entry = async (entry: FileSystemEntry, files: Upload[]) => {
|
||||
if (entry.isFile) {
|
||||
files.push({
|
||||
path: entry.fullPath.slice(1),
|
||||
file: await new Promise<File>((resolve, reject) =>
|
||||
(entry as FileSystemFileEntry).file(resolve, reject)
|
||||
),
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
// A reader returns the directory in parts, Chromium gives 100 entries
|
||||
// at a time. An empty part marks the end
|
||||
const reader = (entry as FileSystemDirectoryEntry).createReader()
|
||||
while (true) {
|
||||
const entries = await new Promise<FileSystemEntry[]>(
|
||||
(resolve, reject) => reader.readEntries(resolve, reject)
|
||||
)
|
||||
if (entries.length === 0) {
|
||||
return
|
||||
}
|
||||
|
||||
// One at a time on purpose. Chromium asks another process for
|
||||
// each file, and handles all the answers which have arrived in
|
||||
// one go. Asking for a whole tree at once is a third faster, but
|
||||
// freezes the page for seconds: 7 for 100k files
|
||||
for (const e of entries) {
|
||||
await read_entry(e, files)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -52,10 +52,9 @@ export class FSNode {
|
||||
user_permissions?: { [index: string]: FSPermissions }
|
||||
password_permissions?: { [index: string]: FSPermissions }
|
||||
|
||||
// Added by us
|
||||
|
||||
// Indicates whether the file is selected in the file manager
|
||||
fm_selected?: boolean = $state(false)
|
||||
// Only set on the nodes returned by fs_get_trash
|
||||
original_path?: string
|
||||
deletion_date?: string
|
||||
|
||||
is_shared = (): boolean => {
|
||||
return (this.link_permissions !== undefined && this.link_permissions.read === true) ||
|
||||
@@ -143,28 +142,10 @@ export type NodeOptions = {
|
||||
// API methods
|
||||
// ===========
|
||||
|
||||
// mkdir only supports the "mode" option
|
||||
export const fs_mkdir = async (path: string, opts?: NodeOptions) => {
|
||||
export const fs_mkdir = async (path: string) => {
|
||||
const form = new FormData()
|
||||
form.append("action", "mkdir")
|
||||
|
||||
if (opts !== undefined && opts.mode !== undefined) {
|
||||
form.append("mode", opts.mode.toFixed(0))
|
||||
}
|
||||
|
||||
return await fs_check_response(
|
||||
await fetch(fs_path_url(path), { method: "POST", body: form })
|
||||
)
|
||||
}
|
||||
|
||||
export const fs_mkdirall = async (path: string, opts: NodeOptions) => {
|
||||
const form = new FormData()
|
||||
form.append("action", "mkdirall")
|
||||
|
||||
if (opts && opts.mode) {
|
||||
form.append("mode", opts.mode.toFixed(0))
|
||||
}
|
||||
|
||||
return await fs_check_response(
|
||||
await fetch(fs_path_url(path), { method: "POST", body: form })
|
||||
)
|
||||
@@ -251,22 +232,15 @@ export const fs_trash = async (path: string) => {
|
||||
) as GenericResponse
|
||||
}
|
||||
|
||||
export type TrashEntry = {
|
||||
node: FSNode;
|
||||
original_path: string;
|
||||
deletion_date: string;
|
||||
};
|
||||
|
||||
export const fs_get_trash = async (path: string) => {
|
||||
let resp = await fs_check_response(
|
||||
const resp = await fs_check_response(
|
||||
await fetch(fs_path_url(path) + "?trash")
|
||||
) as TrashEntry[]
|
||||
resp.forEach((entry, index) => {
|
||||
resp[index].node = Object.assign(new FSNode(), entry.node)
|
||||
})
|
||||
) as { node: FSNode, original_path: string, deletion_date: string }[]
|
||||
|
||||
return resp
|
||||
};
|
||||
// The trash metadata is moved into the node, so the trash can be listed
|
||||
// like the children of a directory
|
||||
return resp.map(({ node, ...info }) => Object.assign(new FSNode(), node, info))
|
||||
}
|
||||
|
||||
export const fs_search = async (path: string, term: string, limit = 10) => {
|
||||
return await fs_check_response(
|
||||
|
||||
@@ -95,6 +95,22 @@ export type UserSession = {
|
||||
creation_time: string,
|
||||
last_used_time: string,
|
||||
valid_domains: string[],
|
||||
|
||||
// Whether this is the key the list of sessions was requested with
|
||||
current: boolean,
|
||||
|
||||
// What the key is allowed to do
|
||||
filesystem_read: boolean,
|
||||
filesystem_write: boolean,
|
||||
account_read: boolean,
|
||||
account_write: boolean,
|
||||
session_read: boolean,
|
||||
session_write: boolean,
|
||||
billing_read: boolean,
|
||||
billing_write: boolean,
|
||||
|
||||
// IDs of the directories the key is limited to. Empty means no limit
|
||||
filesystem_dirs: string[],
|
||||
}
|
||||
|
||||
// If cached_user is undefined it means that the value is not initialized yet,
|
||||
@@ -192,6 +208,20 @@ export const subscription_periods: SubscriptionPeriod[] = [
|
||||
// same value the server divides the monthly fee by
|
||||
export const days_per_month = 365.25 / 12
|
||||
|
||||
// The price of the subscription period the user is in. This is also how far
|
||||
// the balance can go below zero before usage above the plan is refused
|
||||
export const period_price = (u: User) => {
|
||||
const period = subscription_periods.find(p => p.months === u.subscription_months)
|
||||
return period === undefined ? 0 :
|
||||
u.subscription.monthly_fee * period.months * period.discount
|
||||
}
|
||||
|
||||
// Whether usage above a limit of the plan is billed instead of refused. price
|
||||
// is what the plan charges for that usage. The server does the same check in
|
||||
// billsExtra
|
||||
export const bills_extra = (u: User, price: number) =>
|
||||
u.usage_based_billing && price > 0 && u.balance_micro_eur >= -period_price(u)
|
||||
|
||||
export const get_misc_subscriptions = async () => {
|
||||
return await check_response(
|
||||
await fetch(get_endpoint() + "/misc/subscriptions")
|
||||
|
||||
@@ -0,0 +1,136 @@
|
||||
<script lang="ts">
|
||||
import { onMount } from "svelte";
|
||||
import { loading_run } from "lib/Loading";
|
||||
import { check_response, get_endpoint, get_user } from "lib/NovaAPI";
|
||||
import type { FSNode } from "lib/FilesystemAPI.svelte";
|
||||
import FilePicker from "filesystem/filemanager/FilePicker.svelte";
|
||||
|
||||
// An app sends the user here with an OAuth authorization request in the query
|
||||
// string. The API gets it exactly as it came in, first to check it and then to
|
||||
// approve it. Everything this page shows and every address it goes to comes
|
||||
// out of the API's answer, the page itself never reads the request. The API
|
||||
// and the browser can disagree about a query with the same parameter in it
|
||||
// twice, and then the user would approve something else than what they see
|
||||
const endpoint = get_endpoint() + "/user/oauth/authorize" + window.location.search
|
||||
|
||||
// What the app can do with each permission it can ask for
|
||||
const permissions: {[name: string]: string} = {
|
||||
filesystem_read: "See and download your files",
|
||||
filesystem_write: "Upload, change, share and delete your files",
|
||||
account_read: `See your account details, like your e-mail address and how
|
||||
much storage you use`,
|
||||
session_read: "See your API keys, except the ones which can do more than its own",
|
||||
session_write: "Create API keys",
|
||||
billing_read: "See your invoices and transactions",
|
||||
billing_write: "Change your subscription and create invoices",
|
||||
}
|
||||
|
||||
let username = $state("")
|
||||
let request: {client_name: string, scope: string[], redirect_uri: string} = $state(null)
|
||||
let errors: string[] = $state([])
|
||||
|
||||
// The directories the user limits the app to. With none the app can use all
|
||||
// files
|
||||
let dirs: FSNode[] = $state([])
|
||||
let picker: FilePicker = $state()
|
||||
const pick = (nodes: FSNode[]) => {
|
||||
if (!dirs.some(dir => dir.id === nodes[0].id)) {
|
||||
dirs.push(nodes[0])
|
||||
}
|
||||
}
|
||||
|
||||
const authorize = async (method: string) => {
|
||||
try {
|
||||
// The directories go in the body. The query is what the app asks for,
|
||||
// and the API refuses a request which has them in there
|
||||
const body = method !== "POST" ? undefined : new URLSearchParams({
|
||||
filesystem_dirs: JSON.stringify(dirs.map(dir => dir.id)),
|
||||
})
|
||||
return await loading_run(async () => check_response(
|
||||
await fetch(endpoint, {method: method, body: body})
|
||||
))
|
||||
} catch (err) {
|
||||
// A request with several things wrong with it comes back as a list
|
||||
errors = (err.errors ?? [err]).map((e: any) =>
|
||||
(e.message ?? e) + (e.extra?.field ? " (" + e.extra.field + ")" : "")
|
||||
)
|
||||
request = null
|
||||
}
|
||||
}
|
||||
|
||||
const approve = async () => {
|
||||
const approved = await authorize("POST")
|
||||
if (approved !== undefined) {
|
||||
window.location.href = approved.redirect_uri
|
||||
}
|
||||
}
|
||||
|
||||
onMount(async () => {
|
||||
username = (await get_user()).username
|
||||
request = await authorize("GET")
|
||||
})
|
||||
</script>
|
||||
|
||||
<div class="page_content">
|
||||
<section>
|
||||
{#if errors.length !== 0}
|
||||
<h2>This app can't be given access</h2>
|
||||
{#each errors as error}
|
||||
<p>{error}</p>
|
||||
{/each}
|
||||
{:else if request}
|
||||
<h2>{request.client_name} wants access to your account</h2>
|
||||
<p>
|
||||
You are logged in as {username}. If you approve,
|
||||
{request.client_name} will be able to:
|
||||
</p>
|
||||
<ul>
|
||||
{#each request.scope as name}
|
||||
<li>{permissions[name]}</li>
|
||||
{/each}
|
||||
</ul>
|
||||
|
||||
{#if request.scope.some(name => name.startsWith("filesystem_"))}
|
||||
{#if dirs.length === 0}
|
||||
<p>
|
||||
That goes for all your files. You can limit
|
||||
{request.client_name} to the directories you pick.
|
||||
</p>
|
||||
{:else}
|
||||
<p>{request.client_name} can only use the files in:</p>
|
||||
<ul>
|
||||
{#each dirs as dir, index (dir.id)}
|
||||
<li>
|
||||
{dir.path}
|
||||
<button onclick={() => dirs.splice(index, 1)} title="Remove">
|
||||
<i class="icon i_close"></i>
|
||||
</button>
|
||||
</li>
|
||||
{/each}
|
||||
</ul>
|
||||
{/if}
|
||||
<p>
|
||||
<button onclick={() => picker.open("/me")}>
|
||||
<i class="icon i_folder"></i>
|
||||
{dirs.length === 0 ? "Pick directories" : "Add a directory"}
|
||||
</button>
|
||||
</p>
|
||||
{/if}
|
||||
|
||||
<p>
|
||||
You can take the access away again by deleting the key of the
|
||||
app on the <a href="/user/api_keys">API keys page</a>.
|
||||
</p>
|
||||
<button class="button_highlight" onclick={approve}>
|
||||
<i class="icon i_check"></i> Approve
|
||||
</button>
|
||||
<!-- For a request which was not approved the address has an error
|
||||
in it, which tells the app that the user said no -->
|
||||
<a class="button" href={request.redirect_uri} rel="external">
|
||||
<i class="icon i_close"></i> Deny
|
||||
</a>
|
||||
{/if}
|
||||
</section>
|
||||
</div>
|
||||
|
||||
<FilePicker bind:this={picker} callback={pick} directories/>
|
||||
@@ -1,9 +1,11 @@
|
||||
<script lang="ts">
|
||||
import { createEventDispatcher, onMount } from "svelte";
|
||||
import { onMount } from "svelte";
|
||||
import Form, { type FormConfig } from "util/Form.svelte"
|
||||
import { check_response, get_endpoint } from "lib/NovaAPI";
|
||||
|
||||
let dispatch = createEventDispatcher()
|
||||
let { on_login }: {
|
||||
on_login?: (login: {key: string}) => void;
|
||||
} = $props();
|
||||
|
||||
const form_login: FormConfig = {
|
||||
fields: [
|
||||
@@ -21,7 +23,7 @@ const form_login: FormConfig = {
|
||||
login.`
|
||||
},
|
||||
],
|
||||
submit_label: `<i class="icon">send</i> Login`,
|
||||
submit_label: `<i class="icon i_send"></i> Login`,
|
||||
on_submit: async (fields) => {
|
||||
username = fields.username
|
||||
password = fields.password
|
||||
@@ -37,7 +39,7 @@ const form_otp: FormConfig = {
|
||||
description: `Please enter the one-time password from your authenticator app`
|
||||
},
|
||||
],
|
||||
submit_label: `<i class="icon">send</i> Login`,
|
||||
submit_label: `<i class="icon i_send"></i> Login`,
|
||||
on_submit: async (fields) => {
|
||||
totp = fields.totp
|
||||
return await login()
|
||||
@@ -100,7 +102,7 @@ const login = async (e?: SubmitEvent) => {
|
||||
}
|
||||
}
|
||||
|
||||
dispatch("login", {key: resp.auth_key})
|
||||
on_login?.({key: resp.auth_key})
|
||||
|
||||
if (typeof login_redirect === "string" && login_redirect.startsWith("/")) {
|
||||
console.debug("redirecting user to requested path", login_redirect)
|
||||
|
||||
@@ -10,21 +10,21 @@ let page = $state("login")
|
||||
</script>
|
||||
<div class="tab_bar">
|
||||
<button onclick={() => page = "login"} class:button_highlight={page === "login"}>
|
||||
<i class="icon small">login</i>
|
||||
<i class="icon small i_login"></i>
|
||||
<span>Login</span>
|
||||
</button>
|
||||
|
||||
<button onclick={() => page = "register"} class:button_highlight={page === "register"}>
|
||||
<i class="icon small">how_to_reg</i>
|
||||
<i class="icon small i_how_to_reg"></i>
|
||||
<span>Register</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="page_content">
|
||||
{#if page === "login"}
|
||||
<Login on:login={finish_login}/>
|
||||
<Login on_login={finish_login}/>
|
||||
{:else if page === "register"}
|
||||
<Register on:login={finish_login}/>
|
||||
<Register/>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
@@ -35,4 +35,11 @@ let page = $state("login")
|
||||
font-size: 1.3em;
|
||||
justify-content: center;
|
||||
}
|
||||
.page_content {
|
||||
margin-top: 0; /* Attach the buttons to the body */
|
||||
width: calc(100% - 8px);
|
||||
max-width: 992px;
|
||||
margin: 0 auto 12px auto;
|
||||
padding: 8px;
|
||||
}
|
||||
</style>
|
||||
@@ -27,7 +27,7 @@ let form: FormConfig = {
|
||||
"prevent you from logging into your new account"
|
||||
},
|
||||
],
|
||||
submit_label: `<i class="icon">send</i> Register`,
|
||||
submit_label: `<i class="icon i_send"></i> Register`,
|
||||
on_submit: async fields => {
|
||||
if (fields.password !== fields.password2) {
|
||||
return {
|
||||
|
||||
+406
-149
@@ -1,187 +1,444 @@
|
||||
<script>
|
||||
import { preventDefault } from 'svelte/legacy';
|
||||
import { loading_finish, loading_start } from "lib/Loading";
|
||||
<script lang="ts">
|
||||
import { onMount } from "svelte";
|
||||
import { loading_run } from "lib/Loading";
|
||||
import { check_response, dict_to_form, get_endpoint, type UserSession } from "lib/NovaAPI";
|
||||
import { fs_get_node, type FSNode } from "lib/FilesystemAPI.svelte";
|
||||
import FilePicker from "filesystem/filemanager/FilePicker.svelte";
|
||||
import { formatDate } from "util/Formatting";
|
||||
import CopyButton from 'layout/CopyButton.svelte';
|
||||
import CopyButton from "layout/CopyButton.svelte";
|
||||
import NovaLogo from "util/NovaLogo.svelte";
|
||||
|
||||
let loaded = $state(false)
|
||||
let rows = $state([])
|
||||
// Each part of the API has a read and a write permission
|
||||
const components: [string, string, keyof UserSession, keyof UserSession][] = [
|
||||
["Files", "i_folder", "filesystem_read", "filesystem_write"],
|
||||
["Account", "i_person", "account_read", "account_write"],
|
||||
["API keys", "i_vpn_key", "session_read", "session_write"],
|
||||
["Billing", "i_receipt", "billing_read", "billing_write"],
|
||||
]
|
||||
|
||||
let keys: UserSession[] = $state([])
|
||||
|
||||
// The keys which are shown in full, the others are masked
|
||||
let shown: {[key: string]: boolean} = $state({})
|
||||
|
||||
// Names of the directories which keys are limited to, by directory ID
|
||||
let dir_names: {[id: string]: string} = $state({})
|
||||
|
||||
// The keys of which the whole user agent is shown
|
||||
let agent_shown: {[key: string]: boolean} = $state({})
|
||||
|
||||
// The key which is being edited, and what its permissions and directories are
|
||||
// going to be. Nothing changes until it is saved
|
||||
let editing = $state("")
|
||||
let edit_perms: {[name: string]: boolean} = $state({})
|
||||
let edit_dirs: string[] = $state([])
|
||||
let picker: FilePicker = $state()
|
||||
|
||||
const edit_key = (key: UserSession) => {
|
||||
editing = key.auth_key
|
||||
edit_dirs = [...key.filesystem_dirs]
|
||||
edit_perms = {}
|
||||
for (const [, , read, write] of components) {
|
||||
edit_perms[read] = key[read] as boolean
|
||||
edit_perms[write] = key[write] as boolean
|
||||
}
|
||||
}
|
||||
|
||||
const pick_dir = (nodes: FSNode[]) => {
|
||||
const dir = nodes[0]
|
||||
dir_names[dir.id] = dir.name
|
||||
if (!edit_dirs.includes(dir.id)) {
|
||||
edit_dirs.push(dir.id)
|
||||
}
|
||||
}
|
||||
|
||||
const save_key = async () => {
|
||||
try {
|
||||
await loading_run(async () => check_response(
|
||||
await fetch(get_endpoint() + "/user/session", {
|
||||
method: "PUT",
|
||||
body: dict_to_form({
|
||||
auth_key: editing,
|
||||
...edit_perms,
|
||||
filesystem_dirs: edit_dirs,
|
||||
}),
|
||||
})
|
||||
))
|
||||
} catch (err) {
|
||||
alert("Failed to change key: " + (err.message ?? err))
|
||||
return
|
||||
}
|
||||
|
||||
editing = ""
|
||||
await load_keys()
|
||||
}
|
||||
|
||||
// Intl.RelativeTimeFormat is the browser's formatter for "5 minutes ago", it
|
||||
// takes care of the plurals
|
||||
const relative = new Intl.RelativeTimeFormat("en", {numeric: "always", style: "short"})
|
||||
|
||||
// The server records the use of a key once per hour, so for the last used time
|
||||
// anything more exact than that would be made up
|
||||
const ago = (time: string) => {
|
||||
const seconds = (Date.now() - Date.parse(time)) / 1000
|
||||
if (seconds >= 86400) {
|
||||
return relative.format(-Math.floor(seconds / 86400), "day")
|
||||
} else if (seconds >= 3600) {
|
||||
return relative.format(-Math.floor(seconds / 3600), "hour")
|
||||
} else if (seconds >= 60) {
|
||||
return relative.format(-Math.floor(seconds / 60), "minute")
|
||||
}
|
||||
return "just now"
|
||||
}
|
||||
|
||||
const load_keys = async () => {
|
||||
loading_start()
|
||||
try {
|
||||
const resp = await fetch(window.api_endpoint+"/user/session")
|
||||
if(resp.status >= 400) {
|
||||
let json = await resp.json()
|
||||
if (json.value === "authentication_failed") {
|
||||
window.location = "/login"
|
||||
return
|
||||
} else {
|
||||
throw new Error(json.message)
|
||||
}
|
||||
}
|
||||
rows = await resp.json()
|
||||
rows.forEach(row => {
|
||||
row.creation_date = new Date(row.creation_time)
|
||||
row.last_used_date = new Date(row.last_used_time)
|
||||
})
|
||||
rows.sort((a, b) => {
|
||||
return b.last_used_date - a.last_used_date
|
||||
});
|
||||
const resp: UserSession[] = await loading_run(async () => check_response(
|
||||
await fetch(get_endpoint() + "/user/session")
|
||||
))
|
||||
|
||||
// The key of this session goes first, then the most recently used ones
|
||||
keys = resp.sort((a, b) =>
|
||||
Number(b.current) - Number(a.current) ||
|
||||
Date.parse(b.last_used_time) - Date.parse(a.last_used_time)
|
||||
)
|
||||
} catch (err) {
|
||||
alert(err)
|
||||
} finally {
|
||||
loading_finish()
|
||||
loaded = true
|
||||
alert("Failed to load API keys: " + (err.message ?? err))
|
||||
return
|
||||
}
|
||||
};
|
||||
|
||||
for (const id of new Set(keys.flatMap(key => key.filesystem_dirs))) {
|
||||
if (dir_names[id] === undefined) {
|
||||
// If the directory is gone the ID is shown instead
|
||||
fs_get_node("/" + id).then(p => dir_names[id] = p.path[0].name, () => {})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const create_key = async () => {
|
||||
loading_start()
|
||||
try {
|
||||
let form = new FormData()
|
||||
form.append("app_name", "website keys page")
|
||||
|
||||
const resp = await fetch(
|
||||
window.api_endpoint+"/user/session",
|
||||
{
|
||||
// Keys are made to be put in other programs, where they can leak. With
|
||||
// account write a key can change the password and the e-mail address,
|
||||
// which is enough to take the account over, so these don't get it
|
||||
const key: UserSession = await loading_run(async () => check_response(
|
||||
await fetch(get_endpoint() + "/user/session", {
|
||||
method: "POST",
|
||||
body: form,
|
||||
}
|
||||
);
|
||||
if(resp.status >= 400) {
|
||||
throw new Error(await resp.text());
|
||||
}
|
||||
body: dict_to_form({
|
||||
app_name: "website keys page",
|
||||
account_write: false,
|
||||
}),
|
||||
})
|
||||
))
|
||||
shown[key.auth_key] = true
|
||||
} catch (err) {
|
||||
alert("Failed to create new API key! "+err)
|
||||
} finally {
|
||||
loading_finish()
|
||||
alert("Failed to create new API key: " + (err.message ?? err))
|
||||
}
|
||||
|
||||
load_keys();
|
||||
await load_keys()
|
||||
}
|
||||
|
||||
const logout = async (key) => {
|
||||
loading_start()
|
||||
const delete_key = async (key: UserSession) => {
|
||||
if (key.current && !confirm(
|
||||
"This is the key you are logged in with. Deleting it logs you out. Continue?"
|
||||
)) {
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
const resp = await fetch(
|
||||
window.api_endpoint+"/user/session",
|
||||
{
|
||||
// A key is deleted by logging out with it
|
||||
await loading_run(async () => check_response(
|
||||
await fetch(get_endpoint() + "/user/session", {
|
||||
method: "DELETE",
|
||||
headers: {
|
||||
"Authorization": "Basic "+btoa(":"+key),
|
||||
}
|
||||
}
|
||||
);
|
||||
if(resp.status >= 400) {
|
||||
throw new Error(await resp.text());
|
||||
}
|
||||
headers: {"Authorization": "Basic " + btoa(":" + key.auth_key)},
|
||||
})
|
||||
))
|
||||
} catch (err) {
|
||||
alert("Failed to delete key: "+err)
|
||||
} finally {
|
||||
loading_finish()
|
||||
alert("Failed to delete key: " + (err.message ?? err))
|
||||
}
|
||||
|
||||
load_keys();
|
||||
if (key.current) {
|
||||
window.location.href = "/login"
|
||||
} else {
|
||||
await load_keys()
|
||||
}
|
||||
}
|
||||
|
||||
onMount(load_keys)
|
||||
</script>
|
||||
|
||||
<section>
|
||||
{#if !loaded}
|
||||
<div class="highlight_yellow">
|
||||
<h2>Warning</h2>
|
||||
<p>
|
||||
API keys are sensitive information. They can be used to gain
|
||||
full control over your account. Do not show your API keys to
|
||||
someone or something you don't trust!
|
||||
</p>
|
||||
<button class="button_red" onclick={load_keys}>
|
||||
<i class="icon">lock_open</i> Show API keys
|
||||
</button>
|
||||
</div>
|
||||
{:else}
|
||||
<div class="toolbar" style="text-align: left;">
|
||||
<div class="toolbar_spacer"></div>
|
||||
<button onclick={create_key}>
|
||||
<i class="icon">add</i> Create new API key
|
||||
</button>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<p>
|
||||
If you delete the API key that you are currently using you will be
|
||||
logged out of your account. Keys are sorted based on how recently they
|
||||
were used, so your session usually the top one. API keys expire 30 days
|
||||
after the last time they're used. If you think someone is using your
|
||||
account without your authorization it's probably a good idea to delete
|
||||
all your keys.
|
||||
API keys give apps access to your account. Whoever has a key can do
|
||||
everything the key is allowed to do, so don't show them to someone or
|
||||
something you don't trust. A key expires 30 days after it was last used.
|
||||
If you think someone is using your account without your permission,
|
||||
delete all your keys and change your password.
|
||||
</p>
|
||||
</section>
|
||||
<div class="table_scroll">
|
||||
<table style="text-align: left;">
|
||||
<thead>
|
||||
<tr>
|
||||
<td>Key</td>
|
||||
<td>Created</td>
|
||||
<td>Last used ▼</td>
|
||||
<td>IP address</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{#each rows as row (row.auth_key)}
|
||||
<tr style="border-bottom: none;">
|
||||
<td>
|
||||
<CopyButton text={row.auth_key} small_icon>Copy</CopyButton>
|
||||
{row.auth_key}
|
||||
</td>
|
||||
<td>{formatDate(row.creation_time, true, true, false)}</td>
|
||||
<td>{formatDate(row.last_used_time, true, true, false)}</td>
|
||||
<td>{row.creation_ip_address}</td>
|
||||
<td>
|
||||
<button onclick={(e) => {e.preventDefault();logout(row.auth_key)}} class="button button_red round">
|
||||
<i class="icon">delete</i>
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
{#if row.app_name === "website login"}
|
||||
<NovaLogo style="height: 1.6em; vertical-align: middle;"/>
|
||||
Nova website
|
||||
{:else if row.app_name === "website keys page"}
|
||||
<i class="icon">vpn_key</i>
|
||||
Nova keys page
|
||||
{:else if row.app_name === "sharex"}
|
||||
<img src="/res/img/sharex.png" alt="ShareX logo" class="app_icon"/>
|
||||
ShareX
|
||||
{:else if row.app_name === "jdownloader"}
|
||||
<img src="/res/img/jdownloader.png" alt="JDownloader logo" class="app_icon"/>
|
||||
JDownloader
|
||||
|
||||
<div class="toolbar">
|
||||
<div class="toolbar_spacer"></div>
|
||||
<button onclick={create_key}>
|
||||
<i class="icon i_add"></i> Create new API key
|
||||
</button>
|
||||
</div>
|
||||
|
||||
{#each keys as key (key.auth_key)}
|
||||
<div class="key" class:current={key.current}>
|
||||
<div class="row">
|
||||
<span class="app">
|
||||
{#if key.app_name === "website login"}
|
||||
<NovaLogo style="height: 1.5em;"/> Nova website
|
||||
{:else if key.app_name === "website keys page"}
|
||||
<i class="icon i_vpn_key"></i> Created on this page
|
||||
{:else if key.app_name === "sharex"}
|
||||
<img src="/res/img/sharex.png" alt=""/> ShareX
|
||||
{:else if key.app_name === "jdownloader"}
|
||||
<img src="/res/img/jdownloader.png" alt=""/> JDownloader
|
||||
{:else}
|
||||
<i class="icon i_apps"></i> {key.app_name || "Unnamed key"}
|
||||
{/if}
|
||||
</span>
|
||||
{#if key.current}
|
||||
<span class="badge">This session</span>
|
||||
{/if}
|
||||
<div class="toolbar_spacer"></div>
|
||||
<!-- Not the session which is in use. Without its permissions
|
||||
this page and the rest of the website stop working -->
|
||||
{#if !key.current && editing !== key.auth_key}
|
||||
<button onclick={() => edit_key(key)}>
|
||||
<i class="icon i_edit"></i> Edit
|
||||
</button>
|
||||
{/if}
|
||||
<button class="button_red" onclick={() => delete_key(key)}>
|
||||
<i class="icon i_delete"></i> Delete
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<code>
|
||||
{shown[key.auth_key] ? key.auth_key : key.auth_key.slice(0, 8) + "-••••-••••-••••-••••••••••••"}
|
||||
</code>
|
||||
<button
|
||||
class:button_highlight={shown[key.auth_key]}
|
||||
onclick={() => shown[key.auth_key] = !shown[key.auth_key]}
|
||||
>
|
||||
<i class="icon {shown[key.auth_key] ? 'i_visibility_off' : 'i_visibility'}"></i>
|
||||
{shown[key.auth_key] ? "Hide" : "Show"}
|
||||
</button>
|
||||
<CopyButton text={key.auth_key}>Copy</CopyButton>
|
||||
</div>
|
||||
|
||||
{#if editing === key.auth_key}
|
||||
<div class="edit">
|
||||
{#each components as [name, icon, read, write]}
|
||||
<div class="row">
|
||||
<span class="name"><i class="icon small {icon}"></i> {name}</span>
|
||||
<label>
|
||||
<input type="checkbox" bind:checked={edit_perms[read]}/> read
|
||||
</label>
|
||||
<!-- Account write can be taken away from a key, but
|
||||
not given to one -->
|
||||
{#if write !== "account_write" || key.account_write}
|
||||
<label>
|
||||
<input type="checkbox" bind:checked={edit_perms[write]}/> write
|
||||
</label>
|
||||
{/if}
|
||||
</div>
|
||||
{/each}
|
||||
|
||||
<div class="row">
|
||||
{#if edit_dirs.length === 0}
|
||||
<span>Files access is not limited to directories</span>
|
||||
{:else}
|
||||
Unknown app: {row.app_name}
|
||||
<span>Files access is limited to</span>
|
||||
{#each edit_dirs as id, index (id)}
|
||||
<span>
|
||||
<i class="icon small i_folder"></i>{dir_names[id] ?? id}
|
||||
<button onclick={() => edit_dirs.splice(index, 1)} title="Remove">
|
||||
<i class="icon small i_close"></i>
|
||||
</button>
|
||||
</span>
|
||||
{/each}
|
||||
{/if}
|
||||
</td>
|
||||
<td colspan="4">User-Agent: {row.user_agent}</td>
|
||||
</tr>
|
||||
{/each}
|
||||
</tbody>
|
||||
</table>
|
||||
<br/>
|
||||
</div>
|
||||
<button onclick={() => picker.open("/me")}>
|
||||
<i class="icon i_folder"></i>
|
||||
{edit_dirs.length === 0 ? "Limit to a directory" : "Add a directory"}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<button class="button_highlight" onclick={save_key}>
|
||||
<i class="icon i_save"></i> Save
|
||||
</button>
|
||||
<button onclick={() => editing = ""}>
|
||||
<i class="icon i_close"></i> Cancel
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
{:else}
|
||||
<div class="row permissions">
|
||||
{#each components as [name, icon, read, write]}
|
||||
<span class:none={!key[read] && !key[write]}>
|
||||
<i class="icon small {icon}"></i>
|
||||
{name}:
|
||||
{#if key[read] && key[write]}
|
||||
read / write
|
||||
{:else if key[read]}
|
||||
read only
|
||||
{:else if key[write]}
|
||||
write only
|
||||
{:else}
|
||||
no access
|
||||
{/if}
|
||||
</span>
|
||||
{/each}
|
||||
</div>
|
||||
{#if key.filesystem_dirs.length !== 0}
|
||||
<div class="row">
|
||||
<span>Files access is limited to</span>
|
||||
{#each key.filesystem_dirs as id}
|
||||
<a href="/d/{id}"><i class="icon small i_folder"></i>{dir_names[id] ?? id}</a>
|
||||
{/each}
|
||||
</div>
|
||||
{/if}
|
||||
{/if}
|
||||
|
||||
<div class="details">
|
||||
<div>
|
||||
<span>Created</span>
|
||||
{formatDate(key.creation_time, true, true, false)}
|
||||
({ago(key.creation_time)})
|
||||
</div>
|
||||
<div>
|
||||
<span>Last used</span>
|
||||
{formatDate(key.last_used_time, true, true, false)}
|
||||
({ago(key.last_used_time)})
|
||||
</div>
|
||||
<div>
|
||||
<span>IP address</span>
|
||||
{key.creation_ip_address}
|
||||
</div>
|
||||
<div class="agent" class:agent_shown={agent_shown[key.auth_key]}>
|
||||
<span>User agent</span>
|
||||
<button
|
||||
aria-expanded={!!agent_shown[key.auth_key]}
|
||||
onclick={() => agent_shown[key.auth_key] = !agent_shown[key.auth_key]}
|
||||
>
|
||||
{key.user_agent}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/each}
|
||||
</section>
|
||||
|
||||
<FilePicker bind:this={picker} callback={pick_dir} directories/>
|
||||
|
||||
<style>
|
||||
.toolbar {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
width: 100%;
|
||||
}
|
||||
.toolbar > * { flex: 0 0 auto; }
|
||||
.toolbar_spacer { flex: 1 1 auto; }
|
||||
.toolbar_spacer {
|
||||
flex: 1 1 auto;
|
||||
}
|
||||
|
||||
.app_icon {
|
||||
height: 1.6em;
|
||||
vertical-align: middle;
|
||||
.key {
|
||||
margin: 0.8em 0;
|
||||
padding: 0.4em 0.6em;
|
||||
border-radius: 8px;
|
||||
border-left: 3px solid var(--separator);
|
||||
background: var(--card_color);
|
||||
}
|
||||
.key.current {
|
||||
border-left-color: var(--accent_color);
|
||||
}
|
||||
.row {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: 0.2em 0.5em;
|
||||
margin: 0.3em 0;
|
||||
}
|
||||
|
||||
/* An icon with text next to it. Flex centres the two on each other, inline
|
||||
layout would put the icon on the baseline of the text */
|
||||
.app,
|
||||
.permissions > span,
|
||||
.row > a,
|
||||
.edit label,
|
||||
.edit span {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 0.3em;
|
||||
}
|
||||
/* The name of a permission, in front of its checkboxes */
|
||||
.name {
|
||||
min-width: 6em;
|
||||
}
|
||||
.app {
|
||||
font-size: 1.1em;
|
||||
}
|
||||
.app > img {
|
||||
height: 1.5em;
|
||||
}
|
||||
.badge {
|
||||
padding: 0 0.6em;
|
||||
border-radius: 1em;
|
||||
color: var(--link_color);
|
||||
background: var(--accent_shade);
|
||||
}
|
||||
|
||||
/* The key takes the space the buttons leave, and is cut off when it doesn't
|
||||
fit. It can still be copied in full */
|
||||
code {
|
||||
flex: 1 1 10em;
|
||||
padding: 0.3em 0.5em;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.permissions > span {
|
||||
padding: 0.1em 0.5em;
|
||||
border: 1px solid var(--separator);
|
||||
border-radius: 6px;
|
||||
}
|
||||
.none,
|
||||
.details span {
|
||||
opacity: 0.6;
|
||||
}
|
||||
|
||||
/* Each detail is a label with its value below it */
|
||||
.details {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 0.2em 1.5em;
|
||||
font-size: 0.9em;
|
||||
}
|
||||
.details > div {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
/* The user agent gets the space which is left, and is cut off until it is
|
||||
clicked. It's a button so it works with a keyboard too, without the looks of
|
||||
one */
|
||||
.agent {
|
||||
flex: 1 1 10em;
|
||||
min-width: 0;
|
||||
}
|
||||
.agent > button {
|
||||
all: unset;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
cursor: pointer;
|
||||
}
|
||||
.agent_shown {
|
||||
flex-basis: 100%;
|
||||
}
|
||||
.agent_shown > button {
|
||||
white-space: normal;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
</style>
|
||||
@@ -9,7 +9,7 @@ import { user } from "lib/UserStore";
|
||||
|
||||
let affiliate_link = $derived(
|
||||
window.location.protocol+"//"+window.location.host +
|
||||
"?ref=" + encodeURIComponent($user.username)
|
||||
"/user?ref=" + encodeURIComponent($user.username)
|
||||
)
|
||||
let affiliate_deny = $state(false)
|
||||
onMount(() => {
|
||||
@@ -74,7 +74,7 @@ let account_settings: FormConfig = $derived({
|
||||
separator: true,
|
||||
},
|
||||
],
|
||||
submit_label: `<i class="icon">save</i> Save`,
|
||||
submit_label: `<i class="icon i_save"></i> Save`,
|
||||
on_submit: async fields => {
|
||||
if (fields.password_new1 != fields.password_new2) {
|
||||
return {
|
||||
@@ -122,7 +122,7 @@ let affiliate_settings: FormConfig = $derived({
|
||||
extra.`,
|
||||
},
|
||||
],
|
||||
submit_label: `<i class="icon">save</i> Save`,
|
||||
submit_label: `<i class="icon i_save"></i> Save`,
|
||||
on_submit: async fields => {
|
||||
const form = new FormData()
|
||||
form.append("affiliate_user_name", fields.affiliate_user_name)
|
||||
@@ -167,7 +167,7 @@ let delete_account: FormConfig = {
|
||||
},
|
||||
],
|
||||
submit_red: true,
|
||||
submit_label: `<i class="icon">delete</i> Delete`,
|
||||
submit_label: `<i class="icon i_delete"></i> Delete`,
|
||||
on_submit: async fields => {
|
||||
const resp = await fetch(
|
||||
get_endpoint()+"/user",
|
||||
|
||||
@@ -67,13 +67,13 @@ onMount(() => {
|
||||
<h3>{month_str}</h3>
|
||||
<div class="toolbar">
|
||||
<button onclick={last_month}>
|
||||
<i class="icon">chevron_left</i>
|
||||
<i class="icon i_chevron_left"></i>
|
||||
Previous month
|
||||
</button>
|
||||
<div class="toolbar_spacer"></div>
|
||||
<button onclick={next_month}>
|
||||
Next month
|
||||
<i class="icon">chevron_right</i>
|
||||
<i class="icon i_chevron_right"></i>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@@ -119,13 +119,13 @@ onMount(() => {
|
||||
{#if data.length > 100}
|
||||
<div class="toolbar">
|
||||
<button onclick={last_month}>
|
||||
<i class="icon">chevron_left</i>
|
||||
<i class="icon i_chevron_left"></i>
|
||||
Previous month
|
||||
</button>
|
||||
<div class="toolbar_spacer"></div>
|
||||
<button onclick={next_month}>
|
||||
Next month
|
||||
<i class="icon">chevron_right</i>
|
||||
<i class="icon i_chevron_right"></i>
|
||||
</button>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
@@ -74,10 +74,10 @@ const deny = () => {
|
||||
<Modal bind:this={modal} title="Affiliate sponsoring request" width="700px">
|
||||
<section>
|
||||
<p>
|
||||
Hi! {referral} wants you to sponsor their Nova account. This
|
||||
will give them €0.50 every month in Nova prepaid credit. They
|
||||
can use this credit to get a discount on their file storage and
|
||||
sharing costs. Here is a short summary of what this entails:
|
||||
Hi! {referral} wants you to sponsor their Nova account. This will
|
||||
give them €0.01 every day in Nova prepaid credit. They can use this
|
||||
credit to get a discount on their file storage and sharing costs.
|
||||
Here is a short summary of what this entails:
|
||||
</p>
|
||||
<ul>
|
||||
<li>
|
||||
@@ -97,10 +97,6 @@ const deny = () => {
|
||||
You can change who you are sponsoring at any time on your <a
|
||||
href="/user/settings">account settings page</a>.
|
||||
</li>
|
||||
<li>
|
||||
If you want to know more about the affiliate program check out
|
||||
the <a href="/about#toc_12">Q&A page</a>.
|
||||
</li>
|
||||
</ul>
|
||||
<p>
|
||||
If you click 'Accept' then the requested affiliate code will be
|
||||
|
||||
@@ -52,7 +52,7 @@ let app_name = $derived(() => {
|
||||
<!-- Show a back button if an app is selected -->
|
||||
{#if app_name}
|
||||
<a href="/user/connect_app" class="button">
|
||||
<i class="icon">arrow_back</i>
|
||||
<i class="icon i_arrow_back"></i>
|
||||
Back to apps
|
||||
</a>
|
||||
{/if}
|
||||
@@ -92,7 +92,7 @@ let app_name = $derived(() => {
|
||||
{#if !api_key}
|
||||
<div class="center">
|
||||
<button class="button_highlight" onclick={create_key}>
|
||||
<i class="icon">add</i>
|
||||
<i class="icon i_add"></i>
|
||||
Generate key
|
||||
</button>
|
||||
</div>
|
||||
@@ -102,7 +102,7 @@ let app_name = $derived(() => {
|
||||
<div class="copy_container">
|
||||
<CopyButton text={api_key}>Copy key to clipboard</CopyButton>
|
||||
<button onclick={toggle_show_key} class="copy_button" class:button_highlight={show_key !== ""}>
|
||||
<i class="icon">visibility</i>
|
||||
<i class="icon i_visibility"></i>
|
||||
{#if show_key === ""}
|
||||
Show key
|
||||
{:else}
|
||||
@@ -146,7 +146,7 @@ let app_name = $derived(() => {
|
||||
|
||||
<div class="center">
|
||||
<a href="/misc/sharex/nova.storage.sxcu" class="button button_highlight">
|
||||
<i class="icon small">save</i>
|
||||
<i class="icon small i_save"></i>
|
||||
Download ShareX Uploader
|
||||
</a>
|
||||
</div>
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
import ProgressBar from "util/ProgressBar.svelte";
|
||||
import { formatDataVolume, formatEuros } from "util/Formatting"
|
||||
import { user } from "lib/UserStore";
|
||||
import { bills_extra } from "lib/NovaAPI";
|
||||
|
||||
let { total = 0, used = 0 }: {
|
||||
total?: number;
|
||||
@@ -10,12 +11,15 @@ let { total = 0, used = 0 }: {
|
||||
|
||||
let frac = $derived(used / total)
|
||||
let bill_shock = $derived($user !== null && $user.monthly_transfer_cap === total)
|
||||
let billable = $derived($user !== null && $user.subscription.price_per_tb_bandwidth > 0)
|
||||
let billed = $derived(billable && $user.usage_based_billing)
|
||||
let price = $derived($user === null ? 0 : $user.subscription.price_per_tb_bandwidth)
|
||||
let billed = $derived($user !== null && bills_extra($user, price))
|
||||
|
||||
// Usage based billing is on, but the balance is too far below zero for it
|
||||
let overdrawn = $derived($user !== null && $user.usage_based_billing && price > 0 && !billed)
|
||||
let included = $derived($user === null ? 0 : $user.subscription.monthly_transfer_cap)
|
||||
</script>
|
||||
|
||||
<ProgressBar total={total} used={used}></ProgressBar>
|
||||
<ProgressBar total={total} used={used} warn></ProgressBar>
|
||||
<div class="gauge_labels">
|
||||
<div>
|
||||
{formatDataVolume(used, 3)}
|
||||
@@ -47,17 +51,25 @@ let included = $derived($user === null ? 0 : $user.subscription.monthly_transfer
|
||||
</p>
|
||||
{#if bill_shock}
|
||||
<p>
|
||||
This is your bill shock limit. <a href="/user/sharing">Increase
|
||||
This is your bill shock limit. <a href="/user/subscription/metered_billing">Increase
|
||||
or disable the limit</a> to continue sharing files.
|
||||
</p>
|
||||
{:else if overdrawn}
|
||||
<p>
|
||||
Your balance is too far below zero to bill more data transfer.
|
||||
Top up your credit to continue sharing files.
|
||||
</p>
|
||||
<a class="button button_highlight" href="/user/subscription/manage">
|
||||
<i class="icon i_paid"></i> Top up credit
|
||||
</a>
|
||||
{:else}
|
||||
<p>
|
||||
Upgrade your plan or enable
|
||||
<a href="/user/sharing">usage based billing</a> to continue
|
||||
<a href="/user/subscription/metered_billing">usage based billing</a> to continue
|
||||
sharing files.
|
||||
</p>
|
||||
<a class="button button_highlight" href="/user/subscription/manage">
|
||||
<i class="icon">bolt</i> Upgrade options
|
||||
<i class="icon i_bolt"></i> Upgrade options
|
||||
</a>
|
||||
{/if}
|
||||
</div>
|
||||
@@ -70,11 +82,11 @@ let included = $derived($user === null ? 0 : $user.subscription.monthly_transfer
|
||||
{#if bill_shock}
|
||||
<p>
|
||||
This is your bill shock limit, you can change it in the
|
||||
<a href="/user/sharing">sharing settings</a>.
|
||||
<a href="/user/subscription/metered_billing">subscription settings</a>.
|
||||
</p>
|
||||
{:else}
|
||||
<a class="button button_highlight" href="/user/subscription/manage">
|
||||
<i class="icon">bolt</i> Upgrade options
|
||||
<i class="icon i_bolt"></i> Upgrade options
|
||||
</a>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
@@ -11,6 +11,8 @@ import { onMount } from "svelte";
|
||||
import { get_user, type User } from "lib/NovaAPI";
|
||||
import SharingSettings from "./SharingSettings.svelte";
|
||||
import SubscriptionManage from "./SubscriptionManage.svelte";
|
||||
import SubscriptionUsage from "./SubscriptionUsage.svelte";
|
||||
import RemoteSync from "./remote_sync/RemoteSync.svelte";
|
||||
|
||||
let pages: Tab[] = [
|
||||
{
|
||||
@@ -39,6 +41,11 @@ let pages: Tab[] = [
|
||||
title: "Transactions",
|
||||
icon: "receipt",
|
||||
component: Transactions,
|
||||
}, {
|
||||
path: "/user/subscription/metered_billing",
|
||||
title: "Metered billing",
|
||||
icon: "data_usage",
|
||||
component: SubscriptionUsage,
|
||||
},
|
||||
],
|
||||
}, {
|
||||
@@ -46,6 +53,11 @@ let pages: Tab[] = [
|
||||
title: "Sharing settings",
|
||||
icon: "share",
|
||||
component: SharingSettings,
|
||||
}, {
|
||||
path: "/user/remote_sync",
|
||||
title: "Remote sync",
|
||||
icon: "sync_alt",
|
||||
component: RemoteSync,
|
||||
}, {
|
||||
path: "/user/connect_app",
|
||||
title: "Apps",
|
||||
|
||||
@@ -1,14 +1,10 @@
|
||||
<script lang="ts">
|
||||
import { onMount } from "svelte";
|
||||
import { formatDataVolume, formatEuros } from "util/Formatting";
|
||||
import ProgressBar from "util/ProgressBar.svelte";
|
||||
import { loading_run } from "lib/Loading";
|
||||
import { get_endpoint, put_user } from 'lib/NovaAPI';
|
||||
import { put_user } from 'lib/NovaAPI';
|
||||
import SuccessMessage from 'util/SuccessMessage.svelte';
|
||||
import { user } from "lib/UserStore";
|
||||
|
||||
let success_message: SuccessMessage = $state()
|
||||
let transfer_cap = $state($user === null ? 0 : $user.monthly_transfer_cap / 1e12)
|
||||
|
||||
const update_user = async (e: SubmitEvent) => {
|
||||
if (e !== null) {
|
||||
@@ -16,10 +12,7 @@ const update_user = async (e: SubmitEvent) => {
|
||||
}
|
||||
loading_run(async () => {
|
||||
try {
|
||||
await put_user({
|
||||
transfer_cap: transfer_cap*1e12,
|
||||
embed_domains: embed_domains.join(" "),
|
||||
})
|
||||
await put_user({embed_domains: embed_domains.join(" ")})
|
||||
|
||||
success_message.set(true, "Sharing settings updated")
|
||||
} catch (err) {
|
||||
@@ -28,40 +21,6 @@ const update_user = async (e: SubmitEvent) => {
|
||||
})
|
||||
}
|
||||
|
||||
const set_usage_based_billing = (e: Event) => {
|
||||
const input = e.target as HTMLInputElement
|
||||
loading_run(async () => {
|
||||
try {
|
||||
await put_user({usage_based_billing: input.checked})
|
||||
success_message.set(true, "Usage based billing updated")
|
||||
} catch (err) {
|
||||
input.checked = !input.checked
|
||||
success_message.set(false, "Failed to update user: "+err)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
let transfer_used = $state(0)
|
||||
let load_transfer_used = () => {
|
||||
let today = new Date()
|
||||
let start = new Date()
|
||||
start.setDate(start.getDate() - 30)
|
||||
|
||||
fetch(
|
||||
get_endpoint() + "/user/time_series/egress" +
|
||||
"?start=" + start.toISOString() +
|
||||
"&end=" + today.toISOString() +
|
||||
"&interval=60"
|
||||
).then(resp => {
|
||||
if (!resp.ok) { return Promise.reject("Error: " + resp.status); }
|
||||
return resp.json();
|
||||
}).then(resp => {
|
||||
transfer_used = resp.amounts.reduce((acc, cur) => { return acc + cur }, 0)
|
||||
}).catch(e => {
|
||||
console.error("Error requesting time series: " + e);
|
||||
})
|
||||
}
|
||||
|
||||
// Embedding settings
|
||||
let embed_domains: string[] = $state($user === null ? [] : $user.embed_domains.split(" "))
|
||||
let new_domain: string = $state("")
|
||||
@@ -79,58 +38,11 @@ const del_domain = (index: number) => {
|
||||
embed_domains = embed_domains
|
||||
update_user(null)
|
||||
}
|
||||
|
||||
onMount(async () => {
|
||||
load_transfer_used()
|
||||
})
|
||||
</script>
|
||||
|
||||
<section>
|
||||
<SuccessMessage bind:this={success_message}/>
|
||||
|
||||
{#if $user !== null && $user.subscription.type === "subscription"}
|
||||
<h2>Usage based billing</h2>
|
||||
<p>
|
||||
When your storage or data transfer goes over the limits of your
|
||||
plan, uploads and downloads are blocked. With usage based billing
|
||||
they keep working and the usage above the limits is billed at
|
||||
{formatEuros($user.subscription.price_per_tb_storage, 2)} per TB per
|
||||
month for storage and
|
||||
{formatEuros($user.subscription.price_per_tb_bandwidth, 2)} per TB
|
||||
for data transfer.
|
||||
</p>
|
||||
<label>
|
||||
<input type="checkbox" checked={$user.usage_based_billing} onchange={set_usage_based_billing}/>
|
||||
Enable usage based billing
|
||||
</label>
|
||||
{/if}
|
||||
|
||||
<h2>Bill shock limit</h2>
|
||||
<p>
|
||||
Billshock limit in terabytes per month (1 TB = 1000 GB). Set to 0 to
|
||||
disable.
|
||||
</p>
|
||||
<form onsubmit={update_user} class="billshock_container">
|
||||
<input type="number" bind:value={transfer_cap} step="0.1" min="0" style="width: 5em;"/>
|
||||
<div style="margin: 0.5em;">TB</div>
|
||||
<button type="submit">
|
||||
<i class="icon">save</i> Save
|
||||
</button>
|
||||
</form>
|
||||
|
||||
<p>
|
||||
Bandwidth used in the last 30 days: {formatDataVolume(transfer_used, 3)},
|
||||
new limit: {formatDataVolume(transfer_cap*1e12, 3)}
|
||||
</p>
|
||||
<ProgressBar used={transfer_used} total={transfer_cap*1e12}></ProgressBar>
|
||||
<p>
|
||||
The billshock limit limits how much bandwidth your account can use in a
|
||||
30 day window. When this limit is reached hotlinking will be disabled
|
||||
and you will no longer be charged for bandwidth usage. This is mostly
|
||||
useful for the Prepaid subscription, but it works for Patreon plans too.
|
||||
Set to 0 to disable the limit.
|
||||
</p>
|
||||
|
||||
<h2>Embedding controls</h2>
|
||||
<p>
|
||||
Here you can control which websites are allowed to embed your files in
|
||||
@@ -144,7 +56,7 @@ onMount(async () => {
|
||||
<div class="form_row">
|
||||
<span>Add domain name</span>
|
||||
<input class="grow" bind:value={new_domain} type="text"/>
|
||||
<button class="shrink" type="submit"><i class="icon">add</i> Add</button>
|
||||
<button class="shrink" type="submit"><i class="icon i_add"></i> Add</button>
|
||||
</div>
|
||||
</form>
|
||||
<hr/>
|
||||
@@ -155,8 +67,8 @@ onMount(async () => {
|
||||
{/if}
|
||||
{#each embed_domains as domain, index}
|
||||
<div class="form_row">
|
||||
<button class="shrink" type="button" onclick={() => del_domain(index)}>
|
||||
<i class="icon">delete</i>
|
||||
<button class="shrink" type="button" onclick={() => del_domain(index)} title="Remove">
|
||||
<i class="icon i_delete"></i>
|
||||
</button>
|
||||
<div>{domain}</div>
|
||||
</div>
|
||||
@@ -165,12 +77,6 @@ onMount(async () => {
|
||||
</section>
|
||||
|
||||
<style>
|
||||
.billshock_container {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.highlight_border {
|
||||
text-align: initial;
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
import { formatDataVolume, formatEuros } from "util/Formatting"
|
||||
import ProgressBar from "util/ProgressBar.svelte";
|
||||
import { user } from "lib/UserStore";
|
||||
import { bills_extra } from "lib/NovaAPI";
|
||||
|
||||
let { total = 0, used = 0 }: {
|
||||
total?: number;
|
||||
@@ -9,11 +10,14 @@ let { total = 0, used = 0 }: {
|
||||
} = $props();
|
||||
|
||||
let frac = $derived(total <= 0 ? 0 : used / total)
|
||||
let billable = $derived($user !== null && $user.subscription.price_per_tb_storage > 0)
|
||||
let billed = $derived(billable && $user.usage_based_billing)
|
||||
let price = $derived($user === null ? 0 : $user.subscription.price_per_tb_storage)
|
||||
let billed = $derived($user !== null && bills_extra($user, price))
|
||||
|
||||
// Usage based billing is on, but the balance is too far below zero for it
|
||||
let overdrawn = $derived($user !== null && $user.usage_based_billing && price > 0 && !billed)
|
||||
</script>
|
||||
|
||||
<ProgressBar total={total} used={used}></ProgressBar>
|
||||
<ProgressBar total={total} used={used} warn></ProgressBar>
|
||||
<div class="gauge_labels">
|
||||
<div>
|
||||
{formatDataVolume(used, 3)}
|
||||
@@ -35,17 +39,28 @@ let billed = $derived(billable && $user.usage_based_billing)
|
||||
month.
|
||||
</p>
|
||||
{/if}
|
||||
{:else if frac > 1 && overdrawn}
|
||||
<div class="highlight_yellow">
|
||||
<p>
|
||||
You are storing more than your plan includes, and your balance is
|
||||
too far below zero to bill more storage. You can't upload new files
|
||||
until you top up your credit. Your existing files stay available.
|
||||
</p>
|
||||
<a class="button button_highlight" href="/user/subscription/manage">
|
||||
<i class="icon i_paid"></i> Top up credit
|
||||
</a>
|
||||
</div>
|
||||
{:else if frac > 1}
|
||||
<div class="highlight_yellow">
|
||||
<p>
|
||||
You are storing more than your plan allows, so you can't upload new
|
||||
files. Your existing files stay available. Delete some files or
|
||||
upgrade your plan to continue uploading, or enable
|
||||
<a href="/user/sharing">usage based billing</a> to pay for the
|
||||
<a href="/user/subscription/metered_billing">usage based billing</a> to pay for the
|
||||
storage above the limit.
|
||||
</p>
|
||||
<a class="button button_highlight" href="/user/subscription/manage">
|
||||
<i class="icon">bolt</i> Upgrade options
|
||||
<i class="icon i_bolt"></i> Upgrade options
|
||||
</a>
|
||||
</div>
|
||||
{:else if frac > 0.8}
|
||||
@@ -55,7 +70,7 @@ let billed = $derived(billable && $user.usage_based_billing)
|
||||
it runs out you won't be able to upload new files anymore.
|
||||
</p>
|
||||
<a class="button button_highlight" href="/user/subscription/manage">
|
||||
<i class="icon">bolt</i> Upgrade options
|
||||
<i class="icon i_bolt"></i> Upgrade options
|
||||
</a>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
@@ -129,11 +129,11 @@ onMount(async () => {
|
||||
<td>
|
||||
{#if row.status === "open"}
|
||||
<a href="/api/user/invoice/{row.id}/pay" class="button button_highlight">
|
||||
<i class="icon">paid</i> Pay
|
||||
<i class="icon i_paid"></i> Pay
|
||||
</a>
|
||||
{/if}
|
||||
<a href="/api/user/invoice/{row.id}/pdf" target="_blank" class="button">
|
||||
<i class="icon">description</i> PDF
|
||||
<i class="icon i_description"></i> PDF
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -0,0 +1,101 @@
|
||||
<script lang="ts">
|
||||
import { formatDataVolume, formatEuros } from "util/Formatting";
|
||||
import ProgressBar from "util/ProgressBar.svelte";
|
||||
import { loading_run } from "lib/Loading";
|
||||
import { period_price, put_user } from "lib/NovaAPI";
|
||||
import SuccessMessage from "util/SuccessMessage.svelte";
|
||||
import { user } from "lib/UserStore";
|
||||
import ToggleButton from "layout/ToggleButton.svelte";
|
||||
|
||||
let success_message: SuccessMessage = $state()
|
||||
|
||||
// The toggle button has already flipped the value in the user store when this
|
||||
// runs. put_user reloads the store from the server, so only a failed request
|
||||
// has to flip it back
|
||||
const set_usage_based_billing = () => {
|
||||
loading_run(async () => {
|
||||
try {
|
||||
await put_user({usage_based_billing: $user.usage_based_billing})
|
||||
success_message.set(true, "Usage based billing updated")
|
||||
} catch (err) {
|
||||
$user.usage_based_billing = !$user.usage_based_billing
|
||||
success_message.set(false, "Failed to update user: "+(err?.message ?? err))
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
let transfer_cap = $state($user === null ? 0 : $user.monthly_transfer_cap / 1e12)
|
||||
let transfer_used = $derived($user === null ? 0 : $user.monthly_transfer_used)
|
||||
|
||||
const set_transfer_cap = (e: SubmitEvent) => {
|
||||
e.preventDefault()
|
||||
loading_run(async () => {
|
||||
try {
|
||||
await put_user({transfer_cap: transfer_cap*1e12})
|
||||
success_message.set(true, "Bill shock limit updated")
|
||||
} catch (err) {
|
||||
success_message.set(false, "Failed to update user: "+(err?.message ?? err))
|
||||
}
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<section>
|
||||
<SuccessMessage bind:this={success_message}/>
|
||||
|
||||
{#if $user !== null && $user.subscription.type === "subscription"}
|
||||
<h2>Usage based billing</h2>
|
||||
<p>
|
||||
When your storage or data transfer goes over the limits of your
|
||||
plan, uploads and downloads are blocked. With usage based billing
|
||||
they keep working and the usage above the limits is billed at
|
||||
{formatEuros($user.subscription.price_per_tb_storage, 2)} per TB per
|
||||
month for storage and
|
||||
{formatEuros($user.subscription.price_per_tb_bandwidth, 2)} per TB
|
||||
for data transfer.
|
||||
</p>
|
||||
<p>
|
||||
This usage is charged from your account credit afterwards. When
|
||||
your balance is more than {formatEuros(period_price($user), 2)} below zero
|
||||
(the price of your subscription period) the limits of your plan
|
||||
apply again, until you top up your credit.
|
||||
</p>
|
||||
<ToggleButton bind:on={$user.usage_based_billing} action={set_usage_based_billing}>
|
||||
Usage based billing
|
||||
</ToggleButton>
|
||||
{/if}
|
||||
|
||||
<h2>Bill shock limit</h2>
|
||||
<p>
|
||||
Billshock limit in terabytes per month (1 TB = 1000 GB). Set to 0 to
|
||||
disable.
|
||||
</p>
|
||||
<form onsubmit={set_transfer_cap} class="billshock_container">
|
||||
<input type="number" bind:value={transfer_cap} step="0.1" min="0" style="width: 5em;"/>
|
||||
<div style="margin: 0.5em;">TB</div>
|
||||
<button type="submit">
|
||||
<i class="icon i_save"></i> Save
|
||||
</button>
|
||||
</form>
|
||||
|
||||
<p>
|
||||
Bandwidth used in the last 30 days: {formatDataVolume(transfer_used, 3)},
|
||||
new limit: {formatDataVolume(transfer_cap*1e12, 3)}
|
||||
</p>
|
||||
<ProgressBar used={transfer_used} total={transfer_cap*1e12} warn></ProgressBar>
|
||||
<p>
|
||||
The billshock limit limits how much bandwidth your account can use in a
|
||||
30 day window. When this limit is reached your files can't be downloaded
|
||||
until your usage drops below it, and you will no longer be charged for
|
||||
bandwidth usage. This is mostly useful with usage based billing, but it
|
||||
works without it too. Set to 0 to disable the limit.
|
||||
</p>
|
||||
</section>
|
||||
|
||||
<style>
|
||||
.billshock_container {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
}
|
||||
</style>
|
||||
@@ -99,11 +99,13 @@ onMount(() => {
|
||||
<h2>Transaction log</h2>
|
||||
<p>
|
||||
Here is a log of all transactions on your account balance. Usage is
|
||||
calculated per day. The storage charge is divided by the average number
|
||||
of days in a month (30.4375).
|
||||
calculated per day. Storage and bandwidth are only charged for what you
|
||||
use above the amounts included in your plan, and that is the usage which
|
||||
is listed here. The storage charge is divided by the average number of
|
||||
days in a month (30.4375).
|
||||
</p>
|
||||
<p>
|
||||
Example: If you have 2 TB stored on your Nova account at €4 per TB
|
||||
Example: If you store 2 TB more than your plan includes at €4 per TB
|
||||
then the daily charge will be:<br/>
|
||||
|
||||
2 TB * € 4 = € 8<br/>
|
||||
@@ -114,13 +116,13 @@ onMount(() => {
|
||||
<h3>{month_str}</h3>
|
||||
<div class="toolbar">
|
||||
<button onclick={last_month}>
|
||||
<i class="icon">chevron_left</i>
|
||||
<i class="icon i_chevron_left"></i>
|
||||
Previous month
|
||||
</button>
|
||||
<div class="toolbar_spacer"></div>
|
||||
<button onclick={next_month}>
|
||||
Next month
|
||||
<i class="icon">chevron_right</i>
|
||||
<i class="icon i_chevron_right"></i>
|
||||
</button>
|
||||
</div>
|
||||
<ul>
|
||||
@@ -129,11 +131,11 @@ onMount(() => {
|
||||
</li>
|
||||
<li>
|
||||
Storage charge: <Euro amount={transactions.total_storage_charge} precision="4"/>
|
||||
(used {formatDataVolume(transactions.total_storage_used, 3)})
|
||||
({formatDataVolume(transactions.total_storage_used, 3)} above your plan)
|
||||
</li>
|
||||
<li>
|
||||
Bandwidth charge: <Euro amount={transactions.total_bandwidth_charge} precision="4"/>
|
||||
(used {formatDataVolume(transactions.total_bandwidth_used, 3)})
|
||||
({formatDataVolume(transactions.total_bandwidth_used, 3)} above your plan)
|
||||
</li>
|
||||
<li>
|
||||
Total charge: <Euro amount={transactions.total_deducted} precision="4"/>
|
||||
|
||||
@@ -18,7 +18,7 @@ import { user } from "lib/UserStore";
|
||||
</li>
|
||||
{/if}
|
||||
<li>
|
||||
<i class="icon">settings</i>
|
||||
<i class="icon i_settings"></i>
|
||||
<a href="/user/settings">Account settings</a>
|
||||
</li>
|
||||
</ul>
|
||||
@@ -28,11 +28,11 @@ import { user } from "lib/UserStore";
|
||||
|
||||
<div class="button_row">
|
||||
<a href="/d/me" class="button">
|
||||
<i class="icon">folder</i>
|
||||
<i class="icon i_folder"></i>
|
||||
Filesystem
|
||||
</a>
|
||||
<button onclick={()=> logout_user("/")}>
|
||||
<i class="icon">logout</i>
|
||||
<i class="icon i_logout"></i>
|
||||
Log out
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@@ -59,11 +59,11 @@ onMount(() => {
|
||||
</script>
|
||||
|
||||
<div class="toolbar">
|
||||
<Button click={last_month} icon="chevron_left"/>
|
||||
<Button click={last_month} icon="chevron_left" title="Previous month"/>
|
||||
<div class="toolbar_spacer">
|
||||
{month_str}
|
||||
</div>
|
||||
<Button click={next_month} icon="chevron_right"/>
|
||||
<Button click={next_month} icon="chevron_right" title="Next month"/>
|
||||
</div>
|
||||
|
||||
{#if data.length === 0}
|
||||
|
||||
@@ -108,11 +108,11 @@ onMount(() => {
|
||||
</script>
|
||||
|
||||
<div class="toolbar">
|
||||
<Button click={last_month} icon="chevron_left"/>
|
||||
<Button click={last_month} icon="chevron_left" title="Previous month"/>
|
||||
<div class="toolbar_spacer">
|
||||
{month_str}
|
||||
</div>
|
||||
<Button click={next_month} icon="chevron_right"/>
|
||||
<Button click={next_month} icon="chevron_right" title="Next month"/>
|
||||
</div>
|
||||
|
||||
<table>
|
||||
@@ -137,14 +137,14 @@ onMount(() => {
|
||||
<td>Storage charge</td>
|
||||
<td>
|
||||
<Euro amount={transactions.total_storage_charge} precision="4"/>
|
||||
(used {formatDataVolume(transactions.total_storage_used, 3)})
|
||||
({formatDataVolume(transactions.total_storage_used, 3)} above your plan)
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Bandwidth charge</td>
|
||||
<td>
|
||||
<Euro amount={transactions.total_bandwidth_charge} precision="4"/>
|
||||
(used {formatDataVolume(transactions.total_bandwidth_used, 3)})
|
||||
({formatDataVolume(transactions.total_bandwidth_used, 3)} above your plan)
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
||||
Loaded 100 of 118 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user