diff options
| author | Akihiko Odaki <nekomanma@pixiv.co.jp> | 2018-03-26 13:21:41 +0900 |
|---|---|---|
| committer | Akihiko Odaki <nekomanma@pixiv.co.jp> | 2018-03-26 13:21:41 +0900 |
| commit | 0109e0811c4142153ae3f915295e62630653909e (patch) | |
| tree | 0047b2a1cf267de83d4caad5dfde9b31327f6f7e /src | |
| parent | Merge pull request #1286 from akihikodaki/master (diff) | |
| download | sharkey-0109e0811c4142153ae3f915295e62630653909e.tar.gz sharkey-0109e0811c4142153ae3f915295e62630653909e.tar.bz2 sharkey-0109e0811c4142153ae3f915295e62630653909e.zip | |
Specify Cookie domain with hostname
Diffstat (limited to 'src')
| -rw-r--r-- | src/api/common/signin.ts | 2 | ||||
| -rw-r--r-- | src/web/app/common/mios.ts | 4 | ||||
| -rw-r--r-- | src/web/app/config.ts | 2 |
3 files changed, 5 insertions, 3 deletions
diff --git a/src/api/common/signin.ts b/src/api/common/signin.ts index 693e62f39f..ec3dd80309 100644 --- a/src/api/common/signin.ts +++ b/src/api/common/signin.ts @@ -4,7 +4,7 @@ export default function(res, user, redirect: boolean) { const expires = 1000 * 60 * 60 * 24 * 365; // One Year res.cookie('i', user.token, { path: '/', - domain: `.${config.host}`, + domain: `.${config.hostname}`, secure: config.url.substr(0, 5) === 'https', httpOnly: false, expires: new Date(Date.now() + expires), diff --git a/src/web/app/common/mios.ts b/src/web/app/common/mios.ts index 986630da20..582a46c4cd 100644 --- a/src/web/app/common/mios.ts +++ b/src/web/app/common/mios.ts @@ -3,7 +3,7 @@ import { EventEmitter } from 'eventemitter3'; import * as merge from 'object-assign-deep'; import * as uuid from 'uuid'; -import { host, apiUrl, swPublickey, version, lang, googleMapsApiKey } from '../config'; +import { hostname, apiUrl, swPublickey, version, lang, googleMapsApiKey } from '../config'; import Progress from './scripts/loading'; import Connection from './scripts/streaming/stream'; import { HomeStreamManager } from './scripts/streaming/home'; @@ -220,7 +220,7 @@ export default class MiOS extends EventEmitter { public signout() { localStorage.removeItem('me'); - document.cookie = `i=; domain=.${host}; expires=Thu, 01 Jan 1970 00:00:01 GMT;`; + document.cookie = `i=; domain=.${hostname}; expires=Thu, 01 Jan 1970 00:00:01 GMT;`; location.href = '/'; } diff --git a/src/web/app/config.ts b/src/web/app/config.ts index 24158c3aed..32710dd9c4 100644 --- a/src/web/app/config.ts +++ b/src/web/app/config.ts @@ -1,4 +1,5 @@ declare const _HOST_: string; +declare const _HOSTNAME_: string; declare const _URL_: string; declare const _API_URL_: string; declare const _DOCS_URL_: string; @@ -16,6 +17,7 @@ declare const _LICENSE_: string; declare const _GOOGLE_MAPS_API_KEY_: string; export const host = _HOST_; +export const hostname = _HOSTNAME_; export const url = _URL_; export const apiUrl = _API_URL_; export const docsUrl = _DOCS_URL_; |