Skip to content

Commit

Permalink
Merge branch 'release-candidate' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
lucyhe committed May 26, 2015
2 parents 18a0341 + 53af95c commit 8b37c84
Show file tree
Hide file tree
Showing 32 changed files with 475 additions and 256 deletions.
33 changes: 30 additions & 3 deletions Gruntfile.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ module.exports = (grunt) ->
freedomxmpp: grunt.file.readJSON('node_modules/freedom-social-xmpp/package.json')
freedomfirebase: grunt.file.readJSON('node_modules/freedom-social-firebase/package.json')

clean: ['build/dev', '.tscache']
clean: ['build/dev', 'build/dist', '.tscache']

#-------------------------------------------------------------------------
copy: {
Expand Down Expand Up @@ -331,10 +331,22 @@ module.exports = (grunt) ->
nonull: true,
expand: true,
cwd: 'src/',
src: ['**/*'],
src: [
'**/*',
'!generic_core/dist_build/*',
'!generic_core/dev_build/*'
],
dest: devBuildPath,
onlyIf: 'modified'
}
{
nonull: true,
expand: true,
cwd: 'src/generic_core/dev_build/',
src: ['*'],
dest: devBuildPath + '/generic_core',
onlyIf: 'modified'
}
]

# Copy releveant files for distribution.
Expand Down Expand Up @@ -400,6 +412,7 @@ module.exports = (grunt) ->
'freedom-social-firebase/facebook-social-provider.js'

'**/freedom-module.json'
'!generic_core/freedom-module.json'
'**/*.static.js'
'!**/*spec*'

Expand All @@ -409,6 +422,12 @@ module.exports = (grunt) ->
]
dest: 'build/dist/chrome/app'
}
{ # Chrome app freedom-module
expand: true
cwd: 'src/generic_core/dist_build/'
src: ['*']
dest: 'build/dist/chrome/app/generic_core'
}
{ # Firefox
expand: true
cwd: firefoxDevPath
Expand All @@ -433,8 +452,10 @@ module.exports = (grunt) ->
'data/freedom-social-firebase/facebook-social-provider.js'

'data/**/freedom-module.json'
'!generic_core/freedom-module.json'
'data/**/*.static.js'
'data/scripts/get_logs.js'
'data/generic_ui/scripts/get_logs.js'
'data/scripts/content-proxy.js'
'!**/*spec*'

'data/bower/webcomponentsjs/webcomponents.min.js'
Expand All @@ -454,6 +475,12 @@ module.exports = (grunt) ->
]
dest: 'build/dist/firefox'
}
{ # Firefox freedom-module
expand: true
cwd: 'src/generic_core/dist_build/'
src: ['*']
dest: 'build/dist/firefox/data/generic_core/'
}
]

