Create upload directories if they don't exist
This commit is contained in:
parent
e12929960a
commit
3fdccd49d5
8
app.js
8
app.js
|
@ -7,7 +7,6 @@ global.ratelimit_counts = {}
|
|||
global.ratelimit_timestamps = {}
|
||||
|
||||
const pug = require('pug')
|
||||
const path = require('path')
|
||||
const compression = require('compression')
|
||||
const express = require('express')
|
||||
const cookieParser = require('cookie-parser')
|
||||
|
@ -53,7 +52,12 @@ const fs = require('fs')
|
|||
const app = express()
|
||||
const request = require('postman-request')
|
||||
const commons = require('./inc/commons.js')(request, fs)
|
||||
const dlAndSave = require('./inc/downloadAndSave.js')(commons)
|
||||
const dlAndSave = require('./inc/downloadAndSave.js')(commons);
|
||||
|
||||
['pics/thumbs', 'pics/flairs', 'pics/icons', 'vids']
|
||||
.map(d => `./static/${d}`)
|
||||
.filter(d => !fs.existsSync(d))
|
||||
.forEach(d => fs.mkdirSync(d, { recursive: true }))
|
||||
|
||||
if(!config.https_enabled && config.redirect_http_to_https) {
|
||||
console.error(`Cannot redirect HTTP=>HTTPS while "https_enabled" is false.`)
|
||||
|
|
|
@ -20,7 +20,7 @@ module.exports = function(request, fs) {
|
|||
if(!error) {
|
||||
resolve({ success: true })
|
||||
} else {
|
||||
resolve({ success: false })
|
||||
resolve({ success: false, error })
|
||||
}
|
||||
})
|
||||
}).catch((err) => {
|
||||
|
|
|
@ -89,7 +89,7 @@ module.exports = function(tools) {
|
|||
let temp_files = [temp_path, audio_path]
|
||||
deleteFiles(temp_files, (error) => {
|
||||
if(error) {
|
||||
console.log(`Error while deleting temporay files:`, error)
|
||||
console.log(`Error while deleting temporary files:`, error)
|
||||
}
|
||||
})
|
||||
resolve(final_url)
|
||||
|
|
Loading…
Reference in New Issue