Advertisement
Guest User

nigger

a guest
Oct 15th, 2016
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 180.35 KB | None | 0 0
  1. program={}program.core={}program.apps={}program.snippets={}program.cloud={}program.mail={}program.feed={}program.draw={}program.main={}program.draw.menu={}program.chat={}program.account={}program.profile={}program.tickets={}program.plugins={}local a={...}Internal={Details={Name="Discover App",Description="Discover Network Application.",Version=7.1,Build=054,ReleaseKey="47e748dcf1759597ddc91855f0e95673648d172bb72fdb820679735ca9ea5d47293ca7e5b26e91eb0e3dce660905d75c7617e12121306c4f79190cfef45fe7cd"},Config={ConfigFilePath=".DiscoverConfig",BlockTerminate=false,EnablePlugins=true,PluginsDirectory="/DA_Plugins",AutoUpdate=true,PluginConfigFile=".DiscoverAppPlugins"},Icons={},System={Platform=false,ActiveScreen=false},Plugins={},Tasks={},Account={},Alerts={},Thread={History={}},Swap={Viewer={},Edit={},Update={}},Controls={}}local b,c=term.getSize()if b==51 and c==19 then Internal.System.Platform="Desktop"elseif b==26 and c==20 then Internal.System.Platform="Platform"elseif b==39 and c==13 then Internal.System.Platform="Turtle"else Internal.System.Platform="Unknown"end;local d,e=pcall(function()if http then aa=aa or{}local f=http.get("http://api.dannysmc.com/files/apis/discover.lua")f=f.readAll()local g={}f=loadstring(f)local g=getfenv()setfenv(f,g)local status,e=pcall(f,unpack(aa))if not status and e then printError("Error loading api")return false end;local h=e;g=g;_G["base"]=g end end)if not d then error("Could not install API")end;local d,e=pcall(function()if http then aa=aa or{}local f=http.get("http://api.dannysmc.com/files/apis/baseapi.lua")f=f.readAll()local g={}f=loadstring(f)local g=getfenv()setfenv(f,g)local status,e=pcall(f,unpack(aa))if not status and e then printError("Error loading api")return false end;local h=e;g=g;_G["base"]=g end end)if not d then error("Could not install API")end;function program.core.options()base.screen.colour("cyan")base.draw.textl("   Discover Options   ",1,false,"white","cyan")base.draw.textl("----------------------",2,false,"white","cyan")base.draw.textc("Exit Discover",4,false,"orange","cyan")base.draw.textc("Restart Discover",5,false,"orange","cyan")base.draw.textc("Reboot Computer",6,false,"orange","cyan")base.draw.textc("Shutdown Computer",7,false,"orange","cyan")while true do local i={os.pullEvent("mouse_click")}if i[3]>=14 and i[3]<=35 and i[4]==10 then base.thread.create("Shutdown",program.core.shutdown,1,1,51,19)base.thread.switch("Shutdown")elseif i[3]>=14 and i[3]<=35 and i[4]==11 then base.thread.create("Reboot",program.core.reboot,1,1,51,19)base.thread.switch("Reboot")elseif i[3]>=14 and i[3]<=35 and i[4]==12 then base.screen.colour("cyan")base.draw.textc("Restarting now...",4,false,"white","cyan")base.draw.textc("See you soon!",5,false,"white","cyan")sleep(1)os.reboot()elseif i[3]>=14 and i[3]<=35 and i[4]==13 then base.screen.colour("cyan")base.draw.textc("Shutting down...",4,false,"white","cyan")base.draw.textc("Goodbye!",5,false,"white","cyan")sleep(1)os.shutdown()else base.thread.remove("Power")base.thread.switch("Home")end end end;function program.core.shutdown()base.screen.colour("white")base.draw.textc("DiscoverApp::Shutdown",2,false,"grey","white")local j="Thank you for using the DiscoverApp!! Created by FluxDev / DannySMc"for k,l in ipairs(base.data.wordwrap(j,47))do base.draw.textc(l,k+7,false,"cyan","white")end;local function m(j)base.draw.box(1,51,16,1," ","white","white")base.draw.textc(j.."...",16,false,"lightGrey","white")sleep(0.5)end;m("Closing program")m("Running shutdown callbacks")DiscoverApp.Callbacks.Run("Shutdown")m("Logging out of Discover Network")if Discover.User:LoggedIn()then Discover.User:Logout()end;m("Unlock termination block")if Internal.Config.BlockTerminate then os.pullEvent=os.oldPullEvent end;m("Stopping processes")base.thread.exit()threads={}end;function program.core.reboot()base.screen.colour("white")base.draw.textc("DiscoverApp::Shutdown",2,false,"grey","white")local j="Thank you for using the DiscoverApp!! Created by FluxDev / DannySMc"for k,l in ipairs(base.data.wordwrap(j,47))do base.draw.textc(l,k+7,false,"cyan","white")end;local function m(j)base.draw.box(1,51,16,1," ","white","white")base.draw.textc(j.."...",16,false,"lightGrey","white")sleep(0.5)end;m("Restarting")m("Running reboot callbacks")DiscoverApp.Callbacks.Run("Reboot")m("Logging out of Discover Network")if Discover.User:LoggedIn()then Discover.User:Logout()end;m("Unlock termination block")if Internal.Config.BlockTerminate then os.pullEvent=os.oldPullEvent end;m("Clearing screen, restarting")base.thread.reset()Internal.Swap.Signal="Reboot"end;Internal.Icons={["accManagement"]={{"3:3: ","3:3: ","3:3: ","3:3: ","3:3: ","3:3: ","3:3: ","3:3: ","3:3: ","3:3: ","3:3: ","3:3: ","3:3: ","3:3: "},{"3:3: ","f:3:A","f:3:c","f:3:c","f:3:o","f:3:u","f:3:n","f:3:t","3:3: ","3:3: ","3:3: ","3:3: ","f:8::","f:8:)"},{"3:3: ","3:3: ","f:3:M","f:3:a","f:3:n","f:3:a","f:3:g","f:3:e","f:3:m","f:3:e","f:3:n","f:3:t","3:3: ","3:3: "},{"3:3: ","3:3: ","3:3: ","3:3: ","3:3: ","3:3: ","3:3: ","3:3: ","3:3: ","3:3: ","3:3: ","3:3: ","3:3: ","3:3: "}},["appStore"]={{"f:6: ","f:6: ","f:6: ","f:6: ","f:6: ","f:6: ","f:6: ","f:6: ","f:6: ","f:6: ","7:0:O","7:0:S","8:0: ","f:6: "},{"f:6: ","f:6:A","f:6:p","f:6:p","f:6: ","f:6: ","f:6: ","f:6: ","f:6: ","f:6: ","7:0:P","7:0:A","8:0:D","f:6: "},{"f:6: ","f:6: ","f:6:S","f:6:t","f:6:o","f:6:r","f:6:e","f:6: ","f:6: ","f:6: ","8:0:A","8:0:p","7:0:p","f:6: "},{"f:6: ","f:6: ","f:6: ","f:6: ","f:6: ","f:6: ","f:6: ","f:6: ","f:6: ","f:6: ","8:0:C","8:0:m","7:0:d","f:6: "}},["chatRooms"]={{"1:1: ","1:1: ","1:1: ","1:1: ","1:1: ","1:1: ","1:1: ","1:1: ","1:1: ","1:1: ","1:1: ","1:1: ","1:1: ","1:1: "},{"1:1: ","f:1:C","f:1:h","f:1:a","f:1:t","1:1: ","1:1: ","1:1: ","1:1: ","1:1: ","f:1: ","f:8:H","f:8:i","f:8:!"},{"1:1: ","1:1: ","f:1:R","f:1:o","f:1:o","f:1:m","f:1:s","1:1: ","f:3:H","f:3:e","f:3:y","f:3:!","1:1: ","1:1: "},{"1:1: ","1:1: ","1:1: ","1:1: ","1:1: ","1:1: ","1:1: ","1:1: ","1:1: ","1:1: ","1:1: ","1:1: ","1:1: ","1:1: "}},["cloudStorage"]={{"9:9: ","9:9: ","9:9: ","9:9: ","9:9: ","9:9: ","9:9: ","9:9: ","9:9: ","9:9: ","9:9: ","9:9: ","9:9: ","9:9: "},{"9:9: ","f:9:C","f:9:l","f:9:o","f:9:u","f:9:d","9:9: ","9:9: ","9:9: ","9:9: ","9:9: ","9:0: ","9:0: ","9:9: "},{"9:9: ","9:9: ","f:9:S","f:9:t","f:9:o","f:9:r","f:9:a","f:9:g","f:9:e","9:9: ","9:0: ","9:0: ","9:0: ","9:0: "},{"9:9: ","9:9: ","9:9: ","9:9: ","9:9: ","9:9: ","9:9: ","9:9: ","9:9: ","9:9: ","9:9: ","9:9: ","9:9: ","9:9: "}},["credits"]={{"f:4: ","f:4: ","f:4: ","f:4: ","f:4: ","f:4: ","f:4: ","f:4: ","f:4: ","7:8:-","7:8:-","7:8: ","f:4: ","f:4: "},{"f:4: ","f:4:C","f:4:r","f:4:e","f:4:d","f:4:i","f:4:t","f:4:s","f:4: ","7:8:-","7:8:-","7:8:-","f:4: ","f:4: "},{"f:4: ","f:4: ","f:4: ","f:4: ","f:4: ","f:4: ","f:4: ","f:4: ","f:4: ","7:8:-","7:8: ","7:8: ","f:4: ","f:4: "},{"f:4: ","f:4: ","f:4: ","f:4: ","f:4: ","f:4: ","f:4: ","f:4: ","f:4: ","7:8:-","7:8:-","7:8: ","f:4: ","f:4: "}},["help"]={{"5:5: ","5:5: ","5:5: ","5:5: ","5:5: ","5:5: ","5:5: ","5:5: ","5:5: ","5:0:?","5:0:?","5:0:?","5:0:?","5:5: "},{"5:5: ","f:5:H","f:5:e","f:5:l","f:5:p","5:5: ","5:5: ","5:5: ","5:5: ","5:0:?","5:5: ","5:5: ","5:0:?","5:5: "},{"5:5: ","5:5: ","5:5: ","f:5:F","f:5:A","f:5:Q","5:5: ","5:5: ","5:5: ","5:5: ","5:5: ","5:0:?","5:0:?","5:5: "},{"5:5: ","5:5: ","5:5: ","5:5: ","5:5: ","5:5: ","5:5: ","5:5: ","5:5: ","5:5: ","5:5: ","5:0:?","5:5: ","5:5: "}},["login"]={{"d:d: ","d:d: ","d:d: ","d:d: ","d:d: ","d:d: ","d:d: ","d:d: ","d:d: ","d:d: ","d:d: ","d:d: ","d:d: ","d:d: "},{"d:d: ","f:d:L","f:d:o","f:d:g","f:d:i","f:d:n","d:d: ","d:d: ","d:d: ","0:f:u","0:f:s","0:f:e","0:f:r","d:d: "},{"d:d: ","d:d: ","d:d: ","d:d: ","d:d: ","d:d: ","d:d: ","d:d: ","d:d: ","0:f:*","0:f:*","0:f:*","0:f:*","d:d: "},{"d:d: ","d:d: ","d:d: ","d:d: ","d:d: ","d:d: ","d:d: ","d:d: ","d:d: ","d:d: ","d:d: ","d:d: ","d:d: ","d:d: "}},["logout"]={{"e:e: ","e:e: ","e:e: ","e:e: ","e:e: ","e:e: ","e:e: ","e:e: ","e:e: ","e:e: ","e:e: ","e:0: ","e:e: ","e:e: "},{"e:e: ","f:e:L","f:e:o","f:e:g","f:e:o","f:e:u","f:e:t","e:e: ","e:e: ","e:0: ","e:e: ","e:0: ","e:e: ","e:0: "},{"e:e: ","e:e: ","e:e: ","e:e: ","e:e: ","e:e: ","e:e: ","e:e: ","e:e: ","e:0: ","e:e: ","e:e: ","e:e: ","e:0: "},{"e:e: ","e:e: ","e:e: ","e:e: ","e:e: ","e:e: ","e:e: ","e:e: ","e:e: ","e:0: ","e:0: ","e:0: ","e:0: ","e:0: "}},["mailbox"]={{"2:2: ","2:2: ","2:2: ","2:2: ","2:2: ","2:2: ","2:2: ","2:2: ","2:2: ","2:2: ","2:2: ","2:2: ","2:2: ","2:2: "},{"2:2: ","f:2:M","f:2:a","f:2:i","f:2:l","f:2:b","f:2:o","f:2:x","2:2: ","2:e: ","2:0: ","2:0: ","2:0: ","2:2: "},{"2:2: ","2:2: ","2:2: ","2:2: ","2:2: ","2:2: ","2:2: ","2:2: ","2:2: ","2:e: ","2:e: ","2:0: ","2:0: ","2:2: "},{"2:2: ","2:2: ","2:2: ","2:2: ","2:2: ","2:2: ","2:2: ","2:2: ","2:2: ","2:2: ","2:2: ","2:c: ","2:2: ","2:2: "}},["tickets"]={{"2:2: ","2:2: ","2:2: ","2:2: ","2:2: ","2:2: ","2:2: ","2:2: ","2:2: ","2:2: ","2:2: ","2:2: ","2:2: ","2:2: "},{"2:2: ","f:2:T","f:2:i","f:2:c","f:2:k","f:2:e","f:2:t","f:2:s","2:2: ","f:0:B","f:0:u","f:0:g","f:0:1","2:2: "},{"2:2: ","2:2: ","2:2: ","2:2: ","2:2: ","2:2: ","2:2: ","2:2: ","2:2: ","f:0:e","f:0:t","f:0:c","2:0: ","2:2: "},{"2:2: ","2:2: ","2:2: ","2:2: ","2:2: ","2:2: ","2:2: ","2:2: ","2:2: ","2:2: ","2:2: ","2:2: ","2:2: ","2:2: "}},["newsFeed"]={{"e:e: ","e:e: ","e:e: ","e:e: ","e:e: ","e:e: ","e:e: ","e:e: ","e:e: ","e:e: ","e:8: ","e:8: ","e:8: ","e:e: "},{"e:e: ","f:e:N","f:e:e","f:e:w","f:e:s","e:e: ","e:e: ","e:e: ","e:e: ","e:e: ","e:7: ","e:7: ","e:8: ","e:e: "},{"e:e: ","e:e: ","f:e:F","f:e:e","f:e:e","f:e:d","e:e: ","e:e: ","e:e: ","e:e: ","e:7: ","e:7: ","e:7: ","e:e: "},{"e:e: ","e:e: ","e:e: ","e:e: ","e:e: ","e:e: ","e:e: ","e:e: ","e:e: ","e:e: ","e:8: ","e:8: ","e:8: ","e:e: "}},["profiles"]={{"3:3: ","3:3: ","3:3: ","3:3: ","3:3: ","3:3: ","3:3: ","3:3: ","3:3: ","3:3: ","f:8:U","f:8:s","f:8:e","f:8:r"},{"3:3: ","f:3:P","f:3:r","f:3:o","f:3:f","f:3:i","f:3:l","f:3:e","f:3:s","3:3: ","f:8:5","f:8:6","f:8:3","f:8: "},{"3:3: ","3:3: ","3:3: ","3:3: ","3:3: ","3:3: ","3:3: ","3:3: ","3:3: ","3:3: ","3:7: ","3:7: ","3:7: ","3:7: "},{"3:3: ","3:3: ","3:3: ","3:3: ","3:3: ","3:3: ","3:3: ","3:3: ","3:3: ","3:3: ","3:3: ","3:3: ","3:3: ","3:3: "}},["settings"]={{"8:8: ","8:8: ","8:8: ","8:8: ","8:8: ","8:8: ","8:8: ","8:8: ","8:8: ","8:8: ","8:8: ","8:8: ","8:8: ","8:8: "},{"8:8: ","f:8:S","f:8:e","f:8:t","f:8:t","f:8:i","f:8:n","f:8:g","f:8:s","8:8: ","8:8: ","0:8::","0:8:x","8:8: "},{"8:8: ","8:8: ","8:8: ","8:8: ","8:8: ","8:8: ","8:8: ","8:8: ","8:8: ","8:8: ","8:8: ","0:8::","0:8:x","0:8: "},{"8:8: ","8:8: ","8:8: ","8:8: ","8:8: ","8:8: ","8:8: ","8:8: ","8:8: ","8:8: ","8:8: ","8:8: ","8:8: ","8:8: "}},["snippetStore"]={{"5:5: ","5:5: ","5:5: ","5:5: ","5:5: ","5:5: ","5:5: ","5:5: ","5:5: ","5:5: ","5:5: ","5:5: ","5:5: ","5:5: "},{"5:5: ","f:5:S","f:5:n","f:5:i","f:5:p","f:5:p","f:5:e","f:5:t","5:5: ","5:5: ","5:5: ","0:f:1","0:f:0","5:5: "},{"5:5: ","5:5: ","f:5:S","f:5:t","f:5:o","f:5:r","f:5:e","5:5: ","5:5: ","5:5: ","5:5: ","0:f:0","0:f:1","5:5: "},{"5:5: ","5:5: ","5:5: ","5:5: ","5:5: ","5:5: ","5:5: ","5:5: ","5:5: ","5:5: ","5:5: ","5:5: ","5:5: ","5:5: "}},["socialNetwork"]={{"6:6: ","6:6: ","6:6: ","6:6: ","6:6: ","6:6: ","6:6: ","6:6: ","6:6: ","6:6: ","6:6: ","6:6: ","6:6: ","6:6: "},{"6:6: ","f:6:S","f:6:o","f:6:c","f:6:i","f:6:a","f:6:l","6:6: ","6:6: ","6:6: ","f:3:.","f:3:.","f:3:.","6:6: "},{"6:6: ","6:6: ","f:6:N","f:6:e","f:6:t","f:6:w","f:6:o","f:6:r","f:6:k","6:6: ","6:3: ","6:3: ","6:3: ","6:3: "},{"6:6: ","6:6: ","6:6: ","6:6: ","6:6: ","6:6: ","6:6: ","6:6: ","6:6: ","6:6: ","6:6: ","6:6: ","6:6: ","6:6: "}},["updateLogs"]={{"5:5: ","5:5: ","5:5: ","5:5: ","5:5: ","5:5: ","5:5: ","5:5: ","5:5: ","5:5: ","5:5: ","5:5: ","5:5: ","5:5: "},{"5:5: ","f:5:U","f:5:p","f:5:d","f:5:a","f:5:t","f:5:e","5:5: ","5:5: ","5:5: ","0:f:1","0:f:.","0:f:0","5:5: "},{"5:5: ","5:5: ","f:5:L","f:5:o","f:5:g","f:5:s","5:5: ","5:5: ","5:5: ","5:5: ","0:f:1","0:f:.","0:f:1","5:5: "},{"5:5: ","5:5: ","5:5: ","5:5: ","5:5: ","5:5: ","5:5: ","5:5: ","5:5: ","5:5: ","5:5: ","5:5: ","5:5: ","5:5: "}},["sysInfo"]={{"f:6: ","f:6: ","f:6: ","f:6: ","f:6: ","f:6: ","f:6: ","f:6: ","f:6: ","f:6: ","f:6: ","f:6: ","f:6: ","f:6: "},{"f:6: ","f:6:S","f:6:y","f:6:s","f:6:t","f:6:e","f:6:m","f:6: ","f:6: ","f:6: ","e:0:V","e:0::","e:0:1","f:6: "},{"f:6: ","f:6: ","f:6:D","f:6:e","f:6:t","f:6:a","f:6:i","f:6:l","f:6:s","f:6: ","e:0:B","e:0::","e:0:9","f:6: "},{"f:6: ","f:6: ","f:6: ","f:6: ","f:6: ","f:6: ","f:6: ","f:6: ","f:6: ","f:6: ","f:6: ","f:6: ","f:6: ","f:6: "}},["PluginsManager"]={{"f:d: ","f:d: ","f:d: ","f:d: ","f:d: ","f:d: ","f:d: ","f:d: ","f:d: ","f:d: ","f:d: ","f:d: ","f:d: ","f:d: "},{"f:d: ","f:d:P","f:d:l","f:d:u","f:d:g","f:d:i","f:d:n","f:d:s","f:d: ","f:d: ","e:0:|","e:0:-","e:0:|","f:d: "},{"f:d: ","f:d: ","f:d:M","f:d:a","f:d:n","f:d:a","f:d:g","f:d:e","f:d:r","f:d: ","e:0:-","e:0:|","e:0:-","f:d: "},{"f:d: ","f:d: ","f:d: ","f:d: ","f:d: ","f:d: ","f:d: ","f:d: ","f:d: ","f:d: ","f:d: ","f:d: ","f:d: ","f:d: "}}}Internal.MenuEntries={}Internal.Callbacks={["Shutdown"]={},["Reboot"]={},["Startup"]={},["Login"]={},["Logout"]={}}DiscoverApp={Register={MenuIcon=function(n,o)if Internal.Icons[n]==nil then Internal.Icons[n]=o;return true else return false end end,MenuEntry=function(n,p,q,r,s)if not type(Internal.MenuEntries)=="table"then Internal.MenuEntries={}end;local new={}new["icon_name"]=n;new["base_func"]=p;new["func_name"]=q;new["thrd_name"]=r;new["req_login"]=s;table.insert(Internal.MenuEntries,new)new=nil;return true end},MenuBar={Render=function(name)program.draw.menubar(name)end,Handler=function(name,t,u)program.draw.menu.handler(name,t,u)end},Alerts={Create=function(v,w,x)new={Title=v,Message=w,Function=x}table.insert(Internal.Alerts,new)return true end},Settings={Create=function(y,z)if Internal.Config[tostring(y)]==nil then Internal.Config[tostring(y)]=z;return true else return unpack({false,"Setting name already used!"})end end,Retrieve=function(y)return Internal.Config[tostring(y)]end,Save=function()local A=fs.open(Internal.Config.ConfigFilePath,"w")local B={["Account"]=Internal.Account,["Config"]=Internal.Config}A.write(Discover.Crypto:Base64("encode",textutils.serialize(B)))A.close()return true end,Reload=function()Internal.Controls.InstallConfig()return true end},Threads={Create=function(name,C)return base.thread.create(name,C)end,Switch=function(name)return base.thread.switch(name)end,Remove=function(name)return base.thread.remove(name)end,Find=function(name)return base.thread.find(name)end,List=function(name)return threads end},Tasks={Create=function(name,C)if type(name)=="string"and type(C)=="function"then local new={}new.name=tostring(name)new.func=C;table.insert(Internal.Tasks,new)base.thread.createbg(new.name,new.func)return true else return unpack({false,"Expecting string, function"})end end,Remove=function(name)for k,l in ipairs(Internal.Tasks)do if l.name==name then table.remove(Internal.Tasks,k)if base.thread.find(name)then base.thread.remove(name)end;return true end end;return unpack({false,"Could not find task"})end},Callbacks={Register=function(D,E,C)if D=="shutdown"then local new={}new.name=tostring(E)new.func=tostring(C)Internal.Callbacks.Shutdown[#Internal.Callbacks.Shutdown+1]=new;new=nil;return true elseif D=="reboot"then local new={}new.name=tostring(E)new.func=tostring(C)Internal.Callbacks.Reboot[#Internal.Callbacks.Reboot+1]=new;new=nil;return true elseif D=="startup"then local new={}new.name=tostring(E)new.func=tostring(C)Internal.Callbacks.Startup[#Internal.Callbacks.Startup+1]=new;new=nil;return true elseif D=="login"then local new={}new.name=tostring(E)new.func=tostring(C)Internal.Callbacks.Login[#Internal.Callbacks.Login+1]=new;new=nil;return true elseif D=="logout"then local new={}new.name=tostring(E)new.func=tostring(C)Internal.Callbacks.Logout[#Internal.Callbacks.Logout+1]=new;new=nil;return true else return false end end,Run=function(...)local F={...}local D=F[1]table.remove(F,1)if D then if Internal.Callbacks[D]then for k,l in pairs(Internal.Callbacks[D])do program[l.name][l.func](unpack(F))end;return true else return true end else return false end end}}function program.core.crash(G)if not G then G="Unknown error"end;base.draw.box(8,36,4,2," ","lightGrey","lightGrey")base.draw.box(8,36,6,2," ","lightGrey","lightGrey")base.draw.box(8,36,8,2," ","lightGrey","lightGrey")base.draw.box(8,36,10,2," ","lightGrey","lightGrey")base.draw.box(8,36,12,2," ","lightGrey","lightGrey")base.draw.box(8,36,14,2," ","lightGrey","lightGrey")base.draw.box(44,1,5,11," ","black","black")base.draw.box(9,36,16,1," ","black","black")base.draw.box(8,36,4,1," ","grey","grey")base.draw.textc("DiscoverApp::Crash",4,false,"cyan","grey")local j="Oh snap! Take down the error message and create a ticket for me to fix it!"for k,l in ipairs(base.data.wordwrap(j,33))do base.draw.textc(l,k+5,false,"white","lightGrey")end;for k,l in ipairs(base.data.wordwrap(G,33))do base.draw.textc(l,k+9,false,"red","lightGrey")end;base.draw.textc("  Reboot  ",14,false,"white","orange")while true do local i={os.pullEvent()}if i[1]=="mouse_click"then if i[3]>=20 and i[3]<=30 and i[4]==14 then os.reboot()end end end end;function program.core.init()local d,e=pcall(function()assert(type(Discover)=="table")assert(type(base)=="table")local t,u=term.getSize()local function H()base.screen.colour("white")base.draw.textc("Discover App",1,false,"grey","white")base.draw.textc("Developed By FluxDev",u,false,"red","white")end;local function m(j)local j=base.data.wordwrap(j,t-5)for k,l in ipairs(j)do base.draw.box(1,t,k+9,1," ","white","white")end;for k,l in ipairs(j)do base.draw.textc(l,k+9,false,"lightBlue","white")end;sleep(0.1)end;m("Running init sequence, please wait ...")H()m("Checking system requirements ...")if not http then error("Please enable HTTP in your CC config!")end;if not term.isColour()then error("Please use an advanced computer!")end;m("Checking for IP Lock ...")local d,I=Discover.User:CheckIP()if d then error("It looks like your IP has been blocked because of spam.")end;program.core.update(m)m("Searching for config ...")function Internal.Controls.InstallConfig()if fs.exists(Internal.Config.ConfigFilePath)then local A=fs.open(Internal.Config.ConfigFilePath,"r")local J=A.readAll()A.close()local B=textutils.unserialize(Discover.Crypto:Base64("decode",J))for k,l in pairs(B.Config)do Internal.Config[k]=l end;for k,l in pairs(B.Account)do Internal.Account[k]=l end end end;Internal.Controls.InstallConfig()Plugin={}if Internal.Config.EnablePlugins then m("Checking for plugins, please wait ...")if fs.exists(Internal.Config.PluginsDirectory)then local K=fs.list(Internal.Config.PluginsDirectory)local function L(filepath)local d,e=pcall(function()if fs.exists(filepath)then local M,C=nil;local A=fs.open(filepath,"r")local N=0;for O in A.readLine do N=N+1;N=N+1;if O:sub(1,8)=="-- @base"then M=tostring(O:sub(10))elseif O:sub(1,8)=="-- @func"then C=tostring(O:sub(10))end;if M and C then program[M]={}require(filepath)Plugin[M][C]()break end;if N>25 then break end end;A.close()end end)if d then return"Success"else print(e)sleep(10000)return"Fail"end end;for k,l in ipairs(K)do m("Installing plugins: "..tostring(k).."/"..tostring(#K).." :: "..tostring(tostring(L(fs.combine(Internal.Config.PluginsDirectory,l)))))H()end end end;m("Running startup callbacks ...")DiscoverApp.Callbacks.Run("Startup")m("Checking for blocking method ...")if Internal.Config.BlockTerminate then os.oldPullEvent=os.pullEvent;os.pullEvent=os.pullEventRaw end;m("Looking for account credentials ... ")if Internal.Account.Username and Internal.Account.Password then DiscoverApp.Callbacks.Run("Login")local status=Discover.User:ManualLogin(Internal.Account.Username,Internal.Account.Password)Internal.Account.Username=nil;Internal.Account.Password=nil;if status then m("Account found, logged in!")else m("Account found, could not login!")Discover.User:Reset()end else m("Account credentials were not found!")end;if Discover.User:LoggedIn()then m("Retrieving account notifications ...")local status,P=Discover.Notifications:List()if not status then m("Could not get notifications, "..tostring(Discover.User:GetField("ErrorMsg")))else Internal.Alerts=P;m("Added "..tostring(#P).." alerts!")end end;base.thread.create("Home",program.main.home)base.thread.switch("Home")base.thread.run()if Internal.Swap.Signal=="Reboot"then program.core.init()end;term.clear()term.setCursorPos(1,1)end)if not d then program.core.crash(e)end end;function program.core.update(m)if Internal.Config.AutoUpdate then m("Checking for new release ...")local d,e=Discover.Core:Update("check",Internal.Details.ReleaseKey,Internal.Details.Version)if d then m("Update found! Downloading and installing ...")if Discover.Core:Update("download",Internal.Details.ReleaseKey)then m("Installed, Rebooting...")sleep(1)shell.run(shell.getRunningProgram())else m("Unable to install new update...")end else m("No update, you are on the latest version!")sleep(0.5)end end end;local Q=false;local R=0;Internal.System.ActiveScreen="Homepage"function program.draw.menubar(S)Internal.System.ActiveScreen=tostring(S)base.draw.box(1,51,1,2," ","grey","grey")base.draw.textl("Discover App",1,false,"cyan","grey")base.draw.textc(base.time.current(),1,false,"lime","grey")base.draw.textr("("..#Internal.Alerts..") Alerts",1,false,"lightGrey","grey")if Q then program.draw.menu.tasks(true,false)else program.draw.menu.tasks(false,false)end end;function program.draw.menu.handler(S,t,u)local T,U=term.getSize()local V=base.thread.list()if t>=1 and t<=51 and(u>=1 and u<=2)then if u==1 then if t>=1 and t<=14 then if not base.thread.find("Home")then base.thread.create("Home",program.main.home)end;base.thread.switch("Home")elseif t>=46 and t<=51 then if not base.thread.find("Alerts")then base.thread.create("Alerts",program.main.alerts)end;base.thread.switch("Alerts")end elseif u==2 then if t==1 then if R>0 then R=R-1;program.draw.menu.tasks(Q,false)end elseif t>=3 and t<=11 then local id=1+R;if id<=#V and Q then if V[id]['name']==currentThread['name']then if t==3 then base.thread.remove(V[id]['name'])if not base.thread.find("Home")then base.thread.create("Home",program.main.home)end;base.thread.switch("Home")end else if base.thread.find(V[id]['name'])then base.thread.switch(V[id]['name'])end end end elseif t>=13 and t<=21 then local id=2+R;if id<=#V and Q then if V[id]['name']==currentThread['name']then if t==13 then base.thread.remove(V[id]['name'])if not base.thread.find("Home")then base.thread.create("Home",program.main.home)end;base.thread.switch("Home")end else if base.thread.find(V[id]['name'])then base.thread.switch(V[id]['name'])end end end elseif t>=23 and t<=31 then local id=3+R;if id<=#V and Q then if V[id]['name']==currentThread['name']then if t==23 then base.thread.remove(V[id]['name'])if not base.thread.find("Home")then base.thread.create("Home",program.main.home)end;base.thread.switch("Home")end else if base.thread.find(V[id]['name'])then base.thread.switch(V[id]['name'])end end end elseif t>=33 and t<=41 then local id=4+R;if id<=#V and Q then if V[id]['name']==currentThread['name']then if t==33 then base.thread.remove(V[id]['name'])if not base.thread.find("Home")then base.thread.create("Home",program.main.home)end;base.thread.switch("Home")end else if base.thread.find(V[id]['name'])then base.thread.switch(V[id]['name'])end end end elseif t==42 then if#V>=4+R then R=R+1;program.draw.menu.tasks(Q,false)end elseif t>=45 and t<=51 then if Q then Q=false;program.draw.menu.tasks(false,true)else Q=true;program.draw.menu.tasks(true,true)end end end end end;function program.draw.menu.tasks(W,X)local V=base.thread.list()if W then if X then for Y=51,1,-3 do base.draw.box(Y,3,2,1," ","lightGrey","lightGrey")sleep(0.001)end;base.draw.box(1,51,2,1," ","lightGrey","lightGrey")base.draw.textr("Close >",2,false,"white","lightGrey")local Z={3,13,23,33}local j={"Dash","Apps","Cloud","Mail","Settings","CronTab"}base.draw.texta("<",1,2,false,"red","lightGrey")base.draw.texta(">",42,2,false,"red","lightGrey")for k,l in ipairs(Z)do if#V>=k+R then if V[k+R]['name']==currentThread['name']then base.draw.texta("         ",Z[k],2,false,"lightGrey","lightGrey")base.draw.texta('x',Z[k],2,false,"red","lightGrey")base.draw.texta(tostring(V[k+R]['name']:sub(1,6)),Z[k]+2,2,false,"lightBlue","lightGrey")else base.draw.texta("         ",Z[k],2,false,"lightGrey","lightGrey")base.draw.texta(tostring(V[k+R]['name']:sub(1,8)),Z[k],2,false,"lightBlue","lightGrey")end;if X then sleep(0.01)end end end;os.startTimer(1)else local t,u=term.getSize()local Z={3,13,23,33}local j={"Dash","Apps","Cloud","Mail"}base.draw.box(1,t,2,1," ","lightGrey","lightGrey")base.draw.textr("Close >",2,false,"white","lightGrey")for k,l in ipairs(Z)do if#V>=k+R then if V[k+R]['name']==currentThread['name']then base.draw.texta("         ",Z[k],2,false,"lightGrey","lightGrey")base.draw.texta('x',Z[k],2,false,"red","lightGrey")base.draw.texta(tostring(V[k+R]['name']:sub(1,6)),Z[k]+2,2,false,"lightBlue","lightGrey")else base.draw.texta("         ",Z[k],2,false,"lightGrey","lightGrey")base.draw.texta(tostring(V[k+R]['name']:sub(1,8)),Z[k],2,false,"lightBlue","lightGrey")end end end;base.draw.texta("<",1,2,false,"red","lightGrey")base.draw.texta(">",42,2,false,"red","lightGrey")end else if X then for Y=1,51,3 do base.draw.box(Y,3,2,1," ","grey","grey")sleep(0.001)end;base.draw.box(1,51,2,1," ","grey","grey")os.startTimer(1)end;base.draw.textl(Internal.System.ActiveScreen,2,false,"black","grey")if X then sleep(0.01)end;base.draw.textr("Tasks <",2,false,"white","grey")end end;function program.main.home()if Internal.System.Platform=="Desktop"then base.screen.colour("white")program.draw.menubar("Dashboard")local b,c=term.getSize()base.draw.box(1,b,c,1," ","grey","grey")local a0=Discover.User:LoggedIn()local a1={["icon_name"]="login",["base_func"]="account",["func_name"]="login",["thrd_name"]="Account",["req_login"]=false}local a2={["icon_name"]="logout",["base_func"]="account",["func_name"]="logout",["thrd_name"]="Logout",["req_login"]=true}local a3={{["icon_name"]="login",["base_func"]="account",["func_name"]="login",["thrd_name"]="Account",["req_login"]=false},{["icon_name"]="appStore",["base_func"]="apps",["func_name"]="main",["thrd_name"]="Apps",["req_login"]=false},{["icon_name"]="snippetStore",["base_func"]="snippets",["func_name"]="main",["thrd_name"]="Snippets",["req_login"]=false},{["icon_name"]="cloudStorage",["base_func"]="cloud",["func_name"]="main",["thrd_name"]="Cloud",["req_login"]=true},{["icon_name"]="mailbox",["base_func"]="mail",["func_name"]="main",["thrd_name"]="Mail",["req_login"]=true},{["icon_name"]="newsFeed",["base_func"]="feed",["func_name"]="view",["thrd_name"]="Feed",["req_login"]=true},{["icon_name"]="chatRooms",["base_func"]="chat",["func_name"]="main",["thrd_name"]="Chat",["req_login"]=true},{["icon_name"]="profiles",["base_func"]="profile",["func_name"]="main",["thrd_name"]="Profile",["req_login"]=true},{["icon_name"]="accManagement",["base_func"]="account",["func_name"]="manage",["thrd_name"]="Account",["req_login"]=true},{["icon_name"]="tickets",["base_func"]="tickets",["func_name"]="main",["thrd_name"]="Tickets",["req_login"]=true},{["icon_name"]="PluginsManager",["base_func"]="plugins",["func_name"]="main",["thrd_name"]="Plugins",["req_login"]=false},{["icon_name"]="settings",["base_func"]="main",["func_name"]="settings",["thrd_name"]="Settings",["req_login"]=false},{["icon_name"]="updateLogs",["base_func"]="main",["func_name"]="updates",["thrd_name"]="Updates",["req_login"]=false},{["icon_name"]="sysInfo",["base_func"]="main",["func_name"]="details",["thrd_name"]="SysInfo",["req_login"]=false},{["icon_name"]="help",["base_func"]="main",["func_name"]="help",["thrd_name"]="Help",["req_login"]=false},{["icon_name"]="credits",["base_func"]="main",["func_name"]="credits",["thrd_name"]="Credits",["req_login"]=false}}if#Internal.MenuEntries>0 then for k,l in ipairs(Internal.MenuEntries)do table.insert(a3,l)end end;local a4=1;local a5={3,19,35,3,19,35,3,19,35}local a6={4,4,4,9,9,9,14,14,14,14}local a7=math.ceil(#a3/9)local function a8()if Discover.User:LoggedIn()then a3[1]=a2 else a3[1]=a1 end;local a9=a7*9;local ab=a4*9-9;for Y=1,9 do base.draw.box(a5[Y],14,a6[Y],2," ","white","white")base.draw.box(a5[Y],14,a6[Y]+2,2," ","white","white")local ac=ab+Y;if ac<=#a3 then base.draw.texta("ICON"..tostring(ac..":"..a4),a5[Y],a6[Y],false,"red","white")base.gui.image.render(a5[Y],a6[Y],Internal.Icons[a3[ac]["icon_name"]])end end;base.draw.textl(" Page: "..tostring(a4).." / "..tostring(a7),c,false,"cyan","grey")base.draw.textr("Finder ",c,false,"orange","grey")base.draw.textc("Exit",c,false,"red","grey")end;a8()while true do local i={os.pullEvent()}if i[1]=="timer"then program.draw.menubar("Dashboard")if not Discover.User:LoggedIn()==a0 then a8()a0=Discover.User:LoggedIn()end elseif i[1]=="mouse_click"then if i[3]>=1 and i[3]<=b and(i[4]>=1 and i[4]<=2)then program.draw.menu.handler("Home",i[3],i[4])elseif i[3]>=45 and i[3]<=50 and i[4]==19 then if not base.thread.find("Finder")then base.thread.create("Finder",program.main.finder)end;base.thread.switch("Finder")elseif i[3]>=22 and i[3]<=28 and i[4]==19 then base.thread.create("Power",program.core.options,15,7,22,8)base.thread.switch("Power")elseif i[3]>=1 and i[3]<=b and(i[4]>=3 and i[4]<=c-1)then local ab=a4*9-9;if i[3]>=3 and i[3]<=16 and(i[4]>=4 and i[4]<=7)then local ac=ab+1;local ad=false;if ac<=#a3 then if a3[ac]['req_login']==true then if Discover.User:LoggedIn()then ad=true else ad=false end else ad=true end;if ad then if#a3>=ac then if not base.thread.find(a3[ac]["thrd_name"])then base.thread.create(a3[ac]["thrd_name"],program[a3[ac]["base_func"]][a3[ac]["func_name"]])end;base.thread.switch(a3[ac]["thrd_name"])end else base.gui.alert("You need to be logged in to view this")sleep(1)program.main.home()end end elseif i[3]>=19 and i[3]<=32 and(i[4]>=4 and i[4]<=7)then local ac=ab+2;local ad=false;if ac<=#a3 then if a3[ac]['req_login']==true then if Discover.User:LoggedIn()then ad=true else ad=false end else ad=true end;if ad then if#a3>=ac then if not base.thread.find(a3[ac]["thrd_name"])then base.thread.create(a3[ac]["thrd_name"],program[a3[ac]["base_func"]][a3[ac]["func_name"]])end;base.thread.switch(a3[ac]["thrd_name"])end else base.gui.alert("You need to be logged in to view this")sleep(1)program.main.home()end end elseif i[3]>=35 and i[3]<=48 and(i[4]>=4 and i[4]<=7)then local ac=ab+3;local ad=false;if ac<=#a3 then if a3[ac]['req_login']==true then if Discover.User:LoggedIn()then ad=true else ad=false end else ad=true end;if ad then if#a3>=ac then if not base.thread.find(a3[ac]["thrd_name"])then base.thread.create(a3[ac]["thrd_name"],program[a3[ac]["base_func"]][a3[ac]["func_name"]])end;base.thread.switch(a3[ac]["thrd_name"])end else base.gui.alert("You need to be logged in to view this")sleep(1)program.main.home()end end elseif i[3]>=3 and i[3]<=16 and(i[4]>=9 and i[4]<=12)then local ac=ab+4;local ad=false;if ac<=#a3 then if a3[ac]['req_login']==true then if Discover.User:LoggedIn()then ad=true else ad=false end else ad=true end;if ad then if#a3>=ac then if not base.thread.find(a3[ac]["thrd_name"])then base.thread.create(a3[ac]["thrd_name"],program[a3[ac]["base_func"]][a3[ac]["func_name"]])end;base.thread.switch(a3[ac]["thrd_name"])end else base.gui.alert("You need to be logged in to view this")sleep(1)program.main.home()end end elseif i[3]>=19 and i[3]<=32 and(i[4]>=9 and i[4]<=12)then local ac=ab+5;local ad=false;if ac<=#a3 then if a3[ac]['req_login']==true then if Discover.User:LoggedIn()then ad=true else ad=false end else ad=true end;if ad then if#a3>=ac then if not base.thread.find(a3[ac]["thrd_name"])then base.thread.create(a3[ac]["thrd_name"],program[a3[ac]["base_func"]][a3[ac]["func_name"]])end;base.thread.switch(a3[ac]["thrd_name"])end else base.gui.alert("You need to be logged in to view this")sleep(1)program.main.home()end end elseif i[3]>=35 and i[3]<=48 and(i[4]>=9 and i[4]<=12)then local ac=ab+6;local ad=false;if ac<=#a3 then if a3[ac]['req_login']==true then if Discover.User:LoggedIn()then ad=true else ad=false end else ad=true end;if ad then if#a3>=ac then if not base.thread.find(a3[ac]["thrd_name"])then base.thread.create(a3[ac]["thrd_name"],program[a3[ac]["base_func"]][a3[ac]["func_name"]])end;base.thread.switch(a3[ac]["thrd_name"])end else base.gui.alert("You need to be logged in to view this")sleep(1)program.main.home()end end elseif i[3]>=3 and i[3]<=16 and(i[4]>=14 and i[4]<=17)then local ac=ab+7;local ad=false;if ac<=#a3 then if a3[ac]['req_login']==true then if Discover.User:LoggedIn()then ad=true else ad=false end else ad=true end;if ad then if#a3>=ac then if not base.thread.find(a3[ac]["thrd_name"])then base.thread.create(a3[ac]["thrd_name"],program[a3[ac]["base_func"]][a3[ac]["func_name"]])end;base.thread.switch(a3[ac]["thrd_name"])end else base.gui.alert("You need to be logged in to view this")sleep(1)program.main.home()end end elseif i[3]>=19 and i[3]<=32 and(i[4]>=14 and i[4]<=17)then local ac=ab+8;local ad=false;if ac<=#a3 then if a3[ac]['req_login']==true then if Discover.User:LoggedIn()then ad=true else ad=false end else ad=true end;if ad then if#a3>=ac then if not base.thread.find(a3[ac]["thrd_name"])then base.thread.create(a3[ac]["thrd_name"],program[a3[ac]["base_func"]][a3[ac]["func_name"]])end;base.thread.switch(a3[ac]["thrd_name"])end else base.gui.alert("You need to be logged in to view this")sleep(1)program.main.home()end end elseif i[3]>=35 and i[3]<=48 and(i[4]>=14 and i[4]<=17)then local ac=ab+9;local ad=false;if ac<=#a3 then if a3[ac]['req_login']==true then if Discover.User:LoggedIn()then ad=true else ad=false end else ad=true end;if ad then if#a3>=ac then if not base.thread.find(a3[ac]["thrd_name"])then base.thread.create(a3[ac]["thrd_name"],program[a3[ac]["base_func"]][a3[ac]["func_name"]])end;base.thread.switch(a3[ac]["thrd_name"])end else base.gui.alert("You need to be logged in to view this")sleep(1)program.main.home()end end end end elseif i[1]=="mouse_scroll"then if i[2]==-1 then if a4>1 then a4=a4-1;a8()end elseif i[2]==1 then if a4<a7 then a4=a4+1;a8()end end end end elseif Internal.System.Platform=="Turtle"then elseif Internal.System.Platform=="Pocket"then end end;function program.main.alerts()base.screen.colour("white")program.draw.menubar("Alerts")base.draw.box(1,51,19,1," ","grey","grey")base.draw.textl(" "..#Internal.Alerts.." alert(s)",19,false,"lightBlue","grey")base.draw.textr("Exit ",19,false,"red","grey")local scroll=0;local function ae(scroll)if#Internal.Alerts>0 then for Y=1,14 do if#Internal.Alerts>=Y+scroll then base.draw.box(1,51,Y+3,1," ","white","white")base.draw.texta(Y+scroll..":",1,Y+3,false,"grey","white")base.draw.texta(Internal.Alerts[Y+scroll].message:sub(1,35),5,Y+3,false,"cyan","white")base.draw.texta("X",50,Y+3,false,"red","white")else break end end else base.draw.textc("You have no new alerts",9,false,"red","white")end end;ae(scroll)while true do local i={os.pullEvent()}if i[1]=="timer"then program.draw.menubar("Alerts")elseif i[1]=="mouse_click"then if i[4]>=1 and i[4]<=2 then program.draw.menu.handler("Alerts",i[3],i[4])elseif i[3]>=47 and i[3]<=50 and i[4]==19 then base.thread.remove("Alerts")if not base.thread.find("Home")then base.thread.create("Home",program.main.home)end;base.thread.switch("Home")elseif i[3]>=1 and i[3]<=48 and(i[4]>=4 and i[4]<=17)then local u=i[4]-3+scroll;if#Internal.Alerts>=u then program.main.alerts_view(u)end elseif i[3]==50 then local u=i[4]-3+scroll;if Discover.Notifications:Delete(Internal.Alerts[u].id)then base.gui.alert("Deleted alert!")status,Internal.Alerts=Discover.Notifications:List()sleep(1)program.main.alerts()else base.gui.alert("Could not delete alert!")status,Internal.Alerts=Discover.Notifications:List()sleep(1.5)program.main.alerts_view(id)end end elseif i[1]=="mouse_scroll"then if i[2]==-1 then if scroll>0 then scroll=scroll-1;ae(scroll)end elseif i[2]==1 then if scroll+14<#Internal.Alerts then scroll=scroll+1;ae(scroll)end end end end end;function program.main.alerts_view(id)base.screen.colour("white")program.draw.menubar("Alerts: View")base.draw.box(1,51,19,1," ","grey","grey")base.draw.texta("Exit",47,19,false,"orange","grey")base.draw.texta("Delete",2,19,false,"lightBlue","grey")for k,l in ipairs(base.data.wordwrap(Internal.Alerts[id].message,51))do base.draw.texta(l,1,k+3,false,"cyan","white")end;base.draw.textc("Time Stamp: "..tostring(Internal.Alerts[id].ntime),18,false,"lightGrey","white")while true do local i={os.pullEvent()}if i[1]=="timer"then program.draw.menubar("Alerts: View")elseif i[1]=="mouse_click"then if i[4]>=1 and i[4]<=2 then program.draw.menu.handler("Alerts: View",i[3],i[4])elseif i[3]>=47 and i[3]<=50 and i[4]==19 then program.main.alerts()elseif i[3]>=2 and i[3]<=7 and i[4]==19 then if Discover.Notifications:Delete(Internal.Alerts[id].id)then base.gui.alert("Deleted notification!")status,Internal.Alerts=Discover.Notifications:List()sleep(1)program.main.alerts()else base.gui.alert("Could not delete notification!")status,Internal.Alerts=Discover.Notifications:List()sleep(1.5)program.main.alerts_view(id)end end end end end;function program.main.details()base.screen.colour("white")program.draw.menubar("System: Details")local j="When giving bug reports it\'s always good to give as much information as possible. Below is a list of the versions, builds etc for the Discover API, the Base API and the Discover App. If you can include the versions for each in every bug report. Formatted like Version:Build."for k,l in ipairs(base.data.wordwrap(j,49))do base.draw.textl(" "..tostring(l),k+3,false,"lightGrey","white")end;base.draw.texta("DiscoverAPI: ",2,12,false,"grey","white")base.draw.texta("Base API: ",2,14,false,"grey","white")base.draw.texta("DiscoverApp: ",2,16,false,"grey","white")base.draw.texta("->",20,12,false,"lightGrey","white")base.draw.texta("->",20,14,false,"lightGrey","white")base.draw.texta("->",20,16,false,"lightGrey","white")base.draw.texta(tostring(Discover.Core.Internal.Version..":"..Discover.Core.Internal.Build),24,12,false,"cyan","white")base.draw.texta(tostring(base.core.getVersion(true)),24,14,false,"cyan","white")base.draw.texta(tostring(Internal.Details.Version..":"..Internal.Details.Build),24,16,false,"cyan","white")base.draw.box(1,51,19,1," ","grey","grey")base.draw.textr("Exit ",19,false,"orange","grey")while true do local i={os.pullEvent()}if i[1]=="timer"then program.draw.menubar("System: Details")elseif i[1]=="mouse_click"then if i[4]>=1 and i[4]<=2 then program.draw.menu.handler("System: Details",i[3],i[4])elseif i[3]>=47 and i[3]<=50 and i[4]==19 then base.thread.remove("SysInfo")base.thread.switch("Home")end end end end;function program.main.credits()base.screen.colour("white")program.draw.menubar("Credits")local scroll=0;base.draw.box(1,51,19,1," ","grey","grey")base.draw.textr("Exit ",19,false,"orange","grey")local af={":","=","+ Credits","=","- Well as a note from myself (Danny), I just want to say thank you for using the App Store, and of course the Discover App. This app will encorporate mostly everything I make now, as it is easier to keep up one app, then multiple apps. I also plan to encorporate full embedding functions into this, as well as CLI version.","=","- If you ever want to help work on the app with me or other, please please please! Just ask, the help is appreciated and I have multiple things I need to add to this while it is in Beta, before it even gets branded as a release. Also if you find any bugs please submit them here: http://git.dannysmc.com/dannysmc95/DiscoverApp/issues; again thank you.","=",":","=","+ Thanks to","=","- I wanted to say thank you to a few people including: Creator, as he was a good tester and was always giving feedback in the early days of the app, as well as Cranium for a few code snippets that have helped massively (probably doesn't even know it). I also want to thank ByteMe who helped me make the first step at designing the interface, (if you look back on the thread).","=",":","=","+ Thanks to the Beta Testers","=","- Well I would like to say thank you to my beta testers who went through the program and got most of the bugs before release: Mumbai, thecrimulo, Checco2212, and CompuTech. So thank you for your hard work on finding the bugs for me.","=",":","=","+ Other Developers / Ideas","=","- Well if you didn't know me and WaitDev_ partnered up to help work on the Discover App, he helped a fair amount before leaving the development team due to not enough time, but he did help work on the image editor for apps, the icons on the home menu, and as well as working on a nice to look at menu system.","=",":"}local function a8(P,scroll)for Y=1,14 do if Y+scroll<=#P then base.draw.box(1,51,Y+3,1," ","white","white")if P[Y+scroll]:sub(1,3)=="[T]"then base.draw.texta(P[Y+scroll]:sub(5),3,Y+3,false,"grey","white")elseif P[Y+scroll]:sub(1,3)=="[P]"then base.draw.texta(P[Y+scroll]:sub(5),3,Y+3,false,"cyan","white")elseif P[Y+scroll]:sub(1,3)=="[L]"then base.draw.textc(P[Y+scroll]:sub(5),Y+3,false,"lightGrey","white")elseif P[Y+scroll]:sub(1,3)=="[S]"then base.draw.texta(" ",3,Y+3,false,"cyan","white")end end end end;local function ag(P)local new={}for k,l in ipairs(P)do if l:sub(1,1)=="+"then table.insert(new,"[T]:"..tostring(l:sub(3)))elseif l:sub(1,1)=="-"then for f,ah in ipairs(base.data.wordwrap(l:sub(3),47))do table.insert(new,"[P]:"..tostring(ah))end elseif l:sub(1,1)==":"then table.insert(new,"[L]:"..tostring(string.rep("-",47)))elseif l:sub(1,1)=="="then table.insert(new,"[S]")end end;return new end;local ai=ag(af)a8(ai,scroll)while true do local i={os.pullEvent()}if i[1]=="timer"then program.draw.menubar("Credits")elseif i[1]=="mouse_click"then if i[4]>=1 and i[4]<=2 then program.draw.menu.handler("Credits",i[3],i[4])elseif i[3]>=47 and i[3]<=50 and i[4]==19 then base.thread.remove("Credits")if not base.thread.find("Home")then base.thread.create("Home",program.main.home)end;base.thread.switch("Home")end elseif i[1]=="mouse_scroll"then if i[2]==-1 then if scroll>0 then scroll=scroll-1;a8(ai,scroll)end elseif i[2]==1 then if scroll+14<#ai then scroll=scroll+1;a8(ai,scroll)end end end end end;function program.main.updates(name)tData={{["name"]="Update: 7.0.1 (Beta)",["content"]="First public release. This is a complete re-code of most of the core inner workings of the store including new task manager, menu bar, and home page, as well as better settings screen and also gives access for better plugin support, allowing you to create plugins to install menu tiles to the home screen. I have also added a new CLI based interface, which is internal to the app, but will come out as an external program, that will link directly into the CraftOS shell."},{["name"]="Update: 6.9.4 (Beta)",["content"]="Small updates being pushed ready for the end product. These updates include some minor tweaks to the Discover API that will enable a more controlled functional use for other developers in the long run."},{["name"]="Update: 6.4.8 (Alpha)",["content"]="A new update that adds some new fixes to the main Discover API, including the use of the new Discover Network API Object, and a ton of new code fixes to make storing files easier, this also helps because it uses another form of data storage."},{["name"]="Update: 6.0.1 (Beta)",["content"]="The newest version of the App Store comes with some new surprises! We have a new Social Network category, which allows you to in turn adds a little more to the store. You have two new categories. Mailbox and News Feed. Mailbox is a functional mail client allowing you to send mail to other users and even offers you to send files to and from. If you want to send more than one file then please use Creator's Compress program to compress all the files into one file then use that file to send to another user. I am working on a live chat system currently allowing you to do even more, this will come in the next version I hope, I have also added an issue reporter, so when you have an error in your program you can actually send issues to me directly where I can work on them and fix them. The feed is actually a simple news feed where you can post updates and even just general chat. Hopefully when the chat comes you will have a live chat you can interact with."},{["name"]="Update: 5.9.8 (Beta)",["content"]="Added Beta versions of the Discover Social code, including the Mailbox, Live Chat and the News Feed options. Mailbox is completed so far I am just working on the news feed next and then the live chat as the live chat may be a problem."},{["name"]="Update: 5.8.1 (Release)",["content"]="Added bug reporting when a crash occurs, it will offer to send the information of the bug to the server for you which then goes to my issue manager. Fixed bug from the edit app page where it was not sending the right data to the discover object."},{["name"]="Update: 5.7.2 (Release)",["content"]="Fixed the delete function, which crashed because of an invalid return from the server, also added a test version of the finder,to access this use the 'f' key on the home menu."},{["name"]="Update: 5.6.1 (Release)",["content"]="Added new loading screen and changed a few bits and bobs on the settings page as well as some new amends for the backend."},{["name"]="Update: 5.5.2 (Release)",["content"]="Added new update logs, converted the API for the store to a newer one called Base, due to it running an old API roughly 2 years out of date."},{["name"]="Update: 5.4.8 (Release)",["content"]="Added limitRead functions to contain the read function, added some new updates to the backend and added the DiscoverX link in the Menu for when it is released to test it out."},{["name"]="Update: 5.3.5 (Release)",["content"]="Added the ability to Upload from pastebin by simply providing a pastebin ID (click toggle on the file path) when uploading, Fixed the exit function, had to amend the coroutine manager (Wasn't exiting/removing threads correctly), added DiscoverX feature menu item."},{["name"]="Update: 5.2.1 (Release)",["content"]="Account modification updates, allowing you to update your email and password using a generated key sent to the currently registered email, to help keep accounts secure. Updated the credits section for all the helpers as well as a few words from me. Added new updates for allowing you to update/edit from the \"View my Apps\" screen instead, allowing you to set the ID from there. You can also now update an app using a pastebin ID as well."},{["name"]="Update: 5.1.3 (Beta)",["content"]="Multiple fixes to the Discover Cloud Network, and added the ability to rename a file, when you click on a file in the files viewer. Added some additions wrapping text so it stays inside the boxes, thanks to Cranium for this code back in 2012 ;)."},{["name"]="Update: 5.0.1 (Alpha)",["content"]="Added DiscoverCloud, Allowing you to upload, download and delete files from a remote server, allowing you to have programs anywhere on any computer! Please see \"Help / FAQ\" for more information about how to use the Cloud and what it can do!"},{["name"]="Update: 4.9.8 (Release)",["content"]="Added a new search screen to search for finding apps!"},{["name"]="Update: 4.8.9 (Release)",["content"]="Added multiple bug fixes!"},{["name"]="Update: 4.8.2 (Beta)",["content"]="Added the notifications system, which was requested by LDDestroier, which when someone comments on your app, then a notification is created for you to view on the little \"N\" in the menubar at the top, or just go to \"My Profile -> Notifications\" and you can see them all there, this will allow you to view them in depth. Made an update for the statistics page as well."},{["name"]="Update: 4.7.0 (Release)",["content"]="Added 2 new console commands 'search' and 'view' which can either search for an app or view an apps meta data."},{["name"]="Update: 4.6.3 (Release)",["content"]="Added a fix for the comments issue, as the validation for auth keys was not working correctly, added some command line functions like 'install' and 'view'."},{["name"]="Update: 4.5.1 (Beta)",["content"]="Added the latest discover cloud options so you can now use the cloud as a FTP type service. Allowing you to upload files to and from the server. Then you can access the files on the web at: http://syncc.dannysmc.com/ the Discover Cloud is the backend part of SynCC, and of course added an exit button."},{["name"]="Update: 4.3.2 (Beta)",["content"]="Added some test code for the Snippets which act like gists I guess for Git, that you can upload bits of code, the character limit is locked at 100,000 characters, as otherwise anymore than that does not really count as a snippet of code. Snippets can have most of the same meta data, other than it uses a new storing method."},{["name"]="Update: 4.2.8 (Beta)",["content"]="Added some changes to the Apps listing to have the categories, versions and all listings all connected, making some room for some more ideas I have for the App Store."},{["name"]="Update: 4.2.1 (Release)",["content"]="After moving web servers I added some more bug fixes to allow the application to gain access to my web server again, as I had a lot of changes that had to be performed."},{["name"]="Update: 4.1.4 (Beta)",["content"]="Fixed a few bugs, like Help / FAQ and Updates screens where there was problems with clickable regions. Fixed the inability to scroll up on certain emulators on the Versions and Categories screens, not sure why, just coded it a little more bullet proof. Added up new account screens, removed user settings because it was a waste of a button."},{["name"]="Update: 4.1.1 (Beta)",["content"]="Currently the recent release, this is where everything was coded and functioning this is for all of the great store users to be able to test the Store, and tell me what they think, and give useful feedback, in the settings menu you can actually submit bugs, and review what you think of the Discover Store, and the new name. Also do you like the new API, this was built with security and ease in one."},{["name"]="Update: 4.0.1 (Alpha)",["content"]="This update was the very first version of the new re-coded store App, this had all the correct versions of the new DiscoverAPI. This was coded without multitasking, but with the new system and the way the Store would function I felt it would be better to incorporate the new Thread System. The new threads manager harnesses ComputerCraft's alternative to multitasking allowing multiple threads, with little or no problem, and the new task manager I added to be able to flick through tasks with ease."}}if name:sub(1,7)=="content"then local scroll=0;conid=tonumber(name:sub(8))base.screen.colour("white")program.draw.menubar("Updates Log")base.draw.box(1,51,19,1," ","grey","grey")base.draw.texta("Back",2,19,false,"lightBlue","grey")base.draw.textr("Scroll enabled ",19,false,"orange","grey")pagecontent=base.data.wordwrap(tData[conid].content,49)local function ae(scroll)for Y=1,14 do if#pagecontent>=Y+scroll then base.draw.box(1,51,Y+3,1," ","white","white")base.draw.textl(pagecontent[Y+scroll],Y+3,false,"cyan","white")else break end end end;ae(scroll)while true do local i={os.pullEvent()}if i[1]=="timer"then program.draw.menubar("Updates Log")elseif i[1]=="mouse_click"then if i[4]>=1 and i[4]<=2 then program.draw.menu.handler("Updates Log",i[3],i[4])elseif i[3]>=2 and i[3]<=5 and i[4]==19 then program.main.updates("menu")end elseif i[1]=="mouse_scroll"then if i[2]==-1 then if scroll>0 then scroll=scroll-1;ae(scroll)end elseif i[2]==1 then if scroll+14<#pagecontent then scroll=scroll+1;ae(scroll)end end end end else local scroll=0;base.screen.colour("white")program.draw.menubar("Updates Log")base.draw.box(1,51,19,1," ","grey","grey")base.draw.textl("Update Logs: "..tostring(#tData),19,false,"lightBlue","grey")base.draw.textr("Exit ",19,false,"orange","grey")local function aj(ak)if tostring(ak):len()==1 then return" "..tostring(ak)else return tostring(ak)end end;local function ae(scroll)for Y=1,14 do if#tData>=Y+scroll then base.draw.box(1,51,Y+3,1," ","white","white")base.draw.texta(tostring(aj(Y+scroll))..": "..tData[Y+scroll].name,1,Y+3,false,"cyan","white")else break end end end;ae(scroll)while true do local i={os.pullEvent()}if i[1]=="timer"then program.draw.menubar("Updates Log")elseif i[1]=="mouse_click"then if i[4]>=1 and i[4]<=2 then program.draw.menu.handler("Help / FAQ",i[3],i[4])elseif i[3]>=47 and i[3]<=50 and i[4]==19 then base.thread.remove("Updates")base.thread.switch("Home")elseif i[3]>=1 and i[3]<=51 and(i[4]>=4 and i[4]<=19)then local al=i[4]-3+scroll;if al<=#tData then program.main.updates("content"..tostring(al))end end elseif i[1]=="mouse_scroll"then if i[2]==-1 then if scroll>0 then scroll=scroll-1;ae(scroll)end elseif i[2]==1 then if scroll+14<#tData then scroll=scroll+1;ae(scroll)end end end end end end;function program.main.help(name)tData={{["name"]="What is DiscoverApp?",["content"]="The DiscoverApp is a powerful app that brings together the Discover Network, for everyone to use with a nice interface and advanced controls. The app includes numerous controls and functions for users to encorporate into their programs, it also includes powerful functionality including plugin control and allows you to download example plugins, and the DiscoverAPI for you to include into your own programs. The base idea for the DiscoverApp is of course the App Store, with other 800 users and 170 apps as of writing this."},{["name"]="What is Discover Social?",["content"]="Discover Social, is just the social part of the Discover App, where it adds more user to user interaction. This includes profiles, chat rooms, mail, news feed and some other upcoming features which makes it all connected."},{["name"]="How to use the App/Snippet Store?",["content"]="To open the app or snippet store just click the tile on the home menu, at this point on both you will be presented with a menu screen, the menu screen is to list options for you to view apps as, think of filters. As well as an App of the day on the right of the page. We also have packages where you can see user created packages of items, examples would be Microsoft package, which adds most microsoft type programs etc. Click on the left bar for an option you wish to use, and then you will load into a view for what you want to see. Same with the snippet store. Uploading/Updating/Editing and other functions are also presented in this menu as I removed them from my account, because of course with the addition of all the other features of the Discover Network, having it would make no sense."},{["name"]="How to use the Mailbox?",["content"]="The mailbox is super easy to use, but to use it click it, and you will be show your inbox (only when logged in), and then here you can view your mail, delete or reply to it. With this you can also see your sent emails and create a new one, of course the recipient is the username you wish to send to, and subject and message are your content. The attachment allows you to specify a file you wish to send to another, currently multi-file sending is not enabled due to a number of performance issues; though this will be added within time, once I have made it more friendly."},{["name"]="How to use Cloud Storage?",["content"]="The cloud storage is like a FileZilla type view, where you can see your remote and local directories side by side, allowing you to press the arrow to send files to and from the cloud, currently the cloud is just a single directory for yourself, but this shall soon change into support for sharing files with others, group directories, and of course folders! This will also come out as a CLI program and a external GUI program."},{["name"]="What is a profile?",["content"]="A profile is a page of information about you. This will collect information from your Apps you have uploaded and of course any information you wish to add to it. This profile represents you, so for this you can write anything about you and updates from the news feed will also come up on your profile."},{["name"]="What is the chat room for?",["content"]="Think of the chat room as just a live chat, it basically uses a live chat system for users to chat in real time over CC. This is quite handy for group chats or anything else. It will soon expand it to a slack/gitter type chat with markdown markup support and file uploading, post pinning and link meta retriever."},{["name"]="Managing your account",["content"]="Your account is in your hands, we have no added a delete option, where it will delete your account, so no information is held about you. This information is yours and we respect that. Your apps can be handed to another player or they will stay under your name. You can also see what notifications you receive, and even write reviews!!"},{["name"]="What is the finder for?",["content"]="The finder is a dynamic page that will collect all functions inside of the Discover App and then outputs them to your screen so you can run them manually or even use them to help figure out your own bugs while creating plugins."},{["name"]="How to make plugins?",["content"]="Plugins are very simple to make and I have made it as super simple to use as possible, first you will need to get the example plugin file, here will explain the base functions of what you can do. The file is found here: http://git.dannysmc.com/snippets/18."},{["name"]="Discover App Settings",["content"]="This has multiple categories, all you should do is choose the category you need and then choose the option and either enable it, disable it or other, this allows you to edit most of the base settings of the Discover App."},{["name"]="Command line interface?",["content"]="This is a feature that will be added in the future, as I am looking at making it an extension for CraftOS."}}if name:sub(1,7)=="content"then local scroll=0;conid=tonumber(name:sub(8))base.screen.colour("white")program.draw.menubar("Help / FAQ")base.draw.box(1,51,19,1," ","grey","grey")base.draw.texta("Back",2,19,false,"lightBlue","grey")base.draw.textr("Scroll enabled ",19,false,"orange","grey")pagecontent=base.data.wordwrap(tData[conid].content,49)local function ae(scroll)for Y=1,14 do if#pagecontent>=Y+scroll then base.draw.box(1,51,Y+3,1," ","white","white")base.draw.textl(pagecontent[Y+scroll],Y+3,false,"cyan","white")else break end end end;ae(scroll)while true do local i={os.pullEvent()}if i[1]=="timer"then program.draw.menubar("Help / FAQ")elseif i[1]=="mouse_click"then if i[4]>=1 and i[4]<=2 then program.draw.menu.handler("Help / FAQ",i[3],i[4])elseif i[3]>=2 and i[3]<=5 and i[4]==19 then program.main.help("menu")end elseif i[1]=="mouse_scroll"then if i[2]==-1 then if scroll>0 then scroll=scroll-1;ae(scroll)end elseif i[2]==1 then if scroll+14<#pagecontent then scroll=scroll+1;ae(scroll)end end end end else local scroll=0;base.screen.colour("white")program.draw.menubar("Help / FAQ")base.draw.box(1,51,19,1," ","grey","grey")base.draw.textl("Help Topics: "..tostring(#tData),19,false,"lightBlue","grey")base.draw.textr("Exit ",19,false,"orange","grey")local function aj(ak)if tostring(ak):len()==1 then return" "..tostring(ak)else return tostring(ak)end end;local function ae(scroll)for Y=1,14 do if#tData>=Y+scroll then base.draw.box(1,51,Y+3,1," ","white","white")base.draw.texta(tostring(aj(Y+scroll))..": "..tData[Y+scroll].name,1,Y+3,false,"cyan","white")else break end end end;ae(scroll)while true do local i={os.pullEvent()}if i[1]=="timer"then program.draw.menubar("Help / FAQ")elseif i[1]=="mouse_click"then if i[4]>=1 and i[4]<=2 then program.draw.menu.handler("Help / FAQ",i[3],i[4])elseif i[3]>=47 and i[3]<=50 and i[4]==19 then base.thread.remove("Help")base.thread.switch("Home")elseif i[3]>=1 and i[3]<=51 and(i[4]>=4 and i[4]<=19)then local al=i[4]-3+scroll;if al<=#tData then program.main.help("content"..tostring(al))end end elseif i[1]=="mouse_scroll"then if i[2]==-1 then if scroll>0 then scroll=scroll-1;ae(scroll)end elseif i[2]==1 then if scroll+14<#tData then scroll=scroll+1;ae(scroll)end end end end end end;function program.main.finder()base.screen.colour("white")program.draw.menubar("Finder")local am={}local scroll=0;base.draw.box(1,51,19,1," ","grey","grey")base.draw.textr("Exit ",19,false,"orange","grey")local function an(P,id)for k,l in pairs(P)do if type(l)=="table"then am[tostring(k)]={}an(l,tostring(k))else if id then table.insert(am[tostring(id)],tostring(k))end end end end;an(program)local function ag(P)local new={}for k,l in pairs(P)do table.insert(new,"+ "..tostring(k))for f,ah in ipairs(l)do table.insert(new,tostring("- "..tostring(ah)))end end;return new end;local function a8(P)for Y=1,14 do if#P>=Y+scroll then base.draw.box(1,20,Y+3,1," ","white","white")if P[Y+scroll]:sub(1,1)=="+"then base.draw.texta(tostring(P[Y+scroll]),3,Y+3,false,"cyan","white")elseif P[Y+scroll]:sub(1,1)=="-"then base.draw.texta(tostring(P[Y+scroll]),6,Y+3,false,"lightGrey","white")end end end end;local j="On the left is all functions inside the DiscoverApp. To run one please click the function, if you wish to run with arguments, right click it instead. Run with caution, as these should only be run when needed by the application, meaning you may cause instability."for k,l in ipairs(base.data.wordwrap(j,29))do base.draw.texta(l,21,k+3,false,"orange","white")end;local ao=ag(am)a8(ao)while true do local i={os.pullEvent()}if i[1]=="timer"then program.draw.menubar("Finder")elseif i[1]=="mouse_click"then if i[4]>=1 and i[4]<=2 then program.draw.menu.handler("Finder",i[3],i[4])elseif i[3]>=47 and i[3]<=50 and i[4]==19 then base.thread.remove("Finder")if not base.thread.find("Home")then base.thread.create("Home",program.main.home)end;base.thread.switch("Home")end elseif i[1]=="mouse_scroll"then if i[2]==-1 then if scroll>0 then scroll=scroll-1;a8(ao)end elseif i[2]==1 then if scroll+14<#ao then scroll=scroll+1;a8(ao)end end end end end;function program.main.settings(S)if S=="help"then base.screen.colour("white")program.draw.menubar("Settings: About")base.draw.box(1,51,19,1," ","grey","grey")base.draw.textr("Back ",19,false,"red","grey")local j="The settings are basically a collection of all options controlled by DiscoverApp. This includes some base configurations, but best of all it contains all a plugins settings, the plugin API for DiscoverApp, has settings management, which works with the internal settings, so you can edit/change any/all settings saved by a plugin. Settings are either 1 of 2 options they are a boolean or a string, even numbers are stored as strings, so please remember to tonumber() the string when you receive it again. To change a setting scroll (if needed) to the setting, and click the edit button, this will then bring up an Accept / Yes and Decline / No option for booleans to either enable or disable an option or for strings it will popup with an input box for you to write your own config value. Please note when making plugins, a plugin should ALWAYS check for a config option first before writing it, as otherwise you could create a new setting which gets saved to file then when you restart DiscoverApp and it loads the configuration file, you will then overwrite the option as plugins are loaded after the config file being loaded. So always check for this."local scroll=0;local ao=base.data.wordwrap(j,49)local function a8()for Y=1,14 do if scroll+Y<=#ao then base.draw.box(1,51,Y+3,1," ","white","white")base.draw.textl(" "..tostring(ao[Y+scroll]),Y+3,false,"cyan","white")end end end;a8()while true do local i={os.pullEvent()}if i[1]=="timer"then program.draw.menubar("Settings: About")elseif i[1]=="mouse_click"then if i[4]>=1 and i[4]<=2 then program.draw.menu.handler("Settings: About",i[3],i[4])elseif i[3]>=47 and i[3]<=50 and i[4]==19 then program.main.settings()end elseif i[1]=="mouse_scroll"then if i[2]==-1 then if scroll>0 then scroll=scroll-1;a8()end elseif i[2]==1 then if#ao>14+scroll then scroll=scroll+1;a8()end end end end else base.screen.colour("white")program.draw.menubar("Settings: Menu")base.draw.box(1,51,19,1," ","grey","grey")base.draw.textr("Exit ",19,false,"red","grey")base.draw.textl(" About",19,false,"lightBlue","grey")base.draw.textc("Refresh",19,false,"orange","grey")base.draw.textl("    Setting Names    |   Value / Enabled   | Edit |",3,false,"lightGrey","white")local scroll=0;local ap={}for k,l in pairs(Internal.Config)do table.insert(ap,k)end;local function a8()for Y=1,13 do if#ap>=Y+scroll then local y=ap[Y+scroll]base.draw.box(1,51,Y+4,1," ","white","white")base.draw.texta(tostring(y:sub(1,20)),2,Y+4,false,"cyan","white")if Internal.Config[y]==true then base.draw.texta(tostring(Internal.Config[y]):sub(1,20),24,Y+4,false,"green","white")elseif Internal.Config[y]==false then base.draw.texta(tostring(Internal.Config[y]):sub(1,20),24,Y+4,false,"red","white")else base.draw.texta(tostring(Internal.Config[y]):sub(1,20),24,Y+4,false,"blue","white")end;base.draw.texta(tostring("Edit"),46,Y+4,false,"orange","white")end end end;local function aq()local A=fs.open(Internal.Config.ConfigFilePath,"w")local B={["Account"]=Internal.Account,["Config"]=Internal.Config}A.write(Discover.Crypto:Base64("encode",textutils.serialize(B)))A.close()base.gui.alert("Setting was changed!")sleep(0.5)for Y=4,18 do base.draw.box(1,51,Y,1," ","white","white")end;a8()end;a8()while true do local i={os.pullEvent()}if i[1]=="timer"then program.draw.menubar("Settings: Menu")elseif i[1]=="mouse_click"then if i[4]>=1 and i[4]<=2 then program.draw.menu.handler("Settings: Menu",i[3],i[4])elseif i[3]>=47 and i[3]<=50 and i[4]==19 then base.thread.remove("Settings")if not base.thread.find("Home")then base.thread.create("Home",program.main.home)end;base.thread.switch("Home")elseif i[3]>=20 and i[3]<=30 and i[4]==19 then a8()elseif i[3]>=2 and i[3]<=6 and i[4]==19 then program.main.settings("help")elseif i[3]>=46 and i[3]<=49 and(i[4]>=5 and i[4]<=17)then local y=i[4]-4+scroll;if#ap>=y then if Internal.Config[ap[y]]==true or Internal.Config[ap[y]]==false then Internal.Config[ap[y]]=base.gui.confirm("Enable / Disable "..tostring(ap[y]))aq()else Internal.Config[ap[y]]=base.gui.input("Change "..tostring(ap[y]).." to")aq()end end end elseif i[1]=="mouse_scroll"then if i[2]==-1 then if scroll>0 then scroll=scroll-1;a8()end elseif i[2]==1 then if#ap>13+scroll then scroll=scroll+1;a8()end end end end end end;function program.apps.main()base.screen.colour("white")program.draw.menubar("Apps: Main")base.draw.box(1,51,19,1," ","grey","grey")base.draw.textl(" Exit",19,false,"orange","grey")base.draw.textr("Search ",19,false,"lightBlue","grey")base.draw.box(2,24,11,1,false,"cyan","cyan")base.draw.box(2,24,13,1,false,"cyan","cyan")base.draw.box(2,24,15,1,false,"cyan","cyan")base.draw.box(2,24,17,1,false,"cyan","cyan")base.draw.box(27,24,11,1,false,"cyan","cyan")base.draw.box(27,24,13,1,false,"red","red")base.draw.box(27,24,15,1,false,"red","red")base.draw.box(27,24,17,1,false,"orange","orange")base.draw.texta("Apps: Newest",3,11,false,"white","cyan")base.draw.texta("Apps: Categories",3,13,false,"white","cyan")base.draw.texta("Apps: Versions",3,15,false,"white","cyan")base.draw.texta("Apps: Packages",3,17,false,"white","cyan")base.draw.texta("Apps: Downloads",28,11,false,"white","cyan")base.draw.texta("Apps: Owned",28,13,false,"white","red")base.draw.texta("Apps: Upload",28,15,false,"white","red")base.draw.texta("Apps: Moderation",28,17,false,"white","orange")local j="Main app store menu, items in cyan are generic, items in red are for being logged in! All account management for apps is found in red. Orange items are for moderators to check apps. To search all the apps, click thes search button in the bottom right corner."for k,l in ipairs(base.data.wordwrap(j,49))do base.draw.textl(" "..tostring(l),k+3,false,"lightGrey","white")end;while true do local i={os.pullEvent()}if i[1]=="timer"then program.draw.menubar("Apps: Main")elseif i[1]=="mouse_click"then if i[4]>=1 and i[4]<=2 then program.draw.menu.handler("Apps: Main",i[3],i[4])elseif i[3]>=2 and i[3]<=5 and i[4]==19 then base.thread.remove("Apps")base.thread.switch("Home")elseif i[3]>=45 and i[3]<=50 and i[4]==19 then if not base.thread.find("App:Search")then base.thread.create("App:Search",program.apps.search)end;base.thread.switch("App:Search")elseif i[3]>=2 and i[3]<=24 and i[4]==11 then program.apps.all()program.apps.main()elseif i[3]>=2 and i[3]<=24 and i[4]==13 then program.apps.categories()program.apps.main()elseif i[3]>=2 and i[3]<=24 and i[4]==15 then program.apps.versions()program.apps.main()elseif i[3]>=2 and i[3]<=24 and i[4]==17 then program.apps.packages()program.apps.main()elseif i[3]>=27 and i[3]<=50 and i[4]==11 then program.apps.downloads()program.apps.main()elseif i[3]>=27 and i[3]<=50 and i[4]==13 then if not Discover.User:LoggedIn()then base.gui.alert("You need to be logged in to view this!")sleep(1)program.apps.main()end;program.apps.owned()program.apps.main()elseif i[3]>=27 and i[3]<=50 and i[4]==15 then if not Discover.User:LoggedIn()then base.gui.alert("You need to be logged in to view this!")sleep(1)program.apps.main()end;program.apps.upload()program.apps.main()elseif i[3]>=27 and i[3]<=50 and i[4]==17 then if not Discover.User:LoggedIn()then base.gui.alert("You need to be logged in and staff to view this!")sleep(1)program.apps.main()end;if Discover.User:GetRank()=="Moderator"then base.gui.alert("This feature is still being developed!")sleep(1)program.apps.main()else base.gui.alert("You need to be a moderator to view this!")sleep(1)program.apps.main()end end end end end;function program.apps.all(ar,as)base.screen.colour("white")program.draw.menubar("Apps: All")local scroll=0;base.draw.textc("Downloading Apps Listing...",10,false,"red","white")status,ar=Discover.Apps:List("apps")base.draw.box(1,51,10,1," ","white","white")base.draw.texta("        Categories        |        Versions        ",1,3,false,"white","lightGrey")base.draw.box(1,51,19,1," ","grey","grey")base.draw.texta(tostring("Total Apps: "..#ar),2,19,false,"lightBlue","grey")base.draw.textr("Exit ",19,false,"orange","grey")local function aj(ak)if tostring(ak):len()==1 then return"  "..tostring(ak)elseif tostring(ak):len()==2 then return" "..tostring(ak)else return tostring(ak)end end;local function ae(scroll)for Y=1,13 do if#ar>=Y+scroll then base.draw.box(1,51,Y+4,1," ","white","white")base.draw.textl(aj(Y+scroll)..": "..tostring(ar[Y+scroll].name),Y+4,false,"grey","white")end end end;ae(scroll)while true do local i={os.pullEvent()}if i[1]=="timer"then program.draw.menubar("Apps: All")elseif i[1]=="mouse_click"then if i[4]>=1 and i[4]<=2 then program.draw.menu.handler("Apps: All",i[3],i[4])elseif i[3]>=1 and i[3]<=25 and i[4]==3 then program.apps.categories()elseif i[3]>=26 and i[3]<=51 and i[4]==3 then program.apps.versions()elseif i[3]>=47 and i[3]<=50 and i[4]==19 then program.apps.main()elseif i[3]>=1 and i[3]<=51 and(i[4]>=5 and i[4]<=17)then local al=i[4]-4+scroll;local at="View"..tostring(ar[al].id)base.thread.create(at,program.apps.view)Internal.Swap.Viewer[1]=ar[al].id;Internal.Swap.Viewer[2]=ar;base.thread.switch(at)end elseif i[1]=="mouse_scroll"then if i[2]==-1 then if scroll>0 then scroll=scroll-1;ae(scroll)end elseif i[2]==1 then if scroll+13<=#ar-1 then scroll=scroll+1;ae(scroll)end end end end end;function program.apps.view()base.screen.colour("white")base.draw.textc("Loading...",9,false,"grey","white")local scroll=0;local au=Internal.Swap.Viewer[1]local ar=Internal.Swap.Viewer[2]for k,l in ipairs(ar)do if tonumber(l.id)==tonumber(au)then apppos=k;break end end;local av=base.data.wordwrap(ar[apppos].description,49)base.screen.colour("white")program.draw.menubar("View App "..tostring(ar[apppos].id))base.draw.box(1,51,19,1," ","grey","grey")base.draw.texta("Comments",2,19,false,"lightBlue","grey")local function aw(scroll)for Y=1,7 do if#av>=Y+scroll then base.draw.box(1,51,Y+9,1," ","white","white")base.draw.textl(av[Y+scroll],Y+9,false,"grey","white")end end end;local function ae()base.draw.textl("Name (ID):",4,false,"lightGrey","white")base.draw.texta(ar[apppos].name.." ("..ar[apppos].id..")",12,4,false,"grey","white")base.draw.textl("Category:",5,false,"lightGrey","white")base.draw.texta(ar[apppos].category,12,5,false,"grey","white")base.draw.textl("Version:",6,false,"lightGrey","white")base.draw.texta(ar[apppos].version,12,6,false,"grey","white")base.draw.textl("Creator:",7,false,"lightGrey","white")base.draw.texta(ar[apppos].creator,12,7,false,"grey","white")base.draw.textl("App Hash:",18,false,"lightGrey","white")base.draw.texta(ar[apppos].hash,11,18,false,"grey","white")base.draw.textl("Description",9,false,"lightGrey","white")base.draw.textr(ar[apppos].downloads.." download(s) ",19,false,"orange","grey")aw(scroll)base.draw.texta(" Download ",41,5,false,"white","cyan")base.draw.texta("   App!   ",41,6,false,"white","cyan")end;ae()while true do local i={os.pullEvent()}if i[1]=="timer"then program.draw.menubar("View App "..tostring(ar[apppos].id))elseif i[1]=="mouse_click"then if i[4]>=1 and i[4]<=2 then program.draw.menu.handler("Help / FAQ",i[3],i[4])elseif i[3]>=41 and i[3]<=50 and(i[4]>=5 and i[4]<=6)then Internal.Swap.Download=ar[apppos].id;base.thread.create("Download"..tostring(ar[apppos].id),program.apps.download)base.thread.switch("Download"..tostring(ar[apppos].id))elseif i[3]>=2 and i[3]<=9 and i[4]==19 then program.apps.comments(ar[apppos].id)base.screen.colour("white")program.draw.menubar("View App "..tostring(ar[apppos].id))base.draw.box(1,51,19,1," ","grey","grey")base.draw.texta("Comments",2,19,false,"lightBlue","grey")ae()end elseif i[1]=="mouse_scroll"then if i[2]==-1 then if scroll>0 then scroll=scroll-1;ae(scroll)end elseif i[2]==1 then if scroll+14<=#av then scroll=scroll+1;ae(scroll)end end end end end;function program.apps.download()base.screen.colour("white")program.draw.menubar("Download")local au=Internal.Swap.Download;local j="You are attempting to download an app, please choose a name for the file download"local function ae()for k,l in ipairs(base.data.wordwrap(j,45))do base.draw.textc(l,k+3,false,"grey","white")end;base.draw.texta("File Name / Path:",8,8,false,"lightGrey","white")base.draw.box(8,36,9,1," ","cyan","cyan")base.draw.texta(" Download ",8,12,false,"white","cyan")base.draw.texta(" Cancel ",36,12,false,"white","cyan")end;ae()while true do local i={os.pullEvent()}if i[1]=="timer"then program.draw.menubar("Download")elseif i[1]=="mouse_click"then if i[4]>=1 and i[4]<=2 then program.draw.menu.handler("Download",i[3],i[4])elseif i[3]>=8 and i[3]<=17 and i[4]==12 then if filepath then local status=Discover.Apps:Download(au,filepath)base.gui.alert("Saved!")sleep(1)base.thread.remove("Download"..tostring(au))if not base.thread.find("Apps")then base.thread.create("Apps",program.apps.all)end;base.thread.switch("Apps")else base.draw.box(1,51,14,1," ","white","white")base.draw.textc("Please supply a file path / name!",14,false,"lightGrey","white")end elseif i[3]>=36 and i[3]<=43 and i[4]==12 then base.thread.remove("Download"..tostring(au))base.thread.switch("Home")elseif i[3]>=8 and i[3]<=43 and i[4]==9 then base.draw.box(8,36,9,1," ","cyan","cyan")base.colour.set("white","cyan")term.setCursorPos(8,9)write(": ")filepath=tostring(base.io.limitRead(34))end end end end;function program.apps.comments(au)base.screen.colour("white")base.draw.textc("Downloading comments...",9,false,"grey","white")local scroll=0;local d,ax=Discover.Apps:Comment("list",au)if not d then Internal.Swap.Viewer[1]=au;program.apps.view()end;base.screen.colour("white")program.draw.menubar("Comments: "..tostring(au))base.draw.box(1,51,19,1," ","grey","grey")if Discover.User:LoggedIn()then base.draw.textl(" Add",19,false,"lightBlue","grey")end;base.draw.textr("Back ",19,false,"orange","grey")local function ae(scroll)if#ax==0 then base.draw.textc("No comments to display",9,false,"grey","white")end;for Y=1,14 do if#ax>=Y+scroll then base.draw.box(1,51,Y+9,1," ","white","white")base.draw.textl(ax[Y+scroll].comment,Y+3,false,"grey","white")base.draw.textr(ax[Y+scroll].username,Y+3,false,"cyan","white")end end end;ae(scroll)while true do local i={os.pullEvent()}if i[1]=="timer"then program.draw.menubar("Comments: "..tostring(au))elseif i[1]=="mouse_click"then if i[4]>=1 and i[4]<=2 then program.draw.menu.handler("Comments",i[3],i[4])elseif i[3]>=2 and i[3]<=4 and i[4]==19 then if Discover.User:LoggedIn()then local ay=base.gui.input("Comment Text:")local status=Discover.Apps:Comment("add",au,ay)if status then base.gui.alert("Added!")sleep(0.5)else base.gui.alert("Failed")sleep(1)end;base.screen.colour("white")base.draw.textc("Download comments...",9,false,"grey","white")local scroll=0;d,ax=Discover.Apps:Comment("list",au)if not d then viewapps[1]=au;store.apps.view()end;base.screen.colour("white")program.draw.menubar("Comments: "..tostring(au))base.draw.box(1,51,19,1," ","grey","grey")if Discover.User:LoggedIn()then base.draw.textl(" Add",19,false,"lightBlue","grey")end;base.draw.textr("Back ",19,false,"orange","grey")ae(scroll)end elseif i[3]>=47 and i[3]<=50 and i[4]==19 then break end elseif i[1]=="mouse_scroll"then if i[2]==-1 then if scroll>0 then scroll=scroll-1;ae(scroll)end elseif i[2]==1 then if scroll+14<=#ax then scroll=scroll+1;ae(scroll)end end end end end;function program.apps.categories()base.screen.colour("white")program.draw.menubar("Apps: Categories")base.draw.box(21,1,5,13,"|","lightGrey","white")base.draw.box(1,51,19,1," ","grey","grey")local az=0;local aA=0;local status,aB=Discover.Apps:List('categories')local aC={}local aD=""local status,aE=Discover.Apps:List('apps')base.draw.texta("Total Categories: "..#aB,2,19,false,"lightBlue","grey")base.draw.textr("Exit ",19,false,"orange","grey")base.draw.texta("        All         |           Versions           ",1,3,false,"white","lightGrey")local function aF(az)for Y=1,13 do if#aB>=Y+az then if aD==aB[Y+az]then base.draw.box(1,19,Y+4,1," ","white","white")base.draw.texta(aB[Y+az],1,Y+4,false,"grey","white")else base.draw.box(1,19,Y+4,1," ","white","white")base.draw.texta(aB[Y+az],1,Y+4,false,"cyan","white")end end end end;local function aG(aA)for Y=1,13 do if#aC>=Y+aA then base.draw.box(22,29,Y+4,1," ","white","white")base.draw.texta(aC[Y+aA].name:sub(1,25),23,Y+4,false,"grey","white")end end end;aF(az)aG(aA)while true do local i={os.pullEvent()}if i[1]=="timer"then program.draw.menubar("Apps: Categories")elseif i[1]=="mouse_click"then if i[4]>=1 and i[4]<=2 then program.draw.menu.handler("Apps: Categories",i[3],i[4])elseif i[3]>=1 and i[3]<=25 and i[4]==3 then program.apps.all()elseif i[3]>=26 and i[3]<=51 and i[4]==3 then program.apps.versions()elseif i[3]>=47 and i[3]<=50 and i[4]==19 then program.apps.main()elseif i[3]>=1 and i[3]<=20 and(i[4]>=5 and i[4]<=17)then local aH=i[4]-4+az;if#aB>=aH then aD=aB[aH]aC={}for k,l in ipairs(aE)do if l.category==aD then aC[#aC+1]=l end end;for Y=1,14 do base.draw.box(22,29,Y+3,1,false,"white","white")end;aA=0;aG(aA)aF(az)end elseif i[3]>=22 and i[3]<=51 and(i[4]>=5 and i[4]<=17)then local aH=i[4]-4+aA;if#aC>=aH then Internal.Swap.Viewer[1]=aC[aH].id;Internal.Swap.Viewer[2]=aE;if not base.thread.find("View"..tostring(aC[aH].id))then base.thread.create("View"..tostring(aC[aH].id),program.apps.view)end;base.thread.switch("View"..tostring(aC[aH].id))end end elseif i[1]=="mouse_scroll"then if i[2]==-1 then if i[3]>=1 and i[3]<=20 and(i[4]>=4 and i[4]<=17)then if az>0 then az=az-1;aF(az)end elseif i[3]>=22 and i[3]<=51 and(i[4]>=4 and i[4]<=17)then if aA>0 then aA=aA-1;aG(aA)end end elseif i[2]==1 then if i[3]>=1 and i[3]<=20 and(i[4]>=4 and i[4]<=17)then if az+14<=#aB-1 then az=az+1;aF(az)end elseif i[3]>=22 and i[3]<=51 and(i[4]>=4 and i[4]<=17)then if aA+14<=#aC-1 then aA=aA+1;aG(aA)end end end end end end;function program.apps.versions(aI)base.screen.colour("white")program.draw.menubar("Apps: Versions")base.draw.box(21,1,5,13,"|","lightGrey","white")base.draw.box(1,51,19,1," ","grey","grey")local az=0;local aA=0;local status,aB=Discover.Apps:List("versions")local aC={}local aD=""local status,aE=Discover.Apps:List("apps")base.draw.texta("Total Versions: "..#aB,2,19,false,"lightBlue","grey")base.draw.textr("Exit ",19,false,"orange","grey")base.draw.texta("        All         |          Categories          ",1,3,false,"white","lightGrey")local function aF(az)for Y=1,13 do if#aB>=Y+az then if aD==aB[Y+az]then base.draw.box(1,19,Y+4,1," ","white","white")base.draw.texta(aB[Y+az],1,Y+4,false,"grey","white")else base.draw.box(1,19,Y+4,1," ","white","white")base.draw.texta(aB[Y+az],1,Y+4,false,"cyan","white")end end end end;local function aG(aA)for Y=1,13 do if#aC>=Y+aA then base.draw.box(22,29,Y+4,1," ","white","white")base.draw.texta(aC[Y+aA].name:sub(1,25),23,Y+4,false,"grey","white")end end end;aF(az)aG(aA)while true do local i={os.pullEvent()}if i[1]=="timer"then program.draw.menubar("Apps: Versions")elseif i[1]=="mouse_click"then if i[4]>=1 and i[4]<=2 then program.draw.menu.handler("Apps: Versions",i[3],i[4])elseif i[3]>=1 and i[3]<=25 and i[4]==3 then program.apps.all()elseif i[3]>=26 and i[3]<=51 and i[4]==3 then program.apps.categories()elseif i[3]>=47 and i[3]<=50 and i[4]==19 then program.apps.main()elseif i[3]>=1 and i[3]<=20 and(i[4]>=5 and i[4]<=17)then local aH=i[4]-4+az;if#aB>=aH then aD=aB[aH]aC={}for k,l in ipairs(aE)do if l.version==aD then aC[#aC+1]=l end end;for Y=1,13 do base.draw.box(22,29,Y+3,1,false,"white","white")end;aA=0;aG(aA)aF(az)end elseif i[3]>=22 and i[3]<=51 and(i[4]>=5 and i[4]<=17)then local aH=i[4]-4+aA;if#aC>=aH then Internal.Swap.Viewer[1]=aC[aH].id;Internal.Swap.Viewer[2]=aE;if not base.thread.find("View"..tostring(aC[aH].id))then base.thread.create("View"..tostring(aC[aH].id),program.apps.view)end;base.thread.switch("View"..tostring(aC[aH].id))end end elseif i[1]=="mouse_scroll"then if i[2]==-1 then if i[3]>=1 and i[3]<=20 and(i[4]>=5 and i[4]<=17)then if az>0 then az=az-1;aF(az)end elseif i[3]>=22 and i[3]<=51 and(i[4]>=5 and i[4]<=17)then if aA>0 then aA=aA-1;aG(aA)end end elseif i[2]==1 then if i[3]>=1 and i[3]<=20 and(i[4]>=5 and i[4]<=17)then if az+13<=#aB-1 then az=az+1;aF(az)end elseif i[3]>=22 and i[3]<=51 and(i[4]>=5 and i[4]<=17)then if aA+13<=#aC-1 then aA=aA+1;aG(aA)end end end end end end;function program.apps.search(aJ)if aJ=="mouse_up"then aJ=nil end;base.screen.colour("white")program.draw.menubar("Apps: Search")base.draw.box(1,51,19,1," ","grey","grey")base.draw.box(3,47,19,1," ","lightGrey","lightGrey")base.draw.textc("Click here to search",19,false,"white","lightGrey")local d,ar=Discover.Apps:List("apps")local aK=ar;local scroll=0;if aJ then aK={}for k,l in ipairs(ar)do if string.lower(l.name):match(aJ:lower())then table.insert(aK,l)end end end;local function ae(scroll)if#aK>0 then for Y=1,14 do if scroll+Y<=#aK then base.draw.box(1,51,Y+3,1," ","white","white")base.draw.texta(tostring(Y+scroll)..": "..aK[Y+scroll].name,1,Y+3,false,"grey","white")end end else base.draw.textc("No apps match your search term",10,false,"red","white")end end;ae(scroll)while true do local i={os.pullEvent()}if i[1]=="timer"then program.draw.menubar("Apps: Search")elseif i[1]=="mouse_click"then if i[4]>=1 and i[4]<=2 then program.draw.menu.handler("Apps: Search",i[3],i[4])elseif i[3]>=3 and i[3]<=49 and i[4]==19 then base.draw.box(3,47,19,1," ","lightGrey","lightGrey")base.colour.set("orange","lightGrey")term.setCursorPos(3,19)write(": ")local aL=tostring(base.io.limitRead(45))term.setCursorPos(1,4)program.apps.search(aL)elseif i[3]>=1 and i[3]<=51 and(i[4]>=4 and i[4]<=17)then local al=i[4]-3+scroll;if al>0 and al<=#aK then local at="View"..tostring(aK[al].id)base.thread.create(at,program.apps.view)Internal.Swap.Viewer[1]=aK[al].id;Internal.Swap.Viewer[2]=ar;base.thread.switch(at)end end elseif i[1]=="mouse_scroll"then if i[2]==-1 then if scroll>0 then scroll=scroll-1;ae(scroll)end elseif i[2]==1 then if scroll+14<#aK then scroll=scroll+1;ae(scroll)end end end end end;function program.apps.downloads(ar,as)base.screen.colour("white")program.draw.menubar("Apps: Downloads")local scroll=0;base.draw.textc("Downloading Apps Listing...",10,false,"red","white")status,ar=Discover.Apps:List("downloads")base.draw.box(1,51,10,1," ","white","white")base.draw.box(1,51,19,1," ","grey","grey")base.draw.texta(tostring("Total Apps: "..#ar),2,19,false,"lightBlue","grey")base.draw.textr("Exit ",19,false,"orange","grey")local function aj(ak)if tostring(ak):len()==1 then return"  "..tostring(ak)elseif tostring(ak):len()==2 then return" "..tostring(ak)else return tostring(ak)end end;local function ae(scroll)for Y=1,14 do if#ar>=Y+scroll then base.draw.box(1,51,Y+3,1," ","white","white")base.draw.textl(aj(Y+scroll)..": "..tostring(ar[Y+scroll].name),Y+3,false,"grey","white")end end end;ae(scroll)while true do local i={os.pullEvent()}if i[1]=="timer"then program.draw.menubar("Apps: Downloads")elseif i[1]=="mouse_click"then if i[4]>=1 and i[4]<=2 then program.draw.menu.handler("Apps: Downloads",i[3],i[4])elseif i[3]>=1 and i[3]<=25 and i[4]==3 then program.apps.categories()elseif i[3]>=26 and i[3]<=51 and i[4]==3 then program.apps.versions()elseif i[3]>=47 and i[3]<=50 and i[4]==19 then program.apps.main()elseif i[3]>=1 and i[3]<=51 and(i[4]>=5 and i[4]<=17)then local al=i[4]-3+scroll;local at="View"..tostring(ar[al].id)base.thread.create(at,program.apps.view)Internal.Swap.Viewer[1]=ar[al].id;Internal.Swap.Viewer[2]=ar;base.thread.switch(at)end elseif i[1]=="mouse_scroll"then if i[2]==-1 then if scroll>0 then scroll=scroll-1;ae(scroll)end elseif i[2]==1 then if scroll+14<=#ar-1 then scroll=scroll+1;ae(scroll)end end end end end;function program.apps.owned()base.screen.colour("white")base.draw.textc("Downloading your apps list...",9,false,"grey","white")local d,ar=Discover.Apps:List("owned")if not d then base.gui.alert("Could not obtain your Apps list...")sleep(1.5)if not base.thread.find("Apps")then base.thread.create("Apps",program.apps.all)end;base.thread.remove("Apps:Owned")base.thread.switch("Apps")end;base.draw.box(1,51,9,1," ","white","white")program.draw.menubar("Apps: Owned")base.draw.box(1,51,19,1," ","grey","grey")base.draw.texta("Your Apps: "..tostring(#ar),2,19,false,"orange","grey")base.draw.textr("Exit ",19,false,"orange","grey")local scroll=0;local function aj(ak)if tostring(ak):len()==1 then return" "..tostring(ak)else return tostring(ak)end end;local function ae(scroll)for Y=1,14 do if#ar>=Y+scroll then base.draw.box(1,51,Y+3,1," ","white","white")base.draw.texta(tostring(aj(Y+scroll)..": "..ar[Y+scroll].name):sub(1,40),1,Y+3,false,"grey","white")base.draw.texta("X",50,Y+3,false,"red","white")base.draw.texta("Edit",44,Y+3,false,"lightBlue","white")base.draw.texta("Upd",40,Y+3,false,"lightBlue","white")end end end;ae(scroll)while true do local i={os.pullEvent()}if i[1]=="timer"then program.draw.menubar("Apps: Owned")elseif i[1]=="mouse_click"then if i[4]>=1 and i[4]<=2 then program.draw.menu.handler("Apps: Owned",i[3],i[4])elseif i[3]>=47 and i[3]<=50 and i[4]==19 then program.apps.main()elseif i[3]>=40 and i[3]<=42 and(i[4]>=4 and i[4]<=17)then local au=ar[i[4]-3+scroll].id;Internal.Swap.Edit=au;base.thread.create("App:Update",program.apps.update)base.thread.switch("App:Update")elseif i[3]>=44 and i[3]<=47 and(i[4]>=4 and i[4]<=17)then local au=ar[i[4]-3+scroll].id;Internal.Swap.Edit=au;base.thread.create("App:Edit",program.apps.edit)base.thread.switch("App:Edit")elseif i[3]==50 and(i[4]>=4 and i[4]<=17)then local au=ar[i[4]-3+scroll].id;local aM=ar[i[4]-3+scroll].name;base.draw.box(8,36,8,2," ","grey","grey")base.draw.box(8,36,10,2," ","grey","grey")local j="To delete the app: "..tostring(aM).." press \"enter\" otherwise please press any other button to exit."for k,l in ipairs(base.data.wordwrap(j,34))do base.draw.texta(l,9,k+7,false,"white","grey")end;while true do local aN,aO=os.pullEvent("key")if aN=="key"then if aO==28 then base.screen.colour("white")store.draw.menu("Apps: Owned")base.colour.set("cyan","white")term.setCursorPos(1,4)print("Deleting...")local status=Discover.Apps:Delete(au)if status then print("\nApp was deleted!!")sleep(0.5)print("Updating local cache...")sleep(0.5)program.apps.owned()else base.gui.alert(discover.data.errormsg)sleep(1.5)program.apps.owned()end else break end else break end end end elseif i[1]=="mouse_scroll"then if i[2]==-1 then if scroll>0 then scroll=scroll-1;ae(scroll)end elseif i[2]==1 then if scroll+14<#ar then scroll=scroll+1;ae(scroll)end end end end end;function program.apps.upload(aP,P)if not P then P={}end;if not aP then aP=""end;if aP=="1"then base.screen.colour("white")program.draw.menubar("Upload: Step 1")base.draw.box(1,51,19,11," ","grey","grey")base.draw.textl(" Cancel",19,false,"orange","grey")base.draw.textr("Next Step ",19,false,"orange","grey")base.draw.textc("Press \"up\" to see preset versions / categories.",18,false,"lightGrey","white")base.draw.textc("Setting up auto-fill settings...",10,false,"red","white")local d,aQ=Discover.Apps:List("versions")local d,aR=Discover.Apps:List("categories")base.draw.box(1,51,10,1," ","white","white")local function ae()base.draw.textc("Please follow on-screen instructions!",4,false,"cyan","white")base.draw.texta("App Name:",8,6,false,"lightGrey","white")base.draw.box(8,36,7,1," ","cyan","cyan")base.draw.texta("App Description:",8,9,false,"lightGrey","white")base.draw.box(8,36,10,1," ","cyan","cyan")base.draw.texta("App Version:",8,12,false,"lightGrey","white")base.draw.box(8,36,13,1," ","cyan","cyan")base.draw.texta("App Category:",8,15,false,"lightGrey","white")base.draw.box(8,36,16,1," ","cyan","cyan")end;local function a8()if up_name then base.draw.texta(tostring(": "..up_name),8,7,false,"white","cyan")end;if up_desc then base.draw.texta(tostring(": "..up_desc),8,10,false,"white","cyan")end;if up_vers then base.draw.texta(tostring(": "..up_vers),8,13,false,"white","cyan")end;if up_cate then base.draw.texta(tostring(": "..up_cate),8,16,false,"white","cyan")end end;a8()ae()while true do local i={os.pullEvent()}if i[1]=="timer"then program.draw.menubar("Upload: Step 1")elseif i[1]=="mouse_click"then if i[4]>=1 and i[4]<=2 then program.draw.menu.handler("Upload",i[3],i[4])elseif i[3]>=2 and i[3]<=7 and i[4]==19 then base.thread.remove("Upload")if not base.thread.find("Account")then base.thread.create("Account",program.main.home)end;base.thread.switch("Account")elseif i[3]>=42 and i[3]<=50 and i[4]==19 then if up_name and up_desc and up_vers and up_cate then program.apps.upload("2")else base.draw.box(1,51,17,1," ","white","white")base.draw.textc("Please fill out all fields",17,false,"red","white")sleep(1)base.draw.box(1,51,17,1," ","white","white")end elseif i[3]>=8 and i[3]<=43 and i[4]==7 then base.draw.box(1,51,7,1," ","white","white")base.draw.box(8,36,7,1," ","cyan","cyan")base.colour.set("white","cyan")term.setCursorPos(8,7)write(": ")up_name=tostring(base.io.limitRead(34))elseif i[3]>=8 and i[3]<=43 and i[4]==10 then base.draw.box(1,51,10,1," ","white","white")base.draw.box(8,36,10,1," ","cyan","cyan")base.colour.set("white","cyan")term.setCursorPos(8,10)write(": ")up_desc=tostring(base.io.limitRead(34))elseif i[3]>=8 and i[3]<=43 and i[4]==13 then base.draw.box(1,51,13,1," ","white","white")base.draw.box(8,36,13,1," ","cyan","cyan")base.colour.set("white","cyan")term.setCursorPos(8,13)write(": ")up_vers=tostring(read(_,aQ))elseif i[3]>=8 and i[3]<=43 and i[4]==16 then base.draw.box(1,51,16,1," ","white","white")base.draw.box(8,36,16,1," ","cyan","cyan")base.colour.set("white","cyan")term.setCursorPos(8,16)write(": ")up_cate=tostring(read(_,aR))end end end elseif aP=="2"then base.screen.colour("white")program.draw.menubar("Upload: Step 2")base.draw.box(1,51,19,11," ","grey","grey")base.draw.textl(" Back",19,false,"orange","grey")base.draw.textr("Upload ",19,false,"orange","grey")base.draw.textc("Setting up auto-fill settings...",10,false,"red","white")local d,aQ=Discover.Apps:List("versions")local d,aR=Discover.Apps:List("categories")base.draw.box(1,51,10,1," ","white","white")local function ae()base.draw.textc("Please follow on-screen instructions!",4,false,"cyan","white")base.draw.texta("App Status:",8,6,false,"lightGrey","white")base.draw.box(8,36,7,1," ","cyan","cyan")base.draw.texta("App\'s file path:",8,9,false,"lightGrey","white")base.draw.box(8,36,10,1," ","cyan","cyan")end;local function aS()up_stat=nil;up_path=nil;up_desc=nil;up_cate=nil;up_vers=nil;up_name=nil;program.apps.main()end;local aT=true;local aU=false;local function aV()if aT then aT=false;aU=true;base.draw.box(8,27,10,1," ","cyan","cyan")base.draw.box(8,27,9,1," ","white","white")base.draw.texta("App\'s file path:",8,9,false,"lightGrey","white")base.draw.texta(" Toggle ",36,10,false,"white","orange")elseif aU then aT=true;aU=false;base.draw.box(8,27,10,1," ","cyan","cyan")base.draw.box(8,27,9,1," ","white","white")base.draw.texta("Pastebin ID:",8,9,false,"lightGrey","white")base.draw.texta(" Toggle ",36,10,false,"white","orange")end end;local function a8()if up_stat then base.draw.texta(tostring(": "..up_stat),8,7,false,"white","cyan")end;if up_path then base.draw.texta(tostring(": "..up_path),8,10,false,"white","cyan")end end;ae()a8()aV()while true do local i={os.pullEvent()}if i[1]=="timer"then program.draw.menubar("Upload: Step 2")elseif i[1]=="mouse_click"then if i[4]>=1 and i[4]<=2 then program.draw.menu.handler("Upload",i[3],i[4])elseif i[3]>=8 and i[3]<=43 and i[4]==7 then base.draw.box(1,51,7,1," ","white","white")base.draw.box(8,36,7,1," ","cyan","cyan")base.colour.set("white","cyan")term.setCursorPos(8,7)write(": ")up_stat=tostring(read(_,{"public","private"}))elseif i[3]>=36 and i[3]<=43 and i[4]==10 then aV()elseif i[3]>=8 and i[3]<=35 and i[4]==10 then base.draw.box(8,27,10,1," ","cyan","cyan")base.colour.set("white","cyan")term.setCursorPos(8,10)write(": ")up_path=tostring(base.io.limitRead(34))elseif i[3]>=45 and i[3]<=50 and i[4]==19 then if up_stat and up_path then for Y=12,17 do base.draw.box(1,51,Y,1," ","white","white")end;if aT then base.draw.texta(":: Downloading File...",8,12,false,"grey","white")app=http.get("http://pastebin.com/raw/"..textutils.urlEncode(tostring(up_path)))base.draw.texta(":: Extracting Data...",8,13,false,"grey","white")up_path_content=app.readAll()elseif aU then base.draw.texta(":: Finding File...",8,12,false,"grey","white")if fs.exists(up_path)then base.draw.texta(":: Extracting Data...",8,13,false,"grey","white")local A=fs.open(up_path,"r")up_path_content=A.readAll()A.close()else base.draw.texta(":: ERROR -> No file found",8,13,false,"grey","white")sleep(1)program.apps.upload("2")end end;base.draw.texta(":: Sending Server Request...",8,14,false,"grey","white")local status=Discover.Apps:Upload(up_name,up_desc,up_vers,up_cate,up_stat,up_path_content,true)if status then base.draw.texta(":: Upload was successfull!",8,15,false,"grey","white")sleep(1)aS()else base.draw.texta(":: Unable to store data",8,15,false,"grey","white")base.draw.texta(":: "..tostring(Discover.User:GetField("ErrorMsg")),8,15,false,"grey","white")sleep(2)end else base.draw.box(1,51,18,1," ","white","white")base.draw.textc("Please fill out all fields",18,false,"red","white")sleep(1)base.draw.box(1,51,18,1," ","white","white")end elseif i[3]>=2 and i[3]<=5 and i[4]==19 then program.apps.upload("1")end end end else base.screen.colour("white")program.draw.menubar("Upload")base.draw.box(1,51,19,11," ","grey","grey")base.draw.textl(" Cancel",19,false,"orange","grey")base.draw.textr("Accept ",19,false,"orange","grey")local scroll=0;base.draw.textc("Setting up auto-fill settings...",10,false,"red","white")local d,aQ=Discover.Apps:List("versions")local d,aR=Discover.Apps:List("categories")base.draw.box(1,51,10,1," ","white","white")base.draw.textc("Downloading meta information...",10,false,"red","white")local d,aW=Discover.Apps:List("versions")local d,aX=Discover.Apps:List("categories")local P={Versions=aW,Categories=aX}local function ae(scroll)base.draw.textc("Please read the following before submitting:",4,false,"lightGrey","white")local j="Apps uploaded to this system are saved to a database/server. We do NOT edit your code and/or modify it for our own use. App moderators will check apps for malicious code to try and stop any kind of data stealing. We also say that if your app is full of errors, it may be set to private, and a notification sent to your account/email in the database, mentioning this - of course once updated you can set it to public again. Program installers are also very welcome."tText=base.data.wordwrap(j,47)for Y=1,12 do if scroll+Y<=#tText then base.draw.box(1,51,Y+5,1," ","white","white")base.draw.texta(tText[Y+scroll],3,Y+5,false,"grey","white")end end end;ae(scroll)while true do local i={os.pullEvent()}if i[1]=="timer"then program.draw.menubar("Upload")elseif i[1]=="mouse_click"then if i[4]>=1 and i[4]<=2 then program.draw.menu.handler("Upload",i[3],i[4])elseif i[3]>=2 and i[3]<=7 and i[4]==19 then program.apps.main()elseif i[3]>=45 and i[3]<=50 and i[4]==19 then program.apps.upload("1",P)end elseif i[1]=="mouse_scroll"then if i[2]==-1 then if scroll>0 then scroll=scroll-1;ae(scroll)end elseif i[2]==1 then if scroll+12<#tText then scroll=scroll+1;ae(scroll)end end end end end end;function program.apps.update()if not Internal.Swap.Edit then upd_stat=nil;upd_path=nil;upd_vers=nil;upd_path_content=nil;Internal.Swap.Edit=nil;base.gui.alert("No update ID given!")base.thread.remove("Update")if not base.thread.find("Apps")then base.thread.create("Apps",program.apps.main)end;base.thread.switch("Apps")end;base.screen.colour("white")program.draw.menubar("Update")base.draw.box(1,51,19,1," ","grey","grey")base.draw.textl(" Cancel",19,false,"orange","grey")base.draw.textr("Update ",19,false,"cyan","grey")base.draw.textc("Setting up auto-fill settings...",10,false,"red","white")local d,aQ=Discover.Apps:List("versions")local d,aR=Discover.Apps:List("categories")base.draw.box(1,51,10,1," ","white","white")local function aS()upd_stat=nil;upd_path=nil;upd_vers=nil;upd_path_content=nil;Internal.Swap.Edit=nil;base.thread.remove("Update")if not base.thread.find("Apps")then base.thread.create("Apps",program.apps.main)end;base.thread.switch("Apps")end;local aU=true;local aT=false;local function aV()if aU then base.draw.box(8,27,15,1," ","white","white")base.draw.texta("File Path:",8,15,false,"lightGrey","white")base.draw.box(8,27,16,1," ","cyan","cyan")base.draw.texta(" Toggle ",36,16,false,"white","orange")elseif aT then base.draw.box(8,27,15,1," ","white","white")base.draw.texta("Pastebin ID:",8,15,false,"lightGrey","white")base.draw.box(8,27,16,1," ","cyan","cyan")base.draw.texta(" Toggle ",36,16,false,"white","orange")end end;aV()local function ae()base.draw.textc("Please follow on-screen instructions!",4,false,"cyan","white")base.draw.texta("App ID:",8,6,false,"lightGrey","white")if Internal.Swap.Edit then base.draw.texta("> "..Internal.Swap.Edit,8,7,false,"red","white")else base.draw.box(8,36,7,1," ","cyan","cyan")end;base.draw.texta("Version:",8,9,false,"lightGrey","white")base.draw.box(8,36,10,1," ","cyan","cyan")base.draw.texta("Status:",8,12,false,"lightGrey","white")base.draw.box(8,36,13,1," ","cyan","cyan")end;ae()while true do local i={os.pullEvent()}if i[1]=="timer"then program.draw.menubar("Update")elseif i[1]=="mouse_click"then if i[4]>=1 and i[4]<=2 then program.draw.menu.handler("Update",i[3],i[4])elseif i[3]>=36 and i[3]<=43 and i[4]==16 then if aU then aT=true;aU=false elseif aT then aU=true;aT=false end;aV()elseif i[3]>=8 and i[3]<=43 and i[4]==7 then base.draw.box(1,51,7,1," ","white","white")base.draw.box(8,36,7,1," ","cyan","cyan")base.colour.set("white","cyan")term.setCursorPos(8,7)write(": ")Internal.Swap.Edit=tostring(base.io.limitRead(34))elseif i[3]>=8 and i[3]<=43 and i[4]==10 then base.draw.box(1,51,10,1," ","white","white")base.draw.box(8,36,10,1," ","cyan","cyan")base.colour.set("white","cyan")term.setCursorPos(8,10)write(": ")upd_vers=tostring(read(_,aQ))elseif i[3]>=8 and i[3]<=43 and i[4]==13 then base.draw.box(1,51,13,1," ","white","white")base.draw.box(8,36,13,1," ","cyan","cyan")base.colour.set("white","cyan")term.setCursorPos(8,13)write(": ")upd_stat=tostring(read(_,{"public","private"}))elseif i[3]>=8 and i[3]<=43 and i[4]==16 then base.draw.box(8,27,16,1," ","white","white")base.draw.box(8,27,16,1," ","cyan","cyan")base.colour.set("white","cyan")term.setCursorPos(8,16)write(": ")upd_path=tostring(read(_,aR))elseif i[3]>=45 and i[3]<=50 and i[4]==19 then if Internal.Swap.Edit and upd_vers and upd_stat and upd_path then if aT then shell.run("pastebin get "..upd_path.." .temp")local J=fs.open(".temp","r")upd_path_content=J.readAll()J.close()fs.delete(".temp")elseif aU then if not fs.exists(upd_path)then base.draw.box(1,51,18,1," ","white","white")base.draw.textc("No file found in the given path",18,false,"red","white")sleep(0.8)base.draw.box(1,51,18,1," ","white","white")program.apps.update()end;local A=fs.open(upd_path,"r")upd_path_content=A.readAll()A.close()end;local status=Discover.Apps:Update(Internal.Swap.Edit,upd_vers,upd_stat,upd_path_content)if status then base.gui.alert("App was updated!")sleep(1)aS()else base.draw.box(1,51,18,1," ","white","white")base.draw.textc(Discover.User:GetField("ErrorMsg"),18,false,"red","white")sleep(1.2)base.draw.box(1,51,18,1," ","white","white")end else base.draw.box(1,51,18,1," ","white","white")base.draw.textc("Please fill out all fields",18,false,"red","white")sleep(0.8)base.draw.box(1,51,18,1," ","white","white")end elseif i[3]>=2 and i[3]<=7 and i[4]==19 then aS()end end end end;function program.apps.packages(aI)base.screen.colour("white")program.draw.menubar("Apps: Packages")base.draw.box(21,1,5,13,"|","lightGrey","white")base.draw.box(1,51,19,1," ","grey","grey")local az=0;local aA=0;local status,aB=Discover.Apps:List("packages")for k,l in ipairs(aB)do if l==""then table.remove(aB,k)end end;local aC={}local aD=""local status,aE=Discover.Apps:List("apps")base.draw.texta("Total Packages: "..#aB,2,19,false,"lightBlue","grey")base.draw.textr("Exit ",19,false,"orange","grey")base.draw.texta("        All         |           Packages           ",1,3,false,"white","lightGrey")local function aF(az)for Y=1,13 do if#aB>=Y+az then if aD==aB[Y+az]then base.draw.box(1,19,Y+4,1," ","white","white")base.draw.texta(aB[Y+az],1,Y+4,false,"grey","white")else base.draw.box(1,19,Y+4,1," ","white","white")base.draw.texta(aB[Y+az],1,Y+4,false,"cyan","white")end end end end;local function aG(aA)for Y=1,13 do if#aC>=Y+aA then base.draw.box(22,29,Y+4,1," ","white","white")base.draw.texta(aC[Y+aA].name:sub(1,25),23,Y+4,false,"grey","white")end end end;aF(az)aG(aA)while true do local i={os.pullEvent()}if i[1]=="timer"then program.draw.menubar("Apps: Packages")elseif i[1]=="mouse_click"then if i[4]>=1 and i[4]<=2 then program.draw.menu.handler("Apps: Packages",i[3],i[4])elseif i[3]>=1 and i[3]<=25 and i[4]==3 then program.apps.all()elseif i[3]>=26 and i[3]<=51 and i[4]==3 then program.apps.categories()elseif i[3]>=47 and i[3]<=50 and i[4]==19 then program.apps.main()elseif i[3]>=1 and i[3]<=20 and(i[4]>=5 and i[4]<=17)then local aH=i[4]-4+az;if#aB>=aH then aD=aB[aH]aC={}for k,l in ipairs(aE)do if l.package==aD then aC[#aC+1]=l end end;for Y=1,13 do base.draw.box(22,29,Y+3,1,false,"white","white")end;aA=0;aG(aA)aF(az)end elseif i[3]>=22 and i[3]<=51 and(i[4]>=5 and i[4]<=17)then local aH=i[4]-4+aA;if#aC>=aH then Internal.Swap.Viewer[1]=aC[aH].id;Internal.Swap.Viewer[2]=aE;if not base.thread.find("View"..tostring(aC[aH].id))then base.thread.create("View"..tostring(aC[aH].id),program.apps.view)end;base.thread.switch("View"..tostring(aC[aH].id))end end elseif i[1]=="mouse_scroll"then if i[2]==-1 then if i[3]>=1 and i[3]<=20 and(i[4]>=5 and i[4]<=17)then if az>0 then az=az-1;aF(az)end elseif i[3]>=22 and i[3]<=51 and(i[4]>=5 and i[4]<=17)then if aA>0 then aA=aA-1;aG(aA)end end elseif i[2]==1 then if i[3]>=1 and i[3]<=20 and(i[4]>=5 and i[4]<=17)then if az+13<=#aB-1 then az=az+1;aF(az)end elseif i[3]>=22 and i[3]<=51 and(i[4]>=5 and i[4]<=17)then if aA+13<=#aC-1 then aA=aA+1;aG(aA)end end end end end end;function program.apps.edit()local au=Internal.Swap.Edit;if not au then base.gui.alert("No App ID Supplied")sleep(1.5)base.thread.remove("App:Edit")if not base.thread.find("Apps")then base.thread.create("Apps",program.apps.main)end;base.thread.switch("Apps")end;base.screen.colour("white")program.draw.menubar("App: Edit")base.draw.box(1,51,19,1," ","grey","grey")base.draw.textl(" Cancel ",19,false,"orange","grey")base.draw.textr("Edit ",19,false,"lightBlue","grey")base.draw.textc("Setting up auto-fill settings...",10,false,"red","white")local d,aR=Discover.Apps:List("categories")base.draw.box(1,51,10,1," ","white","white")local function ae(scroll)base.draw.texta("App ID:",8,4,false,"lightGrey","white")base.draw.texta("> "..Internal.Swap.Edit,8,5,false,"red","white")base.draw.texta("Name:",8,7,false,"lightGrey","white")base.draw.box(8,36,8,1," ","cyan","cyan")base.draw.texta("Description:",8,10,false,"lightGrey","white")base.draw.box(8,36,11,1," ","cyan","cyan")base.draw.texta("Category:",8,13,false,"lightGrey","white")base.draw.box(8,36,14,1," ","cyan","cyan")base.draw.texta("Status:",8,16,false,"lightGrey","white")base.draw.box(8,36,17,1," ","cyan","cyan")end;ae(scroll)while true do local i={os.pullEvent()}if i[1]=="timer"then program.draw.menubar("App: Edit")elseif i[1]=="mouse_click"then if i[4]>=1 and i[4]<=2 then program.draw.menu.handler("App: Edit",i[3],i[4])elseif i[3]>=2 and i[3]<=7 and i[4]==19 then if not base.thread.find("Apps")then base.thread.create("Apps",program.apps.main)end;Internal.Swap.Edit=nil;base.thread.remove("App:Edit")base.thread.switch("Apps")elseif i[3]>=47 and i[3]<=50 and i[4]==19 then local status=Discover.Apps:Edit(au,edit_name,edit_desc,edit_cate,edit_stat)if status then base.gui.alert("Edited!")sleep(0.5)if not base.thread.find("Apps")then base.thread.create("Apps",program.apps.main)end;base.thread.remove("App:Edit")base.thread.switch("Apps")else base.gui.alert(Discover.User:GetField("ErrorMsg"))sleep(1.2)if not base.thread.find("Apps")then base.thread.create("Apps",program.apps.main)end;base.thread.remove("App:Edit")base.thread.switch("Apps")end elseif i[3]>=8 and i[3]<=47 and i[4]==8 then base.draw.box(8,36,8,1," ","cyan","cyan")base.colour.set("white","cyan")term.setCursorPos(8,8)write(": ")edit_name=tostring(base.io.limitRead(34))elseif i[3]>=8 and i[3]<=47 and i[4]==11 then base.draw.box(8,36,11,1," ","cyan","cyan")base.colour.set("white","cyan")term.setCursorPos(8,11)write(": ")edit_desc=tostring(base.io.limitRead(34))elseif i[3]>=8 and i[3]<=47 and i[4]==14 then base.draw.box(8,36,14,1," ","cyan","cyan")base.colour.set("white","cyan")term.setCursorPos(8,14)write(": ")edit_cate=tostring(read(_,aR))elseif i[3]>=8 and i[3]<=47 and i[4]==17 then base.draw.box(8,36,17,1," ","cyan","cyan")base.colour.set("white","cyan")term.setCursorPos(8,17)write(": ")edit_stat=tostring(read(_,{"public","private"}))end end end end;function program.profile.main()base.screen.colour("white")program.draw.menubar("Profile: Main")local N=0;local scroll=0;local ap={'View my profile','Edit my profile'}for Y=1,22 do base.draw.box(Y,1,3,16," ","lightGrey","lightGrey")end;for Y=1,4,2 do N=N+1;base.draw.box(2,20,Y+4,1," ","orange","orange")base.draw.texta(ap[N],3,Y+4,false,"white","orange")end;base.draw.texta("Available Profiles",29,4,false,"lightGrey","white")base.draw.box(1,51,19,1," ","grey","grey")local j="Profiles are a way of showing who you are and will show some basic stats about you and any information you choose."for k,l in ipairs(base.data.wordwrap(j,20))do base.draw.texta(l,2,k+9,false,"red","lightGrey")end;base.draw.textr("Exit ",19,false,"orange","grey")base.draw.texta("Downloading profiles",28,11,false,"red","white")local d,aY=Discover.Profiles:List()local function a8()for Y=1,12 do if Y+scroll<=#aY then base.draw.box(23,26,Y+5,1," ","white","white")base.draw.texta(tostring(Y+scroll)..": "..tostring(aY[Y+scroll]),24,Y+5,false,"cyan","white")end end end;if not d then base.draw.box(23,26,11,1," ","white","white")local aZ="Could not download profiles list"for k,l in ipairs(base.data.wordwrap(aZ,26))do base.draw.texta(l,27,10+k,false,"red","white")end;aY=false else base.draw.box(23,26,11,1," ","white","white")a8()end;while true do local i={os.pullEvent()}if i[1]=="timer"then program.draw.menubar("Profile: Main")elseif i[1]=="mouse_click"then if i[4]>=1 and i[4]<=2 then program.draw.menu.handler("Profile: Main",i[3],i[4])elseif i[3]>=47 and i[3]<=50 and i[4]==19 then base.thread.remove("Profile")base.thread.switch("Home")elseif i[3]>=2 and i[3]<=20 and i[4]==5 then if Discover.User:LoggedIn()then program.profile.view(Discover.User:GetField("Username"))else base.gui.alert("Please login to access this feature")sleep(1)program.profile.main()end elseif i[3]>=2 and i[3]<=20 and i[4]==7 then if Discover.User:LoggedIn()then program.profile.edit(Discover.User:GetField("Username"))else base.gui.alert("Please login to access this feature")sleep(1)program.profile.main()end elseif i[3]>=23 and i[3]<=51 and(i[4]>=6 and i[4]<=16)then local a_=i[4]-5+scroll;if a_<=#aY then program.profile.view(aY[a_])end end elseif i[1]=="mouse_scroll"then if i[2]==-1 then if scroll>0 then scroll=scroll-1;a8()end elseif i[2]==1 then if scroll+12<#aY then scroll=scroll+1;a8()end end end end end;function program.profile.view(username)base.screen.colour("white")program.draw.menubar("Profile: View")local scroll=0;local b0={}base.draw.box(1,51,19,1," ","grey","grey")base.draw.textr("Exit ",19,false,"orange","grey")local function ag(P)local new={}new[#new+1]="[L]"new[#new+1]="[H] "..tostring(P.username).."\'s Profile"new[#new+1]="[L]"new[#new+1]="[S]"new[#new+1]="[K] Name:-:"..tostring(P.name)new[#new+1]="[K] Birthday:-:"..tostring(P.birthday)new[#new+1]="[K] Registered:-:"..tostring(P.registered)new[#new+1]="[K] Website:-:"..tostring(P.website)new[#new+1]="[K] Location:-:"..tostring(P.location)new[#new+1]="[S]"new[#new+1]="[L]"new[#new+1]="[H] Bio / About"new[#new+1]="[S]"for _,l in ipairs(base.data.wordwrap(P.bio,45))do new[#new+1]="[P] "..tostring(l)end;new[#new+1]="[S]"new[#new+1]="[L]"new[#new+1]="[H] Discover Statistics"new[#new+1]="[S]"if not P.app_uploads or P.app_uploads==""then P.app_uploads=0 end;if not P.app_downloads or P.app_downloads==""then P.app_downloads=0 end;new[#new+1]="[K] App Uploads:-:"..tostring(P.app_uploads)new[#new+1]="[K] App Downloads:-:"..tostring(P.app_downloads)new[#new+1]="[K] Snippet Uploads:-:"..tostring(P.snippet_uploads)new[#new+1]="[K] Snippet Downloads:-:"..tostring(P.snippet_downloads)new[#new+1]="[S]"new[#new+1]="[L]"new[#new+1]="[H] Recent Feed Posts"new[#new+1]="[S]"if#P.newsfeed_posts>0 then for k,l in ipairs(P.newsfeed_posts)do for _,ah in ipairs(base.data.wordwrap(l.message,45))do new[#new+1]="[P] "..tostring(ah)end;new[#new+1]="[P] ~"..tostring(l.sent)new[#new+1]="[S]"end else new[#new+1]="[S]"new[#new+1]="[P] No posts to display"new[#new+1]="[S]"end;new[#new+1]="[L]"return new end;local function a8()if#b0==0 then base.draw.textc("No profile data to show",10,false,"red","white")else for Y=1,14 do if Y+scroll<=#b0 then base.draw.box(1,51,Y+3,1," ","white","white")if b0[Y+scroll]:sub(1,3)=="[H]"then base.draw.textc(b0[Y+scroll]:sub(4),Y+3,false,"grey","white")elseif b0[Y+scroll]:sub(1,3)=="[L]"then base.draw.textc(string.rep("-",47),Y+3,false,"lightGrey","white")elseif b0[Y+scroll]:sub(1,3)=="[P]"then base.draw.textc(b0[Y+scroll]:sub(4),Y+3,false,"cyan","white")elseif b0[Y+scroll]:sub(1,3)=="[K]"then local b1=b0[Y+scroll]:sub(4)local b2=b1:find(":-:")local y=b1:sub(1,b2-1)local z=b1:sub(b2+3)base.draw.texta(tostring(y..": "..z),5,Y+3,false,"orange","white")elseif b0[Y+scroll]:sub(1,3)=="[S]"then base.draw.textc(" ",Y+3,false,"white","white")end end end end end;base.draw.textc("Downloading profile of: "..tostring(username),10,false,"red","white")local d,profile=Discover.Profiles:View(username)if not d then local j="Could not download this user's profile, this could be because they do not have a profile, or an error on the server occured. Please try again in a few minutes."for k,l in ipairs(base.data.wordwrap(j,41))do base.draw.textc(l,k+7,false,"red","white")end else b0=ag(profile)base.draw.box(1,51,10,1," ","white","white")a8(b0)end;while true do local i={os.pullEvent()}if i[1]=="timer"then program.draw.menubar("Profile: View")elseif i[1]=="mouse_click"then if i[4]>=1 and i[4]<=2 then program.draw.menu.handler("Profile: View",i[3],i[4])elseif i[3]>=47 and i[3]<=50 and i[4]==19 then program.profile.main()end elseif i[1]=="mouse_scroll"then if i[2]==-1 then if scroll>0 then scroll=scroll-1;a8()end elseif i[2]==1 then if scroll+14<#b0 then scroll=scroll+1;a8()end end end end end;function program.profile.edit(username)base.screen.colour("white")program.draw.menubar("Profile: Edit")base.draw.box(1,51,19,1," ","grey","grey")base.draw.textl(" Exit",19,false,"orange","grey")base.draw.textr("Update ",19,false,"lightBlue","grey")local function a8(P)if not P.name then P.name="Not set"end;if not P.birthday then P.birthday="Not set"end;if not P.website then P.website="Not set"end;if not P.location then P.location="Not set"end;if not P.bio then P.bio="Not set"end;profile=P;base.draw.texta("Name:",8,4,false,"lightGrey","white")base.draw.box(8,36,5,1," ","cyan","cyan")base.draw.texta("Birthday (DD/MM/YYYY):",8,7,false,"lightGrey","white")base.draw.box(8,36,8,1," ","cyan","cyan")base.draw.texta("Website:",8,10,false,"lightGrey","white")base.draw.box(8,36,11,1," ","cyan","cyan")base.draw.texta("Location:",8,13,false,"lightGrey","white")base.draw.box(8,36,14,1," ","cyan","cyan")base.draw.texta("Bio / About:",8,16,false,"lightGrey","white")base.draw.box(8,36,17,1," ","cyan","cyan")base.draw.texta("> "..tostring(P.name:sub(1,35)),8,5,false,"white","cyan")base.draw.texta("> "..tostring(P.birthday:sub(1,35)),8,8,false,"white","cyan")base.draw.texta("> "..tostring(P.website:sub(1,35)),8,11,false,"white","cyan")base.draw.texta("> "..tostring(P.location:sub(1,35)),8,14,false,"white","cyan")base.draw.texta("> "..tostring(P.bio:sub(1,35)),8,17,false,"white","cyan")end;local d,profile=Discover.Profiles:View(username)if not d then local j="Could not download your profile, this might be because you don't have one. Press the create button to create your profile."for k,l in ipairs(base.data.wordwrap(j,41))do base.draw.textc(l,k+5,false,"red","white")end;base.draw.textc("  Create your profile  ",16,false,"white","cyan")while true do local b3={os.pullEvent()}if b3[1]=="mouse_click"then if b3[3]>=10 and b3[3]<=40 and b3[4]==16 then base.screen.colour("white")program.draw.menubar("Profile: Edit")base.draw.box(1,51,19,1," ","grey","grey")base.draw.textl(" Exit",19,false,"orange","grey")base.draw.textr("Update ",19,false,"lightBlue","grey")profile={name=nil,birthday=nil,location=nil,bio=nil,website=nil}a8(profile)break else program.profile.main()end end end else a8(profile)end;while true do local i={os.pullEvent()}if i[1]=="timer"then program.draw.menubar("Profile: Edit")elseif i[1]=="mouse_click"then if i[4]>=1 and i[4]<=2 then program.draw.menu.handler("Profile: Edit",i[3],i[4])elseif i[3]>=2 and i[3]<=6 and i[4]==19 then program.profile.main()elseif i[3]>=45 and i[3]<=50 and i[4]==19 then local A=fs.open("out.lua","w")A.write(textutils.serialize(profile))A.close()local d,e=Discover.Profiles:Edit(profile.name,profile.birthday,profile.location,profile.bio,profile.website)if not d then base.gui.alert("ERR: "..tostring(e))sleep(1.5)program.profile.edit(username)else base.gui.alert("Your profile was updated successfully!")sleep(1)program.profile.edit(username)end elseif i[3]>=8 and i[3]<=43 and i[4]==5 then base.draw.box(8,36,5,1," ","cyan","cyan")term.setCursorPos(8,5)base.colour.set("white","cyan")write(": ")profile.name=tostring(base.io.limitRead(34))elseif i[3]>=8 and i[3]<=43 and i[4]==8 then base.draw.box(8,36,8,1," ","cyan","cyan")term.setCursorPos(8,8)base.colour.set("white","cyan")write(": ")profile.birthday=tostring(base.io.limitRead(34))elseif i[3]>=8 and i[3]<=43 and i[4]==11 then base.draw.box(8,36,11,1," ","cyan","cyan")term.setCursorPos(8,11)base.colour.set("white","cyan")write(": ")profile.website=tostring(base.io.limitRead(34))elseif i[3]>=8 and i[3]<=43 and i[4]==14 then base.draw.box(8,36,14,1," ","cyan","cyan")term.setCursorPos(8,14)base.colour.set("white","cyan")write(": ")profile.location=tostring(base.io.limitRead(34))elseif i[3]>=8 and i[3]<=43 and i[4]==17 then base.draw.box(8,36,17,1," ","cyan","cyan")term.setCursorPos(8,17)base.colour.set("white","cyan")write(": ")profile.bio=tostring(base.io.limitRead(34))end end end end;function program.feed.view(a4)base.screen.colour("white")program.draw.menubar("Feed")local b4={}local scroll=0;base.draw.textc("Downloading feed, please wait...",10,false,"red","white")local status,b5=Discover.Feed:List()if not status then base.gui.alert("Could not download feed")sleep(1)base.thread.remove("Feed")base.thread.switch("Home")end;base.draw.box(1,51,10,1," ","white","white")base.draw.box(1,51,19,1," ","grey","grey")base.draw.textl(" Create Post",19,false,"lightBlue","grey")base.draw.textc("Refresh",19,false,"orange","grey")base.draw.textr("Exit ",19,false,"red","grey")local function ag()b4={}table.insert(b4,":B:")for k,l in ipairs(b5)do table.insert(b4,":A:"..l.author)for Y,b6 in ipairs(base.data.wordwrap(l.message,45))do table.insert(b4,":M:"..b6)end;table.insert(b4,":T:"..l.sent_time)table.insert(b4,":B:")end end;local function a8()for Y=3,18 do base.draw.box(1,51,Y,1," ","white","white")end;base.draw.textc("No feed posts to show",10,false,"red","white")if#b4>0 then for Y=1,14 do if Y+scroll<=#b4 then base.draw.box(1,51,Y+3,1," ","white","white")if b4[Y+scroll]:sub(1,3)==":A:"then base.draw.textl("  "..b4[Y+scroll]:sub(4),Y+3,false,"red","white")elseif b4[Y+scroll]:sub(1,3)==":M:"then base.draw.textl("   "..b4[Y+scroll]:sub(4),Y+3,false,"cyan","white")elseif b4[Y+scroll]:sub(1,3)==":T:"then base.draw.textr(b4[Y+scroll]:sub(4).."  ",Y+3,false,"orange","white")elseif b4[Y+scroll]:sub(1,3)==":B:"then base.draw.textc("- - - - - - - - - - - - - - - - - - - - - - - -",Y+3,false,"lightGrey","white")else end end end else for Y=3,18 do base.draw.box(1,51,Y,1," ","white","white")end;base.draw.textc("No feed posts to show",10,false,"red","white")end end;ag()a8()while true do local i={os.pullEvent()}if i[1]=="timer"then program.draw.menubar("Feed")elseif i[1]=="mouse_click"then if i[4]>=1 and i[4]<=2 then program.draw.menu.handler("Feed",i[3],i[4])elseif i[3]>=2 and i[3]<=12 and i[4]==19 then local message=base.gui.input("What do you want to say?")local status=Discover.Feed:Create(message)if not status then base.gui.alert("Could not create new post")sleep(1)program.feed.view()end;base.gui.alert("Submitted!")sleep(0.5)base.gui.alert("Updating feed...")sleep(0.5)status,b5=Discover.Feed:List()if not status then base.gui.alert("Could not download feed")sleep(1)base.thread.remove("Feed")base.thread.switch("Home")end;ag()a8()elseif i[3]>=20 and i[3]<=30 and i[4]==19 then base.gui.alert("Downloading feed, please wait...")sleep(0.5)status,b5=Discover.Feed:List()if not status then base.gui.alert("Could not download feed")sleep(1)base.thread.remove("Feed")base.thread.switch("Home")end;ag()a8()elseif i[3]>=47 and i[3]<=50 and i[4]==19 then base.thread.remove("Feed")if not base.thread.find("Home")then base.thread.create("Home",program.main.home)end;base.thread.switch("Home")end elseif i[1]=="mouse_scroll"then if i[2]==-1 then if scroll>0 then scroll=scroll-1;a8()end elseif i[2]==1 then if scroll+14<#b4 then scroll=scroll+1;a8()end end end end end;function program.cloud.main()base.screen.colour("white")program.draw.menubar("Cloud")local aA=0;local az=0;local b7={}local b8=fs.list("/")for _,l in ipairs(b8)do if not fs.isDir(l)then table.insert(b7,l)end end;local b9={"Rename"}base.draw.textc("Listing your files, please wait...",10,false,"red","white")local d,ba=Discover.Cloud:List()if ba then base.draw.box(1,51,10,1," ","white","white")else base.gui.alert(tostring(e))sleep(1.5)base.thread.remove("Cloud")base.thread.switch("Home")end;base.draw.box(26,1,3,17," ","grey","grey")base.draw.box(1,51,19,1," ","grey","grey")base.draw.texta("- Local Files -",5,3,false,"lightGrey","white")base.draw.texta("- Remote Files -",32,3,false,"lightGrey","white")base.draw.textr("Exit ",19,false,"orange","grey")local function bb(aA)if#ba>0 then for Y=1,14 do if#ba>=Y+aA then base.draw.box(27,24,Y+4,1," ","white","white")base.draw.texta(ba[Y+aA].filename:sub(1,19),28,Y+4,false,"cyan","white")base.draw.texta("<",48,Y+4,false,"lightBlue","white")base.draw.texta("X",50,Y+4,false,"red","white")else break end end else base.draw.texta("No files to show",31,10,false,"red","white")end end;local function bc(az)if#b7>0 then for Y=1,14 do if#b7>=Y+az then base.draw.box(2,24,Y+4,1," ","white","white")base.draw.texta(b7[Y+az]:sub(1,19),2,Y+4,false,"cyan","white")base.draw.texta(">",22,Y+4,false,"lightBlue","white")base.draw.texta("X",24,Y+4,false,"red","white")else break end end else base.draw.texta("No files to show",2,10,false,"red","white")end end;bb(aA)bc(az)while true do local i={os.pullEvent()}if i[1]=="timer"then program.draw.menubar("Cloud")elseif i[1]=="mouse_click"then if i[4]>=1 and i[4]<=2 then program.draw.menu.handler("Cloud",i[3],i[4])elseif i[3]>=47 and i[3]<=50 and i[4]==19 then base.thread.remove("Cloud")if not base.thread.find("Home")then base.thread.create("Home",program.main.home)end;base.thread.switch("Home")elseif i[3]==22 and(i[4]>=4 and i[4]<=17)then local al=i[4]-4+az;if al>0 and al<=#b7 then if fs.exists(b7[al])then base.gui.alert("Converting file for upload, please wait")sleep(0.25)local status=Discover.Cloud:Create(b7[al])if status then base.gui.alert("File pushed to server!")sleep(0.5)program.cloud.main()else base.gui.alert("File could not be pushed!")sleep(0.5)program.cloud.main()end else base.gui.alert("File doesn't exist!")sleep(0.5)program.cloud.main()end end elseif i[3]>=1 and i[3]<=22 and(i[4]>=4 and i[4]<=17)then local al=i[4]-4+az;if al>0 and al<=#b7 then base.draw.texta(table.concat(b9," | "),2,19,false,"cyan","grey")local F={os.pullEvent("mouse_click")}if F[3]>=2 and F[3]<=7 and F[4]==19 then base.draw.box(8,36,9,2," ","grey","grey")base.draw.box(10,32,10,1," ","lightGrey","lightGrey")base.draw.textc("New File Name",9,false,"white","grey")base.colour.set("black","lightGrey")term.setCursorPos(10,10)write(": ")local bd=tostring(base.io.limitRead(30))fs.move(b7[al],bd)base.gui.alert("File Renamed!")sleep(0.5)program.cloud.main()else base.draw.box(1,30,19,1," ","grey","grey")end end elseif i[3]>=27 and i[3]<=47 and(i[4]>=4 and i[4]<=17)then local al=i[4]-4+aA;if al>0 and al<=#ba then base.draw.texta(table.concat(b9," | "),2,19,false,"cyan","grey")local F={os.pullEvent("mouse_click")}if F[3]>=2 and F[3]<=7 and F[4]==19 then base.draw.box(8,36,9,2," ","grey","grey")base.draw.box(10,32,10,1," ","lightGrey","lightGrey")base.draw.textc("New File Name",9,false,"white","grey")base.colour.set("black","lightGrey")term.setCursorPos(10,10)write(": ")local bd=tostring(base.io.limitRead(30))local status=Discover.Cloud:Rename(ba[al].id,bd)if status then base.gui.alert("File was renamed!")sleep(0.5)program.cloud.main()else base.gui.alert("File could not be renamed!")sleep(0.5)program.cloud.main()end else base.draw.box(1,30,19,1," ","grey","grey")end end elseif i[3]==24 and(i[4]>=4 and i[4]<=17)then local al=i[4]-4+az;if al>0 and al<=#b7 then if fs.exists(b7[al])then fs.delete(b7[al])base.gui.alert("File Deleted!")sleep(0.5)program.cloud.main()else base.gui.alert("File doesn't exist!")sleep(0.5)program.cloud.main()end end elseif i[3]==48 and(i[4]>=4 and i[4]<=17)then local al=i[4]-4+aA;if al>0 and al<=#ba then local A=fs.open(ba[al].filename,"w")A.write(base.base64.decode(ba[al].filedata))A.close()base.gui.alert("File was pulled from server!")sleep(0.5)program.cloud.main()end elseif i[3]==50 and(i[4]>=4 and i[4]<=17)then local al=i[4]-4+aA;if al>0 and al<=#ba then local status=Discover.Cloud:Delete(ba[al].id)if status then base.gui.alert("File was deleted!")sleep(0.5)program.cloud.main()else base.gui.alert("File could not be deleted!")sleep(0.5)program.cloud.main()end end end elseif i[1]=="mouse_scroll"then if i[3]>=1 and i[3]<=25 and(i[4]>=4 and i[4]<=17)then if i[2]==-1 then if az>0 then az=az-1;bc(az)end elseif i[2]==1 then if az+13<#b7 then az=az+1;bc(az)end end elseif i[3]>=27 and i[3]<=51 and(i[4]>=4 and i[4]<=17)then if i[2]==-1 then if aA>0 then aA=aA-1;bb(aA)end elseif i[2]==1 then if aA+13<#ba then aA=aA+1;bb(aA)end end end end end end;function program.mail.main(a4,F,be)if a4=="create"then base.screen.colour("white")program.draw.menubar("Mail: Create")base.draw.texta("Recipient:",8,4,false,"lightGrey","white")base.draw.texta("Subject:",8,7,false,"lightGrey","white")base.draw.texta("Message:",8,10,false,"lightGrey","white")base.draw.texta("Attachment:",8,13,false,"lightGrey","white")base.draw.box(8,36,5,1," ","cyan","cyan")base.draw.box(8,36,8,1," ","cyan","cyan")base.draw.box(8,36,11,1," ","cyan","cyan")base.draw.box(8,36,14,1," ","cyan","cyan")base.draw.box(1,51,19,1," ","grey","grey")base.draw.textl(" Cancel",19,false,"orange","grey")base.draw.textr("Send ",19,false,"lightBlue","grey")if F then base.draw.box(8,36,5,1," ","white","white")base.draw.texta("> "..F,8,5,false,"red","white")recipient=F end;if be then base.draw.box(8,36,8,1," ","white","white")base.draw.texta("> "..be,8,8,false,"red","white")subject=tostring(be)end;while true do local i={os.pullEvent()}if i[1]=="timer"then program.draw.menubar("Mail: Create")elseif i[1]=="mouse_click"then if i[4]>=1 and i[4]<=2 then program.draw.menu.handler("Mail",i[3],i[4])elseif i[3]>=8 and i[3]<=43 and i[4]==5 then base.draw.box(8,36,5,1," ","cyan","cyan")term.setCursorPos(8,5)base.colour.set("white","cyan")write(": ")recipient=tostring(read())elseif i[3]>=8 and i[3]<=43 and i[4]==8 then base.draw.box(8,36,8,1," ","cyan","cyan")term.setCursorPos(8,8)base.colour.set("white","cyan")write(": ")subject=tostring(base.io.limitRead(34))elseif i[3]>=8 and i[3]<=43 and i[4]==11 then base.draw.box(8,36,11,1," ","cyan","cyan")term.setCursorPos(8,11)base.colour.set("white","cyan")write(": ")message=tostring(base.io.limitRead(34))elseif i[3]>=8 and i[3]<=43 and i[4]==14 then base.draw.box(8,36,14,1," ","cyan","cyan")term.setCursorPos(8,14)base.colour.set("white","cyan")write(": ")attachment=tostring(base.io.limitRead(34))elseif i[3]>=2 and i[3]<=7 and i[4]==19 then program.mail.main()elseif i[3]>=47 and i[3]<=50 and i[4]==19 then if recipient and subject and message then if attachment then if fs.exists(attachment)then local A=fs.open(attachment,"r")attachdata=A.readAll()A.close()else base.draw.textc("Incorrect attachment path",18,false,"red","white")sleep(0.5)program.mail.main('create',F)end end;if Discover.Mail:Create(recipient,subject,message,attachdata)then base.gui.alert("Mail was sent!")sleep(0.5)program.mail.main()else base.draw.textc(tostring("Could not send mail"),18,false,"red","white")sleep(0.5)base.draw.box(1,51,18,1," ","white","white")end else base.draw.textc("Please fill in all fields",18,false,"red","white")sleep(0.5)base.draw.box(1,51,18,1," ","white","white")end end end end elseif a4=="sent"then base.screen.colour("white")program.draw.menubar("Mail: Sent")local bf=1;base.draw.textc("Downloading mailbox, please wait",10,false,"red","white")local d,bg=Discover.Mail:List("sent")if not d then error("Could not download mailbox")end;base.draw.box(1,51,10,1," ","white","white")local bh=math.ceil(#bg/3)for Y=1,12 do base.draw.box(Y,1,3,17," ","lightGrey","lightGrey")end;base.draw.box(2,10,5,1," ","orange","orange")base.draw.texta(" Inbox",2,5,false,"white","orange")base.draw.box(2,10,7,1," ","orange","orange")base.draw.texta(" Create",2,7,false,"white","orange")base.draw.box(2,10,9,1," ","orange","orange")base.draw.texta(" Sent",2,9,false,"white","orange")base.draw.textl(" Page: "..bf.."/"..bh,19,false,"white","lightGrey")local function a8()if#bg>0 then local bi=bf*4-4;local bj={4,8,12,16}for Y=1,4 do if Y+bi<=#bg then base.draw.box(13,38,bj[Y],1," ","white","white")base.draw.box(13,38,bj[Y]+1,1," ","white","white")base.draw.box(13,38,bj[Y]+2,1," ","white","white")local f=tostring(bg[Y+bi]['sender'])local ah=f:sub(1,1):upper()local ai=f:sub(2)base.draw.texta(tostring(ah..""..ai),14,bj[Y],false,"grey","white")base.draw.texta(tostring(bg[Y+bi]['subject']:sub(1,30)),14,bj[Y]+1,false,"cyan","white")base.draw.texta(tostring(bg[Y+bi]['sent_date']),14,bj[Y]+2,false,"lightGrey","white")else base.draw.box(13,38,bj[Y],1," ","white","white")base.draw.box(13,38,bj[Y]+1,1," ","white","white")base.draw.box(13,38,bj[Y]+2,1," ","white","white")end end else base.draw.texta("No mail to display",23,11,false,"red","white")end end;a8()while true do local i={os.pullEvent()}if i[1]=="timer"then program.draw.menubar("Mail: Sent")elseif i[1]=="mouse_click"then if i[4]>=1 and i[4]<=2 then program.draw.menu.handler("Mail",i[3],i[4])elseif i[3]>=1 and i[3]<=12 and(i[4]>=3 and i[4]<=19)then if i[3]>=2 and i[3]<=11 and i[4]==5 then program.mail.main()elseif i[3]>=2 and i[3]<=11 and i[4]==7 then program.mail.main("create")elseif i[3]>=2 and i[3]<=11 and i[4]==9 then program.mail.main("sent")end end elseif i[1]=="mouse_scroll"then if i[2]==-1 then if bf>1 then bf=bf-1;a8()base.draw.textl(" Page: "..bf.."/"..bh,19,false,"white","lightGrey")end elseif i[2]==1 then if bf<bh then bf=bf+1;a8()base.draw.textl(" Page: "..bf.."/"..bh,19,false,"white","lightGrey")end end end end elseif a4=="view"and F then base.screen.colour("white")program.draw.menubar("Mail: View")local d,bk=Discover.Mail:List("inbox")if not d then error("Could not download mailbox")end;base.draw.textc("Loading...",10,false,"red","white")local bl={}for k,l in ipairs(bk)do if l.id==F then bl=l;break end end;sleep(0.15)local status=Discover.Mail:Read(bl['id'])base.draw.box(1,51,10,1," ","white","white")local tMessage={}local scroll=0;base.draw.box(1,51,19,1," ","grey","grey")base.draw.textl(" Back",19,false,"orange","grey")base.draw.textr("Reply ",19,false,"cyan","grey")base.draw.textc("Delete",19,false,"red","grey")local function a8()base.draw.texta("--------------------< Message >--------------------",1,8,false,"lightGrey","white")base.draw.texta("To:",2,4,false,"grey","white")base.draw.texta(bl['recipient']:sub(1,22),8,4,false,"lightBlue","white")base.draw.texta("From:",26,4,false,"grey","white")base.draw.texta(bl['sender']:sub(1,22),31,4,false,"lightBlue","white")base.draw.texta("Sent:",2,5,false,"grey","white")base.draw.texta(bl['sent_date'],8,5,false,"lightBlue","white")base.draw.texta("Subject: ",2,6,false,"grey","white")base.draw.texta(bl['subject'],11,6,false,"lightBlue","white")tMessage=base.data.wordwrap(bl['message'],47)end;if bl['attachments']:len()>5 then base.draw.textc("Download attachment",18,false,"lightGrey","white")end;local function bm()for Y=1,7 do if scroll+Y<=#tMessage then base.draw.box(1,51,Y+9,1," ","white","white")base.draw.texta(tMessage[Y+scroll],3,Y+9,false,"grey","white")end end end;a8()bm()while true do local i={os.pullEvent()}if i[1]=="timer"then program.draw.menubar("Mail: View")elseif i[1]=="mouse_click"then if i[4]>=1 and i[4]<=2 then program.draw.menu.handler("Mail",i[3],i[4])elseif i[3]>=2 and i[3]<=5 and i[4]==19 then program.mail.main()elseif i[3]>=46 and i[3]<=50 and i[4]==19 then program.mail.main("create",bl['sender'],bl['subject'])elseif i[3]>=22 and i[3]<=28 and i[4]==19 then base.gui.alert("Deleting...")local status=Discover.Mail:Delete(bl['id'])if status then base.gui.alert("Mail was deleted")sleep(0.5)program.mail.main()else base.gui.alert(tostring(discover.data.errormsg))sleep(1)program.mail.main()end elseif i[3]>=12 and i[3]<=42 and i[4]==18 then if bl['attachments']:len()>5 then local P=base.base64.decode(bl['attachments'])local A=fs.open(base.gui.input("Save as:"),"w")A.write(P)A.close()program.mail.main('view',F)end elseif i[3]>=1 and i[3]<=12 and(i[4]>=3 and i[4]<=19)then if i[3]>=2 and i[3]<=11 and i[4]==5 then program.mail.main()elseif i[3]>=2 and i[3]<=11 and i[4]==7 then program.mail.main("create")elseif i[3]>=2 and i[3]<=11 and i[4]==9 then program.mail.main("sent")end end elseif i[1]=="mouse_scroll"then if i[2]==-1 then if scroll>0 then scroll=scroll-1;bm()end elseif i[2]==1 then if 7+scroll<#tMessage then scroll=scroll+1;bm()end end end end else base.screen.colour("white")program.draw.menubar("Mail: Inbox")local bf=1;base.draw.textc("Download mailbox, please wait",10,false,"red","white")local d,bk=Discover.Mail:List("inbox")if not d then error("Could not download mailbox")end;base.draw.box(1,51,10,1," ","white","white")local bh=math.ceil(#bk/3)for Y=1,12 do base.draw.box(Y,1,3,17," ","lightGrey","lightGrey")end;base.draw.box(2,10,5,1," ","orange","orange")base.draw.texta(" Inbox",2,5,false,"white","orange")base.draw.box(2,10,7,1," ","orange","orange")base.draw.texta(" Create",2,7,false,"white","orange")base.draw.box(2,10,9,1," ","orange","orange")base.draw.texta(" Sent",2,9,false,"white","orange")base.draw.box(2,10,11,1," ","orange","orange")base.draw.texta(" Exit",2,11,false,"white","orange")local bn=0;for k,l in ipairs(bk)do if l.status=='unread'then bn=bn+1 end end;base.draw.textl(" Unread: "..bn,18,false,"white","lightGrey")base.draw.textl(" Page: "..bf.."/"..bh,19,false,"white","lightGrey")local function a8()if#bk>0 then local bi=bf*4-4;local bj={4,8,12,16}for Y=1,4 do if Y+bi<=#bk then base.draw.box(13,39,bj[Y],1," ","white","white")base.draw.box(13,39,bj[Y]+1,1," ","white","white")base.draw.box(13,39,bj[Y]+2,1," ","white","white")local f=tostring(bk[Y+bi]['sender'])local ah=f:sub(1,1):upper()local ai=f:sub(2)if bk[Y+bi]['status']=='unread'then base.draw.texta(tostring(ah..""..ai),14,bj[Y],false,"grey","white")base.draw.texta(tostring(bk[Y+bi]['subject']:sub(1,30)),14,bj[Y]+1,false,"cyan","white")base.draw.texta(tostring(bk[Y+bi]['sent_date']),14,bj[Y]+2,false,"lightGrey","white")base.draw.box(51,1,bj[Y],3," ","red","red")else base.draw.texta(tostring(ah..""..ai),14,bj[Y],false,"grey","white")base.draw.texta(tostring(bk[Y+bi]['subject']:sub(1,30)),14,bj[Y]+1,false,"cyan","white")base.draw.texta(tostring(bk[Y+bi]['sent_date']),14,bj[Y]+2,false,"lightGrey","white")end else base.draw.box(13,39,bj[Y],1," ","white","white")base.draw.box(13,39,bj[Y]+1,1," ","white","white")base.draw.box(13,39,bj[Y]+2,1," ","white","white")end end else base.draw.texta("No mail to display",23,11,false,"red","white")end end;a8()while true do local i={os.pullEvent()}if i[1]=="timer"then program.draw.menubar("Mail: Inbox")elseif i[1]=="mouse_click"then if i[4]>=1 and i[4]<=2 then program.draw.menu.handler("Mail",i[3],i[4])elseif i[3]>=2 and i[3]<=12 and i[4]==11 then base.thread.remove("Mail")base.thread.switch("Home")elseif i[3]>=13 and i[3]<=51 and(i[4]>=3 and i[4]<=19)then if i[4]>=4 and i[4]<=6 then local bo=bf*4-4+1;if bo<=#bk then program.mail.main("view",bk[bo]['id'])end elseif i[4]>=8 and i[4]<=10 then local bo=bf*4-4+2;if bo<=#bk then program.mail.main("view",bk[bo]['id'])end elseif i[4]>=12 and i[4]<=14 then local bo=bf*4-4+3;if bo<=#bk then program.mail.main("view",bk[bo]['id'])end elseif i[4]>=16 and i[4]<=18 then local bo=bf*4-4+4;if bo<=#bk then program.mail.main("view",bk[bo]['id'])end end elseif i[3]>=1 and i[3]<=12 and(i[4]>=3 and i[4]<=19)then if i[3]>=2 and i[3]<=11 and i[4]==5 then program.mail.main()elseif i[3]>=2 and i[3]<=11 and i[4]==7 then program.mail.main("create")elseif i[3]>=2 and i[3]<=11 and i[4]==9 then program.mail.main("sent")end end elseif i[1]=="mouse_scroll"then if i[2]==-1 then if bf>1 then bf=bf-1;a8()base.draw.textl(" Unread: "..bn,18,false,"white","lightGrey")base.draw.textl(" Page: "..bf.."/"..bh,19,false,"white","lightGrey")end elseif i[2]==1 then if bf<bh then bf=bf+1;a8()base.draw.textl(" Unread: "..bn,18,false,"white","lightGrey")base.draw.textl(" Page: "..bf.."/"..bh,19,false,"white","lightGrey")end end end end end end;function program.chat.main()base.screen.colour("white")program.draw.menubar("Chat: Main")base.draw.box(1,51,19,1," ","grey","grey")base.draw.textr("Exit ",19,false,"red","grey")base.draw.textl(" About",19,false,"orange","grey")local scroll=0;base.draw.textc("Downloading groups list ... ",10,false,"red","white")local d,bp=Discover.Chat:List("group")local function a8()for Y=1,14 do if Y+scroll<=#bp then base.draw.box(1,51,Y+3,1," ","white","white")base.draw.texta(" "..tostring(Y+scroll)..": "..tostring(bp[Y+scroll]),24,Y+3,false,"cyan","white")end end end;if not d then base.draw.box(24,27,10,1," ","white","white")base.draw.texta("Could not download groups",27,10,false,"red","white")downloaded_groups=false else base.draw.box(1,51,10,1," ","white","white")downloaded_groups=true;a8()end;local N=0;local ap={"Global Chat","Group Chat"}for Y=1,22 do base.draw.box(Y,1,3,16,false,"lightGrey","lightGrey")end;for Y=1,#ap*2,2 do N=N+1;base.draw.box(2,20,Y+3,1," ","orange","orange")base.draw.texta(ap[N],3,Y+3,false,"white","orange")end;while true do local i={os.pullEvent()}if i[1]=="timer"then program.draw.menubar("Chat: Main")elseif i[1]=="mouse_click"then if i[4]>=1 and i[4]<=2 then program.draw.menu.handler("Chat: Main",i[3],i[4])elseif i[3]>=47 and i[3]<=50 and i[4]==19 then base.thread.remove("Chat")base.thread.switch("Home")elseif i[3]>=2 and i[3]<=6 and i[4]==19 then program.chat.info()elseif i[3]>=2 and i[3]<=21 and i[4]==4 then program.chat.global()elseif i[3]>=2 and i[3]<=21 and i[4]==6 then local bq=base.gui.input("Group name to join?")local br=false;if bq then for _,l in ipairs(bp)do if l==bq then br=true end end end;if not br then local d=base.gui.confirm("Group not found, create it?")if d then local d,e=Discover.Chat:Send("group",bq,"Group created by: "..tostring(Discover.User.Data.Username),true)if d then base.gui.alert("Created new group, joining...")sleep(1)program.chat.group(bq)else base.gui.alert("Failed:"..tostring(e))sleep(1.5)program.chat.main()end else base.gui.alert("Not created, returning...")sleep(0.5)program.chat.main()end end elseif i[3]>=23 and i[3]<=51 and(i[4]>=4 and i[4]<=17)then local id=i[4]-3+scroll;if id<=#bp then program.chat.group(bp[id])end end elseif i[1]=="mouse_scroll"then if downloaded_groups then if i[2]==-1 then if scroll>0 then scroll=scroll-1;a8()end elseif i[2]==1 then if scroll+14<#bp then scroll=scroll+1;a8()end end end end end end;function program.chat.group(bs)base.screen.colour("white")program.draw.menubar("Chat: Group")base.draw.box(1,51,19,1," ","grey","grey")base.draw.textr("Back ",19,false,"red","grey")base.draw.textl(" About",19,false,"lightBlue","grey")base.draw.textc("Anchor",19,false,"orange","grey")base.draw.box(1,51,18,1," ","lightGrey","lightGrey")base.draw.textc("Click to chat",18,false,"white","lightGrey")local bt={}local bu={}local scroll=0;local bv=0;local bw=true;base.draw.textc("Joining chat, please wait...",10,false,"red","white")local d,e=Discover.Chat:Send("group",tostring(bs),"*"..tostring(Discover.User.Data.Username).." has joined the conversation.")if not d then base.gui.alert("Error: "..tostring(e))sleep(1.5)program.chat.main()else base.draw.box(1,51,10,1," ","white","white")end;local function a8()if bw then scroll=#bu-13 end;for Y=1,13 do base.draw.box(1,51,Y+3,1," ","white","white")if#bu>=Y+scroll then if bu[Y+scroll]:sub(1,3)=="[A]"then base.draw.texta(bu[Y+scroll]:sub(4),3,Y+3,false,"lightGrey","white")elseif bu[Y+scroll]:sub(1,3)=="[M]"then base.draw.texta(bu[Y+scroll]:sub(4),4,Y+3,false,"cyan","white")elseif bu[Y+scroll]:sub(1,3)=="[T]"then elseif bu[Y+scroll]:sub(1,3)=="[S]"then end end end end;local function ag()bu={}for Y=#bt,1,-1 do table.insert(bu,"[A]"..tostring(bt[Y].sender).." - "..tostring(bt[Y].sent_time))for _,ah in ipairs(base.data.wordwrap(bt[Y].message,45))do table.insert(bu,"[M]"..tostring(ah))end;table.insert(bu,"[S]")end end;Discover.Chat:View("group",tostring(bs),true)while true do local i={os.pullEvent()}if i[1]=="timer"then program.draw.menubar("Chat: Group")if bv>=10 then Discover.Chat:View("group",tostring(bs),true)bv=0 else bv=bv+1 end elseif i[1]=="mouse_click"then if i[4]>=1 and i[4]<=2 then program.draw.menu.handler("Chat: Group",i[3],i[4])elseif i[3]>=2 and i[3]<=6 and i[4]==19 then local d,e=Discover.Chat:Send("group",tostring(bs),"*"..tostring(Discover.User.Data.Username).." has left the conversation.")program.chat.info("usage")elseif i[3]>=21 and i[3]<=30 and i[4]==19 then bw=true;a8()elseif i[3]>=47 and i[3]<=50 and i[4]==19 then local d,e=Discover.Chat:Send("group",tostring(bs),"*"..tostring(Discover.User.Data.Username).." has left the conversation.")program.chat.main()elseif i[3]>=1 and i[3]<=51 and i[4]==18 then base.draw.box(1,51,18,1," ","lightGrey","lightGrey")base.colour.set("white","lightGrey")term.setCursorPos(1,18)write(": ")local bx=base.io.limitRead(45)local d,e=Discover.Chat:Send("group",tostring(bs),bx)if not d then base.gui.alert("Error: "..tostring(e))sleep(1)local d,e=Discover.Chat:Send("group",tostring(bs),"*"..tostring(Discover.User.Data.Username).." has left the conversation.")program.chat.main()end;base.draw.box(1,51,18,1," ","lightGrey","lightGrey")Discover.Chat:View("group",tostring(bs),true)end elseif i[1]=="http_failure"then elseif i[1]=="http_success"then local d,P=Discover.Chat:Handle(i[3].readAll())bt=P;ag()a8()elseif i[1]=="mouse_scroll"then if i[2]==-1 then if scroll>0 then scroll=scroll-1;bw=false;a8()end elseif i[2]==1 then if scroll+13<#bu then scroll=scroll+1;bw=false;a8()end end end end end;function program.chat.global()base.screen.colour("white")program.draw.menubar("Chat: Global")base.draw.box(1,51,19,1," ","grey","grey")base.draw.textr("Back ",19,false,"red","grey")base.draw.textl(" About",19,false,"lightBlue","grey")base.draw.textc("Anchor",19,false,"orange","grey")base.draw.box(1,51,18,1," ","lightGrey","lightGrey")base.draw.textc("Click to chat",18,false,"white","lightGrey")local bt={}local bu={}local scroll=0;local bv=0;local bw=true;base.draw.textc("Joining chat, please wait...",10,false,"red","white")local d,e=Discover.Chat:Send("global","*"..tostring(Discover.User.Data.Username).." has joined the conversation.")if not d then base.gui.alert("Error: "..tostring(e))sleep(1.5)program.chat.main()end;local function a8()if bw then scroll=#bu-13 end;for Y=1,13 do base.draw.box(1,51,Y+3,1," ","white","white")if#bu>=Y+scroll then if bu[Y+scroll]:sub(1,3)=="[A]"then base.draw.texta(bu[Y+scroll]:sub(4),3,Y+3,false,"lightGrey","white")elseif bu[Y+scroll]:sub(1,3)=="[M]"then base.draw.texta(bu[Y+scroll]:sub(4),4,Y+3,false,"cyan","white")elseif bu[Y+scroll]:sub(1,3)=="[T]"then elseif bu[Y+scroll]:sub(1,3)=="[S]"then end end end end;local function ag()bu={}for Y=#bt,1,-1 do table.insert(bu,"[A]"..tostring(bt[Y].sender).." - "..tostring(bt[Y].sent_time))for _,ah in ipairs(base.data.wordwrap(bt[Y].message,45))do table.insert(bu,"[M]"..tostring(ah))end;table.insert(bu,"[S]")end end;Discover.Chat:View("global",_,true)while true do local i={os.pullEvent()}if i[1]=="timer"then program.draw.menubar("Chat: Global")if bv>=10 then Discover.Chat:View("global",_,true)bv=0 else bv=bv+1 end elseif i[1]=="mouse_click"then if i[4]>=1 and i[4]<=2 then program.draw.menu.handler("Chat: Global",i[3],i[4])elseif i[3]>=2 and i[3]<=6 and i[4]==19 then local d,e=Discover.Chat:Send("global","*"..tostring(Discover.User.Data.Username).." has left the conversation.")program.chat.info("usage")elseif i[3]>=21 and i[3]<=30 and i[4]==19 then bw=true;a8()elseif i[3]>=47 and i[3]<=50 and i[4]==19 then local d,e=Discover.Chat:Send("global","*"..tostring(Discover.User.Data.Username).." has left the conversation.")program.chat.main()elseif i[3]>=1 and i[3]<=51 and i[4]==18 then base.draw.box(1,51,18,1," ","lightGrey","lightGrey")base.colour.set("white","lightGrey")term.setCursorPos(1,18)write(": ")local bx=base.io.limitRead(45)local d,e=Discover.Chat:Send("global",bx)if not d then base.gui.alert("Error: "..tostring(e))sleep(1)local d,e=Discover.Chat:Send("global","*"..tostring(Discover.User.Data.Username).." has left the conversation.")program.chat.main()end;base.draw.box(1,51,18,1," ","lightGrey","lightGrey")Discover.Chat:View("global",_,true)end elseif i[1]=="http_failure"then elseif i[1]=="http_success"then local d,P=Discover.Chat:Handle(i[3].readAll())bt=P;ag()a8()elseif i[1]=="mouse_scroll"then if i[2]==-1 then if scroll>0 then scroll=scroll-1;bw=false;a8()end elseif i[2]==1 then if scroll+13<#bu then scroll=scroll+1;bw=false;a8()end end end end end;function program.chat.info(S)if S=="usage"then base.screen.colour("white")program.draw.menubar("Chat: Info")base.draw.box(1,51,19,1," ","grey","grey")base.draw.textr("Back ",19,false,"red","grey")local j="Using the chat room is simple, to view the messages load the chat you wish to use, and the messages will appear, give it a second, it will also announce your join event. Then it will load. Messages are rendered in a simple to use way, but they are anchored by default to the floor, so the newest messages appear at the bottom. To scroll, this will disable the anchor, to re-enable it, just click anchor text at the bottom centre. To talk in chat, click the message box just before the bottom row, and then you will be able to chat, type your message and press enter, and this will send the data over then update your screen to keep up."local scroll=0;local ao=base.data.wordwrap(j,49)local function a8()for Y=1,14 do if scroll+Y<=#ao then base.draw.box(1,51,Y+3,1," ","white","white")base.draw.textl(" "..tostring(ao[Y+scroll]),Y+3,false,"cyan","white")end end end;a8()while true do local i={os.pullEvent()}if i[1]=="timer"then program.draw.menubar("Chat: Info")elseif i[1]=="mouse_click"then if i[4]>=1 and i[4]<=2 then program.draw.menu.handler("Chat: Info",i[3],i[4])elseif i[3]>=47 and i[3]<=50 and i[4]==19 then program.chat.main()end elseif i[1]=="mouse_scroll"then if i[2]==-1 then if scroll>0 then scroll=scroll-1;a8()end elseif i[2]==1 then if#ao>14+scroll then scroll=scroll+1;a8()end end end end else base.screen.colour("white")program.draw.menubar("Chat: Info")base.draw.box(1,51,19,1," ","grey","grey")base.draw.textr("Back ",19,false,"red","grey")local j="The chat rooms are a beta feature to the DiscoverApp, that in essence will allow you to live chat to other users. You can participate in the global chat, a group chat that you can make or join, and public user to user messages. Please note that group chat is a public feature, which means groups will be listed when wanting to join one, this is only for while it is in beta, then private chats will be enabled. The chat is for users wishing to send messages to other members as well as join in with live chat! The chat supports timestamps also, to show when a message was sent, please understand that this is based of the server location which is GMT+1. Any ideas you wish to see, just send me a message on the CCForums, I am \'DannySMc\' or send me a ticket on the DiscoverApp. If you wish to work on the development of the Discover App, just send me a message also and I can look at adding you onto the git repository."local scroll=0;local ao=base.data.wordwrap(j,49)local function a8()for Y=1,14 do if scroll+Y<=#ao then base.draw.box(1,51,Y+3,1," ","white","white")base.draw.textl(" "..tostring(ao[Y+scroll]),Y+3,false,"cyan","white")end end end;a8()while true do local i={os.pullEvent()}if i[1]=="timer"then program.draw.menubar("Chat: Info")elseif i[1]=="mouse_click"then if i[4]>=1 and i[4]<=2 then program.draw.menu.handler("Chat: Info",i[3],i[4])elseif i[3]>=47 and i[3]<=50 and i[4]==19 then program.chat.main()end elseif i[1]=="mouse_scroll"then if i[2]==-1 then if scroll>0 then scroll=scroll-1;a8()end elseif i[2]==1 then if#ao>14+scroll then scroll=scroll+1;a8()end end end end end end;function program.plugins.main()base.screen.colour("white")program.draw.menubar("Plugins: Main")base.draw.box(1,51,19,1," ","grey","grey")base.draw.textr("Exit ",19,false,"red","grey")base.draw.textl(" About",19,false,"orange","grey")local scroll=0;local N=0;local ap={"Creating a plugin","What are plugins","Installed plugins"}for Y=1,22 do base.draw.box(Y,1,3,16,false,"lightGrey","lightGrey")end;for Y=1,#ap*2,2 do N=N+1;base.draw.box(2,20,Y+3,1," ","orange","orange")base.draw.texta(ap[N],3,Y+3,false,"white","orange")end;local function a8(P)for Y=1,14 do if Y+scroll<=#P then base.draw.box(23,29,Y+3,1," ","white","white")base.draw.texta(Y+scroll..": "..tostring(P[Y+scroll]['name']:sub(1,28)),24,Y+3,false,"cyan","white")end end end;base.draw.texta("Downloading plugins...",26,10,false,"red","white")local d,P=Discover.Plugins:List()if not d then base.gui.alert("Could not download the plugins list")sleep(1.5)base.thread.remove("Plugins")base.thread.switch("Home")else base.draw.box(23,29,10,1," ","white","white")a8(P)end;while true do local i={os.pullEvent()}if i[1]=="timer"then program.draw.menubar("Plugins: Main")elseif i[1]=="mouse_click"then if i[4]>=1 and i[4]<=2 then program.draw.menu.handler("Plugins: Main",i[3],i[4])elseif i[3]>=47 and i[3]<=50 and i[4]==19 then base.thread.remove("Plugins")base.thread.switch("Home")elseif i[3]>=2 and i[3]<=21 and i[4]==4 then program.plugins.info("create")elseif i[3]>=2 and i[3]<=21 and i[4]==6 then program.plugins.info("about")elseif i[3]>=2 and i[3]<=21 and i[4]==8 then program.plugins.installed()elseif i[3]>=2 and i[3]<=6 and i[4]==19 then program.plugins.info("about")elseif i[3]>=24 and i[3]<=50 and(i[4]>=4 and i[4]<=17)then local id=i[4]-3+scroll;if id<=#P then program.plugins.view(P[id])end end elseif i[1]=="mouse_scroll"then if i[2]==-1 then if scroll>0 then scroll=scroll-1;a8(P)end elseif i[2]==1 then if scroll+14<#P then scroll=scroll+1;a8(P)end end end end end;function program.plugins.view(P)base.screen.colour("white")program.draw.menubar("Plugins: View")local scroll=0;base.draw.box(1,51,19,1," ","grey","grey")base.draw.textr("Back ",19,false,"orange","grey")base.draw.textl(" Install",19,false,"lightBlue","grey")base.draw.textc(tostring(P.downloads).." Download(s)",18,false,"red","white")base.draw.texta("Name (ID):",3,5,false,"lightGrey","white")base.draw.texta("Developer:",3,6,false,"lightGrey","white")base.draw.texta("Released:",3,7,false,"lightGrey","white")base.draw.texta(tostring(P.name),15,5,false,"lightBlue","white")base.draw.texta(tostring(P.author),15,6,false,"lightBlue","white")base.draw.texta(tostring(P.released),15,7,false,"lightBlue","white")base.draw.texta("Description:",3,9,false,"lightGrey","white")local ao=base.data.wordwrap(P.description,45)local function a8()for Y=1,6 do if Y+scroll<=#ao then base.draw.box(1,51,Y+10,1," ","white","white")base.draw.texta(tostring(ao[Y+scroll]),3,Y+10,false,"cyan","white")end end end;a8()while true do local i={os.pullEvent()}if i[1]=="timer"then program.draw.menubar("Plugins: View")elseif i[1]=="mouse_click"then if i[4]>=1 and i[4]<=2 then program.draw.menu.handler("Plugins: View",i[3],i[4])elseif i[3]>=2 and i[3]<=8 and i[4]==19 then local name=P.name:lower():gsub(" ","_")local d=Discover.Plugins:Download(tostring(P.id),tostring(Internal.Config.PluginsDirectory),tostring(name..".lua"))if d then if fs.exists(Internal.Config.PluginConfigFile)then local A=fs.open(Internal.Config.PluginConfigFile,"r")local pconfig=base.base64.decode(textutils.unserialize(pconfig))A.close()local new={}new.name=P.name;new.released=P.released;new.filename=tostring(name..".lua")table.insert(pconfig,new)new=nil;local A=fs.open(Internal.Config.PluginConfigFile,"w")A.write(base.base64.encode(textutils.serialize(pconfig)))A.close()else local new={}local pconfig={}new.name=P.name;new.released=P.released;new.filename=tostring(name..".lua")table.insert(pconfig,new)new=nil;local A=fs.open(Internal.Config.PluginConfigFile,"w")A.write(base.base64.encode(textutils.serialize(pconfig)))A.close()end;base.gui.alert("Installed plugin successfully!")sleep(1)local by=base.gui.confirm("Reboot DiscoverApp with plugin?")if by then program.core.reboot()else program.plugins.view(P)end else base.gui.alert("Could not install plugin!")sleep(1.5)program.plugins.view(P)end elseif i[3]>=47 and i[3]<=50 and i[4]==19 then program.plugins.main()end elseif i[1]=="mouse_scroll"then if i[2]==-1 then if scroll>0 then scroll=scroll-1;a8()end elseif i[2]==1 then if scroll+6<#ao then scroll=scroll+1;a8()end end end end end;function program.plugins.info(S)if S=="create"then base.screen.colour("white")program.draw.menubar("Plugins: Info")base.draw.box(1,51,19,1," ","grey","grey")base.draw.textr("Back ",19,false,"red","grey")local scroll=0;local j="Creating a plugin is very simple once you understand the API. The API extends core functions allowing you to do code upgrades and addons for the app. The DiscoverApp comes with an example plugin you can edit yourself to understand how to make one. In the plugins manager, click on ExamplePlugin and install it, then navigate to your plugins folder (DA_Plugins) by default, and then edit it with your favourite editor. This is useful as it allows you to add more to the Discover App with ease."local ao=base.data.wordwrap(j,49)local function a8()for Y=1,14 do if#ao>=Y+scroll then base.draw.box(1,51,Y+3,1," ","white","white")base.draw.textl(" "..tostring(ao[Y+scroll]),Y+3,false,"cyan","white")end end end;a8()while true do local i={os.pullEvent()}if i[1]=="timer"then program.draw.menubar("Plugins: Info")elseif i[1]=="mouse_click"then if i[4]>=1 and i[4]<=2 then program.draw.menu.handler("Plugins: Info",i[3],i[4])elseif i[3]>=47 and i[3]<=50 and i[4]==19 then program.plugins.main()end elseif i[1]=="mouse_scroll"then if i[2]==-1 then if scroll>0 then scroll=scroll-1;a8()end elseif i[2]==1 then if scroll+14<#ao then scroll=scroll+1;a8()end end end end elseif S=="about"then base.screen.colour("white")program.draw.menubar("Plugins: Info")base.draw.box(1,51,19,1," ","grey","grey")base.draw.textr("Back ",19,false,"red","grey")local scroll=0;local j="Plugins are just files of code that extend the current DiscoverApp, you can create extended editions of the app, or even just add a new menu idea with a program you have made, maybe an in-built code editor, or an in-built file manager. Again the possibilities are endless. By default there is an example plugin that is installable, which showcases most functions that are exposed by the DiscoverApp."local ao=base.data.wordwrap(j,49)local function a8()for Y=1,14 do if#ao>=Y+scroll then base.draw.box(1,51,Y+3,1," ","white","white")base.draw.textl(" "..tostring(ao[Y+scroll]),Y+3,false,"cyan","white")end end end;a8()while true do local i={os.pullEvent()}if i[1]=="timer"then program.draw.menubar("Plugins: Info")elseif i[1]=="mouse_click"then if i[4]>=1 and i[4]<=2 then program.draw.menu.handler("Plugins: Info",i[3],i[4])elseif i[3]>=47 and i[3]<=50 and i[4]==19 then program.plugins.main()end elseif i[1]=="mouse_scroll"then if i[2]==-1 then if scroll>0 then scroll=scroll-1;a8()end elseif i[2]==1 then if scroll+14<#ao then scroll=scroll+1;a8()end end end end end end;function program.plugins.installed()base.screen.colour("white")program.draw.menubar("Plugins: Installed")base.draw.box(1,51,19,1," ","grey","grey")base.draw.textr("Back ",19,false,"red","grey")local scroll=0;if fs.exists(Internal.Config.PluginConfigFile)then local A=fs.open(Internal.Config.PluginConfigFile,"r")local pconf=textutils.unserialize(base.base64.decode(A.readAll()))A.close()else base.gui.alert("No plugin config file exists")sleep(1.5)program.plugins.main()end;local function a8()for Y=1,14 do if#pconf>=Y+scroll then base.draw.box(1,51,Y+3,1," ","white","white")base.draw.textl(" "..tostring(Y+scroll)..": "..tostring(pconf[Y+scroll]['name']:sub(1,40)),Y+3,false,"cyan","white")base.draw.textr("Uninstall ",Y+3,false,"red","white")end end end;a8()while true do local i={os.pullEvent()}if i[1]=="timer"then program.draw.menubar("Plugins: Installed")elseif i[1]=="mouse_click"then if i[4]>=1 and i[4]<=2 then program.draw.menu.handler("Plugins: Installed",i[3],i[4])elseif i[3]>=47 and i[3]<=50 and i[4]==19 then program.plugins.main()elseif i[3]>=42 and i[3]<=50 and(i[4]>=4 and i[4]<=17)then local id=i[4]-3+scroll;if id<=#pconf then local bz=pconf[id]if fs.exists(fs.combine(Internal.Config.PluginsDirectory,bz.filename))then fs.delete(fs.combine(Internal.Config.PluginsDirectory,bz.filename))base.gui.alert("File found and removed, removing meta...")table.remove(pconf,id)sleep(1)local A=fs.open(Internal.Config.PluginConfigFile,"w")A.write(base.base64.encode(textutils.serialize(pconf)))A.close()program.plugins.installed()else base.gui.alert("No file found, removing meta...")table.remove(pconf,id)sleep(1)local A=fs.open(Internal.Config.PluginConfigFile,"w")A.write(base.base64.encode(textutils.serialize(pconf)))A.close()program.plugins.installed()end;if fs.exists(Internal.Config.PluginsDirectory)then local K=fs.list(Internal.Config.PluginsDirectory)if#K==0 then fs.delete(Internal.Config.PluginsDirectory)end end end end elseif i[1]=="mouse_scroll"then if i[2]==-1 then if scroll>0 then scroll=scroll-1;a8()end elseif i[2]==1 then if scroll+14<#pconf then scroll=scroll+1;a8()end end end end end;function program.tickets.main()base.screen.colour("white")program.draw.menubar("Tickets: Main")base.draw.box(1,51,19,1," ","grey","grey")base.draw.textr("Exit ",19,false,"red","grey")local N=0;local ap={"Create Ticket","List Tickets"}for Y=1,22 do base.draw.box(Y,1,3,16,false,"lightGrey","lightGrey")end;for Y=1,#ap*2,2 do N=N+1;base.draw.box(2,20,Y+4,1," ","orange","orange")base.draw.texta(ap[N],3,Y+4,false,"white","orange")end;local j="This is the internal ticket system, where you can post bugs, ideas or just a general message. The system will go through many changes as time comes but for now this is the beta version. Please check open tickets before posting to make sure it's not already been mentioned."for k,l in ipairs(base.data.wordwrap(j,25))do base.draw.texta(tostring(l),24,k+3,false,"cyan","white")end;while true do local i={os.pullEvent()}if i[1]=="timer"then program.draw.menubar("Tickets: Main")elseif i[1]=="mouse_click"then if i[4]>=1 and i[4]<=2 then program.draw.menu.handler("Tickets: Main",i[3],i[4])elseif i[3]>=47 and i[3]<=50 and i[4]==19 then base.thread.remove("Tickets")if not base.thread.find("Home")then base.thread.create("Home",program.main.home)end;base.thread.switch("Home")elseif i[3]>=2 and i[3]<=21 and i[4]==5 then program.tickets.create()elseif i[3]>=2 and i[3]<=21 and i[4]==7 then program.tickets.list()end end end end;function program.tickets.list()base.screen.colour("white")program.draw.menubar("Tickets: List")base.draw.box(1,51,19,1," ","grey","grey")base.draw.textr("Back ",19,false,"red","grey")base.draw.textc("Refresh",19,false,"orange","grey")base.draw.textl(" Create",19,false,"lightBlue","grey")local scroll=0;base.draw.textc("Download tickets list...",10,false,"red","white")local d,bA=Discover.Tickets:List()if not d then base.draw.textc("Could not retrieve tickets, try again later!",10,false,"red","white")sleep(2)bA={}else base.draw.box(1,51,10,1," ","white","white")end;local function a8()for Y=1,14 do if Y+scroll<=#bA then base.draw.box(1,51,Y+3,1," ","white","white")base.draw.texta(Y+scroll..": "..tostring(bA[Y+scroll]['title']:sub(1,40)),2,Y+3,false,"cyan","white")if bA[Y+scroll]['status']=="true"then base.draw.textr("Fixed ",Y+3,false,"green","white")else base.draw.textr("Pending ",Y+3,false,"red","white")end end end;if#bA<1 then base.draw.textc("No tickets to show! Good sign right? ;)",10,false,"red","white")end end;a8()while true do local i={os.pullEvent()}if i[1]=="timer"then program.draw.menubar("Tickets: List")elseif i[1]=="mouse_click"then if i[4]>=1 and i[4]<=2 then program.draw.menu.handler("Tickets: List",i[3],i[4])elseif i[3]>=47 and i[3]<=50 and i[4]==19 then program.tickets.main()elseif i[3]>=20 and i[3]<=30 and i[4]==19 then program.tickets.list()elseif i[3]>=2 and i[3]<=7 and i[4]==19 then program.tickets.create()elseif i[3]>=2 and i[3]<=50 and(i[4]>=4 and i[4]<=17)then local y=i[4]-3+scroll;if y<=#bA then program.tickets.view(bA[y].id,bA[y])end end elseif i[1]=="mouse_scroll"then if i[2]==-1 then if scroll>0 then scroll=scroll-1;a8()end elseif i[2]==1 then if scroll+14<#bA then scroll=scroll+1;a8()end end end end end;function program.tickets.create()base.screen.colour("white")program.draw.menubar("Tickets: Create")base.draw.box(1,51,19,1," ","grey","grey")base.draw.textr("Back ",19,false,"red","grey")base.draw.textl(" List Tickets",19,false,"lightBlue","grey")base.draw.textc("Reset Form",19,false,"orange","grey")local j="When creating a ticket, make sure to explain yourself clearly, any bugs, please tell me the steps you took so I can reproduce the error. Also include any error messages given."for k,l in ipairs(base.data.wordwrap(j,49))do base.draw.textc(l,k+3,false,"cyan","white")end;base.draw.texta("Title:",8,9,false,"lightGrey","white")base.draw.box(8,36,10,1," ","cyan","cyan")base.draw.texta("Message:",8,12,false,"lightGrey","white")base.draw.box(8,36,13,1," ","cyan","cyan")base.draw.textc("   Create Ticket   ",16,false,"white","cyan")while true do local i={os.pullEvent()}if i[1]=="timer"then program.draw.menubar("Tickets: Create")elseif i[1]=="mouse_click"then if i[4]>=1 and i[4]<=2 then program.draw.menu.handler("Tickets: Create",i[3],i[4])elseif i[3]>=47 and i[3]<=50 and i[4]==19 then program.tickets.main()elseif i[3]>=2 and i[3]<=13 and i[4]==19 then program.tickets.list()elseif i[3]>=18 and i[3]<=32 and i[4]==19 then program.tickets.create()elseif i[3]>=8 and i[3]<=43 and i[4]==10 then base.draw.box(8,36,10,1," ","cyan","cyan")base.colour.set("white","cyan")term.setCursorPos(8,10)write(": ")title=tostring(base.io.limitRead(34))elseif i[3]>=8 and i[3]<=43 and i[4]==13 then base.draw.box(8,36,13,1," ","cyan","cyan")base.colour.set("white","cyan")term.setCursorPos(8,13)write(": ")message=tostring(base.io.limitRead(34))elseif i[3]>=16 and i[3]<=34 and i[4]==16 then if title and message then local d,e=Discover.Tickets:Create(title,message)if not d then base.gui.alert(tostring(e))sleep(1.5)program.tickets.create()else base.gui.alert(tostring(e))sleep(1)program.tickets.main()end else base.draw.textc("Please fill in all fields!",18,false,"red","white")sleep(1)base.draw.box(1,51,18,1," ","white","white")end end end end end;function program.tickets.view(bB,P)base.screen.colour("white")program.draw.menubar("Tickets: Create")base.draw.box(1,51,19,1," ","grey","grey")base.draw.textr("Back ",19,false,"red","grey")base.draw.textl(" Create",19,false,"orange","grey")local scroll=0;local function a8()base.draw.textl(" Title:",4,false,"lightGrey","white")base.draw.texta(tostring(P.title),12,4,false,"cyan","white")base.draw.textl(" Created:",5,false,"lightGrey","white")base.draw.texta(tostring(P.ntime),12,5,false,"cyan","white")base.draw.textl(" Status:",6,false,"lightGrey","white")if P.status=="true"then base.draw.texta("Fixed",12,6,false,"green","white")else base.draw.texta("Pending",12,6,false,"red","white")end;base.draw.textl(" Author:",7,false,"lightGrey","white")base.draw.texta(tostring(P.author),12,7,false,"cyan","white")base.draw.textl(" Message:",9,false,"lightGrey","white")tMessage=base.data.wordwrap(P.message,45)for Y=1,7 do if Y+scroll<=#tMessage then base.draw.box(1,51,Y+10,1," ","white","white")base.draw.texta(tMessage[Y+scroll],3,Y+10,false,"cyan","white")end end end;a8()while true do local i={os.pullEvent()}if i[1]=="timer"then program.draw.menubar("Tickets: Create")elseif i[1]=="mouse_click"then if i[4]>=1 and i[4]<=2 then program.draw.menu.handler("Tickets: Create",i[3],i[4])elseif i[3]>=47 and i[3]<=50 and i[4]==19 then program.tickets.list()elseif i[3]>=2 and i[3]<=7 and i[4]==19 then program.tickets.create()end elseif i[1]=="mouse_scroll"then if i[2]==-1 then if scroll>0 then scroll=scroll-1;a8()end elseif i[2]==1 then if scroll+7<#tMessage then scroll=scroll+1;a8()end end end end end;function program.account.login()if Internal.System.Platform=="Desktop"then base.screen.colour("white")program.draw.menubar("Account: Login")local status=false;base.draw.box(8,36,7,1," ","cyan","cyan")base.draw.box(8,36,11,1," ","cyan","cyan")base.draw.texta("Username:",8,6,false,"lightGrey","white")base.draw.texta("Password:",8,10,false,"lightGrey","white")base.draw.texta("Remember me",8,14,false,"lightGrey","white")base.draw.texta("Enabled",37,14,false,"green","white")base.draw.box(1,51,19,1," ","grey","grey")base.draw.textl(" Cancel",19,false,"red","grey")base.draw.textr("Login ",19,false,"cyan","grey")base.draw.textc("Register",19,false,"orange","grey")local function bC()if status then base.draw.texta(" Enabled",36,14,false,"green","white")else base.draw.texta("Disabled",36,14,false,"red","white")end end;bC()while true do local i={os.pullEvent()}if i[1]=="timer"then program.draw.menubar("Account: Login")elseif i[1]=="mouse_click"then if i[3]>=1 and i[3]<=b and(i[4]>=1 and i[4]<=2)then program.draw.menu.handler("Account: Login",i[3],i[4])elseif i[3]>=8 and i[3]<=43 and i[4]==14 then if status then status=false else status=true end;bC()elseif i[3]>=8 and i[3]<=43 and i[4]==7 then base.draw.box(8,36,7,1," ","cyan","cyan")base.colour.set("white","cyan")term.setCursorPos(8,7)write(": ")username=tostring(base.io.limitRead(32))elseif i[3]>=8 and i[3]<=43 and i[4]==11 then base.draw.box(8,36,11,1," ","cyan","cyan")base.colour.set("white","cyan")term.setCursorPos(8,11)write(": ")password=tostring(base.io.limitRead(32,"*"))elseif i[3]>=2 and i[3]<=7 and i[4]==19 then base.thread.remove("Account")base.thread.switch("Home")elseif i[3]>=19 and i[3]<=30 and i[4]==19 then program.account.register()elseif i[3]>=46 and i[3]<=50 and i[4]==19 then DiscoverApp.Callbacks.Run("Login")local status=Discover.User:Login(username,password)if status then if status then local A=fs.open(Internal.Config.ConfigFilePath,"w")Internal.Account.Username=username;Internal.Account.Password=Discover.Crypto:Sha256(password)local B={["Account"]=Internal.Account,["Config"]=Internal.Config}A.write(Discover.Crypto:Base64("encode",textutils.serialize(B)))A.close()end;base.gui.alert("You have been logged in!")sleep(0.5)os.startTimer(1)base.thread.remove("Account")base.thread.switch("Home")else base.gui.alert("We could not log you in!")sleep(1.5)program.account.login()end end end end end end;function program.account.register()base.screen.colour("white")program.draw.menubar("Register")base.draw.box(1,51,19,1," ","grey","grey")base.draw.textl(" Cancel",19,false,"orange","grey")base.draw.textr("Register ",19,false,"cyan","grey")local function ae()base.draw.textc("Discover API Registration",4,false,"grey","white")base.draw.texta("Username:",8,7,false,"lightGrey","white")base.draw.box(8,36,8,1," ","cyan","cyan")base.draw.texta("Password:",8,10,false,"lightGrey","white")base.draw.box(8,36,11,1," ","cyan","cyan")base.draw.texta("Email:",8,13,false,"lightGrey","white")base.draw.box(8,36,14,1," ","cyan","cyan")base.draw.textc("Have an account? Login here!",17,false,"grey","white")end;ae()while not Discover.User:LoggedIn()do local i={os.pullEvent()}if i[1]=="timer"then program.draw.menubar("Register")elseif i[1]=="mouse_click"then if i[4]>=1 and i[4]<=2 then program.draw.menu.handler("Register",i[3],i[4])elseif i[3]>=8 and i[3]<=43 and i[4]==8 then base.draw.box(8,36,8,1," ","cyan","cyan")base.colour.set("white","cyan")term.setCursorPos(8,8)write(": ")username=tostring(base.io.limitRead(34))elseif i[3]>=8 and i[3]<=43 and i[4]==11 then base.draw.box(8,36,11,1," ","cyan","cyan")base.colour.set("white","cyan")term.setCursorPos(8,11)write(": ")password=tostring(base.io.limitRead(34,"*"))elseif i[3]>=8 and i[3]<=43 and i[4]==14 then base.draw.box(8,36,14,1," ","cyan","cyan")base.colour.set("white","cyan")term.setCursorPos(8,14)write(": ")email=tostring(base.io.limitRead(34))elseif i[3]>=9 and i[3]<=42 and i[4]==17 then program.account.login()elseif i[3]>=2 and i[3]<=10 and i[4]==19 then break elseif i[3]>=43 and i[3]<=50 and i[4]==19 then if username and password and email then base.draw.textc("Requesting Authentication, Please Wait",17,false,"lightGrey","white")local bD,bE=Discover.User:Register(username,password,email)if bD then base.gui.alert("Registered. Obtaining authkey, please wait")sleep(0.5)local status=Discover.User:Login(username,password)if status then base.gui.alert("Logged in!")sleep(0.8)base.thread.remove("Account")base.thread.switch("Home")else base.gui.alert(Discover.User:GetField("ErrorMsg"))sleep(1.5)base.thread.remove("Account")base.thread.switch("Home")end else base.draw.box(1,51,17,1," ","white","white")base.draw.textc(tostring(bE),17,false,"lightGrey","white")sleep(1)base.thread.remove("Account")base.thread.switch("Home")end else base.draw.textc("Please fill in the fields",17,false,"lightGrey","white")end end end end end;function program.account.logout()program.draw.menubar("Account: Logout")base.screen.colour("white")base.draw.textc("Logging out...",10,false,"red","white")DiscoverApp.Callbacks.Run("Logout")local status=Discover.User:Logout()local status=Discover.User:Reset()base.thread.remove("Login")base.thread.switch("Home")end;function program.account.manage()base.screen.colour("white")program.draw.menubar("Account: Manage")base.draw.box(1,51,19,1," ","grey","grey")base.draw.textr("Exit ",19,false,"red","grey")local ap={"My Statistics","My Information"}local N=0;local function ae()for Y=1,20 do base.draw.box(Y,1,3,16," ","lightGrey","lightGrey")end;for Y=1,#ap*2,2 do N=N+1;base.draw.box(2,18,Y+3,1," ","orange","orange")base.draw.texta(ap[N],3,Y+3,false,"white","orange")end;base.draw.texta("My Details",31,4,false,"grey","white")base.draw.texta("Username:",22,7,false,"lightGrey","white")base.draw.box(22,29,8,1," ","cyan","cyan")base.draw.texta(tostring(Discover.User:GetField("Username")),23,8,false,"white","cyan")base.draw.texta("AuthKey:",22,11,false,"lightGrey","white")base.draw.box(22,29,12,1," ","cyan","cyan")base.draw.box(22,29,13,1," ","cyan","cyan")base.draw.box(22,29,14,1," ","cyan","cyan")base.draw.box(22,29,15,1," ","cyan","cyan")base.draw.box(22,29,16,1," ","cyan","cyan")base.draw.texta(tostring(Discover.User:GetField("AuthKey")):sub(1,27),23,12,false,"white","cyan")base.draw.texta(tostring(Discover.User:GetField("AuthKey")):sub(28,54),23,13,false,"white","cyan")base.draw.texta(tostring(Discover.User:GetField("AuthKey")):sub(55,81),23,14,false,"white","cyan")base.draw.texta(tostring(Discover.User:GetField("AuthKey")):sub(82,108),23,15,false,"white","cyan")base.draw.texta(tostring(Discover.User:GetField("AuthKey")):sub(109),23,16,false,"white","cyan")end;ae()while true do local i={os.pullEvent()}if i[1]=="timer"then program.draw.menubar("Account: Manage")elseif i[1]=="mouse_click"then if i[4]>=1 and i[4]<=2 then program.draw.menu.handler("Account: Manage",i[3],i[4])elseif i[3]>=47 and i[3]<=50 and i[4]==19 then base.thread.remove("Account")if not base.thread.find("Home")then base.thread.create("Home",program.main.home)end;base.thread.switch("Home")elseif i[3]>=2 and i[3]<=18 and i[4]==4 then program.account.statistics()elseif i[3]>=2 and i[3]<=18 and i[4]==6 then program.account.edit()elseif i[3]>=2 and i[3]<=18 and i[4]==8 then program.account.alerts()end end end end;function program.account.statistics()base.screen.colour("white")program.draw.menubar("Account: Statistics")base.draw.box(1,51,19,1," ","grey","grey")base.draw.textr("Back ",19,false,"red","grey")local function bF()base.draw.textc("Processing...",9,false,"grey","white")sleep(0.5)d,stats_data=Discover.User:GetStatistics()base.draw.box(1,51,9,1," ","white","white")end;local function ae()local j="Here you can see your statistics for uploads, downloads on both apps and snippets."for k,l in ipairs(base.data.wordwrap(j,49))do base.draw.texta(l,2,k+3,false,"lightGrey","white")end;base.draw.texta("App Uploads: ",2,10,false,"grey","white")base.draw.texta("Snippet Uploads: ",2,12,false,"grey","white")base.draw.texta("Downloads (Apps): ",2,14,false,"grey","white")base.draw.texta("Downloads (Snippets):",2,16,false,"grey","white")base.draw.texta(stats_data.uploaded_apps,25,10,false,"cyan","white")base.draw.texta(stats_data.uploaded_snips,25,12,false,"cyan","white")base.draw.texta(stats_data.app_downloads,25,14,false,"cyan","white")base.draw.texta(stats_data.snip_downloads,25,16,false,"cyan","white")end;bF()ae()while true do local i={os.pullEvent()}if i[1]=="timer"then program.draw.menubar("Account: Statistics")elseif i[1]=="mouse_click"then if i[4]>=1 and i[4]<=2 then program.draw.menu.handler("Account: Statistics",i[3],i[4])elseif i[3]>=47 and i[3]<=50 and i[4]==19 then program.account.manage()end end end end;function program.account.edit()base.screen.colour("white")program.draw.menubar("Account: Edit")base.draw.box(1,51,19,1," ","grey","grey")base.draw.textl(" Back ",19,false,"red","grey")base.draw.textc("Refresh",19,false,"orange","grey")base.draw.textr("Update ",19,false,"lightBlue","grey")local function bG()base.draw.textc("Downloading your information, please wait",10,false,"red","white")d,userdata=Discover.User:GetData()if not d then base.gui.alert("Could not obtain data, please try again later!")sleep(1.5)program.account.manage()else base.draw.box(1,51,10,1," ","white","white")end end;local function a8()local Y=0;for k,l in pairs(userdata)do Y=Y+1;base.draw.box(1,51,Y+3,1," ","white","white")base.draw.texta(tostring(k):sub(1,18),2,Y+3,false,"cyan","white")base.draw.texta("->",21,Y+3,false,"lightGrey","white")base.draw.texta(tostring(l):sub(1,25),25,Y+3,false,"orange","white")end;base.draw.texta("   Change Password   ",2,12,false,"white","cyan")base.draw.texta("    Change Email     ",2,14,false,"white","cyan")end;bG()a8()while true do local i={os.pullEvent()}if i[1]=="timer"then program.draw.menubar("Account: Edit")elseif i[1]=="mouse_click"then if i[4]>=1 and i[4]<=2 then program.draw.menu.handler("Account: Edit",i[3],i[4])elseif i[3]>=2 and i[3]<=5 and i[4]==19 then program.account.manage()elseif i[3]>=22 and i[3]<=28 and i[4]==19 then bG()a8()elseif i[3]>=2 and i[3]<=22 and i[4]==12 then local bH=base.gui.input("New password:","*")local d,e=Discover.User:Modify("password",bH)if d then base.gui.alert("Updated password for your account!")sleep(1)base.gui.alert("Obtaining new authkey...")local d,e=Discover.User:Login(Discover.User:GetField("Username"),bH)if d then base.gui.alert("Obtaining new authkey...")else base.gui.alert("Error: "..tostring(e))end;sleep(1.5)program.account.edit()else base.gui.alert("Could not update your password!")sleep(1.5)program.account.edit()end elseif i[3]>=2 and i[3]<=22 and i[4]==14 then local bI=base.gui.input("New email:")local d,e=Discover.User:Modify("email",bI)if d then base.gui.alert("Updated email for your account!")sleep(1)program.account.edit()else base.gui.alert("Could not update your email!")sleep(1.5)program.account.edit()end end end end end;function program.snippets.main()base.screen.colour("white")program.draw.menubar("Snippets")for Y=1,22 do base.draw.box(Y,1,3,17," ","lightGrey","lightGrey")end;local bj={4,6,8,10,12,14,16,18}local bJ={"View all snippets","Upload new snippet","View my snippets","Exit snippet store"}for k,l in ipairs(bJ)do base.draw.box(2,20,bj[k],1," ","orange","orange")base.draw.texta(l,3,bj[k],false,"white","orange")end;local j="The snippet server allows you to store snippets of code as a separate file which can be downloaded, edited, shared, and added as dependencies to programs using the Discover Dependencies Manager (DDM), which is a work in progress, but works very well."for k,l in ipairs(base.data.wordwrap(j,27))do base.draw.texta(l,24,k+3,false,"lightGrey","white")end;while true do local i={os.pullEvent()}if i[1]=="timer"then program.draw.menubar("Snippets")elseif i[1]=="mouse_click"then if i[4]>=1 and i[4]<=2 then program.draw.menu.handler("Snippets",i[3],i[4])elseif i[3]>=2 and i[3]<=21 and i[4]==4 then program.snippets.all()elseif i[3]>=2 and i[3]<=21 and i[4]==6 then if Discover.User:LoggedIn()then program.snippets.upload()else base.gui.alert("You need to be logged in to view this!")sleep(1)program.snippets.main()end elseif i[3]>=2 and i[3]<=21 and i[4]==8 then if Discover.User:LoggedIn()then program.snippets.owned()else base.gui.alert("You need to be logged in to view this!")sleep(1)program.snippets.main()end elseif i[3]>=2 and i[3]<=21 and i[4]==10 then base.thread.remove("Snippets")if not base.thread.find("Home")then base.thread.find("Home",program.main.home)end;base.thread.switch("Home")end end end end;function program.snippets.all()base.screen.colour("white")program.draw.menubar("Snippets: All")base.draw.box(1,51,19,1," ","grey","grey")base.draw.textr("Back ",19,false,"orange","grey")local scroll=0;local d,bK=Discover.Snippets:List('all')if not d then base.draw.textc("Could not download snippets listing",10,false,"red","white")sleep(2.5)base.thread.remove("Snippets")base.thread.switch("Home")end;base.draw.texta("Total: "..#bK,2,19,false,"lightBlue","grey")local function aj(ak)if tostring(ak):len()==1 then return"  "..tostring(ak)elseif tostring(ak):len()==2 then return" "..tostring(ak)else return tostring(ak)end end;local function ae(scroll)if#bK>0 then for Y=1,14 do if#bK>=Y+scroll then base.draw.box(1,51,Y+3,1," ","white","white")base.draw.textl(aj(Y+scroll)..": "..bK[Y+scroll].name,Y+3,false,"grey","white")end end else base.draw.textc("There are no snippets to display",10,false,"red","white")end end;ae(scroll)while true do local i={os.pullEvent()}if i[1]=="timer"then program.draw.menubar("Snippets: All")elseif i[1]=="mouse_click"then if i[4]>=1 and i[4]<=2 then program.draw.menu.handler("Snippets: All",i[3],i[4])elseif i[3]>=47 and i[3]<=51 and i[4]==19 then program.snippets.main()elseif i[3]>=1 and i[3]<=51 and(i[4]>=4 and i[4]<=17)then local al=i[4]-3+scroll;if#bK>=al then program.snippets.view(bK[al])program.snippets.all()end end elseif i[1]=="mouse_scroll"then if i[2]==-1 then if scroll>0 then scroll=scroll-1;ae(scroll)end elseif i[2]==1 then if scroll+14<=#bK-1 then scroll=scroll+1;ae(scroll)end end end end end;function program.snippets.view(bL)base.screen.colour("white")program.draw.menubar("Snippets: View")base.draw.box(1,51,19,1," ","grey","grey")base.draw.textr("Back ",19,false,"orange","grey")base.draw.texta("Name (ID):",1,4,false,"lightGrey","white")base.draw.texta("Version:",1,5,false,"lightGrey","white")base.draw.texta("Creator:",1,6,false,"lightGrey","white")base.draw.texta("Index / Status:",1,7,false,"lightGrey","white")base.draw.textl(" Downloads: "..tostring(bL.downloads),19,false,"lightBlue","grey")base.draw.texta("Description:",1,9,false,"lightGrey","white")base.draw.texta(tostring(bL.name).." ("..tostring(bL.id)..")",17,4,false,"cyan","white")base.draw.texta(tostring(bL.version),17,5,false,"cyan","white")base.draw.texta(tostring(bL.creator),17,6,false,"cyan","white")base.draw.texta(tostring(bL.index).." / "..tostring(bL.status),17,7,false,"cyan","white")for k,l in ipairs(base.data.wordwrap(bL.description,51))do base.draw.textl(l,k+10,false,"grey","white")end;base.draw.texta(" Download ",41,5,false,"white","cyan")base.draw.texta(" Snippet! ",41,6,false,"white","cyan")while true do local i={os.pullEvent()}if i[1]=="timer"then program.draw.menubar("Snippets: View")elseif i[1]=="mouse_click"then if i[4]>=1 and i[4]<=2 then program.draw.menu.handler("Snippets: View",i[3],i[4])elseif i[3]>=47 and i[3]<=50 and i[4]==19 then break elseif i[3]>=41 and i[3]<=50 and(i[4]>=5 and i[4]<=6)then for Y=7,14 do base.draw.box(8,35,Y,1," ","white","white")end;base.draw.box(8,35,7,6," ","grey","grey")base.colour.set("lightGrey","white")term.setCursorPos(9,8)write(":: Path/Name: ")local name=tostring(base.io.limitRead(34))base.draw.texta(":: Requesting file",9,9,false,"lightGrey","white")sleep(0.5)local P=Discover.Snippets:Download(bL.id,name)base.draw.texta(":: File received",9,10,false,"lightGrey","white")base.draw.texta(":: Saving to file",9,11,false,"lightGrey","white")program.snippets.view(bL)end end end end;function program.snippets.upload()base.screen.colour("white")program.draw.menubar("Snippets (Upload)")base.draw.box(1,51,19,1," ","grey","grey")base.draw.textr("Back ",19,false,"orange","grey")base.draw.textl(" Upload",19,false,"lightBlue","grey")base.draw.texta("Name:",8,4,false,"lightGrey","white")base.draw.box(8,36,5,1," ","cyan","cyan")base.draw.texta("Description:",8,7,false,"lightGrey","white")base.draw.box(8,36,8,1," ","cyan","cyan")base.draw.texta("Version:",8,10,false,"lightGrey","white")base.draw.box(8,36,11,1," ","cyan","cyan")base.draw.texta("Status:",8,13,false,"lightGrey","white")base.draw.box(8,36,14,1," ","cyan","cyan")base.draw.texta("Path:",8,16,false,"lightGrey","white")base.draw.box(8,36,17,1," ","cyan","cyan")while true do local i={os.pullEvent()}if i[1]=="timer"then program.draw.menubar("Snippets (Upload)")elseif i[1]=="mouse_click"then if i[4]>=1 and i[4]<=2 then program.draw.menu.handler("Snippets (Upload)",i[3],i[4])elseif i[3]>=47 and i[3]<=50 and i[4]==19 then program.snippets.main()elseif i[3]>=8 and i[3]<=43 and i[4]==5 then base.draw.box(8,36,5,1," ","cyan","cyan")base.colour.set("white","cyan")term.setCursorPos(8,5)write(": ")name=tostring(base.io.limitRead(34))elseif i[3]>=8 and i[3]<=43 and i[4]==8 then base.draw.box(8,36,8,1," ","cyan","cyan")base.colour.set("white","cyan")term.setCursorPos(8,8)write(": ")desc=tostring(base.io.limitRead(34))elseif i[3]>=8 and i[3]<=43 and i[4]==11 then base.draw.box(8,36,11,1," ","cyan","cyan")base.colour.set("white","cyan")term.setCursorPos(8,11)write(": ")vers=tostring(base.io.limitRead(34))elseif i[3]>=8 and i[3]<=43 and i[4]==14 then base.draw.box(8,36,14,1," ","cyan","cyan")base.colour.set("white","cyan")term.setCursorPos(8,14)write(": ")stat=tostring(base.io.limitRead(34))elseif i[3]>=8 and i[3]<=43 and i[4]==17 then base.draw.box(8,36,17,1," ","cyan","cyan")base.colour.set("white","cyan")term.setCursorPos(8,17)write(": ")path=tostring(base.io.limitRead(34))elseif i[3]>=2 and i[3]<=7 and i[4]==19 then if name and desc and vers and stat and path then if fs.exists(path)then local d,e=Discover.Snippets:Upload(name,desc,vers,stat,path)if d then base.gui.alert("Snippet upload was successful!")sleep(0.5)base.gui.alert("Updating local snippet database...")program.snippets.main()else base.gui.alert("Error: "..tostring(e))sleep(2)program.snippets.main()end else base.draw.textc("File does not exist at path",18,false,"red","white")sleep(1)base.draw.box(1,51,18,1," ","white","white")end else base.draw.textc("Please fill out all fields",18,false,"red","white")sleep(1)base.draw.box(1,51,18,1," ","white","white")end end end end end;function program.snippets.owned()base.screen.colour("white")program.draw.menubar("Snippets: Owned")base.draw.box(1,51,19,1," ","grey","grey")base.draw.textr("Back ",19,false,"orange","grey")local scroll=0;local d,bK=Discover.Snippets:List('owned')if not d then base.draw.textc("Could not download snippets listing",10,false,"red","white")sleep(2.5)base.thread.remove("Snippets")base.thread.switch("Home")end;base.draw.texta("Total: "..#bK,2,19,false,"lightBlue","grey")local function aj(ak)if tostring(ak):len()==1 then return"  "..tostring(ak)elseif tostring(ak):len()==2 then return" "..tostring(ak)else return tostring(ak)end end;local function ae(scroll)if#bK>0 then for Y=1,14 do if#bK>=Y+scroll then base.draw.box(1,51,Y+3,1," ","white","white")base.draw.texta("X",50,Y+3,false,"red","white")base.draw.textl(aj(Y+scroll)..": "..bK[Y+scroll].name,Y+3,false,"grey","white")end end else base.draw.textc("There are no snippets to display",10,false,"red","white")end end;ae(scroll)while true do local i={os.pullEvent()}if i[1]=="timer"then program.draw.menubar("Snippets: Owned")elseif i[1]=="mouse_click"then if i[4]>=1 and i[4]<=2 then program.draw.menu.handler("Snippets: Owned",i[3],i[4])elseif i[3]>=47 and i[3]<=51 and i[4]==19 then program.snippets.main()elseif i[3]>=1 and i[3]<=43 and(i[4]>=4 and i[4]<=17)then local al=i[4]-3+scroll;if#bK>=al then program.snippets.view(bK[al])program.snippets.owned()end elseif i[3]==50 and(i[4]>=4 and i[4]<=17)then local al=i[4]-3+scroll;if#bK>=al then local stat=discover:snippets_delete(bK[al].id)if stat then base.gui.alert("Snippet deleted!")sleep(1)program.snippets.owned()else base.gui.alert("Snippet was unable to be deleted!")sleep(1)base.gui.alert(discover.data.errormsg)sleep(1.5)program.snippets.owned()end end end elseif i[1]=="mouse_scroll"then if i[2]==-1 then if scroll>0 then scroll=scroll-1;ae(scroll)end elseif i[2]==1 then if scroll+14<=#bK-1 then scroll=scroll+1;ae(scroll)end end end end end;if#a>0 then program.core.cli(a)else program.core.init()end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement