2021-04-10 21:27:27 +00:00
|
|
|
import config from '../../config'
|
|
|
|
import replace from './replace'
|
|
|
|
let SensitiveStrings = [
|
|
|
|
config.token,
|
|
|
|
config.supabase.key,
|
|
|
|
config.supabase.url,
|
|
|
|
config.apis.sheri,
|
|
|
|
config.apis.yiffrest,
|
2021-07-08 11:59:37 +00:00
|
|
|
config.trello.key,
|
|
|
|
config.trello.token,
|
2021-04-10 21:27:27 +00:00
|
|
|
].flat(Infinity)
|
|
|
|
|
|
|
|
|
|
|
|
export default function clean(content: any) {
|
|
|
|
let type = content
|
|
|
|
if (typeof type === 'object') {
|
|
|
|
content = JSON.stringify(content)
|
|
|
|
}
|
|
|
|
let regex = new RegExp(`(${SensitiveStrings.join("|")})`, "gi")
|
|
|
|
content = replace(regex, "*snip*", content)
|
|
|
|
if (typeof type === 'object') {
|
|
|
|
content = JSON.parse(content)
|
|
|
|
}
|
|
|
|
return content
|
|
|
|
}
|