From 263700495fc1b5a6f007b6a87d3857804666cb52 Mon Sep 17 00:00:00 2001 From: Ben Allfree Date: Fri, 18 Jul 2025 20:52:24 -0700 Subject: [PATCH 1/7] refactor(mothership): improve logging clarity in HandleInstanceResolve --- .../src/lib/handlers/instance/api/HandleInstanceResolve.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/pockethost/src/mothership-app/src/lib/handlers/instance/api/HandleInstanceResolve.ts b/packages/pockethost/src/mothership-app/src/lib/handlers/instance/api/HandleInstanceResolve.ts index 9564d148..20222fd5 100644 --- a/packages/pockethost/src/mothership-app/src/lib/handlers/instance/api/HandleInstanceResolve.ts +++ b/packages/pockethost/src/mothership-app/src/lib/handlers/instance/api/HandleInstanceResolve.ts @@ -5,7 +5,7 @@ export const HandleInstanceResolve = (c: echo.Context) => { const log = mkLog(`GET:instance/resolve`) - log(`***TOP OF GET`) + log(`TOP OF GET`) const host = c.queryParam('host') if (!host) { From 60eeb5cb0512f003634630c371e4c0780e9365d0 Mon Sep 17 00:00:00 2001 From: Ben Allfree Date: Fri, 18 Jul 2025 21:03:33 -0700 Subject: [PATCH 2/7] refactor(instanceService): remove CNAME block check for improved instance handling --- packages/pockethost/src/services/InstanceService/index.ts | 3 --- 1 file changed, 3 deletions(-) diff --git a/packages/pockethost/src/services/InstanceService/index.ts b/packages/pockethost/src/services/InstanceService/index.ts index 4ee9909a..a9d4a38b 100644 --- a/packages/pockethost/src/services/InstanceService/index.ts +++ b/packages/pockethost/src/services/InstanceService/index.ts @@ -254,9 +254,6 @@ export const instanceService = mkSingleton(async (config: InstanceServiceConfig) } }) if (instance) { - if (!instance.cname_active) { - throw new Error(`CNAME blocked.`) - } dbg(`${host} is a cname`) cache.setItem(instance) return instance From 876a44092f163b174e55173a250d0b8779f73f0f Mon Sep 17 00:00:00 2001 From: Ben Allfree Date: Sat, 19 Jul 2025 06:16:04 -0700 Subject: [PATCH 3/7] fix(firewall): update health check endpoint path from `/_api/firewall/health` to `/api/firewall/health` --- .../commands/FirewallCommand/ServeCommand/firewall/server.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/pockethost/src/cli/commands/FirewallCommand/ServeCommand/firewall/server.ts b/packages/pockethost/src/cli/commands/FirewallCommand/ServeCommand/firewall/server.ts index 6412fd0f..0ef9b59d 100644 --- a/packages/pockethost/src/cli/commands/FirewallCommand/ServeCommand/firewall/server.ts +++ b/packages/pockethost/src/cli/commands/FirewallCommand/ServeCommand/firewall/server.ts @@ -42,7 +42,7 @@ export const firewall = async () => { app.use(cors()) app.use(enforce.HTTPS()) - app.get(`/_api/firewall/health`, (req, res, next) => { + app.get(`/api/firewall/health`, (req, res, next) => { dbg(`Health check`) res.json({ status: 'firewall ok' }) res.end() From 51c361aec6488823b8881bab3f5c3aaf41deb41f Mon Sep 17 00:00:00 2001 From: Ben Allfree Date: Sat, 19 Jul 2025 06:48:09 -0700 Subject: [PATCH 4/7] enh(dashboard): improve logging for user and instance subscriptions --- packages/dashboard/src/util/stores.ts | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/packages/dashboard/src/util/stores.ts b/packages/dashboard/src/util/stores.ts index c66e61d9..293d32f4 100644 --- a/packages/dashboard/src/util/stores.ts +++ b/packages/dashboard/src/util/stores.ts @@ -92,15 +92,16 @@ export const init = () => { onAuthChange((authStoreProps) => { const isLoggedIn = authStoreProps.isValid - isUserLoggedIn.set(isLoggedIn) + console.log(`onAuthChange update`, { isLoggedIn, authStoreProps }) const user = authStoreProps.model as UserFields userStore.set(isLoggedIn ? user : undefined) isAuthStateInitialized.set(true) + isUserLoggedIn.set(isLoggedIn) tryUserSubscribe(user?.id) }) userStore.subscribe((user) => { - console.log(`userStore.subscribe`, { user }) + console.log(`userStore.subscribe update`, { user }) const isPaid = [SubscriptionType.Founder, SubscriptionType.Premium, SubscriptionType.Flounder].includes( user?.subscription || SubscriptionType.Free ) @@ -113,22 +114,25 @@ export const init = () => { // This holds an array of all the user's instances and their data /** Listen for instances */ + let unsubInstanceWatch: UnsubscribeFunc | undefined isUserLoggedIn.subscribe(async (isLoggedIn) => { - let unsub: UnsubscribeFunc | undefined + console.log(`isUserLoggedIn.subscribe update`, { isLoggedIn }) if (!isLoggedIn) { userStore.set(undefined) globalInstancesStore.set({}) globalInstancesStoreReady.set(false) - unsub?.() + unsubInstanceWatch?.() .then(() => { - unsub = undefined + unsubInstanceWatch = undefined }) .catch(console.error) return } const { getAllInstancesById } = client() + console.log('Getting all instances by ID') const instances = await getAllInstancesById() + console.log('Instances', instances) globalInstancesStore.set(instances) globalInstancesStoreReady.set(true) @@ -137,13 +141,14 @@ export const init = () => { client() .client.collection('instances') .subscribe('*', (data) => { + console.log('Instance subscribe update', data) globalInstancesStore.update((instances) => { instances[data.record.id] = data.record return instances }) }) .then((u) => { - unsub = u + unsubInstanceWatch = u }) .catch(() => { console.error('Failed to subscribe to instances') @@ -171,6 +176,7 @@ const tryUserSubscribe = (() => { client().client.collection('users').authRefresh().catch(console.error) }) .then((u) => { + console.log('Subscribed to user', id) unsub = async () => { console.log('Unsubscribing from user', id) await u() From e59c0af44db1c6d210715423f3a97b05f5ff307c Mon Sep 17 00:00:00 2001 From: Ben Allfree Date: Sat, 19 Jul 2025 06:48:48 -0700 Subject: [PATCH 5/7] chore(dashboard): remove unused DISCORD_URL import for cleaner code --- .../src/routes/(app)/instances/[instanceId]/Overview.svelte | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/dashboard/src/routes/(app)/instances/[instanceId]/Overview.svelte b/packages/dashboard/src/routes/(app)/instances/[instanceId]/Overview.svelte index cf636836..bc6403e4 100644 --- a/packages/dashboard/src/routes/(app)/instances/[instanceId]/Overview.svelte +++ b/packages/dashboard/src/routes/(app)/instances/[instanceId]/Overview.svelte @@ -1,8 +1,8 @@