[Web][Dovecot] Rework imapsync: sync sources, OAuth2 (XOAUTH2), worker pool, Python runner

This commit is contained in:
FreddleSpl0it committed 2026-10-22 10:07:52 +02:00
1 parent e756b7857e
commit 7c62a57910
39 files changed
+3582 -1358

No files matched your search

+26 -33
View File
@@ -2169,7 +2169,11 @@ jQuery(function($){
"tr" +
"<'row'<'col-sm-12 col-md-5'i><'col-sm-12 col-md-7'p>>",
language: lang_datatables,
order: [[2, 'desc']],
// keep the backend order (C4: prio desc, never run first, least recently run)
order: [],
// drop state saved before the rework (it would restore the old ID sort / column visibility)
stateSaveParams: mailcowImapsync.jobTableStateSave,
stateLoadParams: mailcowImapsync.jobTableStateLoad,
initComplete: function(){
hideTableExpandCollapseBtn('#tab-syncjobs', '#sync_job_table');
},
@@ -2177,40 +2181,21 @@ jQuery(function($){
type: "GET",
url: "/api/v1/get/syncjobs/all/no_log",
dataSrc: function(json){
if (!Array.isArray(json)) return [];
$.each(json, function (i, item) {
item.log = '<a href="#syncjobLogModal" data-bs-toggle="modal" data-syncjob-id="' + encodeURIComponent(item.id) + '">' + lang.open_logs + '</a>'
item.user2 = escapeHtml(item.user2);
if (!item.exclude > 0) {
item.exclude = '-';
} else {
item.exclude = '<code>' + escapeHtml(item.exclude) + '</code>';
}
item.server_w_port = escapeHtml(item.user1) + '@' + escapeHtml(item.host1) + ':' + escapeHtml(item.port1);
mailcowImapsync.prepareJobRow(item);
item.user2 = mailcowImapsync.wrapCell(escapeHtml(item.user2));
item.action = '<div class="btn-group">' +
'<a href="/edit/syncjob/' + item.id + '" class="btn btn-sm btn-xs-lg btn-xs-half btn-secondary"><i class="bi bi-pencil-fill"></i> ' + lang.edit + '</a>' +
'<a href="#syncjobLogModal" data-bs-toggle="modal" data-syncjob-id="' + encodeURIComponent(item.id) + '" class="btn btn-sm btn-xs-lg btn-xs-half btn-info"><i class="bi bi-card-list"></i> ' + lang.open_logs + '</a>' +
'<a href="#" data-action="delete_selected" data-id="single-syncjob" data-api-url="delete/syncjob" data-item="' + item.id + '" class="btn btn-sm btn-xs-lg btn-xs-half btn-danger"><i class="bi bi-trash"></i> ' + lang.remove + '</a>' +
'</div>';
item.chkbox = '<input type="checkbox" class="form-check-input" data-id="syncjob" name="multi_select" value="' + item.id + '" />';
if (item.is_running == 1) {
item.is_running = '<span id="active-script" class="badge fs-6 bg-success">' + lang.running + '</span>';
} else {
item.is_running = '<span id="inactive-script" class="badge fs-6 bg-warning">' + lang.waiting + '</span>';
}
if (!item.last_run > 0) {
item.last_run = lang.waiting;
}
if (item.success == null) {
item.success = '-';
item.exit_status = '';
} else {
item.success = '<i class="text-' + (item.success == 1 ? 'success' : 'danger') + ' bi bi-' + (item.success == 1 ? 'check-lg' : 'x-lg') + '"></i>';
}
if (lang['syncjob_'+item.exit_status]) {
item.exit_status = lang['syncjob_'+item.exit_status];
} else if (item.success != '-') {
item.exit_status = lang.syncjob_check_log;
}
item.exit_status = item.success + ' ' + item.exit_status;
});
return json;
@@ -2235,40 +2220,46 @@ jQuery(function($){
responsivePriority: 2
},
{
title: 'ID',
title: mailcowImapsync.L('id'),
data: 'id',
responsivePriority: 3,
defaultContent: ''
},
{
title: lang.owner,
title: lang.syncjobs.prio,
data: 'prio',
visible: role === 'admin',
responsivePriority: 3,
defaultContent: ''
},
{
title: lang.syncjobs.user2_label,
data: 'user2',
responsivePriority: 4,
defaultContent: ''
},
{
title: 'Server',
title: lang.syncjobs.source_server,
data: 'server_w_port',
responsivePriority: 6,
defaultContent: ''
},
{
title: lang.last_run,
data: 'last_run',
responsivePriority: 9,
defaultContent: ''
},
{
title: lang.syncjob_last_run_result,
title: lang.syncjobs.syncjob_last_run_result,
data: 'exit_status',
defaultContent: ''
},
{
title: 'Log',
data: 'log',
responsivePriority: 8,
defaultContent: ''
},
{
title: lang.active,
data: 'active',
responsivePriority: 10,
defaultContent: '',
render: function (data, type) {
return 1==data?'<i class="bi bi-check-lg"><span class="sorting-value">1</span></i>':0==data&&'<i class="bi bi-x-lg"><span class="sorting-value">0</span></i>';
@@ -2277,6 +2268,7 @@ jQuery(function($){
{
title: lang.status,
data: 'is_running',
responsivePriority: 7,
defaultContent: ''
},
{
@@ -2486,6 +2478,7 @@ jQuery(function($){
onVisible("[id^=alias_table]", () => draw_alias_table());
onVisible("[id^=aliasdomain_table]", () => draw_aliasdomain_table());
onVisible("[id^=sync_job_table]", () => draw_sync_job_table());
onVisible("[id^=imapsync_source_table]", () => mailcowImapsync.drawSourceTable(role === 'admin' || acl_data.syncjobs === 1));
onVisible("[id^=filter_table]", () => draw_filter_table());
onVisible("[id^=bcc_table]", () => draw_bcc_table());
onVisible("[id^=recipient_map_table]", () => draw_recipient_map_table());