1
0
forked from xomf/slabOS

Compare commits

...

18 Commits
main ... main

Author SHA1 Message Date
e4015debbe Delete tester.lua 2025-06-06 04:41:57 +00:00
17e3221fd9 Update apps.json 2025-06-06 04:41:48 +00:00
186fa1b0bc Update apps.json 2025-06-06 04:41:28 +00:00
f871625016 Add Terminal.lua 2025-06-06 04:40:40 +00:00
3074f9ec8d Update updater.lua 2025-06-06 04:39:37 +00:00
4c457e3118 Update version.json 2025-06-06 04:39:27 +00:00
560bfd7fa2 Update eCash.lua 2025-06-06 04:39:13 +00:00
c20170a0a3 Update eCash.lua 2025-06-06 04:38:54 +00:00
a1d2140017 Update version.json 2025-06-06 04:34:02 +00:00
674822e1ed Update version.json 2025-06-06 04:30:49 +00:00
55b4537e52 Update oobe.lua 2025-06-06 04:26:25 +00:00
f9d241f7e5 Update updater.lua 2025-06-06 04:26:13 +00:00
48fdb784ce Update version.json 2025-06-06 04:25:56 +00:00
ba491b11bf Update slabos.lua 2025-06-06 04:24:16 +00:00
df88bcf6f8 Update libcredit_mobile.lua 2025-06-06 04:14:34 +00:00
3ae183b105 Update slabos.lua 2025-06-06 04:14:13 +00:00
9f9d728dd3 Add oobe.lua 2025-06-06 04:13:55 +00:00
538bafae03
Update version 2025-06-02 19:25:12 +03:00
9 changed files with 336 additions and 23 deletions

1
Terminal.lua Normal file
View File

@ -0,0 +1 @@
shell.run("sh")

View File

@ -5,12 +5,11 @@
"url" : "https://git.mcorangehq.xyz/xomf/slabOS/raw/branch/main/Clicker.lua", "url" : "https://git.mcorangehq.xyz/xomf/slabOS/raw/branch/main/Clicker.lua",
"path" : "apps/Clicker.lua" "path" : "apps/Clicker.lua"
}, },
"Terminal" : {
"Tester" : {
"version" : 1, "version" : 1,
"colour": "red", "colour": "black",
"url" : "https://git.mcorangehq.xyz/xomf/slabOS/raw/branch/main/tester.lua", "url" : "https://git.mcorangehq.xyz/xomf/slabOS/raw/branch/main/Terminal.lua",
"path" : "apps/Tester.lua" "path" : "apps/Terminal.lua"
} }
} }

View File

@ -1,5 +1,5 @@
local basalt = require("../lib/basalt") local basalt = require("/lib/basalt")
local libcredit = require("../lib/libcredit_mobile") local libcredit = require("/lib/libcredit_mobile")
local username = "" local username = ""
local main = basalt.getMainFrame() local main = basalt.getMainFrame()
@ -243,21 +243,16 @@ local loginButton = login:addButton()
username = usernameInput:getText() username = usernameInput:getText()
if not fs.exists("/.usrcache") then
local file = fs.open("/.usrcache","w")
file.write(username)
file.close()
end
login:setVisible(false) login:setVisible(false)
appFrame:setVisible(true) appFrame:setVisible(true)
refresh_ui() refresh_ui()
end) end)
if fs.exists("/.usrcache") then if fs.exists("/config.json") then
local file = fs.open("/.usrcache","r") local file = fs.open("/config.json","r")
local username = file.readLine() local file_content = file.readAll()
local username = textutils.unserialiseJSON(file_content).username
file.close() file.close()
usernameInput:setText(username) usernameInput:setText(username)
end end

View File

