This repository has been archived by the owner on Jun 23, 2023. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add in management addon to configure the main addon (#485)
- Loading branch information
Jonathan Kingston
committed
Aug 21, 2019
1 parent
13f5583
commit 2046c16
Showing
12 changed files
with
116 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,4 @@ | |
src/vendor/* | ||
node_modules/* | ||
dist/* | ||
management-src/web-ext-artifacts/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"extensionName": { | ||
"message": "Firefox Private Network - Management interface" | ||
}, | ||
"extensionDescription": { | ||
"message": "Manage the Firefox Private Network Extension" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
const EXTENSION_ID = "secure-proxy@mozilla.com"; | ||
function sendMessage(type, value) { | ||
return browser.runtime.sendMessage( | ||
EXTENSION_ID, | ||
{ type, value } | ||
); | ||
} | ||
async function init() { | ||
let result = await sendMessage("getCurrentConfig"); | ||
console.log(result); | ||
sendMessage("setDebuggingEnabled", true); | ||
} | ||
init(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"manifest_version": 2, | ||
"name": "__MSG_extensionName__", | ||
"default_locale": "en_US", | ||
"version": "0.1", | ||
"author": "Firefox", | ||
|
||
"homepage_url": "https://private-network.firefox.com", | ||
|
||
"description": "__MSG_extensionDescription__", | ||
|
||
"permissions": [ | ||
], | ||
|
||
"background": { | ||
"scripts": ["background.js"] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import {Component} from "./component.js"; | ||
|
||
// This component handles message from external extensions | ||
// It's current use is to accept configuration of the addon | ||
export class ExternalHandler extends Component { | ||
constructor(receiver) { | ||
super(receiver); | ||
|
||
browser.runtime.onMessageExternal.addListener(this.handleExternalMessage); | ||
} | ||
|
||
async init() { | ||
// Nothing to do here | ||
} | ||
|
||
// eslint-disable-next-line consistent-return | ||
async handleExternalMessage(message) { | ||
log("Got external message", message); | ||
switch (message.type) { | ||
case "getCurrentConfig": | ||
return ConfigUtils.getCurrentConfig(); | ||
case "setDebuggingEnabled": | ||
return ConfigUtils.setDebuggingEnabled(message.value); | ||
case "setProxyURL": | ||
return ConfigUtils.setProxyURL(message.value); | ||
default: | ||
console.error("unhandled message from external extension"); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters