mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-07 14:27:54 +00:00
Some checks failed
Build and push Docker image / .net docker build (push) Has been cancelled
.net checks / run .net tests (push) Has been cancelled
.net checks / dotnet-format (push) Has been cancelled
Build and push Rust service Docker images / rust docker build (push) Has been cancelled
rust checks / cargo fmt (push) Has been cancelled
168 lines
5.8 KiB
HTML
168 lines
5.8 KiB
HTML
<!DOCTYPE html>
|
|
<head>
|
|
<title>PluralKit Premium</title>
|
|
<link rel="stylesheet" href="/static/stylesheet.css" />
|
|
<script src="https://cdn.paddle.com/paddle/v2/paddle.js"></script>
|
|
</head>
|
|
<body>
|
|
<h2>PluralKit Premium</h2>
|
|
|
|
{% if let Some(session) = session %}
|
|
<form action="/logout" method="post">
|
|
<input type="hidden" name="csrf_token" value="{{ session.csrf_token }}" />
|
|
<p>
|
|
logged in as <strong>{{ session.email }}.</strong>
|
|
<button type="submit">log out</button>
|
|
</p>
|
|
</form>
|
|
<br/>
|
|
|
|
{% if subscriptions.is_empty() %}
|
|
<p>You are not currently subscribed to PluralKit Premium.</p>
|
|
<p>Enter your system token to subscribe. yes this will be fixed before release</p>
|
|
<div>
|
|
<input type="text" id="system-token" placeholder="token" required />
|
|
<button id="buy-button">Subscribe to PluralKit Premium</button>
|
|
</div>
|
|
<p id="token-error" style="color: red; display: none;"></p>
|
|
<p id="system-info" style="color: green; display: none;"></p>
|
|
{% else %}
|
|
You are currently subscribed to PluralKit Premium. Thanks for the support!
|
|
<br/>
|
|
{% for sub in &subscriptions %}
|
|
<p>
|
|
<strong>Subscription ID:</strong> {{ sub.subscription_id() }}<br/>
|
|
<strong>Status:</strong> {{ sub.status() }}<br/>
|
|
<strong>Next Renewal:</strong> {{ sub.next_renewal() }}<br/>
|
|
<strong>Linked System:</strong> {{ sub.system_id_display()|safe }}<br/>
|
|
{% if sub.is_cancellable() %}
|
|
<a href="/cancel?id={{ sub.subscription_id() }}">Cancel</a><br/>
|
|
{% endif %}
|
|
</div>
|
|
{% endfor %}
|
|
{% endif %}
|
|
|
|
{% if let Some(paddle) = paddle %}
|
|
<script>
|
|
Paddle.Environment.set("{{ paddle.environment }}");
|
|
Paddle.Initialize({
|
|
token: "{{ paddle.client_token }}",
|
|
eventCallback: function(event) {
|
|
if (event.name === "checkout.completed") {
|
|
// webhook request sometimes takes a while, artificially delay here
|
|
document.body.innerHTML = "<h2>PluralKit Premium</h2><p>Processing your subscription, please wait...</p>";
|
|
setTimeout(function() {
|
|
window.location.href = "{{ base_url }}";
|
|
}, 3000);
|
|
}
|
|
}
|
|
});
|
|
|
|
const buyButton = document.getElementById("buy-button");
|
|
if (buyButton) {
|
|
buyButton.addEventListener("click", async function() {
|
|
const tokenInput = document.getElementById("system-token");
|
|
const errorEl = document.getElementById("token-error");
|
|
const infoEl = document.getElementById("system-info");
|
|
|
|
if (!tokenInput || !tokenInput.value.trim()) {
|
|
errorEl.textContent = "Please enter your system token.";
|
|
errorEl.style.display = "block";
|
|
infoEl.style.display = "none";
|
|
return;
|
|
}
|
|
|
|
// Validate the token
|
|
buyButton.disabled = true;
|
|
buyButton.textContent = "Validating...";
|
|
errorEl.style.display = "none";
|
|
infoEl.style.display = "none";
|
|
|
|
try {
|
|
const response = await fetch("/validate-token", {
|
|
method: "POST",
|
|
headers: { "Content-Type": "application/json" },
|
|
body: JSON.stringify({
|
|
csrf_token: "{{ session.csrf_token }}",
|
|
token: tokenInput.value.trim()
|
|
})
|
|
});
|
|
|
|
const data = await response.json();
|
|
|
|
if (!response.ok) {
|
|
errorEl.textContent = data.error || "Invalid token.";
|
|
errorEl.style.display = "block";
|
|
buyButton.disabled = false;
|
|
buyButton.textContent = "Subscribe to PluralKit Premium";
|
|
return;
|
|
}
|
|
|
|
// Token is valid, open Paddle checkout
|
|
Paddle.Checkout.open({
|
|
settings: {
|
|
allowLogout: false,
|
|
},
|
|
items: [
|
|
{ priceId: "{{ paddle.price_id }}", quantity: 1 }
|
|
],
|
|
customer: {
|
|
email: "{{ session.email }}"
|
|
},
|
|
customData: {
|
|
email: "{{ session.email }}",
|
|
system_id: data.system_id
|
|
}
|
|
});
|
|
|
|
buyButton.disabled = false;
|
|
buyButton.textContent = "Subscribe to PluralKit Premium";
|
|
} catch (err) {
|
|
errorEl.textContent = "Failed to validate token. Please try again.";
|
|
errorEl.style.display = "block";
|
|
buyButton.disabled = false;
|
|
buyButton.textContent = "Subscribe to PluralKit Premium";
|
|
}
|
|
});
|
|
}
|
|
</script>
|
|
{% else %}
|
|
error initializing paddle client
|
|
{% endif %}
|
|
|
|
{% endif %}
|
|
|
|
{% if show_login_form %}
|
|
|
|
<p>
|
|
PluralKit Premium is a paid subscription for the <a href="https://pluralkit.me">PluralKit Discord bot</a> that offers cosmetic perks as well as power user features.
|
|
<br/>Currently offered is
|
|
<ul>
|
|
<li>the ability to set custom system/member/group IDs,</li>
|
|
<li>lossless, higher resolution image hosting on PluralKit's CDN,</li>
|
|
<li>the ability to upload avatars/banners directly from the PluralKit Dashboard,</li>
|
|
<li>and a badge on your PluralKit system card to show off your support.</li>
|
|
</ul>
|
|
More features will be added in the future!
|
|
</p>
|
|
|
|
<strong>Premium is not yet released, please check back soon!</strong>
|
|
|
|
<p>Enter your email address to log in.</p>
|
|
|
|
<form method="POST" action="/login">
|
|
<input type="email" name="email" placeholder="you@example.com" required />
|
|
<button type="submit">Send</button>
|
|
</form>
|
|
{% endif %}
|
|
|
|
{% if let Some(msg) = message %}
|
|
<div>{{ msg }}</div>
|
|
{% endif %}
|
|
|
|
<br/><br/>
|
|
<span>for assistance please email us at <a href="mailto:billing@pluralkit.me">billing@pluralkit.me</a></span>
|
|
<br/>
|
|
<br/>PluralKit Premium is offered by PluralKit, LLC. | <a href="/info/">info/pricing/refund policy</a> | <a href="https://pluralkit.me/terms-of-service/">terms of service</a> | <a href="https://pluralkit.me/privacy/">privacy policy</a>
|
|
<br/><a href="/">home</a>
|
|
</body>
|