From ef4e55053600ff6bf44b813d0eafdefd53f83abf Mon Sep 17 00:00:00 2001 From: Fornax Date: Sun, 28 Nov 2021 21:42:01 +0100 Subject: [PATCH] Add coupon management functions --- go.mod | 2 +- go.sum | 4 +- svelte/src/admin_panel/Subscriptions.svelte | 146 ++++++++++++++++++-- svelte/src/file_viewer/EmbedWindow.svelte | 10 +- webcontroller/subscription_activate.go | 66 +++++++++ webcontroller/web_controller.go | 11 +- 6 files changed, 221 insertions(+), 18 deletions(-) diff --git a/go.mod b/go.mod index fb43f83..1550f56 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.17 require ( fornaxian.tech/config v0.0.0-20211108212237-6133aed90586 fornaxian.tech/log v0.0.0-20211102185326-552e9b1f8640 - fornaxian.tech/pixeldrain_api_client v0.0.0-20211123215854-be6e25030ad8 + fornaxian.tech/pixeldrain_api_client v0.0.0-20211128192613-093515ebeaa7 fornaxian.tech/util v0.0.0-20211102152345-9a486dee9787 github.com/julienschmidt/httprouter v1.3.0 github.com/microcosm-cc/bluemonday v1.0.16 diff --git a/go.sum b/go.sum index d1d02d1..a8985b1 100644 --- a/go.sum +++ b/go.sum @@ -3,8 +3,8 @@ fornaxian.tech/config v0.0.0-20211108212237-6133aed90586/go.mod h1:ULIXF4J1DbBw4 fornaxian.tech/log v0.0.0-20190617093801-1c7ce9a7c9b3/go.mod h1:OyWUNsNPlo5AmlOHvJ4s6WcStQw+9rQyBMwmTz0buEM= fornaxian.tech/log v0.0.0-20211102185326-552e9b1f8640 h1:UPDxJwLRCfh/cv80UMSanzmZ0jIcfS1mcd0Y06HYuLw= fornaxian.tech/log v0.0.0-20211102185326-552e9b1f8640/go.mod h1:sN82qMToeHhP2u3ehvrcE8y1IudRZJAZO9yG5OBYblo= -fornaxian.tech/pixeldrain_api_client v0.0.0-20211123215854-be6e25030ad8 h1:0ueAJb5nHOpFa5TXZgVVs4ORsf2zhpxLRUx3AuAx+wM= -fornaxian.tech/pixeldrain_api_client v0.0.0-20211123215854-be6e25030ad8/go.mod h1:uajB2ofEsefUtxjvs4m7SDyPVRlfrI3qzCSWcud47hY= +fornaxian.tech/pixeldrain_api_client v0.0.0-20211128192613-093515ebeaa7 h1:Gx7SRu906VslyPcIL9D3uw3B2uO6u7mIwsMD7SPr+9k= +fornaxian.tech/pixeldrain_api_client v0.0.0-20211128192613-093515ebeaa7/go.mod h1:uajB2ofEsefUtxjvs4m7SDyPVRlfrI3qzCSWcud47hY= fornaxian.tech/util v0.0.0-20211102152345-9a486dee9787 h1:9ujI8Qi6+FTL/YW6xQAS9DmWDMerHBe8foQvVD/G/i0= fornaxian.tech/util v0.0.0-20211102152345-9a486dee9787/go.mod h1:FqVgfghmxTGR3l9Zx4MOMeZ9KHjiEFl3s3C0BSTvBwk= github.com/BurntSushi/toml v0.4.1 h1:GaI7EiDXDRfa8VshkTj7Fym7ha+y8/XxIgD2okUIjLw= diff --git a/svelte/src/admin_panel/Subscriptions.svelte b/svelte/src/admin_panel/Subscriptions.svelte index ccc1161..8342213 100644 --- a/svelte/src/admin_panel/Subscriptions.svelte +++ b/svelte/src/admin_panel/Subscriptions.svelte @@ -1,7 +1,10 @@ -
-
-

Give user credit

-

- This adds credit to a user's account. You only need to enter one of - the user id, username or email. -

-
-
+
+ {#if loading} +
+
+ {/if} +

Give user credit

+

+ This adds credit to a user's account. You only need to enter one of + the user id, username or email. +

+
+
+
+ +

Create coupon codes

+
+
+
+ +

Active coupon codes

+
+ + + + + + + + {#each coupons as row (row.id)} + + + + + + + {/each} +
IDUsesCredit
{row.id}{row.uses} + +
+ + diff --git a/svelte/src/file_viewer/EmbedWindow.svelte b/svelte/src/file_viewer/EmbedWindow.svelte index 0f78a29..b6242f9 100644 --- a/svelte/src/file_viewer/EmbedWindow.svelte +++ b/svelte/src/file_viewer/EmbedWindow.svelte @@ -164,6 +164,14 @@ const example = () => { Deep sea
+ {:else} +

Direct link

+

+ You can directly download the file from this link without using the + file viewer: +
+ {domain_url()}{file.get_href} +

{/if}

Code

@@ -171,7 +179,7 @@ const example = () => { Put this code in your website to embed the file.

- +