MCPcopy
hub / github.com/CopyTranslator/CopyTranslator / checkList

Function checkList

src/main/focus-handler.ts:7–25  ·  view source on GitHub ↗
(windowName: string, identifier: BlackWhiteType)

Source from the content-addressed store, hash-verified

5
6//检查该窗口是否在白名单内
7function checkList(windowName: string, identifier: BlackWhiteType): boolean {
8 const mode = config.get(`${identifier}Mode` as Identifier) as string;
9 if (mode.indexOf("Global") != -1) {
10 return true;
11 }
12 if (mode.indexOf("WhiteList") != -1) {
13 const whitelist = config.get(
14 `${identifier}WhiteList` as Identifier
15 ) as string[];
16 return whitelist.includes(windowName);
17 }
18 if (mode.indexOf("BlackList") != -1) {
19 const blacklist = config.get(
20 `${identifier}BlackList` as Identifier
21 ) as string[];
22 return !blacklist.includes(windowName);
23 }
24 throw "Unknown Mode";
25}
26
27//注册该窗口,同时检查是否是在白名单内
28export async function isValidWindow(

Callers 1

isValidWindowFunction · 0.85

Calls 1

getMethod · 0.45

Tested by

no test coverage detected