fix sonarqube findings
Sonarqube Scanner / Prepare environment (push) Successful in 7s
Sonarqube Scanner / Build and test (push) Successful in 20s
Sonarqube Scanner / SonarQube analysis (push) Successful in 52s
Sonarqube Scanner / Deploy to Server (push) Successful in 5s

This commit is contained in:
Florian Zumpe
2026-09-30 23:34:26 +02:00
parent 8f4664282b
commit 607e5450e1
6 changed files with 40 additions and 19 deletions
+14 -6
View File
@@ -33,6 +33,18 @@ globalThis.Wegwichtel ??= {};
}
}
function siteDescription(usage, quota, known) {
if (!known) return 'Der Browser meldet keine Speicherkapazität.';
const warning = usage / quota >= .9 ? ' Speicher fast voll.' : '';
return `Website-Speicher: ${format(usage)} von ${format(quota)} belegt (${Math.round(usage / quota * 100)} %). Etwa ${format(Math.max(0, quota - usage))} verfügbar.${warning}`;
}
function localDescription(local) {
if (local == null) return 'Local Storage ist nicht verfügbar.';
const warning = local >= LOCAL_REFERENCE * .9 ? ' Richtwert fast erreicht: Große Bilder können das Speichern verhindern.' : '';
return `Local Storage: ungefähr ${format(local)} belegt. Balken bezogen auf einen Richtwert von 5 MiB; die tatsächliche Grenze hängt vom Browser ab.${warning}`;
}
async function refresh() {
if (refreshTask) return refreshTask;
refreshTask = (async () => {
@@ -41,14 +53,10 @@ globalThis.Wegwichtel ??= {};
const usage = estimate?.usage;
const quota = estimate?.quota;
const known = Number.isFinite(usage) && Number.isFinite(quota) && quota > 0;
show('site', usage, known ? quota : null, known
? `Website-Speicher: ${format(usage)} von ${format(quota)} belegt (${Math.round(usage / quota * 100)} %). Etwa ${format(Math.max(0, quota - usage))} verfügbar.${usage / quota >= .9 ? ' Speicher fast voll.' : ''}`
: 'Der Browser meldet keine Speicherkapazität.');
show('site', usage, known ? quota : null, siteDescription(usage, quota, known));
let local = null;
try { local = localBytes(); } catch { /* Storage can be blocked by browser settings. */ }
show('local', local, local == null ? null : LOCAL_REFERENCE, local == null
? 'Local Storage ist nicht verfügbar.'
: `Local Storage: ungefähr ${format(local)} belegt. Balken bezogen auf einen Richtwert von 5 MiB; die tatsächliche Grenze hängt vom Browser ab.${local >= LOCAL_REFERENCE * .9 ? ' Richtwert fast erreicht: Große Bilder können das Speichern verhindern.' : ''}`);
show('local', local, local == null ? null : LOCAL_REFERENCE, localDescription(local));
for (const panel of document.querySelectorAll('[data-storage-usage]')) {
const warning = panel.querySelector('[data-storage-warning]');
if (warning) { warning.hidden = !lastError; warning.textContent = lastError; }