diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2017-02-22 04:36:09 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2017-02-22 04:36:09 +0900 |
| commit | 10bb5fe0eabfc3c04e7884f90b18e241765f5db7 (patch) | |
| tree | 8dcdeb1ba2e651d3b25ce8ca735b527b52d88ac3 /src | |
| parent | [Client] Clean up: Remove the needless config property (diff) | |
| download | sharkey-10bb5fe0eabfc3c04e7884f90b18e241765f5db7.tar.gz sharkey-10bb5fe0eabfc3c04e7884f90b18e241765f5db7.tar.bz2 sharkey-10bb5fe0eabfc3c04e7884f90b18e241765f5db7.zip | |
Add 親切なエラーメッセージ
Diffstat (limited to 'src')
| -rw-r--r-- | src/config.ts | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/config.ts b/src/config.ts index d2916c39c4..2bbe46fb96 100644 --- a/src/config.ts +++ b/src/config.ts @@ -3,6 +3,7 @@ */ import * as fs from 'fs'; +import * as URL from 'url'; import * as yaml from 'js-yaml'; import isUrl = require('is-url'); @@ -91,6 +92,14 @@ export default function load() { if (!isUrl(config.url)) urlError(config.url); if (!isUrl(config.secondary_url)) urlError(config.secondary_url); + const url = URL.parse(config.url); + const head = url.host.split('.')[0]; + + if (head != 'misskey') { + console.error(`プライマリドメインは、必ず「misskey」ドメインで始まっていなければなりません(現在の設定では「${head}」で始まっています)。例えば「https://misskey.xyz」「http://misskey.my.app.example.com」などが正しいプライマリURLです。`); + process.exit(); + } + config.url = normalizeUrl(config.url); config.secondary_url = normalizeUrl(config.secondary_url); |