Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Web browser integration #424

Open
sanity opened this issue Dec 8, 2022 · 5 comments
Open

Web browser integration #424

sanity opened this issue Dec 8, 2022 · 5 comments
Labels
A-os-integration Area: OS integration C-proposal Category: A proposal seeking feedback planned This has been synced to PT for triage

Comments

@sanity
Copy link
Collaborator

sanity commented Dec 8, 2022

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 sanity added A-os-integration Area: OS integration C-proposal Category: A proposal seeking feedback labels Dec 9, 2022
@sanity
Copy link
Collaborator Author

sanity commented Dec 15, 2022

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
Copy link
Collaborator Author

sanity commented Dec 16, 2022

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

@sanity sanity added the planned This has been synced to PT for triage label Dec 17, 2022
@freenet freenet deleted a comment from github-actions bot Dec 18, 2022
@github-actions
Copy link

github-actions bot commented Dec 18, 2022

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

@freenet freenet deleted a comment from github-actions bot Dec 18, 2022
@freenet freenet deleted a comment from github-actions bot Dec 18, 2022
@freenet freenet deleted a comment from github-actions bot Dec 18, 2022
@freenet freenet deleted a comment from github-actions bot Dec 18, 2022
@freenet freenet deleted a comment from github-actions bot Dec 18, 2022
@planetoryd
Copy link

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

@alexlyee
Copy link

alexlyee commented Aug 9, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-os-integration Area: OS integration C-proposal Category: A proposal seeking feedback planned This has been synced to PT for triage
Projects
None yet
Development

No branches or pull requests

3 participants