Skip to content

Commit

Permalink
moved fetch URL decoding from starter.js into main.js
Browse files Browse the repository at this point in the history
  • Loading branch information
chschnell committed Dec 1, 2024
1 parent 690c46b commit f66e39c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
5 changes: 5 additions & 0 deletions src/browser/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -1737,6 +1737,10 @@
settings.relay_url = $("relay_url").value;
if(!DEFAULT_NETWORKING_PROXIES.includes(settings.relay_url)) new_query_args.set("relay_url", settings.relay_url);
}
if (settings.relay_url.startsWith("fetch") && settings.relay_url.length > 6 && settings.relay_url[5] === ":") {
settings.cors_proxy = settings.relay_url.slice(6);
settings.relay_url = "fetch";
}
settings.disable_audio = $("disable_audio").checked || settings.disable_audio;
if(settings.disable_audio) new_query_args.set("mute", "1");

Expand Down Expand Up @@ -1852,6 +1856,7 @@
net_device: {
type: settings.net_device_type || "ne2k",
relay_url: settings.relay_url,
cors_proxy: settings.cors_proxy
},
autostart: true,

Expand Down
9 changes: 3 additions & 6 deletions src/browser/starter.js
Original file line number Diff line number Diff line change
Expand Up @@ -311,12 +311,9 @@ V86.prototype.continue_init = async function(emulator, options)
if(relay_url)
{
// TODO: remove bus, use direct calls instead
if(relay_url.startsWith("fetch")) {
const fetch_options = {};
if(relay_url.length > 6 && relay_url[5] === ":") {
fetch_options.cors_proxy = relay_url.slice(6);
}
this.network_adapter = new FetchNetworkAdapter(this.bus, fetch_options);
if(relay_url === "fetch")
{
this.network_adapter = new FetchNetworkAdapter(this.bus, options.net_device ? options.net_device : {});
}
else if(relay_url.startsWith("wisp://") || relay_url.startsWith("wisps://"))
{
Expand Down

0 comments on commit f66e39c

Please sign in to comment.