Compare commits
15
Commits
93d5583940
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ca5342d7fa | ||
|
|
ee06b91b92 | ||
|
|
b423446412 | ||
|
|
5788f5a8b4 | ||
|
|
672a19f8f6 | ||
|
|
1956790dde | ||
|
|
ebb72c7f24 | ||
|
|
5b32f3dca7 | ||
|
|
9f8a985c63 | ||
|
|
8a41307700 | ||
|
|
e3e8a1db1a | ||
|
|
a50ac7310f | ||
|
|
1f7238841a | ||
|
|
f3738cbc4d | ||
|
|
6f0f58d2d9 |
No files matched your search
@@ -1,6 +1,6 @@
|
|||||||
module fornaxian.tech/nova_web
|
module fornaxian.tech/nova_web
|
||||||
|
|
||||||
go 1.26
|
go 1.27
|
||||||
|
|
||||||
replace (
|
replace (
|
||||||
fornaxian.tech/nova_server => ../nova_server
|
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);
|
accent-color: var(--accent_color);
|
||||||
}
|
}
|
||||||
|
|
||||||
@font-face {
|
/* Material Symbols, used like <i class="icon i_delete"></i>. The i_ classes
|
||||||
font-family: 'Material Icons';
|
are generated into icons.css by svelte/icons.js. The glyph is a mask on a
|
||||||
font-style: normal;
|
pseudo element so backgrounds and padding on the icon itself still work */
|
||||||
font-weight: 400;
|
|
||||||
font-display: block;
|
|
||||||
src: local('Material Icons'),
|
|
||||||
local('MaterialIcons-Regular'),
|
|
||||||
url(/res/misc/MaterialIcons.woff2) format('woff2');
|
|
||||||
}
|
|
||||||
|
|
||||||
.icon {
|
.icon {
|
||||||
font-family: 'Material Icons';
|
|
||||||
font-weight: normal;
|
|
||||||
font-style: normal;
|
|
||||||
font-size: 1.5em;
|
font-size: 1.5em;
|
||||||
display: inline-block;
|
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;
|
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 {
|
.icon_unicode {
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
||||||
|
|
||||||
<link rel="stylesheet" href="/res/style/layout.css?v{{.CacheID}}"/>
|
<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="/favicon.ico" sizes="32x32"/>
|
||||||
<link rel="icon" href="/res/img/nova.svg" type="image/svg+xml"/>
|
<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",
|
"version": "1.0.0",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "NODE_ENV=production vite build",
|
"build": "node icons.js && NODE_ENV=production vite build",
|
||||||
"dev": "NODE_ENV=development vite build --watch"
|
"dev": "node icons.js && NODE_ENV=development vite build --watch"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@rollup/plugin-node-resolve": "^15.3.1",
|
"@rollup/plugin-node-resolve": "^15.3.1",
|
||||||
|
|||||||
@@ -1,12 +1,17 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { formatDate, formatNumber } from "util/Formatting";
|
import { formatDate, formatNumber } from "util/Formatting";
|
||||||
import Expandable from "util/Expandable.svelte";
|
import Expandable from "util/Expandable.svelte";
|
||||||
import { createEventDispatcher } from "svelte";
|
|
||||||
let dispatch = createEventDispatcher()
|
|
||||||
|
|
||||||
let {
|
let {
|
||||||
report,
|
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();
|
} = $props();
|
||||||
let preview = $state(false)
|
let preview = $state(false)
|
||||||
|
|
||||||
@@ -14,7 +19,7 @@ let can_grant = $derived(report.status !== "granted")
|
|||||||
let can_reject = $derived(report.status !== "rejected")
|
let can_reject = $derived(report.status !== "rejected")
|
||||||
|
|
||||||
let set_status = async (action: string, report_type: string) => {
|
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>
|
</script>
|
||||||
|
|
||||||
@@ -47,19 +52,19 @@ let set_status = async (action: string, report_type: string) => {
|
|||||||
<div class="toolbar">
|
<div class="toolbar">
|
||||||
<div class="action_list">
|
<div class="action_list">
|
||||||
<a class="button" target="_blank" href={"/u/"+report.file.id} rel="noreferrer">
|
<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>
|
</a>
|
||||||
<button class:button_highlight={preview} onclick={() => {preview = !preview}}>
|
<button class:button_highlight={preview} onclick={() => {preview = !preview}}>
|
||||||
<i class="icon">visibility</i> Preview
|
<i class="icon i_visibility"></i> Preview
|
||||||
</button>
|
</button>
|
||||||
{#if can_grant}
|
{#if can_grant}
|
||||||
<button class="button_highlight" onclick={() => {set_status("grant", report.type)}}>
|
<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>
|
</button>
|
||||||
{/if}
|
{/if}
|
||||||
{#if can_reject}
|
{#if can_reject}
|
||||||
<button class="button_red" onclick={() => {set_status("reject", "")}}>
|
<button class="button_red" onclick={() => {set_status("reject", "")}}>
|
||||||
<i class="icon">delete</i> Ignore
|
<i class="icon i_delete"></i> Ignore
|
||||||
</button>
|
</button>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
@@ -105,12 +110,12 @@ let set_status = async (action: string, report_type: string) => {
|
|||||||
<td>{ip_report_count[user_report.ip_address]}</td>
|
<td>{ip_report_count[user_report.ip_address]}</td>
|
||||||
<td>
|
<td>
|
||||||
{#if can_grant}
|
{#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
|
Accept all
|
||||||
</button>
|
</button>
|
||||||
{/if}
|
{/if}
|
||||||
{#if can_reject}
|
{#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
|
Ignore all
|
||||||
</button>
|
</button>
|
||||||
{/if}
|
{/if}
|
||||||
|
|||||||
@@ -168,15 +168,15 @@ onMount(() => {
|
|||||||
|
|
||||||
<div class="tab_bar">
|
<div class="tab_bar">
|
||||||
<button onclick={() => {tab = "pending"; get_reports()}} class:button_highlight={tab === "pending"}>
|
<button onclick={() => {tab = "pending"; get_reports()}} class:button_highlight={tab === "pending"}>
|
||||||
<i class="icon">flag</i>
|
<i class="icon i_flag"></i>
|
||||||
Pending
|
Pending
|
||||||
</button>
|
</button>
|
||||||
<button onclick={() => {tab = "granted"; get_reports()}} class:button_highlight={tab === "granted"}>
|
<button onclick={() => {tab = "granted"; get_reports()}} class:button_highlight={tab === "granted"}>
|
||||||
<i class="icon">flag</i>
|
<i class="icon i_flag"></i>
|
||||||
Granted
|
Granted
|
||||||
</button>
|
</button>
|
||||||
<button onclick={() => {tab = "rejected"; get_reports()}} class:button_highlight={tab === "rejected"}>
|
<button onclick={() => {tab = "rejected"; get_reports()}} class:button_highlight={tab === "rejected"}>
|
||||||
<i class="icon">flag</i>
|
<i class="icon i_flag"></i>
|
||||||
Rejected
|
Rejected
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
@@ -185,8 +185,8 @@ onMount(() => {
|
|||||||
<AbuseReport
|
<AbuseReport
|
||||||
report={report}
|
report={report}
|
||||||
ip_report_count={ip_report_count}
|
ip_report_count={ip_report_count}
|
||||||
on:resolve_report={e => resolve_report(report.id, e.detail.action, e.detail.report_type)}
|
on_resolve_report={(action, report_type) => resolve_report(report.id, action, report_type)}
|
||||||
on:resolve_by_ip={e => resolve_by_ip(e.detail.ip, e.detail.action)}
|
on_resolve_by_ip={resolve_by_ip}
|
||||||
/>
|
/>
|
||||||
{/each}
|
{/each}
|
||||||
</section>
|
</section>
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ let block_form = {
|
|||||||
default_value: "Anonymous",
|
default_value: "Anonymous",
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
submit_label: `<i class="icon">send</i> Submit`,
|
submit_label: `<i class="icon i_send"></i> Submit`,
|
||||||
on_submit: async fields => {
|
on_submit: async fields => {
|
||||||
const form = new FormData()
|
const form = new FormData()
|
||||||
form.append("text", fields.text)
|
form.append("text", fields.text)
|
||||||
|
|||||||
@@ -116,7 +116,6 @@ const delete_reporter = async (reporter: Reporter) => {
|
|||||||
const index = reporters.indexOf(reporter)
|
const index = reporters.indexOf(reporter)
|
||||||
if (index > -1) {
|
if (index > -1) {
|
||||||
reporters.splice(index, 1)
|
reporters.splice(index, 1)
|
||||||
reporters = reporters
|
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -140,11 +139,11 @@ onMount(get_reporters);
|
|||||||
<section>
|
<section>
|
||||||
<div class="toolbar" style="text-align: left;">
|
<div class="toolbar" style="text-align: left;">
|
||||||
<div class="toolbar_spacer"></div>
|
<div class="toolbar_spacer"></div>
|
||||||
<button onclick={() => get_reporters()}>
|
<button onclick={() => get_reporters()} title="Refresh">
|
||||||
<i class="icon">refresh</i>
|
<i class="icon i_refresh"></i>
|
||||||
</button>
|
</button>
|
||||||
<button bind:this={edit_button} class:button_highlight={creating} onclick={() => {creating = !creating}}>
|
<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>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
{#if creating}
|
{#if creating}
|
||||||
@@ -164,7 +163,7 @@ onMount(get_reporters);
|
|||||||
<label for="reporter_status_2">Rejected</label>
|
<label for="reporter_status_2">Rejected</label>
|
||||||
</div>
|
</div>
|
||||||
<button class="button_highlight" type="submit">
|
<button class="button_highlight" type="submit">
|
||||||
<i class="icon">save</i> Save
|
<i class="icon i_save"></i> Save
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
@@ -175,29 +174,29 @@ onMount(get_reporters);
|
|||||||
<h2>Pending reporters ({reporters_pending.length})</h2>
|
<h2>Pending reporters ({reporters_pending.length})</h2>
|
||||||
<EmailReportersTable
|
<EmailReportersTable
|
||||||
reporters={reporters_pending}
|
reporters={reporters_pending}
|
||||||
on:edit={e => edit_reporter(e.detail)}
|
on_edit={edit_reporter}
|
||||||
on:approve={e => approve_reporter(e.detail)}
|
on_approve={approve_reporter}
|
||||||
on:spam={e => spam_reporter(e.detail)}
|
on_spam={spam_reporter}
|
||||||
on:delete={e => delete_reporter(e.detail)}>
|
on_delete={delete_reporter}>
|
||||||
</EmailReportersTable>
|
</EmailReportersTable>
|
||||||
|
|
||||||
|
|
||||||
<h2>Trusted reporters ({reporters_trusted.length})</h2>
|
<h2>Trusted reporters ({reporters_trusted.length})</h2>
|
||||||
<EmailReportersTable
|
<EmailReportersTable
|
||||||
reporters={reporters_trusted}
|
reporters={reporters_trusted}
|
||||||
on:edit={e => edit_reporter(e.detail)}
|
on_edit={edit_reporter}
|
||||||
on:approve={e => approve_reporter(e.detail)}
|
on_approve={approve_reporter}
|
||||||
on:spam={e => spam_reporter(e.detail)}
|
on_spam={spam_reporter}
|
||||||
on:delete={e => delete_reporter(e.detail)}>
|
on_delete={delete_reporter}>
|
||||||
</EmailReportersTable>
|
</EmailReportersTable>
|
||||||
|
|
||||||
<h2>Rejected reporters ({reporters_rejected.length})</h2>
|
<h2>Rejected reporters ({reporters_rejected.length})</h2>
|
||||||
<EmailReportersTable
|
<EmailReportersTable
|
||||||
reporters={reporters_rejected}
|
reporters={reporters_rejected}
|
||||||
on:edit={e => edit_reporter(e.detail)}
|
on_edit={edit_reporter}
|
||||||
on:approve={e => approve_reporter(e.detail)}
|
on_approve={approve_reporter}
|
||||||
on:spam={e => spam_reporter(e.detail)}
|
on_spam={spam_reporter}
|
||||||
on:delete={e => delete_reporter(e.detail)}>
|
on_delete={delete_reporter}>
|
||||||
</EmailReportersTable>
|
</EmailReportersTable>
|
||||||
<br/>
|
<br/>
|
||||||
|
|
||||||
|
|||||||
@@ -1,45 +1,43 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { run, preventDefault } from 'svelte/legacy';
|
|
||||||
import { createEventDispatcher } from "svelte";
|
|
||||||
import { formatDate } from "util/Formatting";
|
import { formatDate } from "util/Formatting";
|
||||||
import Modal from "util/Modal.svelte"
|
import Modal from "util/Modal.svelte"
|
||||||
import SortButton from "layout/SortButton.svelte";
|
import SortButton from "layout/SortButton.svelte";
|
||||||
import { flip } from "svelte/animate";
|
import { flip } from "svelte/animate";
|
||||||
|
|
||||||
const dispatch = createEventDispatcher()
|
let { reporters = [], on_edit, on_approve, on_spam, on_delete }: {
|
||||||
|
reporters?: any[];
|
||||||
let { reporters = $bindable([]) } = $props();
|
on_edit: (reporter: any) => void;
|
||||||
|
on_approve: (reporter: any) => void;
|
||||||
const update_table = (reporters) => sort("")
|
on_spam: (reporter: any) => void;
|
||||||
|
on_delete: (reporter: any) => void;
|
||||||
|
} = $props();
|
||||||
|
|
||||||
let sort_field = $state("last_used")
|
let sort_field = $state("last_used")
|
||||||
let asc = $state(false)
|
let asc = $state(false)
|
||||||
const sort = (field) => {
|
const sort = (field: string) => {
|
||||||
if (field !== "" && field === sort_field) asc = !asc
|
if (field === sort_field) asc = !asc
|
||||||
if (field === "") field = sort_field
|
|
||||||
sort_field = field
|
sort_field = field
|
||||||
|
|
||||||
console.log("sorting by", field, "asc", asc)
|
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 modal: Modal = $state()
|
||||||
let preview_subject = $state("")
|
let preview_subject = $state("")
|
||||||
let preview_html = $state("")
|
let preview_html = $state("")
|
||||||
@@ -50,9 +48,6 @@ const toggle_preview = (rep) => {
|
|||||||
preview_html = rep.last_message_html
|
preview_html = rep.last_message_html
|
||||||
modal.show()
|
modal.show()
|
||||||
}
|
}
|
||||||
run(() => {
|
|
||||||
update_table(reporters)
|
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="table_scroll">
|
<div class="table_scroll">
|
||||||
@@ -69,7 +64,7 @@ run(() => {
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{#each reporters as rep (rep.from_address)}
|
{#each sorted as rep (rep.from_address)}
|
||||||
<tr animate:flip={{duration: 500}}>
|
<tr animate:flip={{duration: 500}}>
|
||||||
<td>{rep.from_address}</td>
|
<td>{rep.from_address}</td>
|
||||||
<td>{rep.name}</td>
|
<td>{rep.name}</td>
|
||||||
@@ -78,24 +73,24 @@ run(() => {
|
|||||||
<td>{formatDate(rep.last_used, true, true, false)}</td>
|
<td>{formatDate(rep.last_used, true, true, false)}</td>
|
||||||
<td>{formatDate(rep.created, false, false, false)}</td>
|
<td>{formatDate(rep.created, false, false, false)}</td>
|
||||||
<td>
|
<td>
|
||||||
<button onclick={preventDefault(() => toggle_preview(rep))} class="button round">
|
<button onclick={e => {e.preventDefault(); toggle_preview(rep)}} class="button round" title="Show last message">
|
||||||
<i class="icon">email</i>
|
<i class="icon i_email"></i>
|
||||||
</button>
|
</button>
|
||||||
<button onclick={preventDefault(() => {dispatch("edit", rep)})} class="button round">
|
<button onclick={e => {e.preventDefault(); on_edit(rep)}} class="button round" title="Edit">
|
||||||
<i class="icon">edit</i>
|
<i class="icon i_edit"></i>
|
||||||
</button>
|
</button>
|
||||||
{#if rep.status !== "trusted"}
|
{#if rep.status !== "trusted"}
|
||||||
<button onclick={preventDefault(() => {dispatch("approve", rep)})} class="button button_highlight round">
|
<button onclick={e => {e.preventDefault(); on_approve(rep)}} class="button button_highlight round" title="Trust">
|
||||||
<i class="icon">check</i>
|
<i class="icon i_check"></i>
|
||||||
</button>
|
</button>
|
||||||
{/if}
|
{/if}
|
||||||
{#if rep.status !== "rejected"}
|
{#if rep.status !== "rejected"}
|
||||||
<button onclick={preventDefault(() => {dispatch("spam", rep)})} class="button button_red round">
|
<button onclick={e => {e.preventDefault(); on_spam(rep)}} class="button button_red round" title="Reject">
|
||||||
<i class="icon">block</i>
|
<i class="icon i_block"></i>
|
||||||
</button>
|
</button>
|
||||||
{/if}
|
{/if}
|
||||||
<button onclick={preventDefault(() => {dispatch("delete", rep)})} class="button button_red round">
|
<button onclick={e => {e.preventDefault(); on_delete(rep)}} class="button button_red round" title="Delete">
|
||||||
<i class="icon">delete</i>
|
<i class="icon i_delete"></i>
|
||||||
</button>
|
</button>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ const date = (d: string) => (!d || d.startsWith("0001-")) ? "never" : formatDate
|
|||||||
<label for="hash_input">File hash (hex sha256)</label>
|
<label for="hash_input">File hash (hex sha256)</label>
|
||||||
<input id="hash_input" bind:value={hash} onclick={e => e.currentTarget.select()}/>
|
<input id="hash_input" bind:value={hash} onclick={e => e.currentTarget.select()}/>
|
||||||
<button type="submit" disabled={loading}>
|
<button type="submit" disabled={loading}>
|
||||||
<i class="icon">search</i> Look up
|
<i class="icon i_search"></i> Look up
|
||||||
</button>
|
</button>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
|||||||
@@ -285,11 +285,11 @@ onMount(() => {
|
|||||||
|
|
||||||
<h3>Cache nodes</h3>
|
<h3>Cache nodes</h3>
|
||||||
</section>
|
</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>
|
<section>
|
||||||
<h3>Storage nodes</h3>
|
<h3>Storage nodes</h3>
|
||||||
</section>
|
</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>
|
<section>
|
||||||
|
|
||||||
<h3>Query statistics</h3>
|
<h3>Query statistics</h3>
|
||||||
|
|||||||
@@ -55,6 +55,8 @@ const groups: {
|
|||||||
data_type: "duration",
|
data_type: "duration",
|
||||||
},
|
},
|
||||||
{metric: "filesystem_index_walk_child", data_type: "number"},
|
{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,
|
title: "Task scheduler", expanded: false,
|
||||||
|
|||||||
@@ -161,13 +161,13 @@ let invoices_filtered: Invoice[] = $state([])
|
|||||||
<h3>{year + "-" + ("00"+(month)).slice(-2)}</h3>
|
<h3>{year + "-" + ("00"+(month)).slice(-2)}</h3>
|
||||||
<div class="toolbar">
|
<div class="toolbar">
|
||||||
<button onclick={last_month}>
|
<button onclick={last_month}>
|
||||||
<i class="icon">chevron_left</i>
|
<i class="icon i_chevron_left"></i>
|
||||||
Previous month
|
Previous month
|
||||||
</button>
|
</button>
|
||||||
<div class="toolbar_spacer"></div>
|
<div class="toolbar_spacer"></div>
|
||||||
<button onclick={next_month}>
|
<button onclick={next_month}>
|
||||||
Next month
|
Next month
|
||||||
<i class="icon">chevron_right</i>
|
<i class="icon i_chevron_right"></i>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import { loading_finish, loading_start } from "lib/Loading";
|
|||||||
let { settlement = {} } = $props();
|
let { settlement = {} } = $props();
|
||||||
let payments = $state([])
|
let payments = $state([])
|
||||||
|
|
||||||
let per_country = $state({})
|
let per_country: {[country: string]: any} = $state({})
|
||||||
let totals = $state({
|
let totals = $state({
|
||||||
count: 0,
|
count: 0,
|
||||||
vat: 0,
|
vat: 0,
|
||||||
@@ -79,7 +79,7 @@ const get_payments = async () => {
|
|||||||
{}
|
{}
|
||||||
)
|
)
|
||||||
|
|
||||||
console.log(per_country)
|
console.log($state.snapshot(per_country))
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
alert(err);
|
alert(err);
|
||||||
} finally {
|
} finally {
|
||||||
|
|||||||
@@ -115,8 +115,8 @@ const decommission = (id: string) => {
|
|||||||
<td>{formatDataVolume(peer.min_free_space, 3)}</td>
|
<td>{formatDataVolume(peer.min_free_space, 3)}</td>
|
||||||
{#if !all_reachable}
|
{#if !all_reachable}
|
||||||
<td>
|
<td>
|
||||||
<button class="button flat delete" onclick={() => decommission(peer.id)}>
|
<button class="button flat delete" onclick={() => decommission(peer.id)} title="Decommission">
|
||||||
<i class="icon small">delete</i>
|
<i class="icon small i_delete"></i>
|
||||||
</button>
|
</button>
|
||||||
</td>
|
</td>
|
||||||
{/if}
|
{/if}
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ let pages = [
|
|||||||
}, {
|
}, {
|
||||||
path: "/admin/paypal_taxes",
|
path: "/admin/paypal_taxes",
|
||||||
title: "Paypal Taxes",
|
title: "Paypal Taxes",
|
||||||
icon: "paypal",
|
icon: "payments",
|
||||||
component: PayPalTaxes,
|
component: PayPalTaxes,
|
||||||
}, {
|
}, {
|
||||||
path: "/admin/invoices",
|
path: "/admin/invoices",
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ let credit_form = {
|
|||||||
default_value: 0,
|
default_value: 0,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
submit_label: `<i class="icon">send</i> Submit`,
|
submit_label: `<i class="icon i_send"></i> Submit`,
|
||||||
on_submit: async fields => {
|
on_submit: async fields => {
|
||||||
const form = new FormData()
|
const form = new FormData()
|
||||||
form.append("id", fields.user_id)
|
form.append("id", fields.user_id)
|
||||||
@@ -71,7 +71,7 @@ let impersonate_form = {
|
|||||||
default_value: "",
|
default_value: "",
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
submit_label: `<i class="icon">send</i> Submit`,
|
submit_label: `<i class="icon i_send"></i> Submit`,
|
||||||
on_submit: async fields => {
|
on_submit: async fields => {
|
||||||
const form = new FormData()
|
const form = new FormData()
|
||||||
form.append("id", fields.user_id)
|
form.append("id", fields.user_id)
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
<script>
|
<script>
|
||||||
import { stopPropagation } from 'svelte/legacy';
|
|
||||||
import { onMount } from "svelte";
|
import { onMount } from "svelte";
|
||||||
import { formatDate } from "util/Formatting";
|
import { formatDate } from "util/Formatting";
|
||||||
import Expandable from "util/Expandable.svelte";
|
import Expandable from "util/Expandable.svelte";
|
||||||
@@ -116,9 +115,9 @@ onMount(get_bans);
|
|||||||
<div class="toolbar_spacer"></div>
|
<div class="toolbar_spacer"></div>
|
||||||
<button class:button_highlight={expanded} onclick={() => {expanded = !expanded}}>
|
<button class:button_highlight={expanded} onclick={() => {expanded = !expanded}}>
|
||||||
{#if expanded}
|
{#if expanded}
|
||||||
<i class="icon">unfold_less</i> Collapse all
|
<i class="icon i_unfold_less"></i> Collapse all
|
||||||
{:else}
|
{:else}
|
||||||
<i class="icon">unfold_more</i> Expand all
|
<i class="icon i_unfold_more"></i> Expand all
|
||||||
{/if}
|
{/if}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
@@ -142,8 +141,8 @@ onMount(get_bans);
|
|||||||
Date<br/>
|
Date<br/>
|
||||||
{formatDate(row.offences[0].ban_time, false, false, false)}
|
{formatDate(row.offences[0].ban_time, false, false, false)}
|
||||||
</div>
|
</div>
|
||||||
<button onclick={stopPropagation(() => {delete_ban(row.user_id)})} class="button button_red" style="align-self: center;">
|
<button onclick={e => {e.stopPropagation(); delete_ban(row.user_id)}} class="button button_red" style="align-self: center;" title="Delete ban">
|
||||||
<i class="icon">delete</i>
|
<i class="icon i_delete"></i>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
{/snippet}
|
{/snippet}
|
||||||
@@ -152,7 +151,7 @@ onMount(get_bans);
|
|||||||
<Button click={() => impersonate(row.user_id)} icon="login" label="Impersonate user"/>
|
<Button click={() => impersonate(row.user_id)} icon="login" label="Impersonate user"/>
|
||||||
<div class="toolbar_spacer"></div>
|
<div class="toolbar_spacer"></div>
|
||||||
<div class="toolbar_label">
|
<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}>
|
<select bind:value={row.select_abuse_type}>
|
||||||
<option>copyright</option>
|
<option>copyright</option>
|
||||||
<option>child_abuse</option>
|
<option>child_abuse</option>
|
||||||
|
|||||||
@@ -33,16 +33,16 @@ onMount(() => {
|
|||||||
oncontextmenu={e => file_menu.open(node, e.target, e)}
|
oncontextmenu={e => file_menu.open(node, e.target, e)}
|
||||||
>
|
>
|
||||||
{#if node.abuse_type !== undefined}
|
{#if node.abuse_type !== undefined}
|
||||||
<i class="icon small">block</i>
|
<i class="icon small i_block"></i>
|
||||||
{:else if node.is_shared()}
|
{:else if node.is_shared()}
|
||||||
<i class="icon small">share</i>
|
<i class="icon small i_share"></i>
|
||||||
{/if}
|
{/if}
|
||||||
<div class="node_name" class:base={$nav.base_index === i} class:small={$nav.path.length > 10}>
|
<div class="node_name" class:base={$nav.base_index === i} class:small={$nav.path.length > 10}>
|
||||||
{node.name}
|
{node.name}
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
{#if $nav.base_index !== i}
|
{#if $nav.base_index !== i}
|
||||||
<i class="icon">chevron_right</i>
|
<i class="icon i_chevron_right"></i>
|
||||||
{/if}
|
{/if}
|
||||||
{/each}
|
{/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 { color_by_name } from "util/Util";
|
||||||
import CopyButton from "layout/CopyButton.svelte";
|
import CopyButton from "layout/CopyButton.svelte";
|
||||||
import type { FSNavigator } from "./FSNavigator";
|
import type { FSNavigator } from "./FSNavigator";
|
||||||
|
import { untrack } from "svelte";
|
||||||
|
|
||||||
let {
|
let {
|
||||||
nav,
|
nav,
|
||||||
@@ -19,9 +20,12 @@ export const toggle = () => visible = !visible
|
|||||||
|
|
||||||
$effect(() => {
|
$effect(() => {
|
||||||
// Only update the chart if the details modal is open. Else the chart is
|
// Only update the chart if the details modal is open. Else the chart is
|
||||||
// rendered for nothing
|
// rendered for nothing. The chart is not there until it's downloaded,
|
||||||
if (visible) {
|
// reading it here makes this run again when it's ready. The timespan is not
|
||||||
update_chart($nav.base, chart_timespan, chart_interval)
|
// 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 total_egress = $state(0)
|
||||||
|
|
||||||
let update_chart = async (base: FSNode, timespan: number, interval: number) => {
|
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) {
|
if (!visible || base.type !== "file" || !chart) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import TextBlock from "layout/TextBlock.svelte";
|
import TextBlock from "layout/TextBlock.svelte";
|
||||||
|
import Button from "layout/Button.svelte";
|
||||||
import { type FSNavigator } from "./FSNavigator";
|
import { type FSNavigator } from "./FSNavigator";
|
||||||
import { onMount } from "svelte";
|
import { onMount } from "svelte";
|
||||||
import { breadcrumbs_store } from "wrap/HeaderStore";
|
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>
|
</script>
|
||||||
|
|
||||||
{#snippet breadcrumbs()}
|
{#snippet breadcrumbs()}
|
||||||
@@ -29,6 +40,23 @@ onMount(() => {
|
|||||||
<p>
|
<p>
|
||||||
This page could not be found.
|
This page could not be found.
|
||||||
</p>
|
</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"}
|
{:else if $nav.navigation_error === "permission_denied" || $nav.navigation_error === "forbidden"}
|
||||||
<h1>Permission denied</h1>
|
<h1>Permission denied</h1>
|
||||||
<p>
|
<p>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { loading_finish, loading_run, loading_start } from "lib/Loading";
|
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_rename } from "lib/FilesystemAPI.svelte";
|
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";
|
import type { FSNode, FSPath, FSPermissions, FSContext } from "lib/FilesystemAPI.svelte";
|
||||||
|
|
||||||
export class FSNavigator {
|
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 will be set to true when the first file or directory is loaded
|
||||||
initialized = false
|
initialized = false
|
||||||
shuffle = false
|
shuffle = false
|
||||||
|
toggle_shuffle = () => {
|
||||||
|
this.shuffle = !this.shuffle
|
||||||
|
this.notify_subscribers()
|
||||||
|
}
|
||||||
|
|
||||||
// Whether navigation events should update the browser history
|
// Whether navigation events should update the browser history
|
||||||
history_enabled = true
|
history_enabled = true
|
||||||
@@ -45,8 +49,8 @@ export class FSNavigator {
|
|||||||
|
|
||||||
last_requested_path: string = ""
|
last_requested_path: string = ""
|
||||||
navigation_error: string = ""
|
navigation_error: string = ""
|
||||||
navigate = async (path: string, push_history: boolean) => {
|
navigate = async (path: string, push_history: boolean, password?: string) => {
|
||||||
if (path === this.last_requested_path) {
|
if (path === this.last_requested_path && password === undefined) {
|
||||||
console.debug("FSNavigator: Requested path ", path, " is equal to current path. Debouncing")
|
console.debug("FSNavigator: Requested path ", path, " is equal to current path. Debouncing")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -56,6 +60,18 @@ export class FSNavigator {
|
|||||||
path = "/" + path
|
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)
|
console.debug("FSNavigator: Navigating to path", path, push_history)
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -70,9 +86,9 @@ export class FSNavigator {
|
|||||||
this.open_node(resp, push_history)
|
this.open_node(resp, push_history)
|
||||||
} catch (err: any) {
|
} catch (err: any) {
|
||||||
if (err.value !== undefined && err.value === "path_not_found") {
|
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")
|
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) {
|
} else if (err.value !== undefined) {
|
||||||
this.navigation_error = err.value
|
this.navigation_error = err.value
|
||||||
@@ -286,6 +302,27 @@ export class FSNavigator {
|
|||||||
this.set_selecting(true)
|
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
|
// A directory can't be moved into itself, and there has to be at least one
|
||||||
// node which is not in dir already
|
// node which is not in dir already
|
||||||
can_move = (dir: string) => {
|
can_move = (dir: string) => {
|
||||||
|
|||||||
@@ -115,11 +115,11 @@ const toggle_expand_keyboard = (e: KeyboardEvent) => {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="container" onclick={toggle_expand} onkeypress={toggle_expand_keyboard} role="presentation">
|
<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}
|
{#if expanded}
|
||||||
<i class="icon">expand_more</i>
|
<i class="icon i_expand_more"></i>
|
||||||
{:else}
|
{:else}
|
||||||
<i class="icon">expand_less</i>
|
<i class="icon i_expand_less"></i>
|
||||||
{/if}
|
{/if}
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import Toolbar from "./Toolbar.svelte";
|
|||||||
import Breadcrumbs from "./Breadcrumbs.svelte";
|
import Breadcrumbs from "./Breadcrumbs.svelte";
|
||||||
import DetailsWindow from "./DetailsWindow.svelte";
|
import DetailsWindow from "./DetailsWindow.svelte";
|
||||||
import FilePreview from "./viewers/FilePreview.svelte";
|
import FilePreview from "./viewers/FilePreview.svelte";
|
||||||
import FSUploadWidget from "./upload_widget/FSUploadWidget.svelte";
|
|
||||||
import { global_navigator } from "./FSNavigator"
|
import { global_navigator } from "./FSNavigator"
|
||||||
import { css_from_path } from "filesystem/edit_window/Branding";
|
import { css_from_path } from "filesystem/edit_window/Branding";
|
||||||
import { update_favicon } from "util/NovaLogo.svelte";
|
import { update_favicon } from "util/NovaLogo.svelte";
|
||||||
@@ -15,7 +14,6 @@ import ErrorPage from "./ErrorPage.svelte";
|
|||||||
|
|
||||||
let file_preview: FilePreview = $state()
|
let file_preview: FilePreview = $state()
|
||||||
let toolbar: Toolbar = $state()
|
let toolbar: Toolbar = $state()
|
||||||
let upload_widget: FSUploadWidget = $state()
|
|
||||||
let details_visible = $state(false)
|
let details_visible = $state(false)
|
||||||
let edit_window: EditWindow = $state()
|
let edit_window: EditWindow = $state()
|
||||||
let edit_visible = $state(false)
|
let edit_visible = $state(false)
|
||||||
@@ -58,13 +56,7 @@ onMount(() => {
|
|||||||
const keydown = (e: KeyboardEvent) => {
|
const keydown = (e: KeyboardEvent) => {
|
||||||
if (e.ctrlKey || e.altKey || e.metaKey) {
|
if (e.ctrlKey || e.altKey || e.metaKey) {
|
||||||
return // prevent custom shortcuts from interfering with system shortcuts
|
return // prevent custom shortcuts from interfering with system shortcuts
|
||||||
} else if (
|
} else if (["text", "password", "textarea"].includes((document.activeElement as any).type)) {
|
||||||
(document.activeElement as any).type !== undefined &&
|
|
||||||
(
|
|
||||||
(document.activeElement as any).type === "text" ||
|
|
||||||
(document.activeElement as any).type === "textarea"
|
|
||||||
)
|
|
||||||
) {
|
|
||||||
return // Prevent shortcuts from interfering with input fields
|
return // Prevent shortcuts from interfering with input fields
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -84,10 +76,10 @@ const keydown = (e: KeyboardEvent) => {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "s":
|
case "s":
|
||||||
nav.base.download()
|
nav.download()
|
||||||
break;
|
break;
|
||||||
case "r":
|
case "r":
|
||||||
nav.shuffle = !nav.shuffle
|
nav.toggle_shuffle()
|
||||||
break;
|
break;
|
||||||
case "a":
|
case "a":
|
||||||
case "ArrowLeft":
|
case "ArrowLeft":
|
||||||
@@ -148,7 +140,6 @@ const keydown = (e: KeyboardEvent) => {
|
|||||||
<FilePreview
|
<FilePreview
|
||||||
bind:this={file_preview}
|
bind:this={file_preview}
|
||||||
nav={nav}
|
nav={nav}
|
||||||
upload_widget={upload_widget}
|
|
||||||
edit_window={edit_window}
|
edit_window={edit_window}
|
||||||
details_window={details_window}
|
details_window={details_window}
|
||||||
/>
|
/>
|
||||||
@@ -171,10 +162,6 @@ const keydown = (e: KeyboardEvent) => {
|
|||||||
|
|
||||||
<EditWindow nav={nav} bind:this={edit_window} bind:visible={edit_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/>
|
<AffiliatePrompt/>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
|||||||
@@ -213,7 +213,7 @@ const window_keydown = (e: KeyboardEvent) => {
|
|||||||
{/if}
|
{/if}
|
||||||
<div class="center">
|
<div class="center">
|
||||||
<form class="search_form" onsubmit={submit_search}>
|
<form class="search_form" onsubmit={submit_search}>
|
||||||
<i class="icon">search</i>
|
<i class="icon i_search"></i>
|
||||||
<input
|
<input
|
||||||
bind:this={search_bar}
|
bind:this={search_bar}
|
||||||
class="term"
|
class="term"
|
||||||
@@ -250,7 +250,7 @@ const window_keydown = (e: KeyboardEvent) => {
|
|||||||
<div class="node">
|
<div class="node">
|
||||||
<div class="node_name" style="text-align: center;">
|
<div class="node_name" style="text-align: center;">
|
||||||
<button onclick={() => {search(last_limit + 100)}}>
|
<button onclick={() => {search(last_limit + 100)}}>
|
||||||
<i class="icon">expand_more</i>
|
<i class="icon i_expand_more"></i>
|
||||||
More results
|
More results
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -41,37 +41,37 @@ export const copy_link = () => {
|
|||||||
|
|
||||||
<div class="grid" class:hide={!toolbar_expanded}>
|
<div class="grid" class:hide={!toolbar_expanded}>
|
||||||
<div class="button_row">
|
<div class="button_row">
|
||||||
<button onclick={() => {nav.open_sibling(-1)}}>
|
<button onclick={() => {nav.open_sibling(-1)}} title="Previous file">
|
||||||
<i class="icon">skip_previous</i>
|
<i class="icon i_skip_previous"></i>
|
||||||
</button>
|
</button>
|
||||||
<button onclick={() => {nav.shuffle = !nav.shuffle}} class:button_highlight={nav.shuffle}>
|
<button onclick={nav.toggle_shuffle} class:button_highlight={$nav.shuffle} title="Shuffle">
|
||||||
<i class="icon">shuffle</i>
|
<i class="icon i_shuffle"></i>
|
||||||
</button>
|
</button>
|
||||||
<button onclick={() => {nav.open_sibling(1)}}>
|
<button onclick={() => {nav.open_sibling(1)}} title="Next file">
|
||||||
<i class="icon">skip_next</i>
|
<i class="icon i_skip_next"></i>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<button onclick={() => $nav.base.download()}>
|
<button onclick={() => nav.download()}>
|
||||||
<i class="icon">save</i>
|
<i class="icon i_save"></i>
|
||||||
<span>Download</span>
|
<span>Download</span>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
{#if is_bookmark($bookmarks_store, $nav.base.id)}
|
{#if is_bookmark($bookmarks_store, $nav.base.id)}
|
||||||
<button onclick={() => bookmark_del($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>
|
<span>Bookmark</span>
|
||||||
</button>
|
</button>
|
||||||
{:else}
|
{:else}
|
||||||
<button onclick={() => bookmark_add($nav.base)}>
|
<button onclick={() => bookmark_add($nav.base)}>
|
||||||
<i class="icon">bookmark_add</i>
|
<i class="icon i_bookmark_add"></i>
|
||||||
<span>Bookmark</span>
|
<span>Bookmark</span>
|
||||||
</button>
|
</button>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
{#if path_is_shared($nav.path)}
|
{#if path_is_shared($nav.path)}
|
||||||
<button onclick={copy_link} class:button_highlight={link_copied}>
|
<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}
|
{#if link_copied}
|
||||||
<span>Link copied!</span>
|
<span>Link copied!</span>
|
||||||
{:else}
|
{: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)-->
|
<!-- 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}
|
{#if navigator.share !== undefined || $nav.permissions.write === true}
|
||||||
<button onclick={(e) => share_dialog.open(e, nav.path)}>
|
<button onclick={(e) => share_dialog.open(e, nav.path)}>
|
||||||
<i class="icon">share</i>
|
<i class="icon i_share"></i>
|
||||||
<span>Share</span>
|
<span>Share</span>
|
||||||
</button>
|
</button>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
<button onclick={() => details_visible = !details_visible} class:button_highlight={details_visible}>
|
<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>
|
<span>Deta<u>i</u>ls</span>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
{#if $nav.base.id !== "me" && $nav.permissions.write === true}
|
{#if $nav.base.id !== "me" && $nav.permissions.write === true}
|
||||||
<button onclick={() => edit_window.edit(nav.base, true, "file")} class:button_highlight={edit_visible}>
|
<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>
|
<span><u>E</u>dit</span>
|
||||||
</button>
|
</button>
|
||||||
{/if}
|
{/if}
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ const add_user = (e: SubmitEvent) => {
|
|||||||
}
|
}
|
||||||
const del_user = (id: string) => {
|
const del_user = (id: string) => {
|
||||||
delete options.user_permissions[id]
|
delete options.user_permissions[id]
|
||||||
options.user_permissions = options.user_permissions
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let new_password = $state("")
|
let new_password = $state("")
|
||||||
@@ -49,7 +48,6 @@ const generate_password = () => {
|
|||||||
let revealed: {[password: string]: boolean} = $state({})
|
let revealed: {[password: string]: boolean} = $state({})
|
||||||
const del_password = (pass: string) => {
|
const del_password = (pass: string) => {
|
||||||
delete options.password_permissions[pass]
|
delete options.password_permissions[pass]
|
||||||
options.password_permissions = options.password_permissions
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@@ -95,7 +93,7 @@ const del_password = (pass: string) => {
|
|||||||
{#if options.user_permissions !== undefined}
|
{#if options.user_permissions !== undefined}
|
||||||
{#each Object.keys(options.user_permissions) as id (id)}
|
{#each Object.keys(options.user_permissions) as id (id)}
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<Button click={() => del_user(id)} icon="delete"/>
|
<Button click={() => del_user(id)} icon="delete" title="Remove"/>
|
||||||
<div class="grow id">
|
<div class="grow id">
|
||||||
{id}
|
{id}
|
||||||
</div>
|
</div>
|
||||||
@@ -135,9 +133,9 @@ const del_password = (pass: string) => {
|
|||||||
{#if options.password_permissions !== undefined}
|
{#if options.password_permissions !== undefined}
|
||||||
{#each Object.keys(options.password_permissions) as password (password)}
|
{#each Object.keys(options.password_permissions) as password (password)}
|
||||||
<div class="row">
|
<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">
|
<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">
|
<div class="grow id">
|
||||||
{revealed[password] ? password : "••••••••••••••••"}
|
{revealed[password] ? password : "••••••••••••••••"}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -151,7 +151,7 @@ let accent_info = $state(false)
|
|||||||
</p>
|
</p>
|
||||||
<div>Header image ID</div>
|
<div>Header image ID</div>
|
||||||
<button onclick={() => pick_image("brand_header_image")}>
|
<button onclick={() => pick_image("brand_header_image")}>
|
||||||
<i class="icon">folder_open</i>
|
<i class="icon i_folder_open"></i>
|
||||||
Pick
|
Pick
|
||||||
</button>
|
</button>
|
||||||
<input type="text" bind:value={options.brand_header_image}/>
|
<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}/>
|
<input class="span2" type="text" bind:value={options.brand_header_link}/>
|
||||||
<div>Background image ID</div>
|
<div>Background image ID</div>
|
||||||
<button onclick={() => pick_image("brand_background_image")}>
|
<button onclick={() => pick_image("brand_background_image")}>
|
||||||
<i class="icon">folder_open</i>
|
<i class="icon i_folder_open"></i>
|
||||||
Pick
|
Pick
|
||||||
</button>
|
</button>
|
||||||
<input type="text" bind:value={options.brand_background_image}/>
|
<input type="text" bind:value={options.brand_background_image}/>
|
||||||
@@ -182,9 +182,9 @@ let accent_info = $state(false)
|
|||||||
<hr/>
|
<hr/>
|
||||||
|
|
||||||
<div class="example_button_row">
|
<div class="example_button_row">
|
||||||
<button type="button"><i class="icon">touch_app</i>Normal</button>
|
<button type="button"><i class="icon i_touch_app"></i>Normal</button>
|
||||||
<button type="button" class="button_highlight"><i class="icon">priority_high</i>Important</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">warning</i>Dangerous</button>
|
<button type="button" class="button_red"><i class="icon i_warning"></i>Dangerous</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="example_button_row">
|
<div class="example_button_row">
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ export const edit = (f: FSNode, oae = false, open_tab = "") => {
|
|||||||
tab = 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
|
// We save the name in a separate field because we need both the original
|
||||||
// name and the new name for the rename operation
|
// 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}">
|
<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">
|
<div class="tab_bar">
|
||||||
<button class:button_highlight={tab === "file"} onclick={() => tab = "file"}>
|
<button class:button_highlight={tab === "file"} onclick={() => tab = "file"}>
|
||||||
<i class="icon">edit</i>
|
<i class="icon i_edit"></i>
|
||||||
Properties
|
Properties
|
||||||
</button>
|
</button>
|
||||||
<button class:button_highlight={tab === "share"} onclick={() => tab = "share"}>
|
<button class:button_highlight={tab === "share"} onclick={() => tab = "share"}>
|
||||||
<i class="icon">share</i>
|
<i class="icon i_share"></i>
|
||||||
Sharing
|
Sharing
|
||||||
</button>
|
</button>
|
||||||
<button class:button_highlight={tab === "branding"} onclick={() => tab = "branding"}>
|
<button class:button_highlight={tab === "branding"} onclick={() => tab = "branding"}>
|
||||||
<i class="icon">palette</i>
|
<i class="icon i_palette"></i>
|
||||||
Branding
|
Branding
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -45,6 +45,16 @@ const toggle_example = () => {
|
|||||||
|
|
||||||
let share_link = $derived(window.location.protocol+"//"+window.location.host+"/d/"+file.id)
|
let share_link = $derived(window.location.protocol+"//"+window.location.host+"/d/"+file.id)
|
||||||
const s3_endpoint = window.location.protocol+"//s3."+window.location.host
|
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>
|
</script>
|
||||||
|
|
||||||
{#if $user.subscription.file_sharing === false}
|
{#if $user.subscription.file_sharing === false}
|
||||||
@@ -79,15 +89,27 @@ const s3_endpoint = window.location.protocol+"//s3."+window.location.host
|
|||||||
<legend>S3 access</legend>
|
<legend>S3 access</legend>
|
||||||
<p>
|
<p>
|
||||||
This directory can be used as a bucket by backup tools and other
|
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,
|
software which supports Amazon S3. The name of the bucket is also the
|
||||||
and the passwords above are the secret keys. Each password's permissions
|
access key, and the passwords above are the secret keys. Each password's
|
||||||
decide what it can do.
|
permissions decide what it can do.
|
||||||
</p>
|
</p>
|
||||||
<table>
|
<table>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr><td>Endpoint</td><td>{s3_endpoint}</td><td><CopyButton text={s3_endpoint}>Copy</CopyButton></td></tr>
|
<tr>
|
||||||
<tr><td>Bucket and access key</td><td>{file.id}</td><td><CopyButton text={file.id}>Copy</CopyButton></td></tr>
|
<td>Endpoint</td>
|
||||||
<tr><td>Region</td><td>us-east-1 (any region works)</td><td></td></tr>
|
<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>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
@@ -110,7 +132,7 @@ const s3_endpoint = window.location.protocol+"//s3."+window.location.host
|
|||||||
<br/>
|
<br/>
|
||||||
<CopyButton text={embed_html} disabled={!is_shared}>Copy HTML</CopyButton>
|
<CopyButton text={embed_html} disabled={!is_shared}>Copy HTML</CopyButton>
|
||||||
<button onclick={toggle_example} class:button_highlight={example} disabled={!is_shared}>
|
<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>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<hr/>
|
<hr/>
|
||||||
|
|||||||
@@ -36,15 +36,16 @@ let {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
{#if child.is_shared()}
|
{#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}
|
||||||
|
|
||||||
{#if !hide_edit}
|
{#if !hide_edit}
|
||||||
<button
|
<button
|
||||||
class="action_button flat"
|
class="action_button flat"
|
||||||
onclick={e => file_event(FileAction.Menu, index, e)}
|
onclick={e => file_event(FileAction.Menu, index, e)}
|
||||||
|
title="Menu"
|
||||||
>
|
>
|
||||||
<i class="icon">menu</i>
|
<i class="icon i_menu"></i>
|
||||||
</button>
|
</button>
|
||||||
{/if}
|
{/if}
|
||||||
</a>
|
</a>
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import Button from "layout/Button.svelte";
|
|||||||
import { formatDate } from "util/Formatting";
|
import { formatDate } from "util/Formatting";
|
||||||
import { drop_target } from "lib/DropTarget"
|
import { drop_target } from "lib/DropTarget"
|
||||||
import { drag_click, move_target, type FSNavigator } from "filesystem/FSNavigator";
|
import { drag_click, move_target, type FSNavigator } from "filesystem/FSNavigator";
|
||||||
import FsUploadWidget from "filesystem/upload_widget/FSUploadWidget.svelte";
|
import { pick_files, upload_files } from "filesystem/upload_widget/FSUploadWidget.svelte";
|
||||||
import EditWindow from "filesystem/edit_window/EditWindow.svelte";
|
import EditWindow from "filesystem/edit_window/EditWindow.svelte";
|
||||||
import { FileAction, type FileActionHandler } from "./FileManagerLib";
|
import { FileAction, type FileActionHandler } from "./FileManagerLib";
|
||||||
import FileMenu from "./FileMenu.svelte";
|
import FileMenu from "./FileMenu.svelte";
|
||||||
@@ -25,20 +25,17 @@ import { toolbar_store } from "wrap/HeaderStore";
|
|||||||
|
|
||||||
let {
|
let {
|
||||||
nav = $bindable(),
|
nav = $bindable(),
|
||||||
upload_widget,
|
|
||||||
edit_window = $bindable(),
|
edit_window = $bindable(),
|
||||||
directory_view = $bindable(localStorage.getItem("directory_view") || "list"),
|
directory_view = $bindable(localStorage.getItem("directory_view") || "list"),
|
||||||
children
|
children
|
||||||
}: {
|
}: {
|
||||||
nav: FSNavigator;
|
nav: FSNavigator;
|
||||||
upload_widget: FsUploadWidget;
|
|
||||||
edit_window: EditWindow;
|
edit_window: EditWindow;
|
||||||
directory_view?: string;
|
directory_view?: string;
|
||||||
children?: import('svelte').Snippet;
|
children?: import('svelte').Snippet;
|
||||||
} = $props();
|
} = $props();
|
||||||
|
|
||||||
let large_icons = $state(localStorage.getItem("large_icons") === "true")
|
let large_icons = $state(localStorage.getItem("large_icons") === "true")
|
||||||
let uploader!: FsUploadWidget
|
|
||||||
// In selection mode a click selects. Moving is the part of selection mode where
|
// 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
|
// the user browses to the directory which the selection has to go to
|
||||||
let moving = $state(false)
|
let moving = $state(false)
|
||||||
@@ -49,10 +46,6 @@ $effect(() => {
|
|||||||
window.scrollTo(0, scroll_positions.get($nav.base.path) ?? 0)
|
window.scrollTo(0, scroll_positions.get($nav.base.path) ?? 0)
|
||||||
})
|
})
|
||||||
|
|
||||||
export const upload = (files: File[]) => {
|
|
||||||
return uploader.upload_files(files)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Navigation functions
|
// Navigation functions
|
||||||
const file_event: FileActionHandler = (action: FileAction, index: number, orig: Event) => {
|
const file_event: FileActionHandler = (action: FileAction, index: number, orig: Event) => {
|
||||||
const node = nav.children[index]
|
const node = nav.children[index]
|
||||||
@@ -190,13 +183,13 @@ onMount(() => {
|
|||||||
|
|
||||||
{#snippet nav_buttons()}
|
{#snippet nav_buttons()}
|
||||||
<button onclick={navigate_back} use:drag_click title="Back">
|
<button onclick={navigate_back} use:drag_click title="Back">
|
||||||
<i class="icon">arrow_back</i>
|
<i class="icon i_arrow_back"></i>
|
||||||
</button>
|
</button>
|
||||||
<button onclick={() => nav.navigate_up()} use:drag_click disabled={$nav.path.length <= 1} title="Up">
|
<button onclick={() => nav.navigate_up()} use:drag_click disabled={$nav.path.length <= 1} title="Up">
|
||||||
<i class="icon">north</i>
|
<i class="icon i_north"></i>
|
||||||
</button>
|
</button>
|
||||||
<button onclick={() => nav.reload()} use:drag_click title="Refresh directory listing">
|
<button onclick={() => nav.reload()} use:drag_click title="Refresh directory listing">
|
||||||
<i class="icon">refresh</i>
|
<i class="icon i_refresh"></i>
|
||||||
</button>
|
</button>
|
||||||
{/snippet}
|
{/snippet}
|
||||||
|
|
||||||
@@ -205,7 +198,7 @@ onMount(() => {
|
|||||||
<div class="toolbar">
|
<div class="toolbar">
|
||||||
<div class="toolbar_left">
|
<div class="toolbar_left">
|
||||||
<button onclick={() => open_search()} title="Press / to search">
|
<button onclick={() => open_search()} title="Press / to search">
|
||||||
<i class="icon">search</i>
|
<i class="icon i_search"></i>
|
||||||
</button>
|
</button>
|
||||||
{@render nav_buttons()}
|
{@render nav_buttons()}
|
||||||
{#if $nav.children.some(c => c.name === ".Trash" && c.type === "dir")}
|
{#if $nav.children.some(c => c.name === ".Trash" && c.type === "dir")}
|
||||||
@@ -213,45 +206,45 @@ onMount(() => {
|
|||||||
onclick={() => nav.navigate($nav.children.find(c => c.name === ".Trash").path, true)}
|
onclick={() => nav.navigate($nav.children.find(c => c.name === ".Trash").path, true)}
|
||||||
title="Open trash bin"
|
title="Open trash bin"
|
||||||
>
|
>
|
||||||
<i class="icon">delete</i>
|
<i class="icon i_delete"></i>
|
||||||
</button>
|
</button>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="toolbar_middle">
|
<div class="toolbar_middle">
|
||||||
<button onclick={() => toggle_view()} title="Switch between gallery, list and compact view">
|
<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 i_list" class:button_highlight={directory_view === "list"}></i>
|
||||||
<i class="icon" class:button_highlight={directory_view === "gallery"}>collections</i>
|
<i class="icon i_collections" class:button_highlight={directory_view === "gallery"}></i>
|
||||||
<i class="icon" class:button_highlight={directory_view === "compact"}>view_compact</i>
|
<i class="icon i_view_compact" class:button_highlight={directory_view === "compact"}></i>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<button class="button_large_icons" onclick={() => toggle_large_icons()} title="Switch between large and small icons">
|
<button class="button_large_icons" onclick={() => toggle_large_icons()} title="Switch between large and small icons">
|
||||||
{#if large_icons}
|
{#if large_icons}
|
||||||
<i class="icon">zoom_out</i>
|
<i class="icon i_zoom_out"></i>
|
||||||
{:else}
|
{:else}
|
||||||
<i class="icon">zoom_in</i>
|
<i class="icon i_zoom_in"></i>
|
||||||
{/if}
|
{/if}
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<button onclick={() => {show_hidden = !show_hidden}} title="Toggle hidden files">
|
<button onclick={() => {show_hidden = !show_hidden}} title="Toggle hidden files">
|
||||||
{#if show_hidden}
|
{#if show_hidden}
|
||||||
<i class="icon">visibility_off</i>
|
<i class="icon i_visibility_off"></i>
|
||||||
{:else}
|
{:else}
|
||||||
<i class="icon">visibility</i>
|
<i class="icon i_visibility"></i>
|
||||||
{/if}
|
{/if}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="toolbar_right">
|
<div class="toolbar_right">
|
||||||
{#if $nav.permissions.write}
|
{#if $nav.permissions.write}
|
||||||
<button onclick={() => upload_widget.pick_files()} title="Upload files to this directory">
|
<button onclick={() => pick_files()} title="Upload files to this directory">
|
||||||
<i class="icon">cloud_upload</i>
|
<i class="icon i_cloud_upload"></i>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<Button click={() => {creating_dir = !creating_dir}} highlight={creating_dir} icon="create_new_folder" title="Make folder"/>
|
<Button click={() => {creating_dir = !creating_dir}} highlight={creating_dir} icon="create_new_folder" title="Make folder"/>
|
||||||
|
|
||||||
<button onclick={() => nav.set_selecting(true)} title="Select and delete files">
|
<button onclick={() => nav.set_selecting(true)} title="Select and delete files">
|
||||||
<i class="icon">select_all</i>
|
<i class="icon i_select_all"></i>
|
||||||
</button>
|
</button>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
@@ -260,7 +253,7 @@ onMount(() => {
|
|||||||
{:else}
|
{:else}
|
||||||
<div class="toolbar toolbar_edit">
|
<div class="toolbar toolbar_edit">
|
||||||
<div>
|
<div>
|
||||||
<Button click={() => nav.set_selecting(false)} icon="close"/>
|
<Button click={() => nav.set_selecting(false)} icon="close" title="Clear selection"/>
|
||||||
{@render nav_buttons()}
|
{@render nav_buttons()}
|
||||||
</div>
|
</div>
|
||||||
<div class="toolbar_spacer">
|
<div class="toolbar_spacer">
|
||||||
@@ -279,7 +272,7 @@ onMount(() => {
|
|||||||
{:else}
|
{:else}
|
||||||
<Button click={() => {moving = true}} icon="drive_file_move" label="Move"/>
|
<Button click={() => {moving = true}} icon="drive_file_move" label="Move"/>
|
||||||
<button onclick={delete_selected} class="button_red">
|
<button onclick={delete_selected} class="button_red">
|
||||||
<i class="icon">delete</i>
|
<i class="icon i_delete"></i>
|
||||||
Delete
|
Delete
|
||||||
</button>
|
</button>
|
||||||
{/if}
|
{/if}
|
||||||
@@ -296,7 +289,7 @@ onMount(() => {
|
|||||||
class="container"
|
class="container"
|
||||||
use:move_target={{nav, node: () => nav.base}}
|
use:move_target={{nav, node: () => nav.base}}
|
||||||
use:drop_target={{
|
use:drop_target={{
|
||||||
upload: (files) => upload_widget.upload_files(files),
|
upload: files => upload_files(files),
|
||||||
shadow: "var(--accent_color) 0 0 10px 2px inset",
|
shadow: "var(--accent_color) 0 0 10px 2px inset",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -7,12 +7,14 @@ import Modal from "util/Modal.svelte";
|
|||||||
import { FSNavigator, path_link } from "filesystem/FSNavigator";
|
import { FSNavigator, path_link } from "filesystem/FSNavigator";
|
||||||
import { fs_encode_path, type FSNode } from "lib/FilesystemAPI.svelte";
|
import { fs_encode_path, type FSNode } from "lib/FilesystemAPI.svelte";
|
||||||
import { FileAction, type FileActionHandler } from "./FileManagerLib";
|
import { FileAction, type FileActionHandler } from "./FileManagerLib";
|
||||||
|
import CreateDirectory from "./CreateDirectory.svelte";
|
||||||
|
|
||||||
let nav = $state(new FSNavigator(false))
|
let nav = $state(new FSNavigator(false))
|
||||||
let modal: Modal = $state()
|
let modal: Modal = $state()
|
||||||
let directory_view = $state("")
|
let directory_view = $state("")
|
||||||
let large_icons = $state(false)
|
let large_icons = $state(false)
|
||||||
let show_hidden = $state(false)
|
let show_hidden = $state(false)
|
||||||
|
let creating_dir = $state(false)
|
||||||
|
|
||||||
let {
|
let {
|
||||||
callback,
|
callback,
|
||||||
@@ -26,6 +28,7 @@ let {
|
|||||||
} = $props();
|
} = $props();
|
||||||
|
|
||||||
export const open = (path: string) => {
|
export const open = (path: string) => {
|
||||||
|
creating_dir = false
|
||||||
modal.show()
|
modal.show()
|
||||||
nav.set_selecting(false)
|
nav.set_selecting(false)
|
||||||
nav.navigate(path, false)
|
nav.navigate(path, false)
|
||||||
@@ -95,14 +98,14 @@ onMount(() => {
|
|||||||
<Modal bind:this={modal} width="900px">
|
<Modal bind:this={modal} width="900px">
|
||||||
{#snippet header()}
|
{#snippet header()}
|
||||||
<div class="header" >
|
<div class="header" >
|
||||||
<button class="button round" onclick={modal.hide}>
|
<button class="button round" onclick={modal.hide} title="Close">
|
||||||
<i class="icon">close</i>
|
<i class="icon i_close"></i>
|
||||||
</button>
|
</button>
|
||||||
<button onclick={() => nav.navigate_up()} disabled={$nav.path.length <= 1} title="Up">
|
<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>
|
||||||
<button onclick={() => nav.reload()} title="Refresh directory listing">
|
<button onclick={() => nav.reload()} title="Refresh directory listing">
|
||||||
<i class="icon">refresh</i>
|
<i class="icon i_refresh"></i>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<div class="title">
|
<div class="title">
|
||||||
@@ -113,22 +116,27 @@ onMount(() => {
|
|||||||
{/if}
|
{/if}
|
||||||
</div>
|
</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">
|
<button onclick={() => {show_hidden = !show_hidden}} title="Toggle hidden files">
|
||||||
{#if show_hidden}
|
{#if show_hidden}
|
||||||
<i class="icon">visibility_off</i>
|
<i class="icon i_visibility_off"></i>
|
||||||
{:else}
|
{:else}
|
||||||
<i class="icon">visibility</i>
|
<i class="icon i_visibility"></i>
|
||||||
{/if}
|
{/if}
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<button onclick={() => toggle_view()} title="Switch between gallery, list and compact view">
|
<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 i_list" class:button_highlight={directory_view === "list"}></i>
|
||||||
<i class="icon" class:button_highlight={directory_view === "gallery"}>collections</i>
|
<i class="icon i_collections" class:button_highlight={directory_view === "gallery"}></i>
|
||||||
<i class="icon" class:button_highlight={directory_view === "compact"}>view_compact</i>
|
<i class="icon i_view_compact" class:button_highlight={directory_view === "compact"}></i>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<button class="button button_highlight round" onclick={done}>
|
<button class="button button_highlight round" onclick={done}>
|
||||||
<i class="icon">done</i> Pick
|
<i class="icon i_done"></i> Pick
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
{/snippet}
|
{/snippet}
|
||||||
@@ -140,20 +148,24 @@ onMount(() => {
|
|||||||
use:path_link={{nav: nav, node: node}}
|
use:path_link={{nav: nav, node: node}}
|
||||||
>
|
>
|
||||||
{#if node.abuse_type !== undefined}
|
{#if node.abuse_type !== undefined}
|
||||||
<i class="icon small">block</i>
|
<i class="icon small i_block"></i>
|
||||||
{:else if node.is_shared()}
|
{:else if node.is_shared()}
|
||||||
<i class="icon small">share</i>
|
<i class="icon small i_share"></i>
|
||||||
{/if}
|
{/if}
|
||||||
<div class="node_name" class:base={$nav.base_index === i}>
|
<div class="node_name" class:base={$nav.base_index === i}>
|
||||||
{node.name}
|
{node.name}
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
{#if $nav.base_index !== i}
|
{#if $nav.base_index !== i}
|
||||||
<i class="icon">chevron_right</i>
|
<i class="icon i_chevron_right"></i>
|
||||||
{/if}
|
{/if}
|
||||||
{/each}
|
{/each}
|
||||||
|
|
||||||
|
|
||||||
|
{#if creating_dir}
|
||||||
|
<CreateDirectory nav={nav}/>
|
||||||
|
{/if}
|
||||||
|
|
||||||
{#if directory_view === "list"}
|
{#if directory_view === "list"}
|
||||||
<ListView
|
<ListView
|
||||||
nav={nav}
|
nav={nav}
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ onMount(load_settings)
|
|||||||
</td>
|
</td>
|
||||||
{/each}
|
{/each}
|
||||||
<td class="node_icons icons_wrap">
|
<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>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
@@ -162,24 +162,25 @@ onMount(load_settings)
|
|||||||
<td class="node_icons">
|
<td class="node_icons">
|
||||||
<div class="icons_wrap">
|
<div class="icons_wrap">
|
||||||
{#if child.abuse_type !== undefined}
|
{#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()}
|
{:else if child.is_shared()}
|
||||||
<a
|
<a
|
||||||
href="/d/{child.id}"
|
href="/d/{child.id}"
|
||||||
onclick={e => file_event(FileAction.Share, index, e)}
|
onclick={e => file_event(FileAction.Share, index, e)}
|
||||||
class="button action_button"
|
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>
|
</a>
|
||||||
{/if}
|
{/if}
|
||||||
{#if child.properties !== undefined && child.properties.branding_enabled === "true" && !hide_branding}
|
{#if child.properties !== undefined && child.properties.branding_enabled === "true" && !hide_branding}
|
||||||
<button class="action_button" onclick={e => file_event(FileAction.Branding, index, e)}>
|
<button class="action_button" onclick={e => file_event(FileAction.Branding, index, e)} title="Edit branding">
|
||||||
<i class="icon">palette</i>
|
<i class="icon i_palette"></i>
|
||||||
</button>
|
</button>
|
||||||
{/if}
|
{/if}
|
||||||
{#if !hide_edit}
|
{#if !hide_edit}
|
||||||
<button class="action_button" onclick={e => file_event(FileAction.Menu, index, e)}>
|
<button class="action_button" onclick={e => file_event(FileAction.Menu, index, e)} title="Menu">
|
||||||
<i class="icon">menu</i>
|
<i class="icon i_menu"></i>
|
||||||
</button>
|
</button>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
@@ -199,7 +200,7 @@ onMount(load_settings)
|
|||||||
</div>
|
</div>
|
||||||
{/each}
|
{/each}
|
||||||
<button type="submit">
|
<button type="submit">
|
||||||
<i class="icon">save</i>
|
<i class="icon i_save"></i>
|
||||||
Save
|
Save
|
||||||
</button>
|
</button>
|
||||||
</form>
|
</form>
|
||||||
|
|||||||
@@ -109,11 +109,11 @@ onMount(() => {
|
|||||||
{#snippet toolbar()}
|
{#snippet toolbar()}
|
||||||
{#if $trash.selecting}
|
{#if $trash.selecting}
|
||||||
<div class="toolbar toolbar_edit">
|
<div class="toolbar toolbar_edit">
|
||||||
<Button icon="close" click={() => trash.set_selecting(false)}/>
|
<Button icon="close" click={() => trash.set_selecting(false)} title="Stop selecting"/>
|
||||||
<div class="toolbar_spacer">Selecting files</div>
|
<div class="toolbar_spacer">Selecting files</div>
|
||||||
<Button click={restore} icon="restore_from_trash" label="Restore"/>
|
<Button click={restore} icon="restore_from_trash" label="Restore"/>
|
||||||
<button onclick={delete_selected} class="button_red">
|
<button onclick={delete_selected} class="button_red">
|
||||||
<i class="icon">delete_forever</i>
|
<i class="icon i_delete_forever"></i>
|
||||||
Delete
|
Delete
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
@@ -121,23 +121,23 @@ onMount(() => {
|
|||||||
<div class="toolbar">
|
<div class="toolbar">
|
||||||
<div>
|
<div>
|
||||||
<button onclick={() => history.back()} title="Back">
|
<button onclick={() => history.back()} title="Back">
|
||||||
<i class="icon">arrow_back</i>
|
<i class="icon i_arrow_back"></i>
|
||||||
</button>
|
</button>
|
||||||
<button onclick={() => nav.navigate_up()} title="Up">
|
<button onclick={() => nav.navigate_up()} title="Up">
|
||||||
<i class="icon">north</i>
|
<i class="icon i_north"></i>
|
||||||
</button>
|
</button>
|
||||||
<button onclick={load} title="Refresh trash bin">
|
<button onclick={load} title="Refresh trash bin">
|
||||||
<i class="icon">refresh</i>
|
<i class="icon i_refresh"></i>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div>Trash bin ({formatDataVolume(size, 3)})</div>
|
<div>Trash bin ({formatDataVolume(size, 3)})</div>
|
||||||
<div>
|
<div>
|
||||||
{#if $trash.children.length !== 0}
|
{#if $trash.children.length !== 0}
|
||||||
<button onclick={() => trash.set_selecting(true)} title="Select files to restore or delete">
|
<button onclick={() => trash.set_selecting(true)} title="Select files to restore or delete">
|
||||||
<i class="icon">select_all</i>
|
<i class="icon i_select_all"></i>
|
||||||
</button>
|
</button>
|
||||||
<button onclick={empty_trash} class="button_red">
|
<button onclick={empty_trash} class="button_red">
|
||||||
<i class="icon">delete_forever</i>
|
<i class="icon i_delete_forever"></i>
|
||||||
Delete all
|
Delete all
|
||||||
</button>
|
</button>
|
||||||
{/if}
|
{/if}
|
||||||
|
|||||||
@@ -1,157 +1,363 @@
|
|||||||
<script lang="ts" module>
|
<script lang="ts" module>
|
||||||
export type UploadJob = {
|
// A file, and its path relative to the directory which it is uploaded to
|
||||||
task_id: number,
|
export type Upload = { file: File, path: string }
|
||||||
file: File,
|
|
||||||
path: string,
|
// The widget is mounted once, in App.svelte, so that uploads keep running when
|
||||||
component: UploadProgress,
|
// the user opens another page. It sets these functions when it mounts
|
||||||
status: string,
|
export let upload_files: (files: Upload[] | Promise<Upload[]>) => void
|
||||||
total_size: number,
|
export let pick_files: () => void
|
||||||
loaded_size: number,
|
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { tick } from "svelte";
|
import { global_navigator as nav } from "filesystem/FSNavigator";
|
||||||
import UploadProgress from "./UploadProgress.svelte";
|
import { fs_path_url } from "lib/FilesystemAPI.svelte";
|
||||||
import type { FSNavigator } from "filesystem/FSNavigator";
|
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 }: {
|
type Job = Upload & {
|
||||||
nav: FSNavigator;
|
dir: string,
|
||||||
} = $props();
|
loaded: number,
|
||||||
|
// What loaded was at the previous update, the difference gives the speed
|
||||||
let file_input_field: HTMLInputElement = $state()
|
prev: number,
|
||||||
let file_input_change = (e: Event) => {
|
speed: number,
|
||||||
// Start uploading the files async
|
xhr?: XMLHttpRequest,
|
||||||
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()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const min_uploads = 2
|
const min_uploads = 2
|
||||||
const max_uploads = 20
|
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
|
// The uploads are deliberately not reactive. A dropped directory can hold
|
||||||
let status = $state("idle")
|
// 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 () => {
|
let visible = $state(false)
|
||||||
active_uploads = 0
|
let collapsed = $state(false)
|
||||||
let uploading_size = 0
|
let paused = $state(false)
|
||||||
for (let i = 0; i < upload_queue.length; i++) {
|
// The timer which waits to try again after the connection was lost
|
||||||
if (upload_queue[i]) {
|
let retry = $state(0)
|
||||||
// If this file is queued, start the upload
|
let view = $state.raw({
|
||||||
if (upload_queue[i].status === "queued") {
|
uploading: false,
|
||||||
upload_queue[i].component.start()
|
running: 0,
|
||||||
upload_queue[i].status = "uploading"
|
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
|
let file_input: HTMLInputElement
|
||||||
if (upload_queue[i].status === "uploading") {
|
pick_files = () => file_input.click()
|
||||||
uploading_size += upload_queue[i].total_size
|
const file_input_change = () => {
|
||||||
active_uploads++
|
upload_files(Array.from(file_input.files, file => ({ file, path: file.name })))
|
||||||
}
|
|
||||||
|
|
||||||
// If the size threshold or the concurrent upload limit is reached
|
// Without this the same file can't be picked twice in a row
|
||||||
// we break the loop. The system tries to keep an upload queue of
|
file_input.value = ""
|
||||||
// 100 MB and a minimum of two concurrent uploads.
|
}
|
||||||
if (
|
|
||||||
(uploading_size >= 100e6 && active_uploads >= min_uploads) ||
|
upload_files = async files => {
|
||||||
active_uploads >= max_uploads
|
// 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
|
||||||
console.debug("Current uploads", active_uploads, "uploads size", uploading_size)
|
const dir = nav.base.path
|
||||||
break
|
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) {
|
if (active.length + queue.length === 0) {
|
||||||
status = "finished"
|
files_total = files_done = size_total = size_done = speed = 0
|
||||||
nav.reload()
|
timer = window.setInterval(() => {
|
||||||
|
update()
|
||||||
|
schedule()
|
||||||
|
}, update_interval)
|
||||||
|
}
|
||||||
|
|
||||||
// Empty the queue to free any references to lingering components
|
const limit = $user?.subscription.file_size_limit || 20e9
|
||||||
upload_queue = []
|
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(() => {
|
setTimeout(() => {
|
||||||
if (status === "finished") {
|
if (timer === 0 && failed.length === 0) {
|
||||||
visible = false
|
visible = false
|
||||||
}
|
}
|
||||||
}, 10000)
|
}, 10e3)
|
||||||
} else {
|
|
||||||
status = "uploading"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const finish_upload = () => {
|
// The request is taken off the job first, that is how its loadend handler knows
|
||||||
// Update the queue so the status updates are properly rendered
|
// that it was aborted on purpose
|
||||||
upload_queue = upload_queue
|
const abort = (job: Job) => {
|
||||||
start_upload()
|
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) => {
|
const leave_confirmation = (e: BeforeUnloadEvent) => {
|
||||||
if (status === "uploading") {
|
if (active.length + queue.length > 0) {
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
return "If you close this page your files will stop uploading. Do you want to continue?"
|
|
||||||
} else {
|
|
||||||
return null
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
@@ -159,33 +365,94 @@ const leave_confirmation = (e: BeforeUnloadEvent) => {
|
|||||||
<svelte:window onbeforeunload={leave_confirmation} />
|
<svelte:window onbeforeunload={leave_confirmation} />
|
||||||
|
|
||||||
<input
|
<input
|
||||||
bind:this={file_input_field}
|
bind:this={file_input}
|
||||||
onchange={file_input_change}
|
onchange={file_input_change}
|
||||||
class="upload_input" type="file" name="file" multiple
|
class="upload_input" type="file" name="file" multiple
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{#if visible}
|
{#if visible}
|
||||||
<div class="upload_widget">
|
<div class="upload_widget bubble">
|
||||||
<div class="header">
|
<div class="header">
|
||||||
{#if status === "idle"}
|
<div class="grow">
|
||||||
Waiting for files
|
<div class="ellipsis">
|
||||||
{:else if status === "uploading"}
|
{#if !view.uploading}
|
||||||
Uploading files...
|
Done{#if view.failed_count > 0}, {view.failed_count} failed{/if}
|
||||||
{:else if status === "finished"}
|
{:else}
|
||||||
Done
|
{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}
|
{/if}
|
||||||
|
<Button
|
||||||
|
flat
|
||||||
|
icon={collapsed ? "expand_less" : "expand_more"}
|
||||||
|
title={collapsed ? "Expand" : "Collapse"}
|
||||||
|
click={() => collapsed = !collapsed}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="body">
|
|
||||||
{#each upload_queue as job, i}
|
{#if !collapsed}
|
||||||
{#if job.status !== "finished"}
|
<div class="stats">
|
||||||
<UploadProgress
|
{view.files_done} / {view.files_total} files,
|
||||||
bind:this={upload_queue[i].component}
|
{formatDataVolume(view.loaded, 3)} /
|
||||||
bind:job={upload_queue[i]}
|
{formatDataVolume(view.total, 3)}
|
||||||
finish={finish_upload}
|
{#if retry !== 0}
|
||||||
/>
|
<br/>
|
||||||
|
Trying again every 10 seconds
|
||||||
{/if}
|
{/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>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
@@ -200,34 +467,59 @@ const leave_confirmation = (e: BeforeUnloadEvent) => {
|
|||||||
position: fixed;
|
position: fixed;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
width: auto;
|
width: 600px;
|
||||||
min-width: 400px;
|
max-width: calc(100% - 40px);
|
||||||
max-width: 80%;
|
|
||||||
height: auto;
|
|
||||||
max-height: 50%;
|
max-height: 50%;
|
||||||
right: 20px;
|
right: 20px;
|
||||||
bottom: 20px;
|
bottom: 20px;
|
||||||
border-radius: 8px;
|
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
color: var(--body_text_color);
|
||||||
box-shadow: 1px 1px 8px var(--shadow_color);
|
box-shadow: 1px 1px 8px var(--shadow_color);
|
||||||
}
|
}
|
||||||
|
|
||||||
.header {
|
.header {
|
||||||
flex: 0 0 auto;
|
flex: 0 0 auto;
|
||||||
background: var(--background_color);
|
display: flex;
|
||||||
color: var(--background_text_color);
|
align-items: center;
|
||||||
text-align: center;
|
padding: 0 0 0 8px;
|
||||||
|
border-bottom: 1px solid var(--separator);
|
||||||
|
}
|
||||||
|
.header .ellipsis {
|
||||||
font-size: 1.2em;
|
font-size: 1.2em;
|
||||||
padding: 4px;
|
}
|
||||||
white-space: nowrap;
|
.stats {
|
||||||
text-overflow: ellipsis;
|
flex: 0 0 auto;
|
||||||
overflow: hidden;
|
padding: 4px 8px;
|
||||||
|
text-align: center;
|
||||||
}
|
}
|
||||||
.body {
|
.body {
|
||||||
flex: 1 1 auto;
|
flex: 1 1 auto;
|
||||||
background: var(--body_color);
|
|
||||||
color: var(--body_text_color);
|
|
||||||
overflow-y: auto;
|
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;
|
text-align: left;
|
||||||
}
|
}
|
||||||
|
.error {
|
||||||
|
padding: 2px 8px;
|
||||||
|
background: var(--red_tint);
|
||||||
|
color: var(--red_color);
|
||||||
|
overflow-wrap: break-word;
|
||||||
|
}
|
||||||
</style>
|
</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"/>
|
<track kind="captions"/>
|
||||||
</audio>
|
</audio>
|
||||||
<div style="text-align: center;">
|
<div style="text-align: center;">
|
||||||
<button onclick={() => change_track(-1)}><i class="icon">skip_previous</i></button>
|
<button onclick={() => change_track(-1)} title="Previous track"><i class="icon i_skip_previous"></i></button>
|
||||||
<button onclick={() => seek(-10)}><i class="icon">replay_10</i></button>
|
<button onclick={() => seek(-10)} title="Back 10 seconds"><i class="icon i_replay_10"></i></button>
|
||||||
<button onclick={toggle_playback}>
|
<button onclick={toggle_playback} title={playing ? "Pause" : "Play"}>
|
||||||
{#if playing}
|
{#if playing}
|
||||||
<i class="icon">pause</i>
|
<i class="icon i_pause"></i>
|
||||||
{:else}
|
{:else}
|
||||||
<i class="icon">play_arrow</i>
|
<i class="icon i_play_arrow"></i>
|
||||||
{/if}
|
{/if}
|
||||||
</button>
|
</button>
|
||||||
<button onclick={() => seek(10)}><i class="icon">forward_10</i></button>
|
<button onclick={() => seek(10)} title="Forward 10 seconds"><i class="icon i_forward_10"></i></button>
|
||||||
<button onclick={() => change_track(1)}><i class="icon">skip_next</i></button>
|
<button onclick={() => change_track(1)} title="Next track"><i class="icon i_skip_next"></i></button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<h2>Tracklist</h2>
|
<h2>Tracklist</h2>
|
||||||
@@ -146,7 +146,7 @@ onMount(() => {
|
|||||||
{#if !sibling.is_hidden()}
|
{#if !sibling.is_hidden()}
|
||||||
<a href={"/d"+fs_encode_path(sibling.path)} class="node" class:button_highlight={sibling.path === $nav.base.path}>
|
<a href={"/d"+fs_encode_path(sibling.path)} class="node" class:button_highlight={sibling.path === $nav.base.path}>
|
||||||
{#if 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}
|
{:else}
|
||||||
<img src={fs_node_icon(sibling, 64, 64)} class="node_icon" alt="icon"/>
|
<img src={fs_node_icon(sibling, 64, 64)} class="node_icon" alt="icon"/>
|
||||||
{/if}
|
{/if}
|
||||||
|
|||||||
@@ -1,14 +1,11 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import type { FSNode } from 'lib/FilesystemAPI.svelte';
|
import type { FSNode } from 'lib/FilesystemAPI.svelte';
|
||||||
import { run } from 'svelte/legacy';
|
|
||||||
|
|
||||||
let { path = [] }: {path: FSNode[]} = $props();
|
let { path = [] }: {path: FSNode[]} = $props();
|
||||||
|
|
||||||
let image_uri: string = $state()
|
let { image_uri, image_link } = $derived.by(() => {
|
||||||
let image_link: string = $state()
|
let image_uri: string = null
|
||||||
const update_links = (path: FSNode[]) => {
|
let image_link: string = null
|
||||||
image_uri = null
|
|
||||||
image_link = null
|
|
||||||
for (let node of path) {
|
for (let node of path) {
|
||||||
if (node.properties && node.properties.branding_enabled === "true") {
|
if (node.properties && node.properties.branding_enabled === "true") {
|
||||||
if (node.properties.brand_header_image) {
|
if (node.properties.brand_header_image) {
|
||||||
@@ -19,10 +16,8 @@ const update_links = (path: FSNode[]) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
return { image_uri, image_link }
|
||||||
run(() => {
|
})
|
||||||
update_links(path)
|
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#if image_uri}
|
{#if image_uri}
|
||||||
|
|||||||
@@ -37,11 +37,11 @@ let {
|
|||||||
</table>
|
</table>
|
||||||
<hr/>
|
<hr/>
|
||||||
<button class="button_highlight" onclick={() => node.download()}>
|
<button class="button_highlight" onclick={() => node.download()}>
|
||||||
<i class="icon">download</i>
|
<i class="icon i_download"></i>
|
||||||
<span>Download</span>
|
<span>Download</span>
|
||||||
</button>
|
</button>
|
||||||
<button onclick={() => open_details()}>
|
<button onclick={() => open_details()}>
|
||||||
<i class="icon">help</i>
|
<i class="icon i_help"></i>
|
||||||
<span>Details</span>
|
<span>Details</span>
|
||||||
</button>
|
</button>
|
||||||
</IconBlock>
|
</IconBlock>
|
||||||
|
|||||||
@@ -14,18 +14,15 @@ import Torrent from "./Torrent.svelte";
|
|||||||
import Zip from "./Zip.svelte";
|
import Zip from "./Zip.svelte";
|
||||||
import CustomBanner from "./CustomBanner.svelte";
|
import CustomBanner from "./CustomBanner.svelte";
|
||||||
import type { FSNavigator } from "filesystem/FSNavigator";
|
import type { FSNavigator } from "filesystem/FSNavigator";
|
||||||
import FsUploadWidget from "filesystem/upload_widget/FSUploadWidget.svelte";
|
|
||||||
import EditWindow from "filesystem/edit_window/EditWindow.svelte";
|
import EditWindow from "filesystem/edit_window/EditWindow.svelte";
|
||||||
import DetailsWindow from "filesystem/DetailsWindow.svelte";
|
import DetailsWindow from "filesystem/DetailsWindow.svelte";
|
||||||
|
|
||||||
let {
|
let {
|
||||||
nav,
|
nav,
|
||||||
upload_widget,
|
|
||||||
edit_window,
|
edit_window,
|
||||||
details_window,
|
details_window,
|
||||||
}: {
|
}: {
|
||||||
nav: FSNavigator
|
nav: FSNavigator
|
||||||
upload_widget: FsUploadWidget
|
|
||||||
edit_window: EditWindow
|
edit_window: EditWindow
|
||||||
details_window: DetailsWindow
|
details_window: DetailsWindow
|
||||||
} = $props();
|
} = $props();
|
||||||
@@ -89,7 +86,7 @@ export const seek = (delta: number) => {
|
|||||||
{:else if viewer_type === "dir" && $nav.base.name === ".Trash"}
|
{:else if viewer_type === "dir" && $nav.base.name === ".Trash"}
|
||||||
<TrashBin nav={nav} root_path={$nav.path[$nav.path.length - 2].path}/>
|
<TrashBin nav={nav} root_path={$nav.path[$nav.path.length - 2].path}/>
|
||||||
{:else if viewer_type === "dir"}
|
{:else if viewer_type === "dir"}
|
||||||
<FileManager nav={nav} upload_widget={upload_widget} edit_window={edit_window}>
|
<FileManager nav={nav} edit_window={edit_window}>
|
||||||
<CustomBanner path={$nav.path}/>
|
<CustomBanner path={$nav.path}/>
|
||||||
</FileManager>
|
</FileManager>
|
||||||
{:else if viewer_type === "audio"}
|
{:else if viewer_type === "audio"}
|
||||||
|
|||||||
@@ -96,7 +96,7 @@ let magnet = $state("")
|
|||||||
</p>
|
</p>
|
||||||
{/if}
|
{/if}
|
||||||
<button onclick={() => node.download()} class="button">
|
<button onclick={() => node.download()} class="button">
|
||||||
<i class="icon">download</i>
|
<i class="icon i_download"></i>
|
||||||
<span>Download torrent file</span>
|
<span>Download torrent file</span>
|
||||||
</button>
|
</button>
|
||||||
</IconBlock>
|
</IconBlock>
|
||||||
|
|||||||
@@ -118,35 +118,35 @@ const video_keydown = (e: KeyboardEvent) => {
|
|||||||
|
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<div class="spacer"></div>
|
<div class="spacer"></div>
|
||||||
<button onclick={() => open_sibling(-1)}>
|
<button onclick={() => open_sibling(-1)} title="Previous file">
|
||||||
<i class="icon">skip_previous</i>
|
<i class="icon i_skip_previous"></i>
|
||||||
</button>
|
</button>
|
||||||
<button onclick={() => seek(-10)}>
|
<button onclick={() => seek(-10)} title="Back 10 seconds">
|
||||||
<i class="icon">replay_10</i>
|
<i class="icon i_replay_10"></i>
|
||||||
</button>
|
</button>
|
||||||
<button onclick={toggle_playback} class="button_highlight">
|
<button onclick={toggle_playback} class="button_highlight" title={playing ? "Pause" : "Play"}>
|
||||||
{#if playing}
|
{#if playing}
|
||||||
<i class="icon">pause</i>
|
<i class="icon i_pause"></i>
|
||||||
{:else}
|
{:else}
|
||||||
<i class="icon">play_arrow</i>
|
<i class="icon i_play_arrow"></i>
|
||||||
{/if}
|
{/if}
|
||||||
</button>
|
</button>
|
||||||
<button onclick={() => seek(10)}>
|
<button onclick={() => seek(10)} title="Forward 10 seconds">
|
||||||
<i class="icon">forward_10</i>
|
<i class="icon i_forward_10"></i>
|
||||||
</button>
|
</button>
|
||||||
<button onclick={() => open_sibling(1)}>
|
<button onclick={() => open_sibling(1)} title="Next file">
|
||||||
<i class="icon">skip_next</i>
|
<i class="icon i_skip_next"></i>
|
||||||
</button>
|
</button>
|
||||||
<div style="width: 16px; height: 8px;"></div>
|
<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}
|
{#if player && player.muted}
|
||||||
<i class="icon">volume_off</i>
|
<i class="icon i_volume_off"></i>
|
||||||
{:else}
|
{:else}
|
||||||
<i class="icon">volume_up</i>
|
<i class="icon i_volume_up"></i>
|
||||||
{/if}
|
{/if}
|
||||||
</button>
|
</button>
|
||||||
<button onclick={toggle_fullscreen}>
|
<button onclick={toggle_fullscreen} title="Fullscreen">
|
||||||
<i class="icon">fullscreen</i>
|
<i class="icon i_fullscreen"></i>
|
||||||
</button>
|
</button>
|
||||||
<div class="spacer"></div>
|
<div class="spacer"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -48,19 +48,22 @@ export const update = async () => {
|
|||||||
return
|
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
|
// 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
|
// downloaded. If so then we set the download URL for each file. This
|
||||||
if (zip.properties !== undefined) {
|
// happens before the zip becomes state, else every file in the archive
|
||||||
if (zip.properties.includes("read_individual_files")) {
|
// 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
|
// 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)
|
comp_ratio = (uncomp_size / node.file_size)
|
||||||
status = "finished"
|
status = "finished"
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
@@ -125,7 +128,7 @@ const recursive_size = (file: ZipEntry) => {
|
|||||||
</table>
|
</table>
|
||||||
<hr/>
|
<hr/>
|
||||||
<button class="button_highlight" onclick={() => node.download()}>
|
<button class="button_highlight" onclick={() => node.download()}>
|
||||||
<i class="icon">download</i>
|
<i class="icon i_download"></i>
|
||||||
<span>Download</span>
|
<span>Download</span>
|
||||||
</button>
|
</button>
|
||||||
</IconBlock>
|
</IconBlock>
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ let { item = {} as ZipEntry }: {
|
|||||||
{#if child.children}
|
{#if child.children}
|
||||||
<details bind:open={child.details_open}>
|
<details bind:open={child.details_open}>
|
||||||
<summary>
|
<summary>
|
||||||
|
<i class="icon {child.details_open ? 'i_folder_open' : 'i_folder'}"></i>
|
||||||
<div class="filename">
|
<div class="filename">
|
||||||
{name}
|
{name}
|
||||||
(
|
(
|
||||||
@@ -37,6 +38,7 @@ let { item = {} as ZipEntry }: {
|
|||||||
{#each Object.entries(item.children) as [name, child]}
|
{#each Object.entries(item.children) as [name, child]}
|
||||||
{#if !child.children}
|
{#if !child.children}
|
||||||
<li>
|
<li>
|
||||||
|
<i class="icon i_description"></i>
|
||||||
<div class="filename">
|
<div class="filename">
|
||||||
{name}
|
{name}
|
||||||
(
|
(
|
||||||
@@ -59,19 +61,13 @@ details {
|
|||||||
}
|
}
|
||||||
details > summary {
|
details > summary {
|
||||||
list-style-type: none;
|
list-style-type: none;
|
||||||
|
}
|
||||||
|
details > summary, li {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
}
|
}
|
||||||
details > summary::before {
|
.icon {
|
||||||
font-family: 'Material Icons';
|
font-size: 1em;
|
||||||
content: 'folder';
|
|
||||||
}
|
|
||||||
details[open] > summary::before {
|
|
||||||
font-family: 'Material Icons';
|
|
||||||
content: 'folder_open';
|
|
||||||
}
|
|
||||||
li::before {
|
|
||||||
font-family: 'Material Icons';
|
|
||||||
content: 'description';
|
|
||||||
}
|
}
|
||||||
ul {
|
ul {
|
||||||
list-style-type: none;
|
list-style-type: none;
|
||||||
@@ -80,7 +76,6 @@ ul {
|
|||||||
border-left: 2px solid var(--separator);
|
border-left: 2px solid var(--separator);
|
||||||
}
|
}
|
||||||
.filename {
|
.filename {
|
||||||
display: inline;
|
|
||||||
margin-left: 0.5em;
|
margin-left: 0.5em;
|
||||||
}
|
}
|
||||||
</style>
|
</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>
|
<script lang="ts">
|
||||||
import Footer from "layout/Footer.svelte";
|
|
||||||
import { drop_target } from "lib/DropTarget";
|
|
||||||
import GetStarted from "./GetStarted.svelte";
|
|
||||||
import Pricing from "./Pricing.svelte";
|
|
||||||
import SubscriptionPlans from "layout/checkout/SubscriptionPlans.svelte";
|
import SubscriptionPlans from "layout/checkout/SubscriptionPlans.svelte";
|
||||||
import NovaLogo from "util/NovaLogo.svelte";
|
import NovaLogo from "util/NovaLogo.svelte";
|
||||||
|
import { user } from "lib/UserStore";
|
||||||
let upload_widget
|
import LoginRegister from "login/LoginRegister.svelte";
|
||||||
|
import Showcase from "./Showcase.svelte";
|
||||||
|
import Euro from "util/Euro.svelte";
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<header class="logo_header">
|
<header class="hero">
|
||||||
<NovaLogo full style="display: block; height: 100px; max-width: 100%; margin: 50px auto;"/>
|
<NovaLogo full style="display: block; height: 100px; max-width: 100%; margin: 50px auto 0 auto;"/>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
<div class="page_content">
|
<section>
|
||||||
<div class="highlight_yellow">
|
<div class="highlight_yellow">
|
||||||
This is a development server. All files and accounts may be lost when
|
This is a development server. All files and accounts may be lost when
|
||||||
the final product launches.
|
the final product launches.
|
||||||
</div>
|
</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>
|
<p>
|
||||||
Nova.storage is a platform for cost-effective cloud storage and
|
Nova is developed and operated entirely within Europe. With its
|
||||||
content delivery. We will store and serve your files at an extremely
|
headquarters in the Netherlands and hosting in Germany.
|
||||||
competitive rate.
|
|
||||||
</p>
|
</p>
|
||||||
<h2>Features</h2>
|
</div>
|
||||||
<ul>
|
<div class="bubble">
|
||||||
<li>
|
<h3><i class="icon i_storage"></i> Proven storage engine</h3>
|
||||||
Cloud storage with <a href="/filesystem#toc_7">rclone</a> and
|
<p>
|
||||||
FTPS support
|
Pixelstore, the storage engine behind Nova, has been running in
|
||||||
</li>
|
production for more than ten years. It is fine-tuned for
|
||||||
<li>
|
reliability and performance.
|
||||||
Customizable download pages (custom branding colours, header and
|
</p>
|
||||||
background images)
|
</div>
|
||||||
</li>
|
<div class="bubble">
|
||||||
<li>
|
<h3><i class="icon i_verified_user"></i> Fault-tolerant</h3>
|
||||||
Fault tolerance for up to four storage server failures
|
<p>
|
||||||
</li>
|
The storage, database and caching layers all have redundancy built
|
||||||
<li>
|
in. Your files stay available through up to four storage server
|
||||||
Caching servers highly optimized for long-distance data transfer
|
failures.
|
||||||
</li>
|
</p>
|
||||||
</ul>
|
</div>
|
||||||
<h3>What you don't get</h3>
|
<div class="bubble">
|
||||||
<ul>
|
<h3>
|
||||||
<li>
|
<i class="icon i_speed"></i>
|
||||||
Data backups - Please keep a local copy of everything you store
|
Highly optimised
|
||||||
in case of emergency
|
</h3>
|
||||||
</li>
|
<p>
|
||||||
<li>
|
Our servers are tuned for high performance transfers over long
|
||||||
Commercial support - I'm busy, please don't bother me
|
distances, so downloads stay fast no matter where you are in the
|
||||||
</li>
|
world.
|
||||||
</ul>
|
</p>
|
||||||
</section>
|
</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>
|
</div>
|
||||||
|
|
||||||
<header>
|
<header>
|
||||||
@@ -60,19 +88,86 @@ let upload_widget
|
|||||||
</header>
|
</header>
|
||||||
<SubscriptionPlans/>
|
<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>
|
<style>
|
||||||
header {
|
.hero {
|
||||||
padding-top: 20px;
|
padding: 0 8px 20px 8px;
|
||||||
padding-bottom: 20px;
|
|
||||||
}
|
}
|
||||||
.logo_header {
|
.highlights {
|
||||||
text-align: initial;
|
display: grid;
|
||||||
padding-top: 0;
|
grid-template-columns: repeat(auto-fill, minmax(min(18em, 100%), 1fr));
|
||||||
padding-bottom: 0;
|
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 {
|
header > h1 {
|
||||||
margin-top: 30px;
|
margin-top: 30px;
|
||||||
margin-bottom: 30px;
|
margin-bottom: 30px;
|
||||||
}
|
}
|
||||||
|
|
||||||
</style>
|
</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>
|
<style>
|
||||||
.star {
|
.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>
|
<style>
|
||||||
.star {
|
.star {
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ let click_int = (e: MouseEvent) => {
|
|||||||
disabled={disabled ? true:null}
|
disabled={disabled ? true:null}
|
||||||
>
|
>
|
||||||
{#if icon !== ""}
|
{#if icon !== ""}
|
||||||
<i class="icon" class:small={icon_small}>{icon}</i>
|
<i class="icon i_{icon}" class:small={icon_small}></i>
|
||||||
{/if}
|
{/if}
|
||||||
{#if label !== ""}
|
{#if label !== ""}
|
||||||
<span>{label}</span>
|
<span>{label}</span>
|
||||||
@@ -85,7 +85,7 @@ let click_int = (e: MouseEvent) => {
|
|||||||
style={style}
|
style={style}
|
||||||
>
|
>
|
||||||
{#if icon !== ""}
|
{#if icon !== ""}
|
||||||
<i class="icon" class:small={icon_small}>{icon}</i>
|
<i class="icon i_{icon}" class:small={icon_small}></i>
|
||||||
{/if}
|
{/if}
|
||||||
{#if label !== ""}
|
{#if label !== ""}
|
||||||
<span>{label}</span>
|
<span>{label}</span>
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ export const copy = (e: MouseEvent) => {
|
|||||||
title="Copy text to clipboard"
|
title="Copy text to clipboard"
|
||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
>
|
>
|
||||||
<i class="icon">content_copy</i>
|
<i class="icon i_content_copy"></i>
|
||||||
<span>
|
<span>
|
||||||
{#if success}
|
{#if success}
|
||||||
Copied!
|
Copied!
|
||||||
|
|||||||
@@ -10,8 +10,9 @@ let {
|
|||||||
class:button_highlight={toggle}
|
class:button_highlight={toggle}
|
||||||
style="margin: 0;"
|
style="margin: 0;"
|
||||||
onclick={() => toggle = !toggle}
|
onclick={() => toggle = !toggle}
|
||||||
|
title="Help"
|
||||||
>
|
>
|
||||||
<i class="icon">help</i>
|
<i class="icon i_help"></i>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
|||||||
@@ -23,30 +23,27 @@ import { formatDataVolume, formatDataVolumeBits, formatThousands } from "util/Fo
|
|||||||
|
|
||||||
let {
|
let {
|
||||||
index_field = "",
|
index_field = "",
|
||||||
rows = $bindable([]),
|
rows = [],
|
||||||
columns = [],
|
columns = [],
|
||||||
sort_field = $bindable(index_field),
|
sort_field = index_field,
|
||||||
totals = false
|
totals = false
|
||||||
}: {
|
}: {
|
||||||
index_field?: string;
|
index_field?: string;
|
||||||
rows?: any;
|
rows?: any[];
|
||||||
columns?: SortColumn[];
|
columns?: SortColumn[];
|
||||||
sort_field?: any;
|
sort_field?: string;
|
||||||
totals?: boolean;
|
totals?: boolean;
|
||||||
} = $props();
|
} = $props();
|
||||||
|
|
||||||
let asc = $state(true)
|
let asc = $state(true)
|
||||||
const sort = (field: string) => {
|
const sort = (field: string) => {
|
||||||
if (field !== "" && field === sort_field) {
|
if (field === sort_field) {
|
||||||
asc = !asc
|
asc = !asc
|
||||||
}
|
}
|
||||||
if (field === "") {
|
|
||||||
field = sort_field
|
|
||||||
}
|
|
||||||
sort_field = field
|
sort_field = field
|
||||||
|
|
||||||
console.log("sorting by", field, "asc", asc)
|
console.log("sorting by", field, "asc", asc)
|
||||||
rows.sort((a, b) => {
|
rows = [...rows].sort((a, b) => {
|
||||||
if (typeof (a[field]) === "number") {
|
if (typeof (a[field]) === "number") {
|
||||||
// Sort ints from high to low
|
// Sort ints from high to low
|
||||||
if (asc) {
|
if (asc) {
|
||||||
@@ -63,7 +60,6 @@ const sort = (field: string) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
rows = rows
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ let {
|
|||||||
highlight = false,
|
highlight = false,
|
||||||
flat = false,
|
flat = false,
|
||||||
action,
|
action,
|
||||||
|
title,
|
||||||
children,
|
children,
|
||||||
}: {
|
}: {
|
||||||
on?: boolean;
|
on?: boolean;
|
||||||
@@ -20,6 +21,7 @@ let {
|
|||||||
highlight?: boolean;
|
highlight?: boolean;
|
||||||
flat?: boolean;
|
flat?: boolean;
|
||||||
action?: (e: MouseEvent) => void;
|
action?: (e: MouseEvent) => void;
|
||||||
|
title?: string;
|
||||||
children?: import('svelte').Snippet;
|
children?: import('svelte').Snippet;
|
||||||
} = $props();
|
} = $props();
|
||||||
|
|
||||||
@@ -34,6 +36,7 @@ const click = (e: MouseEvent) => {
|
|||||||
<button
|
<button
|
||||||
onclick={click}
|
onclick={click}
|
||||||
type="button"
|
type="button"
|
||||||
|
title={title}
|
||||||
class="button"
|
class="button"
|
||||||
class:button_highlight={highlight}
|
class:button_highlight={highlight}
|
||||||
class:group_first
|
class:group_first
|
||||||
@@ -42,9 +45,9 @@ const click = (e: MouseEvent) => {
|
|||||||
class:flat
|
class:flat
|
||||||
>
|
>
|
||||||
{#if on}
|
{#if on}
|
||||||
<i class="icon on">{icon_on}</i>
|
<i class="icon on i_{icon_on}"></i>
|
||||||
{:else}
|
{:else}
|
||||||
<i class="icon off">{icon_off}</i>
|
<i class="icon off i_{icon_off}"></i>
|
||||||
{/if}
|
{/if}
|
||||||
{@render children?.()}
|
{@render children?.()}
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ const open = () => dialog.open(button.getBoundingClientRect())
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<button bind:this={button} onclick={open} class="button round">
|
<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>
|
</button>
|
||||||
|
|
||||||
<Dialog bind:this={dialog}>
|
<Dialog bind:this={dialog}>
|
||||||
|
|||||||
@@ -171,7 +171,7 @@ const submit = async (e: SubmitEvent) => {
|
|||||||
{#if covered}
|
{#if covered}
|
||||||
|
|
||||||
<button type="submit" class="button_highlight" style="flex-direction: column;">
|
<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}
|
Activate plan {status.subscription.name}
|
||||||
({status.months} month{status.months === 1 ? "" : "s"})
|
({status.months} month{status.months === 1 ? "" : "s"})
|
||||||
</button>
|
</button>
|
||||||
@@ -203,7 +203,7 @@ const submit = async (e: SubmitEvent) => {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<button type="submit" class="button_highlight">
|
<button type="submit" class="button_highlight">
|
||||||
<i class="icon">paid</i> Checkout
|
<i class="icon i_paid"></i> Checkout
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -259,10 +259,10 @@ const submit = async (e: SubmitEvent) => {
|
|||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
{#if p.months === status.months}
|
{#if p.months === status.months}
|
||||||
<i class="icon">check</i> Selected
|
<i class="icon i_check"></i> Selected
|
||||||
{:else}
|
{:else}
|
||||||
<button onclick={() => switch_period(p)}>
|
<button onclick={() => switch_period(p)}>
|
||||||
<i class="icon">swap_horiz</i> Select
|
<i class="icon i_swap_horiz"></i> Select
|
||||||
</button>
|
</button>
|
||||||
{/if}
|
{/if}
|
||||||
</td>
|
</td>
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { preventDefault } from 'svelte/legacy';
|
|
||||||
import { countries } from "country-data-list";
|
import { countries } from "country-data-list";
|
||||||
import { get_misc_vat_rate, put_user } from "lib/NovaAPI";
|
import { get_misc_vat_rate, put_user } from "lib/NovaAPI";
|
||||||
import { payment_providers, type CheckoutState } from "./CheckoutLib";
|
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
|
Please pick your country of residence
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<form onsubmit={preventDefault(set_country)} class="country_form">
|
<form onsubmit={set_country} class="country_form">
|
||||||
<div class="country_search">
|
<div class="country_search">
|
||||||
<datalist id="country_picker">
|
<datalist id="country_picker">
|
||||||
{#each countries.all.filter(c => c.status === "assigned") as c}
|
{#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"
|
placeholder="Search for country"
|
||||||
style="flex: 1 1 auto;">
|
style="flex: 1 1 auto;">
|
||||||
<button type="submit" class="button_highlight" style="flex: 0 0 auto;">
|
<button type="submit" class="button_highlight" style="flex: 0 0 auto;">
|
||||||
<i class="icon">send</i>
|
<i class="icon i_send"></i>
|
||||||
Continue
|
Continue
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ const submit = async (e: SubmitEvent) => {
|
|||||||
|
|
||||||
<button type="submit" class="button_highlight" style="align-self: end;">
|
<button type="submit" class="button_highlight" style="align-self: end;">
|
||||||
Continue
|
Continue
|
||||||
<i class="icon">chevron_right</i>
|
<i class="icon i_chevron_right"></i>
|
||||||
</button>
|
</button>
|
||||||
</form>
|
</form>
|
||||||
<hr/>
|
<hr/>
|
||||||
|
|||||||
@@ -67,11 +67,11 @@ const cancel = async () => {
|
|||||||
<SuccessMessage bind:this={cancel_message}/>
|
<SuccessMessage bind:this={cancel_message}/>
|
||||||
<div class="options">
|
<div class="options">
|
||||||
<button onclick={extend}>
|
<button onclick={extend}>
|
||||||
<i class="icon">more_time</i>
|
<i class="icon i_more_time"></i>
|
||||||
Extend current plan (credit deposit)
|
Extend current plan (credit deposit)
|
||||||
</button>
|
</button>
|
||||||
<button onclick={cancel}>
|
<button onclick={cancel}>
|
||||||
<i class="icon">cancel</i>
|
<i class="icon i_cancel"></i>
|
||||||
Cancel current plan and return to Free
|
Cancel current plan and return to Free
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ export type Peer = {
|
|||||||
ip: string
|
ip: string
|
||||||
port: number
|
port: number
|
||||||
hostname: string
|
hostname: string
|
||||||
role: string
|
services: string[] | null
|
||||||
reachable: boolean
|
reachable: boolean
|
||||||
unreachable_count: number
|
unreachable_count: number
|
||||||
latency: number
|
latency: number
|
||||||
|
|||||||
@@ -1,7 +1,11 @@
|
|||||||
|
import type { Upload } from "filesystem/upload_widget/FSUploadWidget.svelte"
|
||||||
|
|
||||||
export const drop_target = (
|
export const drop_target = (
|
||||||
node: HTMLElement,
|
node: HTMLElement,
|
||||||
args: {
|
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,
|
shadow: string | undefined,
|
||||||
},
|
},
|
||||||
) => {
|
) => {
|
||||||
@@ -39,7 +43,7 @@ export const drop_target = (
|
|||||||
const dragleave = (e: DragEvent) => {
|
const dragleave = (e: DragEvent) => {
|
||||||
node.style.boxShadow = ""
|
node.style.boxShadow = ""
|
||||||
}
|
}
|
||||||
const drop = async (e: DragEvent) => {
|
const drop = (e: DragEvent) => {
|
||||||
node.style.boxShadow = ""
|
node.style.boxShadow = ""
|
||||||
|
|
||||||
if (can_upload(e)) {
|
if (can_upload(e)) {
|
||||||
@@ -49,39 +53,59 @@ export const drop_target = (
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// if directory support is available
|
// The items are only valid until this function returns, so every entry
|
||||||
if (e.dataTransfer && e.dataTransfer.items && e.dataTransfer.items.length > 0) {
|
// has to be taken out of them before the first await
|
||||||
for (let i = 0; i < e.dataTransfer.items.length; i++) {
|
const files: Upload[] = []
|
||||||
const entry: FileSystemEntry | null = e.dataTransfer.items[i].webkitGetAsEntry();
|
const reads: Promise<void>[] = []
|
||||||
if (entry !== null) {
|
for (let i = 0; i < e.dataTransfer.items.length; i++) {
|
||||||
read_dir_recursive(entry);
|
const entry = e.dataTransfer.items[i].webkitGetAsEntry()
|
||||||
continue
|
if (entry !== null) {
|
||||||
}
|
reads.push(read_entry(entry, files))
|
||||||
const file: File | null = e.dataTransfer.items[i].getAsFile();
|
continue
|
||||||
if (file !== null) {
|
|
||||||
args.upload([file]);
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else if (e.dataTransfer && e.dataTransfer.files && e.dataTransfer.files.length > 0) {
|
|
||||||
const files: File[] = []
|
// Files which are not on the disk have no entry, like an image
|
||||||
for (let i = 0; i < e.dataTransfer.files.length; i++) {
|
// which is dragged out of another web page
|
||||||
files.push(e.dataTransfer.files[i])
|
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) {
|
// Adds a file, or all the files in a directory, to the list. The path comes
|
||||||
(item as FileSystemDirectoryEntry).createReader().readEntries(entries => {
|
// from the entry. Firefox also puts it in the file's webkitRelativePath,
|
||||||
entries.forEach(entry => {
|
// but Chromium leaves that empty for dropped files
|
||||||
read_dir_recursive(entry);
|
const read_entry = async (entry: FileSystemEntry, files: Upload[]) => {
|
||||||
});
|
if (entry.isFile) {
|
||||||
});
|
files.push({
|
||||||
} else {
|
path: entry.fullPath.slice(1),
|
||||||
(item as FileSystemFileEntry).file(file => {
|
file: await new Promise<File>((resolve, reject) =>
|
||||||
args.upload([file])
|
(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)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -208,6 +208,20 @@ export const subscription_periods: SubscriptionPeriod[] = [
|
|||||||
// same value the server divides the monthly fee by
|
// same value the server divides the monthly fee by
|
||||||
export const days_per_month = 365.25 / 12
|
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 () => {
|
export const get_misc_subscriptions = async () => {
|
||||||
return await check_response(
|
return await check_response(
|
||||||
await fetch(get_endpoint() + "/misc/subscriptions")
|
await fetch(get_endpoint() + "/misc/subscriptions")
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ onMount(async () => {
|
|||||||
<li>
|
<li>
|
||||||
{dir.path}
|
{dir.path}
|
||||||
<button onclick={() => dirs.splice(index, 1)} title="Remove">
|
<button onclick={() => dirs.splice(index, 1)} title="Remove">
|
||||||
<i class="icon">close</i>
|
<i class="icon i_close"></i>
|
||||||
</button>
|
</button>
|
||||||
</li>
|
</li>
|
||||||
{/each}
|
{/each}
|
||||||
@@ -111,7 +111,7 @@ onMount(async () => {
|
|||||||
{/if}
|
{/if}
|
||||||
<p>
|
<p>
|
||||||
<button onclick={() => picker.open("/me")}>
|
<button onclick={() => picker.open("/me")}>
|
||||||
<i class="icon">folder</i>
|
<i class="icon i_folder"></i>
|
||||||
{dirs.length === 0 ? "Pick directories" : "Add a directory"}
|
{dirs.length === 0 ? "Pick directories" : "Add a directory"}
|
||||||
</button>
|
</button>
|
||||||
</p>
|
</p>
|
||||||
@@ -122,12 +122,12 @@ onMount(async () => {
|
|||||||
app on the <a href="/user/api_keys">API keys page</a>.
|
app on the <a href="/user/api_keys">API keys page</a>.
|
||||||
</p>
|
</p>
|
||||||
<button class="button_highlight" onclick={approve}>
|
<button class="button_highlight" onclick={approve}>
|
||||||
<i class="icon">check</i> Approve
|
<i class="icon i_check"></i> Approve
|
||||||
</button>
|
</button>
|
||||||
<!-- For a request which was not approved the address has an error
|
<!-- For a request which was not approved the address has an error
|
||||||
in it, which tells the app that the user said no -->
|
in it, which tells the app that the user said no -->
|
||||||
<a class="button" href={request.redirect_uri} rel="external">
|
<a class="button" href={request.redirect_uri} rel="external">
|
||||||
<i class="icon">close</i> Deny
|
<i class="icon i_close"></i> Deny
|
||||||
</a>
|
</a>
|
||||||
{/if}
|
{/if}
|
||||||
</section>
|
</section>
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { createEventDispatcher, onMount } from "svelte";
|
import { onMount } from "svelte";
|
||||||
import Form, { type FormConfig } from "util/Form.svelte"
|
import Form, { type FormConfig } from "util/Form.svelte"
|
||||||
import { check_response, get_endpoint } from "lib/NovaAPI";
|
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 = {
|
const form_login: FormConfig = {
|
||||||
fields: [
|
fields: [
|
||||||
@@ -21,7 +23,7 @@ const form_login: FormConfig = {
|
|||||||
login.`
|
login.`
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
submit_label: `<i class="icon">send</i> Login`,
|
submit_label: `<i class="icon i_send"></i> Login`,
|
||||||
on_submit: async (fields) => {
|
on_submit: async (fields) => {
|
||||||
username = fields.username
|
username = fields.username
|
||||||
password = fields.password
|
password = fields.password
|
||||||
@@ -37,7 +39,7 @@ const form_otp: FormConfig = {
|
|||||||
description: `Please enter the one-time password from your authenticator app`
|
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) => {
|
on_submit: async (fields) => {
|
||||||
totp = fields.totp
|
totp = fields.totp
|
||||||
return await login()
|
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("/")) {
|
if (typeof login_redirect === "string" && login_redirect.startsWith("/")) {
|
||||||
console.debug("redirecting user to requested path", login_redirect)
|
console.debug("redirecting user to requested path", login_redirect)
|
||||||
|
|||||||
@@ -10,21 +10,21 @@ let page = $state("login")
|
|||||||
</script>
|
</script>
|
||||||
<div class="tab_bar">
|
<div class="tab_bar">
|
||||||
<button onclick={() => page = "login"} class:button_highlight={page === "login"}>
|
<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>
|
<span>Login</span>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<button onclick={() => page = "register"} class:button_highlight={page === "register"}>
|
<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>
|
<span>Register</span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="page_content">
|
<div class="page_content">
|
||||||
{#if page === "login"}
|
{#if page === "login"}
|
||||||
<Login on:login={finish_login}/>
|
<Login on_login={finish_login}/>
|
||||||
{:else if page === "register"}
|
{:else if page === "register"}
|
||||||
<Register on:login={finish_login}/>
|
<Register/>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -35,4 +35,11 @@ let page = $state("login")
|
|||||||
font-size: 1.3em;
|
font-size: 1.3em;
|
||||||
justify-content: center;
|
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>
|
</style>
|
||||||
@@ -27,7 +27,7 @@ let form: FormConfig = {
|
|||||||
"prevent you from logging into your new account"
|
"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 => {
|
on_submit: async fields => {
|
||||||
if (fields.password !== fields.password2) {
|
if (fields.password !== fields.password2) {
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -10,10 +10,10 @@ import NovaLogo from "util/NovaLogo.svelte";
|
|||||||
|
|
||||||
// Each part of the API has a read and a write permission
|
// Each part of the API has a read and a write permission
|
||||||
const components: [string, string, keyof UserSession, keyof UserSession][] = [
|
const components: [string, string, keyof UserSession, keyof UserSession][] = [
|
||||||
["Files", "folder", "filesystem_read", "filesystem_write"],
|
["Files", "i_folder", "filesystem_read", "filesystem_write"],
|
||||||
["Account", "person", "account_read", "account_write"],
|
["Account", "i_person", "account_read", "account_write"],
|
||||||
["API keys", "vpn_key", "session_read", "session_write"],
|
["API keys", "i_vpn_key", "session_read", "session_write"],
|
||||||
["Billing", "receipt", "billing_read", "billing_write"],
|
["Billing", "i_receipt", "billing_read", "billing_write"],
|
||||||
]
|
]
|
||||||
|
|
||||||
let keys: UserSession[] = $state([])
|
let keys: UserSession[] = $state([])
|
||||||
@@ -178,7 +178,7 @@ onMount(load_keys)
|
|||||||
<div class="toolbar">
|
<div class="toolbar">
|
||||||
<div class="toolbar_spacer"></div>
|
<div class="toolbar_spacer"></div>
|
||||||
<button onclick={create_key}>
|
<button onclick={create_key}>
|
||||||
<i class="icon">add</i> Create new API key
|
<i class="icon i_add"></i> Create new API key
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -189,13 +189,13 @@ onMount(load_keys)
|
|||||||
{#if key.app_name === "website login"}
|
{#if key.app_name === "website login"}
|
||||||
<NovaLogo style="height: 1.5em;"/> Nova website
|
<NovaLogo style="height: 1.5em;"/> Nova website
|
||||||
{:else if key.app_name === "website keys page"}
|
{:else if key.app_name === "website keys page"}
|
||||||
<i class="icon">vpn_key</i> Created on this page
|
<i class="icon i_vpn_key"></i> Created on this page
|
||||||
{:else if key.app_name === "sharex"}
|
{:else if key.app_name === "sharex"}
|
||||||
<img src="/res/img/sharex.png" alt=""/> ShareX
|
<img src="/res/img/sharex.png" alt=""/> ShareX
|
||||||
{:else if key.app_name === "jdownloader"}
|
{:else if key.app_name === "jdownloader"}
|
||||||
<img src="/res/img/jdownloader.png" alt=""/> JDownloader
|
<img src="/res/img/jdownloader.png" alt=""/> JDownloader
|
||||||
{:else}
|
{:else}
|
||||||
<i class="icon">apps</i> {key.app_name || "Unnamed key"}
|
<i class="icon i_apps"></i> {key.app_name || "Unnamed key"}
|
||||||
{/if}
|
{/if}
|
||||||
</span>
|
</span>
|
||||||
{#if key.current}
|
{#if key.current}
|
||||||
@@ -206,11 +206,11 @@ onMount(load_keys)
|
|||||||
this page and the rest of the website stop working -->
|
this page and the rest of the website stop working -->
|
||||||
{#if !key.current && editing !== key.auth_key}
|
{#if !key.current && editing !== key.auth_key}
|
||||||
<button onclick={() => edit_key(key)}>
|
<button onclick={() => edit_key(key)}>
|
||||||
<i class="icon">edit</i> Edit
|
<i class="icon i_edit"></i> Edit
|
||||||
</button>
|
</button>
|
||||||
{/if}
|
{/if}
|
||||||
<button class="button_red" onclick={() => delete_key(key)}>
|
<button class="button_red" onclick={() => delete_key(key)}>
|
||||||
<i class="icon">delete</i> Delete
|
<i class="icon i_delete"></i> Delete
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -222,7 +222,7 @@ onMount(load_keys)
|
|||||||
class:button_highlight={shown[key.auth_key]}
|
class:button_highlight={shown[key.auth_key]}
|
||||||
onclick={() => shown[key.auth_key] = !shown[key.auth_key]}
|
onclick={() => shown[key.auth_key] = !shown[key.auth_key]}
|
||||||
>
|
>
|
||||||
<i class="icon">{shown[key.auth_key] ? "visibility_off" : "visibility"}</i>
|
<i class="icon {shown[key.auth_key] ? 'i_visibility_off' : 'i_visibility'}"></i>
|
||||||
{shown[key.auth_key] ? "Hide" : "Show"}
|
{shown[key.auth_key] ? "Hide" : "Show"}
|
||||||
</button>
|
</button>
|
||||||
<CopyButton text={key.auth_key}>Copy</CopyButton>
|
<CopyButton text={key.auth_key}>Copy</CopyButton>
|
||||||
@@ -232,7 +232,7 @@ onMount(load_keys)
|
|||||||
<div class="edit">
|
<div class="edit">
|
||||||
{#each components as [name, icon, read, write]}
|
{#each components as [name, icon, read, write]}
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<span class="name"><i class="icon small">{icon}</i> {name}</span>
|
<span class="name"><i class="icon small {icon}"></i> {name}</span>
|
||||||
<label>
|
<label>
|
||||||
<input type="checkbox" bind:checked={edit_perms[read]}/> read
|
<input type="checkbox" bind:checked={edit_perms[read]}/> read
|
||||||
</label>
|
</label>
|
||||||
@@ -253,25 +253,25 @@ onMount(load_keys)
|
|||||||
<span>Files access is limited to</span>
|
<span>Files access is limited to</span>
|
||||||
{#each edit_dirs as id, index (id)}
|
{#each edit_dirs as id, index (id)}
|
||||||
<span>
|
<span>
|
||||||
<i class="icon small">folder</i>{dir_names[id] ?? id}
|
<i class="icon small i_folder"></i>{dir_names[id] ?? id}
|
||||||
<button onclick={() => edit_dirs.splice(index, 1)} title="Remove">
|
<button onclick={() => edit_dirs.splice(index, 1)} title="Remove">
|
||||||
<i class="icon small">close</i>
|
<i class="icon small i_close"></i>
|
||||||
</button>
|
</button>
|
||||||
</span>
|
</span>
|
||||||
{/each}
|
{/each}
|
||||||
{/if}
|
{/if}
|
||||||
<button onclick={() => picker.open("/me")}>
|
<button onclick={() => picker.open("/me")}>
|
||||||
<i class="icon">folder</i>
|
<i class="icon i_folder"></i>
|
||||||
{edit_dirs.length === 0 ? "Limit to a directory" : "Add a directory"}
|
{edit_dirs.length === 0 ? "Limit to a directory" : "Add a directory"}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<button class="button_highlight" onclick={save_key}>
|
<button class="button_highlight" onclick={save_key}>
|
||||||
<i class="icon">save</i> Save
|
<i class="icon i_save"></i> Save
|
||||||
</button>
|
</button>
|
||||||
<button onclick={() => editing = ""}>
|
<button onclick={() => editing = ""}>
|
||||||
<i class="icon">close</i> Cancel
|
<i class="icon i_close"></i> Cancel
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -279,7 +279,7 @@ onMount(load_keys)
|
|||||||
<div class="row permissions">
|
<div class="row permissions">
|
||||||
{#each components as [name, icon, read, write]}
|
{#each components as [name, icon, read, write]}
|
||||||
<span class:none={!key[read] && !key[write]}>
|
<span class:none={!key[read] && !key[write]}>
|
||||||
<i class="icon small">{icon}</i>
|
<i class="icon small {icon}"></i>
|
||||||
{name}:
|
{name}:
|
||||||
{#if key[read] && key[write]}
|
{#if key[read] && key[write]}
|
||||||
read / write
|
read / write
|
||||||
@@ -297,7 +297,7 @@ onMount(load_keys)
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<span>Files access is limited to</span>
|
<span>Files access is limited to</span>
|
||||||
{#each key.filesystem_dirs as id}
|
{#each key.filesystem_dirs as id}
|
||||||
<a href="/d/{id}"><i class="icon small">folder</i>{dir_names[id] ?? id}</a>
|
<a href="/d/{id}"><i class="icon small i_folder"></i>{dir_names[id] ?? id}</a>
|
||||||
{/each}
|
{/each}
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import { user } from "lib/UserStore";
|
|||||||
|
|
||||||
let affiliate_link = $derived(
|
let affiliate_link = $derived(
|
||||||
window.location.protocol+"//"+window.location.host +
|
window.location.protocol+"//"+window.location.host +
|
||||||
"?ref=" + encodeURIComponent($user.username)
|
"/user?ref=" + encodeURIComponent($user.username)
|
||||||
)
|
)
|
||||||
let affiliate_deny = $state(false)
|
let affiliate_deny = $state(false)
|
||||||
onMount(() => {
|
onMount(() => {
|
||||||
@@ -74,7 +74,7 @@ let account_settings: FormConfig = $derived({
|
|||||||
separator: true,
|
separator: true,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
submit_label: `<i class="icon">save</i> Save`,
|
submit_label: `<i class="icon i_save"></i> Save`,
|
||||||
on_submit: async fields => {
|
on_submit: async fields => {
|
||||||
if (fields.password_new1 != fields.password_new2) {
|
if (fields.password_new1 != fields.password_new2) {
|
||||||
return {
|
return {
|
||||||
@@ -122,7 +122,7 @@ let affiliate_settings: FormConfig = $derived({
|
|||||||
extra.`,
|
extra.`,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
submit_label: `<i class="icon">save</i> Save`,
|
submit_label: `<i class="icon i_save"></i> Save`,
|
||||||
on_submit: async fields => {
|
on_submit: async fields => {
|
||||||
const form = new FormData()
|
const form = new FormData()
|
||||||
form.append("affiliate_user_name", fields.affiliate_user_name)
|
form.append("affiliate_user_name", fields.affiliate_user_name)
|
||||||
@@ -167,7 +167,7 @@ let delete_account: FormConfig = {
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
submit_red: true,
|
submit_red: true,
|
||||||
submit_label: `<i class="icon">delete</i> Delete`,
|
submit_label: `<i class="icon i_delete"></i> Delete`,
|
||||||
on_submit: async fields => {
|
on_submit: async fields => {
|
||||||
const resp = await fetch(
|
const resp = await fetch(
|
||||||
get_endpoint()+"/user",
|
get_endpoint()+"/user",
|
||||||
|
|||||||
@@ -67,13 +67,13 @@ onMount(() => {
|
|||||||
<h3>{month_str}</h3>
|
<h3>{month_str}</h3>
|
||||||
<div class="toolbar">
|
<div class="toolbar">
|
||||||
<button onclick={last_month}>
|
<button onclick={last_month}>
|
||||||
<i class="icon">chevron_left</i>
|
<i class="icon i_chevron_left"></i>
|
||||||
Previous month
|
Previous month
|
||||||
</button>
|
</button>
|
||||||
<div class="toolbar_spacer"></div>
|
<div class="toolbar_spacer"></div>
|
||||||
<button onclick={next_month}>
|
<button onclick={next_month}>
|
||||||
Next month
|
Next month
|
||||||
<i class="icon">chevron_right</i>
|
<i class="icon i_chevron_right"></i>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -119,13 +119,13 @@ onMount(() => {
|
|||||||
{#if data.length > 100}
|
{#if data.length > 100}
|
||||||
<div class="toolbar">
|
<div class="toolbar">
|
||||||
<button onclick={last_month}>
|
<button onclick={last_month}>
|
||||||
<i class="icon">chevron_left</i>
|
<i class="icon i_chevron_left"></i>
|
||||||
Previous month
|
Previous month
|
||||||
</button>
|
</button>
|
||||||
<div class="toolbar_spacer"></div>
|
<div class="toolbar_spacer"></div>
|
||||||
<button onclick={next_month}>
|
<button onclick={next_month}>
|
||||||
Next month
|
Next month
|
||||||
<i class="icon">chevron_right</i>
|
<i class="icon i_chevron_right"></i>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
|
|||||||
@@ -74,10 +74,10 @@ const deny = () => {
|
|||||||
<Modal bind:this={modal} title="Affiliate sponsoring request" width="700px">
|
<Modal bind:this={modal} title="Affiliate sponsoring request" width="700px">
|
||||||
<section>
|
<section>
|
||||||
<p>
|
<p>
|
||||||
Hi! {referral} wants you to sponsor their Nova account. This
|
Hi! {referral} wants you to sponsor their Nova account. This will
|
||||||
will give them €0.50 every month in Nova prepaid credit. They
|
give them €0.01 every day in Nova prepaid credit. They can use this
|
||||||
can use this credit to get a discount on their file storage and
|
credit to get a discount on their file storage and sharing costs.
|
||||||
sharing costs. Here is a short summary of what this entails:
|
Here is a short summary of what this entails:
|
||||||
</p>
|
</p>
|
||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
@@ -97,10 +97,6 @@ const deny = () => {
|
|||||||
You can change who you are sponsoring at any time on your <a
|
You can change who you are sponsoring at any time on your <a
|
||||||
href="/user/settings">account settings page</a>.
|
href="/user/settings">account settings page</a>.
|
||||||
</li>
|
</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>
|
</ul>
|
||||||
<p>
|
<p>
|
||||||
If you click 'Accept' then the requested affiliate code will be
|
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 -->
|
<!-- Show a back button if an app is selected -->
|
||||||
{#if app_name}
|
{#if app_name}
|
||||||
<a href="/user/connect_app" class="button">
|
<a href="/user/connect_app" class="button">
|
||||||
<i class="icon">arrow_back</i>
|
<i class="icon i_arrow_back"></i>
|
||||||
Back to apps
|
Back to apps
|
||||||
</a>
|
</a>
|
||||||
{/if}
|
{/if}
|
||||||
@@ -92,7 +92,7 @@ let app_name = $derived(() => {
|
|||||||
{#if !api_key}
|
{#if !api_key}
|
||||||
<div class="center">
|
<div class="center">
|
||||||
<button class="button_highlight" onclick={create_key}>
|
<button class="button_highlight" onclick={create_key}>
|
||||||
<i class="icon">add</i>
|
<i class="icon i_add"></i>
|
||||||
Generate key
|
Generate key
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
@@ -102,7 +102,7 @@ let app_name = $derived(() => {
|
|||||||
<div class="copy_container">
|
<div class="copy_container">
|
||||||
<CopyButton text={api_key}>Copy key to clipboard</CopyButton>
|
<CopyButton text={api_key}>Copy key to clipboard</CopyButton>
|
||||||
<button onclick={toggle_show_key} class="copy_button" class:button_highlight={show_key !== ""}>
|
<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 === ""}
|
{#if show_key === ""}
|
||||||
Show key
|
Show key
|
||||||
{:else}
|
{:else}
|
||||||
@@ -146,7 +146,7 @@ let app_name = $derived(() => {
|
|||||||
|
|
||||||
<div class="center">
|
<div class="center">
|
||||||
<a href="/misc/sharex/nova.storage.sxcu" class="button button_highlight">
|
<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
|
Download ShareX Uploader
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
import ProgressBar from "util/ProgressBar.svelte";
|
import ProgressBar from "util/ProgressBar.svelte";
|
||||||
import { formatDataVolume, formatEuros } from "util/Formatting"
|
import { formatDataVolume, formatEuros } from "util/Formatting"
|
||||||
import { user } from "lib/UserStore";
|
import { user } from "lib/UserStore";
|
||||||
|
import { bills_extra } from "lib/NovaAPI";
|
||||||
|
|
||||||
let { total = 0, used = 0 }: {
|
let { total = 0, used = 0 }: {
|
||||||
total?: number;
|
total?: number;
|
||||||
@@ -10,8 +11,11 @@ let { total = 0, used = 0 }: {
|
|||||||
|
|
||||||
let frac = $derived(used / total)
|
let frac = $derived(used / total)
|
||||||
let bill_shock = $derived($user !== null && $user.monthly_transfer_cap === 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 price = $derived($user === null ? 0 : $user.subscription.price_per_tb_bandwidth)
|
||||||
let billed = $derived(billable && $user.usage_based_billing)
|
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)
|
let included = $derived($user === null ? 0 : $user.subscription.monthly_transfer_cap)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@@ -47,17 +51,25 @@ let included = $derived($user === null ? 0 : $user.subscription.monthly_transfer
|
|||||||
</p>
|
</p>
|
||||||
{#if bill_shock}
|
{#if bill_shock}
|
||||||
<p>
|
<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.
|
or disable the limit</a> to continue sharing files.
|
||||||
</p>
|
</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}
|
{:else}
|
||||||
<p>
|
<p>
|
||||||
Upgrade your plan or enable
|
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.
|
sharing files.
|
||||||
</p>
|
</p>
|
||||||
<a class="button button_highlight" href="/user/subscription/manage">
|
<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>
|
</a>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
@@ -70,11 +82,11 @@ let included = $derived($user === null ? 0 : $user.subscription.monthly_transfer
|
|||||||
{#if bill_shock}
|
{#if bill_shock}
|
||||||
<p>
|
<p>
|
||||||
This is your bill shock limit, you can change it in the
|
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>
|
</p>
|
||||||
{:else}
|
{:else}
|
||||||
<a class="button button_highlight" href="/user/subscription/manage">
|
<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>
|
</a>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -11,6 +11,8 @@ import { onMount } from "svelte";
|
|||||||
import { get_user, type User } from "lib/NovaAPI";
|
import { get_user, type User } from "lib/NovaAPI";
|
||||||
import SharingSettings from "./SharingSettings.svelte";
|
import SharingSettings from "./SharingSettings.svelte";
|
||||||
import SubscriptionManage from "./SubscriptionManage.svelte";
|
import SubscriptionManage from "./SubscriptionManage.svelte";
|
||||||
|
import SubscriptionUsage from "./SubscriptionUsage.svelte";
|
||||||
|
import RemoteSync from "./remote_sync/RemoteSync.svelte";
|
||||||
|
|
||||||
let pages: Tab[] = [
|
let pages: Tab[] = [
|
||||||
{
|
{
|
||||||
@@ -39,6 +41,11 @@ let pages: Tab[] = [
|
|||||||
title: "Transactions",
|
title: "Transactions",
|
||||||
icon: "receipt",
|
icon: "receipt",
|
||||||
component: Transactions,
|
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",
|
title: "Sharing settings",
|
||||||
icon: "share",
|
icon: "share",
|
||||||
component: SharingSettings,
|
component: SharingSettings,
|
||||||
|
}, {
|
||||||
|
path: "/user/remote_sync",
|
||||||
|
title: "Remote sync",
|
||||||
|
icon: "sync_alt",
|
||||||
|
component: RemoteSync,
|
||||||
}, {
|
}, {
|
||||||
path: "/user/connect_app",
|
path: "/user/connect_app",
|
||||||
title: "Apps",
|
title: "Apps",
|
||||||
|
|||||||
@@ -1,14 +1,10 @@
|
|||||||
<script lang="ts">
|
<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 { 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 SuccessMessage from 'util/SuccessMessage.svelte';
|
||||||
import { user } from "lib/UserStore";
|
import { user } from "lib/UserStore";
|
||||||
|
|
||||||
let success_message: SuccessMessage = $state()
|
let success_message: SuccessMessage = $state()
|
||||||
let transfer_cap = $state($user === null ? 0 : $user.monthly_transfer_cap / 1e12)
|
|
||||||
|
|
||||||
const update_user = async (e: SubmitEvent) => {
|
const update_user = async (e: SubmitEvent) => {
|
||||||
if (e !== null) {
|
if (e !== null) {
|
||||||
@@ -16,10 +12,7 @@ const update_user = async (e: SubmitEvent) => {
|
|||||||
}
|
}
|
||||||
loading_run(async () => {
|
loading_run(async () => {
|
||||||
try {
|
try {
|
||||||
await put_user({
|
await put_user({embed_domains: embed_domains.join(" ")})
|
||||||
transfer_cap: transfer_cap*1e12,
|
|
||||||
embed_domains: embed_domains.join(" "),
|
|
||||||
})
|
|
||||||
|
|
||||||
success_message.set(true, "Sharing settings updated")
|
success_message.set(true, "Sharing settings updated")
|
||||||
} catch (err) {
|
} 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
|
// Embedding settings
|
||||||
let embed_domains: string[] = $state($user === null ? [] : $user.embed_domains.split(" "))
|
let embed_domains: string[] = $state($user === null ? [] : $user.embed_domains.split(" "))
|
||||||
let new_domain: string = $state("")
|
let new_domain: string = $state("")
|
||||||
@@ -79,58 +38,11 @@ const del_domain = (index: number) => {
|
|||||||
embed_domains = embed_domains
|
embed_domains = embed_domains
|
||||||
update_user(null)
|
update_user(null)
|
||||||
}
|
}
|
||||||
|
|
||||||
onMount(async () => {
|
|
||||||
load_transfer_used()
|
|
||||||
})
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<section>
|
<section>
|
||||||
<SuccessMessage bind:this={success_message}/>
|
<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} warn></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>
|
<h2>Embedding controls</h2>
|
||||||
<p>
|
<p>
|
||||||
Here you can control which websites are allowed to embed your files in
|
Here you can control which websites are allowed to embed your files in
|
||||||
@@ -144,7 +56,7 @@ onMount(async () => {
|
|||||||
<div class="form_row">
|
<div class="form_row">
|
||||||
<span>Add domain name</span>
|
<span>Add domain name</span>
|
||||||
<input class="grow" bind:value={new_domain} type="text"/>
|
<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>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
<hr/>
|
<hr/>
|
||||||
@@ -155,8 +67,8 @@ onMount(async () => {
|
|||||||
{/if}
|
{/if}
|
||||||
{#each embed_domains as domain, index}
|
{#each embed_domains as domain, index}
|
||||||
<div class="form_row">
|
<div class="form_row">
|
||||||
<button class="shrink" type="button" onclick={() => del_domain(index)}>
|
<button class="shrink" type="button" onclick={() => del_domain(index)} title="Remove">
|
||||||
<i class="icon">delete</i>
|
<i class="icon i_delete"></i>
|
||||||
</button>
|
</button>
|
||||||
<div>{domain}</div>
|
<div>{domain}</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -165,12 +77,6 @@ onMount(async () => {
|
|||||||
</section>
|
</section>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.billshock_container {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: row;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.highlight_border {
|
.highlight_border {
|
||||||
text-align: initial;
|
text-align: initial;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
import { formatDataVolume, formatEuros } from "util/Formatting"
|
import { formatDataVolume, formatEuros } from "util/Formatting"
|
||||||
import ProgressBar from "util/ProgressBar.svelte";
|
import ProgressBar from "util/ProgressBar.svelte";
|
||||||
import { user } from "lib/UserStore";
|
import { user } from "lib/UserStore";
|
||||||
|
import { bills_extra } from "lib/NovaAPI";
|
||||||
|
|
||||||
let { total = 0, used = 0 }: {
|
let { total = 0, used = 0 }: {
|
||||||
total?: number;
|
total?: number;
|
||||||
@@ -9,8 +10,11 @@ let { total = 0, used = 0 }: {
|
|||||||
} = $props();
|
} = $props();
|
||||||
|
|
||||||
let frac = $derived(total <= 0 ? 0 : used / total)
|
let frac = $derived(total <= 0 ? 0 : used / total)
|
||||||
let billable = $derived($user !== null && $user.subscription.price_per_tb_storage > 0)
|
let price = $derived($user === null ? 0 : $user.subscription.price_per_tb_storage)
|
||||||
let billed = $derived(billable && $user.usage_based_billing)
|
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>
|
</script>
|
||||||
|
|
||||||
<ProgressBar total={total} used={used} warn></ProgressBar>
|
<ProgressBar total={total} used={used} warn></ProgressBar>
|
||||||
@@ -35,17 +39,28 @@ let billed = $derived(billable && $user.usage_based_billing)
|
|||||||
month.
|
month.
|
||||||
</p>
|
</p>
|
||||||
{/if}
|
{/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}
|
{:else if frac > 1}
|
||||||
<div class="highlight_yellow">
|
<div class="highlight_yellow">
|
||||||
<p>
|
<p>
|
||||||
You are storing more than your plan allows, so you can't upload new
|
You are storing more than your plan allows, so you can't upload new
|
||||||
files. Your existing files stay available. Delete some files or
|
files. Your existing files stay available. Delete some files or
|
||||||
upgrade your plan to continue uploading, or enable
|
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.
|
storage above the limit.
|
||||||
</p>
|
</p>
|
||||||
<a class="button button_highlight" href="/user/subscription/manage">
|
<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>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
{:else if frac > 0.8}
|
{: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.
|
it runs out you won't be able to upload new files anymore.
|
||||||
</p>
|
</p>
|
||||||
<a class="button button_highlight" href="/user/subscription/manage">
|
<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>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
|
|||||||
@@ -129,11 +129,11 @@ onMount(async () => {
|
|||||||
<td>
|
<td>
|
||||||
{#if row.status === "open"}
|
{#if row.status === "open"}
|
||||||
<a href="/api/user/invoice/{row.id}/pay" class="button button_highlight">
|
<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>
|
</a>
|
||||||
{/if}
|
{/if}
|
||||||
<a href="/api/user/invoice/{row.id}/pdf" target="_blank" class="button">
|
<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>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</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>
|
<h2>Transaction log</h2>
|
||||||
<p>
|
<p>
|
||||||
Here is a log of all transactions on your account balance. Usage is
|
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
|
calculated per day. Storage and bandwidth are only charged for what you
|
||||||
of days in a month (30.4375).
|
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>
|
||||||
<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/>
|
then the daily charge will be:<br/>
|
||||||
|
|
||||||
2 TB * € 4 = € 8<br/>
|
2 TB * € 4 = € 8<br/>
|
||||||
@@ -114,13 +116,13 @@ onMount(() => {
|
|||||||
<h3>{month_str}</h3>
|
<h3>{month_str}</h3>
|
||||||
<div class="toolbar">
|
<div class="toolbar">
|
||||||
<button onclick={last_month}>
|
<button onclick={last_month}>
|
||||||
<i class="icon">chevron_left</i>
|
<i class="icon i_chevron_left"></i>
|
||||||
Previous month
|
Previous month
|
||||||
</button>
|
</button>
|
||||||
<div class="toolbar_spacer"></div>
|
<div class="toolbar_spacer"></div>
|
||||||
<button onclick={next_month}>
|
<button onclick={next_month}>
|
||||||
Next month
|
Next month
|
||||||
<i class="icon">chevron_right</i>
|
<i class="icon i_chevron_right"></i>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<ul>
|
<ul>
|
||||||
@@ -129,11 +131,11 @@ onMount(() => {
|
|||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
Storage charge: <Euro amount={transactions.total_storage_charge} precision="4"/>
|
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>
|
||||||
<li>
|
<li>
|
||||||
Bandwidth charge: <Euro amount={transactions.total_bandwidth_charge} precision="4"/>
|
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>
|
||||||
<li>
|
<li>
|
||||||
Total charge: <Euro amount={transactions.total_deducted} precision="4"/>
|
Total charge: <Euro amount={transactions.total_deducted} precision="4"/>
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ import { user } from "lib/UserStore";
|
|||||||
</li>
|
</li>
|
||||||
{/if}
|
{/if}
|
||||||
<li>
|
<li>
|
||||||
<i class="icon">settings</i>
|
<i class="icon i_settings"></i>
|
||||||
<a href="/user/settings">Account settings</a>
|
<a href="/user/settings">Account settings</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
@@ -28,11 +28,11 @@ import { user } from "lib/UserStore";
|
|||||||
|
|
||||||
<div class="button_row">
|
<div class="button_row">
|
||||||
<a href="/d/me" class="button">
|
<a href="/d/me" class="button">
|
||||||
<i class="icon">folder</i>
|
<i class="icon i_folder"></i>
|
||||||
Filesystem
|
Filesystem
|
||||||
</a>
|
</a>
|
||||||
<button onclick={()=> logout_user("/")}>
|
<button onclick={()=> logout_user("/")}>
|
||||||
<i class="icon">logout</i>
|
<i class="icon i_logout"></i>
|
||||||
Log out
|
Log out
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -59,11 +59,11 @@ onMount(() => {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="toolbar">
|
<div class="toolbar">
|
||||||
<Button click={last_month} icon="chevron_left"/>
|
<Button click={last_month} icon="chevron_left" title="Previous month"/>
|
||||||
<div class="toolbar_spacer">
|
<div class="toolbar_spacer">
|
||||||
{month_str}
|
{month_str}
|
||||||
</div>
|
</div>
|
||||||
<Button click={next_month} icon="chevron_right"/>
|
<Button click={next_month} icon="chevron_right" title="Next month"/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{#if data.length === 0}
|
{#if data.length === 0}
|
||||||
|
|||||||
@@ -108,11 +108,11 @@ onMount(() => {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="toolbar">
|
<div class="toolbar">
|
||||||
<Button click={last_month} icon="chevron_left"/>
|
<Button click={last_month} icon="chevron_left" title="Previous month"/>
|
||||||
<div class="toolbar_spacer">
|
<div class="toolbar_spacer">
|
||||||
{month_str}
|
{month_str}
|
||||||
</div>
|
</div>
|
||||||
<Button click={next_month} icon="chevron_right"/>
|
<Button click={next_month} icon="chevron_right" title="Next month"/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<table>
|
<table>
|
||||||
@@ -137,14 +137,14 @@ onMount(() => {
|
|||||||
<td>Storage charge</td>
|
<td>Storage charge</td>
|
||||||
<td>
|
<td>
|
||||||
<Euro amount={transactions.total_storage_charge} precision="4"/>
|
<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>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Bandwidth charge</td>
|
<td>Bandwidth charge</td>
|
||||||
<td>
|
<td>
|
||||||
<Euro amount={transactions.total_bandwidth_charge} precision="4"/>
|
<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>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
|
|||||||
@@ -1,14 +1,40 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
|
import { days_per_month, subscription_periods } from "lib/NovaAPI";
|
||||||
import { user } from "lib/UserStore";
|
import { user } from "lib/UserStore";
|
||||||
import Euro from "util/Euro.svelte";
|
import Euro from "util/Euro.svelte";
|
||||||
import { formatDataVolume } from "util/Formatting";
|
import { formatDataVolume, formatDate, formatEuros } from "util/Formatting";
|
||||||
|
|
||||||
|
// What the account costs per day at its current usage, the same sum the server
|
||||||
|
// charges every night. Data transfer above the plan is left out, it can't be
|
||||||
|
// predicted
|
||||||
|
let daily_cost = $derived.by(() => {
|
||||||
|
if ($user === null || $user.subscription.type !== "subscription") {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
const sub = $user.subscription
|
||||||
|
const discount = subscription_periods.find(
|
||||||
|
p => p.months === $user.subscription_months,
|
||||||
|
)?.discount ?? 1
|
||||||
|
const extra_storage = $user.usage_based_billing ?
|
||||||
|
Math.max(0, $user.storage_space_used - sub.storage_limit) *
|
||||||
|
sub.price_per_tb_storage / 1e12 : 0
|
||||||
|
|
||||||
|
return (sub.monthly_fee * discount + extra_storage) / days_per_month
|
||||||
|
})
|
||||||
|
|
||||||
|
let credit_until = $derived.by(() => {
|
||||||
|
const date = new Date()
|
||||||
|
date.setDate(date.getDate() + Math.floor($user.balance_micro_eur / daily_cost))
|
||||||
|
return formatDate(date, false, false, false)
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#if $user !== null}
|
{#if $user !== null}
|
||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
Supporter level: {$user.subscription.name}<br/>
|
Supporter level: {$user.subscription.name}<br/>
|
||||||
<i class="icon">shopping_cart</i>
|
<i class="icon i_shopping_cart"></i>
|
||||||
<a href="/user/subscription">Manage subscriptions</a>
|
<a href="/user/subscription">Manage subscriptions</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
@@ -16,10 +42,22 @@ import { formatDataVolume } from "util/Formatting";
|
|||||||
<li>
|
<li>
|
||||||
Current account balance: <Euro amount={$user.balance_micro_eur}></Euro><br/>
|
Current account balance: <Euro amount={$user.balance_micro_eur}></Euro><br/>
|
||||||
|
|
||||||
<i class="icon">account_balance_wallet</i>
|
{#if daily_cost > 0}
|
||||||
|
Your plan costs {formatEuros(daily_cost, 4)} per day at your
|
||||||
|
current usage.
|
||||||
|
{#if $user.balance_micro_eur > 0}
|
||||||
|
Your credit lasts until about {credit_until}.
|
||||||
|
{/if}
|
||||||
|
{#if $user.usage_based_billing}
|
||||||
|
Data transfer above your plan is not included.
|
||||||
|
{/if}
|
||||||
|
<br/>
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
<i class="icon i_account_balance_wallet"></i>
|
||||||
<a href="/user/subscription/manage">Deposit credit</a><br/>
|
<a href="/user/subscription/manage">Deposit credit</a><br/>
|
||||||
|
|
||||||
<i class="icon">receipt</i>
|
<i class="icon i_receipt"></i>
|
||||||
<a href="/user/subscription/transactions">Transaction log</a>
|
<a href="/user/subscription/transactions">Transaction log</a>
|
||||||
|
|
||||||
{#if $user.balance_micro_eur > 0 && $user.subscription.id === ""}
|
{#if $user.balance_micro_eur > 0 && $user.subscription.id === ""}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { get_endpoint, get_user, type User } from "lib/NovaAPI";
|
import { bills_extra, get_endpoint, get_user, type User } from "lib/NovaAPI";
|
||||||
import { onMount } from "svelte";
|
import { onMount } from "svelte";
|
||||||
import HotlinkProgressBar from "user_home/HotlinkProgressBar.svelte";
|
import HotlinkProgressBar from "user_home/HotlinkProgressBar.svelte";
|
||||||
import StorageProgressBar from "user_home/StorageProgressBar.svelte";
|
import StorageProgressBar from "user_home/StorageProgressBar.svelte";
|
||||||
@@ -37,7 +37,7 @@ onMount(async () => {
|
|||||||
// The lowest limit which blocks downloads. With usage based billing the
|
// The lowest limit which blocks downloads. With usage based billing the
|
||||||
// plan's limit is billed instead, only the bill shock limit blocks
|
// plan's limit is billed instead, only the bill shock limit blocks
|
||||||
let caps = [user.monthly_transfer_cap]
|
let caps = [user.monthly_transfer_cap]
|
||||||
if (!user.usage_based_billing || user.subscription.price_per_tb_bandwidth <= 0) {
|
if (!bills_extra(user, user.subscription.price_per_tb_bandwidth)) {
|
||||||
caps.push(user.subscription.monthly_transfer_cap)
|
caps.push(user.subscription.monthly_transfer_cap)
|
||||||
}
|
}
|
||||||
caps = caps.filter(cap => cap > 0)
|
caps = caps.filter(cap => cap > 0)
|
||||||
@@ -59,6 +59,6 @@ onMount(async () => {
|
|||||||
<br/><br/>
|
<br/><br/>
|
||||||
|
|
||||||
Egress used (30 days):
|
Egress used (30 days):
|
||||||
(<a href="/user/sharing">set custom limit</a>)
|
(<a href="/user/subscription/metered_billing">set custom limit</a>)
|
||||||
<HotlinkProgressBar used={transfer_used} total={transfer_cap}></HotlinkProgressBar>
|
<HotlinkProgressBar used={transfer_used} total={transfer_cap}></HotlinkProgressBar>
|
||||||
{/if}
|
{/if}
|
||||||
@@ -144,17 +144,17 @@ onMount(() => {
|
|||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
{#if i > 0}
|
{#if i > 0}
|
||||||
<Button click={() => swap_card(i, i-1)} icon="chevron_left" flat/>
|
<Button click={() => swap_card(i, i-1)} icon="chevron_left" flat title="Move left"/>
|
||||||
{/if}
|
{/if}
|
||||||
{#if i < cards.length-1}
|
{#if i < cards.length-1}
|
||||||
<Button click={() => swap_card(i, i+1)} icon="chevron_right" flat/>
|
<Button click={() => swap_card(i, i+1)} icon="chevron_right" flat title="Move right"/>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
<Button click={() => shrink(i)} icon="zoom_out" flat/>
|
<Button click={() => shrink(i)} icon="zoom_out" flat title="Shrink"/>
|
||||||
<span>
|
<span>
|
||||||
{card.size === undefined ? 1 : card.size}
|
{card.size === undefined ? 1 : card.size}
|
||||||
</span>
|
</span>
|
||||||
<Button click={() => expand(i)} icon="zoom_in" flat/>
|
<Button click={() => expand(i)} icon="zoom_in" flat title="Enlarge"/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{#if !card.hidden && card.size > 0}
|
{#if !card.hidden && card.size > 0}
|
||||||
|
|||||||
@@ -0,0 +1,263 @@
|
|||||||
|
<script lang="ts">
|
||||||
|
import { onMount } from "svelte";
|
||||||
|
import { loading_run } from "lib/Loading";
|
||||||
|
import { check_response, dict_to_form, get_endpoint } from "lib/NovaAPI";
|
||||||
|
import ProgressBar from "util/ProgressBar.svelte";
|
||||||
|
import { formatDataVolume, formatDate, formatDuration } from "util/Formatting";
|
||||||
|
import { user } from "lib/UserStore";
|
||||||
|
import RemoteSyncForm from "./RemoteSyncForm.svelte";
|
||||||
|
import { edit_remote_sync, form, secret_fields, service_of, type RemoteSync } from "./RemoteSyncLib.svelte";
|
||||||
|
|
||||||
|
let syncs: RemoteSync[] = $state([])
|
||||||
|
|
||||||
|
// Polls every second while a sync runs, the server saves the
|
||||||
|
// progress that often
|
||||||
|
let mounted = true
|
||||||
|
let timeout: ReturnType<typeof setTimeout>
|
||||||
|
const load = async () => {
|
||||||
|
clearTimeout(timeout)
|
||||||
|
try {
|
||||||
|
syncs = await check_response(await fetch(get_endpoint() + "/user/remote_sync"))
|
||||||
|
} catch (err) {
|
||||||
|
console.error("Failed to load remote syncs:", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mounted && syncs.some(t => t.status === "running")) {
|
||||||
|
timeout = setTimeout(load, 1000)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onMount(() => {
|
||||||
|
load()
|
||||||
|
return () => {
|
||||||
|
mounted = false
|
||||||
|
clearTimeout(timeout)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
const edit = (t: RemoteSync) => {
|
||||||
|
edit_remote_sync(t)
|
||||||
|
document.getElementById("remote_sync_form")?.scrollIntoView({ behavior: "smooth" })
|
||||||
|
}
|
||||||
|
|
||||||
|
const restart = async (t: RemoteSync, body = {}) => {
|
||||||
|
try {
|
||||||
|
await loading_run(async () => check_response(
|
||||||
|
await fetch(get_endpoint() + "/user/remote_sync/" + t.id + "/restart", {
|
||||||
|
method: "POST",
|
||||||
|
body: dict_to_form(body),
|
||||||
|
})
|
||||||
|
))
|
||||||
|
} catch (err) {
|
||||||
|
alert("Failed to restart the remote sync: " + (err.message ?? err))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
asking = ""
|
||||||
|
load()
|
||||||
|
}
|
||||||
|
|
||||||
|
// A sync without remembered credentials asks for them again. What the form
|
||||||
|
// still has for that service is filled in
|
||||||
|
let asking = $state("")
|
||||||
|
let secrets: { [name: string]: string } = $state({})
|
||||||
|
let remember_again = $state(false)
|
||||||
|
const ask = (t: RemoteSync) => {
|
||||||
|
const service = service_of(t)
|
||||||
|
secrets = Object.fromEntries(secret_fields(service).map(f =>
|
||||||
|
[f.name, (form.options[service][f.name] as string) ?? ""]
|
||||||
|
))
|
||||||
|
remember_again = false
|
||||||
|
asking = t.id
|
||||||
|
}
|
||||||
|
|
||||||
|
const remove = async (t: RemoteSync) => {
|
||||||
|
try {
|
||||||
|
await loading_run(async () => check_response(
|
||||||
|
await fetch(get_endpoint() + "/user/remote_sync/" + t.id, { method: "DELETE" })
|
||||||
|
))
|
||||||
|
} catch (err) {
|
||||||
|
alert("Failed to remove the remote sync: " + (err.message ?? err))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
load()
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<section>
|
||||||
|
<h2>Remote sync</h2>
|
||||||
|
<p>
|
||||||
|
Copy files between Nova and another storage service. The sync runs
|
||||||
|
on our servers, so you can close this page while it runs. A sync
|
||||||
|
which stopped can be started again, files which are already there are
|
||||||
|
skipped.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
{#if $user !== null && $user.subscription.id === ""}
|
||||||
|
<p>
|
||||||
|
Remote sync is available on paid plans.
|
||||||
|
<a class="button button_highlight" href="/user/subscription/manage">
|
||||||
|
<i class="icon i_shopping_cart"></i> Upgrade
|
||||||
|
</a>
|
||||||
|
</p>
|
||||||
|
{:else}
|
||||||
|
<RemoteSyncForm onsaved={load}/>
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
{#each syncs as t (t.id)}
|
||||||
|
{@const name = t.directory_path || t.directory}
|
||||||
|
{@const service = service_of(t)}
|
||||||
|
<div class="remote_sync" class:running={t.status === "running"} class:editing={form.editing === t.id}>
|
||||||
|
<div class="row">
|
||||||
|
<span class="title">
|
||||||
|
<i class="icon {t.direction === 'import' ? 'i_download' : 'i_upload'}"></i>
|
||||||
|
<span class="badge">{t.sync ? "Sync" : "Copy"}</span>
|
||||||
|
{t.direction === "import" ? t.remote + " → " + name : name + " → " + t.remote}
|
||||||
|
</span>
|
||||||
|
<div class="toolbar_spacer"></div>
|
||||||
|
{#if t.status === "running"}
|
||||||
|
<button onclick={() => remove(t)}>
|
||||||
|
<i class="icon i_cancel"></i> Abort
|
||||||
|
</button>
|
||||||
|
{:else}
|
||||||
|
{#if service !== ""}
|
||||||
|
<button onclick={() => edit(t)}>
|
||||||
|
<i class="icon i_edit"></i> Edit
|
||||||
|
</button>
|
||||||
|
{/if}
|
||||||
|
<button onclick={() => t.remember || service === "" ? restart(t) : ask(t)}>
|
||||||
|
<i class="icon i_restart_alt"></i> Restart
|
||||||
|
</button>
|
||||||
|
<button class="button_red" onclick={() => remove(t)}>
|
||||||
|
<i class="icon i_delete"></i> Remove
|
||||||
|
</button>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{#if t.stats}
|
||||||
|
<ProgressBar total={t.stats.totalBytes} used={t.stats.bytes} speed={1000} animation="linear"/>
|
||||||
|
<div class="details">
|
||||||
|
<div>
|
||||||
|
<span>Data copied</span>
|
||||||
|
{formatDataVolume(t.stats.bytes, 3)} of {formatDataVolume(t.stats.totalBytes, 3)}
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<span>Files copied</span>
|
||||||
|
{t.stats.transfers} of {t.stats.totalTransfers}
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<span>Files checked</span>
|
||||||
|
{t.stats.checks} of {t.stats.totalChecks}
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<span>Transfer rate</span>
|
||||||
|
{formatDataVolume(t.stats.speed, 3)}/s
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<span>Time left</span>
|
||||||
|
<!-- Below a minute the second unit would be milliseconds -->
|
||||||
|
{t.status === "running" && t.stats.eta !== null
|
||||||
|
? formatDuration(t.stats.eta * 1000, t.stats.eta < 60 ? 1 : 2) : "-"}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
{#if t.error}
|
||||||
|
<div class="highlight_red">{t.error}</div>
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
{#if asking === t.id}
|
||||||
|
<form class="form" onsubmit={e => { e.preventDefault(); restart(t, { ...secrets, remember: remember_again }) }}>
|
||||||
|
<!-- Keeps Firefox from filling in the account's login, see RemoteSyncForm -->
|
||||||
|
<input type="text" autocomplete="username" value={"RemoteSync " + t.remote} style="display: none;"/>
|
||||||
|
{#each secret_fields(service) as f (f.name)}
|
||||||
|
<label for={"restart_" + f.name}>{f.label}</label>
|
||||||
|
{#if f.type === "textarea"}
|
||||||
|
<textarea id={"restart_" + f.name} bind:value={secrets[f.name]}></textarea>
|
||||||
|
{:else if f.type === "password"}
|
||||||
|
<input id={"restart_" + f.name} type="password" autocomplete="off" bind:value={secrets[f.name]}/>
|
||||||
|
{:else}
|
||||||
|
<input id={"restart_" + f.name} type="text" autocomplete="off" bind:value={secrets[f.name]}/>
|
||||||
|
{/if}
|
||||||
|
{/each}
|
||||||
|
<label>
|
||||||
|
<input type="checkbox" bind:checked={remember_again}/>
|
||||||
|
Remember the credentials
|
||||||
|
</label>
|
||||||
|
<div class="row">
|
||||||
|
<button type="button" onclick={() => asking = ""}>Cancel</button>
|
||||||
|
<button class="button_highlight" type="submit">
|
||||||
|
<i class="icon i_restart_alt"></i> Restart
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
<div class="details">
|
||||||
|
<div>
|
||||||
|
<span>Status</span>
|
||||||
|
{t.status}
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<span>Started</span>
|
||||||
|
{t.started ? formatDate(t.started, true, true, false) : "-"}
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<span>Credentials</span>
|
||||||
|
{t.remember ? "Remembered" : "Not saved"}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{/each}
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
/* The cards of the API keys page */
|
||||||
|
.remote_sync {
|
||||||
|
margin: 0.8em 0;
|
||||||
|
padding: 0.4em 0.6em;
|
||||||
|
border-radius: 8px;
|
||||||
|
border-left: 3px solid var(--separator);
|
||||||
|
background: var(--card_color);
|
||||||
|
}
|
||||||
|
.remote_sync.running,
|
||||||
|
.remote_sync.editing {
|
||||||
|
border-left-color: var(--accent_color);
|
||||||
|
}
|
||||||
|
.row {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
align-items: center;
|
||||||
|
gap: 0.2em 0.5em;
|
||||||
|
margin: 0.3em 0;
|
||||||
|
}
|
||||||
|
.toolbar_spacer {
|
||||||
|
flex: 1 1 auto;
|
||||||
|
}
|
||||||
|
.title {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 0.3em;
|
||||||
|
font-size: 1.1em;
|
||||||
|
overflow-wrap: anywhere;
|
||||||
|
}
|
||||||
|
.badge {
|
||||||
|
padding: 0 0.6em;
|
||||||
|
border-radius: 1em;
|
||||||
|
color: var(--link_color);
|
||||||
|
background: var(--accent_shade);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 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;
|
||||||
|
}
|
||||||
|
.details span {
|
||||||
|
opacity: 0.6;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,228 @@
|
|||||||
|
<script lang="ts">
|
||||||
|
import { loading_run } from "lib/Loading";
|
||||||
|
import { check_response, dict_to_form, get_endpoint } from "lib/NovaAPI";
|
||||||
|
import FilePicker from "filesystem/filemanager/FilePicker.svelte";
|
||||||
|
import { backends, form, s3_presets, type Field } from "./RemoteSyncLib.svelte";
|
||||||
|
|
||||||
|
// Called after a sync was started or saved
|
||||||
|
let { onsaved }: { onsaved: () => void } = $props()
|
||||||
|
|
||||||
|
let picker: FilePicker = $state()
|
||||||
|
|
||||||
|
// The value of a preset option is its index and region
|
||||||
|
const use_preset = (value: string) => {
|
||||||
|
const [i, region] = value.split(" ")
|
||||||
|
for (const [name, v] of Object.entries(s3_presets[+i].options)) {
|
||||||
|
form.options.s3[name] = v.replace("{region}", region)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const placeholder = (f: Field) =>
|
||||||
|
f.secret && form.editing && form.saved_secrets ? "Saved, leave empty to keep it" : f.default ?? ""
|
||||||
|
|
||||||
|
const submit = async (e: SubmitEvent) => {
|
||||||
|
e.preventDefault()
|
||||||
|
const b = backends[form.backend]
|
||||||
|
const fields = {}
|
||||||
|
for (const f of b.fields) {
|
||||||
|
const value = form.options[form.backend][f.name] || f.default
|
||||||
|
if (value) {
|
||||||
|
fields[f.name] = value
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
await loading_run(async () => check_response(
|
||||||
|
await fetch(get_endpoint() + "/user/remote_sync" + (form.editing ? "/" + form.editing : ""), {
|
||||||
|
method: form.editing ? "PUT" : "POST",
|
||||||
|
body: dict_to_form({
|
||||||
|
direction: form.direction, sync: form.sync, remember: form.remember, directory: form.dir.id,
|
||||||
|
type: b.type ?? form.backend, path: form.paths[form.backend], ...fields,
|
||||||
|
}),
|
||||||
|
})
|
||||||
|
))
|
||||||
|
} catch (err) {
|
||||||
|
alert("Failed to " + (form.editing ? "save" : "start") + " the remote sync: " + (err.message ?? err))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
form.editing = ""
|
||||||
|
form.step = 1
|
||||||
|
onsaved()
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
{#snippet field(f: Field)}
|
||||||
|
{#if f.type === "checkbox"}
|
||||||
|
<label><input type="checkbox" bind:checked={form.options[form.backend][f.name]}/> {f.label}</label>
|
||||||
|
{:else}
|
||||||
|
<label for={"remote_sync_" + f.name}>{f.label}</label>
|
||||||
|
{#if f.type === "textarea"}
|
||||||
|
<textarea id={"remote_sync_" + f.name} bind:value={form.options[form.backend][f.name]}></textarea>
|
||||||
|
{:else if f.type === "password"}
|
||||||
|
<input
|
||||||
|
id={"remote_sync_" + f.name}
|
||||||
|
type="password"
|
||||||
|
autocomplete="off"
|
||||||
|
placeholder={placeholder(f)}
|
||||||
|
bind:value={form.options[form.backend][f.name]}
|
||||||
|
/>
|
||||||
|
{:else}
|
||||||
|
<input id={"remote_sync_" + f.name} type="text" autocomplete="off" placeholder={placeholder(f)} bind:value={form.options[form.backend][f.name]}/>
|
||||||
|
{/if}
|
||||||
|
{#if f.help}
|
||||||
|
<small>{@html f.help}</small>
|
||||||
|
{/if}
|
||||||
|
{/if}
|
||||||
|
<hr/>
|
||||||
|
{/snippet}
|
||||||
|
|
||||||
|
{#snippet path()}
|
||||||
|
<label for="remote_sync_path">{backends[form.backend].path}</label>
|
||||||
|
<input id="remote_sync_path" type="text" bind:value={form.paths[form.backend]} required={backends[form.backend].path_required}/>
|
||||||
|
{/snippet}
|
||||||
|
|
||||||
|
<div id="remote_sync_form" class="highlight_border">
|
||||||
|
<div class="navbar">
|
||||||
|
<b>{form.editing ? "Edit remote sync" : "New remote sync"}</b>
|
||||||
|
{#if form.step === 2}
|
||||||
|
<button onclick={() => form.step = 1}>
|
||||||
|
{form.direction === "import" ? "Import into" : "Export from"} {form.dir.path}
|
||||||
|
</button>
|
||||||
|
<button onclick={() => form.step = 1}>{form.sync ? "Sync" : "Copy"}</button>
|
||||||
|
<button onclick={() => form.step = 1}>Service: {backends[form.backend].name}</button>
|
||||||
|
{/if}
|
||||||
|
{#if form.editing}
|
||||||
|
<button onclick={() => { form.editing = ""; form.step = 1 }}>
|
||||||
|
<i class="icon i_close"></i> Stop editing
|
||||||
|
</button>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
<hr/>
|
||||||
|
|
||||||
|
{#if form.step === 1}
|
||||||
|
<form class="form" onsubmit={e => { e.preventDefault(); form.step = 2 }}>
|
||||||
|
<label class="radio_label">
|
||||||
|
<input type="radio" bind:group={form.direction} value="import"/>
|
||||||
|
Import into Nova
|
||||||
|
</label>
|
||||||
|
<label class="radio_label">
|
||||||
|
<input type="radio" bind:group={form.direction} value="export"/>
|
||||||
|
Export from Nova
|
||||||
|
</label>
|
||||||
|
<hr/>
|
||||||
|
<label class="radio_label">
|
||||||
|
<input type="radio" bind:group={form.sync} value={true}/>
|
||||||
|
Sync: Delete files at the destination which do not exist at
|
||||||
|
the source
|
||||||
|
</label>
|
||||||
|
<label class="radio_label">
|
||||||
|
<input type="radio" bind:group={form.sync} value={false}/>
|
||||||
|
Copy: Only copy files from the source to the destination
|
||||||
|
without removing anything
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<hr/>
|
||||||
|
<label for="remote_sync_dir">Local directory</label>
|
||||||
|
<button id="remote_sync_dir" type="button" onclick={() => picker.open("/me")}>
|
||||||
|
<i class="icon i_folder"></i>
|
||||||
|
{form.dir ? form.dir.path : "Choose a directory"}
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<label for="remote_sync_backend">Remote service</label>
|
||||||
|
<select id="remote_sync_backend" bind:value={form.backend}>
|
||||||
|
{#each Object.entries(backends) as [type, b]}
|
||||||
|
<option value={type}>{b.name}</option>
|
||||||
|
{/each}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<button class="button_highlight" type="submit" disabled={!form.dir}>
|
||||||
|
Next <i class="icon i_arrow_forward"></i>
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
{:else}
|
||||||
|
<form class="form" onsubmit={submit}>
|
||||||
|
<!-- Firefox fills the account's login into a form with a password
|
||||||
|
field, unless the form has a username field of its own -->
|
||||||
|
<input type="text" autocomplete="username" value={"RemoteSync " + backends[form.backend].name} style="display: none;"/>
|
||||||
|
|
||||||
|
{#if form.backend === "s3"}
|
||||||
|
<label for="remote_sync_preset">Preset</label>
|
||||||
|
<select id="remote_sync_preset" onchange={e => use_preset(e.currentTarget.value)}>
|
||||||
|
<option value="" disabled selected>Choose a service to fill in the fields below</option>
|
||||||
|
{#each s3_presets as p, i}
|
||||||
|
{#if p.regions}
|
||||||
|
<optgroup label={p.name}>
|
||||||
|
{#each Object.entries(p.regions) as [region, city]}
|
||||||
|
<option value={i + " " + region}>{p.name} {city} ({region})</option>
|
||||||
|
{/each}
|
||||||
|
</optgroup>
|
||||||
|
{:else}
|
||||||
|
<option value={i + " "}>{p.name}</option>
|
||||||
|
{/if}
|
||||||
|
{/each}
|
||||||
|
</select>
|
||||||
|
<hr/>
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
{#each backends[form.backend].fields.filter(f => !f.advanced) as f (form.backend + f.name)}
|
||||||
|
{@render field(f)}
|
||||||
|
{/each}
|
||||||
|
{#if !backends[form.backend].path_advanced}
|
||||||
|
{@render path()}
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
{#if backends[form.backend].path_advanced || backends[form.backend].fields.some(f => f.advanced)}
|
||||||
|
<label><input type="checkbox" bind:checked={form.advanced}/> Advanced options</label>
|
||||||
|
{#if form.advanced}
|
||||||
|
{#each backends[form.backend].fields.filter(f => f.advanced) as f (form.backend + f.name)}
|
||||||
|
{@render field(f)}
|
||||||
|
{/each}
|
||||||
|
{#if backends[form.backend].path_advanced}
|
||||||
|
{@render path()}
|
||||||
|
{/if}
|
||||||
|
{/if}
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
<label>
|
||||||
|
<input type="checkbox" bind:checked={form.remember}/>
|
||||||
|
Remember the credentials, so a restart doesn't ask for them again
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<button class="button_highlight" type="submit">
|
||||||
|
{#if form.editing}
|
||||||
|
<i class="icon i_save"></i> Save
|
||||||
|
{:else}
|
||||||
|
<i class="icon i_sync_alt"></i> Start sync
|
||||||
|
{/if}
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<FilePicker bind:this={picker} callback={nodes => form.dir = { id: nodes[0].id, path: nodes[0].path }} directories/>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
/* Edit scrolls here, clear of the page's sticky header */
|
||||||
|
#remote_sync_form {
|
||||||
|
scroll-margin-top: 3.5em;
|
||||||
|
}
|
||||||
|
/* The choices of the first step, like the checkout widget */
|
||||||
|
.navbar {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
gap: 0.25em;
|
||||||
|
}
|
||||||
|
.radio_picker {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
.radio_label {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
gap: 0.5em;
|
||||||
|
margin: 0.2em 0;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,245 @@
|
|||||||
|
import { get_endpoint } from "lib/NovaAPI";
|
||||||
|
|
||||||
|
export const nova_api = new URL(get_endpoint(), window.location.href).href
|
||||||
|
|
||||||
|
// The fields are rclone's option names, the server only passes these on.
|
||||||
|
// Advanced fields are behind a toggle, their default is sent when left empty.
|
||||||
|
// Secret fields are credentials, which the server never sends back. help is
|
||||||
|
// HTML
|
||||||
|
export type Field = {
|
||||||
|
name: string
|
||||||
|
label: string
|
||||||
|
type?: "password" | "checkbox" | "textarea"
|
||||||
|
secret?: boolean
|
||||||
|
advanced?: boolean
|
||||||
|
default?: string
|
||||||
|
help?: string
|
||||||
|
}
|
||||||
|
|
||||||
|
// type is the rclone backend, when it differs from the key. A path which is
|
||||||
|
// advanced is behind the toggle, a required one is a bucket
|
||||||
|
export const backends: {
|
||||||
|
[key: string]: {
|
||||||
|
name: string, type?: string, path: string, path_advanced?: boolean, path_required?: boolean, fields: Field[],
|
||||||
|
}
|
||||||
|
} = {
|
||||||
|
s3: {
|
||||||
|
name: "S3", path: "Bucket and path", path_required: true, fields: [
|
||||||
|
{ name: "provider", label: "Provider (AWS, Cloudflare, Wasabi, Other...)" },
|
||||||
|
{ name: "endpoint", label: "Endpoint, empty for AWS" },
|
||||||
|
{ name: "region", label: "Region" },
|
||||||
|
{ name: "access_key_id", label: "Access key ID" },
|
||||||
|
{ name: "secret_access_key", label: "Secret access key", type: "password", secret: true },
|
||||||
|
]
|
||||||
|
},
|
||||||
|
b2: {
|
||||||
|
name: "Backblaze B2", path: "Bucket and path", path_required: true, fields: [
|
||||||
|
{ name: "account", label: "Application key ID" },
|
||||||
|
{ name: "key", label: "Application key", type: "password", secret: true },
|
||||||
|
]
|
||||||
|
},
|
||||||
|
azureblob: {
|
||||||
|
name: "Azure Blob Storage", path: "Container and path", path_required: true, fields: [
|
||||||
|
{ name: "account", label: "Storage account name" },
|
||||||
|
{ name: "key", label: "Storage account key", type: "password", secret: true },
|
||||||
|
]
|
||||||
|
},
|
||||||
|
sftp: {
|
||||||
|
name: "SFTP", path: "Path", fields: [
|
||||||
|
{ name: "host", label: "Host" },
|
||||||
|
{ name: "port", label: "Port, empty for 22" },
|
||||||
|
{ name: "user", label: "User" },
|
||||||
|
{ name: "pass", label: "Password", type: "password", secret: true },
|
||||||
|
{ name: "key_pem", label: "Private key (PEM), instead of a password", type: "textarea", secret: true },
|
||||||
|
]
|
||||||
|
},
|
||||||
|
ftp: {
|
||||||
|
name: "FTP", path: "Path", fields: [
|
||||||
|
{ name: "host", label: "Host" },
|
||||||
|
{ name: "port", label: "Port, empty for 21" },
|
||||||
|
{ name: "user", label: "User" },
|
||||||
|
{ name: "pass", label: "Password", type: "password", secret: true },
|
||||||
|
{ name: "tls", label: "Implicit TLS", type: "checkbox" },
|
||||||
|
{ name: "explicit_tls", label: "Explicit TLS", type: "checkbox" },
|
||||||
|
]
|
||||||
|
},
|
||||||
|
webdav: {
|
||||||
|
name: "WebDAV", path: "Path", fields: [
|
||||||
|
{ name: "url", label: "URL" },
|
||||||
|
{ name: "vendor", label: "Vendor (nextcloud, owncloud, other...)" },
|
||||||
|
{ name: "user", label: "User" },
|
||||||
|
{ name: "pass", label: "Password", type: "password", secret: true },
|
||||||
|
]
|
||||||
|
},
|
||||||
|
// Nova has the API of pixeldrain, rclone's pixeldrain backend does both. The
|
||||||
|
// API keys are text fields: Firefox fills the account password into any
|
||||||
|
// password field on this site
|
||||||
|
nova: {
|
||||||
|
name: "Nova",
|
||||||
|
type: "pixeldrain",
|
||||||
|
path: "Path inside the directory",
|
||||||
|
path_advanced: true,
|
||||||
|
fields: [
|
||||||
|
{
|
||||||
|
name: "root_folder_id",
|
||||||
|
label: "Directory ID",
|
||||||
|
default: "me",
|
||||||
|
help: "Open the directory in the other account, its Node ID is in the Details window. " +
|
||||||
|
"Leave it empty for the home directory of the key.",
|
||||||
|
}, {
|
||||||
|
// rclone checks the key with GET /user
|
||||||
|
name: "api_key",
|
||||||
|
label: "API key of remote account",
|
||||||
|
secret: true,
|
||||||
|
help: "Create one on the <a href=\"/user/api_keys\">API keys page</a> while you are logged in to " +
|
||||||
|
"that account. It needs the Account read permission.",
|
||||||
|
}, {
|
||||||
|
name: "api_url",
|
||||||
|
label: "API endpoint",
|
||||||
|
advanced: true,
|
||||||
|
default: nova_api
|
||||||
|
},
|
||||||
|
]
|
||||||
|
},
|
||||||
|
pixeldrain: {
|
||||||
|
name: "Pixeldrain", path: "Path", fields: [
|
||||||
|
{
|
||||||
|
name: "api_key", label: "API key", secret: true,
|
||||||
|
help: "Create one on the <a href=\"https://pixeldrain.com/user/api_keys\" target=\"_blank\">" +
|
||||||
|
"API keys page</a> of pixeldrain.",
|
||||||
|
},
|
||||||
|
{ name: "api_url", label: "API endpoint", advanced: true, default: "https://pixeldrain.com/api" },
|
||||||
|
{
|
||||||
|
name: "root_folder_id", label: "Directory ID, for a key which only works in one directory, or a shared directory",
|
||||||
|
advanced: true, default: "me",
|
||||||
|
},
|
||||||
|
]
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
// Common S3 services, from rclone's list of providers. A preset fills in its
|
||||||
|
// options, with {region} replaced by the chosen region. The region option is
|
||||||
|
// only set where rclone asks for it, and AWS finds the region of the bucket
|
||||||
|
// itself
|
||||||
|
export const s3_presets: {
|
||||||
|
name: string, options: { [name: string]: string }, regions?: { [region: string]: string },
|
||||||
|
}[] = [
|
||||||
|
{ name: "Amazon S3", options: { provider: "AWS", endpoint: "", region: "" } },
|
||||||
|
{
|
||||||
|
name: "Cloudflare R2",
|
||||||
|
options: { provider: "Cloudflare", endpoint: "https://ACCOUNT_ID.r2.cloudflarestorage.com", region: "auto" },
|
||||||
|
},
|
||||||
|
{ name: "Google Cloud Storage", options: { provider: "GCS", endpoint: "https://storage.googleapis.com", region: "" } },
|
||||||
|
{ name: "Storj", options: { provider: "Storj", endpoint: "https://gateway.storjshare.io", region: "" } },
|
||||||
|
{
|
||||||
|
name: "Wasabi", options: { provider: "Wasabi", endpoint: "https://s3.{region}.wasabisys.com", region: "" },
|
||||||
|
regions: {
|
||||||
|
"us-east-1": "N. Virginia", "us-east-2": "N. Virginia", "us-central-1": "Texas", "us-west-1": "Oregon",
|
||||||
|
"ca-central-1": "Toronto", "eu-central-1": "Amsterdam", "eu-central-2": "Frankfurt", "eu-west-1": "London",
|
||||||
|
"eu-west-2": "Paris", "eu-south-1": "Milan", "ap-northeast-1": "Tokyo", "ap-northeast-2": "Osaka",
|
||||||
|
"ap-southeast-1": "Singapore", "ap-southeast-2": "Sydney",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "Hetzner", options: { provider: "Hetzner", endpoint: "https://{region}.your-objectstorage.com", region: "{region}" },
|
||||||
|
regions: { fsn1: "Falkenstein", nbg1: "Nuremberg", hel1: "Helsinki" },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "Scaleway", options: { provider: "Scaleway", endpoint: "https://s3.{region}.scw.cloud", region: "{region}" },
|
||||||
|
regions: { "nl-ams": "Amsterdam", "fr-par": "Paris", "pl-waw": "Warsaw" },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "OVHcloud", options: { provider: "OVHcloud", endpoint: "https://s3.{region}.io.cloud.ovh.net", region: "{region}" },
|
||||||
|
regions: {
|
||||||
|
gra: "Gravelines", rbx: "Roubaix", sbg: "Strasbourg", "eu-west-par": "Paris", de: "Frankfurt", uk: "London",
|
||||||
|
waw: "Warsaw", bhs: "Beauharnois", "ca-east-tor": "Toronto", sgp: "Singapore", "ap-southeast-syd": "Sydney",
|
||||||
|
"ap-south-mum": "Mumbai",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "DigitalOcean Spaces",
|
||||||
|
options: { provider: "DigitalOcean", endpoint: "https://{region}.digitaloceanspaces.com", region: "" },
|
||||||
|
regions: {
|
||||||
|
nyc3: "New York", sfo2: "San Francisco", sfo3: "San Francisco", tor1: "Toronto", ams3: "Amsterdam",
|
||||||
|
fra1: "Frankfurt", lon1: "London", blr1: "Bangalore", sgp1: "Singapore", syd1: "Sydney",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
export const secret_fields = (service: string) => backends[service].fields.filter(f => f.secret)
|
||||||
|
|
||||||
|
export type RemoteSync = {
|
||||||
|
id: string
|
||||||
|
direction: string
|
||||||
|
sync: boolean
|
||||||
|
directory: string
|
||||||
|
// From the home directory, when the sync started
|
||||||
|
directory_path: string
|
||||||
|
remote: string
|
||||||
|
// What a restart uses. The options never have the credentials
|
||||||
|
type: string
|
||||||
|
path: string
|
||||||
|
options: { [name: string]: string }
|
||||||
|
remember: boolean
|
||||||
|
status: string
|
||||||
|
error: string
|
||||||
|
started: string
|
||||||
|
// rclone's core/stats object
|
||||||
|
stats: {
|
||||||
|
bytes: number
|
||||||
|
totalBytes: number
|
||||||
|
speed: number
|
||||||
|
eta: number | null
|
||||||
|
transfers: number
|
||||||
|
totalTransfers: number
|
||||||
|
checks: number
|
||||||
|
totalChecks: number
|
||||||
|
} | null
|
||||||
|
}
|
||||||
|
|
||||||
|
// The service of a sync, Nova and pixeldrain both use rclone's pixeldrain
|
||||||
|
// backend. Empty for a type which isn't in backends
|
||||||
|
export const service_of = (t: RemoteSync) => {
|
||||||
|
const service = t.type === "pixeldrain" && t.options.api_url === nova_api ? "nova" : t.type
|
||||||
|
return backends[service] === undefined ? "" : service
|
||||||
|
}
|
||||||
|
|
||||||
|
// The form outlives the page, so an attempt which failed can be tried again
|
||||||
|
// without typing everything again. It's only kept in memory, so a reload clears
|
||||||
|
// the passwords in it
|
||||||
|
export const form = $state({
|
||||||
|
step: 1,
|
||||||
|
// The sync which is edited, empty for a new one
|
||||||
|
editing: "",
|
||||||
|
// The edited sync has its credentials saved on the server
|
||||||
|
saved_secrets: false,
|
||||||
|
direction: "import",
|
||||||
|
dir: null as { id: string, path: string } | null,
|
||||||
|
backend: "s3",
|
||||||
|
// The options of one service mean nothing to another
|
||||||
|
options: Object.fromEntries(Object.keys(backends).map(k => [k, {}])) as
|
||||||
|
{ [backend: string]: { [name: string]: string | boolean } },
|
||||||
|
advanced: false,
|
||||||
|
paths: Object.fromEntries(Object.keys(backends).map(k => [k, ""])) as { [backend: string]: string },
|
||||||
|
sync: false,
|
||||||
|
remember: false,
|
||||||
|
})
|
||||||
|
|
||||||
|
// edit_remote_sync loads a sync into the form. Its credentials stay empty, the
|
||||||
|
// server never sends them, and leaving them empty keeps the saved ones
|
||||||
|
export const edit_remote_sync = (t: RemoteSync) => {
|
||||||
|
const service = service_of(t)
|
||||||
|
form.step = 1
|
||||||
|
form.editing = t.id
|
||||||
|
form.saved_secrets = t.remember
|
||||||
|
form.direction = t.direction
|
||||||
|
form.sync = t.sync
|
||||||
|
form.dir = { id: t.directory, path: t.directory_path }
|
||||||
|
form.backend = service
|
||||||
|
form.options[service] = { ...t.options }
|
||||||
|
form.paths[service] = t.path
|
||||||
|
form.remember = t.remember
|
||||||
|
form.advanced = (backends[service].path_advanced && t.path !== "") || backends[service].fields.some(f =>
|
||||||
|
f.advanced && t.options[f.name] !== undefined && t.options[f.name] !== f.default
|
||||||
|
)
|
||||||
|
}
|
||||||
Loaded 100 of 110 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user