Add files via upload

This commit is contained in:
Ale32bit 2016-11-20 17:06:00 +01:00 committed by GitHub
parent 4ec994f4ec
commit f5baf8207a
8 changed files with 854 additions and 0 deletions

93
src/apps/spks/appList.spk Normal file
View file

@ -0,0 +1,93 @@
--
-- sPhone Application Package
-- Built with SPK builder 1.2
--
{
files = "{\
[ \"appList.lua\" ] = \"local apps = {}\\r\\\
local function update()\\r\\\
apps = config.list(\\\"/.sPhone/config/spklist\\\")\\r\\\
for k,v in pairs(apps) do\\r\\\
local h = config.read(\\\"/.sPhone/apps/spk/\\\"..k..\\\"/.spk\\\",\\\"hidden\\\")\\r\\\
if h then\\r\\\
apps[k] = nil\\r\\\
end\\r\\\
end\\r\\\
end\\r\\\
local function menu(id)\\r\\\
local data = config.list(\\\"/.sPhone/apps/spk/\\\"..id..\\\"/.spk\\\")\\r\\\
if data then\\r\\\
term.setBackgroundColor(sPhone.theme[\\\"backgroundColor\\\"])\\r\\\
term.setTextColor(sPhone.theme[\\\"text\\\"])\\r\\\
term.clear()\\r\\\
sPhone.header(\\\" Apps\\\",\\\"X\\\")\\r\\\
term.setCursorPos(2,3)\\r\\\
print(data.name)\\r\\\
term.setCursorPos(2,6)\\r\\\
term.setTextColor(colors.black)\\r\\\
print(\\\"Author:\\\")\\r\\\
term.setTextColor(colors.gray)\\r\\\
term.setCursorPos(2,7)\\r\\\
print(data.author)\\r\\\
term.setCursorPos(2,9)\\r\\\
term.setTextColor(colors.black)\\r\\\
print(\\\"Type:\\\")\\r\\\
term.setTextColor(colors.gray)\\r\\\
term.setCursorPos(2,10)\\r\\\
print((data.type or \\\"Normal\\\"))\\r\\\
term.setCursorPos(2,12)\\r\\\
term.setTextColor(colors.black)\\r\\\
print(\\\"Version:\\\")\\r\\\
term.setTextColor(colors.gray)\\r\\\
term.setCursorPos(2,13)\\r\\\
print(data.version)\\r\\\
paintutils.drawLine(19,4,25,4,colors.red)\\r\\\
term.setTextColor(colors.white)\\r\\\
term.setCursorPos(19,4)\\r\\\
write(\\\"Delete\\\")\\r\\\
local w,h = term.getSize()\\r\\\
while true do\\r\\\
local _,_,mx,my = os.pullEvent(\\\"mouse_click\\\")\\r\\\
if my == 1 and mx == w then\\r\\\
break\\r\\\
elseif (mx >= 19 and mx <= 25) and my == 4 then\\r\\\
if fs.exists(\\\"/.sPhone/apps/spk/\\\"..data.id) then\\r\\\
fs.delete(\\\"/.sPhone/apps/spk/\\\"..data.id)\\r\\\
end\\r\\\
config.write(\\\"/.sPhone/config/spklist\\\",data.id,nil)\\r\\\
break\\r\\\
end\\r\\\
end\\r\\\
end\\r\\\
end\\r\\\
\\r\\\
update()\\r\\\
\\r\\\
while true do\\r\\\
local id, _, mouse = sPhone.list(nil,{\\r\\\
list = apps,\\r\\\
pairs = true,\\r\\\
title = \\\" Apps\\\"\\r\\\
})\\r\\\
if not id then\\r\\\
break\\r\\\
end\\r\\\
if mouse == 1 then\\r\\\
sPhone.launch(id)\\r\\\
break\\r\\\
elseif mouse == 2 then\\r\\\
menu(id)\\r\\\
update()\\r\\\
end\\r\\\
end\",\
}",
config = "{\
type = \"app\",\
name = \"Apps\",\
version = 1,\
main = \"appList.lua\",\
id = \"sphone.appList\",\
author = \"BeaconNet\",\
hidden = true,\
}",
}

35
src/apps/spks/chat.spk Normal file
View file

