diff --git a/res/include/script/user_home.js b/res/include/script/user_home.js index 5f91752..bc28dfe 100644 --- a/res/include/script/user_home.js +++ b/res/include/script/user_home.js @@ -58,7 +58,12 @@ function loadDirectBW() { return resp.json(); }).then(resp => { let total = resp.amounts.reduce((accum, val) => accum += val, 0); - document.getElementById("direct_bandwidth_month").innerText = formatDataVolume(total, 4) + document.getElementById("direct_bandwidth_progress").style.width = (total / window.user.subscription.direct_linking_bandwidth) * 100 + "%" + document.getElementById("direct_bandwidth_text").innerText = formatDataVolume(total, 3) + " out of " + formatDataVolume(window.user.subscription.direct_linking_bandwidth, 3) + + document.getElementById("storage_progress").style.width = (window.user.storage_space_used / window.user.subscription.storage_space) * 100 + "%" + document.getElementById("storage_text").innerText = formatDataVolume(window.user.storage_space_used, 3) + " out of " + formatDataVolume(window.user.subscription.storage_space, 3) + }).catch(e => { console.error("Error requesting time series: " + e); }) diff --git a/res/template/account/user_home.html b/res/template/account/user_home.html index e03f653..f5d00f5 100644 --- a/res/template/account/user_home.html +++ b/res/template/account/user_home.html @@ -3,7 +3,24 @@ {{template "meta_tags" .User.Username}} {{template "user_style" .}} - + + + @@ -23,29 +40,45 @@ (Manage subscription) {{end}} - Change account settings -

- Export uploaded files to CSV - Export created lists to CSV +

Limits

+ Storage:
+
+
+
+
+ Direct link bandwidth: + (More information about direct linking) +
+
+
+
+ +

Settings

+
+ + edit + Change account settings + + + list + Export uploaded files to CSV + + + list + Export created lists to CSV + +

Statistics

diff --git a/res/template/home.html b/res/template/home.html index 63a496a..8ce1ecd 100644 --- a/res/template/home.html +++ b/res/template/home.html @@ -74,8 +74,8 @@ window.api_endpoint = '{{.APIEndpoint}}'; window.user_subscription = {{.User.Subscription}}; - - + + {{template "page_top" .}} @@ -187,6 +187,17 @@ +

+
+ Storage space +
+
+ 500 gigabytes +
+
+ 1 terabyte +
+
Online file previews @@ -230,6 +241,7 @@
20 GB file size
2 TB direct link bandwidth
+ 2 TB storage space
120 days file expiry
@@ -246,6 +258,7 @@
20 GB file size
4 TB direct link bandwidth
+ 4 TB storage space
240 days file expiry
@@ -262,6 +275,7 @@
20 GB file size
8 TB direct link bandwidth
+ 8 TB storage space
480 days file expiry
@@ -278,6 +292,7 @@
20 GB file size
16 TB direct link bandwidth
+ 16 TB storage space
Files never expre
@@ -294,6 +309,7 @@
20 GB file size
32 TB direct link bandwidth
+ 32 TB storage space
Files never expre
diff --git a/svelte/src/admin_panel/AbuseReports.svelte b/svelte/src/admin_panel/AbuseReports.svelte index 4db5751..3af84e7 100644 --- a/svelte/src/admin_panel/AbuseReports.svelte +++ b/svelte/src/admin_panel/AbuseReports.svelte @@ -81,7 +81,7 @@ const get_reports = async () => { onMount(() => { let start = new Date() - start.setDate(start.getDate() - 14) + start.setDate(start.getDate() - 28) let end = new Date() startPicker.valueAsNumber = start.getTime() diff --git a/svelte/src/home_page/UploadProgressBar.svelte b/svelte/src/home_page/UploadProgressBar.svelte index a104210..e682efa 100644 --- a/svelte/src/home_page/UploadProgressBar.svelte +++ b/svelte/src/home_page/UploadProgressBar.svelte @@ -118,7 +118,10 @@ export const start = () => { resp = JSON.parse(xhr.response) } - if (resp.value == "file_too_large" || resp.value == "ip_banned" || tries === 3) { + if (resp.value == "file_too_large" + || resp.value == "ip_banned" + || resp.value == "user_out_of_space" + || tries === 3) { // Permanent failure on_failure(resp.value, resp.message) } else { diff --git a/webcontroller/templates.go b/webcontroller/templates.go index e6426dd..7c7549e 100644 --- a/webcontroller/templates.go +++ b/webcontroller/templates.go @@ -135,6 +135,7 @@ func (tm *TemplateManager) ParseTemplates(silent bool) { "pageNr": tm.pageNr, "add": tm.add, "sub": tm.sub, + "mul": tm.mul, "div": tm.div, "formatData": tm.formatData, "formatSC": tm.formatSC, @@ -245,9 +246,10 @@ func (tm *TemplateManager) pageNr(s string) (nr int) { } return nr } -func (tm *TemplateManager) add(a, b interface{}) int { return detectInt(a) + detectInt(b) } -func (tm *TemplateManager) sub(a, b interface{}) int { return detectInt(a) - detectInt(b) } -func (tm *TemplateManager) div(a, b float64) float64 { return a / b } +func (tm *TemplateManager) add(a, b interface{}) float64 { return toFloat(a) + toFloat(b) } +func (tm *TemplateManager) sub(a, b interface{}) float64 { return toFloat(a) - toFloat(b) } +func (tm *TemplateManager) mul(a, b interface{}) float64 { return toFloat(a) * toFloat(b) } +func (tm *TemplateManager) div(a, b interface{}) float64 { return toFloat(a) / toFloat(b) } func (tm *TemplateManager) formatData(i interface{}) string { return util.FormatData(int64(detectInt(i))) @@ -311,3 +313,33 @@ func detectInt(i interface{}) int { } panic(fmt.Sprintf("%v is not an int", i)) } + +func toFloat(i interface{}) float64 { + switch v := i.(type) { + case int: + return float64(v) + case int8: + return float64(v) + case int16: + return float64(v) + case int32: + return float64(v) + case int64: + return float64(v) + case uint: + return float64(v) + case uint8: + return float64(v) + case uint16: + return float64(v) + case uint32: + return float64(v) + case uint64: + return float64(v) + case float32: + return float64(v) + case float64: + return float64(v) + } + panic(fmt.Sprintf("%v is not a number", i)) +}