From 9630d66d18385898fbc842644a1dea7ae1f5939f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=95=EB=8B=A4=ED=98=84?= Date: Mon, 2 Mar 2026 08:07:45 +0000 Subject: [PATCH] Add patch.ps1 --- patch.ps1 | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 patch.ps1 diff --git a/patch.ps1 b/patch.ps1 new file mode 100644 index 0000000..93df20f --- /dev/null +++ b/patch.ps1 @@ -0,0 +1,60 @@ +$ErrorActionPreference = "Stop" + +$ResourcesDir = Join-Path $env:LOCALAPPDATA "Programs\Mingo\resources" +$AsarPath = Join-Path $ResourcesDir "app.asar" +$BackupPath = Join-Path $ResourcesDir ("app.asar.bak-" + (Get-Date -Format "yyyyMMdd-HHmmss")) +$UnpackedDir = Join-Path $ResourcesDir "app_unpacked" +$AssetsDir = Join-Path $UnpackedDir "out\renderer\assets" + +$MonoValue = '"D2Coding", Consolas, monospace' +$UiValue = '"Asta Sans","Microsoft GothicNeo","Segoe UI","Malgun Gothic",sans-serif' + +# 1. Backup +Copy-Item $AsarPath $BackupPath -Force +Write-Host "Backup created: $BackupPath" + +# 2. Extract +if (Test-Path $UnpackedDir) { + Remove-Item $UnpackedDir -Recurse -Force +} +New-Item -ItemType Directory -Path $UnpackedDir | Out-Null +asar extract $AsarPath $UnpackedDir + +# 3. Find CSS +$CssFile = Get-ChildItem $AssetsDir -Filter "index-*.css" | + Sort-Object Length -Descending | + Select-Object -First 1 + +if (-not $CssFile) { + throw "index-*.css not found." +} + +$CssPath = $CssFile.FullName +Write-Host "Patching CSS: $CssPath" + +$Content = Get-Content $CssPath -Raw + +# Replace mono variable +$Content = [regex]::Replace( + $Content, + '(?m)^\s*--font-family-mono\s*:\s*[^;]+;\s*$', + " --font-family-mono: $MonoValue;", + 1 +) + +# Replace body font-family inside body block +$Content = [regex]::Replace( + $Content, + '(?ms)(body\s*\{.*?)(^\s*font-family\s*:\s*[^;]+;\s*$)(.*?\})', + "`$1 font-family: $UiValue;`n`$3", + 1 +) + +Set-Content -Path $CssPath -Value $Content -Encoding UTF8 + +# 4. Pack +Set-Location $ResourcesDir +asar pack $UnpackedDir $AsarPath + +Write-Host "Done ✅" +Write-Host "If anything breaks, restore: $BackupPath" \ No newline at end of file