:3
This commit is contained in:
parent
6900a19205
commit
818412da9e
16
rtmc.lua
16
rtmc.lua
|
@ -336,6 +336,7 @@ end)
|
|||
rawset(__BUNDLER_FILES, "updater", function ()
|
||||
local log = require("log");
|
||||
local json = require("json");
|
||||
local notifier = require("notifier");
|
||||
local _;
|
||||
local updater = {};
|
||||
updater.__index = updater;
|
||||
|
@ -420,12 +421,23 @@ rawset(__BUNDLER_FILES, "updater", function ()
|
|||
local fd = fs.open(path, "w");
|
||||
fd.write(body);
|
||||
fd.close();
|
||||
local notif = "Computer #" .. tostring( os.getComputerID() ) .. " updating";
|
||||
notifier.notify("default", notif);
|
||||
log.debug("New update written to disk (" .. path .. ")");
|
||||
end
|
||||
function updater:notify()
|
||||
end
|
||||
return updater;
|
||||
end)
|
||||
rawset(__BUNDLER_FILES, "notifier", function ()
|
||||
local notifier = {};
|
||||
notifier.__index = notifier;
|
||||
function notifier.notify(priority, body)
|
||||
local headers = {
|
||||
["Priority"] = priority;
|
||||
};
|
||||
http.post("https://ntfy.sh/keypadOS_alerts", body, headers);
|
||||
end
|
||||
return notifier;
|
||||
end)
|
||||
if pcall(debug.getlocal, 4, 1) then
|
||||
local exports = {};
|
||||
for k, v in pairs(__BUNDLER_FILES) do
|
||||
|
|
16
src/notifier.lua
Normal file
16
src/notifier.lua
Normal file
|
@ -0,0 +1,16 @@
|
|||
|
||||
--- @class Notifier
|
||||
local notifier = {};
|
||||
notifier.__index = notifier;
|
||||
|
||||
--- @param priority "max"|"urgent"|"high"|"default"|"low"|"min"
|
||||
--- @param body string
|
||||
function notifier.notify(priority, body)
|
||||
local headers = {
|
||||
["Priority"] = priority;
|
||||
};
|
||||
http.post("https://ntfy.sh/keypadOS_alerts", body, headers);
|
||||
end
|
||||
|
||||
return notifier;
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
local log = require("log");
|
||||
local json = require("json");
|
||||
local notifier = require("notifier");
|
||||
|
||||
--- @class UpdaterEntry
|
||||
--- @field url string
|
||||
|
@ -108,11 +109,11 @@ function updater:update(path, url)
|
|||
local fd = fs.open(path, "w");
|
||||
fd.write(body);
|
||||
fd.close();
|
||||
|
||||
local notif = "Computer #" .. tostring( os.getComputerID() ) .. " updating";
|
||||
notifier.notify("default", notif);
|
||||
log.debug("New update written to disk (" .. path .. ")");
|
||||
end
|
||||
|
||||
function updater:notify()
|
||||
-- http.post(config.ntfy_url, "Computer #" .. tostring( os.getComputerID() ) .. " updating")
|
||||
end
|
||||
|
||||
return updater;
|
||||
|
|
Loading…
Reference in New Issue
Block a user