Skip to content

Commit

Permalink
Merge branch 'master' into soycode-simplesocksnode
Browse files Browse the repository at this point in the history
  • Loading branch information
soycode authored Jun 27, 2016
2 parents 1a2d177 + 4595dd7 commit 97025c1
Show file tree
Hide file tree
Showing 35 changed files with 416 additions and 483 deletions.
1 change: 0 additions & 1 deletion src/chrome/extension/scripts/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,4 @@ export var ui :user_interface.UserInterface =

export var model :ui_model.Model = ui.model;

ui.browser = 'chrome';
console.log('Loaded dependencies for Chrome Extension.');
2 changes: 0 additions & 2 deletions src/firefox/data/scripts/background.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ if (undefined === ui) {
model = ui.model;
}

ui.browser = 'firefox';

port.on('newlyInstalled', function() {
firefoxBrowserApi.hasInstalledThenLoggedIn = false;
});
16 changes: 15 additions & 1 deletion src/generic_core/uproxy_core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -311,8 +311,22 @@ export class uProxyCore implements uproxy_core_api.CoreApi {
return globals.loadSettings.then(() => {
var copyPasteConnectionState = copyPasteConnection.getCurrentState();

let moveToFront = (array :string[], element :string) :void => {
let i = array.indexOf(element);
if (i < 1) return;
array.splice(0, 0, array.splice(i, 1)[0] );
};

let networkNames = Object.keys(social_network.networks);

for (let name of ['Quiver', 'Cloud']) {
if (name in social_network.networks) {
moveToFront(networkNames, name);
}
}

return {
networkNames: Object.keys(social_network.networks),
networkNames: networkNames,
cloudProviderNames: getCloudProviderNames(),
globalSettings: globals.settings,
onlineNetworks: social_network.getOnlineNetworks(),
Expand Down
27 changes: 15 additions & 12 deletions src/generic_ui/locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -819,6 +819,9 @@
"description": "Invite instructions for the uProxy Network (aka Quiver)",
"message": "Generate a link and send it to your friends so they can find you on uProxy. You can request access, offer access or both."
},
"NETWORK_LIST_CLOUD_LABEL": {
"message": "Create a private cloud server"
},
"ADD_A_CLOUD_FRIEND": {
"description": "Title for screen where user adds a Cloud instance (virtual machine) to use uProxy with",
"message": "Add a Cloud friend"
Expand Down Expand Up @@ -1241,7 +1244,7 @@
},
"CREATE_A_NEW_ACCOUNT": {
"description": "Button text for creating a new account (e.g. for DigitalOcean)",
"message": "Create a new account"
"message": "Create a DigitalOcean account"
},
"SIGN_IN_AND_CONNECT": {
"description": "Button text for signing into DigitalOcean",
Expand Down Expand Up @@ -1301,15 +1304,19 @@
},
"CLOUD_INSTALL_GET_STARTED_TITLE": {
"description": "Message shown during DigitalOcean server deployment",
"message": "uProxy now allows you to create a private cloud server through DigitalOcean."
"message": "Create a private cloud server on DigitalOcean through uProxy."
},
"CLOUD_INSTALL_GET_STARTED_MESSAGE": {
"description": "Message shown during DigitalOcean server deployment",
"message": "For $10 per month you can get and share access with your friends and family. If you sign up with uProxy, your first month is free! Create a new account or sign in to connect and share access. <uproxy-faq-link anchor='whatAreCloudServers'>Learn more.</uproxy-faq-link>"
"message": "For $10 per month you can get and share access with your friends and family. If you sign up for DigitalOcean with uProxy, your first month is free! <uproxy-faq-link anchor='whatAreCloudServers'>Learn more.</uproxy-faq-link>"
},
"CLOUD_INSTALL_EXISTING_SERVER_TITLE": {
"description": "Title for 'already have a cloud server' section",
"message": "Already have a cloud server?"
},
"CLOUD_INSTALL_EXISTING_SERVER_MESSAGE": {
"description": "Instructions link for users who already have an existing cloud server.",
"message": "Already have a cloud server? <uproxy-faq-link anchor='howDoInstallUproxyOnServer'>Learn how</uproxy-faq-link> to use it with uProxy."
"message": "You can manually set up your own uProxy server. <uproxy-faq-link anchor='howDoInstallUproxyOnServer'>Learn how</uproxy-faq-link>"
},
"CLOUD_INSTALL_INVITE_SCREEN_TITLE": {
"description": "Message shown on invite screen for DigitalOcean server deployment",
Expand All @@ -1321,19 +1328,15 @@
},
"I_HAVE_AN_ACCOUNT": {
"description": "Button text shown during DigitalOcean server deployment",
"message": "I have an account"
"message": "I have a DigitalOcean account"
},
"SIGN_ME_IN": {
"description": "Button text shown during DigitalOcean server deployment",
"message": "Sign me in!"
},
"EMPTY_ROSTER_CLOUD_INSTRUCTIONS": {
"description": "Instructions shown for cloud when the user has an empty roster",
"message": "Create a private cloud server and share access with friends & family"
},
"EMPTY_ROSTER_PEER_TO_PEER_INSTRUCTIONS": {
"description": "Instructions shown for peer-to-peer when the user has an empty roster",
"message": "Get or share access with family & friends."
"EMPTY_ROSTER_INSTRUCTIONS": {
"description": "Instructions shown when the user has an empty roster",
"message": "Get and share access from a friend or a private cloud server."
},
"ASIA_SINGAPORE": {
"description": "Region option for deploying a DigitalOcean server",
Expand Down
1 change: 1 addition & 0 deletions src/generic_ui/polymer/button.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
:host {
background: #12A391;
color: white;
text-transform: none;
}
</style>
<shadow></shadow>
Expand Down
58 changes: 15 additions & 43 deletions src/generic_ui/polymer/cloud-install.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@
width: 100%;
background-color: white;
}
uproxy-button {
margin: 15px 0px;
}
paper-progress {
width: 100%;
}
Expand All @@ -32,20 +29,25 @@
}
uproxy-button {
background-color: #34AFCE; /* blue */
margin: 4px 0;
padding: 0.5em;
width: 100%;
font-size: 14px;
}
paper-checkbox {
margin: 0 0 4px;
}
hr {
margin: 20px 0;
color: #eee;
border-style: solid;
}
h1 {
color: #34AFCE; /* blue */
color: #003C48;
font-weight: 400;
font-size: 20px;
line-height: 30px;
}
h2 {
font-weight: 400;
font-size: 23px;
}
p {
line-height: 1.75em;
}
Expand Down Expand Up @@ -73,12 +75,6 @@
.warning {
font-weight: bold;
}
#newAccount {
margin: 15px 0 8px;
}
#haveAccount {
margin: 0 0 15px;
}
</style>

<core-signals on-core-signal-open-cloud-install='{{ open }}'></core-signals>
Expand All @@ -90,44 +86,20 @@

<div class='content'>
<div class='imgWrapper'>
<img src='../../icons/cloud/create-circle-ic.svg'>
<img src='../../icons/cloud/uproxy+digitalocean.svg'>
</div>
<h1>{{ 'CLOUD_INSTALL_GET_STARTED_TITLE' | $$ }}</h1>
<p id='getStartedMessage'></p>
<uproxy-button raised on-tap='{{ showDigitalOceanAccountHelpOverlay }}'
id="newAccount">
{{ 'CREATE_A_NEW_ACCOUNT' | $$ }}
</uproxy-button>
<uproxy-button raised on-tap='{{ showLoginOverlay }}' id="haveAccount">
{{ 'I_HAVE_AN_ACCOUNT' | $$ }}
</uproxy-button>
<p id='existingServerMessage'></p>
</div>
</core-overlay>

<core-overlay id='digitalOceanAccountHelpOverlay'>
<uproxy-app-bar on-go-back='{{ back }}' color='#34AFCE'>
{{ 'CREATE_A_CLOUD_SERVER' | $$ }}
</uproxy-app-bar>

<div class='content'>
<div class='imgWrapper'>
<img src='../../icons/cloud/getstarted-step1.svg'>
<img src='../../icons/cloud/getstarted-step2.svg'>
<img src='../../icons/cloud/getstarted-step3.svg'>
</div>
<h1>{{ 'CLOUD_INSTALL_CREATE_ACCOUNT_TITLE' | $$ }}</h1>
<!-- TODO: some of this text needs to be bold - need to set the HTML element rather than use $$ to translate -->
<p id='createAccountMessage'></p>

<paper-checkbox id='havePromoCode' label="{{ 'HAVE_PROMO_CODE' | $$ }}" on-change="{{havePromoChanged}}"></paper-checkbox>

<uproxy-button raised on-tap='{{ launchDigitalOceanSignup }}'>
{{ 'CREATE_A_NEW_ACCOUNT' | $$ }}
</uproxy-button>
<uproxy-button raised on-tap='{{ showLoginOverlay }}'>
{{ 'SIGN_ME_IN' | $$}}
{{ 'I_HAVE_AN_ACCOUNT' | $$ }}
</uproxy-button>
<hr>
<h1>{{ 'CLOUD_INSTALL_EXISTING_SERVER_TITLE' | $$ }}</h1>
<p id='existingServerMessage'></p>
</div>
</core-overlay>

Expand Down
24 changes: 15 additions & 9 deletions src/generic_ui/polymer/cloud-install.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
/// <reference path='../../../../third_party/typings/browser.d.ts' />
/// <reference path='../../../../third_party/polymer/polymer.d.ts' />

import translator = require('../scripts/translator');
import uproxy_core_api = require('../../interfaces/uproxy_core_api');
import ui_constants = require('../../interfaces/ui');
import user = require('../scripts/user');
Expand Down Expand Up @@ -29,10 +30,6 @@ Polymer({

this.$.getStartedOverlay.open();
},
showDigitalOceanAccountHelpOverlay: function() {
this.closeOverlays();
this.$.digitalOceanAccountHelpOverlay.open();
},
showLoginOverlay: function() {
this.closeOverlays();
this.$.loginOverlay.open();
Expand All @@ -49,8 +46,7 @@ Polymer({
ui.openTab('https://cloud.digitalocean.com/droplets');
},
back: function() {
if (this.$.digitalOceanAccountHelpOverlay.opened ||
this.$.loginOverlay.opened || this.$.failureOverlay.opened) {
if (this.$.loginOverlay.opened || this.$.failureOverlay.opened) {
this.closeOverlays();
this.$.getStartedOverlay.open();
} else {
Expand All @@ -59,7 +55,6 @@ Polymer({
},
closeOverlays: function() {
this.$.getStartedOverlay.close();
this.$.digitalOceanAccountHelpOverlay.close();
this.$.loginOverlay.close();
this.$.installingOverlay.close();
this.$.successOverlay.close();
Expand All @@ -84,6 +79,7 @@ Polymer({
this.closeOverlays();
this.$.successOverlay.open();
ui.model.globalSettings.shouldHijackDO = false;
ui.core.updateGlobalSettings(ui.model.globalSettings);
}).catch((e :any) => {
// TODO: Figure out why e.message is not set
if (e === 'Error: server already exists') {
Expand Down Expand Up @@ -134,10 +130,20 @@ Polymer({
providerName: DEFAULT_PROVIDER
}).then(() => {
this.closeOverlays();
ui.toastMessage = ui.i18n_t('CLOUD_INSTALL_CANCEL_SUCCESS');
this.fire('core-signal', {
name: 'show-toast',
data: {
toastMessage: translator.i18n_t('CLOUD_INSTALL_CANCEL_SUCCESS')
}
});
}).catch((e: Error) => {
this.$.cancelingOverlay.close();
ui.toastMessage = ui.i18n_t('CLOUD_INSTALL_CANCEL_FAILURE');
this.fire('core-signal', {
name: 'show-toast',
data: {
toastMessage: translator.i18n_t('CLOUD_INSTALL_CANCEL_FAILURE')
}
});
});
},
select: function(e: Event, d: Object, input: HTMLInputElement) {
Expand Down
14 changes: 12 additions & 2 deletions src/generic_ui/polymer/contact.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,12 @@ Polymer({
userId: this.contact.userId
});
}).then(() => {
this.ui.toastMessage = translator.i18n_t('REMOVE_CLOUD_SERVER_SUCCESS');
this.fire('core-signal', {
name: 'show-toast',
data: {
toastMessage: translator.i18n_t('REMOVE_CLOUD_SERVER_SUCCESS')
}
});
}).catch((e: Error) => {
if (!e) {
return;
Expand Down Expand Up @@ -174,7 +179,12 @@ Polymer({
},
destroyCloudServerIfNeeded: function() {
if (this.contact.status === this.UserStatus.CLOUD_INSTANCE_CREATED_BY_LOCAL) {
this.ui.toastMessage = translator.i18n_t('REMOVING_UPROXY_CLOUD_STATUS');
this.fire('core-signal', {
name: 'show-toast',
data: {
toastMessage: translator.i18n_t('REMOVING_UPROXY_CLOUD_STATUS')
}
});
return ui_context.core.cloudUpdate({
operation: uproxy_core_api.CloudOperationType.CLOUD_DESTROY,
providerName: DEFAULT_PROVIDER
Expand Down
10 changes: 8 additions & 2 deletions src/generic_ui/polymer/instance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import social = require('../../interfaces/social');
import ui_constants = require('../../interfaces/ui');
import net = require('../../lib/net/net.types');
import uproxy_core_api = require('../../interfaces/uproxy_core_api');
import translator = require('../scripts/translator');
import user_interface = require('../scripts/ui');

// generic_ui/scripts/ui.ts: UserInterface
Expand Down Expand Up @@ -37,8 +38,13 @@ Polymer({
},
start: function() {
if (!this.instance.isOnline) {
this.ui.toastMessage = ui.i18n_t('FRIEND_OFFLINE',
{ name: this.user.name });
this.fire('core-signal', {
name: 'show-toast',
data: {
toastMessage: translator.i18n_t('FRIEND_OFFLINE',
{ name: this.user.name })
}
});
return;
}

Expand Down
26 changes: 4 additions & 22 deletions src/generic_ui/polymer/invite-user.html
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@
cursor: pointer;
vertical-align: top;
padding: 1em 2em 1em 2em;
border-bottom: 1px solid rgba(0, 0, 0, .10);
}
.networkLoginButton:last-child {
border-bottom: none;
Expand Down Expand Up @@ -131,12 +130,7 @@
}
/* uproxy-faq-link is used in the translation for weWontPostLearnMore */
uproxy-faq-link {
font-weight: bold;
}
/* underline is not applied unless we do this hack. TODO: find out why */
uproxy-faq-link::shadow span {
text-decoration: underline;
color: rgb(112, 112, 112);
color: #12A391;
}
.paleText {
color: #9e9e9e;
Expand Down Expand Up @@ -221,27 +215,15 @@
</div>

<div id='allNetworkButtons'>

<div id='cloudInstall' hidden?='{{ model.cloudProviderNames.length < 1 }}' on-tap='{{ cloudInstall }}'>
<div class='content'>
<img src='../../icons/cloud/connect-cloud.png'>
<h1>{{ 'CLOUD_INSTALL_INVITE_SCREEN_TITLE' | $$ }}</h1>
<p>{{ 'CLOUD_INSTALL_INVITE_SCREEN_MESSAGE' | $$ }}</p>
</div>
<div class='chevronWrapper'>
<core-icon icon="chevron-right"></core-icon>
</div>
</div> <!-- end of cloud -->

<div class='categoryHeader'>{{ "CHOOSE_A_SOCIAL_NETWORK" | $$ }}</div>

<template repeat='{{ n in model.networkNames }}' vertical layout>
<div hidden?='{{ n == "Cloud" }}' on-tap='{{ networkTapped }}' class='networkLoginButton' data-network='{{n}}'>
<div on-tap='{{networkTapped }}' class='networkLoginButton' data-network='{{n}}'>
<core-icon icon='uproxy-icons:{{n}}'></core-icon>
<div class='networkName'>{{getNetworkDisplayName(n)}}</div>
<!--
<span class='experimental paleText' hidden?='{{!isExperimentalNetwork(n)}}'>
(Experimental)
</span>
-->
<div class='chevronWrapper'>
<core-icon icon="chevron-right"></core-icon>
</div>
Expand Down
Loading

0 comments on commit 97025c1

Please sign in to comment.