4sp-max-dv 1.0.7 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,9 +4,9 @@
4
4
  <meta charset="UTF-8">
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
6
  <title>4SP MAX - VERSION 5 CLIENT</title>
7
- <link rel="icon" type="image/png" href="https://cdn.jsdelivr.net/npm/4sp-max-dv@1.0.7/images/logo.png">
7
+ <link rel="icon" type="image/png" href="https://cdn.jsdelivr.net/npm/4sp-max-dv@1.1.1/images/logo.png">
8
8
 
9
- <base href="https://cdn.jsdelivr.net/npm/4sp-max-dv@1.0.7/logged-in/">
9
+ <base href="https://cdn.jsdelivr.net/npm/4sp-max-dv@1.1.1/logged-in/">
10
10
  <script src="https://cdn.tailwindcss.com"></script>
11
11
  <link href="https://fonts.googleapis.com/css2?family=Geist:wght@100..900&display=swap" rel="stylesheet">
12
12
 
@@ -930,12 +930,12 @@
930
930
  const displayUsername = document.getElementById('display-username');
931
931
  const displayEmail = document.getElementById('display-email');
932
932
 
933
- const BASE_URL = 'https://cdn.jsdelivr.net/npm/4sp-max-dv@1.0.7/logged-in/';
933
+ const BASE_URL = 'https://cdn.jsdelivr.net/npm/4sp-max-dv@1.1.1/logged-in/';
934
934
 
935
935
  // Preload Logos
936
936
  const preloadImgs = [
937
- 'https://cdn.jsdelivr.net/npm/4sp-max-dv@1.0.7/images/logo-dark.png',
938
- 'https://cdn.jsdelivr.net/npm/4sp-max-dv@1.0.7/images/logo-christmas.png',
937
+ 'https://cdn.jsdelivr.net/npm/4sp-max-dv@1.1.1/images/logo-dark.png',
938
+ 'https://cdn.jsdelivr.net/npm/4sp-max-dv@1.1.1/images/logo-christmas.png',
939
939
  'https://cdn.jsdelivr.net/npm/4sp-asset-library@latest/logo.png'
940
940
  ];
941
941
  preloadImgs.forEach(src => new Image().src = src);
@@ -1666,13 +1666,6 @@
1666
1666
 
1667
1667
  // Determine start page
1668
1668
  let startPage = 'dashboard.html';
1669
- const lastPage = localStorage.getItem(LAST_PAGE_KEY);
1670
-
1671
- // Priority: Last Page > > Default
1672
- if (lastPage) {
1673
- const isValid = Object.values(CLIENT_PAGE_DATA).some(p => p.url === lastPage);
1674
- if (isValid) startPage = lastPage;
1675
- }
1676
1669
 
1677
1670
  loadPage(startPage);
1678
1671
 
@@ -2379,7 +2372,7 @@
2379
2372
 
