Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local run = shell.run
- local lib = {}
- -- Get data which is probably sufficient to uniquely identify a computer on a server.
- function lib.get_host()
- return {
- label = os.getComputerLabel(),
- ID = os.getComputerID(),
- lua_version = _VERSION,
- CC_host = _HOST,
- build = _G.build_number,
- craftOS_version = os.version(),
- debug_available = _G.debug ~= nil,
- ingame_location = lib.location
- }
- end
- -- Reports provided incidents to Santa, or possibly just me. Not Steve. See xkcd.com/838. Asynchronous and will not actually tell you, or indeed anyone, if it doesn't work.
- function lib.report_incident(incident, notify)
- local json = require "json"
- if type(incident) ~= "string" then error "incident description must be string" end
- http.request("https://osmarks.tk/wsthing/report", json.encode({ report = incident, host = get_host() }), {["content-type"] = "application/json"})
- if notify then print "This incident has been reported." end
- end
- function lib.update() run "autorun update" end
- return lib
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement