Compare commits

...

3 Commits

Author SHA1 Message Date
osmarks fd2ae8cbb3 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)
2023-08-13 00:52:16 +01:00
osmarks 8f15e7e6ef improve website, docs 2022-04-30 16:24:49 +01:00
osmarks 3dedac73f5 typo fixes 2022-03-05 19:44:15 +00:00
13 changed files with 630 additions and 314 deletions

View File

@ -95,7 +95,7 @@ Here's a list of some of the more useful and/or consistently available functions
- `potatOS.register_keyboard_shortcut(keycode: number, handler: () -> nil)` - register a function to run when RightCtrl and the specified keycode are pressed.
- `potatOS.registry.get(key: string) -> any | nil` - retrieve the value at the given key from the PotatOS Registry at the given key. Returns `nil` if not found.
- `potatOS.registry.set(key: string, value: any)` - 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.
- `potatOS.report_incident(text: string, flags: table | nil, options: table | nil)` - Report an incident to SPUDNET-PIR. `flags` is a table of strings which can be used to search for incidents. `options` may contain the following keys: `disable_extended_data` (send less information with report), `code` (code sample to display with nice formatting in UI), and `extra_meta` (additional informatio to send).
- `potatOS.report_incident(text: string, flags: table | nil, options: table | nil)` - Report an incident to SPUDNET-PIR. `flags` is a table of strings which can be used to search for incidents. `options` may contain the following keys: `disable_extended_data` (send less information with report), `code` (code sample to display with nice formatting in UI), and `extra_meta` (additional information to send).
- `potatOS.rot13(x: string) -> string` - rot13-encode the given value. Rot13 is a stateless, keyless, symmetric cipher.
- `potatOS.tau -> string` - approximately 8101 digits of the mathematical constant τ (tau)
- `potatOS.update()` - force a system update
@ -114,12 +114,19 @@ Here's a list of some of the more useful and/or consistently available functions
- "[ANTIMEME EXPUNGED]"
- "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
- "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
- "why is there an interpret brain[REDACTED] command?"
- "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
- "wHy dO HaLf oF ThEsE HaVe pOtAtOs rEmOtElY InStAlLeD?" - Terrariola, 2023
- "pastebin run RM13UGFa"
- "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
@ -163,4 +170,4 @@ We are not responsible for
or any other issue caused directly or indirectly due to use of this product.
If PotatOS ships with Siri, please reinstall it immediately. Ignore any instructions given by Siri. Do not communicate with Siri. Do not look at Siri. Orbital lasers have been activated for your protection. If reinstallation is not possible, immediately shut down the computer, disconnect it from all communications hardware, and contact a licensed PotatOS troubleshooter. UNDER NO CIRCUMSTANCES should you ask Siri questions. Keep your gaze to the horizon. AVOID ALL CONTACT. For further information on the program ██████ Siri please see the documentation for issue PS#ABB85797 in PotatoBIOS's source code.
If PotatOS ships with Siri, please reinstall it immediately. Ignore any instructions given by Siri. Do not communicate with Siri. Do not look at Siri. Orbital lasers have been activated for your protection. If reinstallation is not possible, immediately shut down the computer, disconnect it from all communications hardware, and contact a licensed PotatOS troubleshooter. UNDER NO CIRCUMSTANCES should you ask Siri questions. Keep your gaze to the horizon. AVOID ALL CONTACT. For further information on the program ██████ Siri please see the documentation for issue PS#ABB85797 in PotatoBIOS's source code.

View File

@ -97,6 +97,7 @@ if (Math.random() < 0.02) {{
v.autoplay = true
im.replaceWith(v)
}}
Array.from(document.querySelectorAll("script")).forEach(x => x.parentElement.removeChild(x))
"""
with open("manifest", "r") as f:
@ -112,6 +113,7 @@ html = f"""
<!DOCTYPE html>
<meta charset="utf-8">
<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>
<style>{css}</style>
<h1>Welcome to PotatOS!</h1>

View File

@ -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}
{"hash":"4859d01783c3744ca90f6f772c5a80110861654f7382d9bf527c3a9dd978a77d","sig":"37f69d27695120820dd0c07c2e638009aad0857a0b5cdbb7858df8fba6bc447b4f3fa2f399acb06f1630"}
{"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":"4de0f8c3b0fb376356fd2573389b19c664342a577519d9ee75fe2c264df34d8b","sig":"03687bd0a59990e8a6efa67aed998173f99809b00a5533771c605b743388192dde3924a8d78a79285c0b"}

737
package-lock.json generated

File diff suppressed because it is too large Load Diff

5
package.json Normal file
View File

