mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-11-05 09:54:06 +08:00
🍓 Sync 2026-10-01 00:51:52
This commit is contained in:
1 parent
57dc97412f
commit
d45a1cb4ad
60 files changed
+2630
-1193
No files matched your search
@@ -1128,6 +1128,35 @@ return baseclass.extend({
|
||||
return true;
|
||||
},
|
||||
|
||||
/* A regular expression that does not compile reaches sing-box as-is and
|
||||
* takes the whole configuration with it, so the reload keeps the previous
|
||||
* one and the user only sees "my setting did not take". Go's RE2 and this
|
||||
* engine differ in the corners, but every typo is caught here. */
|
||||
validateRegex(section_id, value) {
|
||||
if (section_id && value) {
|
||||
try {
|
||||
new RegExp(value);
|
||||
} catch (e) {
|
||||
return _('Expecting: %s').format(_('valid regular expression'));
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
},
|
||||
|
||||
/* sing-box resolves a DNS query type name through miekg/dns's uppercase
|
||||
* type table (option/types.go), so "aaaa" is an "unknown DNS query type"
|
||||
* and takes the configuration down with it. A numeric code up to 65535 is
|
||||
* valid as-is. */
|
||||
validateQueryType(section_id, value) {
|
||||
if (section_id && value) {
|
||||
if (!((/^[0-9]{1,5}$/.test(value) && parseInt(value, 10) <= 65535) || /^[A-Z][A-Z0-9-]*$/.test(value)))
|
||||
return _('Expecting: %s').format(_('a numeric code or an uppercase type name (for example AAAA)'));
|
||||
}
|
||||
|
||||
return true;
|
||||
},
|
||||
|
||||
validateUniqueValue(uciconfig, ucisection, ucioption, section_id, value) {
|
||||
if (section_id) {
|
||||
if (!value)
|
||||
|
||||
Reference in new issue
Block a user