Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
const express = require('express');
const fileUpload = require('express-fileupload');
const Firestore = require('@google-cloud/firestore');
const Promise = require("bluebird");
const {Storage} = require('@google-cloud/storage');
const storage = new Storage();
const path = require('path');
const dayjs = require('dayjs');
const relativeTime = require('dayjs/plugin/relativeTime')
dayjs.extend(relativeTime)
const app = express();
app.use(express.static('public'));
app.use(fileUpload({
limits: { fileSize: 10 * 1024 * 1024 },
useTempFiles : true,
tempFileDir : '/tmp/'
}))
app.post('/api/pictures', async (req, res) => {
if (!req.files || Object.keys(req.files).length === 0) {
console.log("No file uploaded");
return res.status(400).send('No file was uploaded.');
}
console.log(`Receiving file ${JSON.stringify(req.files.picture)}`);
import React from 'react'
import { Tooltip } from 'antd'
import dayjs from 'dayjs'
import { withTranslation } from 'react-i18next'
dayjs.extend(require('dayjs/plugin/localizedFormat'))
@withTranslation() // Re-render when language changes
class Long extends React.PureComponent {
render() {
const { unixTimeStampMs, ...rest } = this.props
return (
{format(unixTimeStampMs)}
)
}
}
export function format(unixTimeStampMs) {
return dayjs(unixTimeStampMs).format('ll LTS')
}
async run(options) {
const url = options.urls[0];
const timestamp = options.utc ? dayjs.utc() : dayjs();
const { storageManager, resultUrls } = resultsStorage(
url,
timestamp,
options.outputFolder,
options.resultBaseURL,
options.useHash
);
// Setup logging
const logDir = await storageManager.createDirectory('logs');
logging.configure(options, logDir);
// Tell the world what we are using
log.info(
'Versions OS: %s nodejs: %s sitespeed.io: %s browsertime: %s coach: %s',
os.platform() + ' ' + os.release(),
const path = require('path')
const CopyWebpackPlugin = require('copy-webpack-plugin')
const UglifyJsPlugin = require('uglifyjs-webpack-plugin')
const isDev = process.env.NODE_ENV === 'development' // 开发环境
// 增加环境变量
process.env.VUE_APP_BUILD_TIME = require('dayjs')().format('YYYYMDHHmmss')
// 打包输出路径
const outputDir = '../../WebHost/wwwroot'
module.exports = {
outputDir: outputDir,
devServer: {
port: 5223
},
transpileDependencies: ['nm-.*', 'element-ui'],
configureWebpack: {
plugins: [
/**
* 复制nm-lib-skins/public目录下的文件到输出目录
*/
new CopyWebpackPlugin([
{
const path = require('path')
const CopyWebpackPlugin = require('copy-webpack-plugin')
const UglifyJsPlugin = require('uglifyjs-webpack-plugin')
const isDev = process.env.NODE_ENV === 'development' // 开发环境
// 增加环境变量
process.env.VUE_APP_BUILD_TIME = require('dayjs')().format('YYYYMDHHmmss')
// 打包输出路径
const outputDir = '../../WebHost/wwwroot'
module.exports = {
outputDir: outputDir,
devServer: {
port: 5220
},
transpileDependencies: ['nm-.*', 'element-ui'],
configureWebpack: {
plugins: [
/**
* 复制nm-lib-skins/public目录下的文件到输出目录
*/
new CopyWebpackPlugin([
{
const CompressionWebpackPlugin = require('compression-webpack-plugin')
const VueFilenameInjector = require('@d2-projects/vue-filename-injector')
const ThemeColorReplacer = require('webpack-theme-color-replacer')
const forElementUI = require('webpack-theme-color-replacer/forElementUI')
const cdnDependencies = require('./dependencies-cdn')
// 拼接路径
const resolve = dir => require('path').join(__dirname, dir)
// 增加环境变量
process.env.VUE_APP_VERSION = require('./package.json').version
process.env.VUE_APP_BUILD_TIME = require('dayjs')().format('YYYY-M-D HH:mm:ss')
// 基础路径 注意发布之前要先修改这里
let publicPath = process.env.VUE_APP_PUBLIC_PATH || '/'
// 设置不参与构建的库
let externals = {}
cdnDependencies.forEach(package => { externals[package.name] = package.library })
// 引入文件的 cdn 链接
const cdn = {
css: cdnDependencies.map(e => e.css).filter(e => e),
js: cdnDependencies.map(e => e.js).filter(e => e)
}
module.exports = {
// 根据你的实际情况更改这里
const path = require('path')
const CopyWebpackPlugin = require('copy-webpack-plugin')
const UglifyJsPlugin = require('uglifyjs-webpack-plugin')
const isDev = process.env.NODE_ENV === 'development' // 开发环境
// 增加环境变量
process.env.VUE_APP_BUILD_TIME = require('dayjs')().format('YYYYMDHHmmss')
// 打包输出路径
const outputDir = '../WebHost/wwwroot/app'
module.exports = {
outputDir: outputDir,
publicPath: '/app',
devServer: {
port: 5220
},
transpileDependencies: ['nm-.*', 'element-ui'],
configureWebpack: {
plugins: [
/**
* 复制nm-lib-skins/public目录下的文件到输出目录
*/
new CopyWebpackPlugin([
const VueFilenameInjector = require('./tools/vue-filename-injector')
// 拼接路径
const resolve = dir => require('path').join(__dirname, dir)
// 增加环境变量
process.env.VUE_APP_VERSION = require('./package.json').version
process.env.VUE_APP_BUILD_TIME = require('dayjs')().format('YYYY-M-D HH:mm:ss')
// 基础路径 注意发布之前要先修改这里
let publicPath = process.env.VUE_APP_PATH
module.exports = {
publicPath, // 根据你的实际情况更改这里
lintOnSave: true,
devServer: {
publicPath, // 和 publicPath 保持一致
proxy: {
'/api': {
target: 'http://127.0.0.1:7070',
ws: true,
pathRewrite: {
'^/api': '/api'
}
// 增加环境变量
process.env.VUE_APP_BUILD_TIME = require('dayjs')().format('YYYYMDHHmmss')
process.env.VUE_APP_VERSION = require('./package.json').version
const path = require('path')
module.exports = {
devServer: {
port: 6220
},
publicPath: './',
transpileDependencies: ['nm-lib-.*', 'element-ui'],
configureWebpack: {
resolve: {
// 配置解析别名
alias: {
'@': path.resolve(__dirname, './src'),
'@api': path.resolve(__dirname, './src/api'),
'@views': path.resolve(__dirname, './src/views'),
const CompressionWebpackPlugin = require('compression-webpack-plugin')
const VueFilenameInjector = require('@d2-projects/vue-filename-injector')
const ThemeColorReplacer = require('webpack-theme-color-replacer')
const forElementUI = require('webpack-theme-color-replacer/forElementUI')
const cdnDependencies = require('./dependencies-cdn')
// 拼接路径
const resolve = dir => require('path').join(__dirname, dir)
// 增加环境变量
process.env.VUE_APP_VERSION = require('./package.json').version
process.env.VUE_APP_BUILD_TIME = require('dayjs')().format('YYYY-M-D HH:mm:ss')
// 基础路径 注意发布之前要先修改这里
let publicPath = process.env.VUE_APP_PUBLIC_PATH || '/'
// 设置不参与构建的库
let externals = {}
cdnDependencies.forEach(package => { externals[package.name] = package.library })
// 引入文件的 cdn 链接
const cdn = {
css: cdnDependencies.map(e => e.css).filter(e => e),
js: cdnDependencies.map(e => e.js).filter(e => e)
}
module.exports = {
// 根据你的实际情况更改这里