: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 () | rawset(__BUNDLER_FILES, "updater", function () | ||||||
|     local log = require("log"); |     local log = require("log"); | ||||||
|     local json = require("json"); |     local json = require("json"); | ||||||
|  |     local notifier = require("notifier"); | ||||||
|     local _; |     local _; | ||||||
|     local updater  = {}; |     local updater  = {}; | ||||||
|     updater.__index = updater; |     updater.__index = updater; | ||||||
|  | @ -420,12 +421,23 @@ rawset(__BUNDLER_FILES, "updater", function () | ||||||
|         local fd = fs.open(path, "w"); |         local fd = fs.open(path, "w"); | ||||||
|         fd.write(body); |         fd.write(body); | ||||||
|         fd.close(); |         fd.close(); | ||||||
|  |         local notif = "Computer #" .. tostring( os.getComputerID() ) .. " updating"; | ||||||
|  |         notifier.notify("default", notif); | ||||||
|         log.debug("New update written to disk (" .. path .. ")"); |         log.debug("New update written to disk (" .. path .. ")"); | ||||||
|     end |     end | ||||||
|     function updater:notify() |  | ||||||
|     end |  | ||||||
|     return updater; |     return updater; | ||||||
| end) | 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 | if pcall(debug.getlocal, 4, 1) then | ||||||
|     local exports = {}; |     local exports = {}; | ||||||
|     for k, v in pairs(__BUNDLER_FILES) do |     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 log = require("log"); | ||||||
| local json = require("json"); | local json = require("json"); | ||||||
|  | local notifier = require("notifier"); | ||||||
| 
 | 
 | ||||||
| --- @class UpdaterEntry | --- @class UpdaterEntry | ||||||
| --- @field url string | --- @field url string | ||||||
|  | @ -108,11 +109,11 @@ function updater:update(path, url) | ||||||
|     local fd = fs.open(path, "w"); |     local fd = fs.open(path, "w"); | ||||||
|     fd.write(body); |     fd.write(body); | ||||||
|     fd.close(); |     fd.close(); | ||||||
|  | 
 | ||||||
|  |     local notif = "Computer #" .. tostring( os.getComputerID() ) .. " updating"; | ||||||
|  |     notifier.notify("default", notif); | ||||||
|     log.debug("New update written to disk (" .. path .. ")"); |     log.debug("New update written to disk (" .. path .. ")"); | ||||||
| end | end | ||||||
| 
 | 
 | ||||||
| function updater:notify() |  | ||||||
|     -- http.post(config.ntfy_url, "Computer #" .. tostring( os.getComputerID() ) .. " updating") |  | ||||||
| end |  | ||||||
| 
 | 
 | ||||||
| return updater; | return updater; | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user