MCPcopy Create free account
hub / github.com/zxlie/FeHelper / log

Function log

apps/background/monkey.js:499–509  ·  view source on GitHub ↗
(params)

Source from the content-addressed store, hash-verified

497
498/* ================== 日志收集 ================== */
499const log = (params) => {
500 if (!params) return;
501 chrome.storage.local.get(PAGE_MONKEY_LOG_KEY, resps => {
502 let arr = [];
503 try { arr = JSON.parse((resps && resps[PAGE_MONKEY_LOG_KEY]) || '[]'); } catch (e) {}
504 arr.push(Object.assign({ time: Date.now() }, params));
505 if (arr.length > 300) arr = arr.slice(-300);
506 let data = {}; data[PAGE_MONKEY_LOG_KEY] = JSON.stringify(arr);
507 chrome.storage.local.set(data);
508 });
509};
510
511/* ================== @require 白名单校验 ================== */
512// 桥接器代理 fetch 容易被恶意页面滥用做任意 URL 代理(绕过 CORS),

Callers 3

_injectCssFunction · 0.70
_injectLogBridgeFunction · 0.70
execFunction · 0.70

Calls 3

setMethod · 0.80
getMethod · 0.45
parseMethod · 0.45

Tested by

no test coverage detected