diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2018-03-27 12:45:18 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2018-03-27 12:45:18 +0900 |
| commit | 003ecd4c58dee078d40596a29fa56a7d5ce70e2d (patch) | |
| tree | 796d1411235b688f266e69133417b5cf46f0c5ef /src | |
| parent | Merge remote-tracking branch 'refs/remotes/origin/master' into domain (diff) | |
| download | sharkey-003ecd4c58dee078d40596a29fa56a7d5ce70e2d.tar.gz sharkey-003ecd4c58dee078d40596a29fa56a7d5ce70e2d.tar.bz2 sharkey-003ecd4c58dee078d40596a29fa56a7d5ce70e2d.zip | |
Destory api. subdomain
api.example.com --> example.com/api
Diffstat (limited to 'src')
| -rw-r--r-- | src/config.ts | 4 | ||||
| -rw-r--r-- | src/server.ts | 2 | ||||
| -rw-r--r-- | src/web/app/common/scripts/streaming/stream.ts | 5 | ||||
| -rw-r--r-- | src/web/app/config.ts | 2 |
4 files changed, 7 insertions, 6 deletions
diff --git a/src/config.ts b/src/config.ts index 42dfd5f541..406183c91b 100644 --- a/src/config.ts +++ b/src/config.ts @@ -140,11 +140,11 @@ export default function load() { mixin.hostname = url.hostname; mixin.scheme = url.protocol.replace(/:$/, ''); mixin.ws_scheme = mixin.scheme.replace('http', 'ws'); - mixin.ws_url = `${mixin.ws_scheme}://api.${mixin.host}`; + mixin.ws_url = `${mixin.ws_scheme}://${mixin.host}`; mixin.secondary_host = config.secondary_url.substr(config.secondary_url.indexOf('://') + 3); mixin.secondary_hostname = secondaryUrl.hostname; mixin.secondary_scheme = config.secondary_url.substr(0, config.secondary_url.indexOf('://')); - mixin.api_url = `${mixin.scheme}://api.${mixin.host}`; + mixin.api_url = `${mixin.scheme}://${mixin.host}/api`; mixin.auth_url = `${mixin.scheme}://auth.${mixin.host}`; mixin.ch_url = `${mixin.scheme}://ch.${mixin.host}`; mixin.dev_url = `${mixin.scheme}://dev.${mixin.host}`; diff --git a/src/server.ts b/src/server.ts index 7f66c42073..fb581bae5d 100644 --- a/src/server.ts +++ b/src/server.ts @@ -53,7 +53,7 @@ app.use((req, res, next) => { /** * Register modules */ -app.use(vhost(`api.${config.hostname}`, require('./api/server'))); +app.use('/api', require('./api/server')); app.use(vhost(config.secondary_hostname, require('./himasaku/server'))); app.use(vhost(`file.${config.secondary_hostname}`, require('./file/server'))); app.use(require('./web/server')); diff --git a/src/web/app/common/scripts/streaming/stream.ts b/src/web/app/common/scripts/streaming/stream.ts index cb4041fd89..3912186ad3 100644 --- a/src/web/app/common/scripts/streaming/stream.ts +++ b/src/web/app/common/scripts/streaming/stream.ts @@ -1,7 +1,7 @@ import { EventEmitter } from 'eventemitter3'; import * as uuid from 'uuid'; import * as ReconnectingWebsocket from 'reconnecting-websocket'; -import { apiUrl } from '../../../config'; +import { wsUrl } from '../../../config'; import MiOS from '../../mios'; /** @@ -42,14 +42,13 @@ export default class Connection extends EventEmitter { this.state = 'initializing'; this.buffer = []; - const host = apiUrl.replace('http', 'ws'); const query = params ? Object.keys(params) .map(k => encodeURIComponent(k) + '=' + encodeURIComponent(params[k])) .join('&') : null; - this.socket = new ReconnectingWebsocket(`${host}/${endpoint}${query ? '?' + query : ''}`); + this.socket = new ReconnectingWebsocket(`${wsUrl}/${endpoint}${query ? '?' + query : ''}`); this.socket.addEventListener('open', this.onOpen); this.socket.addEventListener('close', this.onClose); this.socket.addEventListener('message', this.onMessage); diff --git a/src/web/app/config.ts b/src/web/app/config.ts index 32710dd9c4..8ea6f70101 100644 --- a/src/web/app/config.ts +++ b/src/web/app/config.ts @@ -2,6 +2,7 @@ declare const _HOST_: string; declare const _HOSTNAME_: string; declare const _URL_: string; declare const _API_URL_: string; +declare const _WS_URL_: string; declare const _DOCS_URL_: string; declare const _STATS_URL_: string; declare const _STATUS_URL_: string; @@ -20,6 +21,7 @@ export const host = _HOST_; export const hostname = _HOSTNAME_; export const url = _URL_; export const apiUrl = _API_URL_; +export const wsUrl = _WS_URL_; export const docsUrl = _DOCS_URL_; export const statsUrl = _STATS_URL_; export const statusUrl = _STATUS_URL_; |