added upload path to config and removed socket.io ref
This commit is contained in:
parent
1b61e0fefa
commit
37315c6c66
4 changed files with 9 additions and 7 deletions
|
@ -19,4 +19,7 @@ module.exports = {
|
||||||
session: {
|
session: {
|
||||||
sessionKey: null, // enter a secret key to be used for session encryption
|
sessionKey: null, // enter a secret key to be used for session encryption
|
||||||
},
|
},
|
||||||
|
files: {
|
||||||
|
uploadDirectory: null, // enter file path to where uploads/publishes should be stored
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
const logger = require('winston');
|
const logger = require('winston');
|
||||||
const multipart = require('connect-multiparty');
|
const multipart = require('connect-multiparty');
|
||||||
const multipartMiddleware = multipart({uploadDir: '/home/lbry/test/'});
|
const config = require('../config/speechConfig.js');
|
||||||
|
const multipartMiddleware = multipart({uploadDir: config.files.uploadDirectory});
|
||||||
const db = require('../models');
|
const db = require('../models');
|
||||||
const { publish } = require('../controllers/publishController.js');
|
const { publish } = require('../controllers/publishController.js');
|
||||||
const { getClaimList, resolveUri } = require('../helpers/lbryApi.js');
|
const { getClaimList, resolveUri } = require('../helpers/lbryApi.js');
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
// load dependencies
|
// load dependencies
|
||||||
const express = require('express');
|
const express = require('express');
|
||||||
const bodyParser = require('body-parser');
|
const bodyParser = require('body-parser');
|
||||||
const siofu = require('socketio-file-upload');
|
|
||||||
const expressHandlebars = require('express-handlebars');
|
const expressHandlebars = require('express-handlebars');
|
||||||
const Handlebars = require('handlebars');
|
const Handlebars = require('handlebars');
|
||||||
const handlebarsHelpers = require('./helpers/handlebarsHelpers.js');
|
const handlebarsHelpers = require('./helpers/handlebarsHelpers.js');
|
||||||
|
@ -32,7 +31,6 @@ app.use(helmet()); // set HTTP headers to protect against well-known web vulnera
|
||||||
app.use(express.static(`${__dirname}/public`)); // 'express.static' to serve static files from public directory
|
app.use(express.static(`${__dirname}/public`)); // 'express.static' to serve static files from public directory
|
||||||
app.use(bodyParser.json()); // 'body parser' for parsing application/json
|
app.use(bodyParser.json()); // 'body parser' for parsing application/json
|
||||||
app.use(bodyParser.urlencoded({ extended: true })); // 'body parser' for parsing application/x-www-form-urlencoded
|
app.use(bodyParser.urlencoded({ extended: true })); // 'body parser' for parsing application/x-www-form-urlencoded
|
||||||
app.use(siofu.router); // 'socketio-file-upload' router for uploading with socket.io
|
|
||||||
app.use((req, res, next) => { // custom logging middleware to log all incoming http requests
|
app.use((req, res, next) => { // custom logging middleware to log all incoming http requests
|
||||||
logger.verbose(`Request on ${req.originalUrl} from ${req.ip}`);
|
logger.verbose(`Request on ${req.originalUrl} from ${req.ip}`);
|
||||||
logger.debug('req.body:', req.body);
|
logger.debug('req.body:', req.body);
|
||||||
|
@ -76,7 +74,7 @@ db.sequelize
|
||||||
.then(hostedContentPath => {
|
.then(hostedContentPath => {
|
||||||
// add the hosted content folder at a static path
|
// add the hosted content folder at a static path
|
||||||
app.use('/media', express.static(hostedContentPath));
|
app.use('/media', express.static(hostedContentPath));
|
||||||
// require routes & wrap in socket.io
|
// require routes
|
||||||
require('./routes/auth-routes.js')(app);
|
require('./routes/auth-routes.js')(app);
|
||||||
require('./routes/api-routes.js')(app);
|
require('./routes/api-routes.js')(app);
|
||||||
require('./routes/page-routes.js')(app);
|
require('./routes/page-routes.js')(app);
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
<div class="row row--tall flex-container--column">
|
<div class="row row--tall flex-container--column">
|
||||||
<form>
|
<form>
|
||||||
<input class="input-file" type="file" id="siofu_input" name="siofu_input" accept="video/*,image/*" onchange="publishFileFunctions.previewAndStageFile(event.target.files[0])" enctype="multipart/form-data"/>
|
<input class="input-file" type="file" id="file_input" name="file_input" accept="video/*,image/*" onchange="publishFileFunctions.previewAndStageFile(event.target.files[0])" enctype="multipart/form-data"/>
|
||||||
</form>
|
</form>
|
||||||
<div id="primary-dropzone" class="dropzone row row--margined row--padded row--tall flex-container--column flex-container--center-center" ondrop="drop_handler(event);" ondragover="dragover_handler(event);" ondragend="dragend_handler(event)" ondragenter="dragenter_handler(event)" ondragleave="dragexit_handler(event)" onclick="publishFileFunctions.triggerFileChooser('siofu_input', event)">
|
<div id="primary-dropzone" class="dropzone row row--margined row--padded row--tall flex-container--column flex-container--center-center" ondrop="drop_handler(event);" ondragover="dragover_handler(event);" ondragend="dragend_handler(event)" ondragenter="dragenter_handler(event)" ondragleave="dragexit_handler(event)" onclick="publishFileFunctions.triggerFileChooser('file_input', event)">
|
||||||
<div id="primary-dropzone-instructions">
|
<div id="primary-dropzone-instructions">
|
||||||
<p class="info-message-placeholder info-message--failure" id="input-error-file-selection" hidden="true"></p>
|
<p class="info-message-placeholder info-message--failure" id="input-error-file-selection" hidden="true"></p>
|
||||||
<p>Drag & drop image or video here to publish</p>
|
<p>Drag & drop image or video here to publish</p>
|
||||||
|
@ -22,7 +22,7 @@
|
||||||
<div class="column column--5 column--sml-10" >
|
<div class="column column--5 column--sml-10" >
|
||||||
<!-- preview -->
|
<!-- preview -->
|
||||||
<div class="row row--padded">
|
<div class="row row--padded">
|
||||||
<div id="asset-preview-holder" class="dropzone" ondrop="drop_handler(event);" ondragover="dragover_handler(event);" ondragend="dragend_handler(event)" ondragenter="preview_onmouseenter_handler()" ondragleave="preview_onmouseleave_handler()" onmouseenter="preview_onmouseenter_handler()" onmouseleave="preview_onmouseleave_handler()" onclick="publishFileFunctions.triggerFileChooser('siofu_input', event)">
|
<div id="asset-preview-holder" class="dropzone" ondrop="drop_handler(event);" ondragover="dragover_handler(event);" ondragend="dragend_handler(event)" ondragenter="preview_onmouseenter_handler()" ondragleave="preview_onmouseleave_handler()" onmouseenter="preview_onmouseenter_handler()" onmouseleave="preview_onmouseleave_handler()" onclick="publishFileFunctions.triggerFileChooser('file_input', event)">
|
||||||
<div id="asset-preview-dropzone-instructions" class="hidden">
|
<div id="asset-preview-dropzone-instructions" class="hidden">
|
||||||
<p>Drag & drop image or video here</p>
|
<p>Drag & drop image or video here</p>
|
||||||
<p class="fine-print">OR</p>
|
<p class="fine-print">OR</p>
|
||||||
|
|
Loading…
Add table
Reference in a new issue