From 679a405d41ea4bfc1d73c73f088928e4ba331a24 Mon Sep 17 00:00:00 2001 From: BlackSigkill Date: Wed, 4 Feb 2026 22:58:50 +0100 Subject: [PATCH 1/3] fix pocketbase wrong url used --- js/accounts/pocketbase.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/js/accounts/pocketbase.js b/js/accounts/pocketbase.js index 78134a2..53e22d8 100644 --- a/js/accounts/pocketbase.js +++ b/js/accounts/pocketbase.js @@ -4,7 +4,11 @@ import { db } from '../db.js'; import { authManager } from './auth.js'; const PUBLIC_COLLECTION = 'public_playlists'; -const POCKETBASE_URL = 'https://monodb.samidy.com'; +const DEFAULT_POCKETBASE_URL = 'https://monodb.samidy.com'; +const POCKETBASE_URL = localStorage.getItem('monochrome-pocketbase-url') || DEFAULT_POCKETBASE_URL; + +console.log('[PocketBase] Using URL:', POCKETBASE_URL); + const pb = new PocketBase(POCKETBASE_URL); pb.autoCancellation(false); @@ -115,8 +119,8 @@ const syncManager = { return new Function('return ' + jsFriendly)(); } } - } catch { - // Ignore fallback error + } catch (error) { + console.log(error);// Ignore fallback error } return fallback; } @@ -562,6 +566,8 @@ const syncManager = { window.dispatchEvent(new CustomEvent('library-changed')); window.dispatchEvent(new CustomEvent('history-changed')); window.dispatchEvent(new HashChangeEvent('hashchange')); + + console.log('[PocketBase] ✓ Sync completed successfully'); } } catch (error) { console.error('Error during PocketBase sync!', error); From 8e9ffaa6948bf545ee27ac212618ad9d8ee07500 Mon Sep 17 00:00:00 2001 From: BlackSigkill Date: Thu, 5 Feb 2026 12:19:21 +0100 Subject: [PATCH 2/3] Clarify log error with a '[Pocketbase]' prefix --- js/accounts/pocketbase.js | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/js/accounts/pocketbase.js b/js/accounts/pocketbase.js index 53e22d8..1e221c7 100644 --- a/js/accounts/pocketbase.js +++ b/js/accounts/pocketbase.js @@ -18,10 +18,8 @@ const syncManager = { _isSyncing: false, async _getUserRecord(uid) { - if (!uid) { - console.warn('_getUserRecord called with no UID.'); - return null; - } + if (!uid) return null; + if (this._userRecordCache && this._userRecordCache.firebase_id === uid) { return this._userRecordCache; } @@ -46,11 +44,11 @@ const syncManager = { this._userRecordCache = newRecord; return newRecord; } catch (createError) { - console.error('Failed to create user record in PocketBase:', createError); + console.error('[PocketBase] Failed to create user:', createError); return null; } } - console.error('Failed to get user record from PocketBase:', error); + console.error('[PocketBase] Failed to get user:', error); return null; } }, @@ -567,10 +565,10 @@ const syncManager = { window.dispatchEvent(new CustomEvent('history-changed')); window.dispatchEvent(new HashChangeEvent('hashchange')); - console.log('[PocketBase] ✓ Sync completed successfully'); + console.log('[PocketBase] ✓ Sync completed'); } } catch (error) { - console.error('Error during PocketBase sync!', error); + console.error('[PocketBase] Sync error:', error); } finally { this._isSyncing = false; } From 8b5c264bc5546cafd4eac0cc596809851a34cb06 Mon Sep 17 00:00:00 2001 From: BlackSigkill Date: Thu, 5 Feb 2026 12:21:12 +0100 Subject: [PATCH 3/3] fix linting warnings --- js/accounts/pocketbase.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/accounts/pocketbase.js b/js/accounts/pocketbase.js index 1e221c7..59782d3 100644 --- a/js/accounts/pocketbase.js +++ b/js/accounts/pocketbase.js @@ -118,7 +118,7 @@ const syncManager = { } } } catch (error) { - console.log(error);// Ignore fallback error + console.log(error); // Ignore fallback error } return fallback; }