summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAndrej Mihajlov <and@codeispoetry.ru>2017-03-01 12:48:46 +0000
committerAndrej Mihajlov <and@codeispoetry.ru>2017-03-01 12:48:46 +0000
commit480d524dd655518ce1a4bc7315c1b81f9c02e159 (patch)
tree32905819b1612bb8242400ebea79abdef634a608
parentf2387c73988fac583adf0f9d4ee69e1d85c8d75b (diff)
downloadmullvadvpn-480d524dd655518ce1a4bc7315c1b81f9c02e159.tar.xz
mullvadvpn-480d524dd655518ce1a4bc7315c1b81f9c02e159.zip
Split constants on enums and config.json
-rw-r--r--app/app.js2
-rw-r--r--app/components/Connect.js3
-rw-r--r--app/components/Login.js3
-rw-r--r--app/components/SelectLocation.js2
-rw-r--r--app/components/Settings.js2
-rw-r--r--app/config.json156
-rw-r--r--app/constants.js120
-rw-r--r--app/containers/LoginPage.js2
-rw-r--r--app/containers/SettingsPage.js2
-rw-r--r--app/enums.js4
-rw-r--r--app/lib/backend-redux-actions.js2
-rw-r--r--app/lib/backend.js3
-rw-r--r--app/reducers/connect.js2
-rw-r--r--app/reducers/settings.js2
-rw-r--r--app/reducers/user.js4
-rw-r--r--app/routes.js2
-rw-r--r--test/actions.spec.js2
-rw-r--r--test/reducers.spec.js3
-rw-r--r--test/routing.spec.js2
-rw-r--r--test/support.js3
20 files changed, 182 insertions, 139 deletions
diff --git a/app/app.js b/app/app.js
index 99dcd4e83a..e43a1de173 100644
--- a/app/app.js
+++ b/app/app.js
@@ -11,7 +11,7 @@ import connectActions from './actions/connect';
import Backend from './lib/backend';
import mapBackendEventsToReduxActions from './lib/backend-redux-actions';
import mapBackendEventsToRouter from './lib/backend-routing';
-import { LoginState, ConnectionState } from './constants';
+import { LoginState, ConnectionState } from './enums';
const initialState = {};
const memoryHistory = createMemoryHistory();
diff --git a/app/components/Connect.js b/app/components/Connect.js
index e90201c363..d2986991fc 100644
--- a/app/components/Connect.js
+++ b/app/components/Connect.js
@@ -4,7 +4,8 @@ import { If, Then, Else } from 'react-if';
import cheapRuler from 'cheap-ruler';
import ReactMapboxGl, { Marker } from 'react-mapbox-gl';
import { Layout, Container, Header } from './Layout';
-import { ConnectionState, mapbox as mapboxConfig } from '../constants';
+import { mapbox as mapboxConfig } from '../config';
+import { ConnectionState } from '../enums';
export default class Connect extends Component {
diff --git a/app/components/Login.js b/app/components/Login.js
index bc3d6e7892..51f363f49c 100644
--- a/app/components/Login.js
+++ b/app/components/Login.js
@@ -2,7 +2,8 @@ import { shell } from 'electron';
import React, { Component, PropTypes } from 'react';
import { If, Then } from 'react-if';
import { Layout, Container, Header } from './Layout';
-import { links, LoginState } from '../constants';
+import { links } from '../config';
+import { LoginState } from '../enums';
import { formatAccount } from '../lib/formatters';
export default class Login extends Component {
diff --git a/app/components/SelectLocation.js b/app/components/SelectLocation.js
index 0720a983d6..9b7bbae625 100644
--- a/app/components/SelectLocation.js
+++ b/app/components/SelectLocation.js
@@ -1,7 +1,7 @@
import React, { Component, PropTypes } from 'react';
import { If, Then } from 'react-if';
import { Layout, Container, Header } from './Layout';
-import { servers } from '../constants';
+import { servers } from '../config';
import CustomScrollbars from './CustomScrollbars';
export default class SelectLocation extends Component {
diff --git a/app/components/Settings.js b/app/components/Settings.js
index c2a77da34f..64135d98dc 100644
--- a/app/components/Settings.js
+++ b/app/components/Settings.js
@@ -3,7 +3,7 @@ import { Layout, Container, Header } from './Layout';
import Switch from './Switch';
import CustomScrollbars from './CustomScrollbars';
import { formatAccount } from '../lib/formatters';
-import { links } from '../constants';
+import { links } from '../config';
import { shell } from 'electron';
export default class Settings extends Component {
diff --git a/app/config.json b/app/config.json
new file mode 100644
index 0000000000..d6cd2993f0
--- /dev/null
+++ b/app/config.json
@@ -0,0 +1,156 @@
+{
+ "mapbox": {
+ "accessToken": "pk.eyJ1IjoibWpob21lciIsImEiOiJjaXd3NmdmNHEwMGtvMnlvMGl3b3R5aGcwIn0.SqIPBcCP6-b9yjxCD32CNg",
+ "styleURL": "mapbox://styles/mjhomer/cizjoenga006f2smnm9z52u8e"
+ },
+ "links": {
+ "createAccount": "https://mullvad.net/account/create/",
+ "purchase": "https://mullvad.net/account/",
+ "faq": "https://mullvad.net/faq/",
+ "guides": "https://mullvad.net/guides/",
+ "supportEmail": "mailto:support@mullvad.net"
+ },
+ "defaultServer": "fastest",
+ "servers": {
+ "ca1.mullvad.net": {
+ "address": "ca1.mullvad.net",
+ "name": "Canada",
+ "city": "Ottawa",
+ "country": "Canada",
+ "location": [
+ 45.42153,
+ -75.697193
+ ]
+ },
+ "ca2.mullvad.net": {
+ "address": "ca2.mullvad.net",
+ "name": "Canada (Quebec)",
+ "city": "Quebec",
+ "country": "Canada",
+ "location": [
+ 46.810811,
+ -71.215439
+ ]
+ },
+ "da.mullvad.net": {
+ "address": "da.mullvad.net",
+ "name": "Denmark",
+ "city": "\u200eCopenhagen",
+ "country": "Denmark",
+ "location": [
+ 55.6760968,
+ 12.5683371
+ ]
+ },
+ "de.mullvad.net": {
+ "address": "de.mullvad.net",
+ "name": "Germany",
+ "city": "Berlin",
+ "country": "Germany",
+ "location": [
+ 52.52000659999999,
+ 13.404954
+ ]
+ },
+ "lt.mullvad.net": {
+ "address": "lt.mullvad.net",
+ "name": "Lithuania",
+ "city": "Vilnius",
+ "country": "Lithuania",
+ "location": [
+ 54.6871555,
+ 25.2796514
+ ]
+ },
+ "nl.mullvad.net": {
+ "address": "nl.mullvad.net",
+ "name": "The Netherlands",
+ "city": "Amsterdam",
+ "country": "The Netherlands",
+ "location": [
+ 52.3702157,
+ 4.895167900000001
+ ]
+ },
+ "no.mullvad.net": {
+ "address": "no.mullvad.net",
+ "name": "Norway",
+ "city": "Oslo",
+ "country": "Norway",
+ "location": [
+ 59.9138688,
+ 10.7522454
+ ]
+ },
+ "ro.mullvad.net": {
+ "address": "ro.mullvad.net",
+ "name": "Romania",
+ "city": "Bucharest",
+ "country": "Romania",
+ "location": [
+ 44.4267674,
+ 26.1025384
+ ]
+ },
+ "sg.mullvad.net": {
+ "address": "sg.mullvad.net",
+ "name": "Singapore",
+ "city": "Singapore",
+ "country": "Singapore",
+ "location": [
+ 1.352083,
+ 103.819836
+ ]
+ },
+ "es.mullvad.net": {
+ "address": "es.mullvad.net",
+ "name": "Spain",
+ "city": "Madrid",
+ "country": "Spain",
+ "location": [
+ 40.4167754,
+ -3.7037902
+ ]
+ },
+ "se1.mullvad.net": {
+ "address": "se1.mullvad.net",
+ "name": "Sweden",
+ "city": "Stockholm",
+ "country": "Sweden",
+ "location": [
+ 59.32932349999999,
+ 18.0685808
+ ]
+ },
+ "ch.mullvad.net": {
+ "address": "ch.mullvad.net",
+ "name": "Switzerland",
+ "city": "Zürich",
+ "country": "Switzerland",
+ "location": [
+ 47.3768866,
+ 8.541694
+ ]
+ },
+ "uk.mullvad.net": {
+ "address": "uk.mullvad.net",
+ "name": "United Kingdom",
+ "city": "London",
+ "country": "United Kingdom",
+ "location": [
+ 51.5073509,
+ -0.1277583
+ ]
+ },
+ "us1.mullvad.net": {
+ "address": "us1.mullvad.net",
+ "name": "USA",
+ "city": "New York",
+ "country": "USA",
+ "location": [
+ 40.7127837,
+ -74.0059413
+ ]
+ }
+ }
+} \ No newline at end of file
diff --git a/app/constants.js b/app/constants.js
deleted file mode 100644
index cd83b2eee8..0000000000
--- a/app/constants.js
+++ /dev/null
@@ -1,120 +0,0 @@
-import Enum from './lib/enum';
-
-const LoginState = Enum('none', 'connecting', 'failed', 'ok');
-const ConnectionState = Enum('disconnected', 'connecting', 'connected', 'failed');
-
-module.exports = {
- mapbox: {
- accessToken: 'pk.eyJ1IjoibWpob21lciIsImEiOiJjaXd3NmdmNHEwMGtvMnlvMGl3b3R5aGcwIn0.SqIPBcCP6-b9yjxCD32CNg',
- styleURL: 'mapbox://styles/mjhomer/cizjoenga006f2smnm9z52u8e'
- },
- links: {
- createAccount: 'https://mullvad.net/account/create/',
- purchase: 'https://mullvad.net/account/',
- faq: 'https://mullvad.net/faq/',
- guides: 'https://mullvad.net/guides/',
- supportEmail: 'mailto:support@mullvad.net'
- },
- servers: {
- 'ca1.mullvad.net': {
- address: 'ca1.mullvad.net',
- name: 'Canada',
- city: 'Ottawa',
- country: 'Canada',
- location: [45.421530, -75.697193]
- },
- 'ca2.mullvad.net': {
- address: 'ca2.mullvad.net',
- name: 'Canada (Quebec)',
- city: 'Quebec',
- country: 'Canada',
- location: [46.810811, -71.215439]
- },
- 'da.mullvad.net': {
- address: 'da.mullvad.net',
- name: 'Denmark',
- city: '‎Copenhagen',
- country: 'Denmark',
- location: [55.6760968, 12.5683371]
- },
- 'de.mullvad.net': {
- address: 'de.mullvad.net',
- name: 'Germany',
- city: 'Berlin',
- country: 'Germany',
- location: [52.52000659999999, 13.404954]
- },
- 'lt.mullvad.net': {
- address: 'lt.mullvad.net',
- name: 'Lithuania',
- city: 'Vilnius',
- country: 'Lithuania',
- location: [54.6871555, 25.2796514]
- },
- 'nl.mullvad.net': {
- address: 'nl.mullvad.net',
- name: 'The Netherlands',
- city: 'Amsterdam',
- country: 'The Netherlands',
- location: [52.3702157, 4.895167900000001]
- },
- 'no.mullvad.net': {
- address: 'no.mullvad.net',
- name: 'Norway',
- city: 'Oslo',
- country: 'Norway',
- location: [59.9138688, 10.7522454]
- },
- 'ro.mullvad.net': {
- address: 'ro.mullvad.net',
- name: 'Romania',
- city: 'Bucharest',
- country: 'Romania',
- location: [44.4267674, 26.1025384]
- },
- 'sg.mullvad.net': {
- address: 'sg.mullvad.net',
- name: 'Singapore',
- city: 'Singapore',
- country: 'Singapore',
- location: [1.352083, 103.819836]
- },
- 'es.mullvad.net': {
- address: 'es.mullvad.net',
- name: 'Spain',
- city: 'Madrid',
- country: 'Spain',
- location: [40.4167754, -3.7037902]
- },
- 'se1.mullvad.net': {
- address: 'se1.mullvad.net',
- name: 'Sweden',
- city: 'Stockholm',
- country: 'Sweden',
- location: [59.32932349999999, 18.0685808]
- },
- 'ch.mullvad.net': {
- address: 'ch.mullvad.net',
- name: 'Switzerland',
- city: 'Zürich',
- country: 'Switzerland',
- location: [47.3768866, 8.541694]
- },
- 'uk.mullvad.net': {
- address: 'uk.mullvad.net',
- name: 'United Kingdom',
- city: 'London',
- country: 'United Kingdom',
- location: [51.5073509, -0.1277583]
- },
- 'us1.mullvad.net': {
- address: 'us1.mullvad.net',
- name: 'USA',
- city: 'New York',
- country: 'USA',
- location: [40.7127837, -74.0059413]
- }
- },
- defaultServer: 'fastest', // can be nearest, fastest or any of keys from .servers
- LoginState, ConnectionState
-};
diff --git a/app/containers/LoginPage.js b/app/containers/LoginPage.js
index 905eaa78a5..97c0fc10fc 100644
--- a/app/containers/LoginPage.js
+++ b/app/containers/LoginPage.js
@@ -2,7 +2,7 @@ import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
import Login from '../components/Login';
import userActions from '../actions/user';
-import { LoginState } from '../constants';
+import { LoginState } from '../enums';
const mapStateToProps = (state) => {
return state;
diff --git a/app/containers/SettingsPage.js b/app/containers/SettingsPage.js
index 4369240928..909526aaa2 100644
--- a/app/containers/SettingsPage.js
+++ b/app/containers/SettingsPage.js
@@ -4,7 +4,7 @@ import Settings from '../components/Settings';
import userActions from '../actions/user';
import settingsActions from '../actions/settings';
import { shell } from 'electron';
-import { links } from '../constants';
+import { links } from '../config';
const mapStateToProps = (state) => {
return state;
diff --git a/app/enums.js b/app/enums.js
new file mode 100644
index 0000000000..87181f9525
--- /dev/null
+++ b/app/enums.js
@@ -0,0 +1,4 @@
+import Enum from './lib/enum';
+
+export const LoginState = Enum('none', 'connecting', 'failed', 'ok');
+export const ConnectionState = Enum('disconnected', 'connecting', 'connected', 'failed');
diff --git a/app/lib/backend-redux-actions.js b/app/lib/backend-redux-actions.js
index ddf788028f..f7ddb05008 100644
--- a/app/lib/backend-redux-actions.js
+++ b/app/lib/backend-redux-actions.js
@@ -2,7 +2,7 @@ import { replace } from 'react-router-redux';
import userActions from '../actions/user';
import connectActions from '../actions/connect';
import Backend from './backend';
-import { LoginState, ConnectionState } from '../constants';
+import { LoginState, ConnectionState } from '../enums';
export default function mapBackendEventsToReduxActions(backend, store) {
const onUpdateIp = (clientIp) => {
diff --git a/app/lib/backend.js b/app/lib/backend.js
index f89bf62641..2a608e52a1 100644
--- a/app/lib/backend.js
+++ b/app/lib/backend.js
@@ -1,6 +1,7 @@
import Enum from './enum';
import { EventEmitter } from 'events';
-import { ConnectionState as ReduxConnectionState, servers } from '../constants';
+import { servers } from '../config';
+import { ConnectionState as ReduxConnectionState } from '../enums';
const EventType = Enum('connect', 'connecting', 'disconnect', 'login', 'logging', 'logout', 'updatedIp');
const ConnectionState = Enum('disconnected', 'connecting', 'connected');
diff --git a/app/reducers/connect.js b/app/reducers/connect.js
index ea830c3c25..b5571fca5e 100644
--- a/app/reducers/connect.js
+++ b/app/reducers/connect.js
@@ -1,5 +1,5 @@
import { handleActions } from 'redux-actions';
-import { ConnectionState } from '../constants';
+import { ConnectionState } from '../enums';
import actions from '../actions/connect';
const initialState = {
diff --git a/app/reducers/settings.js b/app/reducers/settings.js
index 4e1bf4e4f0..146591e9f5 100644
--- a/app/reducers/settings.js
+++ b/app/reducers/settings.js
@@ -1,5 +1,5 @@
import { handleActions } from 'redux-actions';
-import { defaultServer } from '../constants';
+import { defaultServer } from '../config';
import actions from '../actions/settings';
const initialState = {
diff --git a/app/reducers/user.js b/app/reducers/user.js
index 5c1727b864..5b89cfa991 100644
--- a/app/reducers/user.js
+++ b/app/reducers/user.js
@@ -1,8 +1,6 @@
import { handleActions } from 'redux-actions';
-
import actions from '../actions/user';
-
-import { LoginState } from '../constants';
+import { LoginState } from '../enums';
const initialState = {
account: null,
diff --git a/app/routes.js b/app/routes.js
index 92ba2ee024..648da460df 100644
--- a/app/routes.js
+++ b/app/routes.js
@@ -7,7 +7,7 @@ import ConnectPage from './containers/ConnectPage';
import SettingsPage from './containers/SettingsPage';
import SelectLocationPage from './containers/SelectLocationPage';
-import { LoginState } from './constants';
+import { LoginState } from './enums';
const makeRoutes = (store) => {
diff --git a/test/actions.spec.js b/test/actions.spec.js
index b80db98a05..8b2e79e45a 100644
--- a/test/actions.spec.js
+++ b/test/actions.spec.js
@@ -5,7 +5,7 @@ import Backend from '../app/lib/backend';
import userActions from '../app/actions/user';
import connectActions from '../app/actions/connect';
import mapBackendEventsToReduxActions from '../app/lib/backend-redux-actions';
-import { LoginState, ConnectionState } from '../app/constants';
+import { LoginState, ConnectionState } from '../app/enums';
describe('actions', function() {
this.timeout(10000);
diff --git a/test/reducers.spec.js b/test/reducers.spec.js
index 4d0f3d6833..96937250c5 100644
--- a/test/reducers.spec.js
+++ b/test/reducers.spec.js
@@ -2,7 +2,8 @@ import { expect } from 'chai';
import userReducer from '../app/reducers/user';
import connectReducer from '../app/reducers/connect';
import settingsReducer from '../app/reducers/settings';
-import { LoginState, ConnectionState, defaultServer } from '../app/constants';
+import { defaultServer } from '../app/config';
+import { LoginState, ConnectionState } from '../app/enums';
describe('reducers', () => {
diff --git a/test/routing.spec.js b/test/routing.spec.js
index aaedfa7f1f..18259e889f 100644
--- a/test/routing.spec.js
+++ b/test/routing.spec.js
@@ -3,7 +3,7 @@ import { expect } from 'chai';
import { filterIpUpdateActions, mockBackend, mockState, mockStore } from './support';
import userActions from '../app/actions/user';
import mapBackendEventsToRouter from '../app/lib/backend-routing';
-import { LoginState } from '../app/constants';
+import { LoginState } from '../app/enums';
describe('routing', function() {
this.timeout(10000);
diff --git a/test/support.js b/test/support.js
index e60de376e4..10387465d8 100644
--- a/test/support.js
+++ b/test/support.js
@@ -1,7 +1,8 @@
import configureMockStore from 'redux-mock-store';
import thunk from 'redux-thunk';
import Backend from '../app/lib/backend';
-import { LoginState, ConnectionState, defaultServer } from '../app/constants';
+import { defaultServer } from '../app/config';
+import { LoginState, ConnectionState } from '../app/enums';
const middlewares = [ thunk ];
export const mockStore = configureMockStore(middlewares);