Get Khoj Cloud Subscription URL via environment variable

This commit is contained in:
Debanjum Singh Solanky 2023-11-08 10:03:19 -08:00
parent 609d358b1a
commit c52affc6d9
3 changed files with 2 additions and 2 deletions

View file

@ -178,7 +178,7 @@
</div>
{% if not is_subscribed %}
<div class="card-action-row">
<a class="card-button happy" href="https://buy.stripe.com/28ocQb7kb4iD0cEdQQ?email={{ username }}" target="_blank">
<a class="card-button happy" href="{{ khoj_cloud_subscription_url }}?email={{ username }}" target="_blank">
Subscribe
<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M5 12h14M12 5l7 7-7 7"></path></svg>
</a>

View file

@ -782,7 +782,6 @@ async def unsubscribe(request: Request, email: str):
customer_id = customer[0].id
for subscription in stripe.Subscription.list(customer=customer_id):
stripe.Subscription.modify(subscription.id, cancel_at_period_end=True)
success = True
else:
success = False

View file

@ -149,6 +149,7 @@ def config_page(request: Request):
"user_photo": user_picture,
"is_subscribed": user_is_subscribed,
"days_to_renewal": days_to_renewal,
"khoj_cloud_subscription_url": os.getenv("KHOJ_CLOUD_SUBSCRIPTION_URL"),
},
)