Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

sveltekit-pocketbase-starter

Package Overview
Dependencies
Maintainers
0
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sveltekit-pocketbase-starter - npm Package Compare versions

Comparing version 1.0.3 to 1.0.4

2

package.json
{
"name": "sveltekit-pocketbase-starter",
"version": "1.0.3",
"version": "1.0.4",
"author": "Dominick Caponi <d.caponi1@gmail.com>",

@@ -5,0 +5,0 @@ "license": "MIT",

@@ -26,5 +26,3 @@ import { redirect } from '@sveltejs/kit';

if (currentUser){
let subscriptionStatus = null;
let subscriptionCancelAt = null;
let subscriptionID = null;

@@ -42,21 +40,21 @@ const stripeCustomerResult = await stripe.customers.list({

if (subscriptionResult.data.length > 0){
subscriptionStatus = subscriptionResult.data[0].status;
if (subscriptionResult.data[0].cancel_at) {
subscriptionCancelAt = new Date(subscriptionResult.data[0].cancel_at * 1000)
const subscription = subscriptionResult.data[0];
if (subscription.cancel_at) {
subscriptionCancelAt = new Date(subscription.cancel_at * 1000)
}
subscriptionID = subscriptionResult.data[0].id;
await locals.pb?.collection('users').update(userAuthSession.id, {
subscriptionID: subscriptionStatus === "active" ? subscriptionID : null
})
subscriptionID: subscription.status === "active" ? subscription.id : null
});
} else {
await locals.pb?.collection('users').update(userAuthSession.id, {
subscriptionID: null
})
});
}
}
if (currentUser.purchaseIntent) {
let newUserState = {purchaseIntent: '', credits: currentUser.credits}
const nonce = url.searchParams.get('nonce')
const purchaseIntent = validateJwt(currentUser.purchaseIntent, VITE_NONCE_SIGNING_SECRET) as JwtPayload
if (purchaseIntent && purchaseIntent.nonce === nonce) {
const purchaseIntent = validateJwt(currentUser.purchaseIntent, VITE_NONCE_SIGNING_SECRET + nonce) as JwtPayload
if (purchaseIntent) {
newUserState = {...newUserState, credits: (currentUser.credits + purchaseIntent.credits)}

@@ -67,2 +65,3 @@ }

}
return {

@@ -69,0 +68,0 @@ loggedIn: locals.pb?.authStore.isValid,

@@ -71,3 +71,3 @@ import jwt, { type JwtPayload } from 'jsonwebtoken';

const nonce = generateNonce();
const purchaseIntent = jwt.sign({...chosen, nonce}, VITE_NONCE_SIGNING_SECRET);
const purchaseIntent = jwt.sign(chosen, VITE_NONCE_SIGNING_SECRET + nonce);
const isProd = process.env.NODE_ENV === 'production' ? true : false;

@@ -74,0 +74,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc