Merge pull request #2 from ChrisChrome/copilot/change-static-pages-html-usage

Serve static pages without .html extensions via index.html subfolders
This commit is contained in:
Christopher Cookman 2026-07-02 09:10:27 -06:00 committed by GitHub
commit aa76a65f2d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 9 additions and 9 deletions

View file

@ -5,8 +5,8 @@
<title>NOTXCS</title> <title>NOTXCS</title>
<script> <script>
fetch('/auth/me').then(r => r.json()).then(data => { fetch('/auth/me').then(r => r.json()).then(data => {
window.location.replace(data.success ? '/dashboard.html' : '/login.html'); window.location.replace(data.success ? '/dashboard' : '/login');
}).catch(() => window.location.replace('/login.html')); }).catch(() => window.location.replace('/login'));
</script> </script>
</head> </head>
<body> <body>

View file

@ -9,7 +9,7 @@ async function api(path, options = {}) {
}); });
const data = await res.json().catch(() => ({ success: false, message: 'Invalid response from server' })); const data = await res.json().catch(() => ({ success: false, message: 'Invalid response from server' }));
if (res.status === 401) { if (res.status === 401) {
window.location.href = '/login.html'; window.location.href = '/login';
throw new Error('Not authenticated'); throw new Error('Not authenticated');
} }
return data; return data;
@ -18,7 +18,7 @@ async function api(path, options = {}) {
async function init() { async function init() {
const me = await api('/auth/me'); const me = await api('/auth/me');
if (!me.success) { if (!me.success) {
window.location.href = '/login.html'; window.location.href = '/login';
return; return;
} }
document.getElementById('username-display').textContent = me.user.username; document.getElementById('username-display').textContent = me.user.username;
@ -188,7 +188,7 @@ document.getElementById('delete-place-btn').addEventListener('click', async () =
document.getElementById('logout-btn').addEventListener('click', async () => { document.getElementById('logout-btn').addEventListener('click', async () => {
await api('/auth/logout', { method: 'POST' }); await api('/auth/logout', { method: 'POST' });
window.location.href = '/login.html'; window.location.href = '/login';
}); });
// --- ACL (allowed persons / credentials) management --- // --- ACL (allowed persons / credentials) management ---

View file

@ -20,7 +20,7 @@ document.getElementById('login-form').addEventListener('submit', async (e) => {
return; return;
} }
window.location.href = '/dashboard.html'; window.location.href = '/dashboard';
} catch (err) { } catch (err) {
errorEl.textContent = 'Unable to reach the server. Please try again.'; errorEl.textContent = 'Unable to reach the server. Please try again.';
errorEl.classList.add('visible'); errorEl.classList.add('visible');

View file

@ -20,7 +20,7 @@ document.getElementById('register-form').addEventListener('submit', async (e) =>
return; return;
} }
window.location.href = '/dashboard.html'; window.location.href = '/dashboard';
} catch (err) { } catch (err) {
errorEl.textContent = 'Unable to reach the server. Please try again.'; errorEl.textContent = 'Unable to reach the server. Please try again.';
errorEl.classList.add('visible'); errorEl.classList.add('visible');

View file

@ -21,7 +21,7 @@
<button type="submit" class="primary">Log in</button> <button type="submit" class="primary">Log in</button>
</form> </form>
<p class="switch-link">Don't have an account? <a href="/register.html">Register</a></p> <p class="switch-link">Don't have an account? <a href="/register">Register</a></p>
</div> </div>
</div> </div>
<script src="/js/login.js"></script> <script src="/js/login.js"></script>

View file

@ -21,7 +21,7 @@
<button type="submit" class="primary">Register</button> <button type="submit" class="primary">Register</button>
</form> </form>
<p class="switch-link">Already have an account? <a href="/login.html">Log in</a></p> <p class="switch-link">Already have an account? <a href="/login">Log in</a></p>
</div> </div>
</div> </div>
<script src="/js/register.js"></script> <script src="/js/register.js"></script>