support escaping in plugin.description for disabled plugins

Massimo Melina committed Apr 26, 2022 at 14:00 UTC 19a8b1121bc0a2a83c8dbb5b53e2de159b65331c
1 file changed +4 -1
server/src/plugins.ts
+4 -1
@@ -158,7 +158,10 @@ async function rescan() {
158 const pl = foundDisabled[id] = { id } as typeof foundDisabled[0]
159 try {
160 const source = await readFile(f, 'utf8')
161 - pl.description = /exports.description *= *"([^"]*)"/.exec(source)?.[1]
161 + const v = pl.description = /exports.description *= *"(.*)"/.exec(source)?.[1]
162 + if (v)
163 + try { pl.description = JSON.parse(`"${v}"`) }
164 + catch {}
165 pl.version = Number(/exports.version *= *(\d+)/.exec(source)?.[1]) || undefined
166 pl.apiRequired = Number(/exports.apiRequired *= *(\d+)/.exec(source)?.[1]) || undefined
167 }