freenet-core icon indicating copy to clipboard operation
freenet-core copied to clipboard

Web browser integration

Open sanity opened this issue 2 years ago • 5 comments

Use a browser profile to specify Locutus as a proxy: https://superuser.com/questions/1633255/how-can-i-start-a-google-chrome-instance-which-uses-a-proxy-while-already-having

sanity avatar Dec 08 '22 07:12 sanity

If we decide to create a customized browser based on something like Electron, then Min may be a good starting point.

CHAT-GPT guide:

To add a new URL type in Electron, you can use the webPreferences option in the BrowserWindow options when creating a new window. This option allows you to specify custom protocol handlers and their associated handler functions.

For example, to add a new URL type for freenet keys, you could do the following:

In the main Electron process, create a new BrowserWindow instance with the following options:

const win = new BrowserWindow({
  webPreferences: {
    customProtocols: {
      'freenet': (request) => {
        // Step 2: Handle the request and rewrite the URL
      }
    }
  }
});

In the custom protocol handler function, you can parse the freenet key from the URL and rewrite it to request it via a local HTTP listener provided by the local freenet node. For example:

const win = new BrowserWindow({
  webPreferences: {
    customProtocols: {
      'freenet': (request) => {
        // Parse the freenet key from the URL
        const freenetKey = request.url.split(':')[1];

        // Rewrite the URL to request it via the local freenet node
        const rewrittenUrl = `http://localhost:8888/freenet/${freenetKey}`;

        // Load the rewritten URL in the window
        win.loadURL(rewrittenUrl);
      }
    }
  }
});

To prevent normal HTTP requests from a website, you can use the webRequest module to block any requests that are not using the freenet protocol. For example:

const { webRequest } = require('electron');

// Block any requests that are not using the freenet protocol
webRequest.onBeforeRequest((details, callback) => {
  if (details.url.startsWith('http') && !details.url.startsWith('freenet')) {
    // Block the request
    return callback({ cancel: true });
  }

  // Allow the request
  callback({});
});

With these steps, you can add a new URL type for freenet keys and handle requests to them in the Electron browser.

sanity avatar Dec 15 '22 17:12 sanity

Alternative to Electron: https://tauri.app/

sanity avatar Dec 16 '22 22:12 sanity

Pivotal Tracker story: https://www.pivotaltracker.com/story/show/184046434

github-actions[bot] avatar Dec 18 '22 00:12 github-actions[bot]

How about providing access to I2P, Tor, IPFS, etc.

ple1n avatar Dec 27 '22 10:12 ple1n

How about providing access to I2P, Tor, IPFS, etc.

Foxyproxy and its conditional proxying rules? -> i2p inproxy, tor2web, ipfs http gateway, etc.

all of these today require manual setup, but I don't see why an extension or standalone browser couldn't be developed that prepackages these things.

alexlyee avatar Aug 09 '23 15:08 alexlyee