From fa716f002a1651586c84317f9cec7cf45f0737c8 Mon Sep 17 00:00:00 2001 From: Samidy Date: Fri, 16 Jan 2026 18:47:28 +0300 Subject: [PATCH] New Account System --- firebase-setup.md | 93 - index.html | 73 +- js/{firebase => accounts}/auth.js | 18 +- js/{firebase => accounts}/config.js | 0 js/accounts/pocketbase.js | 480 + js/app.js | 8 +- js/db.js | 249 +- js/events.js | 2 +- js/firebase/sync.js | 465 - js/settings.js | 8 +- js/ui-interactions.js | 12 +- js/ui.js | 8 +- package-lock.json | 17555 +++++++++++++------------- package.json | 3 + 14 files changed, 9439 insertions(+), 9535 deletions(-) delete mode 100644 firebase-setup.md rename js/{firebase => accounts}/auth.js (91%) rename js/{firebase => accounts}/config.js (100%) create mode 100644 js/accounts/pocketbase.js delete mode 100644 js/firebase/sync.js diff --git a/firebase-setup.md b/firebase-setup.md deleted file mode 100644 index 115dd74..0000000 --- a/firebase-setup.md +++ /dev/null @@ -1,93 +0,0 @@ -# Setting Up Firebase Sync for Monochrome - -Follow these steps to enable cross-device synchronization for your library, history, and settings using your own Firebase project. - -## 1. Create a Firebase Project - -1. Go to the [Firebase Console](https://console.firebase.google.com/). -2. Click **Add project** and give it a name (e.g., "Monochrome Sync"). -3. (Optional) Disable Gemini and Google Analytics if you want to keep it simple. -4. Click **Create project**. - -## 2. Enable Authentication - -1. In the left sidebar, click **Build** > **Authentication**. -2. Click **Get Started**. -3. Go to the **Sign-in method** tab. -4. Select **Google** and enable it. -5. Set your project support email and click **Save**. - -### 2.1 Authorized Domains (CRITICAL) - -Firebase will block login attempts from unknown domains. - -1. In the **Authentication** section, go to the **Settings** tab. -2. Click **Authorized domains** in the left sub-menu. -3. Click **Add domain**. -4. Add your hosting domain (e.g., `julienmaille.github.io`). - - _Note: `localhost` and `127.0.0.1` are usually added by default for local testing._ - -## 3. Enable Realtime Database - -1. In the left sidebar, click **Build** > **Realtime Database**. -2. Click **Create Database**. -3. Choose a location near you and click **Next**. -4. Select **Start in test mode** (we will change the rules in the next step) and click **Enable**. - -## 4. Set Security Rules - -1. In the Realtime Database section, go to the **Rules** tab. -2. Replace the existing rules with the following to ensure users can only see their own data: - - ```json - { - "rules": { - "users": { - "$uid": { - ".read": "$uid === auth.uid", - ".write": "$uid === auth.uid" - } - }, - "public_playlists": { - ".read": true, - ".indexOn": ["uid", "name"], - "$playlistId": { - ".write": "auth != null && (!data.exists() || data.child('uid').val() === auth.uid)" - } - } - } - } - ``` - - - **Note:** The `public_playlists` rule allows anyone to read the playlists. The write rule ensures that only authenticated users can publish, and only the owner (creator) of a playlist can modify or delete it. - -3. Click **Publish**. - -## 5. Get Your Configuration - -1. Click the gear icon (⚙️) next to "Project Overview" and select **Project settings**. -2. In the **General** tab, scroll down to "Your apps" and click the **Web icon (``)**. -3. Register the app (e.g., "Monochrome App"). -4. You will see a `firebaseConfig` object. It looks like this: - ```javascript - const firebaseConfig = { - apiKey: 'AIzaSy...', - authDomain: 'your-project.firebaseapp.com', - databaseURL: 'https://your-project.firebaseio.com', - projectId: 'your-project', - storageBucket: 'your-project.appspot.com', - messagingSenderId: '...', - appId: '...', - }; - ``` -5. **Copy only the part with the curly braces `{ ... }`**. - -## 6. Configure Monochrome - -1. Open the Monochrome app and go to **Settings**. -2. Find the **Firebase Configuration** section. -3. Paste the JSON object you copied into the textarea. -4. Click **Save & Reload**. -5. Under **Sync & Backup**, click **Connect with Google** and sign in. - -**Your library is now synced to the cloud!** Log in on any other device with the same configuration to see your music everywhere. diff --git a/index.html b/index.html index ab96a8c..dfed5d0 100644 --- a/index.html +++ b/index.html @@ -152,7 +152,7 @@ >
Public Playlist - Visible to anyone with the link + Visible to anyone with the link.