import code

This commit is contained in:
Trevor Johnston 2018-03-14 10:42:15 -04:00
parent 75c938e026
commit c44d9f2fb9
168 changed files with 20089 additions and 4 deletions

2
.clang-format Normal file
View file

@ -0,0 +1,2 @@
BasedOnStyle: Google
ColumnLimit: 100

8
.gitignore vendored Normal file
View file

@ -0,0 +1,8 @@
.DS_Store
**/bower_components
/build
/node_modules/
/src/metrics_server/node_modules/
/src/server_manager/node_modules/
/src/server_manager/install_scripts/do_install_script.ts
yarn-error.log

135
.travis.yml Normal file
View file

@ -0,0 +1,135 @@
language: node_js
node_js:
- "8"
cache:
yarn: true
directories:
- $HOME/.cache/bower
- $HOME/.cache/electron
- $HOME/.cache/electron-builder
before_install:
# https://docs.travis-ci.com/user/languages/javascript-with-nodejs#Travis-CI-supports-yarn
- curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version 1.3.2
- export PATH="$HOME/.yarn/bin:$PATH"
stages:
- build and unit test
- integration test
- name: tag
if: type = cron
- name: deploy
if: tag =~ ^daily
- name: release
if: tag =~ ^v[0-9]
# Stages with the same name define multiple jobs which run in parallel.
# To make it more apparent in the Travis UI exactly what each job is
# doing, we add a descriptive environment variable.
jobs:
include:
# Ideally, we would split this stage in some way, e.g. by component or by
# build/test commands, to make it clearer in the Travis UI exactly which
# command failed. However, since each stage incurs a significantly start-up
# cost, we combine test and build commands for all components into one fast
# stage.
- stage: build and unit test
script:
- yarn shadowbox_install
- yarn do shadowbox/server/build
- yarn do shadowbox/test
- yarn do server_manager/electron_app/build
- yarn do server_manager/web_app/build
- yarn do server_manager/web_app/test
- stage: integration test
sudo: required
services: docker
script:
# https://docs.travis-ci.com/user/docker/
- |
sudo rm -f /usr/local/bin/docker-compose
curl -L https://github.com/docker/compose/releases/download/1.17.1/docker-compose-$(uname -s)-$(uname -m) > docker-compose
chmod +x docker-compose
sudo mv docker-compose /usr/local/bin
- yarn shadowbox_install
- yarn do shadowbox/integration_test/run
- stage: tag
script:
- RELEASE_NAME=daily-$(date -I)
- curl --data '{"tag_name":"'$RELEASE_NAME'","name":"'$RELEASE_NAME'","prerelease":true}' https://api.github.com/repos/Jigsaw-Code/outline-server/releases?access_token=$CI_USER_TOKEN
- stage: deploy
env:
- DESC=shadowbox docker image
sudo: required
services: docker
script:
- yarn shadowbox_install
- yarn do shadowbox/docker/build
- docker login quay.io -u="$QUAY_IO_USERNAME" -p="$QUAY_IO_PASSWORD"
- docker tag outline/shadowbox quay.io/outline/shadowbox:$TRAVIS_TAG
- docker push quay.io/outline/shadowbox:$TRAVIS_TAG
- docker tag outline/shadowbox quay.io/outline/shadowbox:daily
- docker push quay.io/outline/shadowbox:daily
- stage: deploy
env:
- DESC=linux manager
addons:
apt:
packages:
- rpm
script: yarn do server_manager/electron_app/package_linux
# https://www.electron.build/multi-platform-build
- stage: deploy
env:
- DESC=windows manager
sudo: required
services: docker
script:
- yarn do server_manager/electron_app/build
- docker pull electronuserland/builder:wine
- docker run --rm
-v ${PWD}:/project
-v ~/.cache/electron:/root/.cache/electron
-v ~/.cache/electron-builder:/root/.cache/electron-builder
electronuserland/builder:wine
/bin/bash -c "yarn do server_manager/electron_app/package_only_windows" || travis_terminate $?
- stage: deploy
env:
- DESC=macos manager
os: osx
script: yarn do server_manager/electron_app/package_macos
# Note that because we cannot currently build signed macOS or Windows
# binaries on Travis, those builds must be manually built and uploaded
# to the release page.
- stage: release
env:
- DESC=linux manager
addons:
apt:
packages:
- rpm
script: yarn do server_manager/electron_app/release_linux
deploy:
provider: releases
api_key:
secure: "a7JJwbwgWQpXAaGCKbMf/HySyhiBOPeyjZZkSeZBECpqS671j6rbZ2MHvXp7QfU3LZ+Z7MYwkl/DTgbdOZ8ndbwWMn5yJjeIBnreQqZlbyR5jh1G66vu+r55aBxd6+svGp2VynGlWLI+1+4L6U33VHNXnkH6D7fwSKze1glu1XqeUzUkNEPRkWCg/Y6/WGMh19yOgoxulN3mTL65s5FzFpXKdDT7F8J6BPzoz5cWXTMiZM+fs0BjTIfNNabkIWdRvVFJ5s2Cx3EJM0BU1NDRVxGeYJsvli/gkYW82ZTeQdXfn9KQxAK1n6lQsUQJUnErH6jSfrv6QJkSnnKjVogXcP/SSj0p73UAcZuUZ7hRW/TX0HAtgCxnY7dkMaxyBHiNwxprSm4+83VRHIALzUqmcJ28b6VvXo1znD3r9frDsY5PuNAmew3VbpQyxit515tZRpiRXzzSnrFqAovWl6wY0UIkQEFLpi18PGOhUFcewKBpN4W4PszGvWkPgdPNBq5nizUtaHX62lPFoPjGkhcunD4Tn9RIrUcbRTfWVokI5qT8oLZM3mgBS8H85N80ngq1tQBUCJ1Xfd3vqJ+xE0x6boIzYHs4cz0Qoao1vmo1wsycRhr1PAqvtBztAkq+pwOwd9qI9VL8QCJErHBd56I3jkPTsPgMx8K3M8N4/EtOsA0="
file_glob: true
file: "build/server_manager/electron_app/static/dist/*.*"
skip_cleanup: true
on:
tags: true
env:
global:
- ELECTRON_CACHE=$HOME/.cache/electron
- ELECTRON_BUILDER_CACHE=$HOME/.cache/electron-builder

23
CONTRIBUTING.md Normal file
View file

