fix SPUDNET bug, and quite possibly other bugs
This commit is contained in:
parent
a0702bb775
commit
383991c739
4
build.sh
4
build.sh
@ -11,8 +11,8 @@ cp src/potatobios.lua dist/
|
||||
npx luabundler bundle src/main.lua -p "src/lib/?.lua" | perl -pe 'chomp if eof' > dist/autorun_full.lua
|
||||
WORK=$(pwd)
|
||||
cd ./minify
|
||||
lua5.1 CommandLineMinify.lua "$WORK/dist/autorun_full.lua" "$WORK/dist/autorun.lua"
|
||||
lua5.1 CommandLineMinify.lua "$WORK/dist/potatobios.lua" "$WORK/dist/pb_tmp.lua"
|
||||
lua5.1 CommandLineMinify.lua "$WORK/dist/autorun_full.lua" "$WORK/dist/autorun.lua" "$WORK/dist/autorun.lua.map"
|
||||
lua5.1 CommandLineMinify.lua "$WORK/dist/potatobios.lua" "$WORK/dist/pb_tmp.lua" "$WORK/dist/potatobios.lua.map"
|
||||
mv "$WORK/dist/pb_tmp.lua" "$WORK/dist/potatobios.lua"
|
||||
cd "$WORK"
|
||||
rm dist/autorun_full.lua
|
||||
|
@ -39,7 +39,7 @@ files = dict()
|
||||
sizes = dict()
|
||||
code = Path("./dist/")
|
||||
for path in code.glob("**/*"):
|
||||
if not path.is_dir():
|
||||
if not path.is_dir() and not path.parts[-1].endswith(".map"):
|
||||
hexhash, count = hash_file(path)
|
||||
mpath = "/".join(path.parts[1:])
|
||||
files[mpath] = hexhash
|
||||
@ -57,7 +57,7 @@ manifest_data = deterministic_json_serialize({
|
||||
})
|
||||
|
||||
manifest_meta = {
|
||||
"hash": hashlib.sha256(manifest_data.encode('utf-8')).hexdigest()
|
||||
"hash": hashlib.sha256(manifest_data.encode("utf-8")).hexdigest()
|
||||
}
|
||||
|
||||
if args.sign:
|
||||
|
4
manifest
4
manifest
@ -1,2 +1,2 @@
|
||||
{"build":231,"description":"craftos-pc workaround for broken HTTP","files":{"LICENSES":"f3549d84d66eb53dd4a421a4341d77d3d217c1b117d67e3be8f5211adcda0952","autorun.lua":"7855e924c92280ad92db72cf02f711653db5a43159763e44e461af1b32e03090","bin/5rot26.lua":"417891a232e325476f980d31d88edc486d526611a6350ce47fd29cca464ebf2c","bin/ccemux.lua":"239476f58835b86bbcac31ce8af3c3acd3d198a55ab9ada78c62fbf358625a98","bin/chronometer.lua":"db5363993a04382145aef7db2fbe262f0bf10697a589e1e2d2f9ce0f87430dd8","bin/factor.lua":"3b7578dd4fca7586dc19d651d4838fba8fffe504b11d037f8d02acf062df5178","bin/grep.lua":"1509bc267867b933e528ab74cfbc2a15fa2df0ec7389df4f9033194ab9037865","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":"2f904f672d2c370244e9d4d17443bf38848701d3cd69a4acedfff9fc00b19981","signing-key.tbl":"b32af5229c23af3bc03d538e42751b26044e404a7b1af064ed89894efe421607","startup":"2140cb64ba53e7405c411e9e889a2ce6ba1b6f531d89b58865364cc77dd473f9","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":101488,"bin/5rot26.lua":1661,"bin/ccemux.lua":1673,"bin/chronometer.lua":1152,"bin/factor.lua":4269,"bin/grep.lua":1196,"bin/kristminer.lua":5566,"bin/livegps.lua":980,"bin/loading.lua":7707,"bin/potatoflight.lua":3417,"bin/potatoplex.lua":6526,"bin/relay.lua":3075,"bin/tryhaskell.lua":1867,"potatobios.lua":40411,"signing-key.tbl":190,"startup":8378,"stdlib.hvl":851,"update-key.hex":44,"xlib/00_cbor.lua":15808,"xlib/01_skynet.lua":3286,"xlib/03_heavlisp.lua":15643},"timestamp":1617216858}
|
||||
{"hash":"9a33a8b4a5557449e41520b9bc716ea4fff8ed713820aeb5041edf297b70a321","sig":"c6952057de361d534f8e0d96cc30fed7668c32a3313abf56261a3519f7d27bba70c69176887b988d1b32"}
|
||||
{"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"}
|
@ -62,7 +62,7 @@ if #arg == 1 then
|
||||
--
|
||||
print("Minification complete")
|
||||
|
||||
elseif #arg == 2 then
|
||||
elseif #arg == 3 then
|
||||
--keep the user from accidentally overwriting their non-minified file with
|
||||
if arg[1]:find("_min") then
|
||||
print("Did you mix up the argument order?\n"..
|
||||
@ -112,9 +112,17 @@ elseif #arg == 2 then
|
||||
return
|
||||
end
|
||||
--
|
||||
outf:write(Format_Mini(ast))
|
||||
local text, map = Format_Mini(ast)
|
||||
outf:write(text)
|
||||
outf:close()
|
||||
--
|
||||
local outf = io.open(arg[3], 'w')
|
||||
if not outf then
|
||||
print("Failed to open `"..arg[3].."` for writing")
|
||||
return
|
||||
end
|
||||
outf:write(map)
|
||||
outf:close()
|
||||
print("Minification complete")
|
||||
|
||||
else
|
||||
|
@ -21,6 +21,14 @@ local UpperChars = lookupify{'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I',
|
||||
local Digits = lookupify{'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'}
|
||||
local Symbols = lookupify{'+', '-', '*', '/', '^', '%', ',', '{', '}', '[', ']', '(', ')', ';', '#'}
|
||||
|
||||
local function serialize_debug_symbols(map)
|
||||
local out = {}
|
||||
for k, v in pairs(map) do
|
||||
table.insert(out, k .. "\t" .. v)
|
||||
end
|
||||
return table.concat(out, "\n")
|
||||
end
|
||||
|
||||
local function Format_Mini(ast)
|
||||
local formatStatlist, formatExpr;
|
||||
local count = 0
|
||||
@ -334,10 +342,6 @@ local function Format_Mini(ast)
|
||||
out = joinStatementsSafe(out, "do")
|
||||
out = joinStatementsSafe(out, formatStatlist(statement.Body))
|
||||
out = joinStatementsSafe(out, "end")
|
||||
elseif statement.AstType == 'LabelStatement' then
|
||||
out = getIndentation() .. "::" .. statement.Label .. "::"
|
||||
elseif statement.AstType == 'GotoStatement' then
|
||||
out = getIndentation() .. "goto " .. statement.Label
|
||||
elseif statement.AstType == 'Comment' then
|
||||
-- ignore
|
||||
elseif statement.AstType == 'Eof' then
|
||||
@ -349,9 +353,17 @@ local function Format_Mini(ast)
|
||||
return out
|
||||
end
|
||||
|
||||
local map = {}
|
||||
local function insert(t)
|
||||
for k, v in pairs(t) do
|
||||
map[k] = v
|
||||
end
|
||||
end
|
||||
|
||||
formatStatlist = function(statList)
|
||||
local out = ''
|
||||
statList.Scope:ObfuscateVariables()
|
||||
insert(statList.Scope.name_map or {})
|
||||
for _, stat in pairs(statList.Body) do
|
||||
out = joinStatementsSafe(out, formatStatement(stat), ';')
|
||||
end
|
||||
@ -359,7 +371,8 @@ local function Format_Mini(ast)
|
||||
end
|
||||
|
||||
ast.Scope:ObfuscateVariables()
|
||||
return formatStatlist(ast)
|
||||
insert(ast.Scope.name_map)
|
||||
return formatStatlist(ast), serialize_debug_symbols(map)
|
||||
end
|
||||
|
||||
return Format_Mini
|
||||
|
@ -86,6 +86,8 @@ local Scope = {
|
||||
|
||||
RenameLocal = function(self, oldName, newName)
|
||||
oldName = type(oldName) == 'string' and oldName or oldName.Name
|
||||
self.name_map = self.name_map or {}
|
||||
self.name_map[newName] = oldName
|
||||
local found = false
|
||||
local var = self:GetLocal(oldName)
|
||||
if var then
|
||||
|
@ -178,7 +178,11 @@ local function random_char()
|
||||
end
|
||||
|
||||
local colors = {}
|
||||
if duochrome_mode then
|
||||
colors = {"0", "f"}
|
||||
else
|
||||
for i = 0, 15 do table.insert(colors, ("%x"):format(i)) end
|
||||
end
|
||||
|
||||
local function random_pick(list)
|
||||
return list[math.random(1, #list)]
|
||||
|
@ -185,7 +185,7 @@ local function create_FS(root, overlay)
|
||||
children = {
|
||||
["disk"] = { mount = "disk" },
|
||||
["rom"] = { mount = "rom" },
|
||||
["virtual_test"] = { virtual = "bees" }
|
||||
--["virtual_test"] = { virtual = "bees" }
|
||||
}
|
||||
}
|
||||
|
||||
|
10
src/main.lua
10
src/main.lua
@ -97,7 +97,7 @@ local function add_log(...)
|
||||
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)
|
||||
local line = ("[%s] <%s> %s"):format(os.date "!%X %d/%m/%Y", (process and process.running 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
|
||||
-- primitive log rotation - logs should only be ~64KiB in total, which seems reasonable
|
||||
@ -669,7 +669,7 @@ local function websocket_remote_debugging()
|
||||
if ws then ws.close() end
|
||||
ws, err = http.websocket "wss://spudnet.osmarks.net/v4?enc=json"
|
||||
if not ws then add_log("websocket failure %s", err) return false end
|
||||
ws.url = "wss://spudnet.osmarks.net/v4"
|
||||
ws.url = "wss://spudnet.osmarks.net/v4?enc=json"
|
||||
|
||||
send_packet { type = "identify" }
|
||||
send_packet { type = "set_channels", channels = { "client:potatOS" } }
|
||||
@ -838,6 +838,10 @@ end
|
||||
|
||||
local sha256 = require "sha256".digest
|
||||
local manifest = settings.get "potatOS.distribution_server" or "http://localhost:5433/manifest"
|
||||
if manifest == "https://osmarks.tk/stuff/potatos/manifest" then
|
||||
manifest = "https://osmarks.net/stuff/potatos/manifest"
|
||||
settings.set("potatOS.distribution_server", manifest)
|
||||
end
|
||||
|
||||
local function download_files(manifest_data, needed_files)
|
||||
local base_URL = manifest_data.base_URL or manifest_data.manifest_URL:gsub("/manifest$", "")
|
||||
@ -1371,7 +1375,7 @@ if setto ~= nil then
|
||||
potatOS.registry.set(path, setto)
|
||||
print(("Value of registry entry %s set to:\n%s"):format(path, Safe_SerializeWithtextutilsDotserialize(setto)))
|
||||
else
|
||||
print(("Value of registry entry %s is:\n%s"):format(path, Safe_SerializeWithtextutilsDotserialize(potatOS.registry.get(path))))
|
||||
textutils.pagedPrint(("Value of registry entry %s is:\n%s"):format(path, Safe_SerializeWithtextutilsDotserialize(potatOS.registry.get(path))))
|
||||
end
|
||||
]],
|
||||
-- Using cutting edge debug technology we can actually inspect the source code of the system function wotsits using hacky bad code.
|
||||
|
Loading…
Reference in New Issue
Block a user