Skip to content

Commit

Permalink
Allow embedding of CORS proxy in fetch relay_url
Browse files Browse the repository at this point in the history
Extends the syntax of relay_url for fetch to:

    fetch[:CORS-PROXY-URL]

where CORS-PROXY-URL is a full URL pointing to the CORS proxy server, for example:

    fetch:https://example.com/?url=
  • Loading branch information
chschnell authored Nov 27, 2024
1 parent 298da23 commit 690c46b
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/browser/starter.js
Original file line number Diff line number Diff line change
Expand Up @@ -311,9 +311,12 @@ V86.prototype.continue_init = async function(emulator, options)
if(relay_url)
{
// TODO: remove bus, use direct calls instead
if(relay_url === "fetch")
{
this.network_adapter = new FetchNetworkAdapter(this.bus);
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);
}
else if(relay_url.startsWith("wisp://") || relay_url.startsWith("wisps://"))
{
Expand Down

0 comments on commit 690c46b

Please sign in to comment.