@ -0,0 +1,23 @@
# How to Contribute
We'd love to accept your patches and contributions to this project. There are
just a few small guidelines you need to follow.
## Contributor License Agreement
Contributions to this project must be accompanied by a Contributor License
Agreement. You (or your employer) retain the copyright to your contribution,
this simply gives us permission to use and redistribute your contributions as
part of the project. Head over to <https://cla.developers.google.com/> to see
your current agreements on file or to sign a new one.
You generally only need to submit a CLA once, so if you've already submitted one
(even if it was for a different project), you probably don't need to do it
again.
## Code reviews
All submissions, including submissions by project members, require review. We
use GitHub pull requests for this purpose. Consult
[GitHub Help](https://help.github.com/articles/about-pull-requests/) for more
information on using pull requests.

View file

@ -178,7 +178,7 @@
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
boilerplate notice, with the fields enclosed by brackets "{}"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Copyright {yyyy} {name of copyright owner}
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.

117
README.md
View file

@ -1,2 +1,115 @@
# outline-server
Create and manage access to Outline servers
# Outline Server Creator
[![Build Status](https://travis-ci.com/Jigsaw-Code/outline-server.svg?token=HiP4RTme8LSvyrP9kNJq&branch=master)](https://travis-ci.com/Jigsaw-Code/outline-server)
This repository has all the code needed to create and manage Outline servers on DigitalOcean. An Outline server runs
instances of Shadowsocks proxies and provides an API used by the Outline Manager application.
## Components
The system comprises the following components:
- **Server Manager Electron App:** an Election application that wraps the Server Manager web application and runs
natively on Desktop. It adds some extra functionality, like validation of the server self-signed certificate and interception of the DigitalOcean registration flow.
Code: `src/server_manager/electron_app`
- **Proxy Server**: a server that runs the Shadowsocks instances and a REST API to manage its users. Used as backend by the
Server Manager app.
Code: `src/shadowbox`
## Server Manager
### Setup
Ensure you have the following installed:
- [Node](https://nodejs.org/)
- [Yarn](https://yarnpkg.com/en/docs/install)
- [Wine](https://www.winehq.org/download), if you would like to generate binaries for Windows.
Install dependencies:
```
yarn
```
### Electron App
To run the electron app:
```
yarn do server_manager/electron_app/run
```
To build the app for all platforms:
```
yarn do server_manager/electron_app/package
```
The per-platform standalone apps will be at `build/electron_app/bundled`.
The per-platform standalone apps packaged for distribution will be at
`build/electron_app/packaged` in the following formats:
- Windows: zip files. Only generated if you have [wine](https://www.winehq.org/download) installed.
- Linux: tar.gz files.
- macOS: dmg files if built from macOS, zip files otherwise.
To perform a release, use
```
yarn do server_manager/electron_app/release
```
This will perform a clean and reinstall all dependencies to make sure the build is not tainted.
## Proxy Server
See [`src/shadowbox/README.md`](src/shadowbox/README.md).
## Unit Tests
To run all the tests, run `yarn test`
## Build System
We have a very simple build system based on package.json scripts that are called called using `yarn`
and a thin wrapper for what we call build "actions".
We've defined a `do` package.json script that takes an `action` parameter:
```shell
yarn do $ACTION
```
This command will define a `do_action()` function and call `${ACTION}_action.sh`, which must exist.
The called action script can use `do_action` to call its dependencies. The $ACTION parameter is
always resolved from the project root, regardless of the caller location.
The idea of `do_action` is to keep the build logic next to where the relevant code is.
It also defines two environmental variables:
- ROOT_DIR: the root directory of the project, as an absolute path.
- BUILD_DIR: where the build output should go, as an absolute path.
### Build output
Building creates the following directories under `build/`:
- `web_app/`: The Manager web app.
- `static/`: The standalone web app static files. This is what one deploys to a web server or runs with Electron.
- `electron_app/`: The launcher desktop Electron app
- `static/`: The Manager Electron app to run with the electron command-line
- `bundled/`: The Electron app bundled to run standalone on each platform
- `packaged/`: The Electron app bundles packaged as single files for distribution
- `invite_page`: the Invite Page
- `static`: The standalone static files to be deployed
- `shadowbox`: The Proxy Server
The directories have subdirectories for intermediate output:
- `ts/`: Autogenerated Typescript files
- `js/`: The output from compiling Typescript code
- `browserified/`: The output of browserifying the Javascript code
To clean up:
```
yarn run clean
```

9
jasmine.json Normal file
View file

@ -0,0 +1,9 @@
{
"spec_dir": ".",
"spec_files": [
"build/**/*.spec.js"
],
"helpers": ["src/base64mocks.js"],
"stopSpecOnExpectationFailure": false,
"random": false
}

20
package.json Normal file
View file

@ -0,0 +1,20 @@
{
"name": "outline-server",
"devDependencies": {
"@types/jasmine": "^2.5.53",
"clang-format": "^1.2.2",
"husky": "^0.14.3",
"jasmine": "^2.6.0",
"tslint": "^5.9.1",
"typescript": "^2.6.2"
},
"scripts": {
"postinstall": "yarn run server_manager_install",
"server_manager_install": "cd src/server_manager && yarn install --modules-folder ../../node_modules && yarn bower install",
"clean": "rm -rf src/server_manager/bower_components/ src/{metrics_server,server_manager}/node_modules/ build/ node_modules/ src/server_manager/install_scripts/do_install_script.ts",
"shadowbox_install": "cd src/shadowbox && yarn install --modules-folder ../../node_modules --no-bin-links",
"metrics_server_install": "cd src/metrics_server && yarn install --modules-folder ../../node_modules",
"do": "bash ./scripts/do_action.sh",
"precommit": "for i in . src/server_manager/electron_app src/metrics_server src/shadowbox; do tslint -p $i --fix; done; git-clang-format"
}
}

37
scripts/do_action.sh Executable file
View file

@ -0,0 +1,37 @@
#!/bin/bash
#
# Copyright 2018 The Outline Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
set -eux
# TODO: Because Node.js on Cygwin doesn't handle absolute paths very
# well, it would be worth pushd-ing to ROOT_DIR before invoking
# them and making BUILD_DIR a relative path, viz. just "build".
export ROOT_DIR=${ROOT_DIR:-$(git rev-parse --show-toplevel)}
export BUILD_DIR=${BUILD_DIR:-$ROOT_DIR/build}
function do_action() {
readonly STYLE_BOLD_WHITE='\033[1;37m'
readonly STYLE_RESET='\033[0m'
local action=$1
echo -e "$STYLE_BOLD_WHITE[Running $action]$STYLE_RESET"
shift
$ROOT_DIR/src/${action}_action.sh "$@"
echo -e "$STYLE_BOLD_WHITE[Done $action]$STYLE_RESET"
}
export -f do_action
do_action "$@"

View file

@ -0,0 +1,51 @@
# Outline Metrics Server
The Outline Metrics Server is built using [Google Cloud Functions](https://cloud.google.com/functions/), which lets us write a simple Node HTTP server. By deploying this server to the uproxysite Google project, we gain permission to write to uproxysite's BigQuery tables.
## Requirements
* Install `gcloud` from https://cloud.google.com/sdk/docs/
* Node 6.11.1 or greater (for testing via Cloud Functions Emulator)
* You must run `yarn metrics_server_install` explicitly to install metrics_server dependencies.
## Building
Run `yarn do metrics_server/build`
## Deploying
To deploy
* Authenticate with gcloud: `gcloud auth login`
* Select the gcloud project to uproxysite: `gcloud config set project uproxysite`
* Run the deploy script:
* to deploy to test: `yarn do metrics_server/deploy_test`
* to deploy to prod: `yarn do metrics_server/deploy_prod`
## Testing with the Cloud Functions Emulator
You can test with the Google Cloud Functions Emulator by running `yarn do metrics_server/test <test_data>`, e.g.:
```
yarn do metrics_server/test '{"serverId":"12345","startUtcMs":1502486354823,"endUtcMs":1502499314823,"userReports":[{"userId":"1","bytesTransferred":60,"countries":["US","NL"]},{"userId":"2","bytesTransferred":100,"countries":["UK"]}]}'
```
## Testing with Node
You can test the metrics server code using Node:
`cd build/metrics_server`
run `node`, then you can test the post_server_report module as follows:
```
post_server_report = require('./post_server_report.js');
serverReport = {
serverId: "123",
startUtcMs: 1502486354823,
endUtcMs: 1502499314823,
userReports: [
{userId: "1", bytesTransferred: 60, countries: ["US", "NL"]},
{userId: "2", bytesTransferred: 100, countries: ["CN"]}
]
}
post_server_report.postServerReport('uproxy_metrics_test', 'connections_v1', serverReport)
.then(() => { console.log('success') })
.catch((e) => { console.error('failure: ' + e) })
```
You can then view this inserted data at https://bigquery.cloud.google.com/table/uproxysite:uproxy_metrics_test.connections_v1

33
src/metrics_server/build.sh Executable file
View file

@ -0,0 +1,33 @@
#!/bin/bash -eux
#
# Copyright 2018 The Outline Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
if (( $# <= 1 )); then
echo "Invalid arguments, usage:"
echo "build.sh <outdir> <config>"
exit 1;
fi
readonly MODULE_DIR=$(dirname $0)
readonly OUT_DIR=$1
readonly CONFIG_FILE=$2
# Compile the server.
rm -rf $OUT_DIR
tsc -p $MODULE_DIR/tsconfig.json --outDir $OUT_DIR
cp -r $MODULE_DIR/package.json $OUT_DIR
# Copy config file.
cp -r $CONFIG_FILE $OUT_DIR/config.json

View file

@ -0,0 +1,4 @@
{
"datasetName": "uproxy_metrics",
"tableName": "connections_v1"
}

View file

@ -0,0 +1,4 @@
{
"datasetName": "uproxy_metrics_test",
"tableName": "connections_v1"
}

View file

@ -0,0 +1,25 @@
#!/bin/bash -eux
#
# Copyright 2018 The Outline Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
readonly MODULE_DIR=$(dirname $0)
readonly OUT_DIR=$BUILD_DIR/metrics_server/prod
readonly CONFIG_FILE=$MODULE_DIR/config_prod.json
# Build the server
$MODULE_DIR/build.sh $OUT_DIR $CONFIG_FILE
# Deploy as "reportHourlyConnectionMetrics"
gcloud beta functions deploy reportHourlyConnectionMetrics --stage-bucket uproxy-cloud-functions --trigger-http --source=$OUT_DIR --entry-point=reportHourlyConnectionMetrics

View file

@ -0,0 +1,25 @@
#!/bin/bash -eux
#
# Copyright 2018 The Outline Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
readonly MODULE_DIR=$(dirname $0)
readonly OUT_DIR=$BUILD_DIR/metrics_server/test
readonly CONFIG_FILE=$MODULE_DIR/config_test.json
# Build the server
$MODULE_DIR/build.sh $OUT_DIR $CONFIG_FILE
# Deploy as "reportHourlyConnectionMetricsTest"
gcloud beta functions deploy reportHourlyConnectionMetricsTest --stage-bucket uproxy-cloud-functions --trigger-http --source=$OUT_DIR --entry-point=reportHourlyConnectionMetrics

View file

@ -0,0 +1,55 @@
// Copyright 2018 The Outline Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import * as express from 'express';
import * as fs from 'fs';
import * as path from 'path';
import {HourlyServerMetricsReport, isValidServerReport, postServerReport} from './post_server_report';
// Accepts hourly connection metrics and inserts them into BigQuery.
// Request body should contain an HourlyServerMetricsReport.
exports.reportHourlyConnectionMetrics = (req: express.Request, res: express.Response) => {
if (req.method !== 'POST') {
res.status(405).send('Method not allowed');
return;
}
if (!isValidServerReport(req.body)) {
res.status(400).send('Invalid request');
return;
}
const serverReport: HourlyServerMetricsReport = {
serverId: req.body.serverId,
startUtcMs: req.body.startUtcMs,
endUtcMs: req.body.endUtcMs,
userReports: req.body.userReports
};
postServerReport(config.datasetName, config.tableName, serverReport).then(() => {
res.status(200).send('OK');
}).catch((err: Error) => {
res.status(500).send('Error: ' + err);
});
};
interface Config {
datasetName: string;
tableName: string;
}
function loadConfig(): Config {
const configText = fs.readFileSync(path.join(__dirname, 'config.json'), {encoding: 'utf8'});
return JSON.parse(configText);
}
const config = loadConfig();

View file

@ -0,0 +1,15 @@
{
"name": "outline-metrics-server",
"private": true,
"version": "0.1.0",
"description": "Outline metrics server",
"author": "Outline",
"license": "Apache",
"dependencies": {
"@google-cloud/bigquery": "^0.9.6"
},
"devDependencies": {
"@google-cloud/functions-emulator": "1.0.0-alpha.23",
"@types/express": "^4.0.36"
}
}

View file

@ -0,0 +1,118 @@
// Copyright 2018 The Outline Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import * as bigquery from '@google-cloud/bigquery';
// TODO(dborkan): HourlyServerMetricsReport and HourlyUserMetricsReport are
// copied from src/shadowbox/server/metrics.ts - find a way to share these
// definitions between shadowbox and the metrics_server.
export interface HourlyServerMetricsReport {
serverId: string;
startUtcMs: number;
endUtcMs: number;
userReports: HourlyUserMetricsReport[];
}
interface HourlyUserMetricsReport {
userId: string;
countries: string[];
bytesTransferred: number;
}
interface ConnectionRow {
serverId: string;
startTimestamp: string; // ISO formatted string.
endTimestamp: string; // ISO formatted string.
userId: string;
bytesTransferred: number;
countries: string[];
}
// Instantiates a client
const bigqueryProject = bigquery({
projectId: 'uproxysite'
});
export function postServerReport(datasetName: string, tableName: string, serverReport: HourlyServerMetricsReport) {
const dataset = bigqueryProject.dataset(datasetName);
const table = dataset.table(tableName);
const rows = getConnectionRowsFromServerReport(serverReport);
return new Promise((fulfill, reject) => {
table.insert(rows, (err: Error) => {
if (err) {
reject(err);
} else {
fulfill();
}
});
});
}
function getConnectionRowsFromServerReport(serverReport: HourlyServerMetricsReport): ConnectionRow[] {
const startTimestampStr = new Date(serverReport.startUtcMs).toISOString();
const endTimestampStr = new Date(serverReport.endUtcMs).toISOString();
const rows = [];
for (const userReport of serverReport.userReports) {
rows.push({
serverId: serverReport.serverId,
startTimestamp: startTimestampStr,
endTimestamp: endTimestampStr,
userId: userReport.userId,
bytesTransferred: userReport.bytesTransferred,
countries: userReport.countries
});
}
return rows;
}
// Returns true iff testObject contains a valid HourlyServerMetricsReport.
// tslint:disable-next-line:no-any
export function isValidServerReport(testObject: any): boolean {
// Check that all required fields are present.
const requiredServerReportFields = ['serverId', 'startUtcMs', 'endUtcMs', 'userReports'];
for (const fieldName of requiredServerReportFields) {
if (!testObject[fieldName]) {
return false;
}
}
// Check that startUtcMs is not after endUtcMs.
if (testObject.startUtcMs >= testObject.endUtcMs) {
return false;
}
// Check that userReports is an array of 1 or more item.
if (!(testObject.userReports.length >= 1)) {
return false;
}
const requiredUserReportFields = ['userId', 'countries', 'bytesTransferred'];
const MIN_BYTES_TRANSFERRED = 0;
const MAX_BYTES_TRANSFERRED = 500 * Math.pow(2, 30); // 500 GB.
for (const userReport of testObject.userReports) {
// Test that each userReport contains valid fields.
for (const fieldName of requiredUserReportFields) {
if (!userReport[fieldName]) {
return false;
}
}
// Check that bytesTransferred is between min and max transfer limits
if (userReport.bytesTransferred < MIN_BYTES_TRANSFERRED ||
userReport.bytesTransferred > MAX_BYTES_TRANSFERRED) {
return false;
}
}
// Request is a valid HourlyServerMetricsReport.
return true;
}

View file

@ -0,0 +1,34 @@
#!/bin/bash -eux
#
# Copyright 2018 The Outline Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
if (( $# <= 0 )); then
echo "No test data specified"
exit 1;
fi
readonly MODULE_DIR=$(dirname $0)
readonly OUT_DIR=$BUILD_DIR/metrics_server/test
readonly CONFIG_FILE=$MODULE_DIR/config_test.json
# Build the server
$MODULE_DIR/build.sh $OUT_DIR $CONFIG_FILE
# TODO(dborkan): figure out why the functions binary isn't installed at $ROOT_DIR/node_modules/.bin/
readonly FUNCTIONS_EMULATOR=$ROOT_DIR/node_modules/@google-cloud/functions-emulator/bin/functions
$FUNCTIONS_EMULATOR start
$FUNCTIONS_EMULATOR deploy reportHourlyConnectionMetrics --trigger-http --local-path=$OUT_DIR --entry-point=reportHourlyConnectionMetrics
$FUNCTIONS_EMULATOR call reportHourlyConnectionMetrics --data=$1

View file

@ -0,0 +1,22 @@
{
"compilerOptions": {
"target": "es2016",
"removeComments": false,
"noImplicitAny": true,
"module": "commonjs",
"rootDir": ".",
"lib": [
"dom",
"es2016"
]
},
"include": [
"index.ts",
"post_server_report.ts",
"types/**/*.d.ts"
],
"exclude": [
"node_modules"
],
"compileOnSave": true
}

View file

@ -0,0 +1,19 @@
// Copyright 2018 The Outline Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Definitions missing from @types/node.
// TODO(dborkan): Find a *.d.ts file with this definition. The API is defined at
// https://googlecloudplatform.github.io/google-cloud-node/#/docs/bigquery/0.9.6/bigquery
declare module '@google-cloud/bigquery';

1981
src/metrics_server/yarn.lock Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,37 @@
{
"name": "outline-launcher",
"description": "Launches Outline Shadowsocks servers on the cloud",
"main": "",
"authors": [
"Outline"
],
"license": "Apache",
"private": true,
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"test",
"tests"
],
"dependencies": {
"app-layout": "PolymerElements/app-layout#^2.0.4",
"iron-autogrow-textarea": "PolymerElements/iron-autogrow-textarea#^2.1.1",
"iron-icons": "PolymerElements/iron-icons#^2.0.1",
"iron-fit-behavior": "PolymerElements/iron-fit-behavior#^2.1.0",
"iron-pages": "PolymerElements/iron-pages#^2.0.1",
"paper-button": "PolymerElements/paper-button#^2.0.0",
"paper-dialog": "PolymerElements/paper-dialog#^2.0.1",
"paper-dialog-scrollable": "PolymerElements/paper-dialog-scrollable#^2.1.0",
"paper-dropdown-menu": "PolymerElements/paper-dropdown-menu#^2.0.2",
"paper-icon-button": "PolymerElements/paper-icon-button#^2.0.1",
"paper-input": "PolymerElements/paper-input#^2.1.0",
"paper-item": "PolymerElements/paper-item#^2.0.0",
"paper-listbox": "PolymerElements/paper-listbox#^2.0.0",
"paper-progress": "PolymerElements/paper-progress#^2.0.1",
"paper-toast": "PolymerElements/paper-toast#^2.0.0",
"paper-toggle-button": "PolymerElements/paper-toggle-button#^2.0.0",
"web-animations-js": "web-animations/web-animations-js",
"webcomponentsjs": "webcomponents/webcomponentsjs#^v1.1.0"
}
}

View file

@ -0,0 +1,228 @@
// Copyright 2018 The Outline Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import * as events from 'events';
import * as errors from '../infrastructure/errors';
export interface DigitalOceanDropletSpecification {
installCommand: string;
size: string;
image: string;
tags: string[];
}
// Returns an OAuth redirect URL for DigitalOcean.
export function getOauthUrl(clientId: string, redirectUri: string, state?: string): string {
return 'https://cloud.digitalocean.com/v1/oauth/authorize?' +
'client_id=' + clientId + '&' +
'response_type=token&' +
'redirect_uri=' + encodeURIComponent(redirectUri) + '&' +
'state=' + encodeURIComponent(state || '') + '&' +
'scope=read%20write';
}
// See definition and example at
// https://developers.digitalocean.com/documentation/v2/#retrieve-an-existing-droplet-by-id
export type DropletInfo = Readonly < {
id: number;
status: 'new'|'active';
tags: string[];
region: {readonly slug: string;};
size: Readonly < {
transfer: number;
price_monthly: number;
}
> ;
networks: Readonly < {
v4: ReadonlyArray < Readonly < {
type: string;
ip_address: string;
}
>> ;
}
> ;
}
> ;
// Reference:
// https://developers.digitalocean.com/documentation/v2/#get-user-information
export type Account = Readonly < {
email: string;
uuid: string;
email_verified: boolean;
status: string;
}
> ;
// Reference:
// https://developers.digitalocean.com/documentation/v2/#regions
export type RegionInfo = Readonly < {
slug: string;
name: string;
sizes: string[];
available: boolean;
features: string[];
}
> ;
// Marker class for errors due to network or authentication.
// See below for more details on when this is raised.
export class XhrError extends errors.OutlineError {
constructor() {
// No message because XMLHttpRequest.onerror provides no useful info.
super();
}
}
// This class contains methods to interact with DigitalOcean on behalf of a user.
export interface DigitalOceanSession {
accessToken: string;
getAccount(): Promise<Account>;
createDroplet(
displayName: string, region: string, publicKeyForSSH: string,
dropletSpec: DigitalOceanDropletSpecification): Promise<{droplet: DropletInfo}>;
deleteDroplet(dropletId: number): Promise<void>;
getRegionInfo(): Promise<RegionInfo[]>;
getDroplet(dropletId: number): Promise<DropletInfo>;
getDropletTags(dropletId: number): Promise<string[]>;
getDropletsByTag(tag: string): Promise<DropletInfo[]>;
getDroplets(): Promise<DropletInfo[]>;
}
export function createDigitalOceanSession(accessToken: string): DigitalOceanSession {
return new RestApiSession(accessToken);
}
class RestApiSession implements DigitalOceanSession {
// Constructor takes a DigitalOcean access token, which should have
// read+write permissions.
constructor(public accessToken: string) {}
public getAccount(): Promise<Account> {
return this.request<{account: Account}>('GET', 'account/').then((response) => {
return response.account;
});
}
public createDroplet(
displayName: string, region: string, publicKeyForSSH: string,
dropletSpec: DigitalOceanDropletSpecification): Promise<{droplet: DropletInfo}> {
const dropletName = makeValidDropletName(displayName);
// Register a key with DigitalOcean, so the user will not get a potentially
// confusing email with their droplet password, which could get mistaken for
// an invite.
return this.registerKey_(dropletName, publicKeyForSSH).then((keyId: number) => {
return this.request<{droplet: DropletInfo}>('POST', 'droplets', {
name: dropletName,
region,
size: dropletSpec.size,
image: dropletSpec.image,
ssh_keys: [keyId],
user_data: dropletSpec.installCommand,
tags: dropletSpec.tags,
ipv6: true,
});
});
}
public deleteDroplet(dropletId: number): Promise<void> {
return this.request<void>('DELETE', 'droplets/' + dropletId);
}
public getRegionInfo(): Promise<RegionInfo[]> {
return this.request<{regions: RegionInfo[]}>('GET', 'regions').then((response) => {
return response.regions;
});
}
// Registers a SSH key with DigitalOcean.
private registerKey_(keyName: string, publicKeyForSSH: string): Promise<number> {
return this
.request<{ssh_key: {id: number}}>(
'POST', 'account/keys', {name: keyName, public_key: publicKeyForSSH})
.then((response) => {
return response.ssh_key.id;
});
}
public getDroplet(dropletId: number): Promise<DropletInfo> {
return this.request<{droplet: DropletInfo}>('GET', 'droplets/' + dropletId).then((response) => {
return response.droplet;
});
}
public getDropletTags(dropletId: number): Promise<string[]> {
return this.getDroplet(dropletId).then((droplet: DropletInfo) => {
return droplet.tags;
});
}
public getDropletsByTag(tag: string): Promise<DropletInfo[]> {
return this.request<{droplets: DropletInfo[]}>('GET', `droplets/?tag_name=${encodeURI(tag)}`)
.then((response) => {
return response.droplets;
});
}
public getDroplets(): Promise<DropletInfo[]> {
return this.request<{droplets: DropletInfo[]}>('GET', 'droplets/').then((response) => {
return response.droplets;
});
}
// Makes an XHR request to DigitalOcean's API, returns a promise which fulfills
// with the parsed object if successful.
private request<T>(method: string, actionPath: string, data?: {}): Promise<T> {
return new Promise<T>((resolve, reject) => {
const xhr = new XMLHttpRequest();
xhr.open(method, `https://api.digitalocean.com/v2/${actionPath}`);
xhr.setRequestHeader('Authorization', `Bearer ${this.accessToken}`);
xhr.setRequestHeader('Content-Type', 'application/json');
xhr.onload = () => {
// DigitalOcean may return any 2xx status code for success.
if (xhr.status >= 200 && xhr.status <= 299) {
// Parse JSON response if available. For requests like DELETE
// this.response may be empty.
const responseObj = (xhr.response ? JSON.parse(xhr.response) : {});
resolve(responseObj);
} else {
// this.response is a JSON object, whose message is an error string.
const responseJson = JSON.parse(xhr.response);
reject(new Error(
`XHR ${responseJson.id} failed with ${xhr.status}: ${responseJson.message}`));
}
};
xhr.onerror = () => {
// This is raised for both network-level and CORS (authentication)
// problems. Since there is, by design for security reasons, no way
// to programmatically distinguish the two (the error instance
// passed to this handler has *no* useful information), we should
// prompt the user for whether to retry or re-authenticate against
// DigitalOcean (this isn't so bad because application-level
// errors, e.g. bad request parameters and even 404s, do *not* raise
// an onerror event).
reject(new XhrError());
};
xhr.send(data ? JSON.stringify(data) : undefined);
});
}
}
// Removes invalid characters from input name so it can be used with
// DigitalOcean APIs.
function makeValidDropletName(name: string): string {
// Remove all characters outside of A-Z, a-z, 0-9 and '-'.
return name.replace(/[^A-Za-z0-9\-]/g, '');
}

View file

@ -0,0 +1,53 @@
#!/bin/bash -eux
#
# Copyright 2018 The Outline Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Builds the Electron App
readonly OUT_DIR=$BUILD_DIR/server_manager/electron_app
rm -rf $OUT_DIR
readonly NODE_MODULES_BIN_DIR=$ROOT_DIR/src/server_manager/node_modules/.bin
# Build the Web App.
do_action server_manager/web_app/build
# Compile the Electron app source.
# Since Node.js on Cygwin doesn't like absolute Unix-style paths,
# we'll use relative paths here.
tsc -p src/server_manager/electron_app/tsconfig.json --outDir build/server_manager/electron_app/js
# Assemble everything together.
readonly MODULE_DIR=$(dirname $0)
readonly STATIC_DIR=$OUT_DIR/static
mkdir -p $STATIC_DIR
mkdir -p $STATIC_DIR/server_manager
cp -r $OUT_DIR/js/* $STATIC_DIR
cp -r $BUILD_DIR/server_manager/web_app/static $STATIC_DIR/server_manager/web_app/
cp $MODULE_DIR/config.json $STATIC_DIR
# Our electron app assumes all HTML files will be in the web_app directory.
cp $MODULE_DIR/loading.html $STATIC_DIR/server_manager/web_app/
# Electron requires a package.json file for the app's name, etc.
# We also need to install NPMs at this location for require()
# in order for require() to work right in the renderer process, which
# is loaded via a custom protocol.
cp src/server_manager/package.json yarn.lock $STATIC_DIR
cd $STATIC_DIR
yarn install --prod --ignore-scripts
# Icons.
cd $ROOT_DIR
$NODE_MODULES_BIN_DIR/electron-icon-maker --input=src/server_manager/images/launcher-icon.png --output=build/server_manager/electron_app/static

View file

@ -0,0 +1,4 @@
{
"version": "1.0.0",
"releaseDataUrl": "https://raw.githubusercontent.com/Jigsaw-Code/outline-server/master/release/release_data.json"
}

View file

@ -0,0 +1,476 @@
// Copyright 2018 The Outline Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import * as electron from 'electron';
const ipcRenderer = electron.ipcRenderer;
export function modifyUiIfDigitalOcean() {
// Wait for load event, to ensure that the currentUser object is loaded.
// For most signed-in DigitalOcean pages, currentUser is set via inline
// <script> tags in the HTML <head>.
window.addEventListener('load', () => {
if (window.location.host === 'cloud.digitalocean.com') {
const DIGITAL_OCEAN_POLLING_INTERVAL = 200;
let lastScreen: DigitalOceanScreen;
const updateUIOnScreenChange = () => {
getActiveDigitalOceanScreen().then((activeScreen: DigitalOceanScreen) => {
if (activeScreen === lastScreen) {
// Screen hasn't changed, nothing to do.
return;
} else if (activeScreen === DigitalOceanScreen.CREATE_DROPLETS) {
// User is on droplet creation screen, redirect them to OAuth
redirectToOAuth();
} else if (activeScreen === DigitalOceanScreen.EMAIL_VERIFICATION) {
updateUIForEmailVerification();
} else if (activeScreen === DigitalOceanScreen.BILLING) {
updateUIForBilling();
} else if (activeScreen === DigitalOceanScreen.OAUTH) {
if (!isBillingEnabled()) {
// User has not entered any billing info, redirect them to the
// welcome screen before they can complete OAuth. Without
// entering billing info, users cannot create droplets.
window.location.replace('https://cloud.digitalocean.com/welcome');
return;
}
updateUIForOAuth();
} else if (activeScreen === DigitalOceanScreen.REGISTRATION) {
updateUIForRegistration();
} else {
updateUIForUnknownDigitalOcean();
}
lastScreen = activeScreen;
});
};
setInterval(updateUIOnScreenChange, DIGITAL_OCEAN_POLLING_INTERVAL);
updateUIOnScreenChange(); // Invoke immediately to not wait for the interval.
blockDigitalOceanNotifications();
} else if (window.location.host.indexOf('digitalocean.com') >= 0) {
updateUIForUnknownDigitalOcean();
}
});
}
// Screens in DigitalOcean signup process.
enum DigitalOceanScreen {
// User is not on DigitalOcean or is on an unknown screen.
NONE = 0,
// User is being asked to verify their email address.
EMAIL_VERIFICATION,
// User is being asked for billing, after verifying their email.
BILLING,
// User is being asked to create their first droplet.
CREATE_DROPLETS,
// User is asked to permission Outline to modify their DigitalOcean account.
OAUTH,
// User is entering the email and password for registering a new DigitalOcean account.
REGISTRATION
// TODO(dborkan): These screens are not yet used but will be as we improve upon
// the DigitalOcean sign up.
// LOGIN,
}
// Create a promise to be fulfilled when window.onload is fired.
const onceWindowOnload = new Promise((fulfill, reject) => {
window.addEventListener('load', fulfill);
});
class DigitalOceanUser {
constructor(private uuid: string) {}
// Requires that this.uuid is the user currently logged in and that we
// are on cloud.digitalocean.com, so that XHR passes the correct
// authentication cookies to DigitalOcean.
public getOnboardingStep(): Promise<string> {
const url = 'https://cloud.digitalocean.com/api/v1/users/' + this.uuid;
return new Promise((fulfill, reject) => {
const xhr = new XMLHttpRequest();
xhr.open('GET', url);
xhr.onload = function() {
try {
fulfill(JSON.parse(this.response).user.onboarding_step);
} catch (e) {
// Error parsing user.
reject(new Error('Error getting onboarding_step: ' + e));
}
}.bind(xhr);
xhr.onerror = (e: ErrorEvent) => {
reject(new Error('Error refreshing user: ' + e));
};
xhr.send();
});
}
}
function redirectToOAuth() {
// Use client_id and redirect_uri set for Outline electron app.
// Note we cannot include the web_app/main.ts or cloud/digitalocean_api.ts
// libraries in this file due to them being located outside the electron_app
// root directory.
// TODO(dborkan): refactor DigitalOcean OAuth library for use in both the electron_app
// and web_app compilation steps.
window.location.href = 'https://cloud.digitalocean.com/v1/oauth/authorize' +
'?client_id=b171ddd0ee117cc0258cf1a4e8b75c0896a0a2d99724af30770de6d9c2eea71e' +
'&response_type=token' +
'&redirect_uri=' + encodeURIComponent('https://www.getoutline.org/digitalocean_oauth') +
'&state=' +
'&scope=read%20write';
}
interface DigitaloceanWindow extends Window {
currentUser: {uuid: string; payment_method: string;};
}
function getActiveDigitalOceanScreen(): Promise<DigitalOceanScreen> {
// First, handle the case where we just ignore
if (window.location.host !== 'cloud.digitalocean.com') {
return Promise.resolve(DigitalOceanScreen.NONE);
}
// Note: /droplets URL is also used for the EMAIL_VERIFICATION screen,
// don't depend on it.
const digitalOceanScreenByPathname: {[path: string]: DigitalOceanScreen} = {
// TODO(dborkan): for future DigitalOcean sign up enhancements, we can use
// more of this map of pathname to DigitalOceanScreen.
'/v1/oauth/authorize': DigitalOceanScreen.OAUTH,
// '/login': DigitalOceanScreen.LOGIN,
'/registrations/new': DigitalOceanScreen.REGISTRATION
};
if (window.location.pathname in digitalOceanScreenByPathname) {
return Promise.resolve(digitalOceanScreenByPathname[window.location.pathname]);
}
// Create a DigitalOceanUser based on the global currentUser set by
// DigitalOcean.
const globalCurrentUser = (window as DigitaloceanWindow).currentUser;
if (!globalCurrentUser || !globalCurrentUser.uuid) {
return Promise.resolve(DigitalOceanScreen.NONE);
}
const digitalOceanUser = new DigitalOceanUser(globalCurrentUser.uuid);
// Return DigitalOceanScreen based on the user's onboarding step
return digitalOceanUser.getOnboardingStep()
.then((onboardingStep: string) => {
if (onboardingStep === 'activated' || onboardingStep === 'established') {
// User may either be on the /welcome screen "Create Droplets" step or
// the /droplets screen.
return DigitalOceanScreen.CREATE_DROPLETS;
} else if (onboardingStep === 'confirmed') {
return DigitalOceanScreen.BILLING;
} else if (onboardingStep === 'registered') {
return DigitalOceanScreen.EMAIL_VERIFICATION;
}
return DigitalOceanScreen.NONE;
})
.catch((e: Error) => {
// currentUser.onboarding_step is not available, not an error.
return DigitalOceanScreen.NONE;
});
}
// Like Chrome js console's `$` function.
function $(selector: string, root = document): HTMLElement {
// Need to cast return type as HTMLElement to get around TypeScript
// Property 'style' does not exist on type 'Element' errors.
return root.querySelector(selector) as HTMLElement;
}
// Like Chrome js console's `$$` function.
function $$(selector: string, root = document): HTMLElement[] {
return Array.prototype.slice.call(root.querySelectorAll(selector));
}
function hideBySelector(selector: string) {
return $$(selector).forEach((el: HTMLElement) => {
el.style.display = 'none';
});
}
function updateDigitalOceanWelcomeStyles() {
const isReady = $$('.welcome-stages').length > 0;
if (!isReady) {
// Welcome pages are not yet fully set up, try again later.
const WELCOME_STYLE_RETRY_MS = 200;
setTimeout(updateDigitalOceanWelcomeStyles, WELCOME_STYLE_RETRY_MS);
return;
}
// Remove minimum width so everything can fit inside our electron window.
const auroraContainer = $('#aurora-container');
if (auroraContainer) {
auroraContainer.style.minWidth = '0';
}
// Set width container width to 100% to remove margins.
const welcomeStages = $$('.welcome-stages');
if (welcomeStages.length > 0) {
welcomeStages[0].style.width = '100%';
}
// Hide creation steps, since they mention a 3rd "Create Droplet" step.
hideBySelector('.creation-steps');
// Hide nav-bar to remove welcome and support links.
hideBySelector('.nav-bar');
}
function updateUIForEmailVerification() {
onceWindowOnload.then(() => {
updateDigitalOceanWelcomeStyles();
const bannerText =
'Confirm your email and continue here. Close the DigitalOcean browser window once your email is confirmed.';
addDigitalOceanSignupBanner(bannerText);
addDigitalOceanFooter();
});
}
function updateUIForOAuth() {
onceWindowOnload.then(() => {
// Remove minimum width so everything can fit inside our electron window.
$$('#aurora-container').forEach((el) => el.style.minWidth = '0');
// Fix word break of titles.
$$('h1').forEach((el) => el.style.wordBreak = 'normal');
// Hide nav-bar to remove welcome link.
hideBySelector('.nav-bar');
// Widen column so more text fits above-the-fold.
$$('div.small-8.columns.small-centered.u-textAlignCenter').forEach((el) => {
el.style.width = '100%';
el.style.padding = '20px';
});
const bannerText =
'Give Outline permission to use your DigitalOcean account. This will only be used to install the Outline server software.';
addDigitalOceanSignupBanner(bannerText);
addDigitalOceanFooter();
});
}
function updateUIForRegistration() {
onceWindowOnload.then(() => {
hideBySelector('.logo');
hideBySelector('.registration-message');
const bannerText =
'Sign up with DigitalOcean to get a server with 500 GB of data transfer for $5 USD per month. Cancel at anytime.';
addDigitalOceanSignupBanner(bannerText);
addDigitalOceanFooter();
// Add topMargin to #new_user
const newUser = $('#new_user');
if (newUser) {
newUser.style.marginTop = '20px';
}
});
}
function updateUIForUnknownDigitalOcean() {
onceWindowOnload.then(() => {
addDigitalOceanSignupBanner();
addDigitalOceanFooter();
// Hide DigitalOcean header (e.g. from https://www.digitalocean.com/legal/privacy/)
// and undo top margin to bring Outline header to the top of the page.
hideBySelector('.Page-header');
const htmlNode = document.childNodes[1] as HTMLElement;
if (htmlNode && htmlNode.nodeName === 'HTML') {
htmlNode.style.marginTop = '0';
}
});
}
function updateUIForBilling() {
onceWindowOnload.then(() => {
// Bring electron window to the front, as user was probably just redirected
// to the billing screen in their default web browser.
ipcRenderer.send('bring-to-front');
updateDigitalOceanWelcomeStyles();
const bannerText =
'DigitalOcean will charge you $5 USD a month for your server. You can cancel at anytime.';
addDigitalOceanSignupBanner(bannerText);
addDigitalOceanFooter();
});
}
function addDigitalOceanSignupBanner(text?: string) {
// Check if banner already exists (e.g. it may exist if the user advanced from
// the email-verification to billing screens without the screen being completely
// cleared);
let bannerDiv = document.getElementById('outlineBanner');
if (!bannerDiv) {
bannerDiv = document.createElement('div');
bannerDiv.id = 'outlineBanner';
document.body.insertBefore(bannerDiv, document.body.firstChild);
}
// Set global function to take the user back to the Outline home screen.
// tslint:disable-next-line:no-any
(window as any).showOutlineHome = () => {
// .go takes the offset from the current page. To return to the Outline
// home, we need to go back to page 1. e.g. if window.history.length is
// 3, we need to go -2 pages.
window.history.go(-1 * (window.history.length - 1));
};
// Set the HTML for the banner. Since the banner will appear on DigitalOcean pages,
// we should not rely on any frameworks like Polymer, as they might conflict with
// existing frameworks on those pages.
// All class names should begin with Outline to ensure no collisions.
bannerDiv.innerHTML = `
<link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500" rel="stylesheet">
<style>
#outlineBanner {
font-family: "Roboto", sans-serif;
font-size: 14px;
font-weight: 400;
color: rgba(0,0,0,0.54);
background-color: #FAFAFA;
box-shadow: 0 3px 5px 0 rgba(0,0,0,0.10), 0 2px 4px 0 rgba(0,0,0,0.1), 0 4px 4px 0 rgba(0,0,0, .12);
}
#outlineBanner .getStarted{
font-family: "Roboto", sans-serif;
font-size: 18px;
color: #ffffff;
line-height: 32px;
font-weight: 400;
margin-left: 24px;
}
#outlineBanner .outlineAppHeader {
background-color: #263238;
height: 64px;
padding: 16px;
}
#outlineBanner .outlineAppHeader a {
cursor: pointer;
}
#outlineBanner .outlineStep {
display: inline-block;
}
#outlineBanner .outlineStepContainer {
padding: 24px 0px 24px 0px;
text-align: center;
}
#outlineBanner .outlineStepContainer hr {
width: 46px;
border-width: 0px 0px 1px 0px;
border-style: solid;
border-color: rgba(0, 0, 0, 0.24);
margin: 0px 24px 2px 24px;
border: 1px, 1px, 1px, 1px;
display: inline-block;
}
#outlineBanner .outlineStepCircle {
color: white;
background-color: black;
border-radius: 50%;
width: 26px;
height: 26px;
display: inline-block;
vertical-align: middle;
}
#outlineBanner .stepTextTwo {
font-weight: 500;
font-family: "Roboto", sans-serif;
color: rgba(0,0,0,0.34);
margin-left: 12px;
}
#outlineBanner .stepTextOne {
font-family: "Roboto", sans-serif;
color: rgba(0,0,0,0.87);
font-weight: 500;
margin-left: 12px;
}
#outlineBanner .outlineStepNumber {
font-family: "Roboto", sans-serif;
padding-top: 5px;
}
#outlineBanner .outlineText {
font-family: "Roboto", sans-serif;
font-weight: 400;
line-height: 28px;
font-size: 14px;
padding: 0px 12% 24px 12%;
text-align: center;
color: rgba(0, 0, 0, 0.87);
}
</style>
<div class='outlineAppHeader'>
<a onclick="showOutlineHome()"><img src="outline://web_app/images/back.svg"></a>
<span class="getStarted">Get started</span>
</div>
`;
if (text) {
bannerDiv.innerHTML += `
<div class="outlineStepContainer">
<div class="outlineStep">
<span class="outlineStepCircle"><div class="outlineStepNumber">1</div></span>
<span class="stepTextOne">Choose a server</span>
</div>
<hr></hr>
<div class="outlineStep">
<span class="outlineStepCircle" style="background-color: #b8b8b8"><div class="outlineStepNumber">2</div></span>
<span class="stepTextTwo">Set up Outline</span>
</div>
</div>
<div class='outlineText'>${text}</div>
`;
}
}
function addDigitalOceanFooter() {
if (document.getElementById('outlineFooter')) {
// Footer already exists (e.g. it may exist if the user advanced from
// the email-verification to billing screens without the screen being completely
// cleared).
return;
}
const footerDiv = document.createElement('div');
footerDiv.id = 'outlineFooter';
footerDiv.innerHTML = `
<style>
#outlineFooter {
font-family: "Roboto", sans-serif;
font-size: 12px;
font-weight: 400;
color: rgba(0,0,0,0.54);
background-color: #ECEFF1;
text-align: right;
padding: 6px 0 6px 0;
position: fixed;
bottom: 0;
width: 100%;
}
#outlineFooter a {
text-decoration: none;
padding-right: 20px;
color: rgba(0,0,0,0.54);
}
</style>
<a href="https://s3.amazonaws.com/outline-vpn/index.html#/support/dataCollection">Data Collection</a>
<a href="https://www.google.com/policies/privacy/">Privacy</a>
<a href="https://s3.amazonaws.com/outline-vpn/static_downloads/Outline-Terms-of-Service.html">Terms</a>
`;
document.body.insertBefore(footerDiv, null);
}
function blockDigitalOceanNotifications() {
function dismiss() {
hideBySelector('.Modal-backdrop');
hideBySelector('.aurora-news-modal');
// Hide notifications like "NYC Network Connectivity".
hideBySelector('.status-notification');
}
// Attempt to dismiss popups every DISMISS_INTERVAL_MS.
const DISMISS_INTERVAL_MS = 1000;
setInterval(dismiss, DISMISS_INTERVAL_MS);
dismiss();
}
function isBillingEnabled(): boolean {
const currentUser = (window as DigitaloceanWindow).currentUser;
return currentUser && currentUser.payment_method !== null;
}

View file

@ -0,0 +1,232 @@
// Copyright 2018 The Outline Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import * as electron from 'electron';
import * as fs from 'fs';
import * as path from 'path';
import * as url from 'url';
import {LoadingWindow} from './loading_window';
import * as menu from './menu';
import {checkForUpdates} from './update_checker';
const app = electron.app;
const ipcMain = electron.ipcMain;
const shell = electron.shell;
const debugMode = process.env.OUTLINE_DEBUG === 'true';
// prevent window being garbage collected
let mainWindow: Electron.BrowserWindow;
electron.protocol.registerStandardSchemes(['outline']);
app.on('ready', () => {
const menuTemplate = menu.getMenuTemplate(debugMode);
if (menuTemplate.length > 0) {
electron.Menu.setApplicationMenu(electron.Menu.buildFromTemplate(menuTemplate));
}
// Register a custom protocol so we can use absolute paths in the web app.
// This also acts as a kind of chroot for the web app, so it cannot access
// the user's filesystem (important for the DigitalOcean pages we customise).
// Hostnames are ignored.
electron.protocol.registerFileProtocol(
'outline',
(request, callback) => {
const appPath = new url.URL(request.url).pathname;
const filesystemPath = path.join(__dirname, 'server_manager/web_app', appPath);
callback(filesystemPath);
},
(error) => {
if (error) {
throw new Error('Failed to register outline protocol');
}
});
mainWindow = createMainWindow();
});
// Set of fingerprints. All values are true.
const trustedFingerprints = new Set<string>();
interface IpcEvent {
returnValue: {};
}
ipcMain.on('whitelist-certificate', (event: IpcEvent, fingerprint: string) => {
const prefix = 'sha256/';
const electronFormFingerprint = prefix + fingerprint;
trustedFingerprints.add(electronFormFingerprint);
event.returnValue = true;
});
ipcMain.on('clear-digital-ocean-cookies', (event: IpcEvent) => {
// Clear cookies and then return asynchronously.
mainWindow.webContents.session.clearStorageData({storages: ['cookies']}, () => {
event.returnValue = true;
});
});
// Restores the mainWindow if minimized and brings it into focus.
ipcMain.on('bring-to-front', (event: IpcEvent) => {
if (mainWindow.isMinimized()) {
mainWindow.restore();
}
mainWindow.focus();
});
app.on('certificate-error', (event, webContents, url, error, certificate, callback) => {
event.preventDefault();
const isValid = trustedFingerprints.has(certificate.fingerprint);
callback(isValid);
});
function startsWith(larger: string, prefix: string) {
return larger.substr(0, prefix.length) === prefix;
}
function createMainWindow() {
const win = new electron.BrowserWindow({
width: 600,
height: 768,
resizable: false,
icon: path.join(__dirname, 'web_app', 'ui_components', 'icons', 'launcher.png'),
webPreferences: {
nodeIntegration: false,
preload: path.join(__dirname, 'preload.js'),
nativeWindowOpen: true
}
});
const webAppUrl = getWebAppUrl();
win.loadURL(webAppUrl);
win.webContents.on('did-get-redirect-request', (event: Event, oldUrl: string, newUrl: string) => {
console.log('[did-get-redirect-request] to %s from %s', newUrl, oldUrl);
const parts = newUrl.split('#');
if (parts.length === 2 && parts[0] === 'https://www.getoutline.org/digitalocean_oauth') {
// OAuth callback.
event.preventDefault();
win.loadURL(`${webAppUrl}#${parts[1]}`);
}
});
const loadingWindow = new LoadingWindow(win, 'outline://web_app/loading.html');
const LOADING_WINDOW_DELAY_MS = 3000;
const handleNavigation = (event: Event, url: string) => {
if (!isWhitelistedUrl(url)) {
shell.openExternal(url);
event.preventDefault();
}
};
win.webContents.on('will-navigate', (event: Event, url: string) => {
handleNavigation(event, url);
if (url.startsWith('http') && isWhitelistedUrl(url)) {
loadingWindow.showInMs(LOADING_WINDOW_DELAY_MS);
}
});
win.webContents.on('new-window', handleNavigation.bind(this));
win.webContents.on('did-finish-load', () => {
loadingWindow.hide();
});
// Disable window maximization. Setting "maximizable: false" in BrowserWindow
// options does not work as documented.
win.setMaximizable(false);
return win;
}
app.on('activate', () => {
if (!mainWindow) {
mainWindow = createMainWindow();
mainWindow.on('closed', () => {
mainWindow = null;
});
}
});
app.on('window-all-closed', () => {
app.quit();
});
function isWhitelistedUrl(url: string): boolean {
const whitelistUrlRegExps = [
'^outline://', '^https://\\w*.digitalocean.com',
// Add PayPal URLs so that user can pay for their DigitalOcean server
// using PayPal without needing to leave the electron app (if they left
// the electron app, they might see the screen asking them to create their
// first droplet).
'^https://\\w*.paypal.com'
];
for (const regex of whitelistUrlRegExps) {
if (url.search(new RegExp(regex)) === 0) {
return true;
}
}
return false;
}
function getWebAppUrl() {
const queryParams = new url.URLSearchParams();
queryParams.set('version', config.version);
// Set queryParams from environment variables.
if (process.env.SB_IMAGE) {
queryParams.set('image', process.env.SB_IMAGE);
console.log(`Will install Shadowbox from ${process.env.SB_IMAGE} Docker image`);
}
if (process.env.SB_METRICS_URL) {
queryParams.set('metricsUrl', process.env.SB_METRICS_URL);
console.log(`Will use metrics url ${process.env.SB_METRICS_URL}`);
}
if (process.env.SENTRY_DSN) {
queryParams.set('sentryDsn', process.env.SENTRY_DSN);
console.log(`Will use sentryDsn url ${process.env.SENTRY_DSN}`);
}
if (debugMode) {
queryParams.set('outlineDebugMode', 'true');
console.log(`Enabling Outline debug mode`);
}
// Append arguments to URL if any.
const webAppUrl = new url.URL('outline://web_app/index.html');
webAppUrl.search = queryParams.toString();
const webAppUrlString = webAppUrl.toString();
console.log('Launching web app from ' + webAppUrlString);
return webAppUrlString;
}
interface Config {
version: string;
releaseDataUrl: string;
}
function loadConfig(): Config {
const configText = fs.readFileSync(path.join(__dirname, 'config.json'), {encoding: 'utf8'});
return JSON.parse(configText);
}
const config = loadConfig();
// Override version in Mac about panel.
if (app.setAboutPanelOptions) {
app.setAboutPanelOptions({
// Sets version # outside of parenthesis, the version inside the parens will
// be the version from package.json.
applicationVersion: config.version
});
}
checkForUpdates(config.version, config.releaseDataUrl);

View file

@ -0,0 +1,8 @@
<html>
<head>
<title>Outline Manager - Loading</title>
</head>
<body>
Loading...
</body>
</html>

View file

@ -0,0 +1,49 @@
// Copyright 2018 The Outline Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import * as electron from 'electron';
export class LoadingWindow {
private loadingBrowserWindow: electron.BrowserWindow;
private timeoutId: NodeJS.Timer;
public constructor(private mainWindow: Electron.BrowserWindow, private url: string) {}
public showInMs(delayMs: number) {
if (this.timeoutId) {
// Timeout is already set - cancel it.
clearTimeout(this.timeoutId);
}
this.timeoutId = global.setTimeout(() => {
this.timeoutId = null;
this.loadingBrowserWindow = new electron.BrowserWindow();
this.loadingBrowserWindow.loadURL(this.url);
this.loadingBrowserWindow.setBounds(this.mainWindow.getBounds());
this.mainWindow.hide();
}, delayMs);
}
public hide() {
if (this.timeoutId) {
// loadingBrowserWindow has not been displayed yet, cancel the timeout.
clearTimeout(this.timeoutId);
}
if (this.loadingBrowserWindow) {
this.loadingBrowserWindow.close();
this.loadingBrowserWindow = null;
}
this.mainWindow.show();
}
}

View file

@ -0,0 +1,45 @@
// Copyright 2018 The Outline Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import * as electron from 'electron';
// We only want a menu if we're running on macOS or in debug mode, or both.
// Note that when invoked via the electron command line tool, default_app
// adds a menu. We can't disable that.
export function getMenuTemplate(debugMode: boolean): Electron.MenuItemConstructorOptions[] {
const template: Electron.MenuItemConstructorOptions[] = [];
if (process.platform === 'darwin') {
template.push(
// From default_app's main.js.
{
submenu: [
{role: 'about'}, {type: 'separator'}, {role: 'services', submenu: []},
{type: 'separator'}, {role: 'hide'}, {role: 'hideothers'}, {role: 'unhide'},
{type: 'separator'}, {role: 'quit'}
]
},
// editMenu is required for copy+paste keyboard shortcuts to work on Mac.
{role: 'editMenu'});
}
if (debugMode) {
template.push({
label: 'Developer',
submenu: [{role: 'reload'}, {role: 'forcereload'}, {role: 'toggledevtools'}]
});
}
return template;
}

View file

@ -0,0 +1,37 @@
#!/bin/bash -eux
#
# Copyright 2018 The Outline Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
yarn do server_manager/electron_app/build
$ROOT_DIR/src/server_manager/node_modules/.bin/electron-builder \
--projectDir=build/server_manager/electron_app/static \
--publish=never \
--x64 \
--linux AppImage \
--config.linux.icon=icons/png \
--config.linux.category=Network \
--config.artifactName='Outline-Manager.${ext}'
for arch in ia32 x64; do
$ROOT_DIR/src/server_manager/node_modules/.bin/electron-builder \
--projectDir=build/server_manager/electron_app/static \
--publish=never \
--$arch \
--linux deb rpm tar.gz \
--config.linux.icon=icons/png \
--config.linux.category=Network \
--config.artifactName='Outline-Manager-'${arch}'.${ext}'
done

View file

@ -0,0 +1,24 @@
#!/bin/bash -eux
#
# Copyright 2018 The Outline Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
yarn do server_manager/electron_app/build
$ROOT_DIR/src/server_manager/node_modules/.bin/electron-builder \
--projectDir=build/server_manager/electron_app/static \
--publish=never \
--mac dmg \
--config.mac.icon=icons/mac/icon.icns \
--config.artifactName='Outline-Manager.${ext}'

View file

@ -0,0 +1,27 @@
#!/bin/bash -eux
#
# Copyright 2018 The Outline Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# This script is mostly intended for the continuous build, which takes place
# in a Docker container. *Building* is not supported by that Docker image
# so we build separately.
$ROOT_DIR/src/server_manager/node_modules/.bin/electron-builder \
--projectDir=build/server_manager/electron_app/static \
--publish=never \
--ia32 \
--win nsis \
--config.win.icon=icons/win/icon.ico \
--config.artifactName='Outline-Manager.${ext}'

View file

@ -0,0 +1,34 @@
// Copyright 2018 The Outline Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import * as electron from 'electron';
import * as digital_ocean_modifications from './digital_ocean_modifications';
const ipcRenderer = electron.ipcRenderer;
interface ElectronGlobal extends NodeJS.Global {
whitelistCertificate: (fingerprint: string) => void;
clearDigitalOceanCookies: () => void;
}
process.once('loaded', () => {
(global as ElectronGlobal).whitelistCertificate = (fingerprint: string) => {
return ipcRenderer.sendSync('whitelist-certificate', fingerprint);
};
(global as ElectronGlobal).clearDigitalOceanCookies = () => {
return ipcRenderer.sendSync('clear-digital-ocean-cookies');
};
});
digital_ocean_modifications.modifyUiIfDigitalOcean();

View file

@ -0,0 +1,80 @@
#!/bin/bash -eux
#
# Copyright 2018 The Outline Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Get INCREMENT_TYPE
if (( $# <= 0 )); then
echo "usage: ./release_action.sh [major|minor|patch]"
exit 1;
fi
readonly INCREMENT_TYPE=$1
readonly MODULE_DIR=$(dirname $0)
readonly SCRIPTS_DIR=$MODULE_DIR/release_scripts/
readonly CONFIG_FILE=$MODULE_DIR/config.json
# Check that we are on the latest $BRANCH_FOR_RELEASE branch with no changes.
readonly BRANCH_FOR_RELEASE="master"
if [[ $(git rev-parse --abbrev-ref HEAD) != "$BRANCH_FOR_RELEASE" ]]; then
echo "Must be on $BRANCH_FOR_RELEASE branch"
exit 1
fi
if [[ $(git diff) != "" ]]; then
echo "Must have no local changes"
exit 1
fi
git pull origin $BRANCH_FOR_RELEASE
# Create a new branch for this release - will be deleted after this script is
# run regardless of whether the release is successful or not.
readonly BRANCH_NAME="release-$(date "+%Y%m%d-%H%M%S")"
git checkout -b $BRANCH_NAME
# Set trap to return to $BRANCH_FOR_RELEASE branch and delete temporary branch.
function finish {
git checkout $BRANCH_FOR_RELEASE
git branch -D $BRANCH_NAME
}
trap finish EXIT
function getConfigVersion {
echo $(node $SCRIPTS_DIR/get_config_version.js $CONFIG_FILE)
}
# Update electron_app/config.json and store old and new versions.
readonly OLD_VERSION=$(getConfigVersion)
node $SCRIPTS_DIR/bump_electron_version.js $CONFIG_FILE $INCREMENT_TYPE
readonly NEW_VERSION=$(getConfigVersion)
# Create packages and copy them into releases directory.
yarn run clean
yarn
do_action server_manager/electron_app/package
cp -f ${BUILD_DIR}/server_manager/electron_app/static/dist/*.* releases/
# Update releases/release_data.json
sed -i "" "s/$OLD_VERSION/$NEW_VERSION/g" releases/release_data.json
# Push to github
git add .
git commit -m "new release"
git push origin $BRANCH_NAME
readonly TAG_NAME="v$NEW_VERSION"
git tag $TAG_NAME
git push origin $TAG_NAME
# Open a pull request in github.
readonly GITHUB_URL="https://github.com/Jigsaw-Code/outline-server/compare/$BRANCH_NAME?expand=1"
open $GITHUB_URL

View file

@ -0,0 +1,17 @@
#!/bin/bash -eux
#
# Copyright 2018 The Outline Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
yarn do server_manager/electron_app/package_linux

View file

@ -0,0 +1,24 @@
#!/bin/bash -eux
#
# Copyright 2018 The Outline Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
readonly CSC_LINK=${CSC_LINK:-unset}
if [ "$CSC_LINK" == "unset" ]; then
echo "must specify CSC_LINK"
exit 1
fi
yarn do server_manager/electron_app/package_macos

View file

@ -0,0 +1,39 @@
// Copyright 2018 The Outline Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Increments the "version" field in the Outline Manager Electron app's
// config.json file.
const fs = require('fs');
const semver = require('semver');
const configFilename = process.argv[2];
const bumpType = process.argv[3];
if (!configFilename || !bumpType) {
console.error('usage: node bump_electron_version.js <configFilename> <[major|minor|patch]>');
process.exit(1);
} else if (!(new Set(['major', 'minor', 'patch'])).has(bumpType)) {
console.error('bumpType must be major, minor, or patch');
process.exit(1);
}
// Read the config file.
const configText = fs.readFileSync(configFilename, {encoding: 'utf8'});
const configObj = JSON.parse(configText);
// Write new config file.
configObj.version = semver.inc(configObj.version, bumpType);
const newConfigJson = JSON.stringify(configObj, null, 2);
fs.writeFileSync(configFilename, newConfigJson, {encoding: 'utf8'});
console.log('Updated ' + configFilename + ' to version ' + configObj.version);

View file

@ -0,0 +1,28 @@
// Copyright 2018 The Outline Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Returns the version from the Outline Manager Electron app's config.
const fs = require('fs');
const configFilename = process.argv[2];
if (!configFilename) {
console.error('usage: node get_config_version.js <configFilename>');
process.exit(1);
}
// Read the config file version.
const configText = fs.readFileSync(configFilename, {encoding: 'utf8'});
const configObj = JSON.parse(configText);
console.log(configObj.version)

View file

@ -0,0 +1,26 @@
#!/bin/bash -eux
#
# Copyright 2018 The Outline Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
yarn do server_manager/electron_app/build
$ROOT_DIR/src/server_manager/node_modules/.bin/electron-builder \
--projectDir=build/server_manager/electron_app/static \
--publish=never \
--ia32 \
--win nsis \
--config.win.icon=icons/win/icon.ico \
--config.win.certificateSubjectName='Jigsaw Operations LLC' \
--config.artifactName='Outline-Manager.${ext}'

View file

@ -0,0 +1,25 @@
#!/bin/bash -eux
#
# Copyright 2018 The Outline Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
do_action server_manager/electron_app/build
readonly NODE_MODULES_BIN_DIR=$ROOT_DIR/src/server_manager/node_modules/.bin
cd $BUILD_DIR/server_manager/electron_app/static
OUTLINE_DEBUG=true \
SB_METRICS_URL=https://metrics-test.uproxy.org \
SENTRY_DSN=https://ee9db4eb185b471ca08c8eb5efbf61f1@sentry.io/214597 \
$NODE_MODULES_BIN_DIR/electron .

View file

@ -0,0 +1,23 @@
{
"compilerOptions": {
"target": "es2016",
"removeComments": false,
"noImplicitAny": true,
"module": "commonjs",
"rootDir": ".",
"lib": [
"dom",
"es2016"
]
},
"include": [
"index.ts",
"preload.ts",
"digital_ocean_modifications.ts",
"../types/*.d.ts"
],
"exclude": [
"node_modules"
],
"compileOnSave": true
}

View file

@ -0,0 +1,76 @@
// Copyright 2018 The Outline Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import * as electron from 'electron';
import * as fs from 'fs';
import * as https from 'https';
import * as os from 'os';
import * as request from 'request-lite';
import * as semver from 'semver';
import * as url from 'url';
interface ReleaseData {
location?: string;
version?: string;
buildTimestamp?: number;
md5?: string;
}
function getManagerReleaseData(releaseDataUrl: string): Promise<ReleaseData> {
const releaseName = `outline-manager-${os.platform()}-${os.arch()}`;
return new Promise((fulfill, reject) => {
request(releaseDataUrl, (error, response, body) => {
if (error) {
return reject(error);
}
try {
const data: ReleaseData = JSON.parse(body)['latestVersions'][releaseName];
if (!data.version || !data.location) {
return reject('invalid managerReleaseData ' + data);
}
return fulfill(data);
} catch (e) {
return reject('Unable to fetch latest manager info ' + e);
}
});
});
}
export function checkForUpdates(currentVersion: string, releaseDataUrl: string) {
getManagerReleaseData(releaseDataUrl)
.then((managerReleaseData) => {
const latestVersion = managerReleaseData.version;
const semverDiff = semver.diff(latestVersion, currentVersion);
// Only prompt for major and minor updates, ignoring patch, etc.
if ((semverDiff === 'major' || semverDiff === 'minor') &&
semver.gt(latestVersion, currentVersion)) {
electron.dialog.showMessageBox(
{
message: `A new version of the Outline Manager is available.\n\nCurrent version: ${
currentVersion}\nNew version: ${latestVersion}`,
buttons: ['Download', 'Cancel']
},
(clickedButtonIndex: number) => {
if (clickedButtonIndex === 0) {
electron.shell.openExternal(managerReleaseData.location);
}
});
}
})
.catch((e: Error) => {
// Print error and prevent from propagating as we can still run the manager
// without checking for new releases.
console.error('Unable to fetch latest manager info', e);
});
}

View file

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="16px" height="16px" viewBox="0 0 16 16" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- Generator: Sketch 48.2 (47327) - http://www.bohemiancoding.com/sketch -->
<title>back</title>
<desc>Created with Sketch.</desc>
<defs></defs>
<g id="Manager-007b" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" transform="translate(-35.000000, -24.000000)" opacity="0.86">
<g id="ic/arrow_back/white" transform="translate(31.000000, 20.000000)">
<g id="ic_arrow_back_24px">
<polygon id="Shape" points="0 0 24 0 24 24 0 24"></polygon>
<polygon id="Shape" fill="#FFFFFF" fill-rule="nonzero" points="20 11 7.83 11 13.42 5.41 12 4 4 12 12 20 13.41 18.59 7.83 13 20 13"></polygon>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 897 B

View file

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="12px" height="10px" viewBox="0 0 12 10" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- Generator: Sketch 47 (45396) - http://www.bohemiancoding.com/sketch -->
<title>check copy 2</title>
<desc>Created with Sketch.</desc>
<defs></defs>
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="Desktop" transform="translate(-534.000000, -1020.000000)" fill="#FFFFFF">
<g id="check-copy-2" transform="translate(531.000000, 1016.000000)">
<rect id="Rectangle" fill-opacity="0" x="0" y="0" width="18" height="18"></rect>
<polygon id="Path-8-Copy-10" fill-rule="nonzero" points="5.04574404 7.68776621 3.58652645 9.05549572 7.54659883 13.2804593 14.4134736 5.95425596 12.954256 4.58652645 7.54659883 10.3559044"></polygon>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 964 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 92 KiB

View file

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="24px" height="24px" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- Generator: Sketch 47 (45396) - http://www.bohemiancoding.com/sketch -->
<title>DO_Logo_icon_white</title>
<desc>Created with Sketch.</desc>
<defs></defs>
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="Desktop" transform="translate(-294.000000, -585.000000)" fill="#FFFFFE">
<g id="DO_Logo_icon_white" transform="translate(294.000000, 585.000000)">
<g id="Group-3">
<path d="M11.959322,23.9288071 L11.959322,19.291519 C16.8677966,19.291519 20.6779661,14.4237224 18.7932203,9.25762071 C18.1016949,7.3457563 16.5694915,5.81355291 14.6576271,5.12202748 C9.49152542,3.25084104 4.62372881,7.04745121 4.62372881,11.9559258 L0,11.9559258 C0,4.13219698 7.56610169,-1.96949794 15.7694915,0.593213925 C19.3491525,1.71863765 22.2101695,4.56609528 23.3220339,8.1457563 C25.8847458,16.3627055 19.7966102,23.9288071 11.959322,23.9288071" id="Fill-1"></path>
</g>
<polygon id="Fill-4" points="7 19 12 19 12 14 7 14"></polygon>
<polygon id="Fill-5" points="4 22 7 22 7 19 4 19"></polygon>
<polygon id="Fill-6" points="1 19 4 19 4 16 1 16"></polygon>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.3 KiB

View file

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="24px" height="24px" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- Generator: Sketch 43.2 (39069) - http://www.bohemiancoding.com/sketch -->
<title>Group</title>
<desc>Created with Sketch.</desc>
<defs></defs>
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="Group">
<circle id="Oval-15-Copy-3" fill="#222222" cx="12" cy="12" r="12"></circle>
<g id="ic_done_white_24dp" transform="translate(4.000000, 3.000000)">
<polygon id="Shape" points="0 0 18 0 18 18 0 18"></polygon>
<polygon id="Shape" fill="#FFFFFF" fill-rule="nonzero" points="6.13636364 11.9104478 3.03409091 8.7761194 2 9.82089552 6.13636364 14 15 5.04477612 13.9659091 4"></polygon>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 933 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

View file

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="103px" height="34px" viewBox="0 0 103 34" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- Generator: Sketch 49 (51002) - http://www.bohemiancoding.com/sketch -->
<title>Jigsaw</title>
<desc>Created with Sketch.</desc>
<defs></defs>
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="001-Outline.org-1440" transform="translate(-76.000000, -4866.000000)">
<g id="Group-21" transform="translate(0.000000, 4299.000000)">
<g id="Jigsaw" transform="translate(74.000000, 565.000000)">
<rect id="boundingbox" fill-opacity="0" fill="#FFFFFF" x="0" y="0" width="106" height="38"></rect>
<g id="Jigsaw_Logo_White" transform="translate(2.000000, 2.000000)" fill="#263238" fill-rule="nonzero">
<path d="M16.9871099,0 C7.60553846,0 0,7.60516483 0,16.9871099 C0,26.3686813 7.60553846,33.9742198 16.9871099,33.9742198 C26.369055,33.9742198 33.9742198,26.3686813 33.9742198,16.9871099 C33.9742198,7.60516483 26.369055,0 16.9871099,0 Z M24.4405824,18.740912 C24.4405824,19.2778132 24.0053076,19.7129011 23.4684067,19.7129011 C22.9316924,19.7129011 22.4964176,20.1483626 22.4964176,20.6850769 L22.4964176,21.4497032 C22.4964176,21.9866044 22.9316924,22.4218792 23.4684067,22.4218792 C24.0053076,22.4218792 24.4405824,22.8571538 24.4405824,23.3938681 L24.4405824,23.4200219 C24.4405824,23.9569231 24.0053076,24.3923845 23.4684067,24.3923845 L23.2513296,24.3920111 C23.0198681,24.4041538 22.7187252,24.4764506 22.4519561,24.743033 C22.1851868,25.0098023 22.1011208,25.3126263 22.1011208,25.5425933 L22.1011208,25.7615385 L22.1009342,25.7615385 C22.1009342,25.782088 22.1,25.8024506 22.0988792,25.8228132 C22.0988792,26.0539011 22.0206044,26.2988132 21.8444395,26.4753517 C21.668088,26.6517032 21.426912,26.7296044 21.1956374,26.7296044 C21.1741538,26.7310989 21.1524836,26.7318462 21.1308132,26.7318462 L20.9118681,26.7318462 C20.7226263,26.7318462 20.3790769,26.815912 20.1123076,27.0826813 C19.8455385,27.3494506 19.7734286,27.6505933 19.7612857,27.882055 L19.7612857,28.101 C19.7612857,28.6367802 19.326945,29.0711208 18.7911649,29.0711208 L18.761088,29.0711208 C18.4931977,29.0711208 18.2505275,28.9625824 18.0752967,28.7871649 C17.8996924,28.6115605 17.790967,28.3692637 17.790967,28.1013737 L17.7911538,28.0991319 C17.7911538,27.5624176 17.3558792,27.1271429 16.818978,27.1271429 L16.0543516,27.1271429 C15.5176374,27.1271429 15.0823626,27.5624176 15.0823626,28.0991319 L15.0821758,28.0991319 C15.0827363,28.6362198 14.6472747,29.0716813 14.1101868,29.0714945 L14.0834725,29.0714945 C13.5467582,29.0709341 13.112044,28.6356593 13.112044,28.0991319 C13.112044,27.5624176 12.6765824,27.1271429 12.1398681,27.1271429 L10.7942527,27.1271429 C10.5637253,27.1271429 10.3772857,26.9403296 10.3772857,26.7098023 L10.3772857,25.3641868 C10.3772857,24.8274725 9.94182418,24.3923845 9.40492307,24.3923845 C8.8682088,24.3923845 8.43274725,23.9569231 8.43274725,23.4200219 L8.43274725,23.3938681 C8.43274725,22.8571538 8.8682088,22.4218792 9.40492307,22.4218792 L9.43107693,22.4218792 C9.9677912,22.4218792 10.4030659,22.8571538 10.4030659,23.3938681 C10.4030659,23.9307693 10.8381539,24.3662307 11.3752418,24.3662307 L12.1398681,24.3662307 C12.6765824,24.3662307 13.112044,23.9307693 13.112044,23.3938681 C13.112044,22.8571538 13.5473187,22.4218792 14.084033,22.4218792 L14.1101868,22.4218792 C14.6470879,22.4218792 15.0823626,22.8571538 15.0823626,23.3938681 C15.0823626,23.9307693 15.5176374,24.3662307 16.0543516,24.3662307 L16.818978,24.3662307 C17.3558792,24.3662307 17.7911538,23.9307693 17.7911538,23.3938681 C17.790967,22.8571538 18.2264286,22.4218792 18.7631429,22.4218792 C19.3000439,22.4218792 19.7355055,21.9866044 19.7355055,21.4497032 L19.7355055,20.6850769 C19.7355055,20.1483626 19.3000439,19.7129011 18.7631429,19.7129011 C18.2264286,19.7129011 17.790967,19.2778132 17.790967,18.740912 L17.790967,18.7147582 C17.790967,18.1780439 18.2264286,17.7427693 18.7631429,17.7427693 C19.3000439,17.7427693 19.7355055,17.3074945 19.7355055,16.7705934 L19.7355055,16.005967 C19.7355055,15.4692527 19.3000439,15.0337912 18.7631429,15.0337912 C18.2264286,15.0337912 17.790967,14.5987033 17.790967,14.0618022 L17.790967,14.0356484 L17.790967,10.3397363 C17.790967,9.80414286 18.2253076,9.36980219 18.761088,9.36980219 L18.7864945,9.36980219 C19.323022,9.36980219 19.7465275,8.93135164 19.7401758,8.39501099 L19.7401758,7.21042857 L19.7401758,6.04116483 C19.7401758,5.29540658 20.3402198,4.69069231 21.0859781,4.69069231 L21.1455714,4.69069231 C21.8915164,4.69069231 22.4962307,5.29540658 22.4962307,6.04116483 L22.4962307,6.45327473 C22.4962307,6.99036263 22.9316924,7.42563737 23.4684067,7.42563737 C24.0053076,7.42563737 24.4403956,7.86072527 24.4403956,8.39743956 L24.4403956,8.42359341 L24.4403956,10.3645824 L23.4816704,10.3645824 C23.2513296,10.3645824 23.0645164,10.5513956 23.0645164,10.7815494 L23.0645164,12.1271648 C23.0645164,12.6640659 22.629055,13.0995275 22.0923407,13.0995275 C21.5554395,13.0995275 21.1203517,13.5346154 21.1203517,14.0713297 L21.1203517,14.0974835 C21.1203517,14.6343846 21.5554395,15.0694725 22.0923407,15.0694725 L22.1184945,15.0694725 C22.6552088,15.0694725 23.0904836,14.6343846 23.0904836,14.0974835 C23.0904836,13.5607692 23.5257582,13.1253077 24.0626593,13.1253077 L24.4403956,13.1253077 L24.4405824,18.7147582 L24.4405824,18.740912 Z" id="Fill-30"></path>
</g>
<path d="M48.7,26.32 C47.6599948,26.32 46.773337,26.0300029 46.04,25.45 C45.306663,24.8699971 44.7866682,24.0533386 44.48,23 L46.16,22.3 C46.5866688,23.8066742 47.4599934,24.56 48.78,24.56 C49.6333376,24.56 50.2899977,24.2833361 50.75,23.73 C51.2100023,23.1766639 51.44,22.4266714 51.44,21.48 L51.44,11.68 L53.28,11.68 L53.28,21.44 C53.28,23.0000078 52.8500043,24.2033291 51.99,25.05 C51.1299957,25.8966709 50.03334,26.32 48.7,26.32 Z M57.6,13.74 C57.3466654,13.9933346 57.0400018,14.12 56.68,14.12 C56.3199982,14.12 56.0133346,13.9933346 55.76,13.74 C55.5066654,13.4866654 55.38,13.1800018 55.38,12.82 C55.38,12.4599982 55.5066654,12.1533346 55.76,11.9 C56.0133346,11.6466654 56.3199982,11.52 56.68,11.52 C57.0400018,11.52 57.3466654,11.6466654 57.6,11.9 C57.8533346,12.1533346 57.98,12.4599982 57.98,12.82 C57.98,13.1800018 57.8533346,13.4866654 57.6,13.74 Z M57.6,26 L55.76,26 L55.76,16.2 L57.6,16.2 L57.6,26 Z M64.16,30.64 C62.9999942,30.64 62.053337,30.3500029 61.32,29.77 C60.586663,29.1899971 60.0600016,28.5266704 59.74,27.78 L61.42,27.08 C61.6066676,27.613336 61.9499975,28.0599982 62.45,28.42 C62.9500025,28.7800018 63.5199968,28.96 64.16,28.96 C65.1733384,28.96 65.9699971,28.6566697 66.55,28.05 C67.1300029,27.4433303 67.42,26.6200052 67.42,25.58 L67.42,24.64 L67.34,24.64 C67.0199984,25.1200024 66.5666696,25.5199984 65.98,25.84 C65.3933304,26.1600016 64.733337,26.32 64,26.32 C62.733327,26.32 61.6400046,25.820005 60.72,24.82 C59.7999954,23.819995 59.34,22.5800074 59.34,21.1 C59.34,19.6199926 59.7999954,18.380005 60.72,17.38 C61.6400046,16.379995 62.733327,15.88 64,15.88 C64.733337,15.88 65.3933304,16.0399984 65.98,16.36 C66.5666696,16.6800016 67.0199984,17.0799976 67.34,17.56 L67.42,17.56 L67.42,16.2 L69.18,16.2 L69.18,25.5 C69.18,27.1800084 68.6933382,28.4566623 67.72,29.33 C66.7466618,30.2033377 65.560007,30.64 64.16,30.64 Z M64.3,24.64 C65.166671,24.64 65.9033303,24.3200032 66.51,23.68 C67.1166697,23.0399968 67.42,22.1800054 67.42,21.1 C67.42,20.0199946 67.1166697,19.1600032 66.51,18.52 C65.9033303,17.8799968 65.166671,17.56 64.3,17.56 C63.4466624,17.56 62.7133364,17.8833301 62.1,18.53 C61.4866636,19.1766699 61.18,20.033328 61.18,21.1 C61.18,22.166672 61.4866636,23.0233301 62.1,23.67 C62.7133364,24.3166699 63.4466624,24.64 64.3,24.64 Z M74.96,26.32 C73.8666612,26.32 72.9633369,26.053336 72.25,25.52 C71.5366631,24.986664 71.013335,24.320004 70.68,23.52 L72.32,22.84 C72.8400026,24.0666728 73.7266604,24.68 74.98,24.68 C75.5533362,24.68 76.0233315,24.5533346 76.39,24.3 C76.7566685,24.0466654 76.94,23.7133354 76.94,23.3 C76.94,22.6599968 76.4933378,22.2266678 75.6,22 L73.62,21.52 C72.9933302,21.3599992 72.4000028,21.0566689 71.84,20.61 C71.2799972,20.1633311 71,19.5600038 71,18.8 C71,17.933329 71.3833295,17.2300027 72.15,16.69 C72.9166705,16.1499973 73.8266614,15.88 74.88,15.88 C75.746671,15.88 76.5199966,16.0766647 77.2,16.47 C77.8800034,16.8633353 78.3666652,17.426663 78.66,18.16 L77.06,18.82 C76.6999982,17.953329 75.953339,17.52 74.82,17.52 C74.2733306,17.52 73.8133352,17.6333322 73.44,17.86 C73.0666648,18.0866678 72.88,18.3933314 72.88,18.78 C72.88,19.3400028 73.313329,19.719999 74.18,19.92 L76.12,20.38 C77.0400046,20.5933344 77.7199978,20.9599974 78.16,21.48 C78.6000022,22.0000026 78.82,22.5866634 78.82,23.24 C78.82,24.1200044 78.4600036,24.8533304 77.74,25.44 C77.0199964,26.0266696 76.093339,26.32 74.96,26.32 Z M83.62,26.32 C82.5799948,26.32 81.7100035,26.020003 81.01,25.42 C80.3099965,24.819997 79.96,24.0266716 79.96,23.04 C79.96,21.973328 80.3733292,21.1366697 81.2,20.53 C82.0266708,19.9233303 83.0466606,19.62 84.26,19.62 C85.3400054,19.62 86.2266632,19.819998 86.92,20.22 L86.92,19.94 C86.92,19.2199964 86.6733358,18.6433355 86.18,18.21 C85.6866642,17.7766645 85.0800036,17.56 84.36,17.56 C83.826664,17.56 83.3433355,17.6866654 82.91,17.94 C82.4766645,18.1933346 82.1800008,18.5399978 82.02,18.98 L80.34,18.26 C80.5666678,17.6733304 81.01333,17.1300025 81.68,16.63 C82.34667,16.1299975 83.2266612,15.88 84.32,15.88 C85.5733396,15.88 86.6133292,16.246663 87.44,16.98 C88.2666708,17.713337 88.68,18.74666 88.68,20.08 L88.68,26 L86.92,26 L86.92,24.64 L86.84,24.64 C86.106663,25.7600056 85.0333404,26.32 83.62,26.32 Z M83.92,24.64 C84.6800038,24.64 85.3699969,24.3566695 85.99,23.79 C86.6100031,23.2233305 86.92,22.5533372 86.92,21.78 C86.3999974,21.3533312 85.6200052,21.14 84.58,21.14 C83.6866622,21.14 83.0133356,21.3333314 82.56,21.72 C82.1066644,22.1066686 81.88,22.5599974 81.88,23.08 C81.88,23.5600024 82.0866646,23.9399986 82.5,24.22 C82.9133354,24.5000014 83.386664,24.64 83.92,24.64 Z M101.28,26 L99.4,26 L96.96,18.48 L94.54,26 L92.68,26 L89.52,16.2 L91.44,16.2 L93.62,23.6 L93.64,23.6 L96.06,16.2 L97.96,16.2 L100.38,23.6 L100.4,23.6 L102.56,16.2 L104.44,16.2 L101.28,26 Z" fill="#263238"></path>
</g>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 10 KiB

View file

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="40px" height="40px" viewBox="0 0 40 40" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- Generator: Sketch 47.1 (45422) - http://www.bohemiancoding.com/sketch -->
<title>key-avater</title>
<desc>Created with Sketch.</desc>
<defs></defs>
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="key-004" transform="translate(-29.000000, -370.000000)">
<g id="key-avater" transform="translate(29.000000, 370.000000)">
<g>
<circle id="gradient" fill="#263238" transform="translate(20.000000, 20.000000) rotate(-270.000000) translate(-20.000000, -20.000000) " cx="20" cy="20" r="20"></circle>
<path d="M20.65,18 C19.83,15.67 17.61,14 15,14 C11.69,14 9,16.69 9,20 C9,23.31 11.69,26 15,26 C17.61,26 19.83,24.33 20.65,22 L25,22 L25,26 L29,26 L29,22 L31,22 L31,18 L20.65,18 Z M15,22 C13.9,22 13,21.1 13,20 C13,18.9 13.9,18 15,18 C16.1,18 17,18.9 17,20 C17,21.1 16.1,22 15,22 Z" id="Shape" fill="#FFFFFF" fill-rule="nonzero"></path>
</g>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.2 KiB

View file

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="40px" height="40px" viewBox="0 0 40 40" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- Generator: Sketch 47.1 (45422) - http://www.bohemiancoding.com/sketch -->
<title>key-avater</title>
<desc>Created with Sketch.</desc>
<defs></defs>
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="key-004" transform="translate(-29.000000, -370.000000)">
<g id="key-avater" transform="translate(29.000000, 370.000000)">
<g>
<circle id="gradient" fill="#263238" transform="translate(20.000000, 20.000000) rotate(-270.000000) translate(-20.000000, -20.000000) " cx="20" cy="20" r="20"></circle>
<path d="M20.65,18 C19.83,15.67 17.61,14 15,14 C11.69,14 9,16.69 9,20 C9,23.31 11.69,26 15,26 C17.61,26 19.83,24.33 20.65,22 L25,22 L25,26 L29,26 L29,22 L31,22 L31,18 L20.65,18 Z M15,22 C13.9,22 13,21.1 13,20 C13,18.9 13.9,18 15,18 C16.1,18 17,18.9 17,20 C17,21.1 16.1,22 15,22 Z" id="Shape" fill="#FFFFFF" fill-rule="nonzero"></path>
</g>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.2 KiB

View file

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="22px" height="20px" viewBox="0 0 22 20" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- Generator: Sketch 47.1 (45422) - http://www.bohemiancoding.com/sketch -->
<title>key-empty</title>
<desc>Created with Sketch.</desc>
<defs></defs>
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" opacity="0.34">
<g id="key-001" transform="translate(-289.000000, -523.000000)" fill="#000000">
<g id="key-empty" transform="translate(289.000000, 523.000000)">
<g id="Group-7">
<g id="key-avater" transform="translate(0.000000, 8.000000)" fill-rule="nonzero">
<path d="M11.65,4 C10.83,1.67 8.61,0 6,0 C2.69,0 0,2.69 0,6 C0,9.31 2.69,12 6,12 C8.61,12 10.83,10.33 11.65,8 L16,8 L16,12 L20,12 L20,8 L22,8 L22,4 L11.65,4 Z M6,8 C4.9,8 4,7.1 4,6 C4,4.9 4.9,4 6,4 C7.1,4 8,4.9 8,6 C8,7.1 7.1,8 6,8 Z" id="Shape"></path>
</g>
<path d="M18,5 L14,5 L14,3 L18,3 L22,3 L22,5 L18,5 Z M17,5 L19,5 L19,8 L17,8 L17,5 Z M17,0 L19,0 L19,3 L17,3 L17,0 Z" id="Combined-Shape"></path>
</g>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 453 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

View file

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="45px" height="46px" viewBox="0 0 45 46" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- Generator: Sketch 47.1 (45422) - http://www.bohemiancoding.com/sketch -->
<title>manager-key-avatar</title>
<desc>Created with Sketch.</desc>
<defs></defs>
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="key-004" transform="translate(-26.000000, -291.000000)" fill-rule="nonzero">
<g id="manager-key-avatar" transform="translate(26.000000, 291.000000)">
<path d="M40.6938907,26.4192733 L44.1613887,29.1305636 C44.591115,29.4697886 44.7042008,30.0803936 44.4327948,30.5779236 L39.9093606,38.4027135 C39.6379545,38.9002435 39.0499081,39.1037785 38.5297132,38.9002435 L34.3451888,37.2198729 C32.7273169,38.5611884 30.8756223,39.6303532 28.8603119,40.3571672 L28.2162832,44.8479884 C28.1484317,45.3907484 27.6734711,45.7978184 27.1080419,45.7978184 L18.0611735,45.7978184 C17.4957442,45.7978184 17.0207836,45.3907484 16.9529321,44.8479884 L16.3043338,40.3253026 C14.311747,39.595146 12.480867,38.5297283 10.8800361,37.197385 L6.6395022,38.9002435 C6.14192444,39.0811635 5.53126083,38.9002435 5.25985478,38.4027135 L0.736420601,30.5779236 C0.465014551,30.0803936 0.578100405,29.4697886 1.00782665,29.1305636 L4.54803015,26.3624238 C4.35489387,25.2946912 4.25404652,24.1948492 4.25404652,23.0714553 C4.25404652,22.0166335 4.34295813,20.9825762 4.51369645,19.9763675 L1.00782665,17.2350737 C0.578100405,16.8958487 0.44239738,16.2852437 0.736420601,15.7877137 L5.25985478,7.96292382 C5.53126083,7.46539382 6.11930727,7.26185883 6.6395022,7.46539382 L10.7010833,9.09639432 C12.3528313,7.68586288 14.2576723,6.56297674 16.338041,5.80529399 L16.9529321,1.51764888 C17.0207836,0.974888889 17.4957442,0.567818893 18.0611735,0.567818893 L27.1080419,0.567818893 C27.6734711,0.567818893 28.1484317,0.974888889 28.2162832,1.51764888 L28.8266342,5.77363494 C30.9299631,6.52753066 32.8558188,7.65408695 34.5246036,9.07371393 L38.5297132,7.46539382 C39.0272909,7.28447383 39.6379545,7.46539382 39.9093606,7.96292382 L44.4327948,15.7877137 C44.7042008,16.2852437 44.591115,16.8958487 44.1613887,17.2350737 L40.7287858,19.919079 C40.9059301,20.9433136 40.9982503,21.9966042 40.9982503,23.0714553 C40.9982503,24.2147976 40.8937896,25.3337441 40.6938907,26.4192733 Z" id="Combined-Shape" fill="#263238"></path>
<path d="M23.65,21 C22.83,18.67 20.61,17 18,17 C14.69,17 12,19.69 12,23 C12,26.31 14.69,29 18,29 C20.61,29 22.83,27.33 23.65,25 L28,25 L28,29 L32,29 L32,25 L34,25 L34,21 L23.65,21 Z M18,25 C16.9,25 16,24.1 16,23 C16,21.9 16.9,21 18,21 C19.1,21 20,21.9 20,23 C20,24.1 19.1,25 18,25 Z" id="Shape" fill="#FFFFFF"></path>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

View file

@ -0,0 +1,43 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="75px" height="62px" viewBox="0 0 75 62" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- Generator: Sketch 45.2 (43514) - http://www.bohemiancoding.com/sketch -->
<title>Group 51</title>
<desc>Created with Sketch.</desc>
<defs>
<path d="M13.9802498,-7.47991079e-16 L39.917549,-7.47991079e-16 L39.917549,0 C45.4403965,-1.01448797e-15 49.917549,4.4771525 49.917549,10 L49.917549,12.6818906 L49.917549,12.6818906 C49.917549,18.2047381 45.4403965,22.6818906 39.917549,22.6818906 L-2.84217094e-14,22.6818906 L3.98024982,18.8032639 L3.98024982,10 L3.98024982,10 C3.98024982,4.4771525 8.45740232,1.01448797e-15 13.9802498,0 Z" id="path-1"></path>
<path d="M14.7009446,-3.33500588e-16 L48.8747911,6.61471745e-16 L48.8747911,0 C54.3976386,-1.01454218e-15 58.8747911,4.4771525 58.8747911,10 L58.8747911,16.196965 L58.8747911,16.196965 C58.8747911,21.7198125 54.3976386,26.196965 48.8747911,26.196965 L1.42108547e-13,26.196965 L4.7009446,22.2381533 L4.7009446,10 L4.7009446,10 C4.7009446,4.4771525 9.1780971,-7.61814656e-16 14.7009446,-1.77635684e-15 Z" id="path-2"></path>
</defs>
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="Manager-stickersheet" transform="translate(-696.000000, -6872.000000)">
<g id="Group-51" transform="translate(696.000000, 6873.000000)">
<g id="Group-14" transform="translate(18.000000, 0.000000)">
<rect id="Rectangle-Copy" stroke="#66818D" x="-0.018102372" y="-0.5" width="49.3695372" height="53.7489712"></rect>
<g id="Group-12" transform="translate(6.918297, 4.869136)">
<g id="Rectangle-33">
<use fill="#455A64" fill-rule="evenodd" xlink:href="#path-1"></use>
<path stroke="#66818D" stroke-width="1" d="M1.22953045,22.1818906 L39.917549,22.1818906 C45.1642542,22.1818906 49.417549,17.9285958 49.417549,12.6818906 L49.417549,10 C49.417549,4.75329488 45.1642542,0.5 39.917549,0.5 L13.9802498,0.5 C8.7335447,0.5 4.48024982,4.75329488 4.48024982,10 L4.48024982,19.0141681 L1.22953045,22.1818906 Z"></path>
</g>
<path d="M42.2038245,6.63417368 L11.5357076,6.63417368 L42.2038245,6.63417368 Z" id="Line-2" stroke="#66818D" stroke-linecap="square"></path>
<path d="M42.2038245,11.1035117 L11.5357076,11.1035117 L42.2038245,11.1035117 Z" id="Line-2-Copy-6" stroke="#66818D" stroke-linecap="square"></path>
<path d="M32.5843635,15.5728498 L11.5357076,15.5728498 L32.5843635,15.5728498 Z" id="Line-2-Copy-7" stroke="#66818D" stroke-linecap="square"></path>
</g>
</g>
<g id="Group-18" transform="translate(0.000000, 29.000000)">
<g id="Group-33" transform="translate(4.000000, 5.083951)">
<g id="Rectangle-33" transform="translate(29.437396, 13.098483) scale(-1, 1) translate(-29.437396, -13.098483) ">
<use fill="#455A64" fill-rule="evenodd" xlink:href="#path-2"></use>
<path stroke="#F0F2F4" stroke-width="1" d="M1.36995171,25.696965 L48.8747911,25.696965 C54.1214962,25.696965 58.3747911,21.4436701 58.3747911,16.196965 L58.3747911,10 C58.3747911,4.75329488 54.1214962,0.5 48.8747911,0.5 L14.7009446,0.5 C9.45423948,0.5 5.2009446,4.75329488 5.2009446,10 L5.2009446,22.4707667 L1.36995171,25.696965 Z"></path>
</g>
<g id="Group-10" transform="translate(9.000000, 7.000000)" stroke="#F0F2F4" stroke-linecap="square">
<path d="M0.311320755,0.5 L32.7126181,0.5" id="Line-2"></path>
<path d="M0.314814815,5.5 L33.7089363,5.5" id="Line-2-Copy"></path>
<path d="M0.340909091,10.5 L14.3845431,10.5" id="Line-2-Copy-2"></path>
</g>
</g>
<circle id="Oval-6-Copy" fill="#1DE9B6" cx="6" cy="6" r="6"></circle>
<polyline id="Path-10-Copy" stroke="#455A64" stroke-linecap="square" points="3 6 5 8 9 4"></polyline>
</g>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 4.3 KiB

View file

@ -0,0 +1,43 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="69px" height="66px" viewBox="0 0 69 66" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- Generator: Sketch 45.2 (43514) - http://www.bohemiancoding.com/sketch -->
<title>Group 54</title>
<desc>Created with Sketch.</desc>
<defs>
<rect id="path-1" x="13.6554289" y="5.02777778" width="48.2920219" height="53.9722222" rx="4"></rect>
<rect id="path-2" x="0" y="39" width="51.4086736" height="26.4444444"></rect>
<polygon id="path-3" points="8.69565217 0 18.3043478 0 21 9 6 9"></polygon>
</defs>
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="Manager-stickersheet" transform="translate(-418.000000, -6868.000000)">
<g id="Group-54" transform="translate(418.000000, 6868.000000)">
<g id="Group-53" transform="translate(6.000000, 0.000000)">
<g id="Group-11">
<g id="Rectangle">
<use fill="#455A64" fill-rule="evenodd" xlink:href="#path-1"></use>
<rect stroke="#66818D" stroke-width="1" x="13.1554289" y="4.52777778" width="49.2920219" height="54.9722222" rx="4"></rect>
</g>
<g id="Rectangle-2">
<use fill="#455A64" fill-rule="evenodd" xlink:href="#path-2"></use>
<rect stroke="#F0F2F4" stroke-width="1" x="0.5" y="39.5" width="50.4086736" height="25.4444444"></rect>
</g>
<g id="Group-21" transform="translate(24.000000, 0.000000)">
<path d="M0.451612903,8.5 L25.5,8.5" id="Line-5" stroke="#66818D" stroke-linecap="square"></path>
<g id="Rectangle-35">
<use fill="#455A64" fill-rule="evenodd" xlink:href="#path-3"></use>
<path stroke="#66818D" stroke-width="1" d="M9.06783969,0.5 L6.67170442,8.5 L20.3282956,8.5 L17.9321603,0.5 L9.06783969,0.5 Z"></path>
</g>
<circle id="Oval-2" stroke="#66818D" stroke-linecap="square" cx="13.5" cy="4.5" r="1.5"></circle>
</g>
</g>
<polygon id="Rectangle-4" fill="#1DE9B6" opacity="0.313066123" points="4 43 47 43 47 55 34 55 34 60 4 60"></polygon>
<rect id="Rectangle-36" stroke="#1DE9B6" x="7.5" y="46.5" width="37" height="1"></rect>
<rect id="Rectangle-36-Copy" stroke="#1DE9B6" x="7.5" y="51.5" width="37" height="1"></rect>
<rect id="Rectangle-36-Copy-2" stroke="#1DE9B6" x="7.5" y="56.5" width="23" height="1"></rect>
</g>
<circle id="Oval-6" fill="#1DE9B6" cx="6" cy="40" r="6"></circle>
<polyline id="Path-10" stroke="#455A64" stroke-linecap="square" points="3 40 5 42 9 38"></polyline>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 3 KiB

View file

@ -0,0 +1,46 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="69px" height="61px" viewBox="0 0 69 61" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- Generator: Sketch 45.2 (43514) - http://www.bohemiancoding.com/sketch -->
<title>Group 52</title>
<desc>Created with Sketch.</desc>
<defs>
<rect id="path-1" x="3.55271368e-14" y="0" width="48.2920219" height="52.6002029"></rect>
<polygon id="path-2" points="0 -3.41060513e-13 44.9825894 -3.41060513e-13 44.9825894 24.2770167 0 24.2770167"></polygon>
<polygon id="path-3" points="0 0 22.8172555 17.0595253 44.9825894 0 44.9825894 24.2770167 0 24.2770167"></polygon>
<polygon id="path-4" points="22.8172555 3.55271368e-15 44.9825894 18.6123795 0 18.6123795"></polygon>
</defs>
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="Manager-stickersheet" transform="translate(-555.000000, -6872.000000)">
<g id="Group-52" transform="translate(555.000000, 6873.000000)">
<g id="Group-16" transform="translate(6.000000, 0.000000)">
<g id="Group-15" transform="translate(13.655429, 0.000000)">
<g id="Rectangle">
<use fill="#455A64" fill-rule="evenodd" xlink:href="#path-1"></use>
<rect stroke="#66818D" stroke-width="1" x="-0.5" y="-0.5" width="49.2920219" height="53.6002029"></rect>
</g>
<path d="M23.2048908,13.4046169 L23.2048908,15.8323186" id="Line-2" stroke="#66818D" stroke-linecap="square"></path>
<path d="M5.01588704,5.5 L38.3964737,5.5" id="Line-2-Copy-3" stroke="#66818D" stroke-linecap="square"></path>
<path d="M5.01588704,10.5 L38.3964737,10.5" id="Line-2-Copy-4" stroke="#66818D" stroke-linecap="square"></path>
<path d="M5.02443985,15.5 L19.0307207,15.5" id="Line-2-Copy-5" stroke="#66818D" stroke-linecap="square"></path>
</g>
<g id="Group-34" transform="translate(0.000000, 34.797057)">
<g id="Rectangle-19" transform="translate(22.491295, 12.138508) rotate(-180.000000) translate(-22.491295, -12.138508) ">
<use fill="#455A64" fill-rule="evenodd" xlink:href="#path-2"></use>
<path stroke="#F0F2F4" stroke-width="1" d="M0.5,0.5 L0.5,23.7770167 L44.4825894,23.7770167 L44.4825894,0.5 L0.5,0.5 Z"></path>
</g>
<g id="Rectangle-19" transform="translate(22.491295, 12.138508) rotate(-180.000000) translate(-22.491295, -12.138508) ">
<use fill="#455A64" fill-rule="evenodd" xlink:href="#path-3"></use>
<path stroke="#F0F2F4" stroke-width="1" d="M0.5,0.998127862 L0.5,23.7770167 L44.4825894,23.7770167 L44.4825894,1.01576809 L22.8216351,17.6870981 L0.5,0.998127862 Z"></path>
</g>
<g id="Rectangle-19" transform="translate(22.491295, 9.306190) rotate(-180.000000) translate(-22.491295, -9.306190) ">
<use fill="#455A64" fill-rule="evenodd" xlink:href="#path-4"></use>
<path stroke="#F0F2F4" stroke-width="1" d="M22.8126352,0.649019055 L1.40398307,18.1123795 L43.6096115,18.1123795 L22.8126352,0.649019055 Z"></path>
</g>
</g>
</g>
<circle id="Oval-6" fill="#1DE9B6" cx="6" cy="35" r="6"></circle>
<polyline id="Path-10" stroke="#455A64" stroke-linecap="square" points="3 35 5 37 9 33"></polyline>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 3.7 KiB

View file

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="20px" height="18px" viewBox="0 0 20 18" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- Generator: Sketch 47 (45396) - http://www.bohemiancoding.com/sketch -->
<title>terminal</title>
<desc>Created with Sketch.</desc>
<defs></defs>
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="ManualMode-005b" transform="translate(-74.000000, -305.000000)">
<g id="terminal" transform="translate(72.000000, 302.000000)">
<g id="Group-2" transform="translate(12.000000, 12.000000) rotate(-90.000000) translate(-12.000000, -12.000000) translate(3.000000, 2.000000)"></g>
<rect id="Rectangle-3" fill-opacity="0" fill="#FFFFFF" x="0" y="0" width="24" height="24"></rect>
<path d="M5,2 L19,2 C20.1045695,2 21,2.8954305 21,4 L21,20 C21,21.1045695 20.1045695,22 19,22 L5,22 C3.8954305,22 3,21.1045695 3,20 L3,4 L3,4 C3,2.8954305 3.8954305,2 5,2 L5,2 Z M5,4 L5,20 L19,20 L19,4 L5,4 Z" id="Combined-Shape" fill="#141414" transform="translate(12.000000, 12.000000) rotate(-270.000000) translate(-12.000000, -12.000000) "></path>
<rect id="Rectangle-2" fill="#000000" x="10" y="12" width="5" height="2"></rect>
<path d="M4.03553391,11.0355339 L4.03553391,7.03553391 L6.03553391,7.03553391 L6.03553391,10.0355339 L9.03553391,10.0355339 L9.03553391,12.0355339 L4.03553391,12.0355339 L4.03553391,11.0355339 Z" id="Combined-Shape" fill="#000000" transform="translate(6.535534, 9.535534) rotate(-135.000000) translate(-6.535534, -9.535534) "></path>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

View file

@ -0,0 +1,63 @@
<!--
Copyright 2018 The Outline Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<!--<base href=".">-->
<meta name="google" content="notranslate">
<meta http-equiv="Content-Language" content="en">
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0">
<!-- TODO: remove this once launched to a broader audience -->
<meta name="robots" content="noindex,noarchive">
<!-- TODO: update this description -->
<!-- <meta name="descripton" content="Outline is a browser extension that makes it easy to set up and access proxy services for your trusted friends and family.">
<meta property="og:description" content="Outline is a browser extension that makes it easy to set up and access proxy services for your trusted friends and family." /> -->
<link rel="shortcut icon" href="/ui_components/images/favicon.png">
<link rel="stylesheet" href="/ui_components/style.css">
<link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Roboto+Condensed:400" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Roboto+Mono" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Google+Sans" rel="stylesheet">
<script src="/bower_components/webcomponentsjs/webcomponents-loader.js"></script>
<link rel="import" href="/bower_components/app-layout/app-toolbar/app-toolbar.html">
<link rel="import" href="/ui_components/app-root.html">
<!-- Only allow links in the Outline invite and DigitalOcean pages to be included as an iframe -->
<meta http-equiv="Content-Security-Policy" content="frame-src ss://* macappstore://* https://s3.amazonaws.com/outline-vpn/ https://cloud.digitalocean.com https://github.com/;">
<script src="server_manager/web_app/main.js"></script>
<style>
body {
-webkit-font-smoothing: antialiased;
}
/* Show gray background when a dialog is opened */
core-overlay-layer.core-opened {
background-color: rgba(0, 0, 0, 0.5);
width: 100%;
height: 100%;
}
</style>
<title>Outline Manager</title>
</head>
<body dir='ltr' class='page-cloud-install'>
<app-root id="appRoot"></app-root>
</body>
</html>

View file

@ -0,0 +1,32 @@
// Copyright 2018 The Outline Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import * as forge from 'node-forge';
// Keys are in OpenSSH format
export class KeyPair {
public: string;
private: string;
}
// Generates an RSA keypair using forge
export function generateKeyPair(): KeyPair {
const pair = forge.pki.rsa.generateKeyPair({bits: 1538});
// trim() the string because forge adds a trailing space to
// public keys which really messes things up later.
return {
public: forge.ssh.publicKeyToOpenSSH(pair.publicKey, '').trim(),
private: forge.ssh.privateKeyToOpenSSH(pair.privateKey, '').trim()
};
}

View file

@ -0,0 +1,44 @@
// Copyright 2018 The Outline Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
export class OutlineError extends Error {
constructor(message?: string) {
// ref:
// https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-2.html#support-for-newtarget
super(message); // 'Error' breaks prototype chain here
Object.setPrototypeOf(this, new.target.prototype); // restore prototype chain
this.name = new.target.name;
}
}
// Error thrown when a shadowbox server cannot be reached (e.g. due to Firewall)
export class UnreachableServerError extends OutlineError {
constructor(message?: string) {
super(message);
}
}
// Error thrown when trying to access a server that has been deleted.
export class DeletedServerError extends OutlineError {
constructor(message?: string) {
super(message);
}
}
// Error thrown when server installation failed.
export class ServerInstallFailedError extends OutlineError {
constructor(message?: string) {
super(message);
}
}

View file

@ -0,0 +1,40 @@
// Copyright 2018 The Outline Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
export function asciiToHex(text: string) {
// Assumes that text is no more than 8 bits per char, i.e. no unicode.
const hexBytes: string[] = [];
for (let i = 0; i < text.length; ++i) {
const charCode = text.charCodeAt(i);
if (charCode > 0xFF) {
// Consider supporting non-ascii characters:
// http://monsur.hossa.in/2012/07/20/utf-8-in-javascript.html
throw new Error(`Cannot encode wide character with value ${charCode}`);
}
hexBytes.push(('0' + charCode.toString(16)).slice(-2));
}
return hexBytes.join('');
}
export function hexToString(hexString: string) {
const bytes: string[] = [];
if (hexString.length % 2 !== 0) {
throw new Error('hexString has odd length, ignoring: ' + hexString);
}
for (let i = 0; i < hexString.length; i += 2) {
const hexByte = hexString.slice(i, i + 2);
bytes.push(String.fromCharCode(parseInt(hexByte, 16)));
}
return bytes.join('');
}

View file

@ -0,0 +1,29 @@
// Copyright 2018 The Outline Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
'use strict';
const fs = require('fs');
const path = require('path');
const tarballBinary = fs.readFileSync(process.argv[2]);
const base64Tarball = new Buffer(tarballBinary).toString('base64');
const scriptText = `
(base64 --decode | tar --extract --gzip ) <<EOM
${base64Tarball}
EOM
./do_install_server.sh
`;
console.log(`export const SCRIPT = ${JSON.stringify(scriptText)};`);

View file

@ -0,0 +1,170 @@
# Copyright 2018 The Outline Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Script to install Shadowbox on a DigitalOcean droplet
# You must set the following environment variables:
# DO_ACCESS_TOKEN: DigitalOcean access token, with read and write privileges.
# You may set the following environment variables, overriding their defaults:
# SB_IMAGE: Shadowbox Docker image to install, e.g. quay.io/outline/shadowbox:nightly
# SB_API_PORT: The port number of the management API.
# SENTRY_API_URL: Url to post Sentry report to on error.
set -euxo pipefail
export SHADOWBOX_DIR="${SHADOWBOX_DIR:-${HOME:-/root}/shadowbox}"
mkdir -p $SHADOWBOX_DIR
# Save output for debugging
exec 2>&1 >$SHADOWBOX_DIR/install-shadowbox-output
# Initialize sentry log file.
export SENTRY_LOG_FILE="$SHADOWBOX_DIR/sentry-log-file.txt"
> $SENTRY_LOG_FILE
function log_for_sentry() {
echo [$(date "+%Y-%m-%d@%H:%M:%S")] "do_install_server.sh" "$@" >>$SENTRY_LOG_FILE
}
function post_sentry_report() {
if [[ -n "$SENTRY_API_URL" ]]; then
# Get JSON formatted string. This command replaces newlines with literal '\n'
# but otherwise assumes that there are no other characters to escape for JSON.
# If we need better escaping, we can install the jq command line tool.
readonly SENTRY_PAYLOAD_BYTE_LIMIT=8000
SENTRY_PAYLOAD="{\"message\": \"Install error:\n$(cat $SENTRY_LOG_FILE | awk '{printf "%s\\n", $0}' | tail --bytes $SENTRY_PAYLOAD_BYTE_LIMIT)\"}"
# See Sentry documentation at:
# https://media.readthedocs.org/pdf/sentry/7.1.0/sentry.pdf
curl "$SENTRY_API_URL" -H "Origin: shadowbox" --data-binary "$SENTRY_PAYLOAD"
fi
}
# For backward-compatibility:
readonly DO_ACCESS_TOKEN="${DO_ACCESS_TOKEN:-ACCESS_TOKEN}"
if [[ -z "${DO_ACCESS_TOKEN}" ]]; then
echo "Access token must be supplied"
exit 1
fi
# DigitalOcean's Metadata API base url.
# This URL only supports HTTP (not HTTPS) requests, however it is a local link
# address so not at risk for man-in-the-middle attacks or eavesdropping.
# More detail at https://serverfault.com/questions/427018/what-is-this-ip-address-169-254-169-254
readonly DO_METADATA_URL="http://169.254.169.254/metadata/v1"
function cloud::public_ip() {
curl ${DO_METADATA_URL}/interfaces/public/0/ipv4/address
}
# Applies a tag to this droplet.
function cloud::add_tag() {
local tag="$1"
declare -a base_flags=(-X POST -H 'Content-Type: application/json')
base_flags+=(-H "Authorization: Bearer ${DO_ACCESS_TOKEN}")
local TAGS_URL='https://api.digitalocean.com/v2/tags'
# Create the tag
curl "${base_flags[@]}" -d "{\"name\":\"${tag}\"}" "${TAGS_URL}"
local droplet_id="$(curl ${DO_METADATA_URL}/id)"
printf -v droplet_obj '
{
"resources": [{
"resource_id": "%s",
"resource_type": "droplet"
}]
}' "${droplet_id}"
# Link the tag to this droplet
curl "${base_flags[@]}" -d "${droplet_obj}" "${TAGS_URL}/${tag}/resources"
}
# Adds a key-value tag to the droplet.
# Takes the key as the only argument and reads the value from stdin.
# add_kv_tag() converts the input value to hex, because (1) DigitalOcean
# tags may only contain letters, numbers, : - and _, and (2) there is
# currently a bug that makes tags case-insensitive, so we can't use base64.
function cloud::add_kv_tag() {
local key="$1"
local value="$(xxd -p -c 255)"
cloud::add_tag "kv:${key}:${value}"
}
# Adds a key-value tag where the value is already hex-encoded.
function cloud::add_encoded_kv_tag() {
local key="$1"
read value
cloud::add_tag "kv:${key}:${value}"
}
log_for_sentry "Starting install"
# DigitalOcean's docker image comes with ufw enabled by default, disable so when
# can serve the shadowbox manager and instances on arbitrary high number ports.
log_for_sentry "Disabling ufw"
ufw disable
# Recent DigitalOcean Ubuntu droplets have unattended-upgrades configured from
# the outset but we want to enable automatic rebooting so that critical updates
# are applied without the Outline user's intervention.
readonly UNATTENDED_UPGRADES_CONFIG=/etc/apt/apt.conf.d/50unattended-upgrades
if [ -f $UNATTENDED_UPGRADES_CONFIG ]; then
log_for_sentry "Configuring auto-updates"
cat >> $UNATTENDED_UPGRADES_CONFIG << EOF
// Enabled by Outline manager installer.
Unattended-Upgrade::Automatic-Reboot "true";
EOF
fi
log_for_sentry "Getting SB_PUBLIC_IP"
export SB_PUBLIC_IP=$(cloud::public_ip)
log_for_sentry "Initializing ACCESS_CONFIG"
export ACCESS_CONFIG="$SHADOWBOX_DIR/access.txt"
> $ACCESS_CONFIG
# Set trap which publishes an error tag and sentry report only if there is an error.
function finish {
INSTALL_SERVER_EXIT_CODE=$?
log_for_sentry "In EXIT trap, exit code $INSTALL_SERVER_EXIT_CODE"
if [[ -z $(grep apiUrl $ACCESS_CONFIG) ]] || [[ -z $(grep certSha256 $ACCESS_CONFIG) ]]; then
echo "INSTALL_SCRIPT_FAILED: $INSTALL_SERVER_EXIT_CODE" | cloud::add_kv_tag "install-error"
# Post error report to sentry.
post_sentry_report
fi
}
trap finish EXIT
# Run install script asynchronously, so tags can be written as soon as they are ready.
log_for_sentry "Running install_server.sh"
./install_server.sh&
install_pid=$!
# Save tags for access information.
log_for_sentry "Reading tags from ACCESS_CONFIG"
tail -f $ACCESS_CONFIG --pid=$install_pid | while IFS=: read key value; do
case "$key" in
certSha256)
# Bypass encoding
log_for_sentry "Writing certSha256 tag"
echo $value | cloud::add_encoded_kv_tag "$key"
;;
apiUrl)
log_for_sentry "Writing apiUrl tag"
echo -n $value | cloud::add_kv_tag "$key"
;;
esac
done
# Wait for install script to finish, so that if there is any error in install_server.sh,
# the finish trap in this file will be able to access its error code.
wait $install_pid

View file

@ -0,0 +1,247 @@
# Copyright 2018 The Outline Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Script to install a shadowbox docker container, a watchtower docker container
# (to automatically update shadowbox), and to create a new shadowbox user.
# You may set the following environment variables, overriding their defaults:
# SB_IMAGE: Shadowbox Docker image to install, e.g. quay.io/outline/shadowbox:nightly
# SB_API_PORT: The port number of the management API.
# SHADOWBOX_DIR: Directory for persistent Shadowbox state.
# SB_PUBLIC_IP: The public IP address for Shadowbox.
# ACCESS_CONFIG: The location of the access config text file.
# SB_DEFAULT_SERVER_NAME: Default name for this server, e.g. "Outline Server New York".
# This name will be used for the server until the admins updates the name
# via the REST API.
# SENTRY_LOG_FILE: File for writing logs which may be reported to Sentry, in case
# of an install error. No PII should be written to this file. Intended to be set
# only by do_install_server.sh.
# Requires curl and docker to be installed
set -euo pipefail
readonly SENTRY_LOG_FILE=${SENTRY_LOG_FILE:-}
function log_error() {
readonly ERROR_TEXT="\033[0;31m" # red
readonly NO_COLOR="\033[0m"
>&2 printf "${ERROR_TEXT}${1}${NO_COLOR}\n"
}
# Pretty prints text to stdout, and also writes to sentry log file if set.
function log_step() {
log_for_sentry $1
str="> $1"
okStr=" OK"
lineLength=50
echo -n "$str"
numDots=$(expr $lineLength - ${#str} - ${#okStr} - 1)
if [[ $numDots > 0 ]]; then
echo -n " "
for i in $(seq 1 "$numDots"); do echo -n .; done
fi
echo "$okStr"
}
function command_exists {
command -v "$@" > /dev/null 2>&1
}
function log_for_sentry() {
if [[ -n "$SENTRY_LOG_FILE" ]]; then
echo [$(date "+%Y-%m-%d@%H:%M:%S")] "install_server.sh" "$@" >>$SENTRY_LOG_FILE
fi
}
# Check to see if docker is installed.
log_step "Verifying that Docker is installed"
if ! command_exists docker; then
log_error "Docker must be installed, please run \"curl -sS https://get.docker.com/ | sh\" or visit https://www.docker.com/"
exit 1
fi
# Set trap which publishes error tag only if there is an error.
function finish {
EXIT_CODE=$?
if [[ $EXIT_CODE -ne 0 ]]
then
log_error "\nSorry! Something went wrong. If you can't figure this out, please copy and paste all this output into the Outline Manager screen, and send it to us, to see if we can help you."
fi
}
trap finish EXIT
function get_random_port {
local num=0 # Init to an invalid value, to prevent "unbound variable" errors.
until (( 1024 <= num && num < 65536)); do
num=$(( $RANDOM + ($RANDOM % 2) * 32768 ));
done;
echo $num;
}
install_shadowbox() {
log_for_sentry "Creating shadowbox directory"
export SHADOWBOX_DIR="${SHADOWBOX_DIR:-${HOME:-/root}/.shadowbox}"
mkdir -p $SHADOWBOX_DIR
log_for_sentry "Setting API port"
readonly SB_API_PORT="${SB_API_PORT:-$(get_random_port)}"
readonly ACCESS_CONFIG=${ACCESS_CONFIG:-$SHADOWBOX_DIR/access.txt}
readonly SB_IMAGE=${SB_IMAGE:-quay.io/outline/shadowbox:stable}
log_for_sentry "Setting SB_PUBLIC_IP"
# TODO(fortuna): Make sure this is IPv4
readonly SB_PUBLIC_IP=${SB_PUBLIC_IP:-$(curl -4s https://ipinfo.io/ip)}
log_step "Setting up key functions and constants"
if [[ ! "$SB_PUBLIC_IP" =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "Invalid IP lookup result: $SB_PUBLIC_IP"
log_for_sentry "Invalid IP lookup result"
exit 1
fi
function output_config() {
echo "$@" >> $ACCESS_CONFIG
}
# If $ACCESS_CONFIG already exists, copy it to backup then clear it.
# Note we can't do "mv" here as do_install_server.sh may already be tailing
# this file.
log_for_sentry "Initializing ACCESS_CONFIG"
[[ -f $ACCESS_CONFIG ]] && cp $ACCESS_CONFIG $ACCESS_CONFIG.bak && > $ACCESS_CONFIG
# Set watchtower to refresh every 30 seconds if a custom SB_IMAGE is used (for
# testing). Otherwise refresh every hour.
readonly WATCHTOWER_REFRESH_SECONDS=$([ $SB_IMAGE ] && echo 30 || echo 3600)
# Make a directory for persistent state
log_step "Creating persistent state dir"
readonly STATE_DIR="$SHADOWBOX_DIR/persisted-state"
mkdir -p "${STATE_DIR}"
log_step "Setting up directory"
# Generate a secret key for access to the shadowbox API and store it in a tag.
# 16 bytes = 128 bits of entropy should be plenty for this use.
function safe_base64() {
# Implements URL-safe base64 of stdin, stripping trailing = chars.
# Writes result to stdout.
# TODO: this gives the following errors on Mac:
# base64: invalid option -- w
# tr: illegal option -- -
local url_safe="$(base64 -w 0 - | tr '/+' '_-')"
echo -n "${url_safe%%=*}" # Strip trailing = chars
}
readonly SB_API_PREFIX=$(head -c 16 /dev/urandom | safe_base64)
log_step "Generating secret key"
# Generate self-signed cert and store it in the persistent state directory.
readonly CERTIFICATE_NAME="${STATE_DIR}/shadowbox-selfsigned"
readonly SB_CERTIFICATE_FILE="${CERTIFICATE_NAME}.crt"
readonly SB_PRIVATE_KEY_FILE="${CERTIFICATE_NAME}.key"
declare -a openssl_req_flags=(
-x509 -nodes -days 36500 -newkey rsa:2048
-subj "/CN=${SB_PUBLIC_IP}"
-keyout "${SB_PRIVATE_KEY_FILE}" -out "${SB_CERTIFICATE_FILE}"
)
openssl req "${openssl_req_flags[@]}" >/dev/null 2>&1
log_step "Generating self-signed certificate"
# Add a tag with the SHA-256 fingerprint of the certificate.
# (Electron uses SHA-256 fingerprints: https://github.com/electron/electron/blob/9624bc140353b3771bd07c55371f6db65fd1b67e/atom/common/native_mate_converters/net_converter.cc#L60)
# Example format: "SHA256 Fingerprint=BD:DB:C9:A4:39:5C:B3:4E:6E:CF:18:43:61:9F:07:A2:09:07:37:35:63:67"
CERT_OPENSSL_FINGERPRINT=$(openssl x509 -in "${SB_CERTIFICATE_FILE}" -noout -sha256 -fingerprint)
# Example format: "BDDBC9A4395CB34E6ECF1843619F07A2090737356367"
CERT_HEX_FINGERPRINT=$(echo ${CERT_OPENSSL_FINGERPRINT#*=} | tr --delete :)
output_config "certSha256:$CERT_HEX_FINGERPRINT"
log_step "Generating SHA-256 fingerprint"
# Start Shadowbox.
declare -a docker_shadowbox_flags=(
--name shadowbox --restart=always --net=host
-v "${STATE_DIR}:${STATE_DIR}"
-e "SB_STATE_DIR=${STATE_DIR}"
-e "SB_PUBLIC_IP=${SB_PUBLIC_IP}"
-e "SB_API_PORT=${SB_API_PORT}"
-e "SB_API_PREFIX=${SB_API_PREFIX}"
-e "SB_CERTIFICATE_FILE=${SB_CERTIFICATE_FILE}"
-e "SB_PRIVATE_KEY_FILE=${SB_PRIVATE_KEY_FILE}"
-e "SB_METRICS_URL=${SB_METRICS_URL:-}"
-e "SB_DEFAULT_SERVER_NAME=${SB_DEFAULT_SERVER_NAME:-}"
)
docker run -d "${docker_shadowbox_flags[@]}" "${SB_IMAGE}" >/dev/null
log_step "Starting Shadowbox"
# TODO(dborkan): if the script fails after docker run, it will continue to fail
# as the names shadowbox and watchtower will already be in use. Consider
# deleting the container in the case of failure (e.g. using a trap, or
# deleting existing containers on each run).
# Start watchtower to automatically fetch docker image updates.
# TODO(fortuna): Don't wait for Shadowbox to run this.
declare -a docker_watchtower_flags=(--name watchtower --restart=always)
docker_watchtower_flags+=(-v /var/run/docker.sock:/var/run/docker.sock)
docker run -d "${docker_watchtower_flags[@]}" v2tec/watchtower --cleanup --tlsverify --interval $WATCHTOWER_REFRESH_SECONDS >/dev/null
log_step "Starting Watchtower"
readonly SB_API_URL="https://${SB_PUBLIC_IP}:${SB_API_PORT}/${SB_API_PREFIX}"
# Wait for server to be ready
until curl --cacert "${SB_CERTIFICATE_FILE}" -s "${SB_API_URL}/access-keys" >/dev/null; do sleep 1; done
# Create a new user
curl --cacert "${SB_CERTIFICATE_FILE}" -X POST -s "${SB_API_URL}/access-keys" >/dev/null
log_step "Creating first user"
# API is ready. Output the config.
output_config "apiUrl:${SB_API_URL}"
log_step "Generating final output"
# TODO: Figure out how to perform more firewall tests. Unfortunately making a
# request to the manager from within the host machine may not detect
# a firewall, even if the public IP address is used.
if command_exists ufw && [[ $(ufw status) != "Status: inactive" ]]; then
log_error "You have ufw enabled on your machine, please check your configuration to ensure access to high numbered ports."
else
log_step "Cursory firewalls detection"
fi
# Echos the value of the specified field from ACCESS_CONFIG.
# e.g. if ACCESS_CONFIG contains the line "certSha256:1234",
# calling $(get_field_value certSha256) will echo 1234.
function get_field_value {
grep "$1" $ACCESS_CONFIG | sed "s/$1://"
}
# Output JSON. This relies on apiUrl and certSha256 (hex characters) requiring
# no string escaping. TODO: look for a way to generate JSON that doesn't
# require new dependencies.
cat <<END_OF_SERVER_OUTPUT
Please copy the following configuration to your Outline Manager:
{
"apiUrl": "$(get_field_value apiUrl)",
"certSha256": "$(get_field_value certSha256)"
}
END_OF_SERVER_OUTPUT
} # end of install_shadowbox
# Wrapped in a function for some protection against half-downloads.
install_shadowbox

View file

@ -0,0 +1,145 @@
// Copyright 2018 The Outline Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
export interface Server {
// Get the server's name for display.
getName(): string;
// Updates the server name.
setName(name: string): Promise<void>;
// List the access keys for this server, including the admin.
listAccessKeys(): Promise<AccessKey[]>;
// Returns stats for bytes transferred across all access keys of this server.
getDataUsage(): Promise<DataUsageByAccessKey>;
// Adds a new access key to this server.
addAccessKey(): Promise<AccessKey>;
// Renames the access key given by id.
renameAccessKey(accessKeyId: AccessKeyId, name: string): Promise<void>;
// Removes the access key given by id.
removeAccessKey(accessKeyId: AccessKeyId): Promise<void>;
// Returns whether metrics are enabled.
getMetricsEnabled(): boolean;
// Updates whether metrics are enabled.
setMetricsEnabled(metricsEnabled: boolean): Promise<void>;
// Get the server's unique ID, used for metrics reporting.
getServerId(): string;
// Checks if the server is healthy.
isHealthy(): Promise<boolean>;
// Gets the date when this server was created.
getCreatedDate(): Date;
}
// Manual servers are servers which the user has independently setup to run
// shadowbox, and can be on any cloud provider.
export interface ManualServer extends Server { forget(): void; }
// Managed servers are servers created by the Outline Manager through our
// "magic" user experience, e.g. DigitalOcean.
export interface ManagedServer extends Server {
// Returns a promise that fulfills once installation is complete.
// If resetTimeout is true, this will reset the server state and might
// wait until the timeout occurs to reconnect to the server.
waitOnInstall(resetTimeout: boolean): Promise<void>;
// Returns server host object.
getHost(): ManagedServerHost;
// Returns true when installation is complete.
isInstallCompleted(): boolean;
}
// The managed machine where the Outline Server is running.
export interface ManagedServerHost {
// Returns the monthly transfer limit.
getMonthlyTransferLimit(): DataAmount;
// Returns the monthly cost.
getMonthlyCost(): MonetaryCost;
// Returns the server region.
getRegionId(): RegionId;
// Deletes the server - cannot be undone.
delete(): Promise<void>;
}
export class DataAmount { terabytes: number; }
export class MonetaryCost {
// Value in US dollars.
usd: number;
}
export type RegionId = string;
// Keys are cityIds like "nyc". Values are regions like ["nyc1", "nyc3"].
export type RegionMap = {
[cityId: string]: RegionId[]
};
// Repository of ManagedServer objects. These servers are created by the server
// manager on cloud providers where we can provide a "magical" user experience,
// e.g. DigitalOcean.
export interface ManagedServerRepository {
// Lists all existing Shadowboxes.
listServers(): Promise<ManagedServer[]>;
// Return a map of regions that are available and support our target machine size.
getRegionMap(): Promise<Readonly<RegionMap>>;
// Creates a server and returning it when it becomes active (i.e. the server has
// created, not necessarily once shadowbox installation has finished).
createServer(region: RegionId): Promise<ManagedServer>;
}
// Configuration for manual servers. This is the output emitted from the
// shadowbox install script, which is needed for the manager connect to
// shadowbox.
export interface ManualServerConfig {
apiUrl: string;
certSha256: string;
}
// Repository of ManualServer objects. These are servers the user has setup
// themselves, and configured to run shadowbox, outside of the manager.
export interface ManualServerRepository {
// Lists all existing Shadowboxes.
listServers(): Promise<ManualServer[]>;
// Adds a manual server using the config (e.g. user input).
addServer(config: ManualServerConfig): Promise<ManualServer>;
}
export type AccessKeyId = string;
export interface AccessKey {
id: AccessKeyId;
name: string;
accessUrl: string;
}
// Byte transfer stats for the past 30 days, including both inbound and outbound.
// TODO: this is copied at src/shadowbox/model/metrics.ts. Both copies should
// be kept in sync, until we can find a way to share code between the web_app
// and shadowbox.
export interface DataUsageByAccessKey {
// The accessKeyId should be of type AccessKeyId, however that results in the tsc
// error TS1023: An index signature parameter type must be 'string' or 'number'.
// See https://github.com/Microsoft/TypeScript/issues/2491
// TODO: this still says "UserId", changing to "AccessKeyId" will require
// a change on the shadowbox server.
bytesTransferredByUserId: {[accessKeyId: string]: number};
}

View file

@ -0,0 +1,30 @@
{
"name": "outline-manager",
"productName": "Outline Manager",
"version": "1.0.0",
"description": "Create and manage access to Outline servers",
"homepage": "https://getoutline.org/",
"author": {
"name": "The Outline authors",
"email": "info@getoutline.org"
},
"dependencies": {
"bytes": "^3.0.0",
"clipboard-polyfill": "^2.4.6",
"eventemitter3": "^2.0.3",
"node-forge": "^0.7.1",
"raven-js": "^3.17.0",
"request-lite": "^2.40.1",
"semver": "^5.4.1"
},
"devDependencies": {
"@types/bytes": "^2.5.1",
"@types/node-forge": "^0.6.9",
"@types/semver": "^5.4.0",
"bower": "^1.8.0",
"browserify": "^14.5.0",
"electron": "^1.7.9",
"electron-builder": "^20.4.1",
"electron-icon-maker": "^0.0.4"
}
}

View file

@ -0,0 +1,20 @@
// Copyright 2018 The Outline Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Extension to @types/node-forge to add the missing definitions that we need.
declare module 'node-forge' {
namespace ssh {
function publicKeyToOpenSSH(privateKey?: string, passphrase?: string): string;
}
}

View file

@ -0,0 +1,24 @@
// Copyright 2018 The Outline Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// TODO(dborkan): request-lite should be the same type as defined in the
// @types/request module. We should re-use those typings if possible, or just
// use another lightweight request module with it's own @type supplied.
declare module 'request-lite' {
// tslint:disable-next-line:no-any
function request(
url: string, callback: (error: Error, repsonse: any, body: string) => void): void;
namespace request {}
export = request;
}

View file

@ -0,0 +1,307 @@
<!--
Copyright 2018 The Outline Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<link rel='import' href='../bower_components/polymer/polymer.html'>
<link rel="import" href="../bower_components/app-layout/app-drawer/app-drawer.html">
<link rel='import' href='../bower_components/iron-icon/iron-icon.html'>
<link rel='import' href='../bower_components/iron-icons/iron-icons.html'>
<link rel='import' href='../bower_components/iron-pages/iron-pages.html'>
<link rel='import' href='../bower_components/paper-icon-button/paper-icon-button.html'>
<link rel='import' href='../bower_components/paper-toast/paper-toast.html'>
<link rel='import' href='../bower_components/paper-dialog/paper-dialog.html'>
<link rel='import' href='../bower_components/paper-dialog-scrollable/paper-dialog-scrollable.html'>
<link rel="import" href="./cloud-install-styles.html">
<link rel="import" href="./outline-about-dialog.html">
<link rel="import" href="./outline-feedback-dialog.html">
<link rel="import" href="./outline-modal-dialog.html">
<link rel="import" href="./outline-server-creator.html">
<link rel="import" href="./outline-server-view.html">
<dom-module id="app-root">
<template>
<style include='cloud-install-styles'></style>
<style>
:host {
width: 100%;
--primary-green: #00bfa5;
}
/* CONTENT */
#contentColumn {
align-items: stretch;
display: flex;
flex-direction: column;
margin: auto;
position: relative;
}
@media only screen and (max-device-width: 500px) {
#contentColumn {
width: 95%;
}
}
/* BOTTOM NOTIFICATION */
#toast {
align-items: center;
display: flex;
justify-content: space-between;
padding: 24px;
max-width: 450px;
}
#toast paper-icon-button {
/* prevents the icon from resizing when there is a long message in
the toast */
flex-shrink: 0;
padding: 0;
height: 20px;
width: 20px;
}
#settingsDrawer {
z-index: 1000;
margin-top: 12px;
}
#settingsDrawer iron-icon {
margin-right: 12px;
}
#settingsDrawer .settingsMenuItem {
cursor: pointer;
padding: 12px 24px 12px 24px;
font-size: 14px;
}
#settingsDrawer .settingsMenuItem:hover {
color: var(--primary-green);
}
#settingsDrawer #signedIn {
text-align: center;
}
#settingsDrawer #signedIn img {
height: 65px;
margin-top: 12px;
}
#settingsDrawer #signOutButton {
font-weight: bold;
margin-bottom: 24px;
cursor: pointer;
text-transform: uppercase;
}
#settingsDrawer #signOutButton:hover {
color: var(--primary-green);
}
app-toolbar [main-title] {
font-family: 'Google Sans', 'Roboto', sans-serif;
font-size: 20px;
text-align: center;
}
app-toolbar paper-icon-button {
/* needed so the "Outline Manager" title appears centered in the window. */
position: absolute;
}
</style>
<app-drawer id="settingsDrawer">
<div id='signedIn' hidden$='{{!isSignedIn}}'>
<img src='images/manager-profile-2x.png'>
<p>{{adminEmail}}</p>
<div id='signOutButton' on-tap='signOutTapped'>Sign Out</div>
<hr>
</div>
<div on-tap='dataCollectionTapped' class='settingsMenuItem' paper-drawer-toggle>
<iron-icon icon="lock"></iron-icon>Data Collection
</div>
<div on-tap='privacyTapped' class='settingsMenuItem' paper-drawer-toggle>
<iron-icon icon="lock"></iron-icon>Privacy
</div>
<div on-tap='termsTapped' class='settingsMenuItem' paper-drawer-toggle>
<iron-icon icon="info"></iron-icon>Terms
</div>
<div on-tap='submitFeedbackTapped' class='settingsMenuItem' paper-drawer-toggle>
<iron-icon icon="feedback"></iron-icon>Submit Feedback
</div>
<div on-tap='helpTapped' class='settingsMenuItem' paper-drawer-toggle>
<iron-icon icon="help"></iron-icon>Help Center
</div>
<div on-tap='aboutTapped' class='settingsMenuItem' paper-drawer-toggle>
<iron-icon icon="info"></iron-icon>About Outline
</div>
<div on-tap='showLicensesTapped' class='settingsMenuItem' paper-drawer-toggle>
<iron-icon icon="info"></iron-icon>Show Licenses
</div>
</app-drawer>
<app-toolbar class='toolbar'>
<paper-icon-button icon="menu" on-tap="toggleSettingsDrawer"></paper-icon-button>
<div main-title>Outline Manager</div>
</app-toolbar>
<div id='contentColumn'>
<iron-pages id='content' attr-for-selected="id">
<outline-server-creator id='serverCreator'></outline-server-creator>
<outline-server-view id='serverView'></outline-server-view>
</iron-pages>
</div>
<paper-toast id='toast'><paper-icon-button icon='icons:close' on-tap='closeError'></paper-icon-button></paper-toast>
<outline-feedback-dialog id='feedbackDialog'></outline-feedback-dialog>
<outline-about-dialog id='aboutDialog' outline-version='[[outlineVersion]]'></outline-about-dialog>
<outline-modal-dialog id='modalDialog'></outline-modal-dialog>
<paper-dialog id="licenses" restoreFocusOnClose>
<paper-dialog-scrollable>
<code id="licensesText">
Could not load license.txt.
</code>
</paper-dialog-scrollable>
<div class="buttons">
<paper-button dialog-dismiss autofocus>Close</paper-button>
</div>
</paper-dialog>
</template>
<script>
Polymer({
is: 'app-root',
properties: {
adminEmail: {
type: String,
value: ''
},
isSignedIn: {
type: Boolean,
computed: '_isSignedIn(adminEmail)'
},
outlineVersion: String
},
getAndShowServerCreator: function () {
this.$.content.select('serverCreator');
return this.$.serverCreator;
},
getServerCreator: function() {
return this.$.serverCreator;
},
getAndShowServerView: function (server) {
this.server = server;
this.$.content.select('serverView');
this.$.serverCreator.stop();
this.$.serverView.initHelpBubbles();
return this.$.serverView;
},
getServerView: function() {
return this.$.serverView;
},
showError: function (errorMsg) {
this.showToast(errorMsg, Infinity);
},
showNotification: function (message) {
const NOTIFICATION_TOAST_DURATION_MS = 3000;
this.showToast(message, NOTIFICATION_TOAST_DURATION_MS);
},
showToast: function(message, duration) {
const toast = this.$.toast;
toast.close();
// Defer in order to trigger the toast animation, otherwise the
// update happens in place.
setTimeout(() => {
toast.show({
text: message,
duration: duration,
noOverlap: true
});
}, 0);
},
closeError: function () {
this.$.toast.close();
},
// cb is a function which accepts a single boolean which is true iff
// the user chose to retry the failing operation.
showConnectivityDialog: function (cb) {
const dialogTitle = 'Connection problem';
const dialogText = 'We\'re having trouble connecting with your DigitalOcean account. This is often a temporary problem with DigitalOcean or with your internet connection. In some cases, logging into DigitalOcean again will fix the problem.';
this.showModalDialog(dialogTitle, dialogText, ['login', 'retry'])
.then((clickedButtonIndex) => {
cb(clickedButtonIndex === 1); // pass true if user clicked retry
});
},
getConfirmation: function(title, text, confirmButtonText, continueFunc) {
this.showModalDialog(title, text, ['Cancel', confirmButtonText])
.then((clickedButtonIndex) => {
if (clickedButtonIndex === 1) { // user clicked to confirm.
continueFunc();
}
});
},
_isSignedIn: function (adminEmail) {
return Boolean(adminEmail);
},
toggleSettingsDrawer: function() {
this.$.settingsDrawer.toggle();
},
closeSettingsDrawer: function() {
this.$.settingsDrawer.close();
},
submitFeedbackTapped: function () {
this.closeSettingsDrawer();
this.$.feedbackDialog.open();
},
termsTapped: function () {
this.closeSettingsDrawer();
window.open('https://s3.amazonaws.com/outline-vpn/static_downloads/Outline-Terms-of-Service.html');
},
privacyTapped: function () {
this.closeSettingsDrawer();
window.open('https://www.google.com/policies/privacy/');
},
dataCollectionTapped: function () {
this.closeSettingsDrawer();
window.open('https://s3.amazonaws.com/outline-vpn/index.html#/en/support/dataCollection');
},
aboutTapped: function() {
this.closeSettingsDrawer();
this.$.aboutDialog.open();
},
helpTapped: function() {
this.closeSettingsDrawer();
window.open('https://s3.amazonaws.com/outline-vpn/index.html#/en/support/');
},
signOutTapped: function() {
this.closeSettingsDrawer();
this.fire('SignOutRequested');
},
openManualInstallFeedback: function(prepopulatedMessage) {
this.$.feedbackDialog.open(prepopulatedMessage, true);
},
// Returns a Promise which fulfills with the index of the button clicked.
showModalDialog: function(title, text, buttons) {
return this.$.modalDialog.open(title, text, buttons);
},
showLicensesTapped: function () {
this.closeSettingsDrawer();
var xhr = new XMLHttpRequest();
xhr.onload = () => {
this.$.licensesText.innerText = xhr.responseText;
this.$.licenses.open();
};
xhr.onerror = () => {
console.error('could not load license.txt');
};
xhr.open('GET', '/ui_components/licenses/licenses.txt', true);
xhr.send();
}
});
</script>
</dom-module>

View file

@ -0,0 +1,28 @@
<!--
Copyright 2018 The Outline Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<script>
// TODO: translate this
const cityEnglishNameById = {
ams: 'Amsterdam',
sgp: 'Singapore',
blr: 'Bangalore',
fra: 'Frankfurt',
lon: 'London',
sfo: 'San Francisco',
tor: 'Toronto',
nyc: 'New York'
};
</script>

View file

@ -0,0 +1,212 @@
<!--
Copyright 2018 The Outline Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<link rel='import' href='../bower_components/polymer/polymer.html'>
<!-- Polymer style module to share styles between steps
https://www.polymer-project.org/2.0/docs/devguide/style-shadow-dom#style-modules -->
<dom-module id="cloud-install-styles">
<template>
<style>
#title {
font-weight: 100;
color: rgba(0, 0, 0, .87);
font-size: 24px;
line-height: 1.5em;
display: inline-block;
-webkit-margin-before: 1.25em;
-webkit-margin-after: 0em;
-webkit-margin-start: 0px;
-webkit-margin-end: 0px;
}
paper-button {
font-size: 14px;
padding: 1em 3em 1em 3em;
font-weight: 500;
color: rgba(0, 0, 0, 0.87);
letter-spacing: 0.05em;
border-radius: 2px;
}
paper-button.primary {
transition: .5s;
color: white;
background-color: #263238;
width: 56%;
}
paper-button.secondary {
background-color: none;
}
paper-button[disabled] {
background-color: rgba(0, 0, 0, 0.25);
color: white;
}
paper-progress {
width: 100%;
margin-top: 24px;
}
hr {
margin: 2em 0 2em 0;
}
paper-dropdown-menu {
width: 100%;
}
app-toolbar {
background-color: #263238;
color: #EEE;
font-size: 12px;
font-weight: 300;
letter-spacing: .02em;
color: rgba(255,255,255,0.86);
padding: 0;
border-bottom: 1px solid rgba(0, 0, 0, 0.12);
/* Toolbar Copy 3: */
}
app-toolbar paper-icon-button {
margin-left: 16px;
margin-right: 26px;
}
app-toolbar h2 {
color: #e0e2e3;
font-size: 19px;
font-weight: 400;
}
p {
color: rgba(0, 0, 0, 0.54);
margin-top: 12px;
margin-bottom: 24px;
}
paper-dialog {
max-width: 540px;
min-width: 480px;
margin: 56px 32px 32px 32px;
}
paper-dialog-scrollable {
width: 100%;
margin: 0;
}
paper-dialog-scrollable img{
padding-top: 24px;
padding-bottom: 24px;
}
paper-dialog .dialogBanner {
background-color: #eceff1;
text-align: center;
margin-top: 0;
padding-top: 50px;
height: 150px;
}
paper-dialog .dialogBanner img {
height: 150px;
}
.instructions-list {
margin: auto;
padding-right: 42px;
padding-left: 42px;
max-width: 400px;
}
.instructions-list ol {
margin: 0 0 0 0 ;
padding: 0 24px 0 56px;
text-align: center !important;
}
.instructions-list li {
padding: 0 12px 24px 20px;
text-align: left;
}
.instructions-list li:before {
padding: 0 0 30px 20px;
}
.instructions-list paper-button {
margin-top: 20px;
}
.instructions-list a {
text-decoration: underline;
color: rgba(0, 0, 0, 0.87);
font-weight: 500;
}
.instructions-list p {
color: rgba(0, 0, 0, 0.54);
}
.instructions-list img {
padding: 32px 0px 42px 0;
margin: auto;
}
.walkthrough {
background: #FFFFFF;
box-shadow: 0 3px 5px 0 rgba(0,0,0,0.10), 0 2px 4px 0 rgba(0,0,0,0.1), 0 4px 4px 0 rgba(0,0,0, .12);
top: 0px;
display: block;
}
.walkthrough h3 {
font-size: 14px;
line-height: 24px;
color: rgba(0,0,0,0.87);
max-width: 70%;
margin: auto;
padding: 0px 0px 24px 0px;
font-weight: normal;
}
a {
text-decoration: none;
}
.learnMoreLink {
text-decoration: underline;
color: rgba(0, 0, 0, 0.54);
}
/*
Helps make sure elements using both iron-flex-layout and the hidden
attribute actually hide:
- https://github.com/Polymer/polymer/issues/3711
- https://github.com/PolymerElements/iron-flex-layout/issues/86
*/
[hidden] {
display: none !important;
}
</style>
</template>
</dom-module>

View file

@ -0,0 +1,25 @@
# HOWTO re-generate `license.txt`
## Requirements
* `yarn`
* `https://github.com/Jigsaw-Code/bower-disclaimer`
## Steps
* `cd` to the root of your clone of this repo
* Ensure `bower_components` and `node_modules` are up to date and only include dependencies of the Electron app by running `yarn run clean && yarn && yarn do yarn do server_manager/web_app/build`
* `cd src/server_manager`
* `yarn licenses generate-disclaimer --prod > /tmp/yarn`
* `node <path to your bower-disclaimer repo root>/build > /tmp/bower`
* `cat /tmp/{yarn,bower} > ui_components/licenses/licenses.txt`
Done!
## Check
To quickly test for non-compliant licenses:
```bash
yarn licenses list --prod|grep License:|sort -u
```

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,90 @@
<!--
Copyright 2018 The Outline Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<link rel='import' href='../bower_components/polymer/polymer.html'>
<link rel='import' href='../bower_components/paper-dialog/paper-dialog.html'>
<link rel="import" href="./cloud-install-styles.html">
<dom-module id="outline-about-dialog">
<template>
<style include="cloud-install-styles">
#dialog {
width: 80%;
text-align: center;
}
#outlineLogo {
height: 100px;
margin-top: 20px;
}
#version {
font-weight: bold;
}
p {
margin: 20px 0 0 0;
text-align: left;
}
#version {
margin: 0;
text-align: center;
}
a {
color: #00AC9B;
}
#licenses {
min-width: 90%;
}
#licenses code {
font-size: 0.7em;
}
</style>
<paper-dialog id="dialog" modal>
<div>
<img id="outlineLogo" src="images/manager-about-logo2x.png">
</div>
<p id='version'>Version [[outlineVersion]]</p>
<p>Outline is an open source project created by <a href="https://jigsaw.google.com/">Jigsaw</a> to provide a safer way for news organizations and journalists to access the internet. Learn more about Outline on <a href="https://s3.amazonaws.com/outline-vpn/index.html">our website</a>.</p>
<p>Outline is still an early stage project. You can contribute to the code on <a href="https://github.com/jigsaw-Code/?q=outline">GitHub</a>, and follow us on <a href="https://www.reddit.com/r/outlinevpn/">Reddit</a> and <a href="https://medium.com/jigsaw">Medium</a> to hear when we expand to more platforms and add new features.</p>
<p>
<a href="https://jigsaw.google.com/">
<img src="images/jigsaw-logo.svg">
</a>
</p>
<div class="buttons">
<paper-button dialog-dismiss autofocus>Close</paper-button>
</div>
</paper-dialog>
</template>
<script>
Polymer({
is: 'outline-about-dialog',
properties: {
outlineVersion: String
},
open: function () {
this.$.dialog.open();
}
});
</script>
</dom-module>

