浏览代码

:wastebasket: LuatOS JSON 换行 bug 已修复, 删除手动替换的代码, https://github.com/openLuat/LuatOS/commit/4beac0be5913b4c566984f5658c035c562edd640

Mizore 1 年之前
父节点
当前提交
1c809d3d3d
共有 1 个文件被更改,包括 5 次插入5 次删除
  1. 5 5
      script/util_notify.lua

+ 5 - 5
script/util_notify.lua

@@ -68,7 +68,7 @@ local notify = {
         local header = { ["content-type"] = "application/json" }
         local body = { ["chat_id"] = config.TELEGRAM_CHAT_ID, ["disable_web_page_preview"] = true, ["text"] = msg }
         local json_data = json.encode(body)
-        json_data = string.gsub(json_data, "\\b", "\\n")
+        -- json_data = string.gsub(json_data, "\\b", "\\n")
 
         log.info("util_notify", "POST", config.TELEGRAM_API)
         return util_http.fetch(nil, "POST", config.TELEGRAM_API, header, json_data)
@@ -88,7 +88,7 @@ local notify = {
         local header = { ["Content-Type"] = "application/json; charset=utf-8" }
         local body = { title = config.GOTIFY_TITLE, message = msg, priority = config.GOTIFY_PRIORITY }
         local json_data = json.encode(body)
-        json_data = string.gsub(json_data, "\\b", "\\n")
+        -- json_data = string.gsub(json_data, "\\b", "\\n")
 
         log.info("util_notify", "POST", config.GOTIFY_API)
         return util_http.fetch(nil, "POST", url, header, json_data)
@@ -161,7 +161,7 @@ local notify = {
         local body = { msg_type = "text", content = { text = msg } }
         local json_data = json.encode(body)
         -- LuatOS Bug, json.encode 会将 \n 转换为 \b
-        json_data = string.gsub(json_data, "\\b", "\\n")
+        -- json_data = string.gsub(json_data, "\\b", "\\n")
 
         log.info("util_notify", "POST", config.FEISHU_WEBHOOK)
         return util_http.fetch(nil, "POST", config.FEISHU_WEBHOOK, header, json_data)
@@ -177,7 +177,7 @@ local notify = {
         local body = { msgtype = "text", text = { content = msg } }
         local json_data = json.encode(body)
         -- LuatOS Bug, json.encode 会将 \n 转换为 \b
-        json_data = string.gsub(json_data, "\\b", "\\n")
+        -- json_data = string.gsub(json_data, "\\b", "\\n")
 
         log.info("util_notify", "POST", config.WECOM_WEBHOOK)
         return util_http.fetch(nil, "POST", config.WECOM_WEBHOOK, header, json_data)
@@ -198,7 +198,7 @@ local notify = {
 
         local json_data = json.encode(body)
         -- LuatOS Bug, json.encode 会将 \n 转换为 \b
-        json_data = string.gsub(json_data, "\\b", "\\n")
+        -- json_data = string.gsub(json_data, "\\b", "\\n")
 
         local url = "https://api.pushover.net/1/messages.json"