misc: clarity csp, handle billing errors, notes (#831)

This commit is contained in:
Brandon Thomas authored and GitHub committed 2025-09-18 14:49:46 -04:00
1 parent 5e5aa01ce7
commit 8477991327
5 files changed
+23 -9

No files matched your search

+2 -2
View File
@@ -46,10 +46,10 @@
"img-src": "* data: blob: 'unsafe-inline'",
"script-src": [
"'self'",
"https://*.clarity.ms",
"https://*.fakeyou.com",
"https://*.storyteller.ai",
"https://www.clarity.ms",
"https://scripts.clarity.ms",
"https://clarity.ms",
"ipc://localhost",
"tauri://localhost"
],
+2 -2
View File
@@ -46,10 +46,10 @@
"img-src": "* data: blob: 'unsafe-inline'",
"script-src": [
"'self'",
"https://*.clarity.ms",
"https://*.fakeyou.com",
"https://*.storyteller.ai",
"https://www.clarity.ms",
"https://scripts.clarity.ms",
"https://clarity.ms",
"ipc://localhost",
"tauri://localhost"
],
@@ -26,7 +26,13 @@ export const useCreditsState = create<CreditsState>()((set) => ({
// Call to fetch credits from the server
fetchFromServer: async () => {
const data = await ArtcraftGetCredits();
let data;
try {
data = await ArtcraftGetCredits();
} catch (error) {
console.error("Error fetching credits", error);
return;
}
if (!!data.payload) {
set((state) => ({
freeCredits: data.payload.free_credits,
@@ -36,4 +42,4 @@ export const useCreditsState = create<CreditsState>()((set) => ({
}));
}
}
}))
}))
@@ -52,10 +52,15 @@ export const useSubscriptionState = create<SubscriptionState>()((set, get) => ({
// Call to fetch credits from the server
fetchFromServer: async () => {
const data = await ArtcraftGetSubscription();
let data;
try {
data = await ArtcraftGetSubscription();
} catch (error) {
console.error("Error fetching subscription", error);
return;
}
if (!!data.payload) {
let activeSubscription = undefined;
console.log(">>> subscription data.payload", data.payload);
if (!!data.payload.active_subscription) {
activeSubscription = {
subscriptionToken: data.payload.active_subscription.subscription_token,
@@ -65,7 +70,6 @@ export const useSubscriptionState = create<SubscriptionState>()((set, get) => ({
subscriptionEndAt: data.payload.active_subscription.subscription_end_at ? new Date(data.payload.active_subscription.subscription_end_at) : undefined,
};
}
console.log(">>> activeSubscription", activeSubscription);
set((state) => ({
subscriptionInfo: activeSubscription,
}));
+4
View File
@@ -24,8 +24,12 @@ popd || exit
export TAURI_FRONTEND_PATH="${frontend_path}"
export TAURI_APP_PATH="${rust_crate_path}"
# NB: The "frontend dev" script sets "production" too, so this must only control the
# hostnames we use, not minification, etc.
export VITE_ENVIRONMENT_TYPE="production"
# This appears to trigger "nx build" instead of "nx dev".
cargo tauri build --config "${config_path}"
echo "Done!"