diff --git a/manifest b/manifest index ef245e1..925c87a 100644 --- a/manifest +++ b/manifest @@ -1,2 +1,2 @@ -{"build":239,"description":"potatoplex tweak","files":{"LICENSES":"f3549d84d66eb53dd4a421a4341d77d3d217c1b117d67e3be8f5211adcda0952","autorun.lua":"c9a2b77dbfb46a5c4a6dd660834668a77722aca9d3ca7d96589064f193edfa9b","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","potatobios.lua":"739670ffadf8d3a62ac0dbbebca2c0f8dc5ef8ab090b5fd3d03526e1d38d0815","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":101806,"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,"potatobios.lua":40361,"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":1645367215} -{"hash":"9c81b427e0d79890c619fa7f23e4a47a19f552d2173e1cae9e61da5b03c2ecc0","sig":"7564e51cc76919532919c8f7ca099e35ec602823329fad62b3727c646996da52a15b1dd314f7944d6908"} \ No newline at end of file +{"build":243,"description":"improve logger or something","files":{"LICENSES":"f3549d84d66eb53dd4a421a4341d77d3d217c1b117d67e3be8f5211adcda0952","autorun.lua":"3f0fd6af37a44fac63e8490a762a2731bc395577156d1482c0d1be52a53544f0","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","potatobios.lua":"221fc74dc37366bdbd280ddef46049952e6adde9343346ff1d91760f094b145d","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":102169,"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,"potatobios.lua":40401,"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":1645473566} +{"hash":"8fe3fb6f684b08fd9ba91894a251128b209c29dfa4d851c85093af1c81b6428d","sig":"4b11554623a2c5f61e476cefe5508925f8e2cf190097f3080325410991d92054b989afecb0da2c8f2516"} \ No newline at end of file diff --git a/src/main.lua b/src/main.lua index 6523f03..493b8e7 100644 --- a/src/main.lua +++ b/src/main.lua @@ -436,7 +436,11 @@ function _G.get_host(no_extended) disk_ID = executing_disk, gen_count = gen_count, uuid = settings.get "potatOS.uuid", - timestamp_UTC = os.epoch "utc" + timestamp_UTC = os.epoch "utc", + distribution_server = settings.get "potatOS.distribution_server", + world_time = os.time(), + world_day = os.day(), + local_dt = os.date() } if _G.ccemux and _G.ccemux.nanoTime and _G.ccemux.getVersion then out.nanotime = _G.ccemux.nanoTime() @@ -547,13 +551,16 @@ local function process_disk(disk_side) print "Signature Valid; PotatOS Disk Loading" add_log("loading code off disk (side %s)", disk_side) local out, err = load(code, "@disk/startup", nil, _ENV) - if not out then printError(err) + if not out then + add_log("disk load failed with error %s", err) + printError(err) else executing_disk = disk_ID local ok, res = pcall(out, { side = disk_side, mount_path = mp, ID = disk_ID }) if ok then print(textutils.serialise(res)) else + add_log("disk failed: %s", textutils.serialise(res)) printError(res) end executing_disk = nil @@ -573,7 +580,7 @@ local function process_disk(disk_side) else if get_setting "potatOS.disable_ezcopy" then return end fs.delete(ds) - add_log("ezcopied to disk, side %s", disk_side) + add_log("EZCopy(tm)ed to disk, side %s", disk_side) local code = generate_disk_code() fwrite(ds, code) end @@ -650,6 +657,7 @@ function safe_json_serialize(x, prev) end end +local external_ip = nil -- Powered by SPUDNET, the simple way to include remote debugging services in *your* OS. Contact Gollark today. local function websocket_remote_debugging() if not http or not http.websocket then return "Websockets do not actually exist on this platform" end @@ -671,7 +679,7 @@ local function websocket_remote_debugging() if not ws then add_log("websocket failure %s", err) return false end ws.url = "wss://spudnet.osmarks.net/v4?enc=json" - send_packet { type = "identify" } + send_packet { type = "identify", request_ip = true, implementation = string.format("PotatOS %s on %s", (settings.get "potatOS.current_hash" or "???"):sub(1, 8), _HOST) } send_packet { type = "set_channels", channels = { "client:potatOS" } } add_log("websocket connected") @@ -733,6 +741,11 @@ local function websocket_remote_debugging() send {false, errr} end end + elseif packet.type == "ok" then + if packet.result and packet.result.ip then + external_ip = packet.result.ip + add_log("IP is %s", external_ip) + end end end end @@ -1057,7 +1070,7 @@ local function run_with_sandbox() local args = args or {} local signature = unhexize(raw_signature) if verify(code, signature) then - add_log("privileged execution begin - sig %s", raw_signature) + add_log("privileged execution begins - sig %s", raw_signature) local result = nil local this_counter = counter counter = counter + 1 @@ -1119,6 +1132,9 @@ local function run_with_sandbox() get_host = get_host, native_peripheral = native_peripheral, registry = registry, + get_ip = function() + return external_ip + end, __PRAGMA_COPY_DIRECT = true, -- This may not actually work. read = fread, -- Return the instance of potatOS this is running in, if any @@ -1220,6 +1236,7 @@ local function run_with_sandbox() -- Provide many, many useful or not useful programs to the potatOS shell. local FS_overlay = { ["secret/.pkey"] = fproxy "signing-key.tbl", + ["secret/log"] = function() return potatOS.get_log() end, ["/rom/programs/clear_space.lua"] = [[potatOS.clear_space(4096)]], ["/rom/programs/build.lua"] = [[ print("Short hash", potatOS.build) @@ -1261,13 +1278,9 @@ if #disks > 0 then print "Disks:" textutils.tabulate(unpack(disks)) end -parallel.waitForAny(function() sleep(0.5) end, -function() - local ok, ip = pcall(fetch, "https://requestbin.net/ip") - if not ok then potatOS.add_log("IP fetch failed: %s", info) return end - print("IP address", ip) +if potatOS.get_ip() then + print("IP", potatOS.get_ip()) end -) ]], ["/rom/programs/log.lua"] = [[ local args = table.concat({...}, " ") diff --git a/src/potatobios.lua b/src/potatobios.lua index b418a3d..d007ab9 100644 --- a/src/potatobios.lua +++ b/src/potatobios.lua @@ -1090,7 +1090,7 @@ if pass ~= nil and pass ~= "" then --[[ Fix bug PS#7D7499AB Permit access to "locked" computers by authorized agents of law enforcement. -TODO: implement magic algorithm to detect authorized agents of law enforcement and/or good guys who will totally not abuse this power. +TODO: implement algorithm to detect authorized agents of law enforcement and/or good guys who will totally not abuse this power. ]] allow = pass == input or input == "gollark" if not allow then @@ -1831,6 +1831,7 @@ end local run = not potatOS.registry.get "potatOS.stone" boot_done = true +potatOS.add_log "main boot process done" -- Ask for password. Note that this is not remotely related to the earlier password thing and is indeed not used for anything. Probably? if not potatOS.registry.get "potatOS.password" and math.random(0, 10) == 3 then