Compare commits

...

9 Commits

Author SHA1 Message Date
Mauricio Siu
be934065d9 Merge pull request #702 from Dokploy/canary
v0.11.2
2024-11-13 23:48:47 -06:00
Mauricio Siu
82fc9897d2 Merge pull request #701 from Dokploy/fix/stripe-payments
fix(stripe): attempt to fix the servers assignation when the user pay
2024-11-13 23:39:49 -06:00
Mauricio Siu
8162dcfb71 Merge pull request #697 from limichange/patch-1
Update plausible docker-compose.yml
2024-11-13 23:34:57 -06:00
Mauricio Siu
b6ab653ef3 chore(version): bump version 2024-11-13 23:30:33 -06:00
Mauricio Siu
17e9a1a497 fix(stripe): attempt to fix the servers assignation when the user pay 2024-11-13 23:29:24 -06:00
limichange
46f7d43595 Update templates.ts 2024-11-14 09:37:20 +08:00
limichange
59bb59ee24 Update docker-compose.yml 2024-11-13 16:30:11 +08:00
Mauricio Siu
d081d477ef Merge pull request #695 from sokhuong-uon/canary
fix(signin-page): fix a broken link to password reset docs
2024-11-12 21:34:06 -06:00
Sokhuong Uon
cf73f1f764 fix(signin): fix broken link to password reset docs 2024-11-13 09:47:22 +07:00
5 changed files with 50 additions and 24 deletions

View File

@@ -1,6 +1,6 @@
{ {
"name": "dokploy", "name": "dokploy",
"version": "v0.11.1", "version": "v0.11.2",
"private": true, "private": true,
"license": "Apache-2.0", "license": "Apache-2.0",
"type": "module", "type": "module",

View File

@@ -88,7 +88,6 @@ export default async function handler(
.update(admins) .update(admins)
.set({ .set({
stripeSubscriptionId: newSubscription.id, stripeSubscriptionId: newSubscription.id,
serversQuantity: 0,
stripeCustomerId: newSubscription.customer as string, stripeCustomerId: newSubscription.customer as string,
}) })
.where(eq(admins.stripeCustomerId, newSubscription.customer as string)) .where(eq(admins.stripeCustomerId, newSubscription.customer as string))
@@ -121,12 +120,6 @@ export default async function handler(
} }
case "customer.subscription.updated": { case "customer.subscription.updated": {
const newSubscription = event.data.object as Stripe.Subscription; const newSubscription = event.data.object as Stripe.Subscription;
await db
.update(admins)
.set({
serversQuantity: newSubscription?.items?.data?.[0]?.quantity ?? 0,
})
.where(eq(admins.stripeCustomerId, newSubscription.customer as string));
const admin = await findAdminByStripeCustomerId( const admin = await findAdminByStripeCustomerId(
newSubscription.customer as string, newSubscription.customer as string,
@@ -136,8 +129,27 @@ export default async function handler(
return res.status(400).send("Webhook Error: Admin not found"); return res.status(400).send("Webhook Error: Admin not found");
} }
const newServersQuantity = admin.serversQuantity; if (newSubscription.status === "active") {
await updateServersBasedOnQuantity(admin.adminId, newServersQuantity); await db
.update(admins)
.set({
serversQuantity: newSubscription?.items?.data?.[0]?.quantity ?? 0,
})
.where(
eq(admins.stripeCustomerId, newSubscription.customer as string),
);
const newServersQuantity = admin.serversQuantity;
await updateServersBasedOnQuantity(admin.adminId, newServersQuantity);
} else {
await disableServers(admin.adminId);
await db
.update(admins)
.set({ serversQuantity: 0 })
.where(
eq(admins.stripeCustomerId, newSubscription.customer as string),
);
}
break; break;
} }
@@ -148,6 +160,13 @@ export default async function handler(
newInvoice.subscription as string, newInvoice.subscription as string,
); );
if (suscription.status !== "active") {
console.log(
`Skipping invoice.payment_succeeded for subscription ${suscription.id} with status ${suscription.status}`,
);
break;
}
await db await db
.update(admins) .update(admins)
.set({ .set({
@@ -168,22 +187,29 @@ export default async function handler(
} }
case "invoice.payment_failed": { case "invoice.payment_failed": {
const newInvoice = event.data.object as Stripe.Invoice; const newInvoice = event.data.object as Stripe.Invoice;
await db
.update(admins)
.set({
serversQuantity: 0,
})
.where(eq(admins.stripeCustomerId, newInvoice.customer as string));
const admin = await findAdminByStripeCustomerId( const subscription = await stripe.subscriptions.retrieve(
newInvoice.customer as string, newInvoice.subscription as string,
); );
if (!admin) { if (subscription.status !== "active") {
return res.status(400).send("Webhook Error: Admin not found"); const admin = await findAdminByStripeCustomerId(
newInvoice.customer as string,
);
if (!admin) {
return res.status(400).send("Webhook Error: Admin not found");
}
await db
.update(admins)
.set({
serversQuantity: 0,
})
.where(eq(admins.stripeCustomerId, newInvoice.customer as string));
await disableServers(admin.adminId);
} }
await disableServers(admin.adminId);
break; break;
} }

View File

@@ -199,7 +199,7 @@ export default function Home({ IS_CLOUD }: Props) {
) : ( ) : (
<Link <Link
className="hover:underline text-muted-foreground" className="hover:underline text-muted-foreground"
href="https://docs.dokploy.com/docs/core/get-started/reset-password" href="https://docs.dokploy.com/docs/core/reset-password"
target="_blank" target="_blank"
> >
Lost your password? Lost your password?

View File

@@ -26,7 +26,7 @@ services:
hard: 262144 hard: 262144
plausible: plausible:
image: ghcr.io/plausible/community-edition:v2.1.0 image: ghcr.io/plausible/community-edition:v2.1.4
restart: always restart: always
command: sh -c "sleep 10 && /entrypoint.sh db createdb && /entrypoint.sh db migrate && /entrypoint.sh run" command: sh -c "sleep 10 && /entrypoint.sh db createdb && /entrypoint.sh db migrate && /entrypoint.sh run"
depends_on: depends_on:

View File

@@ -34,7 +34,7 @@ export const templates: TemplateData[] = [
{ {
id: "plausible", id: "plausible",
name: "Plausible", name: "Plausible",
version: "v2.1.0", version: "v2.1.4",
description: description:
"Plausible is a open source, self-hosted web analytics platform that lets you track website traffic and user behavior.", "Plausible is a open source, self-hosted web analytics platform that lets you track website traffic and user behavior.",
logo: "plausible.svg", logo: "plausible.svg",