@ -0,0 +1,35 @@
--
-- sPhone Application Package
-- Built with SPK builder 1.2
--
{
files = "{\
[ \"chat.lua\" ] = \"term.setBackgroundColor(sPhone.theme[\\\"backgroundColor\\\"])\\\
term.clear()\\\
term.setCursorPos(1,1)\\\
term.setTextColor(sPhone.theme[\\\"text\\\"])\\\
sPhone.header(\\\"RedNet Chat\\\")\\\
term.setBackgroundColor(sPhone.theme[\\\"backgroundColor\\\"])\\\
term.setTextColor(sPhone.theme[\\\"text\\\"])\\\
term.setCursorPos(2, 5)\\\
if not peripheral.isPresent(\\\"back\\\") or not peripheral.getType(\\\"back\\\") == \\\"modem\\\" then\\\
print(\\\"Modem not found\\\")\\\
print(\\\" Press any key\\\")\\\
os.pullEvent(\\\"key\\\")\\\
return\\\
end\\\
write(\\\"Host: \\\")\\\
local h = read() term.setCursorPos(2,6)\\\
shell.run(\\\"/rom/programs/rednet/chat\\\", \\\"join\\\", h, sPhone.user)\\\
\",\
}",
config = "{\
type = \"app\",\
name = \"RedNet Chat\",\
version = 1,\
main = \"chat.lua\",\
id = \"sphone.chat\",\
author = \"BeaconNet\",\
hidden = true,\
}",
}

27
src/apps/spks/gps.spk Normal file
View file

@ -0,0 +1,27 @@
--
-- sPhone Application Package
-- Built with SPK builder 1.2
--
{
files = "{\
[ \"gps.lua\" ] = \"local x, y, z = gps.locate(0)\\\
if not x then\\\
x, y, z = \\\"?\\\", \\\"?\\\", \\\"?\\\"\\\
end\\\
if tonumber(x) then\\\
sPhone.winOk(\\\"X Y Z\\\", math.ceil(x)..\\\" \\\"..math.ceil(y)..\\\" \\\"..math.ceil(z))\\\
else\\\
sPhone.winOk(\\\"X Y Z\\\",\\\"? ? ?\\\")\\\
end\\\
\",\
}",
config = "{\
type = \"app\",\
name = \"GPS\",\
version = 1,\
main = \"gps.lua\",\
id = \"sphone.gps\",\
author = \"BeaconNet\",\
hidden = true,\
}",
}

46
src/apps/spks/info.spk Normal file
View file

@ -0,0 +1,46 @@
--
-- sPhone Application Package
-- Built with SPK builder 1.2
--
{
files = "{\
[ \"info.lua\" ] = \"local function clear()\\\
term.setBackgroundColor(sPhone.getTheme(\\\"backgroundColor\\\"))\\\
term.setTextColor(sPhone.getTheme(\\\"text\\\"))\\\
term.clear()\\\
term.setCursorPos(1,1)\\\
end\\\
clear()\\\
sPhone.header(\\\"Info\\\", \\\"X\\\")\\\
print(\\\"ID: \\\"..os.getComputerID())\\\
print(\\\"User: \\\"..sPhone.user)\\\
if os.getComputerLabel() then\\\
print(\\\"Label: \\\"..os.getComputerLabel())\\\
end\\\
print(\\\"Version: \\\"..sPhone.version)\\\
print(\\\"\\\")\\\
print(\\\"sPhone made by BeaconNet\\\")\\\
print(\\\"Krist by 3d6\\\")\\\
print(\\\"SHA256 by GravityScore\\\")\\\
print(\\\"Compress by Creator\\\")\\\
print(\\\"And thanks to dan200 for this mod!\\\")\\\
\\\
while true do\\\
local w, h = term.getSize()\\\
local _, _, x, y = os.pullEvent(\\\"mouse_click\\\")\\\
if y == 1 and x == w then\\\
return\\\
end\\\
end\\\
\",\
}",
config = "{\
type = \"system\",\
name = \"Info\",\
main = \"info.lua\",\
version = 1,\
id = \"sphone.info\",\
author = \"BeaconNet\",\
hidden = true,\
}",
}

433
src/apps/spks/settings.spk Normal file
View file

