Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- Used for ease of use with Northbridge Network
- http://northbridge.dx.am
- ]]--
- version = 0.1
- local apiUrl = "http://api.northbridge.dx.am/"
- local function checkForJson()
- if (json == null) then
- error('json api is not running')
- end
- end
- os.version = function()
- return "Northbridge OS Terminal v"..version
- end
- client = {
- setThemeColor = function(color, themePart)
- theme[themePart] = color
- local file = fs.open("northbridge/theme", "w")
- file.write(json.encodePretty(theme))
- file.close()
- end
- ,
- splitString = function(string, splitChar)
- return {string:match('/(.-) (.+)')}
- end
- }
- user = {
- login = function(username, password)
- checkForJson()
- return json.decode(http.get(textutils.urlEncode(apiUrl.."user.php?cmd=login&username="..username.."&password="..password)).readAll())
- end
- ,
- register = function(username, password, email)
- checkForJson()
- return json.decode(http.get(textutils.urlEncode(apiUrl.."user.php?cmd=register&username="..username.."&password="..password.."&email="..email)).readAll())
- end
- ,
- validate = function(username, key)
- checkForJson()
- return json.decode(http.get(textutils.urlEncode(apiUrl.."user.php?cmd=validate&username="..username.."&key="..key)).readAll())
- end
- ,
- logout = function(username, key)
- checkForJson()
- return json.decode(http.get(textutils.urlEncode(apiUrl.."user.php?cmd=logout&username="..username.."&key="..key)).readAll())
- end
- ,
- changePassword = function(username, password, newPassword)
- checkForJson()
- return json.decode(http.get(textutils.urlEncode(apiUrl.."user.php?cmd=passChange&username="..username.."&password="..password.."&newPassword="..newPassword)).readAll())
- end
- ,
- changeEmail = function(username, password, newEmail)
- checkForJson()
- return json.decode(http.get(textutils.urlEncode(apiUrl.."user.php?cmd=emailChange&username="..username.."&password="..password.."&newEmail="..newEmail)).readAll())
- end
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement