feat: implement internationalization for UI text, refactor localStorage keys, and add input validation for state setters.

This commit is contained in:
Kantine Wrapper
2026-03-11 10:14:59 +01:00
parent 00015007d8
commit 9fddf74eb2
19 changed files with 2142 additions and 475 deletions

View File

@@ -1,5 +1,15 @@
/**
* API header factories for the Bessa REST API and GitHub API.
* All fetch calls in the app route through these helpers to ensure
* consistent auth and versioning headers.
*/
import { API_BASE, GUEST_TOKEN, CLIENT_VERSION } from './constants.js';
/**
* Returns request headers for the Bessa REST API.
* @param {string|null} token - Auth token; falls back to GUEST_TOKEN if absent.
* @returns {Object} HTTP headers for fetch()
*/
export function apiHeaders(token) {
return {
'Authorization': `Token ${token || GUEST_TOKEN}`,
@@ -9,6 +19,11 @@ export function apiHeaders(token) {
};
}
/**
* Returns request headers for the GitHub REST API v3.
* Used for version checks and release listing.
* @returns {Object} HTTP headers for fetch()
*/
export function githubHeaders() {
return { 'Accept': 'application/vnd.github.v3+json' };
}