From 0b99483ccbb1a4c111177718c0e9300a19d36a28 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sun, 22 Apr 2018 21:32:09 +0900 Subject: [PATCH] =?UTF-8?q?=E3=82=B5=E3=83=BC=E3=83=90=E3=83=BC=E3=81=AE?= =?UTF-8?q?=E3=83=90=E3=83=BC=E3=82=B8=E3=83=A7=E3=83=B3=E3=81=A8=E3=82=AF?= =?UTF-8?q?=E3=83=A9=E3=82=A4=E3=82=A2=E3=83=B3=E3=83=88=E3=81=AE=E3=83=90?= =?UTF-8?q?=E3=83=BC=E3=82=B8=E3=83=A7=E3=83=B3=E3=82=92=E5=88=86=E3=81=91?= =?UTF-8?q?=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 - gulpfile.ts | 4 ++-- package.json | 7 ++----- src/client/app/boot.js | 4 ++-- src/client/app/common/scripts/check-for-update.ts | 2 +- src/server/api/endpoints/meta.ts | 9 +++++++-- src/version.ts | 7 ------- webpack.config.ts | 4 ++-- 8 files changed, 16 insertions(+), 22 deletions(-) delete mode 100644 src/version.ts diff --git a/.gitignore b/.gitignore index be8689e2ed..326db6fa5e 100644 --- a/.gitignore +++ b/.gitignore @@ -10,4 +10,3 @@ npm-debug.log run.bat api-docs.json package-lock.json -version.json diff --git a/gulpfile.ts b/gulpfile.ts index 719fe9450a..df355e33e7 100644 --- a/gulpfile.ts +++ b/gulpfile.ts @@ -21,7 +21,7 @@ import * as htmlmin from 'gulp-htmlmin'; const uglifyes = require('uglify-es'); import { fa } from './src/build/fa'; -import version from './src/version'; +const client = require('./built/client/meta.json'); import config from './src/config'; const uglify = uglifyComposer(uglifyes, console); @@ -113,7 +113,7 @@ gulp.task('build:client', [ gulp.task('build:client:script', () => gulp.src(['./src/client/app/boot.js', './src/client/app/safe.js']) - .pipe(replace('VERSION', JSON.stringify(version))) + .pipe(replace('VERSION', JSON.stringify(client.version))) .pipe(replace('API', JSON.stringify(config.api_url))) .pipe(replace('ENV', JSON.stringify(env))) .pipe(isProduction ? uglify({ diff --git a/package.json b/package.json index a6cc8f65e0..0a3026e17e 100644 --- a/package.json +++ b/package.json @@ -1,12 +1,9 @@ { "name": "misskey", "author": "syuilo ", - "version": "0.0.5089", + "version": "1.0.0", + "clientVersion": "1.0.0", "codename": "nighthike", - "license": "MIT", - "description": "A miniblog-based SNS", - "bugs": "https://github.com/syuilo/misskey/issues", - "repository": "https://github.com/syuilo/misskey.git", "main": "./built/index.js", "private": true, "scripts": { diff --git a/src/client/app/boot.js b/src/client/app/boot.js index f5a1afec63..35d02cf9c5 100644 --- a/src/client/app/boot.js +++ b/src/client/app/boot.js @@ -105,8 +105,8 @@ const meta = await res.json(); // Compare versions - if (meta.version != ver) { - localStorage.setItem('v', meta.version); + if (meta.clientVersion != ver) { + localStorage.setItem('v', meta.clientVersion); alert( 'Misskeyの新しいバージョンがあります。ページを再度読み込みします。' + diff --git a/src/client/app/common/scripts/check-for-update.ts b/src/client/app/common/scripts/check-for-update.ts index 20ce64ea85..3ed9d41e76 100644 --- a/src/client/app/common/scripts/check-for-update.ts +++ b/src/client/app/common/scripts/check-for-update.ts @@ -3,7 +3,7 @@ import { version as current } from '../../config'; export default async function(mios: MiOS, force = false, silent = false) { const meta = await mios.getMeta(force); - const newer = meta.version; + const newer = meta.clientVersion; if (newer != current) { localStorage.setItem('should-refresh', 'true'); diff --git a/src/server/api/endpoints/meta.ts b/src/server/api/endpoints/meta.ts index f6a276a2b7..0e9ecf47df 100644 --- a/src/server/api/endpoints/meta.ts +++ b/src/server/api/endpoints/meta.ts @@ -2,10 +2,12 @@ * Module dependencies */ import * as os from 'os'; -import version from '../../../version'; import config from '../../../config'; import Meta from '../../../models/meta'; +const pkg = require('../../../../package.json'); +const client = require('../../../../built/client/meta.json'); + /** * @swagger * /meta: @@ -41,7 +43,10 @@ module.exports = (params) => new Promise(async (res, rej) => { res({ maintainer: config.maintainer, - version: version, + + version: pkg.version, + clientVersion: client.version, + secure: config.https != null, machine: os.hostname(), os: os.platform(), diff --git a/src/version.ts b/src/version.ts deleted file mode 100644 index d379b57f8f..0000000000 --- a/src/version.ts +++ /dev/null @@ -1,7 +0,0 @@ -/** - * Version - */ - -const meta = require('../version.json'); - -export default meta.version as string; diff --git a/webpack.config.ts b/webpack.config.ts index 50e28972ac..96eaf9f4c8 100644 --- a/webpack.config.ts +++ b/webpack.config.ts @@ -19,7 +19,7 @@ import { licenseHtml } from './src/build/license'; import locales from './locales'; const meta = require('./package.json'); -const version = meta.version; +const version = meta.clientVersion; const codename = meta.codename; //#region Replacer definitions @@ -114,7 +114,7 @@ module.exports = entries.map(x => { 'process.env.NODE_ENV': JSON.stringify(isProduction ? 'production' : 'development') }), new WebpackOnBuildPlugin(stats => { - fs.writeFileSync('./version.json', JSON.stringify({ + fs.writeFileSync('./built/client/meta.json', JSON.stringify({ version }), 'utf-8'); })