mirror of
https://github.com/ghostersk/gowebmail.git
synced 2026-08-05 09:45:55 +01:00
Generally Working app
This commit is contained in:
+18
-4
@@ -188,8 +188,15 @@ async function openEditAccount(id) {
|
||||
document.getElementById('edit-imap-port').value=r.imap_port||993;
|
||||
document.getElementById('edit-smtp-host').value=r.smtp_host||'';
|
||||
document.getElementById('edit-smtp-port').value=r.smtp_port||587;
|
||||
document.getElementById('edit-sync-mode').value=r.sync_mode||'days';
|
||||
document.getElementById('edit-sync-days').value=r.sync_days||30;
|
||||
// Restore sync mode select: map stored days/mode back to a preset option
|
||||
const sel = document.getElementById('edit-sync-mode');
|
||||
if (r.sync_mode==='all' || !r.sync_days) {
|
||||
sel.value='all';
|
||||
} else {
|
||||
const presetMap={30:'preset-30',90:'preset-90',180:'preset-180',365:'preset-365',730:'preset-730',1825:'preset-1825'};
|
||||
sel.value = presetMap[r.sync_days] || 'days';
|
||||
}
|
||||
toggleSyncDaysField();
|
||||
const errEl=document.getElementById('edit-last-error'), connEl=document.getElementById('edit-conn-result');
|
||||
connEl.style.display='none';
|
||||
@@ -237,7 +244,7 @@ async function unhideFolder(folderId) {
|
||||
function toggleSyncDaysField() {
|
||||
const mode=document.getElementById('edit-sync-mode')?.value;
|
||||
const row=document.getElementById('edit-sync-days-row');
|
||||
if (row) row.style.display=(mode==='all')?'none':'flex';
|
||||
if (row) row.style.display=(mode==='days')?'flex':'none';
|
||||
}
|
||||
|
||||
async function testEditConnection() {
|
||||
@@ -260,11 +267,18 @@ async function saveAccountEdit() {
|
||||
smtp_host:document.getElementById('edit-smtp-host').value.trim(),smtp_port:parseInt(document.getElementById('edit-smtp-port').value)||587};
|
||||
const pw=document.getElementById('edit-password').value;
|
||||
if (pw) body.password=pw;
|
||||
const modeVal = document.getElementById('edit-sync-mode').value;
|
||||
let syncMode='all', syncDays=0;
|
||||
if (modeVal==='days') {
|
||||
syncMode='days'; syncDays=parseInt(document.getElementById('edit-sync-days').value)||30;
|
||||
} else if (modeVal.startsWith('preset-')) {
|
||||
syncMode='days'; syncDays=parseInt(modeVal.replace('preset-',''));
|
||||
} // else 'all': syncMode='all', syncDays=0
|
||||
const [r1, r2] = await Promise.all([
|
||||
api('PUT','/accounts/'+id, body),
|
||||
api('PUT','/accounts/'+id+'/sync-settings',{
|
||||
sync_mode: document.getElementById('edit-sync-mode').value,
|
||||
sync_days: parseInt(document.getElementById('edit-sync-days').value)||30,
|
||||
sync_mode: syncMode,
|
||||
sync_days: syncDays,
|
||||
}),
|
||||
]);
|
||||
if (r1?.ok){toast('Account updated','success');closeModal('edit-account-modal');loadAccounts();}
|
||||
|
||||
+12
-6
@@ -234,14 +234,20 @@
|
||||
</div>
|
||||
<div class="settings-group-title" style="margin:16px 0 8px">Sync Settings</div>
|
||||
<div class="modal-field">
|
||||
<label>Import mode</label>
|
||||
<label>Email history to sync</label>
|
||||
<select id="edit-sync-mode" onchange="toggleSyncDaysField()" style="padding:8px 10px;background:var(--bg);border:1px solid var(--border);border-radius:6px;color:var(--text);font-size:13px;outline:none">
|
||||
<option value="days">Last N days</option>
|
||||
<option value="all">Full mailbox (all email)</option>
|
||||
<option value="preset-30">Last 1 month</option>
|
||||
<option value="preset-90">Last 3 months</option>
|
||||
<option value="preset-180">Last 6 months</option>
|
||||
<option value="preset-365">Last 1 year</option>
|
||||
<option value="preset-730">Last 2 years</option>
|
||||
<option value="preset-1825">Last 5 years</option>
|
||||
<option value="all" selected>All emails (full mailbox)</option>
|
||||
<option value="days">Custom (days)</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="modal-row" id="edit-sync-days-row">
|
||||
<div class="modal-field"><label>Days to fetch</label><input type="number" id="edit-sync-days" value="30" min="1" max="3650"></div>
|
||||
<div class="modal-row" id="edit-sync-days-row" style="display:none">
|
||||
<div class="modal-field"><label>Custom days to fetch</label><input type="number" id="edit-sync-days" value="30" min="1" max="36500"></div>
|
||||
</div>
|
||||
<div id="edit-conn-result" class="test-result" style="display:none"></div>
|
||||
<div id="edit-last-error" style="display:none" class="alert error"></div>
|
||||
@@ -302,5 +308,5 @@
|
||||
{{end}}
|
||||
|
||||
{{define "scripts"}}
|
||||
<script src="/static/js/app.js?v=10"></script>
|
||||
<script src="/static/js/app.js?v=11"></script>
|
||||
{{end}}
|
||||
|
||||
@@ -5,12 +5,12 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>{{block "title" .}}GoMail{{end}}</title>
|
||||
<link href="https://fonts.googleapis.com/css2?family=DM+Serif+Display&family=DM+Sans:ital,wght@0,300;0,400;0,500;1,400&display=swap" rel="stylesheet">
|
||||
<link rel="stylesheet" href="/static/css/gomail.css?v=10">
|
||||
<link rel="stylesheet" href="/static/css/gomail.css?v=11">
|
||||
{{block "head_extra" .}}{{end}}
|
||||
</head>
|
||||
<body class="{{block "body_class" .}}{{end}}">
|
||||
{{block "body" .}}{{end}}
|
||||
<script src="/static/js/gomail.js?v=10"></script>
|
||||
<script src="/static/js/gomail.js?v=11"></script>
|
||||
{{block "scripts" .}}{{end}}
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user