Sync-Fix, Dateinamen mit Leerzeichen, E-Mail-Dropdown, Defaults-System
- Fix: Pull überschreibt lokale Vorlagen nicht mehr (Merge statt Replace) - Fix: toFilename behält Leerzeichen und Groß-/Kleinschreibung - E-Mail in Settings ist jetzt ein Dropdown mit TB-Identitäten - Optionale defaults.local.js für vorkonfigurierte Verbindungsdaten (.gitignored)
This commit is contained in:
@@ -1366,10 +1366,34 @@ document.getElementById('footer-save-button').addEventListener('click', async ()
|
||||
|
||||
// ── Sync Settings UI ──
|
||||
|
||||
async function populateEmailDropdown() {
|
||||
const select = document.getElementById('sync-author-email');
|
||||
const accounts = await browser.accounts.list();
|
||||
const emails = new Set();
|
||||
for (const account of accounts) {
|
||||
for (const identity of account.identities) {
|
||||
if (identity.email && !emails.has(identity.email)) {
|
||||
emails.add(identity.email);
|
||||
const opt = document.createElement('option');
|
||||
opt.value = identity.email;
|
||||
opt.textContent = identity.email;
|
||||
select.appendChild(opt);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async function loadSyncConfig() {
|
||||
try {
|
||||
const result = await browser.storage.local.get(SYNC_CONFIG_KEY);
|
||||
const config = result[SYNC_CONFIG_KEY];
|
||||
let config = result[SYNC_CONFIG_KEY];
|
||||
|
||||
// First launch: apply defaults from defaults.local.js if available
|
||||
if (!config && typeof DEFAULT_SYNC_CONFIG !== 'undefined') {
|
||||
config = { ...DEFAULT_SYNC_CONFIG };
|
||||
await browser.storage.local.set({ [SYNC_CONFIG_KEY]: config });
|
||||
}
|
||||
|
||||
if (config) {
|
||||
document.getElementById('sync-url').value = config.baseUrl || '';
|
||||
document.getElementById('sync-owner').value = config.owner || '';
|
||||
@@ -1640,6 +1664,7 @@ window.addEventListener('load', async () => {
|
||||
const templates = await getTemplates();
|
||||
renderTemplates(templates);
|
||||
updateTplSyncIndicator();
|
||||
await populateEmailDropdown();
|
||||
loadSyncConfig();
|
||||
await loadIdentities();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user