forked from lunanting/cangku
38 lines
951 B
JavaScript
38 lines
951 B
JavaScript
'use strict';
|
|
|
|
const PROTECTED_SYSTEM_CONFIG_KEYS = new Set([
|
|
'alibaba_1688_image_search_config',
|
|
'openclaw_chat_config',
|
|
'selection_fission_ai_analysis_config',
|
|
'selection_similar_products_config',
|
|
]);
|
|
|
|
const PUBLIC_SYSTEM_CONFIG_KEYS = new Set([
|
|
'copyright',
|
|
'default_theme',
|
|
'favicon',
|
|
'logo',
|
|
'setup_completed',
|
|
'setup_completed_at',
|
|
'sidebar_navigation',
|
|
'site_description',
|
|
'site_name',
|
|
]);
|
|
|
|
function isProtectedSystemConfigKey(value) {
|
|
const key = String(value || '').trim();
|
|
return PROTECTED_SYSTEM_CONFIG_KEYS.has(key)
|
|
|| /(?:password|secret|token|credential|api[_-]?key|access[_-]?key)/i.test(key);
|
|
}
|
|
|
|
function filterPublicSystemConfigs(configs = []) {
|
|
return configs.filter((config) => PUBLIC_SYSTEM_CONFIG_KEYS.has(String(config?.config_key || '').trim()));
|
|
}
|
|
|
|
module.exports = {
|
|
PUBLIC_SYSTEM_CONFIG_KEYS,
|
|
PROTECTED_SYSTEM_CONFIG_KEYS,
|
|
filterPublicSystemConfigs,
|
|
isProtectedSystemConfigKey,
|
|
};
|