@knowcode/doc-builder 1.9.7 → 1.9.9
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.
package/doc-builder.config.js
CHANGED
|
@@ -1,17 +1,42 @@
|
|
|
1
1
|
module.exports = {
|
|
2
|
-
"configVersion": "1.9.
|
|
3
|
-
"siteName": "@knowcode/doc-builder",
|
|
4
|
-
"siteDescription": "Beautiful documentation with the least effort possible",
|
|
2
|
+
"configVersion": "1.9.8",
|
|
5
3
|
"docsDir": "docs",
|
|
6
4
|
"outputDir": "html",
|
|
7
|
-
"
|
|
5
|
+
"siteName": "@knowcode/doc-builder",
|
|
6
|
+
"siteDescription": "Beautiful documentation with the least effort possible",
|
|
7
|
+
"favicon": "✨",
|
|
8
8
|
"features": {
|
|
9
9
|
"authentication": false,
|
|
10
10
|
"changelog": true,
|
|
11
11
|
"mermaid": true,
|
|
12
|
+
"tooltips": true,
|
|
13
|
+
"search": false,
|
|
12
14
|
"darkMode": true,
|
|
13
15
|
"phosphorIcons": true,
|
|
14
|
-
"
|
|
16
|
+
"phosphorWeight": "regular",
|
|
17
|
+
"phosphorSize": "1.2em",
|
|
18
|
+
"normalizeTitle": true,
|
|
19
|
+
"showPdfDownload": true,
|
|
20
|
+
"menuDefaultOpen": false,
|
|
21
|
+
"attachments": true,
|
|
22
|
+
"dynamicNavIcons": true,
|
|
23
|
+
"subtleColors": true,
|
|
24
|
+
"privateDirectoryAuth": false
|
|
25
|
+
},
|
|
26
|
+
"auth": {
|
|
27
|
+
"supabaseUrl": "https://xcihhnfcitjrwbynxmka.supabase.co",
|
|
28
|
+
"supabaseAnonKey": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InhjaWhobmZjaXRqcndieW54bWthIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NTM0Mzc2MzcsImV4cCI6MjA2OTAxMzYzN30.zvWp3JFIR8fBIiwuFF5gqOR_Kxb42baZS5fsBz60XOY"
|
|
29
|
+
},
|
|
30
|
+
"changelog": {
|
|
31
|
+
"daysBack": 14,
|
|
32
|
+
"enabled": true
|
|
33
|
+
},
|
|
34
|
+
"folderOrder": [],
|
|
35
|
+
"folderDescriptions": {},
|
|
36
|
+
"folderIcons": {},
|
|
37
|
+
"deployment": {
|
|
38
|
+
"platform": "vercel",
|
|
39
|
+
"outputDirectory": "html"
|
|
15
40
|
},
|
|
16
41
|
"seo": {
|
|
17
42
|
"enabled": true,
|
|
@@ -26,13 +51,18 @@ module.exports = {
|
|
|
26
51
|
"vercel",
|
|
27
52
|
"notion-style"
|
|
28
53
|
],
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"
|
|
54
|
+
"titleTemplate": "{pageTitle} | {siteName}",
|
|
55
|
+
"autoKeywords": true,
|
|
56
|
+
"keywordLimit": 7,
|
|
57
|
+
"descriptionFallback": "smart",
|
|
32
58
|
"organization": {
|
|
33
59
|
"name": "Knowcode Ltd",
|
|
34
|
-
"url": "https://knowcode.tech"
|
|
60
|
+
"url": "https://knowcode.tech",
|
|
61
|
+
"logo": ""
|
|
35
62
|
},
|
|
63
|
+
"ogImage": "/og-default.png",
|
|
64
|
+
"generateSitemap": true,
|
|
65
|
+
"generateRobotsTxt": true,
|
|
36
66
|
"customMetaTags": [
|
|
37
67
|
{
|
|
38
68
|
"name": "google-site-verification",
|
|
@@ -43,5 +73,43 @@ module.exports = {
|
|
|
43
73
|
"content": "B2D8C4C12C530D47AA962B24CAA09630"
|
|
44
74
|
}
|
|
45
75
|
]
|
|
46
|
-
}
|
|
76
|
+
},
|
|
77
|
+
"attachmentTypes": [
|
|
78
|
+
".pdf",
|
|
79
|
+
".doc",
|
|
80
|
+
".docx",
|
|
81
|
+
".xls",
|
|
82
|
+
".xlsx",
|
|
83
|
+
".csv",
|
|
84
|
+
".ppt",
|
|
85
|
+
".pptx",
|
|
86
|
+
".txt",
|
|
87
|
+
".rtf",
|
|
88
|
+
".html",
|
|
89
|
+
".htm",
|
|
90
|
+
".zip",
|
|
91
|
+
".tar",
|
|
92
|
+
".gz",
|
|
93
|
+
".7z",
|
|
94
|
+
".rar",
|
|
95
|
+
".png",
|
|
96
|
+
".jpg",
|
|
97
|
+
".jpeg",
|
|
98
|
+
".gif",
|
|
99
|
+
".svg",
|
|
100
|
+
".webp",
|
|
101
|
+
".ico",
|
|
102
|
+
".bmp",
|
|
103
|
+
".json",
|
|
104
|
+
".xml",
|
|
105
|
+
".yaml",
|
|
106
|
+
".yml",
|
|
107
|
+
".toml",
|
|
108
|
+
".mp4",
|
|
109
|
+
".mp3",
|
|
110
|
+
".wav",
|
|
111
|
+
".avi",
|
|
112
|
+
".mov"
|
|
113
|
+
],
|
|
114
|
+
"productionUrl": "https://doc-builder-delta.vercel.app"
|
|
47
115
|
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
"configVersion": "1.9.6",
|
|
3
|
+
"siteName": "@knowcode/doc-builder",
|
|
4
|
+
"siteDescription": "Beautiful documentation with the least effort possible",
|
|
5
|
+
"docsDir": "docs",
|
|
6
|
+
"outputDir": "html",
|
|
7
|
+
"productionUrl": "https://doc-builder-delta.vercel.app",
|
|
8
|
+
"features": {
|
|
9
|
+
"authentication": false,
|
|
10
|
+
"changelog": true,
|
|
11
|
+
"mermaid": true,
|
|
12
|
+
"darkMode": true,
|
|
13
|
+
"phosphorIcons": true,
|
|
14
|
+
"menuDefaultOpen": false
|
|
15
|
+
},
|
|
16
|
+
"seo": {
|
|
17
|
+
"enabled": true,
|
|
18
|
+
"siteUrl": "https://doc-builder-delta.vercel.app",
|
|
19
|
+
"author": "Lindsay Smith",
|
|
20
|
+
"twitterHandle": "@planbbackups",
|
|
21
|
+
"language": "en-US",
|
|
22
|
+
"keywords": [
|
|
23
|
+
"documentation",
|
|
24
|
+
"markdown",
|
|
25
|
+
"static site generator",
|
|
26
|
+
"vercel",
|
|
27
|
+
"notion-style"
|
|
28
|
+
],
|
|
29
|
+
"generateSitemap": true,
|
|
30
|
+
"generateRobotsTxt": true,
|
|
31
|
+
"ogImage": "/og-default.png",
|
|
32
|
+
"organization": {
|
|
33
|
+
"name": "Knowcode Ltd",
|
|
34
|
+
"url": "https://knowcode.tech"
|
|
35
|
+
},
|
|
36
|
+
"customMetaTags": [
|
|
37
|
+
{
|
|
38
|
+
"name": "google-site-verification",
|
|
39
|
+
"content": "FtzcDTf5BQ9K5EfnGazQkgU2U4FiN3ITzM7gHwqUAqQ"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"name": "msvalidate.01",
|
|
43
|
+
"content": "B2D8C4C12C530D47AA962B24CAA09630"
|
|
44
|
+
}
|
|
45
|
+
]
|
|
46
|
+
}
|
|
47
|
+
};
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
"configVersion": "1.9.7",
|
|
3
|
+
"docsDir": "docs",
|
|
4
|
+
"outputDir": "html",
|
|
5
|
+
"siteName": "@knowcode/doc-builder",
|
|
6
|
+
"siteDescription": "Beautiful documentation with the least effort possible",
|
|
7
|
+
"favicon": "✨",
|
|
8
|
+
"features": {
|
|
9
|
+
"authentication": false,
|
|
10
|
+
"changelog": true,
|
|
11
|
+
"mermaid": true,
|
|
12
|
+
"tooltips": true,
|
|
13
|
+
"search": false,
|
|
14
|
+
"darkMode": true,
|
|
15
|
+
"phosphorIcons": true,
|
|
16
|
+
"phosphorWeight": "regular",
|
|
17
|
+
"phosphorSize": "1.2em",
|
|
18
|
+
"normalizeTitle": true,
|
|
19
|
+
"showPdfDownload": true,
|
|
20
|
+
"menuDefaultOpen": false,
|
|
21
|
+
"attachments": true,
|
|
22
|
+
"dynamicNavIcons": true,
|
|
23
|
+
"subtleColors": true
|
|
24
|
+
},
|
|
25
|
+
"auth": {
|
|
26
|
+
"supabaseUrl": "https://xcihhnfcitjrwbynxmka.supabase.co",
|
|
27
|
+
"supabaseAnonKey": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InhjaWhobmZjaXRqcndieW54bWthIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NTM0Mzc2MzcsImV4cCI6MjA2OTAxMzYzN30.zvWp3JFIR8fBIiwuFF5gqOR_Kxb42baZS5fsBz60XOY"
|
|
28
|
+
},
|
|
29
|
+
"changelog": {
|
|
30
|
+
"daysBack": 14,
|
|
31
|
+
"enabled": true
|
|
32
|
+
},
|
|
33
|
+
"folderOrder": [],
|
|
34
|
+
"folderDescriptions": {},
|
|
35
|
+
"folderIcons": {},
|
|
36
|
+
"deployment": {
|
|
37
|
+
"platform": "vercel",
|
|
38
|
+
"outputDirectory": "html"
|
|
39
|
+
},
|
|
40
|
+
"seo": {
|
|
41
|
+
"enabled": true,
|
|
42
|
+
"siteUrl": "https://doc-builder-delta.vercel.app",
|
|
43
|
+
"author": "Lindsay Smith",
|
|
44
|
+
"twitterHandle": "@planbbackups",
|
|
45
|
+
"language": "en-US",
|
|
46
|
+
"keywords": [
|
|
47
|
+
"documentation",
|
|
48
|
+
"markdown",
|
|
49
|
+
"static site generator",
|
|
50
|
+
"vercel",
|
|
51
|
+
"notion-style"
|
|
52
|
+
],
|
|
53
|
+
"titleTemplate": "{pageTitle} | {siteName}",
|
|
54
|
+
"autoKeywords": true,
|
|
55
|
+
"keywordLimit": 7,
|
|
56
|
+
"descriptionFallback": "smart",
|
|
57
|
+
"organization": {
|
|
58
|
+
"name": "Knowcode Ltd",
|
|
59
|
+
"url": "https://knowcode.tech",
|
|
60
|
+
"logo": ""
|
|
61
|
+
},
|
|
62
|
+
"ogImage": "/og-default.png",
|
|
63
|
+
"generateSitemap": true,
|
|
64
|
+
"generateRobotsTxt": true,
|
|
65
|
+
"customMetaTags": [
|
|
66
|
+
{
|
|
67
|
+
"name": "google-site-verification",
|
|
68
|
+
"content": "FtzcDTf5BQ9K5EfnGazQkgU2U4FiN3ITzM7gHwqUAqQ"
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
"name": "msvalidate.01",
|
|
72
|
+
"content": "B2D8C4C12C530D47AA962B24CAA09630"
|
|
73
|
+
}
|
|
74
|
+
]
|
|
75
|
+
},
|
|
76
|
+
"attachmentTypes": [
|
|
77
|
+
".pdf",
|
|
78
|
+
".doc",
|
|
79
|
+
".docx",
|
|
80
|
+
".xls",
|
|
81
|
+
".xlsx",
|
|
82
|
+
".csv",
|
|
83
|
+
".ppt",
|
|
84
|
+
".pptx",
|
|
85
|
+
".txt",
|
|
86
|
+
".rtf",
|
|
87
|
+
".html",
|
|
88
|
+
".htm",
|
|
89
|
+
".zip",
|
|
90
|
+
".tar",
|
|
91
|
+
".gz",
|
|
92
|
+
".7z",
|
|
93
|
+
".rar",
|
|
94
|
+
".png",
|
|
95
|
+
".jpg",
|
|
96
|
+
".jpeg",
|
|
97
|
+
".gif",
|
|
98
|
+
".svg",
|
|
99
|
+
".webp",
|
|
100
|
+
".ico",
|
|
101
|
+
".bmp",
|
|
102
|
+
".json",
|
|
103
|
+
".xml",
|
|
104
|
+
".yaml",
|
|
105
|
+
".yml",
|
|
106
|
+
".toml",
|
|
107
|
+
".mp4",
|
|
108
|
+
".mp3",
|
|
109
|
+
".wav",
|
|
110
|
+
".avi",
|
|
111
|
+
".mov"
|
|
112
|
+
],
|
|
113
|
+
"productionUrl": "https://doc-builder-delta.vercel.app"
|
|
114
|
+
};
|
package/lib/config.js
CHANGED
|
@@ -38,7 +38,8 @@ const defaultConfig = {
|
|
|
38
38
|
menuDefaultOpen: true, // Menu/sidebar open by default
|
|
39
39
|
attachments: true, // Copy attachments (Excel, PDF, etc.) to output
|
|
40
40
|
dynamicNavIcons: true, // Use status-based icons in navigation
|
|
41
|
-
subtleColors: true
|
|
41
|
+
subtleColors: true, // Apply subtle colors to status icons
|
|
42
|
+
privateDirectoryAuth: false // Enable auth for private directories only (auto-detected)
|
|
42
43
|
},
|
|
43
44
|
|
|
44
45
|
// Authentication - Supabase only (basic auth removed for security)
|
|
@@ -375,7 +376,10 @@ async function loadConfig(configPath, options = {}) {
|
|
|
375
376
|
console.warn(chalk.yellow(`Warning: Failed to load config file: ${error.message}`));
|
|
376
377
|
}
|
|
377
378
|
} else if (!options.preset && !options.legacy) {
|
|
378
|
-
console.log(chalk.gray('No config file found,
|
|
379
|
+
console.log(chalk.gray('No config file found, creating default config...'));
|
|
380
|
+
// Create default config file with all settings
|
|
381
|
+
await saveConfig(customConfigPath, config);
|
|
382
|
+
console.log(chalk.green(`✅ Created ${configPath} with default settings`));
|
|
379
383
|
}
|
|
380
384
|
|
|
381
385
|
// Apply CLI options (these override config file)
|
|
@@ -424,15 +428,19 @@ async function loadConfig(configPath, options = {}) {
|
|
|
424
428
|
}
|
|
425
429
|
// Don't throw error - let commands handle missing directories appropriately
|
|
426
430
|
} else {
|
|
427
|
-
// Check for private directory
|
|
431
|
+
// Check for private directory to inform user about authentication options
|
|
428
432
|
const privatePath = path.join(docsPath, 'private');
|
|
429
433
|
if (fs.existsSync(privatePath) && fs.statSync(privatePath).isDirectory()) {
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
434
|
+
if (config.features.authentication === 'supabase') {
|
|
435
|
+
console.log(chalk.blue('🔐 Found private directory - global Supabase authentication is enabled'));
|
|
436
|
+
console.log(chalk.yellow(' Note: Grant users access by adding domain to the docbuilder_access table'));
|
|
437
|
+
} else {
|
|
438
|
+
console.log(chalk.blue('🔐 Found private directory - will be protected with Supabase authentication'));
|
|
439
|
+
console.log(chalk.gray(' Public pages remain accessible, only /private/ pages require login'));
|
|
440
|
+
console.log(chalk.yellow(' Note: Grant users access by adding domain to the docbuilder_access table'));
|
|
441
|
+
// Set a flag to indicate private directory authentication is needed
|
|
442
|
+
config.features.privateDirectoryAuth = true;
|
|
443
|
+
}
|
|
436
444
|
}
|
|
437
445
|
}
|
|
438
446
|
|
package/lib/core-builder.js
CHANGED
|
@@ -452,7 +452,7 @@ ${seoTags}
|
|
|
452
452
|
<!-- Styles -->
|
|
453
453
|
<link rel="stylesheet" href="/css/notion-style.css">
|
|
454
454
|
|
|
455
|
-
${config.features?.authentication === 'supabase' ? `
|
|
455
|
+
${(config.features?.authentication === 'supabase' || config.features?.privateDirectoryAuth === true) ? `
|
|
456
456
|
<!-- Hide content until auth check -->
|
|
457
457
|
<style>
|
|
458
458
|
body {
|
|
@@ -510,7 +510,7 @@ ${seoTags}
|
|
|
510
510
|
})} UTC</span>
|
|
511
511
|
</div>
|
|
512
512
|
|
|
513
|
-
${config.features?.authentication === 'supabase' ? `
|
|
513
|
+
${(config.features?.authentication === 'supabase' || config.features?.privateDirectoryAuth === true) ? `
|
|
514
514
|
<a href="${relativePath}login.html" class="auth-btn" title="Login/Logout">
|
|
515
515
|
<i class="fas fa-sign-in-alt"></i>
|
|
516
516
|
</a>
|
|
@@ -578,7 +578,7 @@ ${seoTags}
|
|
|
578
578
|
};
|
|
579
579
|
</script>
|
|
580
580
|
<script src="/js/main.js"></script>
|
|
581
|
-
${config.features?.authentication === 'supabase' ? `<script src="https://unpkg.com/@supabase/supabase-js@2"></script>
|
|
581
|
+
${(config.features?.authentication === 'supabase' || config.features?.privateDirectoryAuth === true) ? `<script src="https://unpkg.com/@supabase/supabase-js@2"></script>
|
|
582
582
|
<script src="/js/auth.js"></script>` : ''}
|
|
583
583
|
</body>
|
|
584
584
|
</html>`;
|
|
@@ -609,8 +609,8 @@ const folderDescriptions = {
|
|
|
609
609
|
function buildNavigationStructure(files, currentFile, config = {}) {
|
|
610
610
|
const tree = { files: [], folders: {} };
|
|
611
611
|
|
|
612
|
-
// Check if authentication is enabled
|
|
613
|
-
const isAuthEnabled = config.features?.authentication === 'supabase';
|
|
612
|
+
// Check if authentication is enabled (either global or private directory)
|
|
613
|
+
const isAuthEnabled = config.features?.authentication === 'supabase' || config.features?.privateDirectoryAuth === true;
|
|
614
614
|
|
|
615
615
|
// Include all files in navigation - we'll use CSS to show/hide based on auth state
|
|
616
616
|
files.forEach(file => {
|
|
@@ -1014,8 +1014,8 @@ async function buildDocumentation(config) {
|
|
|
1014
1014
|
if (fs.existsSync(jsSource)) {
|
|
1015
1015
|
await fs.copy(jsSource, path.join(outputDir, 'js'), { overwrite: true });
|
|
1016
1016
|
|
|
1017
|
-
// Generate Supabase auth script if authentication is
|
|
1018
|
-
if (config.features?.authentication === 'supabase') {
|
|
1017
|
+
// Generate Supabase auth script if authentication is needed (global or private directory)
|
|
1018
|
+
if (config.features?.authentication === 'supabase' || config.features?.privateDirectoryAuth === true) {
|
|
1019
1019
|
await generateSupabaseAuthFiles(outputDir, config);
|
|
1020
1020
|
}
|
|
1021
1021
|
}
|
|
@@ -1155,7 +1155,7 @@ async function buildDocumentation(config) {
|
|
|
1155
1155
|
// Generate robots.txt if enabled
|
|
1156
1156
|
if (config.seo.generateRobotsTxt) {
|
|
1157
1157
|
await generateRobotsTxt(config.seo.siteUrl, outputDir, {
|
|
1158
|
-
hasAuthentication: config.features?.authentication === 'supabase'
|
|
1158
|
+
hasAuthentication: config.features?.authentication === 'supabase' || config.features?.privateDirectoryAuth === true
|
|
1159
1159
|
});
|
|
1160
1160
|
}
|
|
1161
1161
|
}
|
|
@@ -1326,7 +1326,7 @@ async function generateSupabaseAuthFiles(outputDir, config) {
|
|
|
1326
1326
|
const supabaseAuth = new SupabaseAuth(authConfig);
|
|
1327
1327
|
|
|
1328
1328
|
// Generate auth script and save to js/auth.js
|
|
1329
|
-
const authScript = supabaseAuth.generateAuthScript();
|
|
1329
|
+
const authScript = supabaseAuth.generateAuthScript(config);
|
|
1330
1330
|
await fs.writeFile(path.join(outputDir, 'js', 'auth.js'), authScript);
|
|
1331
1331
|
|
|
1332
1332
|
// Also copy to root for backward compatibility
|
package/lib/supabase-auth.js
CHANGED
|
@@ -26,7 +26,7 @@ class SupabaseAuth {
|
|
|
26
26
|
/**
|
|
27
27
|
* Generate client-side auth script for inclusion in HTML pages
|
|
28
28
|
*/
|
|
29
|
-
generateAuthScript() {
|
|
29
|
+
generateAuthScript(fullConfig) {
|
|
30
30
|
return `
|
|
31
31
|
/**
|
|
32
32
|
* Supabase Authentication for Documentation Site
|
|
@@ -56,6 +56,10 @@ class SupabaseAuth {
|
|
|
56
56
|
// Check authentication and site access
|
|
57
57
|
async function checkAuth() {
|
|
58
58
|
try {
|
|
59
|
+
// Check authentication mode
|
|
60
|
+
const isGlobalAuthEnabled = ${fullConfig.features?.authentication === 'supabase'};
|
|
61
|
+
const isPrivateDirectoryAuthEnabled = ${fullConfig.features?.privateDirectoryAuth === true};
|
|
62
|
+
|
|
59
63
|
// Check if current page is in private directory
|
|
60
64
|
const currentPath = window.location.pathname;
|
|
61
65
|
const isPrivatePage = currentPath.includes('/private/');
|
|
@@ -64,11 +68,11 @@ class SupabaseAuth {
|
|
|
64
68
|
const { data: { user }, error: userError } = await supabaseClient.auth.getUser();
|
|
65
69
|
|
|
66
70
|
if (userError || !user) {
|
|
67
|
-
//
|
|
68
|
-
if (isPrivatePage) {
|
|
71
|
+
// Redirect if global auth is enabled OR if we're on a private page with private auth enabled
|
|
72
|
+
if (isGlobalAuthEnabled || (isPrivateDirectoryAuthEnabled && isPrivatePage)) {
|
|
69
73
|
redirectToLogin();
|
|
70
74
|
} else {
|
|
71
|
-
// Public page
|
|
75
|
+
// Public page (no global auth and either no private auth or not on private page)
|
|
72
76
|
document.body.classList.add('authenticated'); // Use same class to show body
|
|
73
77
|
updateAuthButton(false);
|
|
74
78
|
}
|
|
@@ -84,7 +88,7 @@ class SupabaseAuth {
|
|
|
84
88
|
.single();
|
|
85
89
|
|
|
86
90
|
if (accessError || !access) {
|
|
87
|
-
if (isPrivatePage) {
|
|
91
|
+
if (isGlobalAuthEnabled || (isPrivateDirectoryAuthEnabled && isPrivatePage)) {
|
|
88
92
|
showAccessDenied();
|
|
89
93
|
} else {
|
|
90
94
|
// Public page, show it but don't grant private navigation access
|
|
@@ -94,15 +98,21 @@ class SupabaseAuth {
|
|
|
94
98
|
return;
|
|
95
99
|
}
|
|
96
100
|
|
|
97
|
-
// User is authenticated and has domain access - grant
|
|
101
|
+
// User is authenticated and has domain access - grant appropriate access
|
|
98
102
|
console.log('User authenticated and authorized');
|
|
99
103
|
document.body.classList.add('authenticated');
|
|
100
|
-
|
|
104
|
+
|
|
105
|
+
// Grant private navigation access if private directory auth is enabled
|
|
106
|
+
if (isPrivateDirectoryAuthEnabled || isGlobalAuthEnabled) {
|
|
107
|
+
document.body.classList.add('has-private-access');
|
|
108
|
+
}
|
|
109
|
+
|
|
101
110
|
updateAuthButton(true);
|
|
102
111
|
|
|
103
112
|
} catch (error) {
|
|
104
113
|
console.error('Auth check failed:', error);
|
|
105
|
-
|
|
114
|
+
const isPrivatePage = window.location.pathname.includes('/private/');
|
|
115
|
+
if (isGlobalAuthEnabled || (isPrivateDirectoryAuthEnabled && isPrivatePage)) {
|
|
106
116
|
redirectToLogin();
|
|
107
117
|
} else {
|
|
108
118
|
// Public page, show it anyway
|