ci: auto build & obfuscate [2026-04-23 00:35:57] (Jenkins #17)

This commit is contained in:
Jenkins CI
2026-04-23 00:35:57 +08:00
parent 8d590073f4
commit 544937bb91
23 changed files with 160 additions and 84 deletions

View File

@@ -58,21 +58,28 @@ function replaceContentByTag(xmlString, tagName, newContent) {
export { extractContentByTag, replaceContentByTag, extractFullTagBlock, opt_extractContentByTag, opt_replaceContentByTag, opt_extractFullTagBlock };
function escapeRegex(s) {
return String(s ?? '').replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
}
function opt_extractContentByTag(text, tagName) {
const regex = new RegExp(`<${tagName}[^>]*>([\\s\\S]*?)<\\/${tagName}>`);
const safe = escapeRegex(tagName);
const regex = new RegExp(`<${safe}[^>]*>([\\s\\S]*?)<\\/${safe}>`);
const match = text.match(regex);
return match ? match[1] : null;
}
function opt_extractFullTagBlock(text, tagName) {
const regex = new RegExp(`(<${tagName}[^>]*>[\\s\\S]*?<\\/${tagName}>)`);
const safe = escapeRegex(tagName);
const regex = new RegExp(`(<${safe}[^>]*>[\\s\\S]*?<\\/${safe}>)`);
const match = text.match(regex);
return match ? match[0] : null;
}
function opt_replaceContentByTag(originalText, tagName, newContent) {
const regex = new RegExp(`(<${tagName}[^>]*>)([\\s\\S]*?)(<\\/${tagName}>)`);
const safe = escapeRegex(tagName);
const regex = new RegExp(`(<${safe}[^>]*>)([\\s\\S]*?)(<\\/${safe}>)`);
const match = originalText.match(regex);
if (match) {