@ -31,6 +31,41 @@ local function sendRequestAndWaitForReply(messageTable, replyHandler, timeout)
return replyReceived return replyReceived
end end
function M.createAccount(username, associatedDevice, callback)
if type(username) ~= "string" or #username == 0 then
error("Username must be a non-empty string.", 2)
end
if type(callback) ~= "function" then
error("Callback must be a function.", 2)
end
if associatedDevice and type(associatedDevice) ~= "number" then
error("Associated device must be a number if provided.", 2)
end
local message = {
type = "createAccount",
user = username
}
if associatedDevice then
message.associatedDevice = associatedDevice
end
return sendRequestAndWaitForReply(message, function(reply)
if reply.type == "accountCreationConfirmation" and reply.user == username then
if reply.status == "success" then
print("Account '" .. username .. "' created successfully. New credit: " .. tostring(reply.newCredit))
callback(true, reply.newCredit)
else
print("Account creation failed for '" .. username .. "'. Reason: " .. tostring(reply.reason))
callback(false, reply.reason)
end
else
print("Unexpected reply for createAccount request: " .. textutils.serialiseJSON(reply))
callback(false, "unexpected_reply")
end
end)
end
function M.getCredit(username, callback) function M.getCredit(username, callback)
local message = { local message = {
type = "getCredit", type = "getCredit",

246
oobe.lua Normal file
View File

@ -0,0 +1,246 @@
local basalt = require("/lib/basalt")
local libcredit = require("/lib/libcredit_mobile")
if fs.exists("/config.json") then
while true do
shell.run("/slabos.lua")
term.clear()
print("Starting...")
sleep(1)
end
end
local main = basalt.getMainFrame()
local contentFrame = main:addFrame()
:setPosition(1,1)
:setSize(26,20)
:setBackground(colours.white)
local colourSelectionFrame = main:addFrame()
:setPosition(1,1)
:setSize(26,20)
:setBackground(colours.white)
:setVisible(false)
local usernameSetupFrame = main:addFrame()
:setPosition(1,1)
:setSize(26,20)
:setBackground(colours.white)
:setVisible(false)
local passwordSetupFrame = main:addFrame()
:setPosition(1,1)
:setSize(26,20)
:setBackground(colours.white)
:setVisible(false)
local selectedColourButton = nil
local selectedWallpaperColourName = "white"
local selectedUsername = ""
local selectedPassword = ""
local welcomeBigFont = contentFrame:addBigFont()
:setText("Welcome!")
:setBackground(colours.white)
:setSize(40,5)
:setPosition(2, 2)
contentFrame:addButton()
:setText("Begin Setup")
:setBackground(colours.lime)
:setPosition(6, 8)
:setSize(15, 3)
:onClick(function(self)
contentFrame:setVisible(false)
colourSelectionFrame:setVisible(true)
end)
contentFrame:addLabel()
:setText("Put me in your main hand and right click")
:setSize(26,2)
:setAutoSize(false)
:setPosition(2,15)
colourSelectionFrame:addLabel()
:setText("Choose your wallpaper")
:setPosition(3, 2)
:setSize(22, 1)
local wallpaperColours = {}
for name, colourValue in pairs(colours) do
if type(colourValue) == "number" then
local textColour = colours.black
if colourValue == colours.black or colourValue == colours.blue or colourValue == colours.red or
colourValue == colours.purple or colourValue == colours.brown or colourValue == colours.gray then
textColour = colours.white
end
table.insert(wallpaperColours, {name = name, colour = colourValue, textColour = textColour})
end
end
table.sort(wallpaperColours, function(a, b)
return a.name < b.name
end)
local startX = 2
local startY = 4
local buttonWidth = 5
local buttonHeight = 3
local paddingX = 1
local paddingY = 1
local coloursPerRow = 4
local maxRows = 3
local maxColoursToShow = coloursPerRow * maxRows
local navButtonHeight = 3
local buttonPaddingBottom = 1
local buttonPaddingSide = 2
for i = 1, math.min(#wallpaperColours, maxColoursToShow) do
local colourData = wallpaperColours[i]
local col = ((i - 1) % coloursPerRow)
local row = math.floor((i - 1) / coloursPerRow)
local x = startX + (buttonWidth + paddingX) * col
local y = startY + (buttonHeight + paddingY) * row
colourSelectionFrame:addButton()
:setText("")
:setBackground(colourData.colour)
:setForeground(colourData.textColour)
:setPosition(x, y)
:setSize(buttonWidth, buttonHeight)
:onClick(function(self)
if selectedColourButton then
selectedColourButton:setText("")
end
self:setText("X")
selectedColourButton = self
selectedWallpaperColourName = colourData.name
end)
end
colourSelectionFrame:addButton()
:setText("Next >")
:setBackground(colours.green)
:setPosition(colourSelectionFrame:getWidth() - 7 - buttonPaddingSide, colourSelectionFrame:getHeight() - navButtonHeight - buttonPaddingBottom)
:setSize(8,navButtonHeight)
:onClick(function(self)
colourSelectionFrame:setVisible(false)
usernameSetupFrame:setVisible(true)
end)
colourSelectionFrame:addButton()
:setText("< Back")
:setBackground(colours.red)
:setPosition(buttonPaddingSide, colourSelectionFrame:getHeight() - navButtonHeight - buttonPaddingBottom)
:setSize(8,navButtonHeight)
:onClick(function(self)
colourSelectionFrame:setVisible(false)
contentFrame:setVisible(true)
end)
usernameSetupFrame:addLabel()
:setText("Set your Username")
:setPosition(4, 2)
:setSize(22, 1)
local usernameInput = usernameSetupFrame:addInput()
:setPosition(3, 4)
:setSize(20, 1)
:setText("")
usernameSetupFrame:addLabel()
:setText("WARNING: Use your In-Game Name (IGN) for eCash to ensure proper transactions and avoid issues!")
:setPosition(4, 6)
:setSize(20, 4)
:setAutoSize(false)
:setForeground(colours.red)
local confirmUsernameButton = usernameSetupFrame:addButton()
:setText("Next >")
:setBackground(colours.green)
:setPosition(usernameSetupFrame:getWidth() - 7 - buttonPaddingSide, usernameSetupFrame:getHeight() - navButtonHeight - buttonPaddingBottom)
:setSize(8,navButtonHeight)
:onClick(function(self)
local inputUsername = usernameInput:getText()
if inputUsername and inputUsername ~= "" and inputUsername ~= "Your IGN here" then
selectedUsername = inputUsername
usernameSetupFrame:setVisible(false)
passwordSetupFrame:setVisible(true)
end
end)
usernameSetupFrame:addButton()
:setText("< Back")
:setBackground(colours.red)
:setPosition(buttonPaddingSide, usernameSetupFrame:getHeight() - navButtonHeight - buttonPaddingBottom)
:setSize(8,navButtonHeight)
:onClick(function(self)
usernameSetupFrame:setVisible(false)
colourSelectionFrame:setVisible(true)
end)
passwordSetupFrame:addLabel()
:setText("Set your password (optional)")
:setAutoSize(false)
:setPosition(4, 2)
:setSize(22, 1)
local passwordInput = passwordSetupFrame:addInput()
:setPosition(3, 4)
:setSize(20, 1)
:setText("")
:setReplaceChar("*")
local confirmPasswordButton = passwordSetupFrame:addButton()
:setText("Done >")
:setBackground(colours.green)
:setPosition(passwordSetupFrame:getWidth() - 7 - buttonPaddingSide, passwordSetupFrame:getHeight() - navButtonHeight - buttonPaddingBottom)
:setSize(8,navButtonHeight)
:onClick(function(self)
local inputPassword = passwordInput:getText()
if inputPassword and inputPassword ~= "" then
selectedPassword = inputPassword
else
selectedPassword = ""
end
libcredit.createAccount(selectedUsername,os.getComputerID(),function()
end)
local configData = {
wallpaperColour = selectedWallpaperColourName,
username = selectedUsername,
password = selectedPassword,
}
local jsonString = textutils.serialiseJSON(configData)
local filePath = "config.json"
local file = fs.open(filePath, "w")
if file then
file.write(jsonString)
file.close()
end
os.reboot()
end)
passwordSetupFrame:addButton()
:setText("< Back")
:setBackground(colours.red)
:setPosition(buttonPaddingSide, passwordSetupFrame:getHeight() - navButtonHeight - buttonPaddingBottom)
:setSize(8,navButtonHeight)
:onClick(function(self)
passwordSetupFrame:setVisible(false)
usernameSetupFrame:setVisible(true)
end)
basalt.run()

View File

@ -1,4 +1,38 @@
local basalt = require("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()
@ -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

View File

@ -1 +0,0 @@
print("Test")

View File

@ -1,4 +1,4 @@
local CURRENT_CLIENT_VERSION = "1.0.0.2" local CURRENT_CLIENT_VERSION = "1.1.0.1"
local INSTALL_PATH = "/" local INSTALL_PATH = "/"
function http_get(url) function http_get(url)

View File

@ -1,8 +1,8 @@
{ {
"version": "1.0.0.2", "version": "1.1.0.1",
"sys_files": { "sys_files": {
"startup.lua": "https://git.mcorangehq.xyz/xomf/slabOS/raw/branch/main/slabos.lua", "slabos.lua": "https://git.mcorangehq.xyz/xomf/slabOS/raw/branch/main/slabos.lua",
"basalt.lua": "https://raw.githubusercontent.com/Pyroxenium/Basalt2/refs/heads/main/release/basalt.lua", "startup.lua": "https://git.mcorangehq.xyz/xomf/slabOS/raw/branch/main/oobe.lua",
"app_manifest.json": "https://git.mcorangehq.xyz/xomf/slabOS/raw/branch/main/app_manifest.json", "app_manifest.json": "https://git.mcorangehq.xyz/xomf/slabOS/raw/branch/main/app_manifest.json",
"lib/libcredit_mobile": "https://git.mcorangehq.xyz/xomf/slabOS/raw/branch/main/libcredit_mobile.lua", "lib/libcredit_mobile": "https://git.mcorangehq.xyz/xomf/slabOS/raw/branch/main/libcredit_mobile.lua",
"lib/basalt.lua": "https://raw.githubusercontent.com/Pyroxenium/Basalt2/refs/heads/main/release/basalt.lua", "lib/basalt.lua": "https://raw.githubusercontent.com/Pyroxenium/Basalt2/refs/heads/main/release/basalt.lua",