Merge pull request 'docker-upload-directories' (#185) from 3np/teddit:docker-upload-directories into main
Reviewed-on: https://codeberg.org/teddit/teddit/pulls/185
This commit is contained in:
commit
aa8d3f3452
|
@ -6,8 +6,10 @@ RUN apk add ffmpeg
|
|||
|
||||
# Install NPM dependencies and copy the project
|
||||
WORKDIR /teddit
|
||||
COPY . /teddit/
|
||||
COPY . ./
|
||||
RUN npm install --no-optional
|
||||
COPY config.js.template /teddit/config.js
|
||||
COPY config.js.template ./config.js
|
||||
|
||||
RUN find ./static/ -type d -exec chmod -R 777 {} \;
|
||||
|
||||
CMD npm start
|
||||
|
|
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