Update dependencies

This commit is contained in:
Christoph Wiechert
2018-12-14 15:19:47 +01:00
parent 5fb623b512
commit 0260c734e0
15 changed files with 5586 additions and 5029 deletions

View File

@@ -1,15 +0,0 @@
{
"presets": [
[
"env",
{
"modules": false
}
],
"stage-2"
],
"plugins": [
"transform-runtime"
],
"comments": false
}

9331
app/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -5,32 +5,34 @@
"author": "Christoph Wiechert <wio@psitrax.de>", "author": "Christoph Wiechert <wio@psitrax.de>",
"private": true, "private": true,
"scripts": { "scripts": {
"dev": "cross-env NODE_ENV=development webpack-dev-server --inline --hot --host 0.0.0.0", "dev": "cross-env NODE_ENV=development webpack-dev-server",
"build": "cross-env NODE_ENV=production webpack --progress --hide-modules" "build": "cross-env NODE_ENV=production webpack --progress --hide-modules",
"analyze": "cross-env ANALYZE=true npm run build"
}, },
"dependencies": { "dependencies": {
"babel-polyfill": "^6.26.0", "babel-polyfill": "^6.26.0",
"crypto-js": "^3.1.9-1", "crypto-js": "^3.1.9-1",
"drag-drop": "^2.13.2", "drag-drop": "^4.2.0",
"tus-js-client": "^1.4.5", "tus-js-client": "^1.5.2",
"uuid": "^3.1.0", "uuid": "^3.3.2",
"vue": "^2.5.8", "vue": "^2.5.21",
"vue-awesome": "^2.3.4", "vue-awesome": "^3.2.0",
"vuex": "^3.0.1" "vuex": "^3.0.1"
}, },
"devDependencies": { "devDependencies": {
"babel-core": "^6.26.0", "@babel/core": "^7.2.0",
"babel-loader": "^7.1.2", "@babel/preset-env": "^7.2.0",
"babel-plugin-transform-runtime": "^6.23.0", "babel-loader": "^8.0.4",
"babel-preset-env": "^1.6.1", "cross-env": "^5.2.0",
"babel-preset-stage-2": "^6.24.1", "css-loader": "^2.0.0",
"cross-env": "^5.1.1", "file-loader": "^2.0.0",
"css-loader": "^0.28.7", "pug": "^2.0.3",
"file-loader": "^1.1.5", "pug-plain-loader": "^1.0.0",
"pug": "^2.0.0-rc.4", "vue-loader": "^15.4.2",
"vue-loader": "^13.5.0", "vue-template-compiler": "^2.5.21",
"vue-template-compiler": "^2.5.8", "webpack": "^4.27.1",
"webpack": "^3.8.1", "webpack-bundle-analyzer": "^3.0.3",
"webpack-dev-server": "^2.9.4" "webpack-cli": "^3.1.2",
"webpack-dev-server": "^3.1.10"
} }
} }

View File

@@ -1,7 +1,7 @@
<template lang="pug"> <template lang="pug">
.download-app .download-app
a.btn.btn-sm.btn-info.btn-new-session(@click='login()', title='Refresh', v-if="loggedIn") a.btn.btn-sm.btn-info.btn-new-session(@click='login()', title='Refresh', v-if="loggedIn")
icon(name="refresh") icon(name="sync-alt")
.alert.alert-danger(v-show="error") .alert.alert-danger(v-show="error")
strong strong
@@ -15,7 +15,7 @@
strong Access denied! strong Access denied!
| |
button.btn.btn-primary(type="submit", :disabled="!password") button.btn.btn-primary(type="submit", :disabled="!password")
icon.fa-fw(name="sign-in") icon.fa-fw(name="sign-in-alt")
| login | login
div(v-if="loggedIn") div(v-if="loggedIn")
@@ -63,8 +63,8 @@
<script> <script>
import 'vue-awesome/icons/exclamation-triangle'; import 'vue-awesome/icons/exclamation-triangle';
import 'vue-awesome/icons/refresh'; import 'vue-awesome/icons/sync-alt';
import 'vue-awesome/icons/sign-in'; import 'vue-awesome/icons/sign-in-alt';
import 'vue-awesome/icons/key'; import 'vue-awesome/icons/key';

