Skip to content

Commit

Permalink
moving to WebExtension
Browse files Browse the repository at this point in the history
  • Loading branch information
schomery committed Nov 26, 2017
1 parent eb7b80d commit 7bcd918
Show file tree
Hide file tree
Showing 79 changed files with 1,569 additions and 0 deletions.
Binary file added Embedded/drawings/fontello-461b61c8.zip
Binary file not shown.
File renamed without changes
File renamed without changes
Binary file added Embedded/src/ipsettings.xpi
Binary file not shown.
19 changes: 19 additions & 0 deletions Embedded/src/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"title": "Privacy Settings (WebExtension)",
"name": "ipsettings",
"version": "0.1.0",
"description": "Alter Firefox's built-in privacy settings with a toolbar panel",
"main": "sdk.js",
"author": "Jeremy Schomery",
"engines": {
"firefox": ">=38.0a1"
},
"hasEmbeddedWebExtension": true,
"permissions": {
"multiprocess": true
},
"license": "MPLv2.0",
"keywords": [
"jetpack"
]
}
41 changes: 41 additions & 0 deletions Embedded/src/sdk.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
'use strict';

var webExtension = require('sdk/webextension');
var prefs = require('sdk/preferences/service');
var {Cc, Ci} = require('chrome');
var prefService = Cc['@mozilla.org/preferences-service;1']
.getService(Ci.nsIPrefService);

function sendPref (pref, response) {
let value = prefs.get(pref);
response({
pref,
value,
default: prefService.getDefaultBranch(pref)[typeof value === 'number' ? 'getIntPref' : 'getBoolPref'](''),
locked: prefService.getBranch(pref).prefIsLocked('')
});
}

function message (request, sender, response) {
if (request.method === 'get-pref') {
sendPref(request.pref, response);
}
else if (request.method === 'change-pref') {
try {
prefs.set(request.pref, request.value);
}
catch (e) {
console.error(e);
}
sendPref(request.pref, response);
}
else if (request.method === 'reset-pref') {
prefs.reset(request.pref);
sendPref(request.pref, response);
}
}
webExtension.startup().then(api => {
let {browser} = api;
browser.runtime.onMessage.addListener(message);
}).catch(e => console.error(e));

