Sources: add Gitea; fix Windows shims for shell tool, repo paths and stateDir

This commit is contained in:
dev
2026-11-01 19:32:40 +08:00
committed by Wanderingss
parent 6337fc823c
commit 4379973775
22 changed files with 1182 additions and 28 deletions
+20
View File
@@ -0,0 +1,20 @@
// Collapses every run of 2+ literal backslashes to one in the gitea source files (over-escaped writes).
import fs from 'node:fs'
const B = String.fromCharCode(92)
const files = ['gitea-api.ts', 'gitea.ts', 'gitea-trigger.ts', 'gitea-channel.ts']
for (const f of files) {
const path = 'src/sources/' + f
const before = fs.readFileSync(path, 'utf8')
let after = before
while (after.includes(B + B)) after = after.split(B + B).join(B)
if (after !== before) {
fs.writeFileSync(path, after)
console.log(f, 'collapsed', (before.length - after.length), 'bytes')
} else console.log(f, 'clean')
}
for (const f of files) {
const t = fs.readFileSync('src/sources/' + f, 'utf8')
const remaining = t.split(B + B).length - 1
const quotes = t.split(B + String.fromCharCode(39)).length - 1
console.log(f, 'remaining double:', remaining, 'escaped-quote sites:', quotes)
}