Finish patreon integration

This commit is contained in:
2021-01-11 21:43:04 +01:00
parent 7dae739e7b
commit 4e1f553207
10 changed files with 241 additions and 251 deletions

View File

@@ -6,6 +6,36 @@
✅ You are logged in to your pixeldrain account. Continue to the next step.
## Join a support tier in Patreon
<div style="text-align: center;">
{{$plan := .URLQuery.Get "plan"}}
{{if eq $plan "t5"}}
<a class="button button_highlight" href="https://www.patreon.com/join/pixeldrain/checkout?rid=5736701">
Order plan 'Resolve'
</a>
{{else if eq $plan "t2"}}
<a class="button button_highlight" href="https://www.patreon.com/join/pixeldrain/checkout?rid=5291482">
Order plan 'Persistence'
</a>
{{else if eq $plan "t3"}}
<a class="button button_highlight" href="https://www.patreon.com/join/pixeldrain/checkout?rid=5291516">
Order plan 'Tenacity'
</a>
{{else if eq $plan "t4"}}
<a class="button button_highlight" href="https://www.patreon.com/join/pixeldrain/checkout?rid=5291528">
Order plan 'Eternity'
</a>
{{else}}
<a class="button button_highlight" href="https://www.patreon.com/join/pixeldrain/checkout?rid=5291427">
Order Pixeldrain Pro Plan
</a>
{{end}}
</div>
After ordering you will receive an e-mail on your Patreon e-mail address with a
link to activate your subscription.
{{else}}
❌ You are not logged into a pixeldrain account. If you do not have an account
@@ -13,56 +43,3 @@ yet you need to register one. You can do so with our [registration
form](/register). If you already have an account you can [log in here](/login).
{{end}}
## Verify your e-mail address
{{if eq .User.Email ""}}
❌ Your e-mail address is not yet verified. You can change your e-mail address on
the [user settings page](/user/settings). After submitting your e-mail address
you will receive a verification link in your inbox. Click the verification link
to verify your e-mail address.
{{else}}
✅ Your e-mail address is verified. Continue to the next step.
{{end}}
## Join a support tier in Patreon
Make sure your Patreon account uses the same e-mail address as your pixeldrain
account. {{if .Authenticated}}(Your e-mail address: {{.User.Email}}){{end}}
{{$plan := .URLQuery.Get "plan"}}
{{if eq $plan "t1"}}
<a class="button button_highlight" href="https://www.patreon.com/join/pixeldrain/checkout?rid=5291427">
Order plan 'I'm doing my part!'
</a>
{{else if eq $plan "t5"}}
<a class="button button_highlight" href="https://www.patreon.com/join/pixeldrain/checkout?rid=5736701">
Order plan 'Resolve'
</a>
{{else if eq $plan "t2"}}
<a class="button button_highlight" href="https://www.patreon.com/join/pixeldrain/checkout?rid=5291482">
Order plan 'Persistence'
</a>
{{else if eq $plan "t3"}}
<a class="button button_highlight" href="https://www.patreon.com/join/pixeldrain/checkout?rid=5291516">
Order plan 'Tenacity'
</a>
{{else if eq $plan "t4"}}
<a class="button button_highlight" href="https://www.patreon.com/join/pixeldrain/checkout?rid=5291528">
Order plan 'Eternity'
</a>
{{else}}
<div style="text-align: center;">
<a class="button button_highlight" href="https://www.patreon.com/join/pixeldrain">
See our subscription plans on Patreon
</a>
</div>
{{end}}
After ordering you will receive an e-mail with a link to activate your
subscription. The subscription will be linked to the pixeldrain account you're
currently logged into.

View File

@@ -34,14 +34,14 @@ function UploadManager(uploadEndpoint, uploadsFinished) {
this.jobCounter = 0;
}
UploadManager.prototype.finishedUploads = function() {
UploadManager.prototype.finishedUploads = function () {
this.uploadLog.sort((a, b) => {
return a.jobID - b.jobID;
})
return this.uploadLog;
}
UploadManager.prototype.addFile = function(
UploadManager.prototype.addFile = function (
file, // Blob
name, // string
onProgress, // func (progress: number)
@@ -67,7 +67,7 @@ UploadManager.prototype.addFile = function(
}
}
UploadManager.prototype.startUpload = function() {
UploadManager.prototype.startUpload = function () {
if (this.uploadQueue.length === 0) {
return; // Nothing to upload
}
@@ -78,13 +78,13 @@ UploadManager.prototype.startUpload = function() {
}
}
UploadManager.prototype.finishUpload = function() {
UploadManager.prototype.finishUpload = function () {
this.activeWorkers--;
if (
this.uploadQueue.length === 0 &&
this.activeWorkers === 0 &&
typeof(this.uploadsFinished) === "function"
typeof (this.uploadsFinished) === "function"
) {
this.uploadsFinished();
return;
@@ -94,7 +94,7 @@ UploadManager.prototype.finishUpload = function() {
this.startUpload();
}
UploadManager.prototype.uploadThread = function() {
UploadManager.prototype.uploadThread = function () {
let job = this.uploadQueue.shift(); // Get the first element of the array
console.debug("Starting upload of " + job.name);
@@ -107,7 +107,7 @@ UploadManager.prototype.uploadThread = function() {
// Report progress updates back to the caller
xhr.upload.addEventListener("progress", evt => {
if (evt.lengthComputable && typeof(job.onProgress) === "function") {
if (evt.lengthComputable && typeof (job.onProgress) === "function") {
job.onProgress(evt.loaded / evt.total);
}
});
@@ -128,7 +128,7 @@ UploadManager.prototype.uploadThread = function() {
fileName: job.name
});
if (typeof(job.onFinished) === "function") {
if (typeof (job.onFinished) === "function") {
job.onFinished(resp.id);
}
@@ -138,7 +138,7 @@ UploadManager.prototype.uploadThread = function() {
// Request failed
console.log("Upload error. status: " + xhr.status + " response: " + xhr.response);
let resp = JSON.parse(xhr.response);
if (job.tries === 3) { // Upload failed
if (resp.value == "file_too_large" || job.tries === 3) { // Upload failed
job.onFailure(resp.value, resp.message);
} else { // Try again
job.tries++;
@@ -150,7 +150,7 @@ UploadManager.prototype.uploadThread = function() {
} else {
// Request did not arrive
if (job.tries === 3) { // Upload failed
if (typeof(job.onFailure) === "function") {
if (typeof (job.onFailure) === "function") {
job.onFailure(xhr.responseText, xhr.responseText);
}
} else { // Try again

View File

@@ -346,7 +346,7 @@ pre {
.file_button{
position: relative;
box-sizing: border-box;
width: 300px;
width: 400px;
max-width: 90%;
height: 3.6em;
margin: 10px;
@@ -432,6 +432,7 @@ select {
overflow: hidden;
font-size: 1em; /* Sometimes user-agents have different font sizes for buttons and links */
text-decoration: none;
text-shadow: none;
color: #bfbfbf; /* Fallback */
color: var(--input_text_color);
outline: 0;