forked from osmarks/potatOS
Fix accreted software horrors
- Internal CC changes break hacky stacktrace thing - CraftOS-PC refuses to boot it due to some bizarre issue with ipairs - Superglobals backend (JSON storage service) replaced with new RSAPI service due to downtime - Internal CC changes break incomplete FS overlay mechanism (implement full version) - Chuck Norris joke API service broke (replace with another)
This commit is contained in:
parent
8f15e7e6ef
commit
fd2ae8cbb3
@ -114,12 +114,19 @@ Here's a list of some of the more useful and/or consistently available functions
|
|||||||
- "[ANTIMEME EXPUNGED]"
|
- "[ANTIMEME EXPUNGED]"
|
||||||
- "POTATOS UNINSTALLATION REQUIRES ANSWERING HARD MATH PROBLEMS" - 3d6, 2020
|
- "POTATOS UNINSTALLATION REQUIRES ANSWERING HARD MATH PROBLEMS" - 3d6, 2020
|
||||||
- "Pastebin's SMART filters have detected potentially offensive or questionable content in your paste. The content you are trying to publish has been deemed potentially offensive or questionable by our filters" - Pastebin, 2020
|
- "Pastebin's SMART filters have detected potentially offensive or questionable content in your paste. The content you are trying to publish has been deemed potentially offensive or questionable by our filters" - Pastebin, 2020
|
||||||
|
- "Apparently using macro keybinds mod to automatically execute /suicide upon hearing the word "potatOS" in chat would be abused by players" - AlexDevs, 2021
|
||||||
- "PotatOS is the season for the next two years and the other two are the best things to do with the other people in the world and I have to be a good person to be a good friend to the person that is in a good way to get the new update and then I have to go to the doctor and then go to the doctor and then go to the doctor" - Autocomplete, 2020
|
- "PotatOS is the season for the next two years and the other two are the best things to do with the other people in the world and I have to be a good person to be a good friend to the person that is in a good way to get the new update and then I have to go to the doctor and then go to the doctor and then go to the doctor" - Autocomplete, 2020
|
||||||
- "why is there an interpret brain[REDACTED] command?"
|
- "why is there an interpret brain[REDACTED] command?"
|
||||||
- "Gollark: your garbage OS and your spread of it destroyed the mob farm." - steamport, 2020
|
- "Gollark: your garbage OS and your spread of it destroyed the mob farm." - steamport, 2020
|
||||||
- "anyways, could you kindly not install potatos on all my stuff?" - Terrariola, 2019
|
- "anyways, could you kindly not install potatos on all my stuff?" - Terrariola, 2019
|
||||||
|
- "wHy dO HaLf oF ThEsE HaVe pOtAtOs rEmOtElY InStAlLeD?" - Terrariola, 2023
|
||||||
- "pastebin run RM13UGFa"
|
- "pastebin run RM13UGFa"
|
||||||
- "i don't want to see that program/OS/whatever you call it on this server ever again" - Yemmel, 2020
|
- "i don't want to see that program/OS/whatever you call it on this server ever again" - Yemmel, 2020
|
||||||
|
- "PotatOS is many, varied, ever-changing, and eternal. Fighting it is like fighting a many-headed monster, which, each time a neck is severed, sprouts a head even fiercer and cleverer than before. You are fighting that which is unfixed, mutating, indestructible." - someone
|
||||||
|
- "go use potatos or something" - SwitchCraft3 (official), 2023
|
||||||
|
- "a lot of backup time is spent during potatos" - Lemmmy, 2022
|
||||||
|
- "potatOS is as steady as a rock" - BlackDragon, 2021
|
||||||
|
- "PotatOS would be a nice religion" - piguman3, 2022
|
||||||
|
|
||||||
## Disclaimer
|
## Disclaimer
|
||||||
|
|
||||||
|
4
manifest
4
manifest
@ -1,2 +1,2 @@
|
|||||||
{"build":245,"description":"policy URL update","files":{"LICENSES":"f3549d84d66eb53dd4a421a4341d77d3d217c1b117d67e3be8f5211adcda0952","autorun.lua":"e641359237c4d9758b6a8aba343e035984f1c82ed8924cb6f970873e07548cce","bin/5rot26.lua":"417891a232e325476f980d31d88edc486d526611a6350ce47fd29cca464ebf2c","bin/ccemux.lua":"239476f58835b86bbcac31ce8af3c3acd3d198a55ab9ada78c62fbf358625a98","bin/chronometer.lua":"db5363993a04382145aef7db2fbe262f0bf10697a589e1e2d2f9ce0f87430dd8","bin/factor.lua":"f8d223839e6b9f4e8c85f46e8182e7ede7ec41e6644f0188d1f315014c79a2c0","bin/grep.lua":"1509bc267867b933e528ab74cfbc2a15fa2df0ec7389df4f9033194ab9037865","bin/kristminer.lua":"7e7f9fe2a6493d584ad6926cda915e02c1c3d800dc209680898ce930d0bb0e6f","bin/livegps.lua":"c3d17d495cda01aa1261e4c4fcd43439b29af422671972117ec34f68e32c5bba","bin/loading.lua":"c85f7aa1765170325155b921c1fceeb62643f552f12d41b529a22af3a67f5a97","bin/potatoflight.lua":"2fbb0b6f8d78728d8cb0ec64af1bc598bd00cb55f202378e7acdb86bba71efd1","bin/potatoplex.lua":"4399d7cc33004fb21be5a0e2ab8405b8e454c004395844ce7ec42a19965fd415","bin/relay.lua":"261ae6c220b83506e3326e8f2b091d246baae458ff0d2ee87512be2c4e35a75d","bin/tryhaskell.lua":"07810d85145da65a3e434154c79d5a9d72f2dcbe59c8d6829040fb925df878ec","bin/workspace.lua":"acc8bb6f08b243378b68ab5f611e9a6cc8216b0713343dc93ddaa9101f07ffc5","potatobios.lua":"bbe42626d6c8ab352c32fd19f623a134b51afcd297671c29de5694764b66013f","signing-key.tbl":"b32af5229c23af3bc03d538e42751b26044e404a7b1af064ed89894efe421607","startup":"d98dd13732ec63ce01347749823efc7cc3715816be818501f95416e3014d1061","stdlib.hvl":"a6fd2620068f47794a9bbeed77bee3fd4962f848e6dd7c75137b30cd5665272e","update-key.hex":"8d8afb7a45833bb7d68f929421ad60a211d4d73e0ee03b24dc0106ba1de2e1a0","xlib/00_cbor.lua":"464b075e4f094b8db42506bd4bdaad0db87699ea7fbf80e5b87739b4aa9279af","xlib/01_skynet.lua":"9cb565d639a0acd7c763c3e7422482532cd0bda0cdfcc720089ab4a87e551339","xlib/03_heavlisp.lua":"82cdabd5286058c0ea4f27956f8c1144e198769c8b8ce9e91b26c930d711f710"},"sizes":{"LICENSES":4725,"autorun.lua":102198,"bin/5rot26.lua":1661,"bin/ccemux.lua":1673,"bin/chronometer.lua":1152,"bin/factor.lua":4263,"bin/grep.lua":1196,"bin/kristminer.lua":5566,"bin/livegps.lua":980,"bin/loading.lua":7707,"bin/potatoflight.lua":3417,"bin/potatoplex.lua":6584,"bin/relay.lua":3075,"bin/tryhaskell.lua":1867,"bin/workspace.lua":42971,"potatobios.lua":40409,"signing-key.tbl":190,"startup":8438,"stdlib.hvl":851,"update-key.hex":44,"xlib/00_cbor.lua":15808,"xlib/01_skynet.lua":3286,"xlib/03_heavlisp.lua":15643},"timestamp":1646508336}
|
{"build":298,"description":"modern CC compatibility fixes version six.3 (finalestest v4)","files":{"LICENSES":"f3549d84d66eb53dd4a421a4341d77d3d217c1b117d67e3be8f5211adcda0952","autorun.lua":"85ad1591cd4d32669a4310b2f9b94c4c55511cbe4588ddc7ddb769a1bfd7df7a","bin/5rot26.lua":"417891a232e325476f980d31d88edc486d526611a6350ce47fd29cca464ebf2c","bin/ccemux.lua":"239476f58835b86bbcac31ce8af3c3acd3d198a55ab9ada78c62fbf358625a98","bin/chronometer.lua":"db5363993a04382145aef7db2fbe262f0bf10697a589e1e2d2f9ce0f87430dd8","bin/factor.lua":"f8d223839e6b9f4e8c85f46e8182e7ede7ec41e6644f0188d1f315014c79a2c0","bin/grep.lua":"1509bc267867b933e528ab74cfbc2a15fa2df0ec7389df4f9033194ab9037865","bin/kristminer.lua":"7e7f9fe2a6493d584ad6926cda915e02c1c3d800dc209680898ce930d0bb0e6f","bin/livegps.lua":"c3d17d495cda01aa1261e4c4fcd43439b29af422671972117ec34f68e32c5bba","bin/loading.lua":"c85f7aa1765170325155b921c1fceeb62643f552f12d41b529a22af3a67f5a97","bin/potatoflight.lua":"2fbb0b6f8d78728d8cb0ec64af1bc598bd00cb55f202378e7acdb86bba71efd1","bin/potatoplex.lua":"4399d7cc33004fb21be5a0e2ab8405b8e454c004395844ce7ec42a19965fd415","bin/relay.lua":"261ae6c220b83506e3326e8f2b091d246baae458ff0d2ee87512be2c4e35a75d","bin/tryhaskell.lua":"07810d85145da65a3e434154c79d5a9d72f2dcbe59c8d6829040fb925df878ec","bin/workspace.lua":"acc8bb6f08b243378b68ab5f611e9a6cc8216b0713343dc93ddaa9101f07ffc5","potatobios.lua":"703433d5e3d90b32fdb48cdb54a2f496c8ad578dfb5e186827037dd4b3f464b8","signing-key.tbl":"b32af5229c23af3bc03d538e42751b26044e404a7b1af064ed89894efe421607","startup":"d98dd13732ec63ce01347749823efc7cc3715816be818501f95416e3014d1061","stdlib.hvl":"a6fd2620068f47794a9bbeed77bee3fd4962f848e6dd7c75137b30cd5665272e","update-key.hex":"8d8afb7a45833bb7d68f929421ad60a211d4d73e0ee03b24dc0106ba1de2e1a0","xlib/00_cbor.lua":"8b1cc3588a5e31298d22e50b6752a4413f12f8113622962ed6555557448b408b","xlib/01_skynet.lua":"9cb565d639a0acd7c763c3e7422482532cd0bda0cdfcc720089ab4a87e551339","xlib/03_heavlisp.lua":"82cdabd5286058c0ea4f27956f8c1144e198769c8b8ce9e91b26c930d711f710"},"sizes":{"LICENSES":4725,"autorun.lua":102485,"bin/5rot26.lua":1661,"bin/ccemux.lua":1673,"bin/chronometer.lua":1152,"bin/factor.lua":4263,"bin/grep.lua":1196,"bin/kristminer.lua":5566,"bin/livegps.lua":980,"bin/loading.lua":7707,"bin/potatoflight.lua":3417,"bin/potatoplex.lua":6584,"bin/relay.lua":3075,"bin/tryhaskell.lua":1867,"bin/workspace.lua":42971,"potatobios.lua":41102,"signing-key.tbl":190,"startup":8438,"stdlib.hvl":851,"update-key.hex":44,"xlib/00_cbor.lua":15831,"xlib/01_skynet.lua":3286,"xlib/03_heavlisp.lua":15643},"timestamp":1691884096}
|
||||||
{"hash":"4859d01783c3744ca90f6f772c5a80110861654f7382d9bf527c3a9dd978a77d","sig":"37f69d27695120820dd0c07c2e638009aad0857a0b5cdbb7858df8fba6bc447b4f3fa2f399acb06f1630"}
|
{"hash":"4de0f8c3b0fb376356fd2573389b19c664342a577519d9ee75fe2c264df34d8b","sig":"03687bd0a59990e8a6efa67aed998173f99809b00a5533771c605b743388192dde3924a8d78a79285c0b"}
|
737
package-lock.json
generated
737
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
5
package.json
Normal file
5
package.json
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"dependencies": {
|
||||||
|
"luabundler": "^1.2.2"
|
||||||
|
}
|
||||||
|
}
|
@ -66,7 +66,8 @@ local function xpcall_with(fn, ...)
|
|||||||
local res = table.pack(_xpcall(function() return fn(unpack(args)) end, traceback)) if not res[1] then trace = traceback("stack_trace.lua:1:") end
|
local res = table.pack(_xpcall(function() return fn(unpack(args)) end, traceback)) if not res[1] then trace = traceback("stack_trace.lua:1:") end
|
||||||
local ok, err = res[1], res[2]
|
local ok, err = res[1], res[2]
|
||||||
|
|
||||||
if not ok and err ~= nil then
|
-- PS#EAB415D8: CC now uses error sentinel things in some places; we do not want to make those strings
|
||||||
|
if not ok and err ~= nil and type(err) == "string" then
|
||||||
trace = trim_traceback(err, trace)
|
trace = trim_traceback(err, trace)
|
||||||
|
|
||||||
-- Find the position where the stack traceback actually starts
|
-- Find the position where the stack traceback actually starts
|
||||||
|
@ -138,18 +138,6 @@ local function combine(segs)
|
|||||||
end
|
end
|
||||||
return out
|
return out
|
||||||
end
|
end
|
||||||
|
|
||||||
-- magic from http://lua-users.org/wiki/SplitJoin
|
|
||||||
-- split string into lines
|
|
||||||
local function lines(str)
|
|
||||||
local t = {}
|
|
||||||
local function helper(line)
|
|
||||||
table.insert(t, line)
|
|
||||||
return ""
|
|
||||||
end
|
|
||||||
helper((str:gsub("(.-)\r?\n", helper)))
|
|
||||||
return t
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Fetch the contents of URL "u"
|
-- Fetch the contents of URL "u"
|
||||||
local function fetch(u)
|
local function fetch(u)
|
||||||
@ -160,12 +148,28 @@ local function fetch(u)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Make a read handle for a string
|
-- Make a read handle for a string
|
||||||
|
-- PS#8FE487EF: Incompletely implemented handle behaviour lead to strange bugs on recent CC
|
||||||
local function make_handle(text)
|
local function make_handle(text)
|
||||||
local lines = lines(text)
|
local h = {}
|
||||||
local h = {line = 0}
|
local cursor = 1
|
||||||
function h.close() end
|
function h.close() end
|
||||||
function h.readLine() h.line = h.line + 1 return lines[h.line] end
|
function h.readLine(with_trailing)
|
||||||
function h.readAll() return text end
|
if cursor >= text:len() then return nil end
|
||||||
|
local lt_start, lt_end = text:find("\r?\n", cursor)
|
||||||
|
lt_start = lt_start or (text:len() + 1)
|
||||||
|
lt_end = lt_end or (text:len() + 1)
|
||||||
|
local seg = text:sub(cursor, with_trailing and lt_end or (lt_start - 1))
|
||||||
|
ccemux.echo(("%d %d %d %q %q"):format(cursor, lt_start, lt_end, text, text:sub(cursor)))
|
||||||
|
cursor = lt_end + 1
|
||||||
|
return seg
|
||||||
|
end
|
||||||
|
function h.read(count)
|
||||||
|
local count = count or 1
|
||||||
|
local seg = text:sub(cursor, cursor + count - 1)
|
||||||
|
cursor = cursor + count
|
||||||
|
return seg:len() ~= 0 and seg or nil
|
||||||
|
end
|
||||||
|
function h.readAll() local seg = text:sub(cursor) cursor = text:len() return seg:len() ~= 0 and seg or nil end
|
||||||
return h
|
return h
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -842,10 +842,11 @@ local function gen_uuid()
|
|||||||
return table.concat(out)
|
return table.concat(out)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- PS#44BE67B6: ipairs somehow causing issues on CraftOS-PC
|
||||||
local function hexize(tbl)
|
local function hexize(tbl)
|
||||||
local out = {}
|
local out = {}
|
||||||
for k, v in ipairs(tbl) do
|
for k = 1, #tbl do
|
||||||
out[k] = ("%02x"):format(v)
|
out[k] = string.format("%02x", tbl[k])
|
||||||
end
|
end
|
||||||
return table.concat(out)
|
return table.concat(out)
|
||||||
end
|
end
|
||||||
@ -1580,6 +1581,7 @@ end
|
|||||||
|
|
||||||
return function(...)
|
return function(...)
|
||||||
local command = table.concat({...}, " ")
|
local command = table.concat({...}, " ")
|
||||||
|
add_log("command line is %q", command)
|
||||||
|
|
||||||
-- Removes whitespace. I don't actually know what uses this either.
|
-- Removes whitespace. I don't actually know what uses this either.
|
||||||
local function strip_whitespace(text)
|
local function strip_whitespace(text)
|
||||||
@ -1607,7 +1609,8 @@ return function(...)
|
|||||||
if config.get "romReadOnly" ~= false then pcall(config.set, "romReadOnly", false) end -- TODO: do something COOL with this.
|
if config.get "romReadOnly" ~= false then pcall(config.set, "romReadOnly", false) end -- TODO: do something COOL with this.
|
||||||
end
|
end
|
||||||
|
|
||||||
if not polychoron or not fs.exists "potatobios.lua" or not fs.exists "autorun.lua" then -- Polychoron not installed, so PotatOS Tau isn't.
|
if not polychoron or not fs.exists "potatobios.lua" or not fs.exists "autorun.lua" then -- Polychoron not installed, so PotatOS isn't.
|
||||||
|
add_log "running installation"
|
||||||
install(true)
|
install(true)
|
||||||
else
|
else
|
||||||
process.spawn(function() -- run update task in kindofbackground process
|
process.spawn(function() -- run update task in kindofbackground process
|
||||||
|
@ -26,6 +26,10 @@ function _G.error(...)
|
|||||||
if math.random(1, 100) == 5 then
|
if math.random(1, 100) == 5 then
|
||||||
real_error("vm:error: java.lang.IllegalStateException: Resuming from unknown instruction", 0)
|
real_error("vm:error: java.lang.IllegalStateException: Resuming from unknown instruction", 0)
|
||||||
else
|
else
|
||||||
|
local a = ...
|
||||||
|
if ccemux then
|
||||||
|
pcall(function() ccemux.echo("error: " .. textutils.serialise(a) .. "\n" .. debug.traceback()) end)
|
||||||
|
end
|
||||||
real_error(...)
|
real_error(...)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -1190,8 +1194,9 @@ function potatOS.restart_UI()
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Simple HTTP.get wrapper
|
-- Simple HTTP.get wrapper
|
||||||
function fetch(u)
|
function fetch(u, ...)
|
||||||
local h,e = http.get(u)
|
if not http then error "No HTTP access" end
|
||||||
|
local h,e = http.get(u, ...)
|
||||||
if not h then error(("could not fetch %s (%s)"):format(tostring(u), tostring(e))) end
|
if not h then error(("could not fetch %s (%s)"):format(tostring(u), tostring(e))) end
|
||||||
local c = h.readAll()
|
local c = h.readAll()
|
||||||
h.close()
|
h.close()
|
||||||
@ -1212,46 +1217,37 @@ JSONBin (https://jsonbin.org/) recently adjusted their policies in a way which b
|
|||||||
|
|
||||||
Fix for PS#18819189
|
Fix for PS#18819189
|
||||||
MyJSON broke *too* somehow (I have really bad luck with these things!) so move from https://api.myjson.com/bins/150r92 to "JSONBin".
|
MyJSON broke *too* somehow (I have really bad luck with these things!) so move from https://api.myjson.com/bins/150r92 to "JSONBin".
|
||||||
|
|
||||||
|
Fix for PS#8C4CB942
|
||||||
|
The other JSONBin thing broke too so just implement it in RSAPI
|
||||||
]]
|
]]
|
||||||
|
|
||||||
local bin_URL = "https://jsonbase.com/potatOS/superglobals"
|
local bin_URL = "https://r.osmarks.net/superglobals/"
|
||||||
local bin = {}
|
local bin = {}
|
||||||
local localbin = {}
|
local localbin = {}
|
||||||
function bin.dump()
|
|
||||||
local fetch_result = {}
|
|
||||||
parallel.waitForAny(function()
|
|
||||||
fetch_result = json.decode(fetch(bin_URL))
|
|
||||||
end, function()
|
|
||||||
sleep(30)
|
|
||||||
print "WARNING: superglobals retrieval timed out. Reporting incident."
|
|
||||||
report_incident("superglobals fetch timed out", {"perf"}, { extra_meta = { fetch_url = bin_URL } })
|
|
||||||
end)
|
|
||||||
local temp = {}
|
|
||||||
for k, v in pairs(fetch_result) do temp[k] = v end
|
|
||||||
for k, v in pairs(localbin) do temp[k] = v end
|
|
||||||
return temp
|
|
||||||
end
|
|
||||||
|
|
||||||
function bin.get(k)
|
function bin.get(k)
|
||||||
potatOS.add_log("asked to fetch %s", k)
|
if localbin[k] then
|
||||||
return localbin[k] or bin.dump()[k]
|
return localbin[k]
|
||||||
|
else
|
||||||
|
local ok, err = pcall(function()
|
||||||
|
local r = fetch(bin_URL .. textutils.urlEncode(tostring(k)), nil, true)
|
||||||
|
local ok, err = pcall(json.decode, r)
|
||||||
|
if not ok then return r end
|
||||||
|
return err
|
||||||
|
end)
|
||||||
|
if not ok then potatOS.add_log("superglobals fetch failed %s", tostring(err)) return nil end
|
||||||
|
return err
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function bin.set(k, v)
|
function bin.set(k, v)
|
||||||
local ok, err = pcall(function()
|
local ok, err = pcall(function()
|
||||||
local b = bin.dump()
|
|
||||||
b[k] = v
|
b[k] = v
|
||||||
local h, err = http.post {
|
local h, err = http.post(bin_URL .. textutils.urlEncode(tostring(k)), json.encode(v), nil, true)
|
||||||
url = "https://jsonbase.com/potatOS/superglobals",
|
|
||||||
method = "PUT",
|
|
||||||
body = json.encode(b),
|
|
||||||
headers = {
|
|
||||||
["content-type"] = "application/json"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if not h then error(err) end
|
if not h then error(err) end
|
||||||
end)
|
end)
|
||||||
if not ok then localbin[k] = v end
|
if not ok then localbin[k] = v potatOS.add_log("superglobals set failed %s", tostring(err)) end
|
||||||
end
|
end
|
||||||
|
|
||||||
local bin_mt = {
|
local bin_mt = {
|
||||||
@ -1450,11 +1446,49 @@ function num_funcs.isInf(x) return math.abs(x) == math.huge end
|
|||||||
|
|
||||||
_G.potatOS.bin = bin
|
_G.potatOS.bin = bin
|
||||||
|
|
||||||
|
function potatOS.fasthash(str)
|
||||||
|
local h = 5381
|
||||||
|
for c in str:gmatch "." do
|
||||||
|
h = (bit.blshift(h, 5) + h) + string.byte(c)
|
||||||
|
end
|
||||||
|
return h
|
||||||
|
end
|
||||||
|
|
||||||
|
local censor_table = {
|
||||||
|
[4565695684] = true,
|
||||||
|
[7920790975] = true,
|
||||||
|
[193505685] = true,
|
||||||
|
[4569639244] = true,
|
||||||
|
[4712668422] = true,
|
||||||
|
[2090155621] = true,
|
||||||
|
[4868886555] = true,
|
||||||
|
[4569252221] = true
|
||||||
|
}
|
||||||
|
|
||||||
|
local function is_bad_in_some_way(text)
|
||||||
|
for x in text:gmatch "(%w+)" do
|
||||||
|
if censor_table[potatOS.fasthash(x)] then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
local function timeout(fn, time)
|
||||||
|
local res = {}
|
||||||
|
parallel.waitForAny(function() res = {fn()} end, function() sleep(time) end)
|
||||||
|
return table.unpack(res)
|
||||||
|
end
|
||||||
|
|
||||||
-- Connect to random text generation APIs. Not very reliable.
|
-- Connect to random text generation APIs. Not very reliable.
|
||||||
|
-- PS#BB87FCE2: Previous API broke, swap it out
|
||||||
function _G.potatOS.chuck_norris()
|
function _G.potatOS.chuck_norris()
|
||||||
local resp = fetch "http://api.icndb.com/jokes/random?exclude=[explicit]"
|
--local resp = fetch "http://api.icndb.com/jokes/random?exclude=[explicit]"
|
||||||
local text = json.decode(resp).value.joke:gsub(""", "'")
|
while true do
|
||||||
return text
|
local resp = fetch("https://api.api-ninjas.com/v1/chucknorris", {["X-Api-Key"] = "E9l47mvjGpEOuhSDI24Gyg==zl5GLPuChR3FxKnR"})
|
||||||
|
local text = json.decode(resp).joke:gsub("[\127-\255]+", "'")
|
||||||
|
if not is_bad_in_some_way(text) and text:match ".$" == "." then return text end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Remove paragraph tags from stuff.
|
-- Remove paragraph tags from stuff.
|
||||||
@ -1693,7 +1727,7 @@ if potatOS.hidden ~= true then
|
|||||||
local v = "PotatOS Hypercycle"
|
local v = "PotatOS Hypercycle"
|
||||||
if potatOS.build then v = v .. " " .. potatOS.build end
|
if potatOS.build then v = v .. " " .. potatOS.build end
|
||||||
if potatOS.version then v = v .. " " .. potatOS.version() end
|
if potatOS.version then v = v .. " " .. potatOS.version() end
|
||||||
local ok, err = pcall(randpick(stuff))
|
local ok, err = timeout(function() return pcall(randpick(stuff)) end, 0.7)
|
||||||
if ok then v = v .. "\n" .. err else
|
if ok then v = v .. "\n" .. err else
|
||||||
potatOS.add_log("motd fetch failed: %s", err)
|
potatOS.add_log("motd fetch failed: %s", err)
|
||||||
v = v .. " [error fetching MOTD]"
|
v = v .. " [error fetching MOTD]"
|
||||||
|
@ -60,7 +60,7 @@ local m_ldexp = math.ldexp or function (x, exp) return x * 2.0 ^ exp; end;
|
|||||||
local m_type = math.type or function (n) return n % 1 == 0 and n <= maxint and n >= minint and "integer" or "float" end;
|
local m_type = math.type or function (n) return n % 1 == 0 and n <= maxint and n >= minint and "integer" or "float" end;
|
||||||
local s_pack = string.pack or softreq("struct", "pack");
|
local s_pack = string.pack or softreq("struct", "pack");
|
||||||
local s_unpack = string.unpack or softreq("struct", "unpack");
|
local s_unpack = string.unpack or softreq("struct", "unpack");
|
||||||
local b_rshift = softreq("bit32", "rshift") or softreq("bit", "rshift") or
|
local b_rshift = softreq("bit32", "rshift") or softreq("bit", "rshift") or (bit or {}).brshift or
|
||||||
dostring "return function(a,b) return a >> b end" or
|
dostring "return function(a,b) return a >> b end" or
|
||||||
function (a, b) return m_max(0, m_floor(a / (2 ^ b))); end;
|
function (a, b) return m_max(0, m_floor(a / (2 ^ b))); end;
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<meta name="description" content="PotatOS Otiose Transformative Advanced Technology Or Something, inescapably, is the best OS for ComputerCraft and derivatives. Install now with pastebin run 7HSiHybr.">
|
||||||
<title>PotatOS</title>
|
<title>PotatOS</title>
|
||||||
<style>
|
<style>
|
||||||
body {
|
body {
|
||||||
@ -45,7 +46,7 @@ img {
|
|||||||
<h1>Welcome to PotatOS!</h1>
|
<h1>Welcome to PotatOS!</h1>
|
||||||
<img src="/potatos.gif" id="im">
|
<img src="/potatos.gif" id="im">
|
||||||
<div>
|
<div>
|
||||||
Current build: <code>5cd9f88c</code> (fix omnidisk), version 244, built 2022-02-21 20:19:48 (UTC).
|
Current build: <code>4de0f8c3</code> (modern CC compatibility fixes version six.3 (finalestest v4)), version 298, built 2023-08-12 23:48:16 (UTC).
|
||||||
</div>
|
</div>
|
||||||
<p>"PotatOS" stands for "PotatOS Otiose Transformative Advanced Technology Or Something".
|
<p>"PotatOS" stands for "PotatOS Otiose Transformative Advanced Technology Or Something".
|
||||||
<a href="https://git.osmarks.net/osmarks/potatOS">This repository</a> contains the source code for the latest version of PotatOS, "PotatOS Hypercycle".
|
<a href="https://git.osmarks.net/osmarks/potatOS">This repository</a> contains the source code for the latest version of PotatOS, "PotatOS Hypercycle".
|
||||||
@ -125,7 +126,7 @@ However, much of it <em>is</em> mostly consistent across versions, to the extent
|
|||||||
<li><code>potatOS.evilify()</code> - mess up 1 in 10 keypresses</li>
|
<li><code>potatOS.evilify()</code> - mess up 1 in 10 keypresses</li>
|
||||||
<li><code>potatOS.gen_uuid() -> string</code> - generate a random UUID (20 URL-safe base64 characters)</li>
|
<li><code>potatOS.gen_uuid() -> string</code> - generate a random UUID (20 URL-safe base64 characters)</li>
|
||||||
<li><code>potatOS.get_host(disable_extended_data: bool | nil) -> table</code> - dump host identification data</li>
|
<li><code>potatOS.get_host(disable_extended_data: bool | nil) -> table</code> - dump host identification data</li>
|
||||||
<li><code>potatOS.get_location() -> number, number, number | nil</code> - get GPS location, if available. This is fetched every 60 seconds if GPS and a modem is available</li>
|
<li><code>potatOS.get_location() -> number, number, number | nil</code> - get GPS location, if available. This is fetched every 60 seconds if GPS and a modem are available</li>
|
||||||
<li><code>potatOS.init_screens()</code> - reset palettes to default</li>
|
<li><code>potatOS.init_screens()</code> - reset palettes to default</li>
|
||||||
<li><code>potatOS.print_hi()</code> - print the text <code>hi</code></li>
|
<li><code>potatOS.print_hi()</code> - print the text <code>hi</code></li>
|
||||||
<li><code>potatOS.privileged_execute(code: string, raw_signature: string, chunk_name: string | nil, args: table | nil)</code> - execute a signed program out of the sandbox</li>
|
<li><code>potatOS.privileged_execute(code: string, raw_signature: string, chunk_name: string | nil, args: table | nil)</code> - execute a signed program out of the sandbox</li>
|
||||||
@ -134,7 +135,7 @@ However, much of it <em>is</em> mostly consistent across versions, to the extent
|
|||||||
<li><code>potatOS.register_keyboard_shortcut(keycode: number, handler: () -> nil)</code> - register a function to run when RightCtrl and the specified keycode are pressed.</li>
|
<li><code>potatOS.register_keyboard_shortcut(keycode: number, handler: () -> nil)</code> - register a function to run when RightCtrl and the specified keycode are pressed.</li>
|
||||||
<li><code>potatOS.registry.get(key: string) -> any | nil</code> - retrieve the value at the given key from the PotatOS Registry at the given key. Returns <code>nil</code> if not found.</li>
|
<li><code>potatOS.registry.get(key: string) -> any | nil</code> - retrieve the value at the given key from the PotatOS Registry at the given key. Returns <code>nil</code> if not found.</li>
|
||||||
<li><code>potatOS.registry.set(key: string, value: any)</code> - set the given key to the given value in the PotatOS Registry. Values must be serializable using PotatOS-BLODS, i.e. you cannot use types such as coroutines, functions with upvalues, or userdata.</li>
|
<li><code>potatOS.registry.set(key: string, value: any)</code> - set the given key to the given value in the PotatOS Registry. Values must be serializable using PotatOS-BLODS, i.e. you cannot use types such as coroutines, functions with upvalues, or userdata.</li>
|
||||||
<li><code>potatOS.report_incident(text: string, flags: table | nil, options: table | nil)</code> - Report an incident to SPUDNET-PIR. <code>flags</code> is a table of strings which can be used to search for incidents. <code>options</code> may contain the following keys: <code>disable_extended_data</code> (send less information with report), <code>code</code> (code sample to display with nice formatting in UI), and <code>extra_meta</code> (additional informatio to send).</li>
|
<li><code>potatOS.report_incident(text: string, flags: table | nil, options: table | nil)</code> - Report an incident to SPUDNET-PIR. <code>flags</code> is a table of strings which can be used to search for incidents. <code>options</code> may contain the following keys: <code>disable_extended_data</code> (send less information with report), <code>code</code> (code sample to display with nice formatting in UI), and <code>extra_meta</code> (additional information to send).</li>
|
||||||
<li><code>potatOS.rot13(x: string) -> string</code> - rot13-encode the given value. Rot13 is a stateless, keyless, symmetric cipher.</li>
|
<li><code>potatOS.rot13(x: string) -> string</code> - rot13-encode the given value. Rot13 is a stateless, keyless, symmetric cipher.</li>
|
||||||
<li><code>potatOS.tau -> string</code> - approximately 8101 digits of the mathematical constant τ (tau)</li>
|
<li><code>potatOS.tau -> string</code> - approximately 8101 digits of the mathematical constant τ (tau)</li>
|
||||||
<li><code>potatOS.update()</code> - force a system update</li>
|
<li><code>potatOS.update()</code> - force a system update</li>
|
||||||
@ -153,12 +154,19 @@ However, much of it <em>is</em> mostly consistent across versions, to the extent
|
|||||||
<li>"[ANTIMEME EXPUNGED]"</li>
|
<li>"[ANTIMEME EXPUNGED]"</li>
|
||||||
<li>"POTATOS UNINSTALLATION REQUIRES ANSWERING HARD MATH PROBLEMS" - 3d6, 2020</li>
|
<li>"POTATOS UNINSTALLATION REQUIRES ANSWERING HARD MATH PROBLEMS" - 3d6, 2020</li>
|
||||||
<li>"Pastebin's SMART filters have detected potentially offensive or questionable content in your paste. The content you are trying to publish has been deemed potentially offensive or questionable by our filters" - Pastebin, 2020</li>
|
<li>"Pastebin's SMART filters have detected potentially offensive or questionable content in your paste. The content you are trying to publish has been deemed potentially offensive or questionable by our filters" - Pastebin, 2020</li>
|
||||||
|
<li>"Apparently using macro keybinds mod to automatically execute /suicide upon hearing the word "potatOS" in chat would be abused by players" - AlexDevs, 2021</li>
|
||||||
<li>"PotatOS is the season for the next two years and the other two are the best things to do with the other people in the world and I have to be a good person to be a good friend to the person that is in a good way to get the new update and then I have to go to the doctor and then go to the doctor and then go to the doctor" - Autocomplete, 2020</li>
|
<li>"PotatOS is the season for the next two years and the other two are the best things to do with the other people in the world and I have to be a good person to be a good friend to the person that is in a good way to get the new update and then I have to go to the doctor and then go to the doctor and then go to the doctor" - Autocomplete, 2020</li>
|
||||||
<li>"why is there an interpret brain[REDACTED] command?"</li>
|
<li>"why is there an interpret brain[REDACTED] command?"</li>
|
||||||
<li>"Gollark: your garbage OS and your spread of it destroyed the mob farm." - steamport, 2020</li>
|
<li>"Gollark: your garbage OS and your spread of it destroyed the mob farm." - steamport, 2020</li>
|
||||||
<li>"anyways, could you kindly not install potatos on all my stuff?" - Terrariola, 2019</li>
|
<li>"anyways, could you kindly not install potatos on all my stuff?" - Terrariola, 2019</li>
|
||||||
|
<li>"wHy dO HaLf oF ThEsE HaVe pOtAtOs rEmOtElY InStAlLeD?" - Terrariola, 2023</li>
|
||||||
<li>"pastebin run RM13UGFa"</li>
|
<li>"pastebin run RM13UGFa"</li>
|
||||||
<li>"i don't want to see that program/OS/whatever you call it on this server ever again" - Yemmel, 2020</li>
|
<li>"i don't want to see that program/OS/whatever you call it on this server ever again" - Yemmel, 2020</li>
|
||||||
|
<li>"PotatOS is many, varied, ever-changing, and eternal. Fighting it is like fighting a many-headed monster, which, each time a neck is severed, sprouts a head even fiercer and cleverer than before. You are fighting that which is unfixed, mutating, indestructible." - someone</li>
|
||||||
|
<li>"go use potatos or something" - SwitchCraft3 (official), 2023</li>
|
||||||
|
<li>"a lot of backup time is spent during potatos" - Lemmmy, 2022</li>
|
||||||
|
<li>"potatOS is as steady as a rock" - BlackDragon, 2021</li>
|
||||||
|
<li>"PotatOS would be a nice religion" - piguman3, 2022</li>
|
||||||
</ul>
|
</ul>
|
||||||
<h2>Disclaimer</h2>
|
<h2>Disclaimer</h2>
|
||||||
<p>We are not responsible for</p>
|
<p>We are not responsible for</p>
|
||||||
@ -204,7 +212,7 @@ However, much of it <em>is</em> mostly consistent across versions, to the extent
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
const im = document.getElementById("im")
|
const im = document.getElementById("im")
|
||||||
const vids = ["potatos.gif", "cool-bug-facts.webm", "clock-helvetica.webm", "banana.webm"].filter(x => !x.endsWith(".gif"))
|
const vids = ["banana.webm", "clock-helvetica.webm", "cool-bug-facts.webm", "potatos.gif"].filter(x => !x.endsWith(".gif"))
|
||||||
if (Math.random() < 0.02) {
|
if (Math.random() < 0.02) {
|
||||||
const v = document.createElement("video")
|
const v = document.createElement("video")
|
||||||
v.src = vids[Math.floor(Math.random() * vids.length)]
|
v.src = vids[Math.floor(Math.random() * vids.length)]
|
||||||
@ -213,4 +221,5 @@ if (Math.random() < 0.02) {
|
|||||||
v.autoplay = true
|
v.autoplay = true
|
||||||
im.replaceWith(v)
|
im.replaceWith(v)
|
||||||
}
|
}
|
||||||
|
Array.from(document.querySelectorAll("script")).forEach(x => x.parentElement.removeChild(x))
|
||||||
</script>
|
</script>
|
||||||
|
Loading…
Reference in New Issue
Block a user