View File

@@ -1,7 +1,7 @@
<template lang="pug"> <template lang="pug">
.download-app .download-app
a.btn.btn-sm.btn-info.btn-new-session(@click='newSession()', title='New Upload') a.btn.btn-sm.btn-info.btn-new-session(@click='newSession()', title='New Upload')
icon.fa-fw(name="cloud-upload") icon.fa-fw(name="cloud-upload-alt")
span.hidden-xs new upload span.hidden-xs new upload
.alert.alert-danger(v-show="error") .alert.alert-danger(v-show="error")
strong strong
@@ -61,7 +61,7 @@
import Clipboard from './common/Clipboard.vue'; import Clipboard from './common/Clipboard.vue';
import PreviewModal from './Download/PreviewModal.vue'; import PreviewModal from './Download/PreviewModal.vue';
import 'vue-awesome/icons/cloud-upload'; import 'vue-awesome/icons/cloud-upload-alt';
import 'vue-awesome/icons/exclamation-triangle'; import 'vue-awesome/icons/exclamation-triangle';
import 'vue-awesome/icons/copy'; import 'vue-awesome/icons/copy';
import 'vue-awesome/icons/check'; import 'vue-awesome/icons/check';
@@ -123,7 +123,7 @@
aEl.style.display = 'none'; aEl.style.display = 'none';
document.body.appendChild(aEl); document.body.appendChild(aEl);
aEl.click(); aEl.click();
aEl.remove(); document.body.removeChild(aEl);
file.downloaded = true; file.downloaded = true;
}, },

View File

