From 9606edaf4de6bf763ad20671e6b6313feeb13e9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Fri, 18 Feb 2022 16:14:18 +0800 Subject: telemetry occlusion path --- script/service/telemetry.lua | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'script') diff --git a/script/service/telemetry.lua b/script/service/telemetry.lua index 1b3e2972..d1bf7680 100644 --- a/script/service/telemetry.lua +++ b/script/service/telemetry.lua @@ -59,12 +59,28 @@ local function pushVersion(link) )) end +local function occlusionPath(str) + return str:gsub('[^"\r\n]+', function (chunk) + if not chunk:find '[/\\]' then + return + end + local newStr, count = chunk:gsub('.+([/\\]script[/\\])', '***%1') + if count > 0 then + return newStr + elseif chunk:find '^%u:' + or chunk:sub(1, 1) == '/' then + return '***' + end + end) +end + local function pushErrorLog(link) - if not log.firstError then + local err = log.firstError + if not err then return end - local err = log.firstError log.firstError = nil + err = occlusionPath(err) send(link, string.pack('zzzz' , 'error' , token -- cgit v1.2.3