@ -0,0 +1,433 @@
--
-- sPhone Application Package
-- Built with SPK builder 1.2
--
{
files = "{\
[ \"settings.lua\" ] = \"local pwChange,mouse,x,y\\\
local pwChangeRep\\\
local skipped = false\\\
local w,h = term.getSize()\\\
local password\\\
\\\
local menu = {\\\
\\\"Update\\\",\\\
\\\"Edit Theme\\\",\\\
\\\"Change Username\\\",\\\
\\\"Change Password\\\",\\\
\\\"Set Label\\\",\\\
\\\"Clear Label\\\",\\\
\\\"Default Apps\\\",\\\
}\\\
\\\
local function clear()\\\
term.setBackgroundColor(sPhone.theme[\\\"backgroundColor\\\"])\\\
term.setTextColor(sPhone.theme[\\\"text\\\"])\\\
term.clear()\\\
term.setCursorPos(1,1)\\\
end\\\
\\\
local function changeUsername()\\\
local newUsername = sPhone.user\\\
term.setBackgroundColor(sPhone.theme[\\\"backgroundColor\\\"])\\\
term.clear()\\\
term.setCursorPos(1,1)\\\
sPhone.header(\\\"New username\\\")\\\
term.setCursorPos(w,1)\\\
term.setBackgroundColor(sPhone.theme[\\\"header\\\"])\\\
term.setTextColor(sPhone.theme[\\\"headerText\\\"])\\\
write(\\\"X\\\")\\\
term.setBackgroundColor(sPhone.theme[\\\"backgroundColor\\\"])\\\
term.setTextColor(sPhone.theme[\\\"text\\\"])\\\
term.setCursorPos(2,7)\\\
print(\\\"Change your username.\\\")\\\
print(\\\" It affects chat app.\\\")\\\
while true do\\\
term.setCursorPos(2,4)\\\
term.clearLine()\\\
newUsername,mouse,x,y = sPhone.read(nil,nil,nil,true,newUsername)\\\
if mouse then\\\
if y == 1 and x == w then\\\
return\\\
end\\\
else\\\
break\\\
end\\\
end\\\
sPhone.user = newUsername\\\
config.write(\\\"/.sPhone/config/sPhone\\\",\\\"username\\\",newUsername)\\\
sPhone.winOk(\\\"Username\\\",\\\"changed\\\")\\\
end\\\
\\\
local function changePassword()\\\
skipped = false\\\
sPhone.wrongPassword = false\\\
while true do\\\
local usingPW = config.read(\\\"/.sPhone/config/sPhone\\\",\\\"lockEnabled\\\")\\\
if not usingPW then\\\
break\\\
end\\\
term.setBackgroundColor(sPhone.theme[\\\"lock.background\\\"])\\\
term.clear()\\\
term.setCursorPos(1,1)\\\
sPhone.header(sPhone.user)\\\
term.setCursorPos(w,1)\\\
term.setBackgroundColor(sPhone.theme[\\\"header\\\"])\\\
term.setTextColor(sPhone.theme[\\\"headerText\\\"])\\\
write(\\\"X\\\")\\\
paintutils.drawBox(7,9,20,11,sPhone.theme[\\\"lock.inputSide\\\"])\\\
term.setBackgroundColor(sPhone.theme[\\\"lock.inputBackground\\\"])\\\
if sPhone.wrongPassword then\\\
term.setTextColor(sPhone.theme[\\\"lock.error\\\"])\\\
term.setBackgroundColor(sPhone.theme[\\\"lock.inputBackground\\\"])\\\
visum.align(\\\"center\\\",\\\" Wrong Password\\\",false,13)\\\
end\\\
term.setTextColor(sPhone.theme[\\\"lock.text\\\"])\\\
term.setBackgroundColor(sPhone.theme[\\\"lock.background\\\"])\\\
visum.align(\\\"center\\\",\\\" Current Password\\\",false,7)\\\
local loginTerm = window.create(term.native(), 8,10,12,1, true)\\\
term.redirect(loginTerm)\\\
term.setBackgroundColor(sPhone.theme[\\\"lock.inputBackground\\\"])\\\
term.clear()\\\
term.setCursorPos(1,1)\\\
term.setTextColor(sPhone.theme[\\\"lock.inputText\\\"])\\\
while true do\\\
password,mouse,x,y = sPhone.read(\\\"*\\\",nil,nil,true,password)\\\
if mouse then\\\
if y == 1 and x == w then\\\
term.redirect(sPhone.mainTerm)\\\
return\\\
end\\\
else\\\
break\\\
end\\\
end\\\
term.redirect(sPhone.mainTerm)\\\
local fpw = config.read(\\\"/.sPhone/config/sPhone\\\",\\\"password\\\")\\\
if sha256.sha256(password) ~= fpw then\\\
sPhone.wrongPassword = true\\\
else\\\
sPhone.wrongPassword = false\\\
break\\\
end\\\
end\\\
\\\
\\\
while true do\\\
term.setBackgroundColor(sPhone.theme[\\\"lock.background\\\"])\\\
term.clear()\\\
term.setCursorPos(1,1)\\\
sPhone.header(sPhone.user)\\\
paintutils.drawBox(7,9,20,11,sPhone.theme[\\\"lock.inputSide\\\"])\\\
term.setBackgroundColor(sPhone.theme[\\\"lock.background\\\"])\\\
if sPhone.wrongPassword then\\\
term.setTextColor(sPhone.theme[\\\"lock.error\\\"])\\\
term.setBackgroundColor(sPhone.theme[\\\"lock.background\\\"])\\\
visum.align(\\\"center\\\",\\\" Wrong Password\\\",false,13)\\\
end\\\
term.setTextColor(sPhone.theme[\\\"lock.text\\\"])\\\
term.setBackgroundColor(sPhone.theme[\\\"lock.background\\\"])\\\
visum.align(\\\"center\\\",\\\" New Password\\\",false,7)\\\
local t = \\\"Disable Password\\\"\\\
term.setCursorPos(w-#t+1,h)\\\
write(t)\\\
local loginTerm = window.create(term.native(), 8,10,12,1, true)\\\
term.redirect(loginTerm)\\\
term.setBackgroundColor(sPhone.theme[\\\"lock.inputBackground\\\"])\\\
term.clear()\\\
term.setCursorPos(1,1)\\\
term.setTextColor(sPhone.theme[\\\"lock.inputText\\\"])\\\
while true do\\\
pwChange,mouse,x,y = sPhone.read(\\\"*\\\",nil,nil,true,pwChange)\\\
if mouse then\\\
if y == h and (x >= 10 and x <= w) then\\\
skipped = true\\\
config.write(\\\"/.sPhone/config/sPhone\\\",\\\"lockEnabled\\\",false)\\\
break\\\
end\\\
else\\\
break\\\
end\\\
end\\\
term.redirect(sPhone.mainTerm)\\\
if not skipped then\\\
term.setBackgroundColor(sPhone.theme[\\\"lock.background\\\"])\\\
term.clear()\\\
term.setCursorPos(1,1)\\\
sPhone.header(sPhone.user)\\\
paintutils.drawBox(7,9,20,11,sPhone.theme[\\\"lock.inputSide\\\"])\\\
term.setBackgroundColor(sPhone.theme[\\\"lock.background\\\"])\\\
term.setTextColor(sPhone.theme[\\\"lock.text\\\"])\\\
visum.align(\\\"center\\\",\\\" Repeat Password\\\",false,7)\\\
local loginTerm = window.create(term.native(), 8,10,12,1, true)\\\
term.redirect(loginTerm)\\\
term.setBackgroundColor(sPhone.theme[\\\"lock.inputBackground\\\"])\\\
term.clear()\\\
term.setCursorPos(1,1)\\\
term.setTextColor(sPhone.theme[\\\"lock.inputText\\\"])\\\
pwChangeRep = read(\\\"*\\\")\\\
term.redirect(sPhone.mainTerm)\\\
if sha256.sha256(pwChange) == sha256.sha256(pwChangeRep) then\\\
sPhone.wrongPassword = false\\\
config.write(\\\"/.sPhone/config/sPhone\\\",\\\"password\\\",sha256.sha256(pwChangeRep))\\\
config.write(\\\"/.sPhone/config/sPhone\\\",\\\"lockEnabled\\\",true)\\\
sPhone.winOk(\\\"Password\\\",\\\"changed\\\")\\\
return\\\
else\\\
sPhone.wrongPassword = true\\\
end\\\
else\\\
config.write(\\\"/.sPhone/config/sPhone\\\",\\\"lockEnabled\\\",false)\\\
sPhone.winOk(\\\"Password\\\",\\\"disabled\\\")\\\
return\\\
end\\\
end\\\
end\\\
\\\
local function changeLabel()\\\
local newLabel = os.getComputerLabel()\\\
sPhone.header(\\\"New Label\\\")\\\
term.setCursorPos(w,1)\\\
term.setBackgroundColor(sPhone.theme[\\\"header\\\"])\\\
term.setTextColor(sPhone.theme[\\\"headerText\\\"])\\\
write(\\\"X\\\")\\\
term.setBackgroundColor(sPhone.theme[\\\"backgroundColor\\\"])\\\
term.setTextColor(sPhone.theme[\\\"text\\\"])\\\
term.setCursorPos(2,7)\\\
print(\\\"Change computer label\\\")\\\
print(\\\" to be identified\\\")\\\
print(\\\" in your inventory.\\\")\\\
while true do\\\
term.setCursorPos(2,4)\\\
term.clearLine()\\\
newLabel,mouse,x,y = sPhone.read(nil,nil,nil,true,newLabel)\\\
if mouse then\\\
if y == 1 and x == w then\\\
return\\\
end\\\
else\\\
break\\\
end\\\
end\\\
newLabel = newLabel:gsub(\\\"&\\\", string.char(0xc2)..string.char(0xa7)) --yay colors\\\
os.setComputerLabel(newLabel)\\\
sPhone.winOk(\\\"Computer Label set\\\")\\\
end\\\
\\\
local function clearLabel()\\\
local ok, err = pcall(function() os.setComputerLabel(nil) end)\\\
if not ok then\\\
os.setComputerLabel(err)\\\
sPhone.winOk(\\\"Error\\\")\\\
return\\\
end\\\
sPhone.winOk(\\\"Computer Label cleared\\\")\\\
end\\\
\\\
local function editTheme()\\\
local themeOptions = {\\\
\\\"Theme List\\\",\\\
\\\"\\\",\\\
\\\"Header Color\\\",\\\
\\\"Header Text Color\\\",\\\
\\\"Text Color\\\",\\\
\\\"Background Color\\\",\\\
\\\"Window Options\\\",\\\
\\\"Login Options\\\",\\\
\\\"Save\\\",\\\
\\\"Load\\\",\\\
\\\"Reset\\\",\\\
}\\\
local themeOptionsWindow = {\\\
\\\"Background\\\",\\\
\\\"Side\\\",\\\
\\\"Button\\\",\\\
\\\"Text\\\",\\\
}\\\
local themeOptionsLock = {\\\
\\\"Background\\\",\\\
\\\"Text\\\",\\\
\\\"Input Background\\\",\\\
\\\"Input Text\\\",\\\
\\\"Input Sides\\\",\\\
\\\"Error\\\",\\\
}\\\
while true do\\\
local _, id = sPhone.menu(themeOptions,\\\"Theme\\\",\\\"X\\\")\\\
if id == 0 then\\\
return\\\
elseif id == 1 then\\\
shell.run(\\\"/.sPhone/apps/themes\\\")\\\
elseif id == 2 then\\\
--separator?\\\
elseif id == 3 then\\\
sPhone.applyTheme(\\\"header\\\", sPhone.colorPicker(\\\"Header\\\",sPhone.getTheme(\\\"header\\\")))\\\
elseif id == 4 then\\\
sPhone.applyTheme(\\\"headerText\\\", sPhone.colorPicker(\\\"Header Text\\\",sPhone.getTheme(\\\"headerText\\\")))\\\
elseif id == 5 then\\\
sPhone.applyTheme(\\\"text\\\", sPhone.colorPicker(\\\"Text\\\",sPhone.getTheme(\\\"text\\\")))\\\
elseif id == 6 then\\\
sPhone.applyTheme(\\\"backgroundColor\\\", sPhone.colorPicker(\\\"Background Color\\\",sPhone.getTheme(\\\"backgroundColor\\\")))\\\
elseif id == 7 then\\\
while true do\\\
local _, id = sPhone.menu(themeOptionsWindow,\\\"Window Theme\\\",\\\"X\\\")\\\
if id == 0 then\\\
return\\\
elseif id == 1 then\\\
sPhone.applyTheme(\\\"window.background\\\", sPhone.colorPicker(\\\"Background\\\",sPhone.getTheme(\\\"window.background\\\")))\\\
elseif id == 2 then\\\
sPhone.applyTheme(\\\"window.side\\\", sPhone.colorPicker(\\\"Side\\\",sPhone.getTheme(\\\"window.side\\\")))\\\
elseif id == 3 then\\\
sPhone.applyTheme(\\\"window.button\\\", sPhone.colorPicker(\\\"Button\\\",sPhone.getTheme(\\\"window.button\\\")))\\\
elseif id == 4 then\\\
sPhone.applyTheme(\\\"window.text\\\", sPhone.colorPicker(\\\"Text\\\",sPhone.getTheme(\\\"window.text\\\")))\\\
end\\\
end\\\
elseif id == 8 then\\\
while true do\\\
local _, id = sPhone.menu(themeOptionsLock,\\\"Login Theme\\\",\\\"X\\\")\\\
if id == 0 then\\\
return\\\
elseif id == 1 then\\\
sPhone.applyTheme(\\\"lock.background\\\", sPhone.colorPicker(\\\"Background\\\",sPhone.getTheme(\\\"lock.background\\\")))\\\
elseif id == 2 then\\\
sPhone.applyTheme(\\\"lock.text\\\", sPhone.colorPicker(\\\"Text\\\",sPhone.getTheme(\\\"lock.text\\\")))\\\
elseif id == 3 then\\\
sPhone.applyTheme(\\\"lock.inputBackground\\\", sPhone.colorPicker(\\\"Input Background\\\",sPhone.getTheme(\\\"lock.inputBackground\\\")))\\\
elseif id == 4 then\\\
sPhone.applyTheme(\\\"lock.inputText\\\", sPhone.colorPicker(\\\"Input Text\\\",sPhone.getTheme(\\\"lock.inputText\\\")))\\\
elseif id == 5 then\\\
sPhone.applyTheme(\\\"lock.inputSide\\\", sPhone.colorPicker(\\\"Input Sides\\\",sPhone.getTheme(\\\"lock.inputSide\\\")))\\\
elseif id == 6 then\\\
sPhone.applyTheme(\\\"lock.error\\\", sPhone.colorPicker(\\\"Error\\\",sPhone.getTheme(\\\"lock.error\\\")))\\\
end\\\
end\\\
elseif id == 9 then\\\
local saveTheme\\\
sPhone.header(sPhone.user)\\\
term.setCursorPos(w,1)\\\
term.setBackgroundColor(sPhone.theme[\\\"header\\\"])\\\
term.setTextColor(sPhone.theme[\\\"headerText\\\"])\\\
write(\\\"X\\\")\\\
term.setBackgroundColor(sPhone.theme[\\\"backgroundColor\\\"])\\\
term.setTextColor(sPhone.theme[\\\"text\\\"])\\\
visum.align(\\\"center\\\", \\\"Save Theme\\\",false,3)\\\
while true do\\\
term.setCursorPos(2,5)\\\
term.clearLine()\\\
saveTheme,mouse,x,y = sPhone.read(nil,nil,nil,true,saveTheme)\\\
if mouse then\\\
if y == 1 and x == w then\\\
return\\\
end\\\
else\\\
break\\\
end\\\
end\\\
if fs.exists(saveTheme) then\\\
fs.delete(saveTheme)\\\
end\\\
fs.copy(\\\"/.sPhone/config/theme\\\", saveTheme)\\\
sPhone.winOk(\\\"Theme saved!\\\")\\\
elseif id == 10 then\\\
local loadTheme = sPhone.list()\\\
if loadTheme then\\\
if fs.exists(loadTheme) and not fs.isDir(loadTheme) then\\\
for k, v in pairs(sPhone.theme) do -- Load theme\\\
sPhone.theme[k] = config.read(loadTheme, k)\\\
end\\\
for k, v in pairs(sPhone.theme) do -- Overwrite theme config\\\
config.write(\\\"/.sPhone/config/theme\\\", k, v)\\\
end\\\
sPhone.winOk(\\\"Theme loaded!\\\")\\\
else\\\
sPhone.winOk(\\\"Theme not found!\\\")\\\
end\\\
end\\\
elseif id == 11 then\\\
fs.delete(\\\"/.sPhone/config/theme\\\")\\\
sPhone.theme = sPhone.defaultTheme\\\
sPhone.winOk(\\\"Removed Theme\\\")\\\
end\\\
end\\\
end\\\
\\\
local function defaultApps()\\\
local defaultMenu = {\\\
\\\"Home\\\",\\\
}\\\
local name, id = sPhone.menu(defaultMenu,\\\"Default Apps\\\",\\\"X\\\")\\\
\\\
if id == 0 then\\\
return\\\
elseif id == 1 then\\\
\\\
while true do\\\
local hList = {\\\
[\\\"sphone.home\\\"] = \\\"sPhone Home\\\",\\\
}\\\
\\\
for k,v in pairs(config.list(\\\"/.sPhone/config/spklist\\\")) do\\\
local f = fs.open(\\\"/.sPhone/apps/spk/\\\"..k..\\\"/.spk\\\",\\\"r\\\")\\\
local data = f.readAll()\\\
f.close()\\\
data = textutils.unserialise(data)\\\
if data.type == \\\"home\\\" then\\\
hList[k] = v\\\
end\\\
end\\\
\\\
local defaultHome = sPhone.list(nil,{\\\
list = hList,\\\
pairs = true,\\\
title = \\\" Default Home\\\",\\\
})\\\
\\\
if not defaultHome then\\\
sPhone.setDefaultApp(\\\"home\\\",\\\"sphone.home\\\")\\\
sPhone.winOk(\\\"Done!\\\",\\\"Reboot to apply\\\")\\\
break\\\
else\\\
sPhone.setDefaultApp(\\\"home\\\",defaultHome)\\\
sPhone.winOk(\\\"Done!\\\",\\\"Reboot to apply\\\")\\\
break\\\
end\\\
end\\\
end\\\
end\\\
\\\
while true do\\\
clear()\\\
sPhone.header(\\\"\\\",\\\"X\\\")\\\
local name, id = sPhone.menu(menu, \\\"Settings\\\",\\\"X\\\")\\\
if id == 0 then\\\
task.kill(temp.get(\\\"homePID\\\"))\\\
return\\\
elseif id == 1 then\\\
setfenv(loadstring(http.get(\\\"https://raw.githubusercontent.com/BeaconNet/sPhone/master/src/installer.lua\\\").readAll()),getfenv())()\\\
elseif id == 2 then\\\
editTheme()\\\
elseif id == 3 then\\\
changeUsername()\\\
elseif id == 4 then\\\
changePassword()\\\
elseif id == 5 then\\\
changeLabel()\\\
elseif id == 6 then\\\
clearLabel()\\\
elseif id == 7 then\\\
defaultApps()\\\
end\\\
end\\\
\",\
}",
config = "{\
type = \"system\",\
name = \"Settings\",\
main = \"settings.lua\",\
version = 1,\
id = \"sphone.settings\",\
author = \"BeaconNet\",\
hidden = true,\
}",
}

