first version

This commit is contained in:
2026-10-07 15:53:12 +02:00
commit 9d8c2a0488
14 changed files with 1481 additions and 0 deletions
+39
View File
@@ -0,0 +1,39 @@
// browser.storage.local wrapper with defaults
var Store = (() => {
const DEFAULT_SETTINGS = {
kimaiUrl: '',
authMode: 'bearer', // bearer (Kimai >= 2.x API token) | legacy (X-AUTH-USER / X-AUTH-TOKEN)
kimaiUser: '',
kimaiToken: '',
defaultProject: null,
defaultActivity: null,
defaultProjectLabel: '',
defaultActivityLabel: '',
defaultDescription: '',
tags: 'abacus-sync',
dayStart: '08:00',
skipIfRulePresent: true,
parse: {
rowSelector: 'tr, [role="row"]',
timeMode: 'auto',
durationIndex: 0,
sameDateRows: 'sum',
year: '',
},
};
async function get() {
const s = await browser.storage.local.get(['settings', 'rules', 'daysText', 'extractInfo', 'catalog']);
return {
settings: { ...DEFAULT_SETTINGS, ...(s.settings || {}), parse: { ...DEFAULT_SETTINGS.parse, ...(s.settings?.parse || {}) } },
rules: s.rules || [],
daysText: s.daysText || '',
extractInfo: s.extractInfo || null,
catalog: s.catalog || { projects: [], activities: [], fetchedAt: null },
};
}
const set = (obj) => browser.storage.local.set(obj);
return { get, set, DEFAULT_SETTINGS };
})();