support backblaze

This commit is contained in:
SrGooglo 2023-07-05 19:04:40 +00:00
parent 6fcd98b070
commit f856ce92d1
2 changed files with 11 additions and 15 deletions

View File

@ -21,6 +21,7 @@
"@foxify/events": "^2.1.0",
"@octokit/rest": "^19.0.7",
"axios": "^1.4.0",
"backblaze-b2": "^1.7.0",
"bcrypt": "^5.1.0",
"busboy": "^1.6.0",
"comty.js": "^0.49.3",
@ -45,7 +46,7 @@
"morgan": "^1.10.0",
"nanoid": "3.2.0",
"normalize-url": "^8.0.0",
"p-map": "^6.0.0",
"p-map": "4.0.0",
"p-queue": "^7.3.4",
"redis": "^4.6.6",
"split-chunk-merge": "^1.0.0"
@ -56,4 +57,4 @@
"mocha": "^10.2.0",
"nodemon": "^2.0.15"
}
}
}

View File

@ -1,13 +1,13 @@
import fs from "fs"
import path from "path"
import B2 from "backblaze-b2"
import RedisClient from "@shared-classes/RedisClient"
import StorageClient from "@shared-classes/StorageClient"
import CacheService from "@shared-classes/CacheService"
import ComtyClient from "@shared-classes/ComtyClient"
import express from "express"
import hyperexpress from "hyper-express"
import pkg from "../package.json"
@ -15,17 +15,6 @@ export default class FileServerAPI {
// max body length is 1GB in bytes
static maxBodyLength = 1000 * 1000 * 1000
// server = global.server = new hyperexpress.Server({
// auto_close: true,
// fast_buffers: false,
// max_body_length: FileServerAPI.maxBodyLength,
// streaming: {
// highWaterMark: 1000 * 1000 * 1000,
// objectMode: false,
// }
// })
//internalRouter = new hyperexpress.Router()
internalRouter = express.Router()
server = global.server = express()
@ -37,6 +26,11 @@ export default class FileServerAPI {
storage = global.storage = StorageClient()
b2Storage = global.b2Storage = new B2({
applicationKeyId: process.env.B2_KEY_ID,
applicationKey: process.env.B2_APP_KEY,
})
cache = global.cache = new CacheService()
comty = global.comty = ComtyClient({
@ -136,6 +130,7 @@ export default class FileServerAPI {
// initialize clients
await this.redis.initialize()
await this.storage.initialize()
await this.b2Storage.authorize()
this.server.use(express.json({ extended: false }))
this.server.use(express.urlencoded({ extended: true }))