View file

@ -0,0 +1,165 @@
<!--
Copyright 2018 The Outline Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<link rel='import' href='../bower_components/paper-dialog/paper-dialog.html'>
<link rel='import' href='../bower_components/paper-dropdown-menu/paper-dropdown-menu.html'>
<link rel='import' href='../bower_components/paper-item/paper-item.html'>
<link rel='import' href='../bower_components/paper-listbox/paper-listbox.html'>
<link rel='import' href='../bower_components/paper-input/paper-input.html'>
<link rel='import' href='../bower_components/paper-input/paper-textarea.html'>
<!-- this is needed to fix the "KeyframeEffect is not defined"
see https://github.com/PolymerElements/paper-swatch-picker/issues/36 -->
<link rel='import' href='../bower_components/web-animations-js/web-animations-next.min.html'>
<dom-module id='outline-feedback-dialog'>
<template>
<style include='cloud-install-styles'></style>
<style>
:host {
margin: 0px;
}
#feedbackWrapper {
margin-top: 0;
}
/*
This element is tricky to size.
We need to constrain its height because paper-dialog doesn't handle things well when its
height exceeds that of the page. max-rows isn't a reliable way to constrain the element's
height because it does not consider line wrapping:
https://github.com/PolymerElements/paper-input/issues/158
By configuring a max-height and setting overflow-y:scroll on the paper-textarea we get its
autogrow behaviour, at the cost of always showing a vertical scrollbar (even when there is
just one line).
*/
#userFeedback {
max-height: 150px;
overflow-x: hidden;
overflow-y: scroll;
}
#userEmail {
/* compensate for extra space added for #userFeedback's error label */
margin-top: -10px;
}
p a {
color: var(--primary-green);
}
paper-input, paper-textarea, paper-dropdown-menu {
--paper-input-container-focus-color: var(--primary-green);
}
#feedbackExplanation {
display: none;
}
.installationFailed #feedbackCategory {
display: none;
}
.installationFailed #userFeedback {
background-color: #ECEFF1;
margin-top: 1em;
}
.installationFailed #feedbackExplanation {
display: block;
}
</style>
<paper-dialog id='dialog' modal>
<h2>[[title]]</h2>
<div id='feedbackWrapper'>
<p id='feedbackExplanation'>[[feedbackExplanation]]</p>
<paper-dropdown-menu id='feedbackCategory' horizontal-align='left'>
<paper-listbox id='feedbackCategoryListbox' slot='dropdown-content'class='dropdown-content' selected='0'>
<paper-item>General Feedback</paper-item>
<paper-item>Performance</paper-item>
<paper-item>Server Connection</paper-item>
<paper-item>Installation Failed</paper-item>
</paper-listbox>
</paper-dropdown-menu>
<paper-textarea id='userFeedback' type='text' placeholder='Your feedback' error-message='Please enter feedback.' on-value-changed='userFeedbackValueChanged'></paper-textarea>
<paper-input id='userEmail' type='text' placeholder='Email address (optional)'></paper-input>
<p>
Your feedback, email address (if provided) and additional information
referred to in the <a href="https://s3.amazonaws.com/outline-vpn/index.html#/en/support/dataCollection">privacy policy</a>
will be sent to the Outline team.
</p>
</div> <!-- end of #feedbackWrapper -->
<p class="buttons">
<paper-button dialog-dismiss>Cancel</paper-button>
<paper-button autofocus on-tap='submitTappedHandler'>Submit</paper-button>
</p>
</paper-dialog>
</template>
<script>
Polymer({
is: 'outline-feedback-dialog',
properties: {
title: String,
feedbackExplanation: String,
feedbackCategories: {
type: Object,
readonly: true,
value: { // Maps a category to its `feedbackCategoryListbox` item index.
GENERAL: 0,
PERFORMANCE: 1,
CONNECTION: 2,
INSTALLATION: 3
}
}
},
open: function(prepopulatedMessage, showInstallationFailed, feedbackCategory = 0) {
// Clear all fields, in case feedback had already been entered.
if (showInstallationFailed) {
this.title = 'Outline Server Installation Failed';
this.feedbackExplanation = 'An error occurred while attempting to install Outline on your server. If you haven\'t been able to figure out a solution, please consider sending us feedback and telling us your email address (optional) so that we can get back to you.';
this.$.dialog.classList.add('installationFailed');
this.$.feedbackCategoryListbox.selected = 3;
} else {
this.title = 'Send Feedback';
this.feedbackExplanation = '';
this.$.dialog.classList.remove('installationFailed');
this.$.feedbackCategoryListbox.selected = feedbackCategory;
}
this.$.userFeedback.invalid = false;
this.$.userFeedback.value = prepopulatedMessage || '';
this.$.userEmail.value = '';
this.$.dialog.open();
},
submitTappedHandler: function() {
// Verify that userFeedback is entered.
if (!this.$.userFeedback.value) {
this.$.userFeedback.invalid = true;
return;
}
const data = {
feedbackCategory: this.$.feedbackCategory.selectedItemLabel,
userFeedback: this.$.userFeedback.value,
userEmail: this.$.userEmail.value,
};
this.fire('SubmitFeedback', data);
this.$.dialog.close();
},
userFeedbackValueChanged: function() {
// Hides any error message when the user starts typing feedback.
this.$.userFeedback.invalid = false;
// Make the paper-dialog (vertically) re-center.
this.$.dialog.notifyResize();
}
});
</script>
</dom-module>

