From 92af4401e22749e726bce69c3bd02c627e7af7e6 Mon Sep 17 00:00:00 2001 From: MeiMei <30769358+mei23@users.noreply.github.com> Date: Fri, 1 Nov 2019 22:34:26 +0900 Subject: 実行時にpackage.jsonを参照しないように (#5418) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 実行時にpackage.jsonを参照しないように * nodeinfo * move meta.json * add dummy * lowercase --- src/config/load.ts | 5 +++-- src/config/types.ts | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'src/config') diff --git a/src/config/load.ts b/src/config/load.ts index aeed54d74e..efebb8bd03 100644 --- a/src/config/load.ts +++ b/src/config/load.ts @@ -5,7 +5,7 @@ import * as fs from 'fs'; import * as yaml from 'js-yaml'; import { Source, Mixin } from './types'; -import * as pkg from '../../package.json'; +import * as meta from '../meta.json'; /** * Path of configuration directory @@ -30,6 +30,7 @@ export default function load() { config.port = config.port || parseInt(process.env.PORT || '', 10); + mixin.version = meta.version; mixin.host = url.host; mixin.hostname = url.hostname; mixin.scheme = url.protocol.replace(/:$/, ''); @@ -38,7 +39,7 @@ export default function load() { mixin.apiUrl = `${mixin.scheme}://${mixin.host}/api`; mixin.authUrl = `${mixin.scheme}://${mixin.host}/auth`; mixin.driveUrl = `${mixin.scheme}://${mixin.host}/files`; - mixin.userAgent = `Misskey/${pkg.version} (${config.url})`; + mixin.userAgent = `Misskey/${meta.version} (${config.url})`; if (config.autoAdmin == null) config.autoAdmin = false; diff --git a/src/config/types.ts b/src/config/types.ts index b96e727506..e766d1f14a 100644 --- a/src/config/types.ts +++ b/src/config/types.ts @@ -58,6 +58,7 @@ export type Source = { * Misskeyが自動的に(ユーザーが設定した情報から推論して)設定する情報 */ export type Mixin = { + version: string; host: string; hostname: string; scheme: string; -- cgit v1.2.3-freya