Files
opencloud/services/groupware/apidoc-postprocess-html.ts
Pascal Bleser 76695c068d groupware: fix typos and minor issues
- fix a bunch of minor issues and typos that were found using GoLand
   and gosec

 - add a gosec Makefile target for Groupware related files, in
   services/groupware/Makefile

 - enable checking JMAP session capabilities for events and contacts,
   and only enable skipping that check for tasks until those are
   implemented in Stalwart as well

 - fix a CWE-190 (integer overflow or wraparound) found by gosec

 - consistently use struct references for methods of Groupware and
   Request, instead of mixing up references and copies

 - always log errors when unable to register a Prometheus metric
2026-04-13 16:40:15 +02:00

25 lines
675 B
TypeScript

import * as fs from 'fs'
import * as cheerio from 'cheerio'
const faviconFile = process.argv[2]
const favicon = fs.readFileSync(faviconFile).toString('base64')
let html = ''
process.stdin.on('data', (chunk) => {
html += chunk.toString()
})
process.stdin.on('end', () => {
try {
const $ = cheerio.load(html)
$('head').append(`<link rel="icon" href="data:image/png;base64,${favicon}">`)
process.stdout.write($.html())
process.stdout.write("\n")
} catch (error) {
if (error instanceof Error) {
console.error(`Error occurred while post-processing HTML: ${error.message}`)
} else {
console.error("Unknown error occurred")
}
}
});