104 changes: 104 additions & 0 deletions Embedded/src/webextension/_locales/en/messages.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
{
"domindexedDBenabled": {
"message": "IndexedDB is a low-level API for client-side storage of significant amounts of structured data, including files/blobs (can break some websites)."
},
"layoutcssvisited_links_enabled": {
"message": "preventing attacks on a user's history through CSS :visited selectors"
},
"domnetinfoenabled": {
"message": "disable giving away network info"
},
"domenable_resource_timing": {
"message": "disable Resource Timing API"
},
"domenable_user_timing": {
"message": "disable User Timing API"
},
"privacydonottrackheaderenabled": {
"message": "The 'Do Not Track' feature is a mechanism that allows to communicate a user's tracking preferences to websites."
},
"domenable_performance": {
"message": "This setting allows the browser to collect and send usage information back to Mozilla."
},
"cameracontrolface_detectionenabled": {
"message": "Allowing face detection if camera is accessible"
},
"devicesensorsenabled": {
"message": "Allowing access to device related information such as orientation"
},
"domstorageenabled": {
"message": "Enable client-side session and persistent storage for web pages"
},
"beaconenabled": {
"message": "Enables webpages to send data to a web server prior to the unloading of the document"
},
"dombatteryenabled": {
"message": "Enables websites to know information about the battery in your laptop or smartphone"
},
"securitytlsunrestricted_rc4_fallback": {
"message": "RC4 is now disabled when using TLS, except for a few specifically whitelisted Web sites. This whitelist is an interim measure until those sites are fixed (bug 1124039). This fallback is controlled by the security.tls.unrestricted_rc4_fallback preference, true by default for the moment"
},
"securitytlsinsecure_fallback_hostsuse_static_list": {
"message": "Web sites needing to fall back to an insecure version of TLS in order to work are now in a hardcoded whitelist which will shrink over time (bug 1114816). The whitelist can be disabled by setting security.tls.insecure_fallback_hosts.use_static_list to false"
},
"securitysslrequire_safe_negotiation": {
"message": "This pref controls the behavior during the initial negotiation between client and server. If set to true, a Mozilla client will reject all connection attempts to servers that are still using the old SSL/TLS protocol and which might be vulnerable to the attack."
},
"securityssltreat_unsafe_negotiation_as_broken": {
"message": "This preference can be used to achieve visual feedback when connecting to a server that still utilizes the old protocol version, not yet supporting the new, enhanced protocol version(s). When set to true, when connecting to such a server, Firefox will warn about 'broken security' by displaying a red/broken padlock in its status bar. It should be noted that this indicator isn't of much help with regards to state of the connection used to retrieve the content. When you see the indicator, it's already “too late”, as a connection to that server has already been established and an attack may have already occurred."
},
"webgldisabled": {
"message": "WebGL is a JavaScript API for rendering interactive 3D computer graphics and 2D graphics within any compatible web browser without the use of plug-ins. WebGL is a potential security risk."
},
"mediagmpemeadobeenabled": {
"message": "A binary plugin that enables playback of encrypted media."
},
"mediaemeenabled": {
"message": "A binary plugin that enables playback of encrypted media."
},
"mediapeerconnectionenabled": {
"message": "WebRTC can leak a users IP address from behind a VPN or proxy."
},
"toolkittelemetryenabled": {
"message": "Usage statistics reports. If toolkit.telemetry.unified is off, it controls if Telemetry is enabled in Firefox. If toolkit.telemetry.unified is on, it controls whether extended data is sent to Mozilla."
},
"toolkittelemetryunified": {
"message": "Usage statistics reports. It controls unified behavior. If set to on, Telemetry is enabled, will record basic data, and will send additional pings."
},
"datareportinghealthreportuploadEnabled": {
"message": "Stability and performance reports."
},
"datareportinghealthreportserviceenabled": {
"message": "Stability and performance reports."
},
"privacytrackingprotectionenabled": {
"message": "This is Mozilla's new built in tracking protection. Note that the tracking protection list is fetched from a Mozilla Safe Browsing server."
},
"geowifiloggingenabled": {
"message": "Disables logging geolocation requests."
},
"geoenabled": {
"message": "Disables geolocation."
},
"browsersend_pings": {
"message": "Allows websites to track users clicks."
},
"browsersafebrowsingmalwareenabled": {
"message": "Disable Google Safe Browsing malware checks. Security risk, but privacy improvement."
},
"browsersafebrowsingdownloadsenabled": {
"message": "Disable Google Safe Browsing and phishing protection. Security risk, but privacy improvement."
},
"browsersafebrowsingphishingenabled": {
"message": "Disable Google Safe Browsing and phishing protection. Security risk, but privacy improvement."
},
"domeventclipboardeventsenabled": {
"message": "Websites can get notifications if you copy, paste, or cut something from a web page, and it lets them know which part of the page had been selected."
},
"networkhttpsendSecureXSiteReferrer": {
"message": "Tells the server which https page the user came from."
},
"networkwebsocketenabled": {
"message": "Websockets can cause some dns requests to not be send over the active proxy."
}
}
21 changes: 21 additions & 0 deletions Embedded/src/webextension/common.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
'use strict';

// FAQs & Feedback
chrome.storage.local.get({
version: null,
faqs: false
}, prefs => {
let version = chrome.runtime.getManifest().version;
if (prefs.version !== version && (prefs.version ? prefs.faqs : true)) {
chrome.storage.local.set({version}, () => {
chrome.tabs.create({
url: 'http://firefox.add0n.com/privacy-settings.html?version=' + version +
'&type=' + (prefs.version ? ('upgrade&p=' + prefs.version) : 'install')
});
});
}
});
(function () {
let {name, version} = chrome.runtime.getManifest();
chrome.runtime.setUninstallURL('http://add0n.com/feedback.html?name=' + name + '&version=' + version);
})();
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
62 changes: 62 additions & 0 deletions Embedded/src/webextension/data/popup/fontello.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
@font-face {
font-family: 'fontello';
src: url('fontello.woff?30729816') format('woff');
font-weight: normal;
font-style: normal;
}
/* Chrome hack: SVG is rendered more smooth in Windozze. 100% magic, uncomment if you need it. */
/* Note, that will break hinting! In other OS-es font will be not as sharp as it could be */
/*
@media screen and (-webkit-min-device-pixel-ratio:0) {
@font-face {
font-family: 'fontello';
src: url('../font/fontello.svg?30729816#fontello') format('svg');
}
}
*/

