💋 Sync 2026-10-11 00:16:14
Merge-upstream / merge (push) Canceled after 0s

This commit is contained in:
github-actions[bot] committed 2026-10-11 00:16:14 +08:00
1 parent c7bafc635d
commit c71da84035
264 files changed
+8169 -3944

No files matched your search

@@ -5,7 +5,6 @@ let values = {
debug: '0',
download_retry: '3',
statistics_enabled: '1',
license_key: 'abcd1234wxyz',
device_vendor: 'Junatum',
device_model: 'Test Router',
device_arch: 'aarch64',
@@ -33,12 +32,6 @@ function to_int(v, def) {
return type(n) == 'int' ? n : def;
}
function mask_secret(v) {
let s = sprintf('%s', v || '');
if (!length(s)) return '';
if (length(s) <= 8) return '********';
return sprintf('%s...%s', substr(s, 0, 4), substr(s, length(s) - 4));
}
function api_error(code, message, field) {
let error = { code: code, message: message };
@@ -71,7 +64,6 @@ return {
cfg: function(name, def) { return values[name] == null ? def : values[name]; },
to_bool: to_bool,
to_int: to_int,
mask_secret: mask_secret,
api_error: api_error,
uci_commit_option: uci_commit_option,
bool_uci: function(v) { return v ? '1' : '0'; }
@@ -1,43 +0,0 @@
'use strict';
let state = {
license_key: 'existing-license-key',
commits: 0,
deletes: 0
};
function trim(s) {
return replace(s, /^[\r\n\t ]+|[\r\n\t ]+$/g, '');
}
function mask_secret(v) {
let s = sprintf('%s', v || '');
if (!length(s)) return '';
if (length(s) <= 8) return '********';
return sprintf('%s...%s', substr(s, 0, 4), substr(s, length(s) - 4));
}
function api_error(code, message, field) {
let error = { code: code, message: message };
if (field) error.field = field;
return { ok: false, error: error };
}
return {
state: state,
reload_uci: function() { return true; },
cfg: function(name, def) { return name == 'license_key' ? state.license_key : def; },
trim: trim,
mask_secret: mask_secret,
api_error: api_error,
uci_commit_option: function(name, value) {
state.license_key = value;
state.commits++;
return true;
},
uci_delete_option: function(name) {
state.license_key = '';
state.deletes++;
return true;
}
};
@@ -1,14 +0,0 @@
'use strict';
let state = { refresh_count: 0, statistics_reset_count: 0, accepted: true, reason: '' };
return {
state: state,
reset_statistics_upload_state: function() {
state.statistics_reset_count++;
},
start_refresh_async: function() {
state.refresh_count++;
return { accepted: state.accepted, reason: state.reason };
}
};
@@ -0,0 +1,24 @@
'use strict';
let ubus = require('ubus');
let state = { calls: [], timeout: false };
function popen(command, mode) {
push(state.calls, command);
if (state.timeout) return null;
let name = match(command, /\"name\":\"([^\"]+)\"/);
let service_name = name ? name[1] : null;
let instance = service_name ? ubus.state.services[service_name] : null;
let response = {};
if (instance != null) response[service_name] = instance;
return {
read: function() { return sprintf('%J', response); },
close: function() { return true; }
};
}
return {
state: state,
popen: popen,
unlink: function() { return true; }
};
@@ -1,6 +1,8 @@
'use strict';
return {
service_status: function() {
return { state: 'running', running: true, lookup_ok: true, instances: { statistics: { running: true } } };
},
service_instance_running: function(name, instance) {
return name == 'safeshield' && instance == 'statistics';
}
+3 -11
View File
@@ -6,7 +6,6 @@ let config = {
require_wan: '1',
refresh_interval_s: '28800',
boot_start_delay_s: '30',
license_key: 'abcd1234wxyz',
apply_local_overrides: '1',
device_vendor: 'Junatum',
device_model: 'Test Router',
@@ -41,8 +40,8 @@ let state = {
health_dns_runtime: '1',
blocklist_installed: '1',
blocklist_file_size_kb: '2048',
license_plan: 'pro',
license_status: 'active'
entitlement_plan: 'pro',
entitlement_status: 'active'
},
warnings: [],
errors: []
@@ -67,12 +66,6 @@ function to_int(v, def) {
return type(n) == 'int' ? n : def;
}
function mask_secret(v) {
let s = sprintf('%s', v || '');
if (!length(s)) return '';
if (length(s) <= 8) return '********';
return sprintf('%s...%s', substr(s, 0, 4), substr(s, length(s) - 4));
}
return {
PKG_NAME: 'safeshield',
@@ -93,6 +86,5 @@ return {
file_size_kb: function() { return 0; },
to_bool: to_bool,
to_optional_bool: to_optional_bool,
to_int: to_int,
mask_secret: mask_secret
to_int: to_int
};
@@ -1,9 +1,11 @@
'use strict';
let state = { service_running: true, dnsmasq_running: true };
let state = { service_running: true, dnsmasq_running: true, lookup_ok: true };
return {
state: state,
service_status: function(name) {
let running = name == 'dnsmasq' ? state.dnsmasq_running : state.service_running;
return { running: running && state.lookup_ok, state: !state.lookup_ok ? 'unknown' : (running ? 'running' : 'stopped'), lookup_ok: state.lookup_ok };
},
service_running: function() { return state.service_running; },
dnsmasq_running: function() { return state.dnsmasq_running; }
};