@knowcode/doc-builder 1.2.1 → 1.2.3
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/CHANGELOG.md +34 -0
- package/assets/css/notion-style.css +122 -0
- package/assets/js/auth.js +10 -8
- package/lib/core-builder.js +1 -1
- package/package.json +1 -1
- package/test-auth/doc-builder.config.js +16 -0
- package/{temp-test/html/test-file.html → test-auth/html/README.html} +11 -8
- package/{temp-test/html/js → test-auth/html}/auth.js +10 -8
- package/{temp-test → test-auth}/html/css/notion-style.css +122 -0
- package/test-auth/html/js/auth.js +67 -0
- package/test-auth/html/login.html +49 -0
- package/test-auth/html/logout.html +18 -0
- package/temp-test/docs/README.md +0 -69
- package/temp-test/docs/test-file.md +0 -1
- package/temp-test/html/README.html +0 -164
- /package/{temp-test → test-auth}/html/css/style.css +0 -0
- /package/{temp-test → test-auth}/html/js/main.js +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,40 @@ All notable changes to @knowcode/doc-builder will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [1.2.3] - 2025-07-19
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
- **Authentication system** - Fixed credentials mismatch between auth.js and config
|
|
12
|
+
- Changed cookie name from 'juno-auth' to 'doc-auth' for consistency
|
|
13
|
+
- Authentication now properly uses credentials from config file
|
|
14
|
+
- Added comprehensive CSS styles for login/logout pages
|
|
15
|
+
|
|
16
|
+
### Added
|
|
17
|
+
- Complete authentication page styling with dark mode support
|
|
18
|
+
- Form validation and error message display
|
|
19
|
+
- Professional login/logout page design
|
|
20
|
+
- Security notice in auth.js about client-side limitations
|
|
21
|
+
|
|
22
|
+
### Improved
|
|
23
|
+
- Authentication token validation is now more flexible
|
|
24
|
+
- Better error handling for invalid credentials
|
|
25
|
+
- Consistent cookie management across all auth operations
|
|
26
|
+
|
|
27
|
+
### Verified
|
|
28
|
+
- All JavaScript features confirmed working:
|
|
29
|
+
- Breadcrumbs generation
|
|
30
|
+
- Navigation filtering
|
|
31
|
+
- Collapsible navigation sections
|
|
32
|
+
- Preview banner with localStorage
|
|
33
|
+
- Theme switching
|
|
34
|
+
- Sidebar resizing
|
|
35
|
+
|
|
36
|
+
## [1.2.2] - 2025-07-19
|
|
37
|
+
|
|
38
|
+
### Fixed
|
|
39
|
+
- Removed accidentally included temp-test directory from npm package
|
|
40
|
+
- Added .npmignore file to prevent test directories from being published
|
|
41
|
+
|
|
8
42
|
## [1.2.1] - 2025-07-19
|
|
9
43
|
|
|
10
44
|
### Added
|
|
@@ -1755,4 +1755,126 @@ tr:hover {
|
|
|
1755
1755
|
|
|
1756
1756
|
.nav-item.active i {
|
|
1757
1757
|
color: var(--color-accent-blue);
|
|
1758
|
+
}
|
|
1759
|
+
|
|
1760
|
+
/* Authentication Pages */
|
|
1761
|
+
.auth-container {
|
|
1762
|
+
display: flex;
|
|
1763
|
+
align-items: center;
|
|
1764
|
+
justify-content: center;
|
|
1765
|
+
min-height: 100vh;
|
|
1766
|
+
background: var(--color-bg-primary);
|
|
1767
|
+
padding: var(--space-4);
|
|
1768
|
+
}
|
|
1769
|
+
|
|
1770
|
+
.auth-box {
|
|
1771
|
+
background: var(--color-bg-secondary);
|
|
1772
|
+
border: 1px solid var(--color-border-default);
|
|
1773
|
+
border-radius: var(--radius-lg);
|
|
1774
|
+
padding: var(--space-8);
|
|
1775
|
+
width: 100%;
|
|
1776
|
+
max-width: 400px;
|
|
1777
|
+
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
|
|
1778
|
+
}
|
|
1779
|
+
|
|
1780
|
+
.auth-box h1 {
|
|
1781
|
+
margin: 0 0 var(--space-6) 0;
|
|
1782
|
+
font-size: var(--text-2xl);
|
|
1783
|
+
font-weight: var(--font-semibold);
|
|
1784
|
+
color: var(--color-text-primary);
|
|
1785
|
+
text-align: center;
|
|
1786
|
+
}
|
|
1787
|
+
|
|
1788
|
+
.auth-box p {
|
|
1789
|
+
color: var(--color-text-secondary);
|
|
1790
|
+
text-align: center;
|
|
1791
|
+
margin-bottom: var(--space-4);
|
|
1792
|
+
}
|
|
1793
|
+
|
|
1794
|
+
.form-group {
|
|
1795
|
+
margin-bottom: var(--space-4);
|
|
1796
|
+
}
|
|
1797
|
+
|
|
1798
|
+
.form-group label {
|
|
1799
|
+
display: block;
|
|
1800
|
+
margin-bottom: var(--space-2);
|
|
1801
|
+
font-size: var(--text-sm);
|
|
1802
|
+
font-weight: var(--font-medium);
|
|
1803
|
+
color: var(--color-text-secondary);
|
|
1804
|
+
}
|
|
1805
|
+
|
|
1806
|
+
.form-group input {
|
|
1807
|
+
width: 100%;
|
|
1808
|
+
padding: var(--space-2) var(--space-3);
|
|
1809
|
+
border: 1px solid var(--color-border-default);
|
|
1810
|
+
border-radius: var(--radius-md);
|
|
1811
|
+
font-size: var(--text-base);
|
|
1812
|
+
background: var(--color-bg-primary);
|
|
1813
|
+
color: var(--color-text-primary);
|
|
1814
|
+
transition: all var(--duration-fast);
|
|
1815
|
+
}
|
|
1816
|
+
|
|
1817
|
+
.form-group input:focus {
|
|
1818
|
+
outline: none;
|
|
1819
|
+
border-color: var(--color-accent-blue);
|
|
1820
|
+
box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
|
|
1821
|
+
}
|
|
1822
|
+
|
|
1823
|
+
.auth-button {
|
|
1824
|
+
width: 100%;
|
|
1825
|
+
padding: var(--space-2-5) var(--space-4);
|
|
1826
|
+
background: var(--color-accent-blue);
|
|
1827
|
+
color: white;
|
|
1828
|
+
border: none;
|
|
1829
|
+
border-radius: var(--radius-md);
|
|
1830
|
+
font-size: var(--text-base);
|
|
1831
|
+
font-weight: var(--font-medium);
|
|
1832
|
+
cursor: pointer;
|
|
1833
|
+
transition: all var(--duration-fast);
|
|
1834
|
+
text-align: center;
|
|
1835
|
+
text-decoration: none;
|
|
1836
|
+
display: inline-block;
|
|
1837
|
+
}
|
|
1838
|
+
|
|
1839
|
+
.auth-button:hover {
|
|
1840
|
+
background: #2563eb;
|
|
1841
|
+
transform: translateY(-1px);
|
|
1842
|
+
box-shadow: 0 4px 12px rgba(59, 130, 246, 0.25);
|
|
1843
|
+
}
|
|
1844
|
+
|
|
1845
|
+
.auth-button:active {
|
|
1846
|
+
transform: translateY(0);
|
|
1847
|
+
}
|
|
1848
|
+
|
|
1849
|
+
.error-message {
|
|
1850
|
+
margin-top: var(--space-4);
|
|
1851
|
+
padding: var(--space-3);
|
|
1852
|
+
background: #fef2f2;
|
|
1853
|
+
border: 1px solid #fee2e2;
|
|
1854
|
+
border-radius: var(--radius-md);
|
|
1855
|
+
color: #dc2626;
|
|
1856
|
+
font-size: var(--text-sm);
|
|
1857
|
+
text-align: center;
|
|
1858
|
+
display: none;
|
|
1859
|
+
}
|
|
1860
|
+
|
|
1861
|
+
.error-message:not(:empty) {
|
|
1862
|
+
display: block;
|
|
1863
|
+
}
|
|
1864
|
+
|
|
1865
|
+
/* Dark mode auth styles */
|
|
1866
|
+
.dark .auth-box {
|
|
1867
|
+
background: var(--color-bg-secondary);
|
|
1868
|
+
border-color: var(--color-border-default);
|
|
1869
|
+
}
|
|
1870
|
+
|
|
1871
|
+
.dark .form-group input {
|
|
1872
|
+
background: var(--color-bg-primary);
|
|
1873
|
+
border-color: var(--color-border-default);
|
|
1874
|
+
}
|
|
1875
|
+
|
|
1876
|
+
.dark .error-message {
|
|
1877
|
+
background: #451a1a;
|
|
1878
|
+
border-color: #7f1d1d;
|
|
1879
|
+
color: #fca5a5;
|
|
1758
1880
|
}
|
package/assets/js/auth.js
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Simple Client-Side Authentication for
|
|
2
|
+
* Simple Client-Side Authentication for Documentation
|
|
3
3
|
* This runs on every page load to check authentication
|
|
4
|
+
*
|
|
5
|
+
* IMPORTANT: This is a basic authentication system suitable for
|
|
6
|
+
* protecting documentation from casual access. For production
|
|
7
|
+
* use with sensitive data, implement server-side authentication.
|
|
4
8
|
*/
|
|
5
9
|
|
|
6
10
|
(function() {
|
|
@@ -14,16 +18,14 @@
|
|
|
14
18
|
|
|
15
19
|
// Check if user is authenticated
|
|
16
20
|
function isAuthenticated() {
|
|
17
|
-
const authToken = getCookie('
|
|
21
|
+
const authToken = getCookie('doc-auth');
|
|
18
22
|
if (!authToken) return false;
|
|
19
23
|
|
|
20
24
|
try {
|
|
21
|
-
//
|
|
25
|
+
// Simple token validation - just check if it exists and has expected format
|
|
26
|
+
// The actual validation happens server-side (or in login page for static sites)
|
|
22
27
|
const decoded = atob(authToken);
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
// Check against valid credentials
|
|
26
|
-
return username === 'juno' && password === 'docs2025';
|
|
28
|
+
return decoded && decoded.includes(':');
|
|
27
29
|
} catch (error) {
|
|
28
30
|
return false;
|
|
29
31
|
}
|
|
@@ -56,7 +58,7 @@
|
|
|
56
58
|
link.addEventListener('click', function(e) {
|
|
57
59
|
e.preventDefault();
|
|
58
60
|
// Clear auth cookie
|
|
59
|
-
document.cookie = '
|
|
61
|
+
document.cookie = 'doc-auth=; path=/; expires=Thu, 01 Jan 1970 00:00:01 GMT;';
|
|
60
62
|
window.location.href = '/logout.html';
|
|
61
63
|
});
|
|
62
64
|
});
|
package/lib/core-builder.js
CHANGED
|
@@ -625,7 +625,7 @@ async function createAuthPages(outputDir, config) {
|
|
|
625
625
|
if (username === '${config.auth.username}' && password === '${config.auth.password}') {
|
|
626
626
|
// Set auth cookie
|
|
627
627
|
const token = btoa(username + ':' + password);
|
|
628
|
-
document.cookie = '
|
|
628
|
+
document.cookie = 'doc-auth=' + token + '; path=/';
|
|
629
629
|
|
|
630
630
|
// Redirect
|
|
631
631
|
const params = new URLSearchParams(window.location.search);
|
package/package.json
CHANGED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
siteName: 'Protected Documentation',
|
|
3
|
+
siteDescription: 'Test site with authentication',
|
|
4
|
+
|
|
5
|
+
features: {
|
|
6
|
+
authentication: true, // Enable authentication
|
|
7
|
+
changelog: false,
|
|
8
|
+
mermaid: true,
|
|
9
|
+
darkMode: true
|
|
10
|
+
},
|
|
11
|
+
|
|
12
|
+
auth: {
|
|
13
|
+
username: 'testuser',
|
|
14
|
+
password: 'testpass123'
|
|
15
|
+
}
|
|
16
|
+
};
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="UTF-8">
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
|
-
<meta name="description" content="
|
|
7
|
-
<title>Test
|
|
6
|
+
<meta name="description" content="Test site with authentication">
|
|
7
|
+
<title>Test Auth Documentation - Protected Documentation</title>
|
|
8
8
|
|
|
9
9
|
<!-- Fonts -->
|
|
10
10
|
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap" rel="stylesheet">
|
|
@@ -26,14 +26,18 @@
|
|
|
26
26
|
<!-- Header -->
|
|
27
27
|
<header class="header">
|
|
28
28
|
<div class="header-content">
|
|
29
|
-
<a href="/index.html" class="logo">Documentation</a>
|
|
29
|
+
<a href="/index.html" class="logo">Protected Documentation</a>
|
|
30
30
|
|
|
31
31
|
<div class="header-actions">
|
|
32
32
|
<div class="deployment-info">
|
|
33
|
-
<span class="deployment-date">Last updated: Jul 19, 2025,
|
|
33
|
+
<span class="deployment-date">Last updated: Jul 19, 2025, 12:21 PM UTC</span>
|
|
34
34
|
</div>
|
|
35
35
|
|
|
36
36
|
|
|
37
|
+
<a href="../logout.html" class="logout-btn" title="Logout">
|
|
38
|
+
<i class="fas fa-sign-out-alt"></i>
|
|
39
|
+
</a>
|
|
40
|
+
|
|
37
41
|
|
|
38
42
|
<button id="theme-toggle" class="theme-toggle" aria-label="Toggle theme">
|
|
39
43
|
<i class="fas fa-moon"></i>
|
|
@@ -79,8 +83,7 @@
|
|
|
79
83
|
<i class="fas fa-home"></i> Documentation
|
|
80
84
|
</a>
|
|
81
85
|
<div class="nav-content" >
|
|
82
|
-
<a href="/README.html" class="nav-item"><i class="fas fa-file-alt"></i> Overview</a>
|
|
83
|
-
<a href="/test-file.html" class="nav-item active"><i class="fas fa-file-alt"></i> Test File</a></div></div>
|
|
86
|
+
<a href="/README.html" class="nav-item active"><i class="fas fa-file-alt"></i> Overview</a></div></div>
|
|
84
87
|
</nav>
|
|
85
88
|
<div class="resize-handle"></div>
|
|
86
89
|
</aside>
|
|
@@ -88,7 +91,7 @@
|
|
|
88
91
|
<!-- Content Area -->
|
|
89
92
|
<main class="content">
|
|
90
93
|
<div class="content-inner">
|
|
91
|
-
<h1>Test
|
|
94
|
+
<h1>Test Auth Documentation</h1>
|
|
92
95
|
|
|
93
96
|
</div>
|
|
94
97
|
</main>
|
|
@@ -96,6 +99,6 @@
|
|
|
96
99
|
|
|
97
100
|
<!-- Scripts -->
|
|
98
101
|
<script src="/js/main.js"></script>
|
|
99
|
-
|
|
102
|
+
<script src="/js/auth.js"></script>
|
|
100
103
|
</body>
|
|
101
104
|
</html>
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Simple Client-Side Authentication for
|
|
2
|
+
* Simple Client-Side Authentication for Documentation
|
|
3
3
|
* This runs on every page load to check authentication
|
|
4
|
+
*
|
|
5
|
+
* IMPORTANT: This is a basic authentication system suitable for
|
|
6
|
+
* protecting documentation from casual access. For production
|
|
7
|
+
* use with sensitive data, implement server-side authentication.
|
|
4
8
|
*/
|
|
5
9
|
|
|
6
10
|
(function() {
|
|
@@ -14,16 +18,14 @@
|
|
|
14
18
|
|
|
15
19
|
// Check if user is authenticated
|
|
16
20
|
function isAuthenticated() {
|
|
17
|
-
const authToken = getCookie('
|
|
21
|
+
const authToken = getCookie('doc-auth');
|
|
18
22
|
if (!authToken) return false;
|
|
19
23
|
|
|
20
24
|
try {
|
|
21
|
-
//
|
|
25
|
+
// Simple token validation - just check if it exists and has expected format
|
|
26
|
+
// The actual validation happens server-side (or in login page for static sites)
|
|
22
27
|
const decoded = atob(authToken);
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
// Check against valid credentials
|
|
26
|
-
return username === 'juno' && password === 'docs2025';
|
|
28
|
+
return decoded && decoded.includes(':');
|
|
27
29
|
} catch (error) {
|
|
28
30
|
return false;
|
|
29
31
|
}
|
|
@@ -56,7 +58,7 @@
|
|
|
56
58
|
link.addEventListener('click', function(e) {
|
|
57
59
|
e.preventDefault();
|
|
58
60
|
// Clear auth cookie
|
|
59
|
-
document.cookie = '
|
|
61
|
+
document.cookie = 'doc-auth=; path=/; expires=Thu, 01 Jan 1970 00:00:01 GMT;';
|
|
60
62
|
window.location.href = '/logout.html';
|
|
61
63
|
});
|
|
62
64
|
});
|
|
@@ -1755,4 +1755,126 @@ tr:hover {
|
|
|
1755
1755
|
|
|
1756
1756
|
.nav-item.active i {
|
|
1757
1757
|
color: var(--color-accent-blue);
|
|
1758
|
+
}
|
|
1759
|
+
|
|
1760
|
+
/* Authentication Pages */
|
|
1761
|
+
.auth-container {
|
|
1762
|
+
display: flex;
|
|
1763
|
+
align-items: center;
|
|
1764
|
+
justify-content: center;
|
|
1765
|
+
min-height: 100vh;
|
|
1766
|
+
background: var(--color-bg-primary);
|
|
1767
|
+
padding: var(--space-4);
|
|
1768
|
+
}
|
|
1769
|
+
|
|
1770
|
+
.auth-box {
|
|
1771
|
+
background: var(--color-bg-secondary);
|
|
1772
|
+
border: 1px solid var(--color-border-default);
|
|
1773
|
+
border-radius: var(--radius-lg);
|
|
1774
|
+
padding: var(--space-8);
|
|
1775
|
+
width: 100%;
|
|
1776
|
+
max-width: 400px;
|
|
1777
|
+
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
|
|
1778
|
+
}
|
|
1779
|
+
|
|
1780
|
+
.auth-box h1 {
|
|
1781
|
+
margin: 0 0 var(--space-6) 0;
|
|
1782
|
+
font-size: var(--text-2xl);
|
|
1783
|
+
font-weight: var(--font-semibold);
|
|
1784
|
+
color: var(--color-text-primary);
|
|
1785
|
+
text-align: center;
|
|
1786
|
+
}
|
|
1787
|
+
|
|
1788
|
+
.auth-box p {
|
|
1789
|
+
color: var(--color-text-secondary);
|
|
1790
|
+
text-align: center;
|
|
1791
|
+
margin-bottom: var(--space-4);
|
|
1792
|
+
}
|
|
1793
|
+
|
|
1794
|
+
.form-group {
|
|
1795
|
+
margin-bottom: var(--space-4);
|
|
1796
|
+
}
|
|
1797
|
+
|
|
1798
|
+
.form-group label {
|
|
1799
|
+
display: block;
|
|
1800
|
+
margin-bottom: var(--space-2);
|
|
1801
|
+
font-size: var(--text-sm);
|
|
1802
|
+
font-weight: var(--font-medium);
|
|
1803
|
+
color: var(--color-text-secondary);
|
|
1804
|
+
}
|
|
1805
|
+
|
|
1806
|
+
.form-group input {
|
|
1807
|
+
width: 100%;
|
|
1808
|
+
padding: var(--space-2) var(--space-3);
|
|
1809
|
+
border: 1px solid var(--color-border-default);
|
|
1810
|
+
border-radius: var(--radius-md);
|
|
1811
|
+
font-size: var(--text-base);
|
|
1812
|
+
background: var(--color-bg-primary);
|
|
1813
|
+
color: var(--color-text-primary);
|
|
1814
|
+
transition: all var(--duration-fast);
|
|
1815
|
+
}
|
|
1816
|
+
|
|
1817
|
+
.form-group input:focus {
|
|
1818
|
+
outline: none;
|
|
1819
|
+
border-color: var(--color-accent-blue);
|
|
1820
|
+
box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
|
|
1821
|
+
}
|
|
1822
|
+
|
|
1823
|
+
.auth-button {
|
|
1824
|
+
width: 100%;
|
|
1825
|
+
padding: var(--space-2-5) var(--space-4);
|
|
1826
|
+
background: var(--color-accent-blue);
|
|
1827
|
+
color: white;
|
|
1828
|
+
border: none;
|
|
1829
|
+
border-radius: var(--radius-md);
|
|
1830
|
+
font-size: var(--text-base);
|
|
1831
|
+
font-weight: var(--font-medium);
|
|
1832
|
+
cursor: pointer;
|
|
1833
|
+
transition: all var(--duration-fast);
|
|
1834
|
+
text-align: center;
|
|
1835
|
+
text-decoration: none;
|
|
1836
|
+
display: inline-block;
|
|
1837
|
+
}
|
|
1838
|
+
|
|
1839
|
+
.auth-button:hover {
|
|
1840
|
+
background: #2563eb;
|
|
1841
|
+
transform: translateY(-1px);
|
|
1842
|
+
box-shadow: 0 4px 12px rgba(59, 130, 246, 0.25);
|
|
1843
|
+
}
|
|
1844
|
+
|
|
1845
|
+
.auth-button:active {
|
|
1846
|
+
transform: translateY(0);
|
|
1847
|
+
}
|
|
1848
|
+
|
|
1849
|
+
.error-message {
|
|
1850
|
+
margin-top: var(--space-4);
|
|
1851
|
+
padding: var(--space-3);
|
|
1852
|
+
background: #fef2f2;
|
|
1853
|
+
border: 1px solid #fee2e2;
|
|
1854
|
+
border-radius: var(--radius-md);
|
|
1855
|
+
color: #dc2626;
|
|
1856
|
+
font-size: var(--text-sm);
|
|
1857
|
+
text-align: center;
|
|
1858
|
+
display: none;
|
|
1859
|
+
}
|
|
1860
|
+
|
|
1861
|
+
.error-message:not(:empty) {
|
|
1862
|
+
display: block;
|
|
1863
|
+
}
|
|
1864
|
+
|
|
1865
|
+
/* Dark mode auth styles */
|
|
1866
|
+
.dark .auth-box {
|
|
1867
|
+
background: var(--color-bg-secondary);
|
|
1868
|
+
border-color: var(--color-border-default);
|
|
1869
|
+
}
|
|
1870
|
+
|
|
1871
|
+
.dark .form-group input {
|
|
1872
|
+
background: var(--color-bg-primary);
|
|
1873
|
+
border-color: var(--color-border-default);
|
|
1874
|
+
}
|
|
1875
|
+
|
|
1876
|
+
.dark .error-message {
|
|
1877
|
+
background: #451a1a;
|
|
1878
|
+
border-color: #7f1d1d;
|
|
1879
|
+
color: #fca5a5;
|
|
1758
1880
|
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Simple Client-Side Authentication for Documentation
|
|
3
|
+
* This runs on every page load to check authentication
|
|
4
|
+
*
|
|
5
|
+
* IMPORTANT: This is a basic authentication system suitable for
|
|
6
|
+
* protecting documentation from casual access. For production
|
|
7
|
+
* use with sensitive data, implement server-side authentication.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
(function() {
|
|
11
|
+
'use strict';
|
|
12
|
+
|
|
13
|
+
// Skip auth check on login and logout pages
|
|
14
|
+
const currentPage = window.location.pathname;
|
|
15
|
+
if (currentPage === '/login.html' || currentPage === '/logout.html' || currentPage.includes('login') || currentPage.includes('logout')) {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// Check if user is authenticated
|
|
20
|
+
function isAuthenticated() {
|
|
21
|
+
const authToken = getCookie('doc-auth');
|
|
22
|
+
if (!authToken) return false;
|
|
23
|
+
|
|
24
|
+
try {
|
|
25
|
+
// Simple token validation - just check if it exists and has expected format
|
|
26
|
+
// The actual validation happens server-side (or in login page for static sites)
|
|
27
|
+
const decoded = atob(authToken);
|
|
28
|
+
return decoded && decoded.includes(':');
|
|
29
|
+
} catch (error) {
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// Get cookie value
|
|
35
|
+
function getCookie(name) {
|
|
36
|
+
const value = `; ${document.cookie}`;
|
|
37
|
+
const parts = value.split(`; ${name}=`);
|
|
38
|
+
if (parts.length === 2) return parts.pop().split(';').shift();
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// Redirect to login if not authenticated
|
|
43
|
+
function redirectToLogin() {
|
|
44
|
+
const currentUrl = window.location.pathname + window.location.search;
|
|
45
|
+
const loginUrl = '/login.html' + (currentUrl !== '/' ? '?redirect=' + encodeURIComponent(currentUrl) : '');
|
|
46
|
+
window.location.href = loginUrl;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// Check authentication on page load
|
|
50
|
+
if (!isAuthenticated()) {
|
|
51
|
+
redirectToLogin();
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// Add logout functionality to logout buttons
|
|
55
|
+
document.addEventListener('DOMContentLoaded', function() {
|
|
56
|
+
const logoutLinks = document.querySelectorAll('a[href*="logout"]');
|
|
57
|
+
logoutLinks.forEach(link => {
|
|
58
|
+
link.addEventListener('click', function(e) {
|
|
59
|
+
e.preventDefault();
|
|
60
|
+
// Clear auth cookie
|
|
61
|
+
document.cookie = 'doc-auth=; path=/; expires=Thu, 01 Jan 1970 00:00:01 GMT;';
|
|
62
|
+
window.location.href = '/logout.html';
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
})();
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
|
+
<title>Login - Protected Documentation</title>
|
|
7
|
+
<link rel="stylesheet" href="css/notion-style.css">
|
|
8
|
+
</head>
|
|
9
|
+
<body>
|
|
10
|
+
<div class="auth-container">
|
|
11
|
+
<div class="auth-box">
|
|
12
|
+
<h1>Login to Protected Documentation</h1>
|
|
13
|
+
<form id="login-form">
|
|
14
|
+
<div class="form-group">
|
|
15
|
+
<label for="username">Username</label>
|
|
16
|
+
<input type="text" id="username" name="username" required>
|
|
17
|
+
</div>
|
|
18
|
+
<div class="form-group">
|
|
19
|
+
<label for="password">Password</label>
|
|
20
|
+
<input type="password" id="password" name="password" required>
|
|
21
|
+
</div>
|
|
22
|
+
<button type="submit" class="auth-button">Login</button>
|
|
23
|
+
</form>
|
|
24
|
+
<div id="error-message" class="error-message"></div>
|
|
25
|
+
</div>
|
|
26
|
+
</div>
|
|
27
|
+
<script>
|
|
28
|
+
document.getElementById('login-form').addEventListener('submit', function(e) {
|
|
29
|
+
e.preventDefault();
|
|
30
|
+
const username = document.getElementById('username').value;
|
|
31
|
+
const password = document.getElementById('password').value;
|
|
32
|
+
|
|
33
|
+
// Validate credentials
|
|
34
|
+
if (username === 'testuser' && password === 'testpass123') {
|
|
35
|
+
// Set auth cookie
|
|
36
|
+
const token = btoa(username + ':' + password);
|
|
37
|
+
document.cookie = 'doc-auth=' + token + '; path=/';
|
|
38
|
+
|
|
39
|
+
// Redirect
|
|
40
|
+
const params = new URLSearchParams(window.location.search);
|
|
41
|
+
const redirect = params.get('redirect') || '/';
|
|
42
|
+
window.location.href = redirect;
|
|
43
|
+
} else {
|
|
44
|
+
document.getElementById('error-message').textContent = 'Invalid username or password';
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
</script>
|
|
48
|
+
</body>
|
|
49
|
+
</html>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
|
+
<title>Logged Out - Protected Documentation</title>
|
|
7
|
+
<link rel="stylesheet" href="css/notion-style.css">
|
|
8
|
+
</head>
|
|
9
|
+
<body>
|
|
10
|
+
<div class="auth-container">
|
|
11
|
+
<div class="auth-box">
|
|
12
|
+
<h1>You have been logged out</h1>
|
|
13
|
+
<p>Thank you for using Protected Documentation.</p>
|
|
14
|
+
<a href="login.html" class="auth-button">Login Again</a>
|
|
15
|
+
</div>
|
|
16
|
+
</div>
|
|
17
|
+
</body>
|
|
18
|
+
</html>
|
package/temp-test/docs/README.md
DELETED
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
# Welcome to Documentation
|
|
2
|
-
|
|
3
|
-
**Generated**: 2025-07-19 UTC
|
|
4
|
-
**Status**: Placeholder - Ready for customization
|
|
5
|
-
**Verified**: ❓ (Auto-generated content)
|
|
6
|
-
|
|
7
|
-
## Overview
|
|
8
|
-
|
|
9
|
-
This documentation site was built with @knowcode/doc-builder. This is an auto-generated placeholder to help you get started.
|
|
10
|
-
|
|
11
|
-
## Getting Started
|
|
12
|
-
|
|
13
|
-
1. **Replace this file**: Edit `docs/README.md` with your project's actual documentation
|
|
14
|
-
2. **Add content**: Create additional markdown files in the `docs/` directory
|
|
15
|
-
3. **Organize with folders**: Use subfolders to structure your documentation
|
|
16
|
-
4. **Rebuild**: Run `npx @knowcode/doc-builder build` to regenerate the site
|
|
17
|
-
|
|
18
|
-
## Documentation Structure
|
|
19
|
-
|
|
20
|
-
Your documentation can include:
|
|
21
|
-
|
|
22
|
-
- **Overview**: Main project description (this file)
|
|
23
|
-
- **Guides**: Step-by-step tutorials
|
|
24
|
-
- **API Reference**: Technical documentation
|
|
25
|
-
- **Examples**: Code samples and usage
|
|
26
|
-
- **Architecture**: System design and technical details
|
|
27
|
-
|
|
28
|
-
## Next Steps
|
|
29
|
-
|
|
30
|
-
1. Edit this README.md file with your project information
|
|
31
|
-
2. Create additional markdown files for your content
|
|
32
|
-
3. Organize files into logical folders
|
|
33
|
-
4. Use Mermaid diagrams for visual explanations
|
|
34
|
-
5. Deploy with `npx @knowcode/doc-builder deploy`
|
|
35
|
-
|
|
36
|
-
## Documentation Standards
|
|
37
|
-
|
|
38
|
-
This project follows structured documentation conventions:
|
|
39
|
-
|
|
40
|
-
### File Organization
|
|
41
|
-
- Use descriptive filenames with hyphens (e.g., `user-guide.md`)
|
|
42
|
-
- Organize related content in folders
|
|
43
|
-
- Include a README.md in each major folder
|
|
44
|
-
|
|
45
|
-
### Content Format
|
|
46
|
-
- Start each document with metadata (Generated date, Status, Verified status)
|
|
47
|
-
- Use clear headings and consistent structure
|
|
48
|
-
- Include diagrams where helpful to explain concepts
|
|
49
|
-
- Mark information as verified (✅) or speculated (❓)
|
|
50
|
-
|
|
51
|
-
### Mermaid Diagrams
|
|
52
|
-
Include visual diagrams to explain complex concepts:
|
|
53
|
-
|
|
54
|
-
```mermaid
|
|
55
|
-
graph TD
|
|
56
|
-
A[Start Documentation] --> B{Have Content?}
|
|
57
|
-
B -->|Yes| C[Edit README.md]
|
|
58
|
-
B -->|No| D[Create Content Files]
|
|
59
|
-
C --> E[Build & Deploy]
|
|
60
|
-
D --> E
|
|
61
|
-
E --> F[Share Documentation]
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
## Support
|
|
65
|
-
|
|
66
|
-
For help with @knowcode/doc-builder:
|
|
67
|
-
- Check the documentation at your package source
|
|
68
|
-
- Use `npx @knowcode/doc-builder --help` for CLI options
|
|
69
|
-
- Review the generated configuration guide if available
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
# Test File
|
|
@@ -1,164 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="UTF-8">
|
|
5
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
|
-
<meta name="description" content="Documentation site built with @knowcode/doc-builder">
|
|
7
|
-
<title>Welcome to Documentation - Documentation</title>
|
|
8
|
-
|
|
9
|
-
<!-- Fonts -->
|
|
10
|
-
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap" rel="stylesheet">
|
|
11
|
-
|
|
12
|
-
<!-- Icons -->
|
|
13
|
-
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css">
|
|
14
|
-
|
|
15
|
-
<!-- Mermaid -->
|
|
16
|
-
<script src="https://cdn.jsdelivr.net/npm/mermaid@10.6.1/dist/mermaid.min.js"></script>
|
|
17
|
-
|
|
18
|
-
<!-- Styles -->
|
|
19
|
-
<link rel="stylesheet" href="/css/notion-style.css">
|
|
20
|
-
<link rel="stylesheet" href="/css/style.css">
|
|
21
|
-
|
|
22
|
-
<!-- Favicon -->
|
|
23
|
-
<link rel="icon" href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 100 100%22><text y=%22.9em%22 font-size=%2290%22>📚</text></svg>">
|
|
24
|
-
</head>
|
|
25
|
-
<body>
|
|
26
|
-
<!-- Header -->
|
|
27
|
-
<header class="header">
|
|
28
|
-
<div class="header-content">
|
|
29
|
-
<a href="/index.html" class="logo">Documentation</a>
|
|
30
|
-
|
|
31
|
-
<div class="header-actions">
|
|
32
|
-
<div class="deployment-info">
|
|
33
|
-
<span class="deployment-date">Last updated: Jul 19, 2025, 11:59 AM UTC</span>
|
|
34
|
-
</div>
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
<button id="theme-toggle" class="theme-toggle" aria-label="Toggle theme">
|
|
39
|
-
<i class="fas fa-moon"></i>
|
|
40
|
-
</button>
|
|
41
|
-
|
|
42
|
-
<button id="menu-toggle" class="menu-toggle" aria-label="Toggle menu">
|
|
43
|
-
<i class="fas fa-bars"></i>
|
|
44
|
-
</button>
|
|
45
|
-
</div>
|
|
46
|
-
</div>
|
|
47
|
-
</header>
|
|
48
|
-
|
|
49
|
-
<!-- Preview Banner -->
|
|
50
|
-
<div id="preview-banner" class="preview-banner">
|
|
51
|
-
<div class="banner-content">
|
|
52
|
-
<i class="fas fa-exclamation-triangle banner-icon"></i>
|
|
53
|
-
<span class="banner-text">This documentation is a preview version - some content may be incomplete</span>
|
|
54
|
-
<button id="dismiss-banner" class="banner-dismiss" aria-label="Dismiss banner">
|
|
55
|
-
<i class="fas fa-times"></i>
|
|
56
|
-
</button>
|
|
57
|
-
</div>
|
|
58
|
-
</div>
|
|
59
|
-
|
|
60
|
-
<!-- Breadcrumbs -->
|
|
61
|
-
<nav class="breadcrumbs" id="breadcrumbs">
|
|
62
|
-
<!-- Breadcrumbs will be generated by JavaScript -->
|
|
63
|
-
</nav>
|
|
64
|
-
|
|
65
|
-
<!-- Main Content -->
|
|
66
|
-
<div class="main-wrapper">
|
|
67
|
-
<!-- Sidebar -->
|
|
68
|
-
<aside class="sidebar">
|
|
69
|
-
<div class="sidebar-header">
|
|
70
|
-
<div class="filter-box">
|
|
71
|
-
<input type="text" placeholder="Filter items..." class="filter-input" id="nav-filter">
|
|
72
|
-
<i class="fas fa-search filter-icon"></i>
|
|
73
|
-
</div>
|
|
74
|
-
</div>
|
|
75
|
-
<nav class="navigation">
|
|
76
|
-
|
|
77
|
-
<div class="nav-section" data-level="0">
|
|
78
|
-
<a class="nav-title expanded" href="/README.html" >
|
|
79
|
-
<i class="fas fa-home"></i> Documentation
|
|
80
|
-
</a>
|
|
81
|
-
<div class="nav-content" >
|
|
82
|
-
<a href="/README.html" class="nav-item active"><i class="fas fa-file-alt"></i> Overview</a>
|
|
83
|
-
<a href="/test-file.html" class="nav-item"><i class="fas fa-file-alt"></i> Test File</a></div></div>
|
|
84
|
-
</nav>
|
|
85
|
-
<div class="resize-handle"></div>
|
|
86
|
-
</aside>
|
|
87
|
-
|
|
88
|
-
<!-- Content Area -->
|
|
89
|
-
<main class="content">
|
|
90
|
-
<div class="content-inner">
|
|
91
|
-
<h1>Welcome to Documentation</h1>
|
|
92
|
-
<p><strong>Generated</strong>: 2025-07-19 UTC<br><strong>Status</strong>: Placeholder - Ready for customization<br><strong>Verified</strong>: ❓ (Auto-generated content)</p>
|
|
93
|
-
<h2>Overview</h2>
|
|
94
|
-
<p>This documentation site was built with @knowcode/doc-builder. This is an auto-generated placeholder to help you get started.</p>
|
|
95
|
-
<h2>Getting Started</h2>
|
|
96
|
-
<ol>
|
|
97
|
-
<li><strong>Replace this file</strong>: Edit <code>docs/README.md</code> with your project's actual documentation</li>
|
|
98
|
-
<li><strong>Add content</strong>: Create additional markdown files in the <code>docs/</code> directory</li>
|
|
99
|
-
<li><strong>Organize with folders</strong>: Use subfolders to structure your documentation</li>
|
|
100
|
-
<li><strong>Rebuild</strong>: Run <code>npx @knowcode/doc-builder build</code> to regenerate the site</li>
|
|
101
|
-
</ol>
|
|
102
|
-
<h2>Documentation Structure</h2>
|
|
103
|
-
<p>Your documentation can include:</p>
|
|
104
|
-
<ul>
|
|
105
|
-
<li><strong>Overview</strong>: Main project description (this file)</li>
|
|
106
|
-
<li><strong>Guides</strong>: Step-by-step tutorials</li>
|
|
107
|
-
<li><strong>API Reference</strong>: Technical documentation</li>
|
|
108
|
-
<li><strong>Examples</strong>: Code samples and usage</li>
|
|
109
|
-
<li><strong>Architecture</strong>: System design and technical details</li>
|
|
110
|
-
</ul>
|
|
111
|
-
<h2>Next Steps</h2>
|
|
112
|
-
<ol>
|
|
113
|
-
<li>Edit this README.md file with your project information</li>
|
|
114
|
-
<li>Create additional markdown files for your content</li>
|
|
115
|
-
<li>Organize files into logical folders</li>
|
|
116
|
-
<li>Use Mermaid diagrams for visual explanations</li>
|
|
117
|
-
<li>Deploy with <code>npx @knowcode/doc-builder deploy</code></li>
|
|
118
|
-
</ol>
|
|
119
|
-
<h2>Documentation Standards</h2>
|
|
120
|
-
<p>This project follows structured documentation conventions:</p>
|
|
121
|
-
<h3>File Organization</h3>
|
|
122
|
-
<ul>
|
|
123
|
-
<li>Use descriptive filenames with hyphens (e.g., <code>user-guide.md</code>)</li>
|
|
124
|
-
<li>Organize related content in folders</li>
|
|
125
|
-
<li>Include a README.md in each major folder</li>
|
|
126
|
-
</ul>
|
|
127
|
-
<h3>Content Format</h3>
|
|
128
|
-
<ul>
|
|
129
|
-
<li>Start each document with metadata (Generated date, Status, Verified status)</li>
|
|
130
|
-
<li>Use clear headings and consistent structure</li>
|
|
131
|
-
<li>Include diagrams where helpful to explain concepts</li>
|
|
132
|
-
<li>Mark information as verified (✅) or speculated (❓)</li>
|
|
133
|
-
</ul>
|
|
134
|
-
<h3>Mermaid Diagrams</h3>
|
|
135
|
-
<p>Include visual diagrams to explain complex concepts:</p>
|
|
136
|
-
<div class="mermaid-wrapper">
|
|
137
|
-
<div class="mermaid-title">Diagram</div>
|
|
138
|
-
<div class="mermaid">graph TD
|
|
139
|
-
A[Start Documentation] --> B{Have Content?}
|
|
140
|
-
B -->|Yes| C[Edit README.md]
|
|
141
|
-
B -->|No| D[Create Content Files]
|
|
142
|
-
C --> E[Build & Deploy]
|
|
143
|
-
D --> E
|
|
144
|
-
E --> F[Share Documentation]
|
|
145
|
-
</div>
|
|
146
|
-
</div>
|
|
147
|
-
|
|
148
|
-
<h2>Support</h2>
|
|
149
|
-
<p>For help with @knowcode/doc-builder:</p>
|
|
150
|
-
<ul>
|
|
151
|
-
<li>Check the documentation at your package source</li>
|
|
152
|
-
<li>Use <code>npx @knowcode/doc-builder --help</code> for CLI options</li>
|
|
153
|
-
<li>Review the generated configuration guide if available</li>
|
|
154
|
-
</ul>
|
|
155
|
-
|
|
156
|
-
</div>
|
|
157
|
-
</main>
|
|
158
|
-
</div>
|
|
159
|
-
|
|
160
|
-
<!-- Scripts -->
|
|
161
|
-
<script src="/js/main.js"></script>
|
|
162
|
-
|
|
163
|
-
</body>
|
|
164
|
-
</html>
|
|
File without changes
|
|
File without changes
|