Versie 0.2.0

This commit is contained in:
Atreides Assets committed 2026-10-29 11:57:29 +01:00
commit e77d8fd373
495 files changed
+81026

No files matched your search

+50
View File
@@ -0,0 +1,50 @@
// Generated, do not edit. sha256:e2056779c9285b8b0c7aa5d702fc44b067694e358ed2b791b9b58447551ece12
import { licenseStatus } from './data/license-status.js';
import { getPref, setPref } from './data/preferences.js';
import { t } from './i18n/index.js';
let snapshot = null;
export async function loadLicense() {
snapshot = await licenseStatus();
return snapshot;
}
export function licenseSnapshot() { return snapshot; }
export function locked(feature) {
const f = snapshot?.features;
return f ? f[feature] === false : false;
}
export function limitFor(kind) {
const m = snapshot?.max;
return m && kind in m ? m[kind] : null;
}
export function counterText(kind, current) {
const max = limitFor(kind);
return max === null ? null : t('license.counter', { n: current, max });
}
const PREF_SCOPE = 'license';
const PREF_SEEN = 'seen';
export function licenseFingerprint(s) {
if (!s) return '';
const i = s.installed;
return [s.level, s.why, s.buyer ?? '', s.issued ?? '',
i ? `${i.majorFrom}-${i.majorTo}` : ''].join('|');
}
export async function markLicenseSeen() {
await setPref(PREF_SCOPE, PREF_SEEN, licenseFingerprint(snapshot));
}
export async function licenseChangedSinceSeen() {
if (!snapshot) return false;
const now = licenseFingerprint(snapshot);
const seen = await getPref(PREF_SCOPE, PREF_SEEN, null);
if (seen === null || seen === undefined) { await setPref(PREF_SCOPE, PREF_SEEN, now); return false; }
return seen !== now;
}