Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const repoHandler = require('./app/handlers/repos');
const dockerImages = require('./app/handlers/docker-images');
const serviceHandler = require('./app/handlers/services')
const dockerfilesHandler = require('./app/handlers/dockerfiles')
// const installationHandler = require('./app/handlers/installation.js');
const treeRoutes = require('./app/handlers/tree_routes.js');
const Checker = require('./app/util/AppChecker.js');
const multer = require('multer');
const webSocketHandler = require('./app/util/ws_handler.js');
const localConfig = require('./config/local.config.json');
const healthChecker = require('./app/util/HealthLabState.js');
const errorHandler = require('express-error-handler');
const port = +process.env.PORT || 8080;
// var upload = multer({ dest: "uploads/" });
const storage = multer.memoryStorage();
const upload = multer({ storage });
const server = http.createServer(app);
const AppUtils = require('./app/util/AppUtils.js');
const dockerSocket = require('./app/util/docker_socket');
// const webshellConfigFile =
const log = AppUtils.getLogger();
// Initialize the checker
Checker.init((err) => {
if (err) {
console.error(err.message);
throw err;
}
});
// If is installed start the healtChecker
Checker.isInstalled((isInstalled) => {
exports.uploadIdentity = async (req, res) => {
const { accountAddress } = req.body;
// const ethAddress = 'abcdefaad1daaaa'; //테스트용
const upload = multer({
storage: multer.memoryStorage(),
fileFilter: async (req, file, cb) => {
// cb(null, FileTypeCheck.uploadFileType(file.mimetype, imageType));
cb(null, true);
}
}).single('identity'); // req.file은 identity 필드의 파일 정보
/**
* ipfs에 저장하고 db에 해쉬값을 저장한다.
* @param file
* @returns {Promise}
*/
const saveToIPFS = async file => {
console.log(file);
const files = [
{
path: 'identity/' + file.originalname, //파일 이름을 유지하기위해 디렉토리 유지
});
// Create new Express router
const router = new express.Router({
caseSensitive: true,
mergeParams: true
});
// Parse application/json requests
const jsonParser = express.json({
limit: '10mb'
});
// Parse multipart/form-data requests
const multipartParser = multer({
storage: multer.memoryStorage()
});
// Parse application/x-www-form-urlencoded requests
const urlencodedParser = express.urlencoded({
extended: true,
limit: '10mb'
});
// Configure IndieAuth middleware
const indieauth = new IndieAuth({
me: config.me
});
// Middleware
router.use(urlencodedParser, jsonParser);
"use strict";
const bodyParser = require('body-parser');
const jsonParser = bodyParser.json();
const security = require('../../utils/security.js');
const multer = require('multer');
const storage = multer.memoryStorage();
const upload = multer({ storage: storage });
const handler = require('../../handlers/api/usersApiHandler.js');
const ApiUserRoutes = function () {
};
ApiUserRoutes.createRoutes = function (self) {
/**
* Add a new User as Admin
*/
self.app.post('/api/user', security.isAuthenticatedAdmin, jsonParser, handler.addUser);
/**
const fs = require('fs');
const path = require('path');
const sharp = require('sharp');
const multer = require('multer');
const utils = require('utility');
const config = require('../config');
const logger = require('../utils/logger');
const util = require('util');
const storage = multer.memoryStorage()
const upload = multer({ storage: storage })
let uploadSingle = upload.single('file');
let uploadLocal = function(req, res, next) {
uploadSingle(req, res, function(err) {
if (err) {
return next(err);
}
const width = req.query.w;
const height = req.query.h;
const date = new Date(); //获取到当前的系统时间
const fileName = utils.md5(utils.YYYYMMDD() + String(req.file.size) + req.file.originalname) + path.extname(req.file.originalname);
const sharpImg = sharp(req.file.buffer);
if (width && height) {
sharpImg.resize(Number(width), Number(height));
sharpImg.max();
} else {
var app = express();
var bodyParser = require('body-parser');
var multer = require('multer');
var cors = require('cors');
var BaseController = require('./baseController');
var dataset = require('./dataset');
var toolkit = require('./toolkit');
var assign = toolkit.assign;
var each = toolkit.each;
var pick = toolkit.pick;
app.use(bodyParser.json({type: 'application/*+json'}));
app.use(bodyParser.urlencoded({extended: true}));
app.use(multer({storage: multer.memoryStorage()}).any());
app.use(cors());
function formatRequest(request) {
return {
requestBody: request.body,
queryParams: request.query,
params: request.params
};
}
function dataToResponse(data, response) {
var status = data[0];
var headers = data[1];
const multer = require('multer');
const storage = multer.memoryStorage();
const upload = multer({ storage: storage });
let uploadSingle = upload.single('file');
module.exports = {
uploadSingle
};
import bodyParser from 'body-parser';
import { AsyncRouter, AsyncRouterInstance } from 'express-async-router';
import { Driver } from '@dynamico/driver';
import { Storage } from '@dynamico/common-types';
import multer from 'multer';
import * as controller from './controller';
const storage = multer.memoryStorage();
const upload = multer({ storage: storage });
interface Options {
readOnly?: boolean;
router?: AsyncRouterInstance;
}
export default (storage: Storage, { readOnly, router = AsyncRouter() }: Options = {}): AsyncRouterInstance => {
const driver = new Driver(storage);
router.post('/host/register', bodyParser.json(), controller.registerHost(driver));
router.get('/:name', controller.get(driver));
if (!readOnly) {
router.use(bodyParser.raw());
function prepareMulterUploadHandler(): Express.RequestHandler {
const inMemory = multer.memoryStorage();
return multer({
limits : {
fileSize : config.MAX_IMAGE_FILESIZE_BYTES,
files : 1,
},
fileFilter : imageTypesFilter,
storage : inMemory,
}).single('image');
}
let config = require('config');
let express = require('express');
let router = new express.Router();
let lists = require('../lib/models/lists');
let templates = require('../lib/models/templates');
let campaigns = require('../lib/models/campaigns');
let subscriptions = require('../lib/models/subscriptions');
let tools = require('../lib/tools');
let editorHelpers = require('../lib/editor-helpers.js');
let striptags = require('striptags');
let passport = require('../lib/passport');
let htmlescape = require('escape-html');
let multer = require('multer');
let _ = require('../lib/translate')._;
let util = require('util');
let uploadStorage = multer.memoryStorage();
let uploads = multer({
storage: uploadStorage
});
router.all('/*', (req, res, next) => {
if (!req.user) {
req.flash('danger', _('Need to be logged in to access restricted content'));
return res.redirect('/account/login?next=' + encodeURIComponent(req.originalUrl));
}
res.setSelectedMenu('campaigns');
next();
});
router.get('/', (req, res) => {
res.render('campaigns/campaigns', {
title: _('Campaigns')