From 167dd257255c251398ab41f25c36364efc112573 Mon Sep 17 00:00:00 2001 From: osmarks Date: Tue, 25 Aug 2020 17:35:59 +0100 Subject: [PATCH] misc improvements - remove potato_tool (useless now) - switch back to lime - fix serialization issue --- manifest | 4 ++-- src/main.lua | 28 +++++++--------------------- 2 files changed, 9 insertions(+), 23 deletions(-) diff --git a/manifest b/manifest index 32abddc..bbdbf45 100644 --- a/manifest +++ b/manifest @@ -1,2 +1,2 @@ -{"build":157,"description":"improve log","files":{"LICENSES":"f3549d84d66eb53dd4a421a4341d77d3d217c1b117d67e3be8f5211adcda0952","autorun.lua":"7b335d3eccf65c337fcdf535a47e2710b3fe4ec6090e888bd2bc09c42eebd32d","bin/5rot26.lua":"91b66cd6d4b33081b25c456142dd7efcb894e819e842693c9e1e17ff48872ff5","bin/ccemux.lua":"239476f58835b86bbcac31ce8af3c3acd3d198a55ab9ada78c62fbf358625a98","bin/chronometer.lua":"db5363993a04382145aef7db2fbe262f0bf10697a589e1e2d2f9ce0f87430dd8","bin/kristminer.lua":"7e7f9fe2a6493d584ad6926cda915e02c1c3d800dc209680898ce930d0bb0e6f","bin/livegps.lua":"c3d17d495cda01aa1261e4c4fcd43439b29af422671972117ec34f68e32c5bba","bin/loading.lua":"c85f7aa1765170325155b921c1fceeb62643f552f12d41b529a22af3a67f5a97","bin/potatoflight.lua":"2fbb0b6f8d78728d8cb0ec64af1bc598bd00cb55f202378e7acdb86bba71efd1","bin/potatoplex.lua":"86c9e7597bbe23d7de7e7f1bfc976d0b94dcdf3af9e6c7c6c9b18b98596898c8","bin/relay.lua":"261ae6c220b83506e3326e8f2b091d246baae458ff0d2ee87512be2c4e35a75d","bin/tryhaskell.lua":"07810d85145da65a3e434154c79d5a9d72f2dcbe59c8d6829040fb925df878ec","potatobios.lua":"8821428eec9400a6e8155da0f5485163614f72a462212a8bbae0601d3812bfba","signing-key.tbl":"b32af5229c23af3bc03d538e42751b26044e404a7b1af064ed89894efe421607","startup":"f17bfb9b4322c4467dc9170d50827f2d75717e5c3125d734f21f3406657917bc","update-key.hex":"8d8afb7a45833bb7d68f929421ad60a211d4d73e0ee03b24dc0106ba1de2e1a0","xlib/00_cbor.lua":"464b075e4f094b8db42506bd4bdaad0db87699ea7fbf80e5b87739b4aa9279af","xlib/01_skynet.lua":"bde95ed86f3108ec56624367deea3e2694c8cfcd9eac220a21bad0b56c8a999b"},"timestamp":1598274890} -{"hash":"daa3b2f10031e3e7086cd51744d5cd0c1b47c339d80aa118308d223acf519355","sig":"39a4329954fe3df0faf27b3fea0b62f209149a8b08f22ad24b76e40386312c70b983dfb9be75022afb1a"} \ No newline at end of file +{"build":160,"description":"improve color, logging","files":{"LICENSES":"f3549d84d66eb53dd4a421a4341d77d3d217c1b117d67e3be8f5211adcda0952","autorun.lua":"21348989669bb1a754b42e42ca3e1eeb79938f03154c34a08a02c9d9508b3f50","bin/5rot26.lua":"91b66cd6d4b33081b25c456142dd7efcb894e819e842693c9e1e17ff48872ff5","bin/ccemux.lua":"239476f58835b86bbcac31ce8af3c3acd3d198a55ab9ada78c62fbf358625a98","bin/chronometer.lua":"db5363993a04382145aef7db2fbe262f0bf10697a589e1e2d2f9ce0f87430dd8","bin/kristminer.lua":"7e7f9fe2a6493d584ad6926cda915e02c1c3d800dc209680898ce930d0bb0e6f","bin/livegps.lua":"c3d17d495cda01aa1261e4c4fcd43439b29af422671972117ec34f68e32c5bba","bin/loading.lua":"c85f7aa1765170325155b921c1fceeb62643f552f12d41b529a22af3a67f5a97","bin/potatoflight.lua":"2fbb0b6f8d78728d8cb0ec64af1bc598bd00cb55f202378e7acdb86bba71efd1","bin/potatoplex.lua":"86c9e7597bbe23d7de7e7f1bfc976d0b94dcdf3af9e6c7c6c9b18b98596898c8","bin/relay.lua":"261ae6c220b83506e3326e8f2b091d246baae458ff0d2ee87512be2c4e35a75d","bin/tryhaskell.lua":"07810d85145da65a3e434154c79d5a9d72f2dcbe59c8d6829040fb925df878ec","potatobios.lua":"8821428eec9400a6e8155da0f5485163614f72a462212a8bbae0601d3812bfba","signing-key.tbl":"b32af5229c23af3bc03d538e42751b26044e404a7b1af064ed89894efe421607","startup":"f17bfb9b4322c4467dc9170d50827f2d75717e5c3125d734f21f3406657917bc","update-key.hex":"8d8afb7a45833bb7d68f929421ad60a211d4d73e0ee03b24dc0106ba1de2e1a0","xlib/00_cbor.lua":"464b075e4f094b8db42506bd4bdaad0db87699ea7fbf80e5b87739b4aa9279af","xlib/01_skynet.lua":"bde95ed86f3108ec56624367deea3e2694c8cfcd9eac220a21bad0b56c8a999b"},"timestamp":1598373235} +{"hash":"ec7b48c2022e763ce0f6248b892258451c84022dfb26c0f3c616fac7fcbee9e6","sig":"3a4d717cd5fc9300f51cda161e979149088ce259074dd8b902ac9d396c32bf76aa99a9ff3677606f633a"} \ No newline at end of file diff --git a/src/main.lua b/src/main.lua index c06add8..725a47d 100644 --- a/src/main.lua +++ b/src/main.lua @@ -17,7 +17,7 @@ This license also extends to other PotatOS components or bundled software owned term.clear() term.setCursorPos(1, 1) if term.isColor() then - term.setTextColor(colors.lightBlue) + term.setTextColor(colors.lime) else term.setTextColor(colors.white) end @@ -96,6 +96,7 @@ local function add_log(...) local args = {...} local ok, err = pcall(function() local text = string.format(unpack(args)) + if ccemux and ccemux.echo then ccemux.echo(text) end local line = ("[%s] <%s> %s"):format(os.date "!%X %d/%m/%Y", (process and (process.running.name or tostring(process.running.ID))) or "[n/a]", text) logfile.writeLine(line) logfile.flush() -- this should probably be infrequent enough that the performance impact is not very bad @@ -611,12 +612,14 @@ function safe_json_serialize(x, prev) elseif t == "table" then prev = prev or {} local as_array = true + local max = 0 for k in pairs(x) do if type(k) ~= "number" then as_array = false break end + if k > max then max = k end end if as_array then - for i = 1, #x do - if not x[i] then as_array = false break end + for i = 1, max do + if x[i] == nil then as_array = false break end end end if as_array then @@ -714,6 +717,7 @@ local function websocket_remote_debugging() if type(code) == "string" then _G.wsrecv = recv _G.wssend = send + _G.envrequire = require add_log("SPUDNET command - %s", code) local f, errr = load(code, "@", "t", _G) if f then -- run safely in background, send back response @@ -1285,24 +1289,6 @@ end ]], ["/rom/programs/upd.lua"] = 'potatOS.update()', ["/rom/programs/lyr.lua"] = 'print(string.format("Layers of virtualization >= %d", potatOS.layers()))', - ["/rom/programs/potato_tool.lua"] = [[ -local arg, param = ... -local function print_all_help() - for k, v in pairs(potatOS.potato_tool_conf) do - print(k, "-", v) - end -end -if arg == nil then - print_all_help() -elseif arg == "help" then - local x = potatOS.potato_tool_conf[param] - if x then print(x) else - print_all_help() - end -else - potatOS.potato_tool(arg) -end - ]], ["/rom/programs/uninstall.lua"] = [[ if potatOS.actually_really_uninstall then potatOS.actually_really_uninstall "76fde5717a89e332513d4f1e5b36f6cb" os.reboot() else