MCPcopy Create free account
hub / github.com/hydro-dev/Hydro / SystemSetting

Function SystemSetting

packages/hydrooj/src/model/setting.ts:209–224  ·  view source on GitHub ↗
(...settings: _Setting[] | Schema<any>[])

Source from the content-addressed store, hash-verified

207 };
208};
209export const SystemSetting = (...settings: _Setting[] | Schema<any>[]) => {
210 settings = settings.flatMap((s) => (s instanceof Schema ? schemaToSettings(s) : s) as _Setting[]);
211 for (const setting of settings) {
212 if (SYSTEM_SETTINGS.find((s) => s.key === setting.key)) logger.warn(`Duplicate setting key: ${setting.key}`);
213 SYSTEM_SETTINGS.push(setting);
214 SYSTEM_SETTINGS_BY_KEY[setting.key] = setting;
215 }
216 return () => {
217 for (const setting of settings) {
218 delete SYSTEM_SETTINGS_BY_KEY[setting.key];
219 if (SYSTEM_SETTINGS.includes(setting)) {
220 SYSTEM_SETTINGS.splice(SYSTEM_SETTINGS.indexOf(setting), 1);
221 }
222 }
223 };
224};
225
226const LangSettingNode = {
227 family: 'setting_usage',

Callers 1

setting.tsFile · 0.85

Calls 4

schemaToSettingsFunction · 0.85
findMethod · 0.80
warnMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected