mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-10 02:54:15 +00:00
support backblaze
This commit is contained in:
parent
6fcd98b070
commit
f856ce92d1
@ -21,6 +21,7 @@
|
|||||||
"@foxify/events": "^2.1.0",
|
"@foxify/events": "^2.1.0",
|
||||||
"@octokit/rest": "^19.0.7",
|
"@octokit/rest": "^19.0.7",
|
||||||
"axios": "^1.4.0",
|
"axios": "^1.4.0",
|
||||||
|
"backblaze-b2": "^1.7.0",
|
||||||
"bcrypt": "^5.1.0",
|
"bcrypt": "^5.1.0",
|
||||||
"busboy": "^1.6.0",
|
"busboy": "^1.6.0",
|
||||||
"comty.js": "^0.49.3",
|
"comty.js": "^0.49.3",
|
||||||
@ -45,7 +46,7 @@
|
|||||||
"morgan": "^1.10.0",
|
"morgan": "^1.10.0",
|
||||||
"nanoid": "3.2.0",
|
"nanoid": "3.2.0",
|
||||||
"normalize-url": "^8.0.0",
|
"normalize-url": "^8.0.0",
|
||||||
"p-map": "^6.0.0",
|
"p-map": "4.0.0",
|
||||||
"p-queue": "^7.3.4",
|
"p-queue": "^7.3.4",
|
||||||
"redis": "^4.6.6",
|
"redis": "^4.6.6",
|
||||||
"split-chunk-merge": "^1.0.0"
|
"split-chunk-merge": "^1.0.0"
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
import fs from "fs"
|
import fs from "fs"
|
||||||
import path from "path"
|
import path from "path"
|
||||||
|
|
||||||
|
import B2 from "backblaze-b2"
|
||||||
|
|
||||||
import RedisClient from "@shared-classes/RedisClient"
|
import RedisClient from "@shared-classes/RedisClient"
|
||||||
import StorageClient from "@shared-classes/StorageClient"
|
import StorageClient from "@shared-classes/StorageClient"
|
||||||
import CacheService from "@shared-classes/CacheService"
|
import CacheService from "@shared-classes/CacheService"
|
||||||
import ComtyClient from "@shared-classes/ComtyClient"
|
import ComtyClient from "@shared-classes/ComtyClient"
|
||||||
|
|
||||||
import express from "express"
|
import express from "express"
|
||||||
import hyperexpress from "hyper-express"
|
|
||||||
|
|
||||||
import pkg from "../package.json"
|
import pkg from "../package.json"
|
||||||
|
|
||||||
@ -15,17 +15,6 @@ export default class FileServerAPI {
|
|||||||
// max body length is 1GB in bytes
|
// max body length is 1GB in bytes
|
||||||
static maxBodyLength = 1000 * 1000 * 1000
|
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()
|
internalRouter = express.Router()
|
||||||
|
|
||||||
server = global.server = express()
|
server = global.server = express()
|
||||||
@ -37,6 +26,11 @@ export default class FileServerAPI {
|
|||||||
|
|
||||||
storage = global.storage = StorageClient()
|
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()
|
cache = global.cache = new CacheService()
|
||||||
|
|
||||||
comty = global.comty = ComtyClient({
|
comty = global.comty = ComtyClient({
|
||||||
@ -136,6 +130,7 @@ export default class FileServerAPI {
|
|||||||
// initialize clients
|
// initialize clients
|
||||||
await this.redis.initialize()
|
await this.redis.initialize()
|
||||||
await this.storage.initialize()
|
await this.storage.initialize()
|
||||||
|
await this.b2Storage.authorize()
|
||||||
|
|
||||||
this.server.use(express.json({ extended: false }))
|
this.server.use(express.json({ extended: false }))
|
||||||
this.server.use(express.urlencoded({ extended: true }))
|
this.server.use(express.urlencoded({ extended: true }))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user