Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

commonplace

Package Overview
Dependencies
Maintainers
7
Versions
83
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

commonplace - npm Package Compare versions

Comparing version 0.4.1 to 0.4.2

src/media/js/consumer_info.js

14

lib/build.js

@@ -13,5 +13,2 @@ var fs = require('fs');

'settings_travis.js',
'settings_package_prod.js',
'settings_package_stage.js',
'settings_package_dev.js',
'tests.js',

@@ -26,2 +23,6 @@

var re_blacklist = [
/^settings_package_/
];
function concatJS(src_dir, callback) {

@@ -38,6 +39,11 @@ var output = '';

function(file) {
// Don't include blacklisted files.
if (blacklist.indexOf(path.basename(file)) !== -1) {
// Don't include blacklisted files.
return;
}
for (var i = 0; i < re_blacklist.length; i++) {
if (path.basename(file).match(re_blacklist[i])) {
return;
}
}

@@ -44,0 +50,0 @@ // Automatically name anonymous modules.

{
"name": "commonplace",
"version": "0.4.1",
"version": "0.4.2",
"preferGlobal": true,

@@ -5,0 +5,0 @@ "repository": {

@@ -1,2 +0,2 @@

define('capabilities', [], function() {
define('capabilities', ['settings'], function(settings) {
function safeMatchMedia(query) {

@@ -31,2 +31,18 @@ var m = window.matchMedia(query);

static_caps.persona = function() {
return ((!!navigator.id || !!navigator.mozId)
&& !static_caps.phantom
&& !static_caps.fallbackFxA());
};
static_caps.nativeFxA = function() {
return (static_caps.firefoxOS
&& !!navigator.userAgent.match(/rv:32.0/)
&& settings.switches.indexOf('firefox-accounts') !== -1)
};
static_caps.fallbackFxA = function() {
return (!static_caps.nativeFxA()
&& settings.switches.indexOf('firefox-accounts') !== -1);
};
// True if the login should inherit mobile behaviors such as allowUnverified.

@@ -33,0 +49,0 @@ // The _shimmed check is for B2G where identity is native (not shimmed).

@@ -55,3 +55,31 @@ define('login',

function getCenteredCoordinates(width, height) {
var x = window.screenX + Math.max(0, Math.floor((window.innerWidth - width) / 2));
var y = window.screenY + Math.max(0, Math.floor((window.innerHeight - height) / 2));
return [x, y];
}
function fxaLogin() {
var data = {
'auth_response': msg.data.auth_code,
'state': settings.fxa_auth_state
};
z.page.trigger('before_login');
requests.post(urls.api.url('fxa-login'), data).done(function(data) {
user.set_token(data.token, data.settings);
user.update_permissions(data.permissions);
user.update_apps(data.apps);
console.log('Login succeeded, preparing the app');
z.body.addClass('logged-in');
$('.loading-submit').removeClass('loading-submit');
z.page.trigger('reload_chrome').trigger('logged_in');
_.invoke(pending_logins, 'resolve');
pending_logins = [];
});
}
function startLogin() {
var w = 320;
var h = 500;
var i = getCenteredCoordinates(w, h);
var def = defer.Deferred();

@@ -84,10 +112,29 @@ pending_logins.push(def);

}
persona_loaded.done(function() {
if (capabilities.persona()) {
console.log('Requesting login from Persona');
navigator.id.request(opt);
if (capabilities.fallbackFxA()) {
window.addEventListener('message', function (msg) {
if (!msg.data || !msg.data.auth_code) {
return;
}
fxaLogin(msg.data.auth_code);
}, false);
if (capabilities.device_type == 'desktop') {
storage.setItem('fxa-destination') = window.location.href
window.location.href = settings.fxa_auth_url
} else {
window.open(
settings.fxa_auth_url, "fxa",
'width=' + w + ',height=' + h + ',left=' + i[0] + ',top=' + i[1]);
}
});
} else {
persona_loaded.done(function() {
if (capabilities.persona()) {
console.log('Requesting login from Persona');
if (capabilities.nativeFxA()) {
navigator.id.request({oncancel: opt.oncancel});
} else {
navigator.id.request(opt);
}
}
});
}
return def.promise();

@@ -200,4 +247,5 @@ }

console.log('Calling navigator.id.watch');
navigator.id.watch({
opts = {
loggedInUser: email,
onready: function() {},
onlogin: gotVerifiedEmail,

@@ -208,4 +256,9 @@ onlogout: function() {

}
});
};
if (capabilities.nativeFxA()) {
opts.wantIssuer = 'firefox-accounts';
}
navigator.id.watch(opts);
}
}).fail(function() {

@@ -217,3 +270,3 @@ notification.notification({

return {login: startLogin};
return {login: startLogin, fxaLogin: fxaLogin};
});

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc