diff --git a/slabos.lua b/slabos.lua index 5480f1e..be1e427 100644 --- a/slabos.lua +++ b/slabos.lua @@ -1,5 +1,39 @@ local basalt = require("/lib/basalt") +config = {} +if fs.exists("config.json") then + + local config_file = fs.open("/config.json","r") + local config_text = config_file.readAll() + config = textutils.unserialiseJSON(config_text) + config_file.close() + +end + +if config.password then + + while true do + + if config.password == "" then + break + end + + term.setCursorPos(1, 1) + term.clear() + print("This device requires a password to start.") + write("Password: ") + local msg = read() + + if msg == config.password then + break + else + print("Incorrect!") + sleep(1) + end + + end +end + local main = basalt.getMainFrame() local FRAME_WIDTH = 26 @@ -12,6 +46,10 @@ local homescreen = main:addFrame() :setBackground(colours.blue) :setVisible(true) +if config.wallpaperColour then + homescreen:setBackground(colours[config.wallpaperColour]) +end + local active_app_frames = {} local current_active_frame = homescreen