Merge remote-tracking branch 'origin/main' into copilot/add-user-perm-levels

This commit is contained in:
copilot-swe-agent[bot] 2026-07-02 15:12:08 +00:00 committed by GitHub
commit 4ee90f46ee
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 12 additions and 9 deletions

3
README.md Normal file
View file

@ -0,0 +1,3 @@
Made by a clanker. It's just a stupid project not made for public use, but im making it public anyways.
Recreated the API for https://xcs.restrafes.co/ and had Copilot make the frontend cause i suck at frontend.

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

@ -18,7 +18,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;
@ -27,7 +27,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;
} }
currentUser = me.user; currentUser = me.user;
@ -209,7 +209,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>