Commit c30b808d authored by Danny SMc's avatar Danny SMc

Inital code re-haul

parents 6e4214db 719eddd6
......@@ -9,3 +9,10 @@
ad.js
TODO
test.html
=======
.DS_Store
.DS_Store?
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db
\ No newline at end of file
::Version 0.1 (Alpha):
-> First build and trial of new app
\ No newline at end of file
# Contributions
We do allow other users to contribute but we expect it to be in good condition, which means commenting your code so that other developers
can read your code, otherwise we shall instantly decline the pull request. Coding standards, please make sure to follow our type of coding
and do not share this code unless given permission to.
\ No newline at end of file
This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
You are free to:
Share — copy and redistribute the material in any medium or format
The licensor cannot revoke these freedoms as long as you follow the license terms.
Under the following terms:
Attribution — You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
NonCommercial — You may not use the material for commercial purposes.
NoDerivatives — If you remix, transform, or build upon the material, you may not distribute the modified material.
No additional restrictions — You may not apply legal terms or technological measures that legally restrict others from doing anything the license permits.
Notices:
You do not have to comply with the license for elements of the material in the public domain or where your use is permitted by an applicable exception or limitation.
No warranties are given. The license may not give you all of the permissions necessary for your intended use. For example, other rights such as publicity, privacy, or moral rights may limit how you use the material.
\ No newline at end of file
---------------------
Base API Docs
---------------------
Base is a library of loads of functions I found and added together that come in handy when coding!
So a function is done like so:
base.<lib>.<function>
so example:
base.draw.textc()
: Native Functions (Not in base table) :: Not in base table, all separate functions
-> require(path) (A version of the standard Lua require)
-> toboolean(var) (Converts a string, or number to a boolean)
: Draw Lib (base.draw) :: Library of useful drawing functions
-> textr(text, y, newline, txtcol, bgcol)
-> textl(text, y, newline, txtcol, bgcol)
-> textc(text, y, newline, txtcol, bgcol)
-> texta(text, x, y, newline, txtcol, bgcol)
-> box(x, width, y, height, char, col, bgcol)
: GUI Lib (base.gui) :: GUI Library for used things I always had
-> alert(text) (Creates a one line popup on screen)
-> confirm(text) (Creates a popup asking yes or no - touchscreen)
-> input(text, mask) (Creates text box with input and mask)
-> limitInput(text) (Creates a limited text box, so no overflow)
: GUI Image Lib (base.gui.image) :: Image Library in GUI
-> render(xpos, ypos, tImg) (Render image at xpos and ypos with the table image)
: Crypto Lib (base.crypto) :: Cryptography Library for hashing and encryption
-> sha256(msg) (Will hash text into a SHA256 hash)
-> blake256(msg) (Will hash text into a Blake256 hash)
: Parse Lib (base.parse) :: Parsing Library
-> html(stringData) (Will parse html into a full object)
-> xml(stringData) (Will parse xml into a full object)
-> ini(filepath, options) (Parses ini into lua table)
: JSON Lib (base.json) :: JSON library
-> decode(str, pos, end_delim) (Decode return from JSON to Lua Array)
-> stringify(obj, as_key) (Stringify and object)
: Database Lib (base.database) :: Database / Object Control
-> load(path) (Load table from database)
-> save(path) (Save table to database)
-> search(tData, term) (search for data in table)
-> insert(tData, val, key) (Insert data to table)
-> remove(tData, val, key) (Removes key from table)
-> delete(path) (Deletes a database file)
: Time Lib (base.time) :: Time management functions
-> current() (Gets current time in Game in 24hr and 5 characters)
: Colour Lib (base.colour) :: Terminal / Screen Colour Control
-> set(textColour, BgColour) (Sets text and background colour)
-> reset() (Resets colours back to white and black)
: Screen Lib (base.screen) :: Simple screen functions
-> clearLine(y, newline) (Simply just clears a line on the screen)
-> colour(colour) (Colours a screen)
-> clear() (Clears a screen to default)
: Thread Lib (base.thread) :: Thread manager / coroutine manager
-> create(name, func) (Creates a thread with the name and func given)
-> createbg(name, func) (Creates background thread)
-> remove(name) (Remove normal thread)
-> removebg(name) (Removes background thread)
-> find(name) (Searches for thread with that name)
-> findbg(name) (Searches for background thread with that name)
-> switch(name) (Switches current running thread)
-> run() (Runs coroutine manager)
-> exit() (Exits coroutine manager)
: Filesystem Lib (base.fs) :: File system controls
-> search(startPath, ignoreRom) (Searchs whole fs, and offers to ignore rom in search)
: Binary Lib (base.binary) :: Binary Conversions Library
-> txttobin( text ) (Will convert text to binary - slow on lots of data)
-> bintotxt( text ) (Converts binary to text - slow on lots of data)
: State Lib (base.state) :: State API make all functions async
-> unblock( func ) (Creates a non-blocking call from a function)
-> setLoop( func ) (Sets loop for non-blocking call)
-> run() (Runs the state control)
-> pullEvent() (New one for non-blocking calls)
: IO Lib (base.io) :: Input / Output Library
-> limitRead(limx, char) (Will limit width of chars and offers a replace for pws)
: Data Lib (base.data) :: Data manipulation library
-> wordwrap(text, limit) (Will wrap text by limit into a table of lines)
-> convertTable(tData) (Converts a table of keys and values for http string)
: Base64 Lib (base.base64) :: Just a base64 library
-> encode(text) (Encode data to base64)
-> decode(text) (Deocde data from base64)
: Settings Lib (base.fs) :: Settings API, compatible with 1.78 version
-> set(name, value) (Set value against name)
-> get(name) (Get value from name)
-> unset(name) (Unset setting)
-> clear() (Clear settings)
-> getNames() (Get setting names)
-> load(path) (Load settings from file)
-> save(path) (Save settings from file)
: Core Lib (base.fs) :: Core Functions for the API - not finished
-> getVersion() (Gets version of API)
-> update() (Updates API - not finished)
-> run() (Initalises API - not finished)
: Net Lib (base.net)
-> request(url, query, [headers]) (Not finished)
-> post(url, query, [headers]) (Not finished)
-> get (url, headers) (Not finished)
\ No newline at end of file
# Discover Network App
This application makes use of the Discover Network to create a interactive and nice to use GUI for users that wish to use it.
### Project Management
| Name | Description | Completed | Developer |
|------|-------------|-----------|-----------|
| Main | This is the main application, and this will include the actual main controller for the program. | 2% | DannySMc |
| Apps | This is the app store part of the app | 0% | N/A |
| Snippets | This is the snippets store part of the app | 0% | N/A |
| Cloud | This is the cloud storage part of the app | 0% | N/A |
| Mail | This is the mail manager part of the app | 0% | N/A |
| Feed | This is the news feed part of the app | 0% | N/A |
\ No newline at end of file
--[[
Name: Account -> Login
Description: Login Function
--]]
function program.account.login()
base.screen.colour("white")
program.draw.menubar("Account: Login")
while true do
local args = { os.pullEvent() }
if args[1] == "timer" then
program.draw.menubar("Account: Login")
elseif args[1] == "mouse_click" then
if (args[3] >= 1 and args[3] <= screenx) and (args[4] >= 1 and args[4] <= 2) then
program.draw.menu.handler("Account: Login", args[3], args[4])
end
end
end
end
\ No newline at end of file
--[[
Name: api.base
Desc: Downloads and installs BaseAPI
--]]
local ok, err = pcall( function()
if http then
aa = aa or {}
local a = http.get("http://api.dannysmc.com/files/apis/baseapi.lua")
a = a.readAll()
local env = {}
a = loadstring(a)
local env = getfenv()
setfenv(a,env)
local status, err = pcall(a, unpack(aa))
if (not status) and err then
printError("Error loading api")
return false
end
local returned = err
env = env
_G["base"] = env
end
end)
if not ok then
error("Could not install API")
end
\ No newline at end of file
--[[
Name: api.discover
Desc: Downloads and installs DiscoverAPI
--]]
local ok, err = pcall( function()
if http then
aa = aa or {}
local a = http.get("http://api.dannysmc.com/files/apis/discover.lua")
a = a.readAll()
local env = {}
a = loadstring(a)
local env = getfenv()
setfenv(a,env)
local status, err = pcall(a, unpack(aa))
if (not status) and err then
printError("Error loading api")
return false
end
local returned = err
env = env
_G["base"] = env
end
end)
if not ok then
error("Could not install API")
end
\ No newline at end of file
--[[
Name: apps.all
Desc: All apps screen function
--]]
\ No newline at end of file
--[[
Name: apps.categories
Desc: App categories screen function
--]]
\ No newline at end of file
--[[
Name: apps.downloads
Desc: Apps listed by download count screen function
--]]
\ No newline at end of file
--[[
Name: apps.owned
Desc: All owned apps screen function
--]]
\ No newline at end of file
--[[
Name: apps.packages
Desc: Apps listed by packages, example the Microsoft Package, Ink, Sketch, etc
--]]
\ No newline at end of file
--[[
Name: apps.downloads
Desc: App search screen function
--]]
\ No newline at end of file
--[[
Name: apps.downloads
Desc: Versions listing screen function
--]]
\ No newline at end of file
--[[
Name: Discover App -> File Builder
Team: FluxDev
--]]
local tArgs = { ... }
local paths = {
"core/core.header.lua";
"core/core.environment.lua";
"api/api.discover.lua";
"api/api.base.lua";
"core/core.general.lua";
"core/core.icons.lua";
"core/core.init.lua";
"main/main.menu.lua";
"main/main.home.lua";
"apps/apps.all.lua";
"account/account.login.lua";
"apps/apps.categories.lua";
"apps/apps.versions.lua";
"apps/apps.search.lua";
"apps/apps.downloads.lua";
"apps/apps.owned.lua";
"apps/apps.packages.lua";
"snippets/snippets.all.lua";
"snippets/snippets.owned.lua";
"core/core.footer.lua";
}
function build(logging)
local ok, err = pcall( function()
if logging then print("Starting build...") end
if not logging then write("Building... ") end
if fs.exists("discoverapp.lua") then
if logging then print("Renaming existing build into temp...") end
fs.move("discoverapp.lua", "discoverapp.temp.lua")
end
local f = fs.open("discoverapp.lua", "a")
for k,v in ipairs(paths) do
if logging then print("Building: " .. tostring(k) .. " / " .. tostring(#paths)) end
sleep(0.01)
local fp = fs.open(v, "r")
f.write(fp.readAll())
f.write("\n\n")
fp.close()
end
f.close()
print("Success")
end)
if not ok then
fs.delete("discoverapp.lua")
fs.move("discoverapp.temp.lua", "discoverapp.lua")
term.setTextColor(colours.red)
if logging then print(shell.getRunningProgram() .. ": " .. tostring(err)) end
term.setTextColor(colours.white)
print("Fail")
else
fs.delete("discoverapp.temp.lua")
end
end
if (#tArgs > 0) then
if tArgs[1] == "run" then
if tArgs[2] == "-l" then
build(true);
else
build(false);
end
elseif tArgs[1] == "compress" then
if fs.exists("discoverapp.lua") then
write("Compressing... ")
local f = fs.open("discoverapp.lua", "r")
local data = f.readAll()
f.close()
data = data:gsub("\\\n", "\n")
data = data:gsub("[\r\f\n]"," ")
data = data:gsub("(%s+)", " ")
local f = fs.open("discoverapp.min.lua", "w")
f.write(data)
f.close()
print("Success")
else
term.setTextColor(colours.red)
print(shell.getRunningProgram() .. ": Please build the program first")
term.setTextColor(colours.white)
end
end
else
term.setTextColour(colours.cyan)
print("Builder: Usage")
print(" -> run (without logging)")
print(" -> run -l (with logging)")
print(" -> compress")
term.setTextColour(colours.white)
end
\ No newline at end of file
--[[
Name: core.environment
Desc: Sets the environment for the core application
--]]
tArgs = { ... }
program = {}; program.core = {}; program.apps = {}; program.snippets = {}; program.cloud = {}; program.mail = {}; program.feed = {}; program.draw = {}; program.main = {}; program.draw.menu = {}; program.chat = {}; program.profiles = {}; program.account = {};
Internal = {
Data = {
Notifications = {};
Apps = {};
Snippets = {};
};
Config = {
Path = ".DiscoverConfig";
};
Icons = {};
System = {
Platform = false;
ActiveScreen = false;
};
}
local screenx, screeny = term.getSize();
if screenx == 51 and screeny == 19 then
Internal.System.Platform = "Desktop";
elseif screenx == 26 and screeny == 20 then
Internal.System.Platform = "Platform";
elseif screenx == 39 and screeny == 13 then
Internal.System.Platform = "Turtle";
else
Internal.System.Platform = "Unknown";
end
\ No newline at end of file
if (#tArgs > 0) then
program.core.cli(tArgs)
else
program.core.init()
end
\ No newline at end of file
--[[
Name: core.general
Desc: Used for general functions / setup for the core application
--]]
function program.core.shutdown()
print("Program closed")
end
\ No newline at end of file
--[[
Name: Discover App
Team: FluxDev (DannySMc, WaitDev_)
--]]
\ No newline at end of file
--[[
Name: core.icons
Desc: Sets all the tables for the icons for this program
15 icons total
--]]
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:C","f:4:r","f:4:e","f:4:d","f:4:i","f:4:t","f:4:s","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: "};
{"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: "};
};
["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: ","8:8::","8: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: ","8:8::","8: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: ","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: "};
}
}
function program.core.init()
-- Initialise the App
local ok, err = pcall( function()
-- Assert APIs
assert(type(Discover) == "table");
assert(type(base) == "table");
-- Run Loading Screen
local x, y = term.getSize();
base.screen.colour("white")
base.draw.textc("Discover App", 1, false, "grey", "white")
base.draw.textc("Developed By FluxDev", y, false, "red", "white")
local function log(text)
local text = base.data.wordwrap(text, x-5)
for k,v in ipairs(text) do
base.draw.box(1, x, k+9, 1, " ", "white", "white")
end
for k,v in ipairs(text) do
base.draw.textc(v, k+9, false, "lightBlue", "white")
end
sleep(0.1);
end
-- Expain Sequence
log("Running init sequence, please wait ...")
-- Check for app config
log("Searching for config ...")
if fs.exists(Internal.Config.Path) then
local f = fs.open(Internal.Config.Path, "r")
local d = f.readAll()
f.close()
Internal.Account = textutils.unserialize(Discover.Crypto:Base64("decode", d))
end
-- Check for username / password
log("Looking for account credentials ... ")
if Internal.Data.Username and Internal.Data.Password then
local status = Discover.User:ManualLogin(Internal.Data.Username, Internal.Data.Password);
Internal.Account.Username = nil;
Internal.Account.Password = nil;
if status then
log("Account found, logged in!")
else
log("Account found, could not login!")
Discover.User:Reset();
end
else
log("Account credentials were not found!")
end
-- Get Notifications
if (Discover.User:LoggedIn()) then
log("Retrieving account notifications ...")
local status, data = Discover.Notifications:List();
if not status then
log("Could not get notifications, " .. tostring(Discover.User:GetField("ErrorMsg")))
Internal.Data.Notifications = {};
else
Internal.Data.Notifications = data;
end
end
-- Initialise Threads
base.thread.create("Home", program.main.home)
base.thread.switch("Home")
base.thread.run()
-- Shutdown Sequence
program.core.shutdown()
end)
if not ok then
error(":Discover: " ..tostring(err))
end
end
\ No newline at end of file
This diff is collapsed.
function program.main.home()
if Internal.System.Platform == "Desktop" then
base.screen.colour("white")
program.draw.menubar("Dashboard")
local screenx, screeny = term.getSize();
base.draw.box(1, screenx, screeny, 1, " ", "grey", "grey")
local iconnames = {
{
["icon_name"] = "login";
["base_func"] = "account";
["func_name"] = "login";
["thrd_name"] = "Login";
};
-- {
-- ["icon_name"] = "logout";
-- ["base_func"] = "account";
-- ["func_name"] = "logout";
-- ["thrd_name"] = "Logout";
-- };
{
["icon_name"] = "appStore";
["base_func"] = "apps";
["func_name"] = "all";
["thrd_name"] = "Apps";
};
{
["icon_name"] = "snippetStore";
["base_func"] = "snippets";
["func_name"] = "all";
["thrd_name"] = "Snippets";
};
{
["icon_name"] = "cloudStorage";
["base_func"] = "cloud";
["func_name"] = "main";
["thrd_name"] = "Cloud";
};
{
["icon_name"] = "mailbox";
["base_func"] = "mail";
["func_name"] = "inbox";
["thrd_name"] = "Mail";
};
{
["icon_name"] = "newsFeed";
["base_func"] = "feed";
["func_name"] = "view";
["thrd_name"] = "Feed";
};
{
["icon_name"] = "chatRooms";
["base_func"] = "chat";
["func_name"] = "main";
["thrd_name"] = "Chat";
};
{
["icon_name"] = "profiles";
["base_func"] = "profiles";
["func_name"] = "main";
["thrd_name"] = "Profiles";
};
{
["icon_name"] = "accManagement";
["base_func"] = "account";
["func_name"] = "manage";
["thrd_name"] = "Account";
};
{
["icon_name"] = "settings";
["base_func"] = "main";
["func_name"] = "settings";
["thrd_name"] = "Settings";
};
{
["icon_name"] = "updateLogs";
["base_func"] = "main";
["func_name"] = "updates";
["thrd_name"] = "Updates";
};
{
["icon_name"] = "help";