mirror of
https://github.com/kenzok8/small-package
synced 2025-04-04 03:01:27 +08:00
update 2025-03-10 00:20:59
This commit is contained in:
parent
1130d513da
commit
4def21af0e
@ -8,12 +8,12 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=ddns-go
|
||||
PKG_VERSION:=6.9.0
|
||||
PKG_VERSION:=6.9.1
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=https://codeload.github.com/jeessy2/ddns-go/tar.gz/v$(PKG_VERSION)?
|
||||
PKG_HASH:=6942537ae8708a5b2e4126067bff368f3f8708e015342d56e3ad2865d7b88029
|
||||
PKG_HASH:=cb15bd2a4fb48eac138920685ec3fd1088b8c8fe9e67adeea83e6ca720e83cef
|
||||
|
||||
PKG_LICENSE:=MIT
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
|
@ -6,19 +6,19 @@
|
||||
|
||||
'require fchomo as hm';
|
||||
|
||||
const map_of_rule_provider = {
|
||||
//type: 'type',
|
||||
//behavior: 'behavior',
|
||||
//format: 'format',
|
||||
//url: 'url',
|
||||
"size-limit": 'size_limit',
|
||||
//interval: 'interval',
|
||||
//proxy: 'proxy',
|
||||
path: 'id',
|
||||
//payload: 'payload',
|
||||
};
|
||||
|
||||
function parseRulesetYaml(field, id, obj) {
|
||||
const map_of_rule_provider = {
|
||||
//type: 'type',
|
||||
//behavior: 'behavior',
|
||||
//format: 'format',
|
||||
//url: 'url',
|
||||
"size-limit": 'size_limit',
|
||||
//interval: 'interval',
|
||||
//proxy: 'proxy',
|
||||
path: 'id',
|
||||
//payload: 'payload', // array: string
|
||||
};
|
||||
|
||||
if (hm.isEmpty(obj))
|
||||
return null;
|
||||
|
||||
|
@ -683,7 +683,6 @@ uci.foreach(uciconf, uciprov, (cfg) => {
|
||||
if (cfg.enabled === '0')
|
||||
return null;
|
||||
|
||||
/* General fields */
|
||||
config["proxy-providers"][cfg['.name']] = {
|
||||
type: cfg.type,
|
||||
...(cfg.type === 'inline' ? {
|
||||
@ -696,48 +695,39 @@ uci.foreach(uciconf, uciprov, (cfg) => {
|
||||
interval: (cfg.type === 'http') ? durationToSecond(cfg.interval) ?? 86400 : null,
|
||||
proxy: get_proxygroup(cfg.proxy),
|
||||
header: cfg.header ? json(cfg.header) : null,
|
||||
"health-check": {},
|
||||
override: {},
|
||||
filter: parse_filter(cfg.filter),
|
||||
"exclude-filter": parse_filter(cfg.exclude_filter),
|
||||
"exclude-type": parse_filter(cfg.exclude_type)
|
||||
})
|
||||
};
|
||||
|
||||
if (cfg.type !== 'inline') {
|
||||
/* Override fields */
|
||||
config["proxy-providers"][cfg['.name']].override = {
|
||||
"additional-prefix": cfg.override_prefix,
|
||||
"additional-suffix": cfg.override_suffix,
|
||||
"proxy-name": isEmpty(cfg.override_replace) ? null : map(cfg.override_replace, (obj) => json(obj)),
|
||||
// Configuration Items
|
||||
tfo: strToBool(cfg.override_tfo),
|
||||
mptcp: strToBool(cfg.override_mptcp),
|
||||
udp: (cfg.override_udp === '0') ? false : true,
|
||||
"udp-over-tcp": strToBool(cfg.override_uot),
|
||||
up: cfg.override_up ? cfg.override_up + ' Mbps' : null,
|
||||
down: cfg.override_down ? cfg.override_down + ' Mbps' : null,
|
||||
"skip-cert-verify": strToBool(cfg.override_skip_cert_verify) || false,
|
||||
"dialer-proxy": dialerproxy[cfg['.name']]?.detour,
|
||||
"interface-name": cfg.override_interface_name,
|
||||
"routing-mark": strToInt(cfg.override_routing_mark) || null,
|
||||
"ip-version": cfg.override_ip_version
|
||||
};
|
||||
|
||||
/* Health fields */
|
||||
if (cfg.health_enable === '0') {
|
||||
config["proxy-providers"][cfg['.name']]["health-check"] = null;
|
||||
} else {
|
||||
config["proxy-providers"][cfg['.name']]["health-check"] = {
|
||||
/* Health fields */
|
||||
"health-check": cfg.health_enable === '0' ? {enable: false} : {
|
||||
enable: true,
|
||||
url: cfg.health_url,
|
||||
interval: durationToSecond(cfg.health_interval) ?? 600,
|
||||
timeout: strToInt(cfg.health_timeout) || 5000,
|
||||
lazy: (cfg.health_lazy === '0') ? false : null,
|
||||
"expected-status": cfg.health_expected_status || '204'
|
||||
};
|
||||
}
|
||||
}
|
||||
},
|
||||
/* Override fields */
|
||||
override: {
|
||||
"additional-prefix": cfg.override_prefix,
|
||||
"additional-suffix": cfg.override_suffix,
|
||||
"proxy-name": isEmpty(cfg.override_replace) ? null : map(cfg.override_replace, (obj) => json(obj)),
|
||||
// Configuration Items
|
||||
tfo: strToBool(cfg.override_tfo),
|
||||
mptcp: strToBool(cfg.override_mptcp),
|
||||
udp: (cfg.override_udp === '0') ? false : true,
|
||||
"udp-over-tcp": strToBool(cfg.override_uot),
|
||||
up: cfg.override_up ? cfg.override_up + ' Mbps' : null,
|
||||
down: cfg.override_down ? cfg.override_down + ' Mbps' : null,
|
||||
"skip-cert-verify": strToBool(cfg.override_skip_cert_verify) || false,
|
||||
"dialer-proxy": dialerproxy[cfg['.name']]?.detour,
|
||||
"interface-name": cfg.override_interface_name,
|
||||
"routing-mark": strToInt(cfg.override_routing_mark) || null,
|
||||
"ip-version": cfg.override_ip_version
|
||||
},
|
||||
/* General fields */
|
||||
filter: parse_filter(cfg.filter),
|
||||
"exclude-filter": parse_filter(cfg.exclude_filter),
|
||||
"exclude-type": parse_filter(cfg.exclude_type)
|
||||
})
|
||||
};
|
||||
});
|
||||
/* Provider END */
|
||||
|
||||
@ -752,15 +742,15 @@ uci.foreach(uciconf, ucirule, (cfg) => {
|
||||
type: cfg.type,
|
||||
format: cfg.format,
|
||||
behavior: cfg.behavior,
|
||||
...(cfg.payload ? {
|
||||
...(cfg.type === 'inline' ? {
|
||||
payload: trim(cfg.payload)
|
||||
} : {
|
||||
path: HM_DIR + '/ruleset/' + cfg['.name']
|
||||
}),
|
||||
url: cfg.url,
|
||||
"size-limit": bytesizeToByte(cfg.size_limit) || null,
|
||||
interval: (cfg.type === 'http') ? durationToSecond(cfg.interval) ?? 259200 : null,
|
||||
proxy: get_proxygroup(cfg.proxy)
|
||||
path: HM_DIR + '/ruleset/' + cfg['.name'],
|
||||
url: cfg.url,
|
||||
"size-limit": bytesizeToByte(cfg.size_limit) || null,
|
||||
interval: (cfg.type === 'http') ? durationToSecond(cfg.interval) ?? 259200 : null,
|
||||
proxy: get_proxygroup(cfg.proxy)
|
||||
})
|
||||
};
|
||||
});
|
||||
/* Rule set END */
|
||||
|
@ -5,6 +5,38 @@
|
||||
'require fs';
|
||||
'require tools.nikki as nikki'
|
||||
|
||||
function loadJS(url) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
const script = document.createElement('script');
|
||||
script.src = url;
|
||||
script.onload = resolve;
|
||||
script.onerror = reject;
|
||||
document.body.appendChild(script);
|
||||
});
|
||||
}
|
||||
|
||||
function loadCSS(url) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
const link = document.createElement('link');
|
||||
link.rel = 'stylesheet';
|
||||
link.href = url;
|
||||
link.onload = resolve;
|
||||
link.onerror = reject;
|
||||
document.head.appendChild(link);
|
||||
});
|
||||
}
|
||||
|
||||
async function loadCodeMirror() {
|
||||
try{
|
||||
await loadJS('https://unpkg.com/codemirror@5/lib/codemirror.js');
|
||||
await loadJS('https://unpkg.com/codemirror@5/mode/yaml/yaml.js');
|
||||
await loadCSS('https://unpkg.com/codemirror@5/lib/codemirror.css');
|
||||
await loadCSS('https://unpkg.com/codemirror@5/theme/dracula.css');
|
||||
} catch (e) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return view.extend({
|
||||
load: function () {
|
||||
return Promise.all([
|
||||
@ -12,6 +44,7 @@ return view.extend({
|
||||
nikki.listProfiles(),
|
||||
nikki.listRuleProviders(),
|
||||
nikki.listProxyProviders(),
|
||||
loadCodeMirror(),
|
||||
]);
|
||||
},
|
||||
render: function (data) {
|
||||
@ -53,22 +86,51 @@ return view.extend({
|
||||
o.write = function (section_id, formvalue) {
|
||||
return true;
|
||||
};
|
||||
o.onchange = function (event, section_id, value) {
|
||||
return L.resolveDefault(fs.read_direct(value), '').then(function (content) {
|
||||
m.lookupOption('nikki.editor._file_content')[0].getUIElement('editor').setValue(content);
|
||||
});
|
||||
};
|
||||
o.onchange = L.bind(function (event, section_id, value) {
|
||||
const uiElement = this.getUIElement(section_id, '_file_content');
|
||||
const editor = uiElement.node.firstChild.editor;
|
||||
fs.read_direct(value).then(function (content) {
|
||||
const mode = value.endsWith('.yml') || value.endsWith('.yaml') ? 'yaml' : null;
|
||||
uiElement.setValue(content);
|
||||
if (editor) {
|
||||
editor.setValue(content);
|
||||
editor.setOption('mode', mode);
|
||||
editor.getDoc().clearHistory();
|
||||
}
|
||||
}).catch(function (e) {
|
||||
uiElement.setValue('');
|
||||
if (editor) {
|
||||
editor.setValue('');
|
||||
editor.setOption('mode', null);
|
||||
editor.getDoc().clearHistory();
|
||||
}
|
||||
})
|
||||
}, s);
|
||||
|
||||
o = s.option(form.TextValue, '_file_content',);
|
||||
o.rows = 25;
|
||||
o.wrap = false;
|
||||
o.write = function (section_id, formvalue) {
|
||||
const path = m.lookupOption('nikki.editor._file')[0].formvalue('editor');
|
||||
o.write = L.bind(function (section_id, formvalue) {
|
||||
const path = this.getOption('_file').formvalue(section_id);
|
||||
return fs.write(path, formvalue);
|
||||
};
|
||||
o.remove = function (section_id) {
|
||||
const path = m.lookupOption('nikki.editor._file')[0].formvalue('editor');
|
||||
}, s);
|
||||
o.remove = L.bind(function (section_id) {
|
||||
const path = this.getOption('_file').formvalue(section_id);
|
||||
return fs.write(path);
|
||||
}, s);
|
||||
o.render = function () {
|
||||
return this.super('render', arguments).then(function (widget) {
|
||||
const textarea = widget.firstChild.firstChild;
|
||||
if (CodeMirror) {
|
||||
const editor = CodeMirror.fromTextArea(textarea, { lineNumbers: true, theme: 'dracula' });
|
||||
editor.on('change', function () {
|
||||
editor.save();
|
||||
});
|
||||
editor.getWrapperElement().style.height = '420px';
|
||||
textarea.editor = editor;
|
||||
}
|
||||
return widget;
|
||||
});
|
||||
};
|
||||
|
||||
return m.render();
|
||||
|
@ -29,10 +29,10 @@ return view.extend({
|
||||
o = s.taboption('app_log', form.Button, 'clear_app_log');
|
||||
o.inputstyle = 'negative';
|
||||
o.inputtitle = _('Clear Log');
|
||||
o.onclick = function () {
|
||||
m.lookupOption('nikki.log._app_log')[0].getUIElement('log').setValue('');
|
||||
o.onclick = L.bind(function (event, section_id) {
|
||||
this.getUIElement(section_id, '_app_log').setValue('');
|
||||
return nikki.clearAppLog();
|
||||
};
|
||||
}, s);
|
||||
|
||||
o = s.taboption('app_log', form.TextValue, '_app_log');
|
||||
o.rows = 25;
|
||||
@ -52,20 +52,20 @@ return view.extend({
|
||||
|
||||
o = s.taboption('app_log', form.Button, 'scroll_app_log_to_bottom');
|
||||
o.inputtitle = _('Scroll To Bottom');
|
||||
o.onclick = function () {
|
||||
const element = m.lookupOption('nikki.log._app_log')[0].getUIElement('log').node.firstChild;
|
||||
o.onclick = L.bind(function (event, section_id) {
|
||||
const element = this.getUIElement(section_id, '_app_log').node.firstChild;
|
||||
element.scrollTop = element.scrollHeight;
|
||||
};
|
||||
}, s);
|
||||
|
||||
s.tab('core_log', _('Core Log'));
|
||||
|
||||
o = s.taboption('core_log', form.Button, 'clear_core_log');
|
||||
o.inputstyle = 'negative';
|
||||
o.inputtitle = _('Clear Log');
|
||||
o.onclick = function () {
|
||||
m.lookupOption('nikki.log._core_log')[0].getUIElement('log').setValue('');
|
||||
o.onclick = L.bind(function (event, section_id) {
|
||||
this.getUIElement(section_id, '_core_log').setValue('');
|
||||
return nikki.clearCoreLog();
|
||||
};
|
||||
}, s);
|
||||
|
||||
o = s.taboption('core_log', form.TextValue, '_core_log');
|
||||
o.rows = 25;
|
||||
@ -85,10 +85,10 @@ return view.extend({
|
||||
|
||||
o = s.taboption('core_log', form.Button, 'scroll_core_log_to_bottom');
|
||||
o.inputtitle = _('Scroll To Bottom');
|
||||
o.onclick = function () {
|
||||
const element = m.lookupOption('nikki.log._core_log')[0].getUIElement('log').node.firstChild;
|
||||
o.onclick = L.bind(function (event, section_id) {
|
||||
const element = this.getUIElement(section_id, '_core_log').node.firstChild;
|
||||
element.scrollTop = element.scrollHeight;
|
||||
};
|
||||
}, s);
|
||||
|
||||
s.tab('debug_log', _('Debug Log'));
|
||||
|
||||
|
@ -66,6 +66,7 @@ o:value("https://fastly.jsdelivr.net/gh/gaoyifan/china-operator-ip@ip-lists/chin
|
||||
o.default = "https://ispip.clang.cn/all_cn.txt"
|
||||
|
||||
o = s:option(Flag, "netflix_enable", translate("Enable Netflix Mode"))
|
||||
o.description = translate("Disable shunt mode before, Please must first disable shunt node.")
|
||||
o.rmempty = false
|
||||
|
||||
o = s:option(Value, "nfip_url", translate("nfip_url"))
|
||||
|
@ -1209,6 +1209,9 @@ msgstr "应用"
|
||||
msgid "Enable Netflix Mode"
|
||||
msgstr "启用 Netflix 分流模式"
|
||||
|
||||
msgid "Disable shunt mode before, Please must first disable shunt node."
|
||||
msgstr "停用分流模式之前,请务必先停用分流节点。"
|
||||
|
||||
msgid "TUIC User UUID"
|
||||
msgstr "TUIC 用户 uuid"
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user