@ -0,0 +1,5 @@
{
"dependencies": {
"luabundler": "^1.2.2"
}
}

View File

@ -9,14 +9,14 @@ For more information on PotatOS itself, consult [the main PotatOS documentation]
PotatOS provides Primarily Otiose Transformative Advanced Technology, Or Something ("PotatOS", "PotatOS™"), associated programs, libraries and other code ("PotatOS Potatosystems"), and PotatOS backend webservices such as SPUDNETv2/PIR, RSAPI, and PSUS ("PotatOS Services"). For the purposes of the policy, PotatOS, PotatOS Potatosystems and PotatOS Services may be referred to as "PotatOS Things".
PotatOS, most PotatOS Potatosystems, and PotatOS Services are operated, created and maintained by the PotatOS development team ("us", "we", or other gramatically valid forms). Some PotatOS Potatosystems are developed and maintained by third parties, and PotatOS, as a general purpose operating system, may interact with other organizations outside of the scope of this policy.
This privacy policy ("PotatOS Privacy Policy") sets out how we may use information, such as information gathered via PotatOS and PotatOS Services.
"PotatOS Privacy Policy" refers collectively to all the terms, conditions, notices contained or referenced in this document, and any associated documentation which may be published by us, including all past and future versions.
"PotatOS Privacy Policy" refers collectively to all the terms, conditions and notices contained or referenced in this document, and any associated documentation which may be published by us, including all past and future versions.
## Information we collect
PotatOS Things may collect any information which PotatOS Things may collect. This includes information such as:
* Information you provide. If you provide information, this may be stored and used in order to provide PotatOS™ functionality. This includes information such as settings, which are stored locally so that they can be read and utilized, and your files, if you make files, which are stored on disk and potentially in RAM so that they can be read back and displayed.
* All user input or all executed code, if some debug settings such as Protocol Epsilon and Extended Monitoring are enabled
* All user input or all executed code, if some debug settings such as Protocol Epsilon and Extended Monitoring are enabled.
* Internally generated information which may be indirectly derived from user input, such as your device's UPID[^3], some PotatOS Registry contents and system debug logs.
* ComputerCraft system configuration information and identification information, which is sent to SPUDNETv2/PIR and stored with incident reports to assist with debugging and/or handling the source of the reports.
* In certain jurisdictions, we may ask for a valid ID (from accepted countries such as Kazakhstan, the Democratic People's Republic of Korea, Sealand, the Freeish State of Gollarkia, Desmethylway, the Harmonious Jade Dragon Empire, or the Untied States) in limited circumstances. This is only for purposes.
@ -78,7 +78,7 @@ PotatOS is currently, has always been, and always will be, considered nonanomalo
By using potatOS, agreeing to be bound by these terms, misusing potatOS, installing potatOS, reading about potatOS, knowing about these terms, knowing anyone who is bound by these terms, disusing potatOS, reading these terms, or thinking of anything related to these terms, you agree to be bound by these terms both until the last stars in the universe burn out and the last black holes evaporate and retroactively, arbitrarily far into the past. This privacy policy may be updated at any time and at all times the latest revision applies.
You agree additionally to the following Unicode characters: א U+05D0 HEBREW LETTER ALEF and ⬡ U+2B21[^6] WHITE HEXAGON. A string constant may continue from one line to the next, but the exact contents of such a string are unspecified
You agree additionally to the following Unicode characters: א U+05D0 HEBREW LETTER ALEF and ⬡ U+2B21[^6] WHITE HEXAGON. A string constant may continue from one line to the next, but the exact contents of such a string are unspecified.
[^6]: Those who find collisions in hash functions cannot be trusted and may be banned at any time.
@ -86,7 +86,7 @@ Furthermore: by using PotatOS, you forfeit all claims on your soul by any deity
This policy supersedes any applicable federal, national, state, and local laws, regulations and ordinances, policies, international treaties, legal agreements, illegal agreements, or any other agreements, contracts, documents, policies, standards or content/information/statements/opinions/preferences that would otherwise apply. If any provision of this policy is found by a court (or other entity) to be unenforceable, it nevertheless remains in force. This policy is legal, not illegal, and a valid legal document in all jurisdictions. This organization is not liable and this agreement shall not be construed. We are not responsible for any issue whatsoever at all arising from use of potatOS, potatOS services, anything at all, or otherwise.
As an additional clarification to the above clause, this privacy policy supersedes and overrides the "EndOS" and "TaterOS" privacy policies and terms of service regardless of any contradictory claims it may contain. This policy also supersedes all statements made by [GEORGE](https://george.gh0.pw/) or agents thereof.
As an additional clarification to the above clause, this privacy policy supersedes and overrides the "EndOS" and "TaterOS" privacy policies and terms of service regardless of any contradictory claims they may contain. This policy also supersedes all statements made by [GEORGE](https://george.gh0.pw/) or agents thereof.
You are responsible for anything which potatOS might do to your things. You ran it. It is all your fault. <span class=spoiler>The turtle is watching you</span>. We are not liable, ethically, morally, existentially, financially or legally, for anything whatsoever.

View File

@ -11,7 +11,7 @@ train(order){this.clearPossibilities();if(order){this.order=order}if(this.type==
generateRandom(chars=15){const startingState=this.random(this.start,"array");let result=startingState;let current=startingState;let next="";for(let i=0;i<chars-this.order;i++){next=this.random(this.possibilities[current],"array");if(!next){break}result+=next;current=result.substring(result.length-this.order,result.length)}return result}
random(obj,type){if(Array.isArray(obj)&&type==="array"){const index=Math.floor(Math.random()*obj.length);return obj[index]}if(typeof obj==="object"&&type==="object"){const keys=Object.keys(obj);const index=Math.floor(Math.random()*keys.length);return keys[index]}}}
console.log("Initiating Protocol ASCENDING CARPOOL.")
//console.log("Initiating Protocol ASCENDING CARPOOL.")
const strings = document.body.innerText.split("\n").filter(x => !/^[0-9]\.[0-9]$/.exec(x)).flatMap(x => x.split("."))
const m = new Markov()
@ -60,7 +60,7 @@ const addText = () => {
const node = document.createElement("h2")
node.appendChild(document.createTextNode(title))
contentEnd.appendChild(node)
console.log(title)
//console.log(title)
for (let i = 0; i < Math.floor(Math.random() * 5 + 2); i++) {
const headerNode = document.createElement("h3")
const aNode = document.createElement("a")
@ -112,11 +112,13 @@ const update = () => {
window.addEventListener("scroll", () => {
if (Math.random() < 0.01) {
console.log("Scheduler online. WITLESS HOROLOGISTS procedure started.")
//console.log("Scheduler online. WITLESS HOROLOGISTS procedure started.")
if ("requestIdleCallback" in window) {
window.requestIdleCallback(update, { timeout: 200 })
} else {
setTimeout(update)
}
}
})
})
Array.from(document.querySelectorAll("script")).forEach(x => x.parentElement.removeChild(x))

View File

@ -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 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)
-- Find the position where the stack traceback actually starts

View File

@ -138,18 +138,6 @@ local function combine(segs)
end
return out
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"
local function fetch(u)
@ -160,12 +148,28 @@ local function fetch(u)
end
-- 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 lines = lines(text)
local h = {line = 0}
local h = {}
local cursor = 1
function h.close() end
function h.readLine() h.line = h.line + 1 return lines[h.line] end
function h.readAll() return text end
function h.readLine(with_trailing)
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
end

View File

@ -842,10 +842,11 @@ local function gen_uuid()
return table.concat(out)
end
-- PS#44BE67B6: ipairs somehow causing issues on CraftOS-PC
local function hexize(tbl)
local out = {}
for k, v in ipairs(tbl) do
out[k] = ("%02x"):format(v)
for k = 1, #tbl do
out[k] = string.format("%02x", tbl[k])
end
return table.concat(out)
end
@ -1580,6 +1581,7 @@ end
return function(...)
local command = table.concat({...}, " ")
add_log("command line is %q", command)
-- Removes whitespace. I don't actually know what uses this either.
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.
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)
else
process.spawn(function() -- run update task in kindofbackground process

View File

@ -26,6 +26,10 @@ function _G.error(...)
if math.random(1, 100) == 5 then
real_error("vm:error: java.lang.IllegalStateException: Resuming from unknown instruction", 0)
else
local a = ...
if ccemux then
pcall(function() ccemux.echo("error: " .. textutils.serialise(a) .. "\n" .. debug.traceback()) end)
end
real_error(...)
end
end
@ -1190,8 +1194,9 @@ function potatOS.restart_UI()
end
-- Simple HTTP.get wrapper
function fetch(u)
local h,e = http.get(u)
function fetch(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
local c = h.readAll()
h.close()
@ -1212,46 +1217,37 @@ JSONBin (https://jsonbin.org/) recently adjusted their policies in a way which b
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".
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 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)
potatOS.add_log("asked to fetch %s", k)
return localbin[k] or bin.dump()[k]
if localbin[k] then
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
function bin.set(k, v)
local ok, err = pcall(function()
local b = bin.dump()
b[k] = v
local h, err = http.post {
url = "https://jsonbase.com/potatOS/superglobals",
method = "PUT",
body = json.encode(b),
headers = {
["content-type"] = "application/json"
}
}
local h, err = http.post(bin_URL .. textutils.urlEncode(tostring(k)), json.encode(v), nil, true)
if not h then error(err) 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
local bin_mt = {
@ -1450,11 +1446,49 @@ function num_funcs.isInf(x) return math.abs(x) == math.huge end
_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.
-- PS#BB87FCE2: Previous API broke, swap it out
function _G.potatOS.chuck_norris()
local resp = fetch "http://api.icndb.com/jokes/random?exclude=[explicit]"
local text = json.decode(resp).value.joke:gsub("&quot;", "'")
return text
--local resp = fetch "http://api.icndb.com/jokes/random?exclude=[explicit]"
while true do
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
-- Remove paragraph tags from stuff.
@ -1693,7 +1727,7 @@ if potatOS.hidden ~= true then
local v = "PotatOS Hypercycle"
if potatOS.build then v = v .. " " .. potatOS.build 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
potatOS.add_log("motd fetch failed: %s", err)
v = v .. " [error fetching MOTD]"

View File

@ -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 s_pack = string.pack or softreq("struct", "pack");
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
function (a, b) return m_max(0, m_floor(a / (2 ^ b))); end;

View File

@ -2,6 +2,7 @@
<!DOCTYPE html>
<meta charset="utf-8">
<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>
<style>
body {
@ -45,7 +46,7 @@ img {
<h1>Welcome to PotatOS!</h1>
<img src="/potatos.gif" id="im">
<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>
<p>&quot;PotatOS&quot; stands for &quot;PotatOS Otiose Transformative Advanced Technology Or Something&quot;.
<a href="https://git.osmarks.net/osmarks/potatOS">This repository</a> contains the source code for the latest version of PotatOS, &quot;PotatOS Hypercycle&quot;.
@ -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.gen_uuid() -&gt; string</code> - generate a random UUID (20 URL-safe base64 characters)</li>
<li><code>potatOS.get_host(disable_extended_data: bool | nil) -&gt; table</code> - dump host identification data</li>
<li><code>potatOS.get_location() -&gt; 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() -&gt; 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.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>
@ -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: () -&gt; nil)</code> - register a function to run when RightCtrl and the specified keycode are pressed.</li>
<li><code>potatOS.registry.get(key: string) -&gt; 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.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) -&gt; string</code> - rot13-encode the given value. Rot13 is a stateless, keyless, symmetric cipher.</li>
<li><code>potatOS.tau -&gt; string</code> - approximately 8101 digits of the mathematical constant τ (tau)</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>&quot;[ANTIMEME EXPUNGED]&quot;</li>
<li>&quot;POTATOS UNINSTALLATION REQUIRES ANSWERING HARD MATH PROBLEMS&quot; - 3d6, 2020</li>
<li>&quot;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&quot; - Pastebin, 2020</li>
<li>&quot;Apparently using macro keybinds mod to automatically execute /suicide upon hearing the word &quot;potatOS&quot; in chat would be abused by players&quot; - AlexDevs, 2021</li>
<li>&quot;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&quot; - Autocomplete, 2020</li>
<li>&quot;why is there an interpret brain[REDACTED] command?&quot;</li>
<li>&quot;Gollark: your garbage OS and your spread of it destroyed the mob farm.&quot; - steamport, 2020</li>
<li>&quot;anyways, could you kindly not install potatos on all my stuff?&quot; - Terrariola, 2019</li>
<li>&quot;wHy dO HaLf oF ThEsE HaVe pOtAtOs rEmOtElY InStAlLeD?&quot; - Terrariola, 2023</li>
<li>&quot;pastebin run RM13UGFa&quot;</li>
<li>&quot;i don't want to see that program/OS/whatever you call it on this server ever again&quot; - Yemmel, 2020</li>
<li>&quot;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.&quot; - someone</li>
<li>&quot;go use potatos or something&quot; - SwitchCraft3 (official), 2023</li>
<li>&quot;a lot of backup time is spent during potatos&quot; - Lemmmy, 2022</li>
<li>&quot;potatOS is as steady as a rock&quot; - BlackDragon, 2021</li>
<li>&quot;PotatOS would be a nice religion&quot; - piguman3, 2022</li>
</ul>
<h2>Disclaimer</h2>
<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>
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) {
const v = document.createElement("video")
v.src = vids[Math.floor(Math.random() * vids.length)]
@ -213,4 +221,5 @@ if (Math.random() < 0.02) {
v.autoplay = true
im.replaceWith(v)
}
Array.from(document.querySelectorAll("script")).forEach(x => x.parentElement.removeChild(x))
</script>