fix(validator,migration,fuzzer): resilient domain validation, strip prefixed comments and fix zapret1 fuzzer fwmark
This commit is contained in:
@@ -1046,7 +1046,13 @@ function validateProxyUrl(url) {
|
||||
|
||||
// src/helpers/parseValueList.ts
|
||||
function parseValueList(value) {
|
||||
return value.split(/\n/).map((line) => line.split("//")[0].split("#")[0]).join(" ").split(/[,\s]+/).map((s) => s.trim()).filter(Boolean);
|
||||
return value.split(/\r?\n/).map((line) => {
|
||||
const stripped = line.replace(
|
||||
/^(full|keyword|regex):[ \t]*(\/\/|#).*$/,
|
||||
""
|
||||
);
|
||||
return stripped.split("//")[0].split("#")[0];
|
||||
}).join(" ").split(/[,\s]+/).map((s) => s.trim()).filter(Boolean);
|
||||
}
|
||||
|
||||
// src/helpers/getProxyUrlName.ts
|
||||
|
||||
@@ -5521,8 +5521,9 @@ function parseCommentAwareListTokens(value) {
|
||||
let offset = 0;
|
||||
|
||||
lines.forEach((line, index) => {
|
||||
const hashIndex = line.indexOf("#");
|
||||
const slashIndex = line.indexOf("//");
|
||||
const cleanLine = line.replace(/^(full|keyword|regex):[ \t]*(\/\/|#).*$/, "");
|
||||
const hashIndex = cleanLine.indexOf("#");
|
||||
const slashIndex = cleanLine.indexOf("//");
|
||||
let commentIndex = -1;
|
||||
|
||||
if (hashIndex >= 0 && slashIndex >= 0) {
|
||||
@@ -5533,7 +5534,7 @@ function parseCommentAwareListTokens(value) {
|
||||
commentIndex = slashIndex;
|
||||
}
|
||||
|
||||
const source = commentIndex >= 0 ? line.slice(0, commentIndex) : line;
|
||||
const source = commentIndex >= 0 ? cleanLine.slice(0, commentIndex) : cleanLine;
|
||||
const matcher = /[^,\s]+/g;
|
||||
let match;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user