MCPcopy Create free account
hub / github.com/TeleBoxOrg/TeleBox_Plugins / loadRemoteMappings

Method loadRemoteMappings

subinfo/subinfo.ts:318–338  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

316
317 // 加载远程配置映射
318 private async loadRemoteMappings(): Promise<number> {
319 try {
320 const response = await axios.get(REMOTE_MAPPINGS_URL, { timeout: 10000 });
321 const content = response.data as string;
322 const mappings: Record<string, string> = {};
323 content.split('\n').forEach(line => {
324 const trimmed = line.trim();
325 if (trimmed && !trimmed.startsWith('#')) {
326 const equalsIndex = trimmed.indexOf('=');
327 if (equalsIndex > 0) {
328 mappings[trimmed.substring(0, equalsIndex).trim()] = trimmed.substring(equalsIndex + 1).trim();
329 }
330 }
331 });
332 REMOTE_CONFIG_MAPPINGS = mappings;
333 return Object.keys(REMOTE_CONFIG_MAPPINGS).length;
334 } catch (error) {
335 // 忽略加载失败
336 return 0;
337 }
338 }
339
340 // 从映射中获取配置名称
341 private getConfigNameFromMappings(url: string): string | null {

Callers 2

handleSubinfoMethod · 0.95
handleChaMethod · 0.95

Calls 1

getMethod · 0.45

Tested by

no test coverage detected