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
|
npx luabundler bundle src/main.lua -p "src/lib/?.lua" | perl -pe 'chomp if eof' > dist/autorun_full.lua
|
||||||
WORK=$(pwd)
|
WORK=$(pwd)
|
||||||
cd ./minify
|
cd ./minify
|
||||||
lua5.1 CommandLineMinify.lua "$WORK/dist/autorun_full.lua" "$WORK/dist/autorun.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"
|
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"
|
mv "$WORK/dist/pb_tmp.lua" "$WORK/dist/potatobios.lua"
|
||||||
cd "$WORK"
|
cd "$WORK"
|
||||||
rm dist/autorun_full.lua
|
rm dist/autorun_full.lua
|
||||||
|
@ -39,7 +39,7 @@ files = dict()
|
|||||||
sizes = dict()
|
sizes = dict()
|
||||||
code = Path("./dist/")
|
code = Path("./dist/")
|
||||||
for path in code.glob("**/*"):
|
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)
|
hexhash, count = hash_file(path)
|
||||||
mpath = "/".join(path.parts[1:])
|
mpath = "/".join(path.parts[1:])
|
||||||
files[mpath] = hexhash
|
files[mpath] = hexhash
|
||||||
@ -57,7 +57,7 @@ manifest_data = deterministic_json_serialize({
|
|||||||
})
|
})
|
||||||
|
|
||||||
manifest_meta = {
|
manifest_meta = {
|
||||||
"hash": hashlib.sha256(manifest_data.encode('utf-8')).hexdigest()
|
"hash": hashlib.sha256(manifest_data.encode("utf-8")).hexdigest()
|
||||||
}
|
}
|
||||||
|
|
||||||
if args.sign:
|
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}
|
{"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":"9a33a8b4a5557449e41520b9bc716ea4fff8ed713820aeb5041edf297b70a321","sig":"c6952057de361d534f8e0d96cc30fed7668c32a3313abf56261a3519f7d27bba70c69176887b988d1b32"}
|
{"hash":"9c81b427e0d79890c619fa7f23e4a47a19f552d2173e1cae9e61da5b03c2ecc0","sig":"7564e51cc76919532919c8f7ca099e35ec602823329fad62b3727c646996da52a15b1dd314f7944d6908"}
|
@ -62,7 +62,7 @@ if #arg == 1 then
|
|||||||
--
|
--
|
||||||
print("Minification complete")
|
print("Minification complete")
|
||||||
|
|
||||||
elseif #arg == 2 then
|
elseif #arg == 3 then
|
||||||
--keep the user from accidentally overwriting their non-minified file with
|
--keep the user from accidentally overwriting their non-minified file with
|
||||||
if arg[1]:find("_min") then
|
if arg[1]:find("_min") then
|
||||||
print("Did you mix up the argument order?\n"..
|
print("Did you mix up the argument order?\n"..
|
||||||
@ -112,9 +112,17 @@ elseif #arg == 2 then
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
--
|
--
|
||||||
outf:write(Format_Mini(ast))
|
local text, map = Format_Mini(ast)
|
||||||
|
outf:write(text)
|
||||||
outf:close()
|
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")
|
print("Minification complete")
|
||||||
|
|
||||||
else
|
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 Digits = lookupify{'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'}
|
||||||
local Symbols = lookupify{'+', '-', '*', '/', '^', '%', ',', '{', '}', '[', ']', '(', ')', ';', '#'}
|
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 function Format_Mini(ast)
|
||||||
local formatStatlist, formatExpr;
|
local formatStatlist, formatExpr;
|
||||||
local count = 0
|
local count = 0
|
||||||
@ -334,10 +342,6 @@ local function Format_Mini(ast)
|
|||||||
out = joinStatementsSafe(out, "do")
|
out = joinStatementsSafe(out, "do")
|
||||||
out = joinStatementsSafe(out, formatStatlist(statement.Body))
|
out = joinStatementsSafe(out, formatStatlist(statement.Body))
|
||||||
out = joinStatementsSafe(out, "end")
|
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
|
elseif statement.AstType == 'Comment' then
|
||||||
-- ignore
|
-- ignore
|
||||||
elseif statement.AstType == 'Eof' then
|
elseif statement.AstType == 'Eof' then
|
||||||
@ -349,9 +353,17 @@ local function Format_Mini(ast)
|
|||||||
return out
|
return out
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local map = {}
|
||||||
|
local function insert(t)
|
||||||
|
for k, v in pairs(t) do
|
||||||
|
map[k] = v
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
formatStatlist = function(statList)
|
formatStatlist = function(statList)
|
||||||
local out = ''
|
local out = ''
|
||||||
statList.Scope:ObfuscateVariables()
|
statList.Scope:ObfuscateVariables()
|
||||||
|
insert(statList.Scope.name_map or {})
|
||||||
for _, stat in pairs(statList.Body) do
|
for _, stat in pairs(statList.Body) do
|
||||||
out = joinStatementsSafe(out, formatStatement(stat), ';')
|
out = joinStatementsSafe(out, formatStatement(stat), ';')
|
||||||
end
|
end
|
||||||
@ -359,7 +371,8 @@ local function Format_Mini(ast)
|
|||||||
end
|
end
|
||||||
|
|
||||||
ast.Scope:ObfuscateVariables()
|
ast.Scope:ObfuscateVariables()
|
||||||
return formatStatlist(ast)
|
insert(ast.Scope.name_map)
|
||||||
|
return formatStatlist(ast), serialize_debug_symbols(map)
|
||||||
end
|
end
|
||||||
|
|
||||||
return Format_Mini
|
return Format_Mini
|
||||||
|
@ -86,6 +86,8 @@ local Scope = {
|
|||||||
|
|
||||||
RenameLocal = function(self, oldName, newName)
|
RenameLocal = function(self, oldName, newName)
|
||||||
oldName = type(oldName) == 'string' and oldName or oldName.Name
|
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 found = false
|
||||||
local var = self:GetLocal(oldName)
|
local var = self:GetLocal(oldName)
|
||||||
if var then
|
if var then
|
||||||
|
@ -178,7 +178,11 @@ local function random_char()
|
|||||||
end
|
end
|
||||||
|
|
||||||
local colors = {}
|
local colors = {}
|
||||||
for i = 0, 15 do table.insert(colors, ("%x"):format(i)) end
|
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)
|
local function random_pick(list)
|
||||||
return list[math.random(1, #list)]
|
return list[math.random(1, #list)]
|
||||||
|
@ -185,7 +185,7 @@ local function create_FS(root, overlay)
|
|||||||
children = {
|
children = {
|
||||||
["disk"] = { mount = "disk" },
|
["disk"] = { mount = "disk" },
|
||||||
["rom"] = { mount = "rom" },
|
["rom"] = { mount = "rom" },
|
||||||
["virtual_test"] = { virtual = "bees" }
|
--["virtual_test"] = { virtual = "bees" }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
12
src/main.lua
12
src/main.lua
@ -97,7 +97,7 @@ local function add_log(...)
|
|||||||
local ok, err = pcall(function()
|
local ok, err = pcall(function()
|
||||||
local text = string.format(unpack(args))
|
local text = string.format(unpack(args))
|
||||||
if ccemux and ccemux.echo then ccemux.echo(text) end
|
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.writeLine(line)
|
||||||
logfile.flush() -- this should probably be infrequent enough that the performance impact is not very bad
|
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
|
-- primitive log rotation - logs should only be ~64KiB in total, which seems reasonable
|
||||||
@ -109,7 +109,7 @@ local function add_log(...)
|
|||||||
if args[1] ~= "reopened log file" then add_log "reopened log file" end
|
if args[1] ~= "reopened log file" then add_log "reopened log file" end
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
if not ok then printError("Failed to write/format/something logs:" .. err) end
|
if not ok then printError("Failed to write/format/something logs: " .. err) end
|
||||||
end
|
end
|
||||||
add_log "started up"
|
add_log "started up"
|
||||||
_G.add_log = add_log
|
_G.add_log = add_log
|
||||||
@ -669,7 +669,7 @@ local function websocket_remote_debugging()
|
|||||||
if ws then ws.close() end
|
if ws then ws.close() end
|
||||||
ws, err = http.websocket "wss://spudnet.osmarks.net/v4?enc=json"
|
ws, err = http.websocket "wss://spudnet.osmarks.net/v4?enc=json"
|
||||||
if not ws then add_log("websocket failure %s", err) return false end
|
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 = "identify" }
|
||||||
send_packet { type = "set_channels", channels = { "client:potatOS" } }
|
send_packet { type = "set_channels", channels = { "client:potatOS" } }
|
||||||
@ -838,6 +838,10 @@ end
|
|||||||
|
|
||||||
local sha256 = require "sha256".digest
|
local sha256 = require "sha256".digest
|
||||||
local manifest = settings.get "potatOS.distribution_server" or "http://localhost:5433/manifest"
|
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 function download_files(manifest_data, needed_files)
|
||||||
local base_URL = manifest_data.base_URL or manifest_data.manifest_URL:gsub("/manifest$", "")
|
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)
|
potatOS.registry.set(path, setto)
|
||||||
print(("Value of registry entry %s set to:\n%s"):format(path, Safe_SerializeWithtextutilsDotserialize(setto)))
|
print(("Value of registry entry %s set to:\n%s"):format(path, Safe_SerializeWithtextutilsDotserialize(setto)))
|
||||||
else
|
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
|
end
|
||||||
]],
|
]],
|
||||||
-- Using cutting edge debug technology we can actually inspect the source code of the system function wotsits using hacky bad code.
|
-- 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