mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-26 15:13:08 +02:00
parent
165c93b248
commit
6ba1035b69
10 changed files with 45 additions and 11 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -8,3 +8,5 @@ npm-debug.log
|
||||||
run.bat
|
run.bat
|
||||||
api-docs.json
|
api-docs.json
|
||||||
package-lock.json
|
package-lock.json
|
||||||
|
version.json
|
||||||
|
/.cache-loader
|
||||||
|
|
|
@ -124,6 +124,7 @@
|
||||||
"gulp-typescript": "3.2.4",
|
"gulp-typescript": "3.2.4",
|
||||||
"gulp-uglify": "3.0.0",
|
"gulp-uglify": "3.0.0",
|
||||||
"gulp-util": "3.0.8",
|
"gulp-util": "3.0.8",
|
||||||
|
"hard-source-webpack-plugin": "^0.6.1",
|
||||||
"highlight.js": "9.12.0",
|
"highlight.js": "9.12.0",
|
||||||
"html-minifier": "3.5.9",
|
"html-minifier": "3.5.9",
|
||||||
"inquirer": "5.1.0",
|
"inquirer": "5.1.0",
|
||||||
|
@ -144,6 +145,7 @@
|
||||||
"node-sass": "^4.7.2",
|
"node-sass": "^4.7.2",
|
||||||
"node-sass-json-importer": "^3.1.3",
|
"node-sass-json-importer": "^3.1.3",
|
||||||
"nprogress": "0.2.0",
|
"nprogress": "0.2.0",
|
||||||
|
"on-build-webpack": "^0.1.0",
|
||||||
"os-utils": "0.0.14",
|
"os-utils": "0.0.14",
|
||||||
"progress-bar-webpack-plugin": "^1.11.0",
|
"progress-bar-webpack-plugin": "^1.11.0",
|
||||||
"prominence": "0.2.0",
|
"prominence": "0.2.0",
|
||||||
|
|
|
@ -2,6 +2,6 @@
|
||||||
* Version
|
* Version
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const meta = require('../package.json');
|
const meta = require('../version.json');
|
||||||
|
|
||||||
export default meta.version as string;
|
export default meta.version as string;
|
||||||
|
|
|
@ -61,11 +61,13 @@
|
||||||
app = isMobile ? 'mobile' : 'desktop';
|
app = isMobile ? 'mobile' : 'desktop';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const ver = localStorage.getItem('v') || VERSION;
|
||||||
|
|
||||||
// Load an app script
|
// Load an app script
|
||||||
// Note: 'async' make it possible to load the script asyncly.
|
// Note: 'async' make it possible to load the script asyncly.
|
||||||
// 'defer' make it possible to run the script when the dom loaded.
|
// 'defer' make it possible to run the script when the dom loaded.
|
||||||
const script = document.createElement('script');
|
const script = document.createElement('script');
|
||||||
script.setAttribute('src', `/assets/${app}.${VERSION}.${lang}.js`);
|
script.setAttribute('src', `/assets/${app}.${ver}.${lang}.js`);
|
||||||
script.setAttribute('async', 'true');
|
script.setAttribute('async', 'true');
|
||||||
script.setAttribute('defer', 'true');
|
script.setAttribute('defer', 'true');
|
||||||
head.appendChild(script);
|
head.appendChild(script);
|
||||||
|
|
|
@ -1,11 +1,13 @@
|
||||||
import MiOS from '../mios';
|
import MiOS from '../mios';
|
||||||
import { version } from '../../config';
|
import { version as current } from '../../config';
|
||||||
|
|
||||||
export default async function(mios: MiOS, force = false, silent = false) {
|
export default async function(mios: MiOS, force = false, silent = false) {
|
||||||
const meta = await mios.getMeta(force);
|
const meta = await mios.getMeta(force);
|
||||||
|
const newer = meta.version;
|
||||||
|
|
||||||
if (meta.version != version) {
|
if (newer != current) {
|
||||||
localStorage.setItem('should-refresh', 'true');
|
localStorage.setItem('should-refresh', 'true');
|
||||||
|
localStorage.setItem('v', newer);
|
||||||
|
|
||||||
// Clear cache (serive worker)
|
// Clear cache (serive worker)
|
||||||
try {
|
try {
|
||||||
|
@ -21,10 +23,10 @@ export default async function(mios: MiOS, force = false, silent = false) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!silent) {
|
if (!silent) {
|
||||||
alert('%i18n:common.update-available%'.replace('{newer}', meta.version).replace('{current}', version));
|
alert('%i18n:common.update-available%'.replace('{newer}', newer).replace('{current}', current));
|
||||||
}
|
}
|
||||||
|
|
||||||
return meta.version;
|
return newer;
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -86,6 +86,7 @@ export default Vue.extend({
|
||||||
<style lang="stylus" scoped>
|
<style lang="stylus" scoped>
|
||||||
.mk-switch
|
.mk-switch
|
||||||
display flex
|
display flex
|
||||||
|
margin 8px 0
|
||||||
cursor pointer
|
cursor pointer
|
||||||
transition all 0.3s
|
transition all 0.3s
|
||||||
|
|
||||||
|
@ -134,7 +135,9 @@ export default Vue.extend({
|
||||||
display inline-block
|
display inline-block
|
||||||
margin 0
|
margin 0
|
||||||
width 40px
|
width 40px
|
||||||
|
min-width 40px
|
||||||
height 20px
|
height 20px
|
||||||
|
min-height 20px
|
||||||
background #dcdfe6
|
background #dcdfe6
|
||||||
border 1px solid #dcdfe6
|
border 1px solid #dcdfe6
|
||||||
outline none
|
outline none
|
||||||
|
@ -154,17 +157,18 @@ export default Vue.extend({
|
||||||
> .label
|
> .label
|
||||||
margin-left 8px
|
margin-left 8px
|
||||||
display block
|
display block
|
||||||
font-size 14px
|
|
||||||
cursor pointer
|
cursor pointer
|
||||||
transition inherit
|
transition inherit
|
||||||
|
|
||||||
> span
|
> span
|
||||||
|
display block
|
||||||
line-height 20px
|
line-height 20px
|
||||||
color #4a535a
|
color #4a535a
|
||||||
transition inherit
|
transition inherit
|
||||||
|
|
||||||
> p
|
> p
|
||||||
margin 0
|
margin 0
|
||||||
|
font-size 90%
|
||||||
color #9daab3
|
color #9daab3
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -94,6 +94,9 @@
|
||||||
<mk-switch v-model="debug" text="デバッグモードを有効にする">
|
<mk-switch v-model="debug" text="デバッグモードを有効にする">
|
||||||
<span>この設定はアカウントに保存されません。</span>
|
<span>この設定はアカウントに保存されません。</span>
|
||||||
</mk-switch>
|
</mk-switch>
|
||||||
|
<mk-switch v-model="enableExperimental" text="実験的機能を有効にする">
|
||||||
|
<span>この設定はアカウントに保存されません。実験的機能を有効にするとMisskeyの動作が不安定になる可能性があります。</span>
|
||||||
|
</mk-switch>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section class="other" v-show="page == 'other'">
|
<section class="other" v-show="page == 'other'">
|
||||||
|
@ -126,17 +129,22 @@ export default Vue.extend({
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
page: 'profile',
|
page: 'profile',
|
||||||
|
meta: null,
|
||||||
license,
|
license,
|
||||||
version,
|
version,
|
||||||
latestVersion: undefined,
|
latestVersion: undefined,
|
||||||
checkingForUpdate: false,
|
checkingForUpdate: false,
|
||||||
showPostFormOnTopOfTl: false,
|
showPostFormOnTopOfTl: false,
|
||||||
debug: localStorage.getItem('debug') == 'true'
|
debug: localStorage.getItem('debug') == 'true',
|
||||||
|
enableExperimental: localStorage.getItem('enableExperimental') == 'true'
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
debug() {
|
debug() {
|
||||||
localStorage.setItem('debug', this.debug ? 'true' : 'false');
|
localStorage.setItem('debug', this.debug ? 'true' : 'false');
|
||||||
|
},
|
||||||
|
enableExperimental() {
|
||||||
|
localStorage.setItem('enableExperimental', this.enableExperimental ? 'true' : 'false');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
@ -145,6 +153,7 @@ export default Vue.extend({
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
|
this.meta = (this as any).os.getMeta();
|
||||||
this.showPostFormOnTopOfTl = (this as any).os.i.client_settings.showPostFormOnTopOfTl;
|
this.showPostFormOnTopOfTl = (this as any).os.i.client_settings.showPostFormOnTopOfTl;
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
|
|
@ -4,7 +4,9 @@
|
||||||
|
|
||||||
import * as webpack from 'webpack';
|
import * as webpack from 'webpack';
|
||||||
|
|
||||||
import version from '../../src/version';
|
const meta = require('../../package.json');
|
||||||
|
const version = meta.version;
|
||||||
|
|
||||||
const constants = require('../../src/const.json');
|
const constants = require('../../src/const.json');
|
||||||
import config from '../../src/conf';
|
import config from '../../src/conf';
|
||||||
import { licenseHtml } from '../../src/common/build/license';
|
import { licenseHtml } from '../../src/common/build/license';
|
||||||
|
|
|
@ -1,4 +1,7 @@
|
||||||
|
import * as fs from 'fs';
|
||||||
import * as webpack from 'webpack';
|
import * as webpack from 'webpack';
|
||||||
|
const WebpackOnBuildPlugin = require('on-build-webpack');
|
||||||
|
const HardSourceWebpackPlugin = require('hard-source-webpack-plugin');
|
||||||
const ProgressBarPlugin = require('progress-bar-webpack-plugin');
|
const ProgressBarPlugin = require('progress-bar-webpack-plugin');
|
||||||
import chalk from 'chalk';
|
import chalk from 'chalk';
|
||||||
|
|
||||||
|
@ -11,6 +14,7 @@ const isProduction = env === 'production';
|
||||||
|
|
||||||
export default (version, lang) => {
|
export default (version, lang) => {
|
||||||
const plugins = [
|
const plugins = [
|
||||||
|
new HardSourceWebpackPlugin(),
|
||||||
new ProgressBarPlugin({
|
new ProgressBarPlugin({
|
||||||
format: chalk` {cyan.bold yes we can} {bold [}:bar{bold ]} {green.bold :percent} {gray (:current/:total)} :elapseds`,
|
format: chalk` {cyan.bold yes we can} {bold [}:bar{bold ]} {green.bold :percent} {gray (:current/:total)} :elapseds`,
|
||||||
clear: false
|
clear: false
|
||||||
|
@ -20,6 +24,11 @@ export default (version, lang) => {
|
||||||
'process.env': {
|
'process.env': {
|
||||||
NODE_ENV: JSON.stringify(process.env.NODE_ENV)
|
NODE_ENV: JSON.stringify(process.env.NODE_ENV)
|
||||||
}
|
}
|
||||||
|
}),
|
||||||
|
new WebpackOnBuildPlugin(stats => {
|
||||||
|
fs.writeFileSync('./version.json', JSON.stringify({
|
||||||
|
version
|
||||||
|
}), 'utf-8');
|
||||||
})
|
})
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,8 @@ const constants = require('../src/const.json');
|
||||||
import plugins from './plugins';
|
import plugins from './plugins';
|
||||||
|
|
||||||
import langs from '../locales';
|
import langs from '../locales';
|
||||||
import version from '../src/version';
|
const meta = require('../package.json');
|
||||||
|
const version = meta.version;
|
||||||
|
|
||||||
global['faReplacement'] = faReplacement;
|
global['faReplacement'] = faReplacement;
|
||||||
|
|
||||||
|
@ -59,7 +60,7 @@ module.exports = Object.keys(langs).map(lang => {
|
||||||
rules: [{
|
rules: [{
|
||||||
test: /\.vue$/,
|
test: /\.vue$/,
|
||||||
exclude: /node_modules/,
|
exclude: /node_modules/,
|
||||||
use: [/*'cache-loader', */{
|
use: ['cache-loader', {
|
||||||
loader: 'vue-loader',
|
loader: 'vue-loader',
|
||||||
options: {
|
options: {
|
||||||
cssSourceMap: false,
|
cssSourceMap: false,
|
||||||
|
@ -140,6 +141,7 @@ module.exports = Object.keys(langs).map(lang => {
|
||||||
use: [{
|
use: [{
|
||||||
loader: 'ts-loader',
|
loader: 'ts-loader',
|
||||||
options: {
|
options: {
|
||||||
|
happyPackMode: true,
|
||||||
configFile: __dirname + '/../src/web/app/tsconfig.json',
|
configFile: __dirname + '/../src/web/app/tsconfig.json',
|
||||||
appendTsSuffixTo: [/\.vue$/]
|
appendTsSuffixTo: [/\.vue$/]
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue