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

refactor: remove embedded:chromesockets experiment #985

Merged
merged 5 commits into from
Mar 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- name: Install Node.js
uses: actions/setup-node@v1
with:
node-version: 12.x
node-version: 14.x

- name: Restore .cache
uses: actions/cache@v2
Expand Down
1 change: 0 additions & 1 deletion add-on/src/lib/dnslink.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@ module.exports = function createDnslinkResolver (getState) {
readDnslinkFromTxtRecord (fqdn) {
const state = getState()
let apiProvider
// TODO: fix DNS resolver for ipfsNodeType='embedded:chromesockets', for now use ipfs.io
if (!state.ipfsNodeType.startsWith('embedded') && state.peerCount !== offlinePeerCount) {
// Use gw port so it can be a GET:
// Chromium does not execute onBeforeSendHeaders for synchronous calls
Expand Down
2 changes: 1 addition & 1 deletion add-on/src/lib/http-proxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ async function registerSubdomainProxy (getState, runtime, notify) {
}

// storing listener for later
var onRequestProxyListener
let onRequestProxyListener

// registerSubdomainProxyFirefox sets proxy using API available in Firefox
// https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/proxy/onRequest
Expand Down
3 changes: 3 additions & 0 deletions add-on/src/lib/ipfs-client/brave.js
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,9 @@ async function initBraveSettings (browser, brave) {
}

if (method !== 'local') {
// user picked remote gateway mode, turn Companion off for now
// (this way clicking power button in browser action menu will re-run activation flow)
await browser.storage.local.set({ active: false })
// close tab with temporary trigger URI
await closeIpfsTab(browser, braveIpfsUriTrigger)
await closeIpfsTab(browser, braveGatewayUrlTrigger)
Expand Down
223 changes: 0 additions & 223 deletions add-on/src/lib/ipfs-client/embedded-chromesockets/config.js

This file was deleted.

61 changes: 0 additions & 61 deletions add-on/src/lib/ipfs-client/embedded-chromesockets/index.js

This file was deleted.

17 changes: 13 additions & 4 deletions add-on/src/lib/ipfs-client/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ log.error = debug('ipfs-companion:client:error')
const external = require('./external')
const embedded = require('./embedded')
const brave = require('./brave')
const embeddedWithChromeSockets = require('./embedded-chromesockets')
const { precache } = require('../precache')

// ensure single client at all times, and no overlap between init and destroy
Expand All @@ -20,12 +19,22 @@ async function initIpfsClient (browser, opts) {
if (client) return // await destroyIpfsClient()
let backend
switch (opts.ipfsNodeType) {
case 'embedded:chromesockets':
// TODO: remove this one-time migration after in second half of 2021
setTimeout(async () => {
log('converting embedded:chromesockets to native external:brave')
opts.ipfsNodeType = 'external:brave'
await browser.storage.local.set({
ipfsNodeType: 'external:brave',
ipfsNodeConfig: '{}' // remove chrome-apps config
})
await browser.tabs.create({ url: 'https://docs.ipfs.io/how-to/companion-node-types/#native' })
}, 0)
// Halt client init
throw new Error('Embedded + chrome.sockets is deprecated. Switching to Native IPFS in Brave.')
case 'embedded':
backend = embedded
break
case 'embedded:chromesockets':
backend = embeddedWithChromeSockets
break
case 'external:brave':
backend = brave
break
Expand Down
Loading