From 6434bbd8b4210e7876d553d24300c95188329c21 Mon Sep 17 00:00:00 2001 From: Xuan Sang LE Date: Sat, 6 Feb 2021 18:46:54 +0100 Subject: [PATCH] Update blogger --- Blogger/README.md | 1 + Blogger/api/sendmail.lua | 34 +++++++++++++++--------- Blogger/build/debug/README.md | 1 + Blogger/build/debug/package.json | 2 +- Blogger/build/debug/sendmail.lua | 34 +++++++++++++++--------- Blogger/build/release/Blogger.zip | Bin 30359 -> 30607 bytes Blogger/package.json | 2 +- packages.json | 42 +++++++++++++++--------------- 8 files changed, 67 insertions(+), 49 deletions(-) diff --git a/Blogger/README.md b/Blogger/README.md index 33b2f09..2c958fe 100644 --- a/Blogger/README.md +++ b/Blogger/README.md @@ -6,6 +6,7 @@ Blackend for my blog at https://blog.iohub.dev ## Change logs ### v0.2.x-a +* Patch 7: Fix sendmail API security bug * Patch 6: Chage libraries load order * Patch 5: Add user photo to portfolio * Patch 4: Add package dependencies diff --git a/Blogger/api/sendmail.lua b/Blogger/api/sendmail.lua index 26e370b..6e8aab4 100644 --- a/Blogger/api/sendmail.lua +++ b/Blogger/api/sendmail.lua @@ -3,20 +3,28 @@ local data = ... -- print(data.content) local error_msg = {} local iserror = false -for k,v in pairs(data.to) do - print("sent to:"..v) - local to = v - local from = "From: mrsang@lxsang.me\n" - local suject = "Subject: " .. data.title .. "\n" - local content = data.content.."\n" - local cmd = 'echo "' .. utils.escape(from .. suject .. content) .. '"| sendmail ' .. to - --print(cmd) - local r = os.execute(cmd) - if not r then - iserror = true - table.insert(error_msg, v) - print("Unable to send mail to: "..v) +local tmp_name = "/tmp/"..os.time(os.date("!*t")) +local file = io.open (tmp_name , "w") +if file then + file:write("From: mrsang@lxsang.me\n") + file:write("Subject: " .. data.title .. "\n") + file:write( data.content.."\n") + file:close() + for k,v in pairs(data.to) do + print("sent to:"..v) + local to = v + local cmd = 'cat ' ..tmp_name .. '| sendmail ' .. to + --print(cmd) + local r = os.execute(cmd) + if not r then + iserror = true + table.insert(error_msg, v) + print("Unable to send mail to: "..v) + end end +else + iserror = true + table.insert(error_msg, "Cannot create mail file") end local result = {} result.error = iserror diff --git a/Blogger/build/debug/README.md b/Blogger/build/debug/README.md index 33b2f09..2c958fe 100644 --- a/Blogger/build/debug/README.md +++ b/Blogger/build/debug/README.md @@ -6,6 +6,7 @@ Blackend for my blog at https://blog.iohub.dev ## Change logs ### v0.2.x-a +* Patch 7: Fix sendmail API security bug * Patch 6: Chage libraries load order * Patch 5: Add user photo to portfolio * Patch 4: Add package dependencies diff --git a/Blogger/build/debug/package.json b/Blogger/build/debug/package.json index a1ad299..0531786 100644 --- a/Blogger/build/debug/package.json +++ b/Blogger/build/debug/package.json @@ -6,7 +6,7 @@ "author": "Xuan Sang LE", "email": "xsang.le@gmail.com" }, - "version":"0.2.6-a", + "version":"0.2.7-a", "category":"Internet", "iconclass":"fa fa-book", "dependencies": ["SimpleMDE@1.11.2-r","Katex@0.11.1-r"], diff --git a/Blogger/build/debug/sendmail.lua b/Blogger/build/debug/sendmail.lua index 26e370b..6e8aab4 100644 --- a/Blogger/build/debug/sendmail.lua +++ b/Blogger/build/debug/sendmail.lua @@ -3,20 +3,28 @@ local data = ... -- print(data.content) local error_msg = {} local iserror = false -for k,v in pairs(data.to) do - print("sent to:"..v) - local to = v - local from = "From: mrsang@lxsang.me\n" - local suject = "Subject: " .. data.title .. "\n" - local content = data.content.."\n" - local cmd = 'echo "' .. utils.escape(from .. suject .. content) .. '"| sendmail ' .. to - --print(cmd) - local r = os.execute(cmd) - if not r then - iserror = true - table.insert(error_msg, v) - print("Unable to send mail to: "..v) +local tmp_name = "/tmp/"..os.time(os.date("!*t")) +local file = io.open (tmp_name , "w") +if file then + file:write("From: mrsang@lxsang.me\n") + file:write("Subject: " .. data.title .. "\n") + file:write( data.content.."\n") + file:close() + for k,v in pairs(data.to) do + print("sent to:"..v) + local to = v + local cmd = 'cat ' ..tmp_name .. '| sendmail ' .. to + --print(cmd) + local r = os.execute(cmd) + if not r then + iserror = true + table.insert(error_msg, v) + print("Unable to send mail to: "..v) + end end +else + iserror = true + table.insert(error_msg, "Cannot create mail file") end local result = {} result.error = iserror diff --git a/Blogger/build/release/Blogger.zip b/Blogger/build/release/Blogger.zip index 07769d6cb760c3140a5d8d6b053fb1e1f7168a70..5571e960710fa440ca033e51a64836355f58daf0 100644 GIT binary patch delta 992 zcmZWo&1(}u6rbHBwWc3>NUdm#lU2w@>{RTb8Yvnrv64eW4%LGsY&X+%ad)=v&NeBC zJ$oo6jNqXNihqD$4nohO7pow6@Teyd`~XkhoVT&tqg_M{V`>a?{;uw%26l^l*eJX#FAT=y*?v0rt}nc7tIzVo(o_C; zF?FLHL#P~U9ba0vUDL2JcUG#*a44R^+N3llH9}mUaLb{(JZlE0x|Tl6wQM%oiCD61 zKwByd zxDPAhO8W8vFP0q{#B>>_j1!{uMw+(kQ@s<^dXR2yjn^UT|507p_G(yW&uKa}>CKo1 z#~DmWGz=j)bANCD@C|b}3Z9r)@hrx58Q!TTwiWFdq?O|{mtzk{^Na7wDUnb!LRTk7 z03shXOav#jeVPfQ_pj~s^iz?Qm-2fGMXNhkAXuvz)H2OxUJqA zQq&ZR7$zO+_6i=9#F_WM?na55YUlai;LXq3Eaa+$;rbJ04|>sVka0~ z2hizn`OOz8gg^&+K%!qZVJ=gL9%uom*eL#;o07FbC9+HIj?2ajixJcJyBmk7uWw%+ zdESQ*=+WV>AcS6LMJpJ?A|c~Nc|)<{5gkhnxx!rI(u;lc$8FwzxDaHMs<+dU8my zVm*>Xa(-S(Y92@?C9xz?56ackQ$p3BoSOnvqMn+Zk*}bnuArx>R-oSayY zssVNiP!MVjkOehJ6QopKsYanVH7_MMF*8R2sF_s{=ozlb4kew@jL8vd83KWis_Bt_K>+2~!THll&PNf?OS4d|mZ& zQ;@9!d8*v|r-v~Q0|N+iplJIX2z6g_F^U6WL6OS{lm}uS20mncK5>(!%A`P{GdZtJ lTJ>=}14D6gMrv-VUPei7PJlNn8%Q+=5FP_+-dzIX0RZaCvIPJD diff --git a/Blogger/package.json b/Blogger/package.json index a1ad299..0531786 100644 --- a/Blogger/package.json +++ b/Blogger/package.json @@ -6,7 +6,7 @@ "author": "Xuan Sang LE", "email": "xsang.le@gmail.com" }, - "version":"0.2.6-a", + "version":"0.2.7-a", "category":"Internet", "iconclass":"fa fa-book", "dependencies": ["SimpleMDE@1.11.2-r","Katex@0.11.1-r"], diff --git a/packages.json b/packages.json index e6df81c..580e55c 100644 --- a/packages.json +++ b/packages.json @@ -55,7 +55,7 @@ "description": "https://raw.githubusercontent.com/lxsang/antosdk-apps/master/Blogger/README.md", "category": "Internet", "author": "Xuan Sang LE", - "version": "0.2.6-a", + "version": "0.2.7-a", "dependencies": ["SimpleMDE@1.11.2-r","Katex@0.11.1-r"],"mimes":["none"], "download": "https://raw.githubusercontent.com/lxsang/antosdk-apps/master/Blogger/build/release/Blogger.zip" }, @@ -129,26 +129,6 @@ "dependencies": [], "download": "https://raw.githubusercontent.com/lxsang/antosdk-apps/master/Katex/build/release/Katex.zip" }, - { - "pkgname": "libjpeg", - "name": "libjpeg", - "description": "https://raw.githubusercontent.com/lxsang/antosdk-apps/master/libjpeg/README.md", - "category": "Library", - "author": "", - "version": "0.1.1-a", - "dependencies": [], - "download": "https://raw.githubusercontent.com/lxsang/antosdk-apps/master/libjpeg/build/release/libjpeg.zip" - }, - { - "pkgname": "libwvnc", - "name": "libwvnc", - "description": "https://raw.githubusercontent.com/lxsang/antosdk-apps/master/libwvnc/README.md", - "category": "Library", - "author": "", - "version": "0.1.2-a", - "dependencies": ["libjpeg@0.1.1-a"], - "download": "https://raw.githubusercontent.com/lxsang/antosdk-apps/master/libwvnc/build/release/libwvnc.zip" - }, { "pkgname": "LuaPlayground", "name": "LuaPlayground", @@ -259,6 +239,26 @@ "dependencies": [], "download": "https://raw.githubusercontent.com/lxsang/antosdk-apps/master/VizApp/build/release/VizApp.zip" }, + { + "pkgname": "libjpeg", + "name": "libjpeg", + "description": "https://raw.githubusercontent.com/lxsang/antosdk-apps/master/libjpeg/README.md", + "category": "Library", + "author": "", + "version": "0.1.1-a", + "dependencies": [], + "download": "https://raw.githubusercontent.com/lxsang/antosdk-apps/master/libjpeg/build/release/libjpeg.zip" + }, + { + "pkgname": "libwvnc", + "name": "libwvnc", + "description": "https://raw.githubusercontent.com/lxsang/antosdk-apps/master/libwvnc/README.md", + "category": "Library", + "author": "", + "version": "0.1.2-a", + "dependencies": ["libjpeg@0.1.1-a"], + "download": "https://raw.githubusercontent.com/lxsang/antosdk-apps/master/libwvnc/build/release/libwvnc.zip" + }, { "pkgname": "vTerm", "name": "Virtual Terminal",