diff --git a/.eslintrc.json b/.eslintrc.json index ba624b3..f7db991 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -5,6 +5,7 @@ "node": true, "es2023": true }, + "extends": ["eslint:recommended", "prettier"], "parser": "@babel/eslint-parser", "parserOptions": { "requireConfigFile": false, diff --git a/index.html b/index.html index 509fde4..579c7c8 100644 --- a/index.html +++ b/index.html @@ -1,4 +1,4 @@ - + @@ -211,6 +211,7 @@

Live Streams

Popular Tags

+
JavaScript Python diff --git a/public/offline.html b/public/offline.html index ab112fb..b9f443a 100644 --- a/public/offline.html +++ b/public/offline.html @@ -1,16 +1,19 @@ - - - + + + Offline - - - + + +
-

You are Offline

-

It seems you are not connected to the internet. Please check your connection and try again.

- Go to Home +

You are Offline

+

+ It seems you are not connected to the internet. Please check your + connection and try again. +

+ Go to Home
- + diff --git a/public/service-worker.js b/public/service-worker.js index df820c4..c89c5bb 100644 --- a/public/service-worker.js +++ b/public/service-worker.js @@ -1,51 +1,55 @@ // service-worker.js +const CACHE_NAME = 'devstream-v1'; const CACHE_NAME = "devstream-v2"; // List of resources to cache const CACHE_RESOURCES = [ - "/", - "/index.html", - "/src/css/style.css", - "/src/js/main.js", - "/manifest.json", - "/src/assets/images/preview-placeholder.jpg", - "/src/assets/icons/icon-192x192.png", - "/src/assets/icons/icon-512x512.png", - "/src/assets/icons/maskable-icon-192x192.png", - "/src/assets/icons/maskable-icon-512x512.png", - "https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css", - "https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free/css/all.min.css", - "https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js", - "https://fonts.googleapis.com/css2?family=Roboto:wght@400&display=swap", - "https://fonts.gstatic.com/s/roboto/v27/KFOmCnqEu92Fr1Mu4mxK.woff2" + '/', + '/index.html', + '/src/css/style.css', + '/src/js/main.js', + '/manifest.json', + '/src/assets/images/preview-placeholder.jpg', + '/src/assets/icons/icon-192x192.png', + '/src/assets/icons/icon-512x512.png', + '/src/assets/icons/maskable-icon-192x192.png', + '/src/assets/icons/maskable-icon-512x512.png', + 'https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css', + 'https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free/css/all.min.css', + 'https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js', + 'https://fonts.googleapis.com/css2?family=Roboto:wght@400&display=swap', + 'https://fonts.gstatic.com/s/roboto/v27/KFOmCnqEu92Fr1Mu4mxK.woff2', ]; // Install event handler -self.addEventListener("install", (event) => { - event.waitUntil( - caches.open(CACHE_NAME).then((cache) => { - console.log("Installing service worker..."); - return cache.addAll(CACHE_RESOURCES); - }).catch(error => { - console.error("Error during cache installation:", error); - }) - ); +self.addEventListener('install', (event) => { + event.waitUntil( + caches + .open(CACHE_NAME) + .then((cache) => { + console.log('Installing service worker...'); + return cache.addAll(CACHE_RESOURCES); + }) + .catch((error) => { + console.error('Error during cache installation:', error); + }) + ); }); // Activate event handler -self.addEventListener("activate", (event) => { - event.waitUntil( - caches.keys().then((cacheNames) => { - return Promise.all( - cacheNames.map((cacheName) => { - if (cacheName !== CACHE_NAME) { - console.log("Removing outdated cache:", cacheName); - return caches.delete(cacheName); - } - }) - ); +self.addEventListener('activate', (event) => { + event.waitUntil( + caches.keys().then((cacheNames) => { + return Promise.all( + cacheNames.map((cacheName) => { + if (cacheName !== CACHE_NAME) { + console.log('Removing outdated cache:', cacheName); + return caches.delete(cacheName); + } }) - ); + ); + }) + ); }); // Fetch event handler with cache-first strategy @@ -87,10 +91,10 @@ self.addEventListener("fetch", (event) => { }); // Message event handler for debugging -self.addEventListener("message", (event) => { - if (event.data === "skipWaiting") { - self.skipWaiting(); - } +self.addEventListener('message', (event) => { + if (event.data === 'skipWaiting') { + self.skipWaiting(); + } }); // Push notification handler diff --git a/src/css/style.css b/src/css/style.css index 0a44efa..33c4c94 100644 --- a/src/css/style.css +++ b/src/css/style.css @@ -71,6 +71,9 @@ body.dark header.bg-white { /* Navigation links within the header */ header .nav-link { + color: var( + --color-header-text + ); /* Ensure nav links get the header text color */ color: #000 !important; } diff --git a/src/models/User.js b/src/models/User.js index 92dce20..7c0b363 100644 --- a/src/models/User.js +++ b/src/models/User.js @@ -15,6 +15,7 @@ const UserSchema = new mongoose.Schema({ unique: true, trim: true, lowercase: true, + match: [/.+\@.+\..+/, 'Please fill a valid email address'], match: [/.+@.+\..+/, 'Please fill a valid email address'], }, // Store the hashed password