add: stripe integration

This commit is contained in:
trisua 2025-05-05 19:38:01 -04:00
parent 2fa5a4dc1f
commit 1d120555a0
31 changed files with 1137 additions and 122 deletions

View file

@ -559,6 +559,9 @@
MANAGE_PINS: 1 << 7,
MANAGE_COMMUNITY: 1 << 8,
MANAGE_QUESTIONS: 1 << 9,
MANAGE_CHANNELS: 1 << 10,
MANAGE_MESSAGES: 1 << 11,
MANAGE_EMOJIS: 1 << 12,
},
],
);

View file

@ -119,10 +119,17 @@
</nav>
{%- endmacro %} {% macro timelines_nav(selected="") -%}
<div class="pillmenu w-full">
{% if user %}
<a href="/" class="{% if selected == 'home' %}active{% endif %}">
{{ icon "newspaper" }}
<span>{{ text "general:link.home" }}</span>
</a>
{% else %}
<a href="/" class="{% if selected == 'all' %}active{% endif %}">
{{ icon "earth" }}
<span>{{ text "general:link.all" }}</span>
</a>
{% endif %}
<a href="/popular" class="{% if selected == 'popular' %}active{% endif %}">
{{ icon "trending-up" }}

View file

@ -1,26 +0,0 @@
{% extends "root.html" %} {% block head %}
<title>{{ config.name }}</title>
{% endblock %} {% block body %}
<main class="flex justify-center" style="padding-top: 2rem">
<div class="flex flex-col gap-2" style="width: 20rem; max-width: 100%">
<h1 class="w-full text-center">{{ config.name }}</h1>
<div class="card flex flex-col gap-2">
<a href="/auth/login" class="button w-full">
{{ icon "log-in" }}
<span>{{ text "auth:action.login" }}</span>
</a>
<a href="/auth/register" class="button w-full secondary">
{{ icon "heart" }}
<span>{{ text "auth:action.register" }}</span>
</a>
</div>
<a href="/popular" class="button w-full quaternary">
{{ icon "trending-up" }}
<span>Explore popular feed</span>
</a>
</div>
</main>
{% endblock %}

View file

@ -232,6 +232,10 @@
SUPPORTER: 1 << 19,
MANAGE_REQUESTS: 1 << 20,
MANAGE_QUESTIONS: 1 << 21,
MANAGE_CHANNELS: 1 << 22,
MANAGE_MESSAGES: 1 << 23,
MANAGE_UPLOADS: 1 << 24,
MANAGE_EMOJIS: 1 << 25,
},
],
);

View file

@ -38,6 +38,34 @@
<div class="w-full flex flex-col gap-2" data-tab="account">
<div class="card tertiary flex flex-col gap-2" id="account_settings">
{% if config.stripe %}
<div class="card-nest" ui_ident="supporter_card">
<div class="card small flex items-center gap-2">
{{ icon "star" }}
<b>Supporter status</b>
</div>
<div class="card">
{% if is_supporter %}
<p>You <b>are</b> a supporter! Thank you for all that you do. You can manage your billing information below. <b>Please use your email address you supplied when paying to login to the billing portal.</b></p>
<a href="{{ config.stripe.billing_portal_url }}" class="button quaternary" target="_blank">Manage billing</a>
{% else %}
<p>You're <b>not</b> currently a supporter! No pressure, but it helps us do some pretty cool things! As a supporter, you'll get:</p>
<ul style="margin-bottom: 1rem">
<li>Vanity badge on profile</li>
<li>Ability to upload gif avatars/banners</li>
<li>Ability to use community emojis outside of their community <b>(soon)</b></li>
<li>Ability to upload and use gif emojis <b>(soon)</b></li>
</ul>
<a href="{{ config.stripe.payment_link }}?client_reference_id={{ user.id }}" class="button" target="_blank">Become a supporter</a>
<span class="fade">Please use your <b>real email</b> when completing payment. It is required to manage your billing settings.</span>
{% endif %}
</div>
</div>
{% endif %}
<div class="card-nest" ui_ident="home_timeline">
<div class="card small">
<b>Home timeline</b>
@ -894,6 +922,7 @@
const theme_settings = document.getElementById("theme_settings");
ui.refresh_container(account_settings, [
"supporter_card",
"home_timeline",
"notifications",
"change_password",

View file

@ -4,6 +4,26 @@
<main class="flex flex-col gap-2">
{{ macros::timelines_nav(selected="all") }} {{
macros::timelines_secondary_nav(posts="/all", questions="/all/questions") }}
{% if not user %}
<div class="card-nest">
<div class="card small flex items-center gap-2">
{{ icon "heart" }}
<b>{{ text "general:label.better_with_account" }}</b>
</div>
<div class="card flex gap-2">
<a href="/auth/login" class="button">
{{ icon "log-in" }}
<span>{{ text "auth:action.login" }}</span>
</a>
<a href="/auth/register" class="button secondary">
{{ icon "user-plus" }}
<span>{{ text "auth:action.register" }}</span>
</a>
</div>
</div>
{% endif %}
<!-- prettier-ignore -->
<div class="card w-full flex flex-col gap-2">