chrome_extension:
Expand Down
7 changes: 4 additions & 3 deletions bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "uProxy",
"version": "0.8.7",
"version": "0.8.8",
"dependencies": {
"polymer": "^0.5.6",
"paper-elements": "Polymer/paper-elements#^0.5.6",
Expand All @@ -15,9 +15,10 @@
"core-header-panel": "Polymer/core-header-panel#^0.5.6",
"core-drawer-panel": "Polymer/core-drawer-panel#^0.5.6",
"core-overlay": "Polymer/core-overlay#^0.5.6",
"paper-toast": "Polymer/paper-toast#^0.5.6"
"paper-toast": "Polymer/paper-toast#^0.5.6",
"webcomponentsjs": "0.6.1"
},
"resolutions": {
"webcomponentsjs": "^0.6.1"
"webcomponentsjs": "0.6.1"
}
}
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "uProxy",
"description": "Share your pathway to the Internet",
"version": "0.8.7",
"version": "0.8.8",
"repository": {
"type": "git",
"url": "https://github.com/uproxy/uproxy"
Expand All @@ -25,7 +25,7 @@
"freedomjs-anonymized-metrics": "~0.1.0",
"freedom-for-chrome": "^0.4.11",
"freedom-for-firefox": "0.6.10",
"freedom-social-firebase": "^0.0.12",
"freedom-social-firebase": "^1.0.1",
"freedom-social-xmpp": "^0.3.6",
"fs-extra": "^0.12.0",
"grunt": "^0.4.2",
Expand Down
2 changes: 1 addition & 1 deletion src/chrome/app/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"name": "__MSG_appName__",
"description": "__MSG_appDescription__",
"minimum_chrome_version": "41.0.2272.63",
"version": "0.8.7",
"version": "0.8.8",
"default_locale": "en",
"icons": {
"128": "icons/128_online.png"
Expand Down
2 changes: 1 addition & 1 deletion src/chrome/extension/manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "__MSG_extName__",
"version": "0.8.7",
"version": "0.8.8",
"manifest_version": 2,
"description": "__MSG_extDescription__",
"minimum_chrome_version": "41.0.2272.63",
Expand Down
2 changes: 1 addition & 1 deletion src/firefox/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"description": "This is the alpha version of uProxy.",
"author": "uProxy Team <info@uproxy.org>",
"license": "Apache 2.0",
"version": "0.8.7",
"version": "0.8.8",
"permissions": {
"private-browsing": true
}
Expand Down
8 changes: 4 additions & 4 deletions src/generic_core/consent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ import uproxy_core_api = require('../interfaces/uproxy_core_api');
ignoringRemoteUserRequest :boolean;
ignoringRemoteUserOffer :boolean;

constructor() {
this.localRequestsAccessFromRemote = false;
constructor(initialConsent :boolean) {
this.localRequestsAccessFromRemote = initialConsent;
this.ignoringRemoteUserOffer = false;
this.localGrantsAccessToRemote = false;
this.remoteRequestsAccessFromLocal = false;
this.localGrantsAccessToRemote = initialConsent;
this.remoteRequestsAccessFromLocal = initialConsent;
this.ignoringRemoteUserRequest = false;
}
}
Expand Down
43 changes: 43 additions & 0 deletions src/generic_core/dev_build/freedom-module.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
"name": "uProxy",
"description": "The uProxy backend provides a mesh web proxy. Access the web through your social connections.",
"app": {
"script": [
"freedom-module.static.js"
]
},
"dependencies": {
"SOCIAL-Google": {
"url": "../freedom-social-xmpp/social.google.json",
"api": "social"
},
"SOCIAL-Facebook": {
"url": "../freedom-social-firebase/social.firebase-facebook.json",
"api": "social"
},
"SOCIAL-Google+": {
"url": "../freedom-social-firebase/social.firebase-google.json",
"api": "social"
},
"loggingcontroller": {
"url": "../uproxy-lib/loggingprovider/freedom-module.json",
"api": "loggingcontroller"
},
"logginglistener": {
"url": "../uproxy-lib/loggingprovider/freedom-module.json",
"api": "logginglistener"
},
"metrics": {
"url": "../freedomjs-anonymized-metrics/anonmetrics.json",
"api": "metrics"
}
},
"permissions": [
"core.rtcpeerconnection",
"core.rtcdatachannel",
"core.storage",
"core.tcpsocket",
"core.udpsocket",
"core.xhr"
]
}
File renamed without changes.
4 changes: 3 additions & 1 deletion src/generic_core/globals.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import local_storage = require('./storage');
import logging = require('../../../third_party/uproxy-lib/logging/logging');
import loggingTypes = require('../../../third_party/uproxy-lib/loggingprovider/loggingprovider.types');
import metrics_module = require('./metrics');
import uproxy_core_api = require('../interfaces/uproxy_core_api');
import user_interface = require('../interfaces/ui');
Expand Down Expand Up @@ -32,7 +33,8 @@ export var settings :uproxy_core_api.GlobalSettings = {
allowNonUnicast: false,
mode: user_interface.Mode.GET,
version: STORAGE_VERSION,
statsReportingEnabled: false
statsReportingEnabled: false,
consoleFilter: loggingTypes.Level.warn
};

export var natType :string = '';
Expand Down
5 changes: 4 additions & 1 deletion src/generic_core/remote-instance.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import globals = require('./globals');
import local_storage = require('./storage');
import net = require('../../../third_party/uproxy-lib/net/net.types');
import signals = require('../../../third_party/uproxy-lib/webrtc/signals');
import local_instance = require('./local-instance');


describe('remote_instance.RemoteInstance', () => {
Expand All @@ -30,7 +31,7 @@ describe('remote_instance.RemoteInstance', () => {
'sendInstanceHandshake',
'updateRemoteRequestsAccessFromLocal'
]);
user.consent = new consent.State();
user.consent = new consent.State(false);

user.network = <social.Network><any>jasmine.createSpyObj(
'network', ['getUser']);
Expand Down Expand Up @@ -105,6 +106,8 @@ describe('remote_instance.RemoteInstance', () => {
'network', ['getUser']);
network['getStorePath'] = function() { return 'networkPath'; };
network['getLocalInstanceId'] = function() { return 'myInstanceId'; };
network['myInstance'] =
new local_instance.LocalInstance(network, 'localUserId');
var user = new remote_user.User(network, 'testUser');
user.update({userId: 'testUser', name: 'Alice'});
instance = new remote_instance.RemoteInstance(user, INSTANCE_ID);
Expand Down
25 changes: 21 additions & 4 deletions src/generic_core/remote-user.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import consent = require('./consent');

import globals = require('./globals');
import storage = globals.storage;
import local_instance = require('./local-instance');

describe('remote_user.User', () => {
// Prepare a fake Social.Network object to construct User on top of.
Expand All @@ -19,6 +20,8 @@ describe('remote_user.User', () => {
]);
network['getLocalInstanceId'] = function() { return 'dummyInstanceId'; };
network['send'] = () => { return Promise.resolve(); };
network['myInstance'] =
new local_instance.LocalInstance(network, 'localUserId');

var user :remote_user.User;
var instance :remote_instance.RemoteInstance;
Expand Down Expand Up @@ -295,9 +298,9 @@ describe('remote_user.User', () => {
});

it('invalid proxy transitions do not modify consent', (done) => {
var emptyConsent = new consent.State();
var emptyConsent = new consent.State(false);

user.consent = new consent.State();
user.consent = new consent.State(false);
user.modifyConsent(uproxy_core_api.ConsentUserAction.CANCEL_REQUEST).then(() => {
expect(user.consent).toEqual(emptyConsent);
user.modifyConsent(uproxy_core_api.ConsentUserAction.UNIGNORE_OFFER).then(() => {
Expand Down Expand Up @@ -371,9 +374,9 @@ describe('remote_user.User', () => {
});

it('invalid client transitions do not modify consent', (done) => {
var emptyConsent = new consent.State();
var emptyConsent = new consent.State(false);

user.consent = new consent.State();
user.consent = new consent.State(false);
user.modifyConsent(uproxy_core_api.ConsentUserAction.CANCEL_OFFER).then(() => {
expect(user.consent).toEqual(emptyConsent);
user.modifyConsent(
Expand All @@ -387,4 +390,18 @@ describe('remote_user.User', () => {
});
});

it('Initializes with consent for local user', () => {
user = new remote_user.User(network, network.myInstance.userId);
expect(user.consent.localRequestsAccessFromRemote).toEqual(true);
expect(user.consent.localGrantsAccessToRemote).toEqual(true);
expect(user.consent.remoteRequestsAccessFromLocal).toEqual(true);
});

it('Initializes without consent for other users', () => {
user = new remote_user.User(network, 'otherUser');
expect(user.consent.localRequestsAccessFromRemote).toEqual(false);
expect(user.consent.localGrantsAccessToRemote).toEqual(false);
expect(user.consent.remoteRequestsAccessFromLocal).toEqual(false);
});

}); // uProxy.User
16 changes: 11 additions & 5 deletions src/generic_core/remote-user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ var log :logging.Log = new logging.Log('remote-user');
public clientIdToStatusMap :{ [clientId :string] :social.ClientStatus };
public profile :freedom_Social.UserProfile;

public consent :consent.State = new consent.State();
public consent :consent.State;

// Each instance is a user and social network pair.
private instances_ :{ [instanceId :string] :remote_instance.RemoteInstance };
Expand Down Expand Up @@ -96,6 +96,9 @@ var log :logging.Log = new logging.Log('remote-user');
this.clientToInstanceMap_ = {};
this.instanceToClientMap_ = {};

this.consent =
new consent.State(userId === this.network.myInstance.userId);

storage.load<social.UserState>(this.getStorePath()).then((state) => {
this.restoreState(state);
}).catch((e) => {
Expand Down Expand Up @@ -352,10 +355,13 @@ var log :logging.Log = new logging.Log('remote-user');
isOnline = true;
}
}
if (!this.network.areAllContactsUproxy() && allInstanceIds.length === 0) {
// For networks which give us profiles for non-uProxy contacts, don't
// send users to the UI unless they have instances (they may not be
// uProxy users).

if (allInstanceIds.length === 0 &&
(!this.network.areAllContactsUproxy() ||
this.userId === this.network.myInstance.userId)) {
// Don't send users with no instances to the UI if either the network
// gives us non-uProxy contacts, or it is the user we are logged in
// with.
return null;
}

Expand Down
Loading

0 comments on commit 8b37c84

Please sign in to comment.