mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-11-02 05:23:56 +08:00
🔥 Sync 2026-06-19 21:14:10
This commit is contained in:
1 parent
ce48633b46
commit
d92edece61
17 files changed
+533
-111
No files matched your search
@@ -5,8 +5,8 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=luci-app-daede
|
||||
PKG_VERSION:=1.13.0
|
||||
PKG_RELEASE:=17
|
||||
PKG_VERSION:=1.14.0
|
||||
PKG_RELEASE:=18
|
||||
PKG_MAINTAINER:=kenzok8
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
|
||||
|
||||
@@ -77,10 +77,9 @@ define Package/$(PKG_NAME)/install
|
||||
$(INSTALL_BIN) ./root/usr/share/luci-app-daede/gen-dae-config.sh $(1)/usr/share/luci-app-daede/gen-dae-config.sh
|
||||
$(INSTALL_BIN) ./root/usr/share/luci-app-daede/proxy-check.sh $(1)/usr/share/luci-app-daede/proxy-check.sh
|
||||
$(INSTALL_BIN) ./root/usr/share/luci-app-daede/fetch-clash-yaml.sh $(1)/usr/share/luci-app-daede/fetch-clash-yaml.sh
|
||||
$(INSTALL_BIN) ./root/usr/share/luci-app-daede/refresh-index.sh $(1)/usr/share/luci-app-daede/refresh-index.sh
|
||||
$(INSTALL_BIN) ./root/usr/share/luci-app-daede/config-backup.sh $(1)/usr/share/luci-app-daede/config-backup.sh
|
||||
$(INSTALL_BIN) ./root/usr/share/luci-app-daede/refresh-index.sh $(1)/usr/share/luci-app-daede/refresh-index.sh
|
||||
$(INSTALL_BIN) ./root/usr/share/luci-app-daede/geo-cron.sh $(1)/usr/share/luci-app-daede/geo-cron.sh
|
||||
|
||||
$(INSTALL_DIR) $(1)/www/cgi-bin
|
||||
$(INSTALL_BIN) ./root/www/cgi-bin/daede-sub $(1)/www/cgi-bin/daede-sub
|
||||
$(INSTALL_BIN) ./root/www/cgi-bin/daede-graphql $(1)/www/cgi-bin/daede-graphql
|
||||
|
||||
@@ -60,7 +60,7 @@ const CSS = [
|
||||
'.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}',
|
||||
'body.dark .dd-up-log,html[data-theme="dark"] .dd-up-log,html[data-bs-theme="dark"] .dd-up-log{color:#a3d9ad}',
|
||||
/* 手风琴折叠组 —— 与 config.js dd-adv 同构 */
|
||||
/* accordion — same structure as config.js dd-adv */
|
||||
'.dd-adv{margin-bottom:14px}',
|
||||
'.dd-adv-bar{display:flex;align-items:center;justify-content:space-between;padding:8px 14px;cursor:pointer;user-select:none;font-size:11.5px;font-weight:600;background:rgba(128,128,128,.04);border:1px solid rgba(0,0,0,.06);border-radius:10px;color:inherit;letter-spacing:.3px;text-transform:uppercase;opacity:.7;box-shadow:0 2px 8px rgba(0,0,0,.03)}',
|
||||
'.dd-adv-bar:hover{background:rgba(56,134,161,.06);opacity:.95}',
|
||||
@@ -131,6 +131,8 @@ function stamp() {
|
||||
|
||||
return view.extend({
|
||||
load: function() {
|
||||
// background apk update so new versions show on next poll
|
||||
fs.exec('/usr/share/luci-app-daede/refresh-index.sh', []).catch(function() {});
|
||||
return Promise.all([
|
||||
backend.detectBackend(),
|
||||
uci.load('daed').catch(function() {}),
|
||||
@@ -212,14 +214,29 @@ return view.extend({
|
||||
logPane.classList.add('show');
|
||||
return;
|
||||
}
|
||||
const bin = atob(res.stdout.trim());
|
||||
let bin;
|
||||
try {
|
||||
bin = atob(res.stdout.trim());
|
||||
} catch (e) {
|
||||
logPane.textContent = _('Export failed: invalid base64 data from server');
|
||||
logPane.classList.add('show');
|
||||
return;
|
||||
}
|
||||
if (!bin || bin.length === 0) {
|
||||
logPane.textContent = _('Export failed: empty archive');
|
||||
logPane.classList.add('show');
|
||||
return;
|
||||
}
|
||||
const arr = new Uint8Array(bin.length);
|
||||
for (let i = 0; i < bin.length; i++) arr[i] = bin.charCodeAt(i);
|
||||
const url = URL.createObjectURL(new Blob([arr], { 'type': 'application/gzip' }));
|
||||
const a = E('a', { 'href': url, 'download': 'daede-config-' + stamp() + '.tar.gz' });
|
||||
document.body.appendChild(a); a.click(); document.body.removeChild(a);
|
||||
setTimeout(function() { URL.revokeObjectURL(url); }, 1000);
|
||||
}).catch(function() {}).finally(function() {
|
||||
}).catch(function(e) {
|
||||
logPane.textContent = _('Export failed') + ': ' + (e ? (e.message || String(e)) : _('script not found'));
|
||||
logPane.classList.add('show');
|
||||
}).finally(function() {
|
||||
exportBtn.disabled = false; exportBtn.textContent = orig;
|
||||
});
|
||||
});
|
||||
@@ -236,7 +253,10 @@ return view.extend({
|
||||
const b64 = String(e.target.result).split(',')[1] || '';
|
||||
fs.write('/tmp/daede-import.b64', b64).then(function() {
|
||||
return runJob('config-backup.sh', 'import', importBtn, '/tmp/luci-app-daede.backup.log');
|
||||
}).catch(function() {}).finally(function() { fileInput.value = ''; });
|
||||
}).catch(function(e) {
|
||||
logPane.textContent = _('Import failed') + ': ' + (e ? (e.message || String(e)) : _('unknown error'));
|
||||
logPane.classList.add('show');
|
||||
}).finally(function() { fileInput.value = ''; });
|
||||
};
|
||||
reader.readAsDataURL(file);
|
||||
});
|
||||
@@ -377,21 +397,6 @@ return view.extend({
|
||||
|
||||
poll.add(refresh);
|
||||
refresh();
|
||||
// Start the potentially slow index refresh without holding a LuCI RPC
|
||||
// request open, then re-probe promptly when its status changes to done.
|
||||
const waitIndexRefresh = function(tries) {
|
||||
return L.resolveDefault(fs.read_direct('/tmp/luci-app-daede.idx.status', 'text'), '').then(function(status) {
|
||||
if (String(status).trim() === 'done')
|
||||
return refresh();
|
||||
if (tries <= 0)
|
||||
return;
|
||||
return new Promise(function(resolve) { setTimeout(resolve, 1000); })
|
||||
.then(function() { return waitIndexRefresh(tries - 1); });
|
||||
});
|
||||
};
|
||||
fs.exec('/usr/share/luci-app-daede/refresh-index.sh', [])
|
||||
.then(function() { return waitIndexRefresh(30); })
|
||||
.catch(function() {});
|
||||
|
||||
// === Geo data source (preset / custom URL + auto-update) ===
|
||||
const geoSettings = (function() {
|
||||
|
||||
@@ -1,28 +1,21 @@
|
||||
#!/bin/sh
|
||||
# Refresh the apk/opkg index for the Updates view without holding the LuCI RPC
|
||||
# request open. The view watches STATUS and re-probes as soon as it reads done.
|
||||
# Background apk/opkg update for the Updates view. Returns at once; throttled.
|
||||
|
||||
LOCK=/tmp/luci-app-daede.idx.lock
|
||||
STATUS=/tmp/luci-app-daede.idx.status
|
||||
|
||||
if [ -f "$LOCK" ]; then
|
||||
mtime=$(date -r "$LOCK" +%s 2>/dev/null || echo 0)
|
||||
if [ "$(( $(date +%s) - mtime ))" -lt 90 ]; then
|
||||
[ -f "$STATUS" ] || printf '%s\n' done > "$STATUS"
|
||||
exit 0
|
||||
fi
|
||||
[ "$(( $(date +%s) - mtime ))" -lt 90 ] && exit 0
|
||||
fi
|
||||
: > "$LOCK"
|
||||
printf '%s\n' running > "$STATUS"
|
||||
|
||||
# -n: skip if a package op holds the shared apk lock (no need to refresh then)
|
||||
(
|
||||
# -n: skip if a package op holds the shared apk lock (no need to refresh then)
|
||||
if command -v apk >/dev/null 2>&1; then
|
||||
flock -n /tmp/luci-app-daede.apk.lock apk update
|
||||
elif command -v opkg >/dev/null 2>&1; then
|
||||
opkg update
|
||||
fi
|
||||
printf '%s\n' done > "$STATUS"
|
||||
) >/dev/null 2>&1 </dev/null &
|
||||
|
||||
exit 0
|
||||
@@ -20,7 +20,6 @@
|
||||
"/tmp/luci-app-daede.pkg-daed.log": [ "read" ],
|
||||
"/tmp/luci-app-daede.pkg-luci-app-daede.log": [ "read" ],
|
||||
"/tmp/luci-app-daede.backup.log": [ "read" ],
|
||||
"/tmp/luci-app-daede.idx.status": [ "read" ],
|
||||
"/bin/pidof dae": [ "exec" ],
|
||||
"/bin/pidof daed": [ "exec" ],
|
||||
"/usr/bin/dae validate -c /tmp/dae-validate.dae": [ "exec" ],
|
||||
|
||||
Reference in new issue
Block a user