23
src/apps/spks/shell.spk Normal file
View file

@ -0,0 +1,23 @@
--
-- sPhone Application Package
-- Built with SPK builder 1.2
--
{
files = "{\
[ \"shell.lua\" ] = \"term.setBackgroundColor(colors.black)\\\
term.setTextColor(colors.white)\\\
term.clear()\\\
term.setCursorPos(1,1)\\\
shell.run(\\\"/rom/programs/shell\\\")\\\
\",\
}",
config = "{\
type = \"app\",\
name = \"Shell\",\
version = 1,\
main = \"shell.lua\",\
id = \"sphone.shell\",\
author = \"BeaconNet\",\
hidden = true,\
}",
}

147
src/apps/spks/store.spk Normal file
View file

@ -0,0 +1,147 @@
--
-- sPhone Application Package
-- Built with SPK builder 1.2
--
{
files = "{\
[ \"store.lua\" ] = \"local host = \\\"https://raw.github.com/BeaconNet/sPhone-Store/master/\\\"\\\
local index = host..\\\"index.lua\\\"\\\
local apps = host..\\\"apps/\\\"\\\
local appsL = {}\\\
local w, h = term.getSize()\\\
\\\
local function redraw()\\\
term.setBackgroundColor(colors.white)\\\
term.setTextColor(colors.black)\\\
term.clear()\\\
term.setTextColor(colors.white)\\\
paintutils.drawLine(1,1,w,1,colors.green)\\\
term.setCursorPos(1,1)\\\
write(\\\" Store\\\")\\\
visum.align(\\\"right\\\",\\\"X\\\",false,1)\\\
term.setTextColor(colors.black)\\\
term.setBackgroundColor(colors.white)\\\
term.setCursorPos(1,3)\\\
end\\\
\\\
local function install(path,name)\\\
local data = http.get(\\\"https://raw.github.com/BeaconNet/sPhone-Store/master/apps/\\\"..path).readAll()\\\
local f = fs.open(\\\"/tmp/sPhoneStore/\\\"..name..\\\".spk\\\",\\\"w\\\")\\\
f.write(data)\\\
f.close()\\\
local status = sPhone.install(\\\"/tmp/sPhoneStore/\\\"..name..\\\".spk\\\")\\\
if status then\\\
sPhone.winOk(\\\"Installed\\\")\\\
else\\\
sPhone.winOk(\\\"Error while installing\\\")\\\
end\\\
end\\\
\\\
redraw()\\\
\\\
term.setCursorPos(1,2)\\\
visum.align(\\\"center\\\",\\\" Loading\\\",false,2)\\\
term.setCursorPos(1,3)\\\
\\\
local c = http.get(index).readAll()\\\
\\\
local appsIndex = textutils.unserialize(c)\\\
\\\
redraw()\\\
\\\
local mx,my = term.getCursorPos()\\\
term.setCursorPos(1,2)\\\
term.clearLine()\\\
term.setCursorPos(mx,my)\\\
\\\
\\\
while true do\\\
local path,name = sPhone.list(nil,{\\\
title = \\\" Store\\\",\\\
pairs = true,\\\
list = appsIndex,\\\
bg1 = colors.white,\\\
fg1 = colors.black,\\\
bg2 = colors.green,\\\
fg2 = colors.white,\\\
bg3 = colors.green,\\\
fg3 = colors.white,\\\
})\\\
\\\
if not path then\\\
return\\\
end\\\
\\\
local data = http.get(\\\"https://raw.github.com/BeaconNet/sPhone-Store/master/apps/\\\"..path).readAll()\\\
data = textutils.unserialise(data)\\\
if data then\\\
local _conf = textutils.unserialise(data.config)\\\
redraw()\\\
term.setCursorPos(2,3)\\\
print(_conf.name)\\\
term.setCursorPos(2,6)\\\
term.setTextColor(colors.black)\\\
print(\\\"Author:\\\")\\\
term.setTextColor(colors.gray)\\\
term.setCursorPos(2,7)\\\
print(_conf.author)\\\
term.setCursorPos(2,9)\\\
term.setTextColor(colors.black)\\\
print(\\\"Type:\\\")\\\
term.setTextColor(colors.gray)\\\
term.setCursorPos(2,10)\\\
print((_conf.type or \\\"Normal\\\"))\\\
term.setCursorPos(2,12)\\\
term.setTextColor(colors.black)\\\
print(\\\"Version:\\\")\\\
term.setTextColor(colors.gray)\\\
term.setCursorPos(2,13)\\\
print(_conf.version)\\\
\\\
if config.read(\\\"/.sPhone/config/spklist\\\",_conf.id) then\\\
paintutils.drawLine(19,4,25,4,colors.red)\\\
term.setTextColor(colors.white)\\\
term.setCursorPos(19,4)\\\
write(\\\"Delete\\\")\\\
else\\\
paintutils.drawLine(19,4,25,4,colors.green)\\\
term.setTextColor(colors.white)\\\
term.setCursorPos(19,4)\\\
write(\\\"Install\\\")\\\
end\\\
\\\
while true do\\\
local _,_,mx,my = os.pullEvent(\\\"mouse_click\\\")\\\
if my == 1 and mx == w then\\\
break\\\
elseif (mx >= 19 and mx <= 25) and my == 4 then\\\
if config.read(\\\"/.sPhone/config/spklist\\\",_conf.id) then\\\
if fs.exists(\\\"/.sPhone/apps/spk/\\\".._conf.id) then\\\
fs.delete(\\\"/.sPhone/apps/spk/\\\".._conf.id)\\\
end\\\
config.write(\\\"/.sPhone/config/spklist\\\",_conf.id,nil)\\\
else\\\
install(path,name)\\\
end\\\
break\\\
end\\\
end\\\
else\\\
sPhone.winOk(\\\"Cannot install\\\",\\\"file corrupted\\\")\\\
end\\\
\\\
\\\
\\\
end\\\
\",\
}",
config = "{\
type = \"app\",\
name = \"Store\",\
version = 1,\
main = \"store.lua\",\
id = \"sphone.store\",\
author = \"BeaconNet\",\
hidden = true,\
}",
}

