Update blogger

This commit is contained in:
Xuan Sang LE 2021-02-06 18:46:54 +01:00
parent b0c2e088f9
commit 6434bbd8b4
8 changed files with 67 additions and 49 deletions

View File

@ -6,6 +6,7 @@ Blackend for my blog at https://blog.iohub.dev
## Change logs ## Change logs
### v0.2.x-a ### v0.2.x-a
* Patch 7: Fix sendmail API security bug
* Patch 6: Chage libraries load order * Patch 6: Chage libraries load order
* Patch 5: Add user photo to portfolio * Patch 5: Add user photo to portfolio
* Patch 4: Add package dependencies * Patch 4: Add package dependencies

View File

@ -3,20 +3,28 @@ local data = ...
-- print(data.content) -- print(data.content)
local error_msg = {} local error_msg = {}
local iserror = false local iserror = false
for k,v in pairs(data.to) do local tmp_name = "/tmp/"..os.time(os.date("!*t"))
print("sent to:"..v) local file = io.open (tmp_name , "w")
local to = v if file then
local from = "From: mrsang@lxsang.me\n" file:write("From: mrsang@lxsang.me\n")
local suject = "Subject: " .. data.title .. "\n" file:write("Subject: " .. data.title .. "\n")
local content = data.content.."\n" file:write( data.content.."\n")
local cmd = 'echo "' .. utils.escape(from .. suject .. content) .. '"| sendmail ' .. to file:close()
--print(cmd) for k,v in pairs(data.to) do
local r = os.execute(cmd) print("sent to:"..v)
if not r then local to = v
iserror = true local cmd = 'cat ' ..tmp_name .. '| sendmail ' .. to
table.insert(error_msg, v) --print(cmd)
print("Unable to send mail to: "..v) 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 end
else
iserror = true
table.insert(error_msg, "Cannot create mail file")
end end
local result = {} local result = {}
result.error = iserror result.error = iserror

View File

@ -6,6 +6,7 @@ Blackend for my blog at https://blog.iohub.dev
## Change logs ## Change logs
### v0.2.x-a ### v0.2.x-a
* Patch 7: Fix sendmail API security bug
* Patch 6: Chage libraries load order * Patch 6: Chage libraries load order
* Patch 5: Add user photo to portfolio * Patch 5: Add user photo to portfolio
* Patch 4: Add package dependencies * Patch 4: Add package dependencies

View File

@ -6,7 +6,7 @@
"author": "Xuan Sang LE", "author": "Xuan Sang LE",
"email": "xsang.le@gmail.com" "email": "xsang.le@gmail.com"
}, },
"version":"0.2.6-a", "version":"0.2.7-a",
"category":"Internet", "category":"Internet",
"iconclass":"fa fa-book", "iconclass":"fa fa-book",
"dependencies": ["SimpleMDE@1.11.2-r","Katex@0.11.1-r"], "dependencies": ["SimpleMDE@1.11.2-r","Katex@0.11.1-r"],

View File

@ -3,20 +3,28 @@ local data = ...
-- print(data.content) -- print(data.content)
local error_msg = {} local error_msg = {}
local iserror = false local iserror = false
for k,v in pairs(data.to) do local tmp_name = "/tmp/"..os.time(os.date("!*t"))
print("sent to:"..v) local file = io.open (tmp_name , "w")
local to = v if file then
local from = "From: mrsang@lxsang.me\n" file:write("From: mrsang@lxsang.me\n")
local suject = "Subject: " .. data.title .. "\n" file:write("Subject: " .. data.title .. "\n")
local content = data.content.."\n" file:write( data.content.."\n")
local cmd = 'echo "' .. utils.escape(from .. suject .. content) .. '"| sendmail ' .. to file:close()
--print(cmd) for k,v in pairs(data.to) do
local r = os.execute(cmd) print("sent to:"..v)
if not r then local to = v
iserror = true local cmd = 'cat ' ..tmp_name .. '| sendmail ' .. to
table.insert(error_msg, v) --print(cmd)
print("Unable to send mail to: "..v) 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 end
else
iserror = true
table.insert(error_msg, "Cannot create mail file")
end end
local result = {} local result = {}
result.error = iserror result.error = iserror

Binary file not shown.

View File

@ -6,7 +6,7 @@
"author": "Xuan Sang LE", "author": "Xuan Sang LE",
"email": "xsang.le@gmail.com" "email": "xsang.le@gmail.com"
}, },
"version":"0.2.6-a", "version":"0.2.7-a",
"category":"Internet", "category":"Internet",
"iconclass":"fa fa-book", "iconclass":"fa fa-book",
"dependencies": ["SimpleMDE@1.11.2-r","Katex@0.11.1-r"], "dependencies": ["SimpleMDE@1.11.2-r","Katex@0.11.1-r"],

View File

@ -55,7 +55,7 @@
"description": "https://raw.githubusercontent.com/lxsang/antosdk-apps/master/Blogger/README.md", "description": "https://raw.githubusercontent.com/lxsang/antosdk-apps/master/Blogger/README.md",
"category": "Internet", "category": "Internet",
"author": "Xuan Sang LE", "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"], "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" "download": "https://raw.githubusercontent.com/lxsang/antosdk-apps/master/Blogger/build/release/Blogger.zip"
}, },
@ -129,26 +129,6 @@
"dependencies": [], "dependencies": [],
"download": "https://raw.githubusercontent.com/lxsang/antosdk-apps/master/Katex/build/release/Katex.zip" "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", "pkgname": "LuaPlayground",
"name": "LuaPlayground", "name": "LuaPlayground",
@ -259,6 +239,26 @@
"dependencies": [], "dependencies": [],
"download": "https://raw.githubusercontent.com/lxsang/antosdk-apps/master/VizApp/build/release/VizApp.zip" "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", "pkgname": "vTerm",
"name": "Virtual Terminal", "name": "Virtual Terminal",