[class^="icon-"]:before, [class*=" icon-"]:before {
font-family: "fontello";
font-style: normal;
font-weight: normal;
speak: none;

display: inline-block;
text-decoration: inherit;
width: 1em;
margin-right: .2em;
text-align: center;
/* opacity: .8; */

/* For safety - reset parent styles, that can break glyph codes*/
font-variant: normal;
text-transform: none;

/* fix buttons height, for twitter bootstrap */
line-height: 1em;

/* Animation center compensation - margins should be symmetric */
/* remove if not needed */
margin-left: .2em;

/* you can be more comfortable with increased icons size */
/* font-size: 120%; */

/* Font smoothing. That was taken from TWBS */
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;

/* Uncomment for 3D effect */
/* text-shadow: 1px 1px 1px rgba(127, 127, 127, 0.3); */
}

.icon-privacy-off:before { content: '\e800'; } /* '' */
.icon-privacy-on:before { content: '\e801'; } /* '' */
.icon-security-on:before { content: '\e802'; } /* '' */
.icon-dot:before { content: '\e803'; } /* '' */
.icon-minus:before { content: '\e804'; } /* '' */
.icon-plus:before { content: '\e805'; } /* '' */
.icon-info:before { content: '\e806'; } /* '' */
.icon-security-off:before { content: '\f13e'; } /* '' */
.icon-toggle-off:before { content: '\f204'; } /* '' */
.icon-toggle-on:before { content: '\f205'; } /* '' */
Binary file not shown.
145 changes: 145 additions & 0 deletions Embedded/src/webextension/data/popup/index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
body {
font-family: "Helvetica Neue",Helvetica,sans-serif;
font-size: 13px;
user-select: none;
width: 600px;
background-color: #fff;
}
table {
width: 100%;
border-spacing: 0;
table-layout: fixed;
}
td {
overflow: hidden;
text-overflow: ellipsis;
}
td:nth-child(4),
td:nth-child(5) {
text-align: center;
}
td:nth-child(6) {
text-align: right;
}

input[type=number] {
width: 45px;
border: none;
background-color: transparent;
}
input[type=button] {
height: 52px;
border: solid 1px #d8d8d8;
background-color: #f5f5f5;
white-space: pre-wrap;
margin: 0 5px;
cursor: pointer;
}
input[type=button]:active {
opacity: 0.5;
}

#root>tbody>tr:nth-child(even) {
background-color: #f5f5f5;
}
#root>tbody>tr>td:nth-child(1) {
width: 150px;
font-weight: bold;
}
#root>tbody>tr>td>table td:nth-child(2) {
width: 32px;
text-align: center;
}
#root>tbody>tr>td>table td:nth-child(3) {
width: 50px;
}
#root>tbody>tr>td>table td:nth-child(4),
#root>tbody>tr>td>table td:nth-child(5) {
width: 20px;
}
#root>tbody>tr>td>table td:nth-child(6) {
width: 50px;
}
#root>tbody>tr>td>table tr:hover {
background-color: rgba(0, 0, 0, 0.1);
}
#root input[type=button] {
width: 22px;
height: 16px;
font-family: fontello;
background-color: #fff;
}

#toolbox {
margin-top: 10px;
}

.icon-toggle-on,
.icon-toggle-off {
cursor: pointer;
}
.icon-toggle-on:before,
.icon-toggle-off:before {
margin-right: 5px;
}
.icon-security-on,
.icon-privacy-on {
color: #448f22
}
.icon-security-off,
.icon-privacy-off {
color: #9c9c9c
}

.center {
text-align: center;
}
.header {
pointer-events: none;
font-weight: bold;
height: 32px;
}

[data-collapsed]>td:first-child {
cursor: pointer;
height: 32px;
}
[data-collapsed]>td:first-child:before {
font-family: fontello;
padding: 0 7px;
font-size: 60%;
line-height: 32px;
}
[data-collapsed=true]>td:first-child:before {
content: '\e805';
}
[data-collapsed=true] table {
display: none;
}
[data-collapsed=true]>td:last-child {
cursor: pointer;
}
[data-collapsed=true]>td:last-child:before {
content: '...';
}
[data-collapsed=false]>td:first-child:before {
content: '\e804';
}

[data-initialized=false] {
opacity: 0.5;
pointer-events: none;
}
[data-same=true] {
opacity: 0.5;
}

[hbox] {
display: flex;
}
[align=true] {
align-items: center;
}
[justify=true] {
justify-content: center;
}
Loading

0 comments on commit 7bcd918

Please sign in to comment.