View file

@ -0,0 +1,146 @@
<!--
Copyright 2018 The Outline Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<link rel='import' href='../bower_components/polymer/polymer.html'>
<link rel='import' href='../bower_components/iron-fit-behavior/iron-fit-behavior.html'>
<dom-module id='outline-help-bubble'>
<template>
<style>
:host {
margin: 10px;
z-index: 100;
}
.helpContent {
background-color: var(--primary-green);
padding: 32px 32px 32px 32px;
font-size: 14px;
width: 250px;
border-radius: 4px;
box-shadow: 0 8px 10px 0 rgba(0,0,0,0.20);
}
.upArrowWrapper, .downArrowWrapper, .rightArrowWrapper, .leftArrowWrapper {
display: none;
position: absolute;
text-align: center;
}
:host(.showArrow-up) .upArrowWrapper,
:host(.showArrow-down) .downArrowWrapper,
:host(.showArrow-left) .leftArrowWrapper,
:host(.showArrow-right) .rightArrowWrapper {
display: block;
}
.upArrowWrapper {
top: -13px;
width: 100%;
left: 0px;
}
.downArrowWrapper {
top: 100%;
width: 100%;
left: 0px;
margin-top: -3px;
}
.rightArrowWrapper {
top: 8px;
left: 100%;
}
.leftArrowWrapper {
top: 8px;
left: -10px;
}
.upArrow, .downArrow, .rightArrow, .leftArrow {
width: 0px;
height: 0px;
display: inline-block;
}
.upArrow {
border-bottom: 10px solid var(--primary-green);
border-left: 10px solid transparent;
border-right: 10px solid transparent;
}
.downArrow {
border-top: 10px solid var(--primary-green);
border-left: 10px solid transparent;
border-right: 10px solid transparent;
}
.rightArrow {
border-left: 10px solid var(--primary-green);
border-top: 10px solid transparent;
border-bottom: 10px solid transparent;
}
.leftArrow {
border-right: 10px solid var(--primary-green);
border-top: 10px solid transparent;
border-bottom: 10px solid transparent;
}
:host(.offset-right) .upArrowWrapper, :host(.offset-right) .downArrowWrapper {
margin-left: 30%;
}
:host(.offset-left) .upArrowWrapper, :host(.offset-left) .downArrowWrapper {
margin-left: -30%;
}
</style>
<div class="rightArrowWrapper"><div class="rightArrow"></div></div>
<div class="leftArrowWrapper"><div class="leftArrow"></div></div>
<div class="upArrowWrapper"><div class="upArrow"></div></div>
<div class="downArrowWrapper"><div class="downArrow"></div></div>
<div class="helpContent"><slot></slot></div>
</template>
<script>
Polymer({
is: 'outline-help-bubble',
behaviors: [
// Take all behaviors from IronFitBehavior, used for positioning relative
// to .positionTarget.
Polymer.IronFitBehavior
],
ready: function() {
// Prevent help bubble from overlapping with it's positionTarget.
this.setAttribute('no-overlap', true);
// Help bubble should default to hidden until show is called.
this.setAttribute('hidden', true);
},
show: function(positionTarget, arrowDirection, leftOrRightOffset) {
this.removeAttribute('hidden');
// Set arrow direction.
this.classList.add('showArrow-' + arrowDirection);
// Apply left or right offset to arrow, e.g. display an up-pointing
// arrow on the top right.
const isUpOrDown = arrowDirection === 'up' || arrowDirection === 'down';
if (isUpOrDown &&
(leftOrRightOffset === 'left' || leftOrRightOffset === 'right')) {
this.classList.add('offset-' + leftOrRightOffset);
}
// Position the help bubble.
this.positionTarget = positionTarget;
this.refit();
// Listen to scroll event so the help bubble can reposition if needed.
window.addEventListener('scroll', this.refit.bind(this));
},
hide: function() {
this.setAttribute('hidden', true);
window.removeEventListener('scroll', this.refit.bind(this));
this.fire('outline-help-bubble-dismissed');
}
});
</script>
</dom-module>

Some files were not shown because too many files have changed in this diff Show more