2380
2373
  async function loadThemes() {
2381
2374
  try {
2382
- const res = await fetch('https://cdn.jsdelivr.net/npm/4sp-max-dv@1.0.7/themes.json');
2375
+ const res = await fetch('https://cdn.jsdelivr.net/npm/4sp-max-dv@1.1.1/themes.json');
2383
2376
  if (!res.ok) return;
2384
2377
  let themes = await res.json();
2385
2378
 
package/injector.js CHANGED
@@ -12,7 +12,6 @@
12
12
  // 1. DEFINE YOUR SCRIPTS HERE
13
13
  // Update this array (and ONLY this array) to manage your application's scripts.
14
14
  const scriptsToLoad = [
15
- '../ban-enforcer.js',
16
15
  '../tab-disguiser.js',
17
16
  '../panic-key.js',
18
17
  '../analytics.js',
@@ -1360,9 +1360,17 @@ async function cleanText(text) {
1360
1360
  // --- AUTH & INIT ---
1361
1361
  onAuthStateChanged(auth, async (user) => {
1362
1362
  if (!user) {
1363
- await signInAnonymously(auth);
1363
+ try {
1364
+ await signInAnonymously(auth);
1365
+ } catch (err) {
1366
+ console.error("Auth error:", err);
1367
+ }
1364
1368
  return;
1365
1369
  }
1370
+
1371
+ // Re-assign user object to ensure it's globally available if needed
1372
+ // although this local scope variable 'user' is used in initApp context
1373
+ const activeUser = user;
1366
1374
 
1367
1375
  if (window.showLoader) window.showLoader("Dailyphoto");
1368
1376
 
@@ -709,11 +709,10 @@ body:not(.no-animations) .btn-toolbar-style:active, body:not(.no-animations) .bt
709
709
 
710
710
  waitForFirebase(() => {
711
711
  if (window.hideLoader) window.hideLoader();
712
+ window._LOCAL_MODE = true;
712
713
  if (firebase.auth) {
713
714
  firebase.auth().onAuthStateChanged((user) => {
714
- if (!user && !window._LOCAL_MODE) {
715
- window.location.replace(redirectPath);
716
- }
715
+ // Redirect logic bypassed via window._LOCAL_MODE
717
716
  });
718
717
  }
719
718
  });
@@ -13,7 +13,6 @@
13
13
 
14
14
  <script src="https://cdn.tailwindcss.com"></script>
15
15
  <script src="../navigation.js"></script>
16
- <script src="../ban-enforcer.js"></script>
17
16
 
18
17
 
19
18
  <script async src="https://www.googletagmanager.com/gtag/js?id=G-1D4F692C1Q"></script>
@@ -4226,28 +4226,12 @@ const performAccountDeletion = async (credential) => {
4226
4226
 
4227
4227
 
4228
4228
 
4229
- function initializeAuth() {
4230
- onAuthStateChanged(auth, async (user) => {
4231
- if (!user) {
4232
- // No user is logged in, redirect to authentication.html (path corrected)
4233
- window.location.href = '../authentication.html';
4234
- } else {
4235
- currentUser = user;
4236
-
4237
- // --- MODIFIED: Mandatory Admin Status Check ---
4238
- // We MUST await this check before proceeding to load tabs that might require admin privileges.
4239
- // This prevents "Missing or insufficient permissions" errors due to race conditions.
4240
- isUserAdmin = await checkAdminStatus(user.uid);
4241
-
4242
- if (isUserAdmin) {
4243
- const adminTab = document.getElementById('tab-management');
4244
- if (adminTab) adminTab.classList.remove('hidden');
4245
- }
4246
-
4247
- // Set initial state to 'General' (or the first tab)
4248
- switchTab('general');
4249
- }
4250
- });
4229
+ async function initializeAuth() {
4230
+ currentUser = { uid: 'anonymous', email: 'anonymous@4sp.local', displayName: 'User' };
4231
+ isUserAdmin = true; // Enable management tab for DV version
4232
+ const adminTab = document.getElementById('tab-management');
4233
+ if (adminTab) adminTab.classList.remove('hidden');
4234
+ switchTab('general');
4251
4235
  }
4252
4236
 
4253
4237
  // Use a short timeout to allow the rest of the script to run before auth check
@@ -60,24 +60,7 @@
60
60
  const auth = getAuth(app);
61
61
 
62
62
  const pageContent = document.getElementById('page-content');
63
-
64
- onAuthStateChanged(auth, async (user) => {
65
- if (user) {
66
- if (window.showLoader) window.showLoader("Velium");
67
- // User is signed in, check admin status
68
- const isAdmin = await checkAdminStatus(user.uid);
69
- if (isAdmin) {
70
- if (window.hideLoader) window.hideLoader();
71
- pageContent.style.display = 'flex'; // Show content for admins
72
- } else {
73
- // Not an admin, redirect to dashboard
74
- window.location.href = '../logged-in/dashboard.html';
75
- }
76
- } else {
77
- // User is signed out, redirect to authentication page
78
- window.location.href = '../authentication.html';
79
- }
80
- });
63
+ pageContent.style.display = 'flex';
81
64
  </script>
82
65
  </body>
83
66
  </html>
@@ -60,15 +60,7 @@
60
60
  const auth = getAuth(app);
61
61
 
62
62
  const pageContent = document.getElementById('page-content');
63
-
64
- onAuthStateChanged(auth, async (user) => {
65
- if (user) {
66
- pageContent.style.display = 'flex'; // Show content for everyone logged in
67
- } else {
68
- // User is signed out, redirect to authentication page
69
- window.location.href = '../authentication.html';
70
- }
71
- });
63
+ pageContent.style.display = 'flex';
72
64
  </script>
73
65
  </body>
74
66
  </html>
package/navigation.js CHANGED
@@ -1583,15 +1583,6 @@ let db;
1583
1583
  if (!authCheckCompleted) {
1584
1584
  authCheckCompleted = true;
1585
1585
  }
1586
-
1587
- // Only redirect if auth check is completed, user is logged out, and we are not already redirecting
1588
- if (authCheckCompleted && !user && !isRedirecting) {
1589
- const targetUrl = '../index.html';
1590
-
1591
- console.log(`User logged out. Restricting access and redirecting to ${targetUrl}`);
1592
- isRedirecting = true; // Set flag to prevent multiple redirects
1593
- window.location.href = targetUrl;
1594
- }
1595
1586
  });
1596
1587
  };
1597
1588
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "4sp-max-dv",
3
- "version": "1.0.7",
3
+ "version": "1.1.1",
4
4
  "main": "admin_keybinds.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"