Start of cleanup

This commit is contained in:
Alessandro Proto 2024-08-20 18:19:07 +02:00
parent df43059cd2
commit c75639eb2d
11 changed files with 348 additions and 334 deletions

View file

@ -1 +0,0 @@
setfenv(loadstring(http.get("https://raw.githubusercontent.com/SertexTeam/sPhone/master/src/installer.lua").readAll()),getfenv())()

17
install.lua Normal file
View file

@ -0,0 +1,17 @@
local h, err = http.get("https://git.alexdevs.me/Legacy-CC/sPhone/raw/branch/master/src/installer.lua")
if not h then
error(err, 0)
end
local content = h.readAll()
h.close()
local func, err = load(content, "@installer.lua", "t", _ENV)
if not func then
error(err, 0)
end
local ok, err = pcall(func)
if not ok then
error(err, 0)
end

View file

@ -13,5 +13,6 @@ if not peripheral.isPresent("back") or not peripheral.getType("back") == "modem"
return return
end end
write("Host: ") write("Host: ")
local h = read() term.setCursorPos(2,6) local h = read()
term.setCursorPos(2, 6)
shell.run("/rom/programs/rednet/chat", "join", h, sPhone.user) shell.run("/rom/programs/rednet/chat", "join", h, sPhone.user)

View file

@ -1,5 +1,3 @@
local buttonsInHome = { local buttonsInHome = {
{ "sPhone.header", 23, 1, 25, 1, sPhone.theme["header"], sPhone.theme["headerText"], "vvv" }, { "sPhone.header", 23, 1, 25, 1, sPhone.theme["header"], sPhone.theme["headerText"], "vvv" },
{ "sPhone.appsButton", 12, 20, 14, 20, sPhone.theme["backgroundColor"], sPhone.theme["header"], "===" }, { "sPhone.appsButton", 12, 20, 14, 20, sPhone.theme["backgroundColor"], sPhone.theme["header"], "===" },
@ -61,6 +59,7 @@
term.setCursorPos(2, 3) term.setCursorPos(2, 3)
write("Shutdown") write("Shutdown")
end end
while true do while true do
term.redirect(sPhone.mainTerm) term.redirect(sPhone.mainTerm)
drawHome() drawHome()
@ -110,7 +109,6 @@
end end
sPhone.inHome = false sPhone.inHome = false
end end
local function updateClock() local function updateClock()

View file

@ -97,7 +97,8 @@ local function readMsg()
if msg ~= "" then if msg ~= "" then
local pos = 1 local pos = 1
local update = os.startTimer(0.15) local update = os.startTimer(0.15)
http.request(server.."send.php","user="..user.."&password="..pass.."&message="..msg.."&to="..sendTo.."&hashed=true") http.request(server .. "send.php",
"user=" .. user .. "&password=" .. pass .. "&message=" .. msg .. "&to=" .. sendTo .. "&hashed=true")
while true do while true do
term.clear() term.clear()
term.setCursorPos(1, 1) term.setCursorPos(1, 1)

View file

@ -120,7 +120,8 @@ local function readMsg()
if msg ~= "" then if msg ~= "" then
local pos = 1 local pos = 1
local update = os.startTimer(0.15) local update = os.startTimer(0.15)
http.request(server.."send.php","user="..user.."&password="..pass.."&message="..msg.."&to="..sendTo.."&hashed=true") http.request(server .. "send.php",
"user=" .. user .. "&password=" .. pass .. "&message=" .. msg .. "&to=" .. sendTo .. "&hashed=true")
while true do while true do
term.clear() term.clear()
term.setCursorPos(1, 1) term.setCursorPos(1, 1)

View file

@ -1,5 +1,3 @@
if not pocket or not term.isColor() then if not pocket or not term.isColor() then
print("sPhone is only for Advanced Pocket Computers!") print("sPhone is only for Advanced Pocket Computers!")
return return
@ -12,7 +10,7 @@ local files = {
["src/init.lua"] = "/.sPhone/init", ["src/init.lua"] = "/.sPhone/init",
["src/sPhone.lua"] = "/.sPhone/sPhone", ["src/sPhone.lua"] = "/.sPhone/sPhone",
["install"] = "/.sPhone/update", ["install.lua"] = "/.sPhone/update",
["LICENSE"] = "/.sPhone/LICENSE", ["LICENSE"] = "/.sPhone/LICENSE",
@ -47,11 +45,10 @@ local files = {
["src/interfaces/login"] = "/.sPhone/interfaces/login", ["src/interfaces/login"] = "/.sPhone/interfaces/login",
["src/interfaces/bootImage"] = "/.sPhone/interfaces/bootImage", ["src/interfaces/bootImage"] = "/.sPhone/interfaces/bootImage",
["src/startup"] = "/startup", ["src/startup.lua"] = "/startup.lua",
["src/startup"] = "/.sPhone/startup",
} }
local githubUser = "SertexTeam" local githubUser = "CC-Legacy"
local githubRepo = "sPhone" local githubRepo = "sPhone"
local githubBranch = "master" local githubBranch = "master"
@ -108,7 +105,7 @@ local function get(user, repo, bran, path, save)
if not user or not repo or not bran or not path then if not user or not repo or not bran or not path then
error("not enough arguments, expected 4 or 5", 2) error("not enough arguments, expected 4 or 5", 2)
end end
local url = "https://raw.github.com/"..user.."/"..repo.."/"..bran.."/"..path local url = "https://git.alexdevs.me/"..user.."/"..repo.."/raw/branch/"..bran.."/"..path
local remote = http.get(url) local remote = http.get(url)
if not remote then if not remote then
return false return false
@ -148,7 +145,7 @@ gui()
term.setCursorPos(2,3) term.setCursorPos(2,3)
print("License\n") print("License\n")
printError("You must accept the license to install sPhone\n") printError("You must accept the license to install sPhone\n")
print("The MIT License (MIT)\nCopyright (c) 2017 Sertex\n\nRead full license here:\nhttps://raw.github.com/SertexTeam/sPhone/master/LICENSE") print("The MIT License (MIT)\nCopyright (c) 2024 AlexDevs\n\nRead full license here:\nhttps://git.alexdevs.me/Legacy-CC/sPhone/src/branch/master/LICENSE")
paintutils.drawFilledBox(2,17,9,19,colors.lime) paintutils.drawFilledBox(2,17,9,19,colors.lime)
term.setCursorPos(3,18) term.setCursorPos(3,18)
term.setTextColor(colors.white) term.setTextColor(colors.white)