Compare commits
No commits in common. "dfa9e305ab8179de67342645bb20401170836fcd" and "ffa88f010c40cfa3e70b01d7581bda9c2b071350" have entirely different histories.
dfa9e305ab
...
ffa88f010c
23
bindings.lua
23
bindings.lua
|
@ -1,23 +0,0 @@
|
||||||
--- @class Exports
|
|
||||||
--- @field log Logger
|
|
||||||
--- @field updater Updater
|
|
||||||
--- @field notifier Notifier
|
|
||||||
--- @field json JsonParser
|
|
||||||
|
|
||||||
|
|
||||||
--- @class Logger
|
|
||||||
--- @field error fun(...)
|
|
||||||
--- @field warn fun(...)
|
|
||||||
--- @field info fun(...)
|
|
||||||
--- @field debug fun(...)
|
|
||||||
|
|
||||||
--- @class Updater
|
|
||||||
--- @field addEntry fun(path: string, branch: string, url: string)
|
|
||||||
|
|
||||||
--- @class JsonParser
|
|
||||||
--- @field decode fun(s: string): table
|
|
||||||
--- @field encode fun(s: table): string
|
|
||||||
|
|
||||||
--- @class Notifier
|
|
||||||
--- @field notify fun(priority: "1"|"2"|"3"|"4"|"5", body: string)
|
|
||||||
|
|
17
rtmc.lua
17
rtmc.lua
|
@ -13,8 +13,6 @@ end
|
||||||
rawset(__BUNDLER_FILES, "main", function ()
|
rawset(__BUNDLER_FILES, "main", function ()
|
||||||
local updater = require("updater");
|
local updater = require("updater");
|
||||||
local log = require("log");
|
local log = require("log");
|
||||||
local notifier = require("notifier")
|
|
||||||
local json = require("json")
|
|
||||||
local MODULE_NAME = "keypadOS";
|
local MODULE_NAME = "keypadOS";
|
||||||
local MODULE_URL = "https://git.mcorangehq.xyz/xomf/keypadOS/raw/branch/keypad/keypadOS.lua";
|
local MODULE_URL = "https://git.mcorangehq.xyz/xomf/keypadOS/raw/branch/keypad/keypadOS.lua";
|
||||||
if not __VERSION then
|
if not __VERSION then
|
||||||
|
@ -30,20 +28,7 @@ rawset(__BUNDLER_FILES, "main", function ()
|
||||||
log.info("Starting bootloader (" .. __VERSION .. ")");
|
log.info("Starting bootloader (" .. __VERSION .. ")");
|
||||||
local upd = updater.new();
|
local upd = updater.new();
|
||||||
upd:addEntry(MODULE_NAME .. ".lua", "keypad", MODULE_URL);
|
upd:addEntry(MODULE_NAME .. ".lua", "keypad", MODULE_URL);
|
||||||
local lib_exports = {
|
parallel.waitForAny(function() updaterLoop(upd) end, require(MODULE_NAME))
|
||||||
log = log,
|
|
||||||
updater = upd,
|
|
||||||
notifier = notifier,
|
|
||||||
json = json
|
|
||||||
};
|
|
||||||
parallel.waitForAny(
|
|
||||||
function()
|
|
||||||
updaterLoop(upd)
|
|
||||||
end,
|
|
||||||
function ()
|
|
||||||
require(MODULE_NAME)(lib_exports);
|
|
||||||
end
|
|
||||||
);
|
|
||||||
end
|
end
|
||||||
local mod = {};
|
local mod = {};
|
||||||
mod.main = _start;
|
mod.main = _start;
|
||||||
|
|
|
@ -22,7 +22,6 @@
|
||||||
-- SOFTWARE.
|
-- SOFTWARE.
|
||||||
--
|
--
|
||||||
|
|
||||||
--- @class JsonParser
|
|
||||||
local json = { _version = "0.1.2" }
|
local json = { _version = "0.1.2" }
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
|
|
||||||
--- @class Logger
|
|
||||||
local log = {};
|
local log = {};
|
||||||
log.__index = log;
|
log.__index = log;
|
||||||
|
|
||||||
|
|
23
src/main.lua
23
src/main.lua
|
@ -1,7 +1,5 @@
|
||||||
local updater = require("updater");
|
local updater = require("updater");
|
||||||
local log = require("log");
|
local log = require("log");
|
||||||
local notifier = require("notifier")
|
|
||||||
local json = require("json")
|
|
||||||
|
|
||||||
local MODULE_NAME = "keypadOS";
|
local MODULE_NAME = "keypadOS";
|
||||||
local MODULE_URL = "https://git.mcorangehq.xyz/xomf/keypadOS/raw/branch/keypad/keypadOS.lua";
|
local MODULE_URL = "https://git.mcorangehq.xyz/xomf/keypadOS/raw/branch/keypad/keypadOS.lua";
|
||||||
|
@ -10,9 +8,6 @@ if not __VERSION then
|
||||||
__VERSION = "DEV";
|
__VERSION = "DEV";
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
--- @param upd Updater
|
--- @param upd Updater
|
||||||
local function updaterLoop(upd)
|
local function updaterLoop(upd)
|
||||||
while true do
|
while true do
|
||||||
|
@ -25,23 +20,7 @@ local function _start()
|
||||||
log.info("Starting bootloader (" .. __VERSION .. ")");
|
log.info("Starting bootloader (" .. __VERSION .. ")");
|
||||||
local upd = updater.new();
|
local upd = updater.new();
|
||||||
upd:addEntry(MODULE_NAME .. ".lua", "keypad", MODULE_URL);
|
upd:addEntry(MODULE_NAME .. ".lua", "keypad", MODULE_URL);
|
||||||
|
parallel.waitForAny(function() updaterLoop(upd) end, require(MODULE_NAME))
|
||||||
--- @type Exports
|
|
||||||
local lib_exports = {
|
|
||||||
log = log,
|
|
||||||
updater = upd,
|
|
||||||
notifier = notifier,
|
|
||||||
json = json
|
|
||||||
};
|
|
||||||
|
|
||||||
parallel.waitForAny(
|
|
||||||
function()
|
|
||||||
updaterLoop(upd)
|
|
||||||
end,
|
|
||||||
function ()
|
|
||||||
require(MODULE_NAME)(lib_exports);
|
|
||||||
end
|
|
||||||
);
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local mod = {};
|
local mod = {};
|
||||||
|
|
|
@ -72,6 +72,7 @@ function updater:check(branch)
|
||||||
log.error("Updater:check: Could not get body of request: " .. berr);
|
log.error("Updater:check: Could not get body of request: " .. berr);
|
||||||
return false;
|
return false;
|
||||||
end
|
end
|
||||||
|
|
||||||
local data = json.decode(body);
|
local data = json.decode(body);
|
||||||
if self.curr_commit_hash == "" then
|
if self.curr_commit_hash == "" then
|
||||||
log.debug("No commit hash found, setting");
|
log.debug("No commit hash found, setting");
|
||||||
|
|
Loading…
Reference in New Issue
Block a user