50
src/apps/spks/themes.spk Normal file
View file

@ -0,0 +1,50 @@
--
-- sPhone Application Package
-- Built with SPK builder 1.2
--
{
files = "{\
[ \"themes.lua\" ] = \"if not sPhone then\\r\\\
printError(\\\"sPhone must be installed and loaded before running this program\\\")\\r\\\
return\\r\\\
end\\r\\\
\\r\\\
\\r\\\
print(\\\"Downloading theme list\\\")\\r\\\
local url = \\\"https://raw.github.com/Ale32bit/sPhone-Mods/master/themes.lua\\\"\\r\\\
\\r\\\
local ht = http.get(url)\\r\\\
local themesRaw = ht.readAll()\\r\\\
local themes = textutils.unserialize(themesRaw)\\r\\\
ht.close()\\r\\\
\\r\\\
local li = {}\\r\\\
for k,v in pairs(themes) do\\r\\\
table.insert(li,k)\\r\\\
end\\r\\\
while true do\\r\\\
local g, c = sPhone.menu(li,\\\" Themes\\\",\\\"X\\\")\\r\\\
if c == 0 then\\r\\\
return\\r\\\
elseif c > #li then\\r\\\
\\r\\\
else\\r\\\
for k,v in pairs(themes[g]) do\\r\\\
sPhone.applyTheme(k,v)\\r\\\
end\\r\\\
sPhone.winOk(\\\"Theme applied\\\")\\r\\\
break\\r\\\
end\\r\\\
end\\r\\\
\",\
}",
config = "{\
type = \"app\",\
name = \"Theme List\",\
version = 1,\
main = \"themes.lua\",\
id = \"sphone.themes\",\
author = \"BeaconNet\",\
hidden = true,\
}",
}