forked from xomf/slabOS
Update slabos.lua
This commit is contained in:
parent
df88bcf6f8
commit
ba491b11bf
38
slabos.lua
38
slabos.lua
|
@ -1,5 +1,39 @@
|
||||||
local basalt = require("/lib/basalt")
|
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 main = basalt.getMainFrame()
|
||||||
|
|
||||||
local FRAME_WIDTH = 26
|
local FRAME_WIDTH = 26
|
||||||
|
@ -12,6 +46,10 @@ local homescreen = main:addFrame()
|
||||||
:setBackground(colours.blue)
|
:setBackground(colours.blue)
|
||||||
:setVisible(true)
|
:setVisible(true)
|
||||||
|
|
||||||
|
if config.wallpaperColour then
|
||||||
|
homescreen:setBackground(colours[config.wallpaperColour])
|
||||||
|
end
|
||||||
|
|
||||||
local active_app_frames = {}
|
local active_app_frames = {}
|
||||||
local current_active_frame = homescreen
|
local current_active_frame = homescreen
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user