💐 Sync 2026-07-09 02:25:04

This commit is contained in:
github-actions[bot] committed 2026-07-09 02:25:04 +08:00
1 parent f077ddaf47
commit 2af7926aeb
37 files changed
+597 -329

No files matched your search

+1 -1
View File
@@ -6,7 +6,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-daede
PKG_VERSION:=1.14.7
PKG_RELEASE:=30
PKG_RELEASE:=31
PKG_MAINTAINER:=kenzok8
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
@@ -4,9 +4,22 @@
'require baseclass';
'require form';
'require fs';
'require ui';
'require uci';
'require view.daede.widgets as widgets';
function applyUciChanges() {
return uci.save().then(function() {
return uci.changes().then(function(ch) {
return (ch && Object.keys(ch).length) ? uci.apply() : null;
});
}).then(function() {
return new Promise(function(resolve) { window.setTimeout(resolve, 1800); });
}).then(function() {
return ui.changes.init();
});
}
function renderDaedSettings() {
let m, s, o;
m = new form.Map('daed', null, null);
@@ -96,12 +109,7 @@ function renderDaedSettings() {
ev.preventDefault();
save.disabled = true;
m.save(null, true)
.then(function() { return uci.save(); })
.then(function() {
return uci.changes().then(function(ch) {
return (ch && Object.keys(ch).length) ? uci.apply() : null;
});
})
.then(applyUciChanges)
.then(function() {
const enabled = uci.get('daed', 'config', 'subscribe_auto_update') === '1';
return fs.exec('/usr/share/luci-app-daede/daed-sub-cron.sh', [ enabled ? 'enable' : 'disable' ]);
@@ -58,9 +58,6 @@ const CSS = [
'.dd-geo-row input[type=text],.dd-geo-row select{font-size:12px;padding:4px 8px;border:1px solid rgba(128,128,128,.35);border-radius:5px;background:transparent;color:inherit;width:100%}',
/* selects cap at 200px on wide screens, shrink to the column on mobile (no overflow) */
'.dd-geo-row select{width:100%!important;max-width:200px;box-sizing:border-box}',
'.dd-geo-auto{display:inline-flex;align-items:center;gap:6px}',
/* Argon shifts label>checkbox down (top:.4rem); reset so flex centers it */
'.dd-geo-auto input[type="checkbox"]{position:static;top:auto;right:auto;margin:0}',
'.dd-geo-actions{margin-top:10px;display:flex;gap:10px;align-items:center}',
'.dd-up-log{margin-top:10px;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;font-size:11px;padding:10px;border:1px solid rgba(128,128,128,.14);border-radius:8px;max-height:200px;overflow:auto;white-space:pre-wrap;word-break:break-all;display:none;background:inherit;color:#4a8c63}',
'.dd-up-log.show{display:block}',
@@ -436,24 +433,25 @@ return view.extend({
presetSel.addEventListener('change', syncCustom);
syncCustom();
const autoCb = E('input', { 'type': 'checkbox' });
autoCb.checked = auto0;
const freqSel = E('select', {}, [
const autoSel = E('select', {}, [
E('option', { 'value': 'off' }, _('Disabled')),
E('option', { 'value': 'daily' }, _('Daily')),
E('option', { 'value': 'weekly' }, _('Weekly'))
]);
freqSel.value = freq0;
autoSel.value = auto0 ? freq0 : 'off';
const saveBtn = E('button', { 'class': 'dd-up-btn dd-up-btn-primary' }, _('Save'));
saveBtn.addEventListener('click', function() {
const p = presetSel.value;
let gi = '', gs = '';
const geoAuto = autoSel.value !== 'off';
const geoFreq = autoSel.value === 'weekly' ? 'weekly' : 'daily';
if (p === 'v2fly') { gi = GEO_PRESETS.v2fly.geoip; gs = GEO_PRESETS.v2fly.geosite; }
else if (p === 'custom') { gi = giInput.value.trim(); gs = gsInput.value.trim(); }
uci.set('daede', 'config', 'geoip_url', gi);
uci.set('daede', 'config', 'geosite_url', gs);
uci.set('daede', 'config', 'geo_auto', autoCb.checked ? '1' : '0');
uci.set('daede', 'config', 'geo_auto_freq', freqSel.value);
uci.set('daede', 'config', 'geo_auto', geoAuto ? '1' : '0');
uci.set('daede', 'config', 'geo_auto_freq', geoFreq);
const orig = saveBtn.textContent;
saveBtn.disabled = true; saveBtn.textContent = '...';
uci.save().then(function() {
@@ -463,7 +461,7 @@ return view.extend({
if (changes && Object.keys(changes).length)
return uci.apply();
}).then(function() {
return fs.exec('/usr/share/luci-app-daede/geo-cron.sh', [autoCb.checked ? 'enable' : 'disable']);
return fs.exec('/usr/share/luci-app-daede/geo-cron.sh', [geoAuto ? 'enable' : 'disable']);
}).then(function() {
logPane.textContent = _('Geo data source saved.');
logPane.classList.add('show');
@@ -485,8 +483,8 @@ return view.extend({
E('div', { 'class': 'dd-geo-row' }, [ E('label', {}, _('Source')), presetSel ]),
customRows,
E('div', { 'class': 'dd-geo-row' }, [
E('label', { 'class': 'dd-geo-auto' }, [ E('span', {}, _('Auto-update')), autoCb ]),
freqSel
E('label', {}, _('Auto-update')),
autoSel
]),
E('div', { 'class': 'dd-geo-actions' }, [ saveBtn ])
])
@@ -22,6 +22,11 @@ function execInit(be, action) {
}).catch(function() {});
}
function restartService(be) {
return execChecked(be.initd, ['restart'])
.then(function() { return waitForService(be, true, 80); });
}
function rejectIfOtherRunning(be, running) {
const other = be.name === 'dae' ? 'daed' : 'dae';
if (!running || !running[other])
@@ -231,8 +236,21 @@ function renderStatusCard(ctx, listenAddr) {
const restart = E('button', { 'class': 'cbi-button cbi-button-positive' }, _('Restart'));
restart.addEventListener('click', function(ev) {
ev.preventDefault();
if (busy) return;
busy = true;
restart.disabled = true;
execInit(be, 'restart').finally(function() { restart.disabled = false; });
lastError = '';
swErr.style.display = 'none';
restartService(be)
.then(function() {
busy = false;
return refresh(true);
})
.catch(function(e) {
busy = false;
lastError = _('Restart failed: %s').format(e.message || e);
return refresh(true);
});
});
actions.push(restart);
}
+3
View File
@@ -836,6 +836,9 @@ msgstr ""
msgid "Auto-update"
msgstr ""
msgid "Disabled"
msgstr ""
msgid "Daily"
msgstr ""
+3
View File
@@ -1025,6 +1025,9 @@ msgstr "自定义"
msgid "Auto-update"
msgstr "自动更新"
msgid "Disabled"
msgstr "关闭"
msgid "Daily"
msgstr "每天"
+3
View File
@@ -1025,6 +1025,9 @@ msgstr "自定义"
msgid "Auto-update"
msgstr "自动更新"
msgid "Disabled"
msgstr "关闭"
msgid "Daily"
msgstr "每天"