mirror of
https://github.com/HeyPuter/puter.git
synced 2025-02-02 23:28:39 +08:00
dev: prep for network build
This commit is contained in:
parent
191977f9e3
commit
86f2dc485f
@ -110,6 +110,23 @@ puter.ui.on('connection', event => {
|
||||
|
||||
window.onload = async function()
|
||||
{
|
||||
let emu_config; try {
|
||||
emu_config = await puter.fs.read('config.json');
|
||||
} catch (e) {}
|
||||
|
||||
if ( ! emu_config ) {
|
||||
await puter.fs.write('config.json', JSON.stringify({}));
|
||||
emu_config = {};
|
||||
}
|
||||
|
||||
if ( emu_config instanceof Blob ) {
|
||||
emu_config = await emu_config.text();
|
||||
}
|
||||
|
||||
if ( typeof emu_config === 'string' ) {
|
||||
emu_config = JSON.parse(emu_config);
|
||||
}
|
||||
|
||||
const resp = await fetch(
|
||||
'./image/build/rootfs.bin'
|
||||
);
|
||||
@ -152,10 +169,14 @@ window.onload = async function()
|
||||
// bzimage_initrd_from_filesystem: true,
|
||||
autostart: true,
|
||||
|
||||
network_relay_url: "wisp://127.0.0.1:3000",
|
||||
network_relay_url: emu_config.network_relay ?? "wisp://127.0.0.1:3000",
|
||||
virtio_console: true,
|
||||
});
|
||||
|
||||
emulator.add_listener('download-error', function(e) {
|
||||
status.missing_files || (status.missing_files = []);
|
||||
status.missing_files.push(e.file_name);
|
||||
});
|
||||
|
||||
const decoder = new TextDecoder();
|
||||
const byteStream = NewCallbackByteStream();
|
||||
|
@ -36,6 +36,19 @@ export class EmuCommandProvider {
|
||||
if ( conn.response.status.ready ) {
|
||||
p_ready.resolve();
|
||||
}
|
||||
console.log('status from emu', conn.response);
|
||||
if ( conn.response.status.missing_files ) {
|
||||
const pfx = '\x1B[31;1m┃\x1B[0m ';
|
||||
ctx.externs.out.write('\n');
|
||||
ctx.externs.out.write('\x1B[31;1m┃ Emulator is missing files:\x1B[0m\n');
|
||||
for (const file of conn.response.status.missing_files) {
|
||||
ctx.externs.out.write(pfx+`- ${file}\n`);
|
||||
}
|
||||
ctx.externs.out.write(pfx+'\n');
|
||||
ctx.externs.out.write(pfx+'\x1B[33;1mDid you run `./tools/build_v86.sh`?\x1B[0m\n');
|
||||
ctx.externs.out.write('\n');
|
||||
return;
|
||||
}
|
||||
console.log('awaiting emulator ready');
|
||||
ctx.externs.out.write('Waiting for emulator...\n');
|
||||
await p_ready;
|
||||
|
Loading…
Reference in New Issue
Block a user