サーバーのバージョンとクライアントのバージョンを分けた

This commit is contained in:
syuilo 2018-04-22 21:32:09 +09:00
parent 8682fd21c4
commit 0b99483ccb
8 changed files with 16 additions and 22 deletions

1
.gitignore vendored
View File

@ -10,4 +10,3 @@ npm-debug.log
run.bat
api-docs.json
package-lock.json
version.json

View File

@ -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({

View File

@ -1,12 +1,9 @@
{
"name": "misskey",
"author": "syuilo <i@syuilo.com>",
"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": {

View File

@ -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の新しいバージョンがあります。ページを再度読み込みします。' +

View File

@ -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');

View File

@ -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(),

View File

@ -1,7 +0,0 @@
/**
* Version
*/
const meta = require('../version.json');
export default meta.version as string;

View File

@ -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');
})