Files
SingBox-Gopanel/scratch/patch_bundle.ps1
CN-JS-HuiBai 9c28e65775
Some checks failed
build / build (api, amd64, linux) (push) Failing after -49s
build / build (api, arm64, linux) (push) Failing after -51s
build / build (api.exe, amd64, windows) (push) Failing after -51s
修复无法单击的错误
2026-04-18 12:17:24 +08:00

20 lines
969 B
PowerShell

$filePath = "d:\Development\SingBox-Gopanel\frontend\admin\reverse\output\index-CO3BwsT2.pretty.js"
# Read file
$content = [System.IO.File]::ReadAllText($filePath)
# Regex patterns (escaping literals to handle parens and braces correctly)
$t1 = [regex]::Escape("Q.jsx(Lot, {") + "\s+" + [regex]::Escape("asChild: !0,") + "\s+" + [regex]::Escape("children: Q.jsx(Nm, {")
$r1 = "Q.jsx(Lot, { asChild: !0, onClick: (e) => (e.stopPropagation(), e.preventDefault()), children: Q.jsx(Nm, {"
$t2 = [regex]::Escape("onSelect: (e) => {") + "\s+" + [regex]::Escape("(e.preventDefault(), l());")
$r2 = "onSelect: (e) => { (e.preventDefault(), e.stopPropagation(), l());"
# Perform replacements
$content = [System.Text.RegularExpressions.Regex]::Replace($content, $t1, $r1)
$content = [System.Text.RegularExpressions.Regex]::Replace($content, $t2, $r2)
# Write back
[System.IO.File]::WriteAllText($filePath, $content)
Write-Output "Patch applied successfully (Regex Escaped)"