Add page for confirming knoxfs trials
This commit is contained in:
BIN
res/static/img/knoxfs.png
Normal file
BIN
res/static/img/knoxfs.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 106 KiB |
@@ -4,8 +4,9 @@
|
|||||||
{{template "meta_tags" "Buckets"}}
|
{{template "meta_tags" "Buckets"}}
|
||||||
{{template "user_style" .}}
|
{{template "user_style" .}}
|
||||||
<script>window.api_endpoint = '{{.APIEndpoint}}';</script>
|
<script>window.api_endpoint = '{{.APIEndpoint}}';</script>
|
||||||
|
<link rel='stylesheet' href='/res/svelte/user_buckets.css'>
|
||||||
|
<script defer src='/res/svelte/user_buckets.js'></script>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
{{template "page_top" .}}
|
{{template "page_top" .}}
|
||||||
<h1>My Buckets</h1>
|
<h1>My Buckets</h1>
|
||||||
@@ -13,9 +14,6 @@
|
|||||||
|
|
||||||
{{template "page_bottom" .}}
|
{{template "page_bottom" .}}
|
||||||
{{template "analytics"}}
|
{{template "analytics"}}
|
||||||
|
|
||||||
<link rel='stylesheet' href='/res/svelte/user_buckets.css'>
|
|
||||||
<script defer src='/res/svelte/user_buckets.js'></script>
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
{{end}}
|
{{end}}
|
||||||
|
@@ -19,7 +19,7 @@
|
|||||||
<li>E-mail address: {{.User.Email}}</li>
|
<li>E-mail address: {{.User.Email}}</li>
|
||||||
<li>
|
<li>
|
||||||
Supporter level: {{.User.Subscription.Name}}
|
Supporter level: {{.User.Subscription.Name}}
|
||||||
{{if ne .User.Subscription.ID ""}}
|
{{if eq .User.Subscription.Type "patreon"}}
|
||||||
(<a href="https://www.patreon.com/join/pixeldrain/checkout?edit=1">Manage subscription</a>)
|
(<a href="https://www.patreon.com/join/pixeldrain/checkout?edit=1">Manage subscription</a>)
|
||||||
{{end}}
|
{{end}}
|
||||||
<ul>
|
<ul>
|
||||||
|
@@ -60,6 +60,19 @@
|
|||||||
<img src="/res/img/sharex_default.png" style="max-width: 100%;" /><br/>
|
<img src="/res/img/sharex_default.png" style="max-width: 100%;" /><br/>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
<h2>Pixeldrain Android</h2>
|
||||||
|
<div class="specs">
|
||||||
|
Platform: Android |
|
||||||
|
License: None |
|
||||||
|
<a href="https://github.com/wimvdputten/Pixeldrain_android" target="_blank">GitHub</a>
|
||||||
|
</div>
|
||||||
|
<p>
|
||||||
|
An Android app for uploading and sharing files on pixeldrain.
|
||||||
|
You can get a compiled APK package from the <a
|
||||||
|
href="https://github.com/wimvdputten/Pixeldrain_android/releases"
|
||||||
|
target="_blank">GitHub releases page</a>.
|
||||||
|
</p>
|
||||||
|
|
||||||
<h2>go-pixeldrain</h2>
|
<h2>go-pixeldrain</h2>
|
||||||
<div class="specs">
|
<div class="specs">
|
||||||
Platform: Linux, Mac OS, Windows (CLI) |
|
Platform: Linux, Mac OS, Windows (CLI) |
|
||||||
|
@@ -31,7 +31,7 @@ func browserCompat(ua string) bool {
|
|||||||
|
|
||||||
func adType() int {
|
func adType() int {
|
||||||
const (
|
const (
|
||||||
aAds = 0 // Always on
|
aAds = 0
|
||||||
amarulaElectronics = 1
|
amarulaElectronics = 1
|
||||||
patreon = 2
|
patreon = 2
|
||||||
soulStudio = 3
|
soulStudio = 3
|
||||||
@@ -47,7 +47,7 @@ func adType() int {
|
|||||||
// Intn returns a number up to n, but never n itself. So to get a random 0
|
// Intn returns a number up to n, but never n itself. So to get a random 0
|
||||||
// or 1 we need to give it n=2. We can use this function to make other
|
// or 1 we need to give it n=2. We can use this function to make other
|
||||||
// splits like 1/3 1/4, etc
|
// splits like 1/3 1/4, etc
|
||||||
switch i := rand.Intn(15); i {
|
switch i := rand.Intn(20); i {
|
||||||
case 0, 1, 2:
|
case 0, 1, 2:
|
||||||
return amarulaSolutions
|
return amarulaSolutions
|
||||||
case 3:
|
case 3:
|
||||||
@@ -58,9 +58,9 @@ func adType() int {
|
|||||||
return pdpro3
|
return pdpro3
|
||||||
case 6:
|
case 6:
|
||||||
return pdpro4
|
return pdpro4
|
||||||
case 7, 8, 9, 10:
|
case 7, 8, 9:
|
||||||
return adMaven
|
return adMaven
|
||||||
case 11, 12, 13, 14:
|
case 10, 11, 12, 13, 14, 15, 16, 17, 18, 19:
|
||||||
return propellerAds
|
return propellerAds
|
||||||
default:
|
default:
|
||||||
panic(fmt.Errorf("random number generator returned unrecognised number: %d", i))
|
panic(fmt.Errorf("random number generator returned unrecognised number: %d", i))
|
||||||
|
@@ -1,89 +0,0 @@
|
|||||||
package webcontroller
|
|
||||||
|
|
||||||
import (
|
|
||||||
"fmt"
|
|
||||||
"html/template"
|
|
||||||
"net/http"
|
|
||||||
)
|
|
||||||
|
|
||||||
func (wc *WebController) patreonLinkForm(td *TemplateData, r *http.Request) (f Form) {
|
|
||||||
f.Name = "link_patreon_subscription"
|
|
||||||
f.Title = "Link Patreon pledge to pixeldrain account"
|
|
||||||
f.SubmitLabel = "Submit"
|
|
||||||
|
|
||||||
if r.FormValue("key") == "" {
|
|
||||||
f.Submitted = true
|
|
||||||
f.SubmitMessages = []template.HTML{"Patron ID not found"}
|
|
||||||
return f
|
|
||||||
}
|
|
||||||
|
|
||||||
patron, err := td.PixelAPI.PatreonByID(r.FormValue("key"))
|
|
||||||
if err != nil && err.Error() == "not_found" {
|
|
||||||
f.Submitted = true
|
|
||||||
f.SubmitMessages = []template.HTML{"Patron ID not found"}
|
|
||||||
return f
|
|
||||||
} else if err != nil {
|
|
||||||
f.Submitted = true
|
|
||||||
formAPIError(err, &f)
|
|
||||||
return f
|
|
||||||
}
|
|
||||||
|
|
||||||
f.Fields = []Field{{
|
|
||||||
Name: "1",
|
|
||||||
Label: "",
|
|
||||||
DefaultValue: "",
|
|
||||||
Description: "<h3>Please confirm that the following information is correct:</h3>",
|
|
||||||
Type: FieldTypeDescription,
|
|
||||||
}, {
|
|
||||||
Name: "2",
|
|
||||||
Label: "Pixeldrain username",
|
|
||||||
DefaultValue: td.User.Username,
|
|
||||||
Type: FieldTypeDescription,
|
|
||||||
}, {
|
|
||||||
Name: "3",
|
|
||||||
Label: "Pixeldrain e-mail",
|
|
||||||
DefaultValue: td.User.Email,
|
|
||||||
Type: FieldTypeDescription,
|
|
||||||
}, {
|
|
||||||
Name: "4",
|
|
||||||
Label: "Patreon username",
|
|
||||||
DefaultValue: patron.FullName,
|
|
||||||
Type: FieldTypeDescription,
|
|
||||||
}, {
|
|
||||||
Name: "5",
|
|
||||||
Label: "Patreon e-mail",
|
|
||||||
DefaultValue: patron.UserEmail,
|
|
||||||
Type: FieldTypeDescription,
|
|
||||||
}, {
|
|
||||||
Name: "6",
|
|
||||||
Label: "Subscription name",
|
|
||||||
DefaultValue: patron.Subscription.Name,
|
|
||||||
Type: FieldTypeDescription,
|
|
||||||
}, {
|
|
||||||
Name: "7",
|
|
||||||
Label: "Monthly contribution",
|
|
||||||
DefaultValue: fmt.Sprintf("€ %.2f / month", float64(patron.PledgeAmountCents)/100.0),
|
|
||||||
Type: FieldTypeDescription,
|
|
||||||
}, {
|
|
||||||
Name: "8",
|
|
||||||
Description: "When clicking submit your patreon pledge will be linked " +
|
|
||||||
"to your pixeldrain account and you will be able to use " +
|
|
||||||
"pixeldrain's premium features. If you would like to update or " +
|
|
||||||
"cancel your subscription later on you can do so through " +
|
|
||||||
"patreon's dashboard",
|
|
||||||
Type: FieldTypeDescription,
|
|
||||||
}}
|
|
||||||
|
|
||||||
if f.ReadInput(r) {
|
|
||||||
if err := td.PixelAPI.PatreonLink(r.FormValue("key")); err != nil {
|
|
||||||
formAPIError(err, &f)
|
|
||||||
} else {
|
|
||||||
// Request was a success
|
|
||||||
f.SubmitSuccess = true
|
|
||||||
f.SubmitMessages = []template.HTML{template.HTML(
|
|
||||||
"Success! Your account has been upgraded to the " + patron.Subscription.Name + " plan.",
|
|
||||||
)}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return f
|
|
||||||
}
|
|
177
webcontroller/subscription_activate.go
Normal file
177
webcontroller/subscription_activate.go
Normal file
@@ -0,0 +1,177 @@
|
|||||||
|
package webcontroller
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"html/template"
|
||||||
|
"net/http"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
func (wc *WebController) patreonLinkForm(td *TemplateData, r *http.Request) (f Form) {
|
||||||
|
f.Name = "link_patreon_subscription"
|
||||||
|
f.Title = "Link Patreon pledge to pixeldrain account"
|
||||||
|
f.SubmitLabel = "Submit"
|
||||||
|
|
||||||
|
if r.FormValue("key") == "" {
|
||||||
|
f.Submitted = true
|
||||||
|
f.SubmitMessages = []template.HTML{"Patron ID not found"}
|
||||||
|
return f
|
||||||
|
}
|
||||||
|
|
||||||
|
patron, err := td.PixelAPI.PatreonByID(r.FormValue("key"))
|
||||||
|
if err != nil && err.Error() == "not_found" {
|
||||||
|
f.Submitted = true
|
||||||
|
f.SubmitMessages = []template.HTML{"Patron ID not found"}
|
||||||
|
return f
|
||||||
|
} else if err != nil {
|
||||||
|
f.Submitted = true
|
||||||
|
formAPIError(err, &f)
|
||||||
|
return f
|
||||||
|
}
|
||||||
|
|
||||||
|
f.Fields = []Field{{
|
||||||
|
Name: "1",
|
||||||
|
Label: "",
|
||||||
|
DefaultValue: "",
|
||||||
|
Description: "<h3>Please confirm that the following information is correct:</h3>",
|
||||||
|
Type: FieldTypeDescription,
|
||||||
|
}, {
|
||||||
|
Name: "2",
|
||||||
|
Label: "Pixeldrain username",
|
||||||
|
DefaultValue: td.User.Username,
|
||||||
|
Type: FieldTypeDescription,
|
||||||
|
}, {
|
||||||
|
Name: "3",
|
||||||
|
Label: "Pixeldrain e-mail",
|
||||||
|
DefaultValue: td.User.Email,
|
||||||
|
Type: FieldTypeDescription,
|
||||||
|
}, {
|
||||||
|
Name: "4",
|
||||||
|
Label: "Patreon username",
|
||||||
|
DefaultValue: patron.FullName,
|
||||||
|
Type: FieldTypeDescription,
|
||||||
|
}, {
|
||||||
|
Name: "5",
|
||||||
|
Label: "Patreon e-mail",
|
||||||
|
DefaultValue: patron.UserEmail,
|
||||||
|
Type: FieldTypeDescription,
|
||||||
|
}, {
|
||||||
|
Name: "6",
|
||||||
|
Label: "Subscription name",
|
||||||
|
DefaultValue: patron.Subscription.Name,
|
||||||
|
Type: FieldTypeDescription,
|
||||||
|
}, {
|
||||||
|
Name: "7",
|
||||||
|
Label: "Monthly contribution",
|
||||||
|
DefaultValue: fmt.Sprintf("€ %.2f / month", float64(patron.PledgeAmountCents)/100.0),
|
||||||
|
Type: FieldTypeDescription,
|
||||||
|
}, {
|
||||||
|
Name: "8",
|
||||||
|
Description: "When clicking submit your patreon pledge will be linked " +
|
||||||
|
"to your pixeldrain account and you will be able to use " +
|
||||||
|
"pixeldrain's premium features. If you would like to update or " +
|
||||||
|
"cancel your subscription later on you can do so through " +
|
||||||
|
"patreon's dashboard",
|
||||||
|
Type: FieldTypeDescription,
|
||||||
|
}}
|
||||||
|
|
||||||
|
if f.ReadInput(r) {
|
||||||
|
if err := td.PixelAPI.PatreonLink(r.FormValue("key")); err != nil {
|
||||||
|
formAPIError(err, &f)
|
||||||
|
} else {
|
||||||
|
// Request was a success
|
||||||
|
f.SubmitSuccess = true
|
||||||
|
f.SubmitMessages = []template.HTML{template.HTML(
|
||||||
|
"Success! Your account has been upgraded to the " + patron.Subscription.Name + " plan.",
|
||||||
|
)}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return f
|
||||||
|
}
|
||||||
|
|
||||||
|
func (wc *WebController) knoxfsLinkForm(td *TemplateData, r *http.Request) (f Form) {
|
||||||
|
f.Name = "link_subscription"
|
||||||
|
f.Title = "Activate KnoxFS promo"
|
||||||
|
f.PreFormHTML = template.HTML(
|
||||||
|
`<div style="text-align: center;">
|
||||||
|
<img src="/res/img/knoxfs.png" alt="KnoxFS logo" style="max-width: 14em;" />
|
||||||
|
</div>`,
|
||||||
|
)
|
||||||
|
f.SubmitLabel = "Confirm"
|
||||||
|
|
||||||
|
if r.FormValue("key") == "" {
|
||||||
|
f.Submitted = true
|
||||||
|
f.SubmitMessages = []template.HTML{"Subscription ID not found"}
|
||||||
|
return f
|
||||||
|
}
|
||||||
|
|
||||||
|
sub, err := td.PixelAPI.SubscriptionByID(r.FormValue("key"))
|
||||||
|
if err != nil && err.Error() == "not_found" {
|
||||||
|
f.Submitted = true
|
||||||
|
f.SubmitMessages = []template.HTML{"Subscription ID not found"}
|
||||||
|
return f
|
||||||
|
} else if err != nil {
|
||||||
|
f.Submitted = true
|
||||||
|
formAPIError(err, &f)
|
||||||
|
return f
|
||||||
|
}
|
||||||
|
|
||||||
|
f.Fields = []Field{{
|
||||||
|
Name: "1",
|
||||||
|
Label: "",
|
||||||
|
DefaultValue: "",
|
||||||
|
Description: "<h3>Please confirm that the following information is correct:</h3>",
|
||||||
|
Type: FieldTypeDescription,
|
||||||
|
}, {
|
||||||
|
Name: "2",
|
||||||
|
Label: "Pixeldrain username",
|
||||||
|
DefaultValue: td.User.Username,
|
||||||
|
Type: FieldTypeDescription,
|
||||||
|
}, {
|
||||||
|
Name: "3",
|
||||||
|
Label: "Pixeldrain e-mail",
|
||||||
|
DefaultValue: td.User.Email,
|
||||||
|
Type: FieldTypeDescription,
|
||||||
|
}, {
|
||||||
|
Name: "4",
|
||||||
|
Label: "Subscription",
|
||||||
|
DefaultValue: sub.SubscriptionType.Name,
|
||||||
|
Type: FieldTypeDescription,
|
||||||
|
}, {
|
||||||
|
Name: "5",
|
||||||
|
Label: "Duration",
|
||||||
|
DefaultValue: fmt.Sprintf("%d days", sub.DurationDays),
|
||||||
|
Type: FieldTypeDescription,
|
||||||
|
}, {
|
||||||
|
Name: "6",
|
||||||
|
Label: "End date",
|
||||||
|
DefaultValue: time.Now().AddDate(0, 0, sub.DurationDays).Format("2006-01-02"),
|
||||||
|
Type: FieldTypeDescription,
|
||||||
|
}, {
|
||||||
|
Name: "7",
|
||||||
|
Description: "When clicking submit this subscription will be linked " +
|
||||||
|
"to your pixeldrain account and you will be able to use " +
|
||||||
|
"pixeldrain's pro features. If you already have a pixeldrain " +
|
||||||
|
"subscription it will be overwritten",
|
||||||
|
Type: FieldTypeDescription,
|
||||||
|
}}
|
||||||
|
if sub.Used {
|
||||||
|
f.Submitted = true
|
||||||
|
f.SubmitRed = true
|
||||||
|
f.SubmitMessages = []template.HTML{"This subscription is already linked to a pixeldrain account. It can't be linked again"}
|
||||||
|
return f
|
||||||
|
}
|
||||||
|
|
||||||
|
if f.ReadInput(r) {
|
||||||
|
if err := td.PixelAPI.SubscriptionLink(r.FormValue("key")); err != nil {
|
||||||
|
formAPIError(err, &f)
|
||||||
|
} else {
|
||||||
|
// Request was a success
|
||||||
|
f.SubmitSuccess = true
|
||||||
|
f.SubmitMessages = []template.HTML{template.HTML(
|
||||||
|
"Success! Your account has been upgraded to the " + sub.SubscriptionType.Name + " plan.",
|
||||||
|
)}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return f
|
||||||
|
}
|
@@ -157,6 +157,9 @@ func New(
|
|||||||
{GET, "patreon_activate" /* */, wc.serveForm(wc.patreonLinkForm, true)},
|
{GET, "patreon_activate" /* */, wc.serveForm(wc.patreonLinkForm, true)},
|
||||||
{PST, "patreon_activate" /* */, wc.serveForm(wc.patreonLinkForm, true)},
|
{PST, "patreon_activate" /* */, wc.serveForm(wc.patreonLinkForm, true)},
|
||||||
|
|
||||||
|
{GET, "knoxfs_activate" /* */, wc.serveForm(wc.knoxfsLinkForm, true)},
|
||||||
|
{PST, "knoxfs_activate" /* */, wc.serveForm(wc.knoxfsLinkForm, true)},
|
||||||
|
|
||||||
// Admin settings
|
// Admin settings
|
||||||
{GET, "admin" /* */, wc.serveTemplate("admin_panel", true)},
|
{GET, "admin" /* */, wc.serveTemplate("admin_panel", true)},
|
||||||
{GET, "admin/globals" /**/, wc.serveForm(wc.adminGlobalsForm, true)},
|
{GET, "admin/globals" /**/, wc.serveForm(wc.adminGlobalsForm, true)},
|
||||||
|
Reference in New Issue
Block a user