@@ -11,7 +11,7 @@
a.btn.btn-sm.btn-default(title="next", @click="next", v-show="currentIndex < files.length-1") a.btn.btn-sm.btn-default(title="next", @click="next", v-show="currentIndex < files.length-1")
icon(name="arrow-right") icon(name="arrow-right")
a.btn.btn-sm.btn-default(title="toggle line wrap", @click="lineWrap = !lineWrap", :class="{active:lineWrap}", v-show="current.previewType === 'text'") a.btn.btn-sm.btn-default(title="toggle line wrap", @click="lineWrap = !lineWrap", :class="{active:lineWrap}", v-show="current.previewType === 'text'")
icon(name="rotate-left", flip="vertical") icon(name="undo-alt", flip="vertical")
div(slot="body") div(slot="body")
div(v-if="current.previewType === 'image'", style="text-align:center") div(v-if="current.previewType === 'image'", style="text-align:center")
img(:src="current.url", style="max-width: 100%; height:auto") img(:src="current.url", style="max-width: 100%; height:auto")
@@ -26,7 +26,7 @@
import Modal from '../common/Modal.vue'; import Modal from '../common/Modal.vue';
import 'vue-awesome/icons/arrow-left'; import 'vue-awesome/icons/arrow-left';
import 'vue-awesome/icons/arrow-right'; import 'vue-awesome/icons/arrow-right';
import 'vue-awesome/icons/rotate-left'; import 'vue-awesome/icons/undo-alt';
export default { export default {
components: { Modal }, components: { Modal },

View File

@@ -1,7 +1,7 @@
<template lang="pug"> <template lang="pug">
.upload-app#uploadApp .upload-app#uploadApp
a.btn.btn-sm.btn-info.btn-new-session(@click='newSession()', title='New Upload') a.btn.btn-sm.btn-info.btn-new-session(@click='newSession()', title='New Upload')
icon.fa-fw(name="cloud-upload") icon.fa-fw(name="cloud-upload-alt")
span.hidden-xs new upload span.hidden-xs new upload
.alert.alert-danger(v-show="error") .alert.alert-danger(v-show="error")
strong strong
@@ -43,12 +43,12 @@
<script type="text/babel"> <script type="text/babel">
"use strict"; "use strict";
import {mapState, mapGetters} from 'vuex'; import { mapState, mapGetters } from 'vuex';
import Settings from './Upload/Settings.vue'; import Settings from './Upload/Settings.vue';
import Files from './Upload/Files.vue'; import Files from './Upload/Files.vue';
import Clipboard from './common/Clipboard.vue' import Clipboard from './common/Clipboard.vue'
import 'vue-awesome/icons/cloud-upload'; import 'vue-awesome/icons/cloud-upload-alt';
import 'vue-awesome/icons/upload'; import 'vue-awesome/icons/upload';
import 'vue-awesome/icons/check'; import 'vue-awesome/icons/check';
import 'vue-awesome/icons/spinner'; import 'vue-awesome/icons/spinner';
@@ -68,7 +68,7 @@
...mapState(['error', 'disabled', 'state']), ...mapState(['error', 'disabled', 'state']),
...mapState('upload', ['sid', 'files']), ...mapState('upload', ['sid', 'files']),
...mapGetters('upload', ['percentUploaded', 'shareUrl']), ...mapGetters('upload', ['percentUploaded', 'shareUrl']),
mailLnk: function(){ mailLnk: function() {
return this.$store.state.config return this.$store.state.config
&& this.$store.state.config.mailTemplate && this.$store.state.config.mailTemplate
&& this.$store.state.config.mailTemplate.replace('%%URL%%', this.shareUrl); && this.$store.state.config.mailTemplate.replace('%%URL%%', this.shareUrl);
@@ -77,9 +77,9 @@
watch: { watch: {
state: function(val) { state: function(val) {
if(val === 'uploaded' || val === 'uploadError') { if (val === 'uploaded' || val === 'uploadError') {
const el = document.getElementById('uploadApp'); const el = document.getElementById('uploadApp');
if(!el || !el.scrollIntoView) return; if (!el || !el.scrollIntoView) return;
el.scrollIntoView(true); el.scrollIntoView(true);
} }
} }
@@ -87,14 +87,10 @@
methods: { methods: {
newSession() { newSession() {
if(!confirm('Create a new upload session?')) return; if (!confirm('Create a new upload session?')) return;
document.location.reload(); document.location.reload();
} }
} }
} }
</script> </script>
<style>
</style>

View File

@@ -7,12 +7,12 @@
<script type="text/babel"> <script type="text/babel">
import 'vue-awesome/icons/file-image-o'; import 'vue-awesome/icons/regular/file-image';
import 'vue-awesome/icons/file-text-o'; import 'vue-awesome/icons/regular/file-alt';
import 'vue-awesome/icons/file-video-o'; import 'vue-awesome/icons/regular/file-video';
import 'vue-awesome/icons/file-audio-o'; import 'vue-awesome/icons/regular/file-audio';
import 'vue-awesome/icons/file-archive-o'; import 'vue-awesome/icons/regular/file-archive';
import 'vue-awesome/icons/file-o'; import 'vue-awesome/icons/regular/file';
export default { export default {
props: ['file'], props: ['file'],
@@ -20,14 +20,14 @@
computed: { computed: {
iconClass() { iconClass() {
const type = this.file.type || this.file.metadata && this.file.metadata.type; const type = this.file.type || this.file.metadata && this.file.metadata.type;
if(!type) return 'file-o'; if(!type) return 'regular/file';
if(type.startsWith('image')) return 'file-image-o'; if(type.startsWith('image')) return 'regular/file-image';
if(type.startsWith('text')) return 'file-text-o'; if(type.startsWith('text')) return 'regular/file-alt';
if(type.startsWith('video')) return 'file-video-o'; if(type.startsWith('video')) return 'regular/file-video';
if(type.startsWith('audio')) return 'file-audio-o'; if(type.startsWith('audio')) return 'regular/file-audio';
if(type === 'application/pdf') return 'file-pdf-o'; if(type === 'application/pdf') return 'regular/file-pdf';
if(type.startsWith('application')) return 'file-archive-o'; if(type.startsWith('application')) return 'regular/file-archive';
return 'file-o'; return 'regular/file';
}, },
isImageBlob() { isImageBlob() {
if(!URL && !webkitURL) return false; if(!URL && !webkitURL) return false;

View File

@@ -1,9 +1,11 @@
if(!String.prototype.startsWith) { // import "babel-polyfill";
String.prototype.startsWith = function(searchString, position) {
position = position || 0; // if(!String.prototype.startsWith) {
return this.indexOf(searchString, position) === position; // String.prototype.startsWith = function(searchString, position) {
}; // position = position || 0;
} // return this.indexOf(searchString, position) === position;
// };
// }
import Vue from 'vue'; import Vue from 'vue';
import Upload from './Upload.vue'; import Upload from './Upload.vue';

View File

@@ -1,5 +1,7 @@
const path = require('path'); const path = require('path');
const webpack = require('webpack'); const webpack = require('webpack');
const BundleAnalyzerPlugin = require("webpack-bundle-analyzer").BundleAnalyzerPlugin;
const { VueLoaderPlugin } = require('vue-loader');
const execSync = require('child_process').execSync; const execSync = require('child_process').execSync;
let commitShaId; let commitShaId;
@@ -8,7 +10,10 @@ try {
commitShaId = '#'+execSync('git rev-parse HEAD').toString().substr(0,10); commitShaId = '#'+execSync('git rev-parse HEAD').toString().substr(0,10);
} catch (e) {} } catch (e) {}
const mode = process.env.NODE_ENV || 'development';
module.exports = { module.exports = {
mode,
entry: { entry: {
upload: './src/upload.js', upload: './src/upload.js',
download: './src/download.js', download: './src/download.js',
@@ -19,29 +24,54 @@ module.exports = {
publicPath: '/app/', publicPath: '/app/',
filename: '[name].js' filename: '[name].js'
}, },
plugins: [ optimization: {
new webpack.optimize.CommonsChunkPlugin({ splitChunks: {
filename: "common.js", chunks: 'all',
name: "common" name: 'common'
}), }
new webpack.DefinePlugin({ },
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV !== 'development' ? 'production' : 'development'), // devtool: 'source-map',
PSITRANSFER_VERSION: JSON.stringify(process.env.PSITRANSFER_VERSION || commitShaId || 'dev') devtool: 'none',
}),
],
module: { module: {
rules: [ rules: [
{ {
test: /\.vue$/, test: /\.vue$/,
loader: 'vue-loader', loader: 'vue-loader',
options: {
loaders: {}
}
}, },
{ {
test: /\.js$/, test: /\.js$/,
loader: 'babel-loader', exclude: /node_modules\/(?!(vue-awesome|)\/).*/,
exclude: /node_modules/ use: {
loader: 'babel-loader',
options: {
presets: [['@babel/preset-env', {
modules: false,
"useBuiltIns": "usage",
"targets": ["last 2 version", "ie 11", "not dead"]
}]],
}
}
},
{
test: /\.pug$/,
oneOf: [
// this applies to `<template lang="pug">` in Vue components
{
resourceQuery: /^\?vue/,
use: ['pug-plain-loader']
},
// this applies to pug imports inside JavaScript
{
use: ['raw-loader', 'pug-plain-loader']
}
]
},
{
test: /\.css$/,
use: [
'vue-style-loader',
'css-loader',
]
}, },
{ {
test: /\.(png|jpg|gif|svg)$/, test: /\.(png|jpg|gif|svg)$/,
@@ -54,13 +84,21 @@ module.exports = {
}, },
resolve: { resolve: {
alias: { alias: {
'vue$': process.env.NODE_ENV !== 'development' ? 'vue/dist/vue.runtime.min.js' : 'vue/dist/vue.runtime.js' 'vue$': mode !== 'development' ? 'vue/dist/vue.runtime.min.js' : 'vue/dist/vue.runtime.js'
} }
}, },
plugins: [
new VueLoaderPlugin(),
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify(mode),
PSITRANSFER_VERSION: JSON.stringify(process.env.PSITRANSFER_VERSION || commitShaId || 'dev')
}),
],
devServer: { devServer: {
historyApiFallback: true, historyApiFallback: true,
noInfo: true, noInfo: false,
disableHostCheck: true, disableHostCheck: true,
host: '0.0.0.0',
proxy: [ proxy: [
// Proxy requests to BE in DEV mode // Proxy requests to BE in DEV mode
// https://webpack.github.io/docs/webpack-dev-server.html#proxy // https://webpack.github.io/docs/webpack-dev-server.html#proxy
@@ -73,24 +111,8 @@ module.exports = {
performance: { performance: {
hints: false hints: false
}, },
devtool: '#eval-source-map'
}; };
if (process.env.NODE_ENV !== 'development') { if(process.env.ANALYZE) {
module.exports.devtool = '#source-map'; module.exports.plugins.push(new BundleAnalyzerPlugin());
let commit;
// http://vue-loader.vuejs.org/en/workflow/production.html
module.exports.plugins = [
...module.exports.plugins,
new webpack.optimize.UglifyJsPlugin({
sourceMap: true,
compress: {
warnings: false
}
}),
new webpack.LoaderOptionsPlugin({
minimize: true
})
];
} }

1035
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -13,17 +13,17 @@
"bugs": "https://github.com/psi-4ward/psitransfer/issues", "bugs": "https://github.com/psi-4ward/psitransfer/issues",
"main": "app.js", "main": "app.js",
"dependencies": { "dependencies": {
"archiver": "^2.1.0", "archiver": "^3.0.0",
"compression": "^1.7.1", "compression": "^1.7.3",
"crypto-js": "^3.1.9-1", "crypto-js": "^3.1.9-1",
"debug": "^3.1.0", "debug": "^4.1.0",
"express": "^4.16.2", "express": "^4.16.4",
"fs-promise": "^2.0.3", "fs-promise": "^2.0.3",
"http-errors": "^1.6.2", "http-errors": "^1.7.1",
"morgan": "^1.9.1", "morgan": "^1.9.1",
"tus-metadata": "^1.0.2", "tus-metadata": "^1.0.2",
"tusboy": "^1.1.1", "tusboy": "^1.1.1",
"uuid": "^3.1.0" "uuid": "^3.3.2"
}, },
"devDependencies": {}, "devDependencies": {},
"scripts": { "scripts": {

View File

@@ -8,7 +8,8 @@
<meta name="robots" content="noindex,nofollow"> <meta name="robots" content="noindex,nofollow">
<link href="/assets/styles.css" rel="stylesheet"> <link href="/assets/styles.css" rel="stylesheet">
<script> <script>
if(typeof Promise === 'undefined') { // Add ployfills for stupid IE
if (document.documentMode || /Edge/.test(navigator.userAgent)) {
(function(d, script) { (function(d, script) {
script = d.createElement('script'); script = d.createElement('script');
script.type = 'text/javascript'; script.type = 'text/javascript';

View File

@@ -8,7 +8,8 @@
<meta name="robots" content="noindex,nofollow"> <meta name="robots" content="noindex,nofollow">
<link href="/assets/styles.css" rel="stylesheet"> <link href="/assets/styles.css" rel="stylesheet">
<script> <script>
if(typeof Promise === 'undefined') { // Add ployfills for stupid IE
if (document.documentMode || /Edge/.test(navigator.userAgent)) {
(function(d, script) { (function(d, script) {
script = d.createElement('script'); script = d.createElement('script');
script.type = 'text/javascript'; script.type = 'text/javascript';

View File

@@ -6,9 +6,11 @@
<link href="/assets/favicon.ico" rel="icon" type="image/x-icon"> <link href="/assets/favicon.ico" rel="icon" type="image/x-icon">
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="robots" content="noindex,nofollow"> <meta name="robots" content="noindex,nofollow">
<meta http-equiv="x-ua-compatible" content="IE=edge">
<link href="/assets/styles.css" rel="stylesheet"> <link href="/assets/styles.css" rel="stylesheet">
<script> <script>
if(typeof Promise === 'undefined') { // Add ployfills for stupid IE
if (document.documentMode || /Edge/.test(navigator.userAgent)) {
(function(d, script) { (function(d, script) {
script = d.createElement('script'); script = d.createElement('script');
script.type = 'text/javascript'; script.type = 'text/javascript';