Compare commits
No commits in common. "main" and "main" have entirely different histories.
|
@ -1 +0,0 @@
|
|||
shell.run("sh")
|
|
@ -5,11 +5,12 @@
|
|||
"url" : "https://git.mcorangehq.xyz/xomf/slabOS/raw/branch/main/Clicker.lua",
|
||||
"path" : "apps/Clicker.lua"
|
||||
},
|
||||
"Terminal" : {
|
||||
|
||||
"Tester" : {
|
||||
"version" : 1,
|
||||
"colour": "black",
|
||||
"url" : "https://git.mcorangehq.xyz/xomf/slabOS/raw/branch/main/Terminal.lua",
|
||||
"path" : "apps/Terminal.lua"
|
||||
"colour": "red",
|
||||
"url" : "https://git.mcorangehq.xyz/xomf/slabOS/raw/branch/main/tester.lua",
|
||||
"path" : "apps/Tester.lua"
|
||||
}
|
||||
|
||||
}
|
17
eCash.lua
17
eCash.lua
|
@ -1,5 +1,5 @@
|
|||
local basalt = require("/lib/basalt")
|
||||
local libcredit = require("/lib/libcredit_mobile")
|
||||
local basalt = require("../lib/basalt")
|
||||
local libcredit = require("../lib/libcredit_mobile")
|
||||
|
||||
local username = ""
|
||||
local main = basalt.getMainFrame()
|
||||
|
@ -243,16 +243,21 @@ local loginButton = login:addButton()
|
|||
|
||||
username = usernameInput:getText()
|
||||
|
||||
if not fs.exists("/.usrcache") then
|
||||
local file = fs.open("/.usrcache","w")
|
||||
file.write(username)
|
||||
file.close()
|
||||
end
|
||||
|
||||
login:setVisible(false)
|
||||
appFrame:setVisible(true)
|
||||
refresh_ui()
|
||||
|
||||
end)
|
||||
|
||||
if fs.exists("/config.json") then
|
||||
local file = fs.open("/config.json","r")
|
||||
local file_content = file.readAll()
|
||||
local username = textutils.unserialiseJSON(file_content).username
|
||||
if fs.exists("/.usrcache") then
|
||||
local file = fs.open("/.usrcache","r")
|
||||
local username = file.readLine()
|
||||
file.close()
|
||||
usernameInput:setText(username)
|
||||
end
|
||||
|
|
|
@ -31,41 +31,6 @@ local function sendRequestAndWaitForReply(messageTable, replyHandler, timeout)
|
|||
return replyReceived
|
||||
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)
|
||||
local message = {
|
||||
type = "getCredit",
|
||||
|
|
246
oobe.lua
246
oobe.lua
|
@ -1,246 +0,0 @@
|
|||
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()
|
40
slabos.lua
40
slabos.lua
|
@ -1,38 +1,4 @@
|
|||
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 basalt = require("basalt")
|
||||
|
||||
local main = basalt.getMainFrame()
|
||||
|
||||
|
@ -46,10 +12,6 @@ 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
|
||||
|
||||
|
|
1
tester.lua
Normal file
1
tester.lua
Normal file
|
@ -0,0 +1 @@
|
|||
print("Test")
|
|
@ -1,4 +1,4 @@
|
|||
local CURRENT_CLIENT_VERSION = "1.1.0.1"
|
||||
local CURRENT_CLIENT_VERSION = "1.0.0.2"
|
||||
local INSTALL_PATH = "/"
|
||||
|
||||
function http_get(url)
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
{
|
||||
"version": "1.1.0.1",
|
||||
"version": "1.0.0.2",
|
||||
"sys_files": {
|
||||
"slabos.lua": "https://git.mcorangehq.xyz/xomf/slabOS/raw/branch/main/slabos.lua",
|
||||
"startup.lua": "https://git.mcorangehq.xyz/xomf/slabOS/raw/branch/main/oobe.lua",
|
||||
"startup.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",
|
||||
"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/basalt.lua": "https://raw.githubusercontent.com/Pyroxenium/Basalt2/refs/heads/main/release/basalt.lua",
|
||||
|
@ -10,4 +10,4 @@
|
|||
"apps/eCash.lua": "https://git.mcorangehq.xyz/xomf/slabOS/raw/branch/main/eCash.lua",
|
||||
"apps/App Store.lua": "https://git.mcorangehq.xyz/xomf/slabOS/raw/branch/main/App%20Store.lua"
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user