Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions firestore.rules
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ rules_version = '2';
// Deploy with: firebase deploy --only firestore:rules
//
// Collections in use:
// Youworship_songs — song catalog (served via public API)
// youworship_songs — song catalog (served via public API)
// bible_chapters — daily Bible verses (public)
// Youworship_users/{uid} — favorites / playlists / recently played
// Youworship_users/{uid}/devices/{deviceId} — YouWorship Connect registry
Expand Down Expand Up @@ -37,7 +37,7 @@ service cloud.firestore {
// ─────────────────────────────────────────────────────────────
// Public content — browsable without an account.
// ─────────────────────────────────────────────────────────────
match /Youworship_songs/{songId} {
match /youworship_songs/{songId} {
// Songs are public; the API also serves them.
allow read: if true;

Expand Down
125 changes: 109 additions & 16 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"firebase": "^12.16.0",
"firebase-admin": "^14.2.0",
"framer-motion": "^12.42.2",
"fuse.js": "^7.5.0",
"jwks-rsa": "^3.1.0",
"lucide-react": "^1.24.0",
"music-metadata": "^11.14.0",
Expand All @@ -40,7 +41,7 @@
"tailwindcss": "^4"
},
"optionalDependencies": {
"lightningcss-linux-x64-gnu": "1.32.0",
"@tailwindcss/oxide-linux-x64-gnu": "4.3.2"
"@tailwindcss/oxide-linux-x64-gnu": "4.3.2",
"lightningcss-linux-x64-gnu": "1.32.0"
}
}
7 changes: 4 additions & 3 deletions scripts/compress-upload.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
* node scripts/compress-upload.js
*/

require("dotenv").config({ path: ".env.local" });
require("dotenv").config({ path: ".env" });
require("dotenv").config({ path: ".env.local", override: true });

const fs = require("fs");
const path = require("path");
Expand Down Expand Up @@ -173,7 +174,7 @@ async function compressToBuffer(inputPath) {
// ─── Step 3: Upload Buffer Directly to Supabase Storage ──────────────────────
async function uploadBufferToSupabase(buffer, storagePath) {
if (!supabase) {
throw new Error("Supabase client is not configured. Please set NEXT_PUBLIC_SUPABASE_URL and SUPABASE_SECRET_KEY in .env.local");
throw new Error("Supabase client is not configured. Please set NEXT_PUBLIC_SUPABASE_URL and SUPABASE_SECRET_KEY in your env files");
}

const safeKey = getSafeStorageKey(storagePath);
Expand Down Expand Up @@ -237,7 +238,7 @@ async function processImages() {
}

if (!supabase) {
console.warn("⚠️ Supabase credentials missing in .env.local. Uploads will be simulated.");
console.warn("⚠️ Supabase credentials missing in env files. Uploads will be simulated.");
}

const relativeFilePaths = getFilesRecursively(inputFolder);
Expand Down
28 changes: 22 additions & 6 deletions scripts/fetch-songs.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,15 @@ import { fileURLToPath } from "url";
import path from "path";

const __dirname = path.dirname(fileURLToPath(import.meta.url));
dotenv.config({ path: path.resolve(__dirname, "../.env.local") });
dotenv.config({ path: path.resolve(__dirname, "../.env") });
dotenv.config({
path: path.resolve(__dirname, "../.env.local"),
override: true,
});

const { initializeApp } = await import("firebase/app");
const { getFirestore, collection, getDocs, query, limit } = await import("firebase/firestore");
const { getFirestore, collection, getDocs, query, limit } =
await import("firebase/firestore");

const firebaseConfig = {
apiKey: process.env.NEXT_PUBLIC_FIREBASE_API_KEY,
Expand All @@ -35,7 +40,9 @@ const app = initializeApp(firebaseConfig);
const db = getFirestore(app);

async function main() {
console.log("🔍 Fetching up to 3 songs from Firebase 'songs' collection...\n");
console.log(
"🔍 Fetching up to 3 songs from Firebase 'songs' collection...\n",
);

const q = query(collection(db, "songs"), limit(3));
const snap = await getDocs(q);
Expand All @@ -59,9 +66,18 @@ async function main() {

// Print the full structure with types
for (const [key, value] of Object.entries(data)) {
const type = Array.isArray(value) ? `Array(${value.length})` : typeof value;
const type = Array.isArray(value)
? `Array(${value.length})`
: typeof value;
const preview = Array.isArray(value)
? `[${value.slice(0, 2).map(v => typeof v === 'string' ? `"${v.substring(0, 30)}..."` : JSON.stringify(v)).join(", ")}${value.length > 2 ? "..." : ""}]`
? `[${value
.slice(0, 2)
.map((v) =>
typeof v === "string"
? `"${v.substring(0, 30)}..."`
: JSON.stringify(v),
)
.join(", ")}${value.length > 2 ? "..." : ""}]`
: typeof value === "string"
? `"${value.substring(0, 60)}${value.length > 60 ? "..." : ""}"`
: JSON.stringify(value);
Expand All @@ -74,7 +90,7 @@ async function main() {
process.exit(0);
}

main().catch(err => {
main().catch((err) => {
console.error("❌ Error:", err.message);
process.exit(1);
});
Loading