comty/packages/server/services/posts/posts.service.js
SrGooglo 8482f2e457 Feat: Implement Music Library and overhaul Studio TV
- Introduces a new Music Library system for managing favorites (tracks,
  playlists, releases), replacing the previous TrackLike model.
- Completely revamps the Studio TV profile page, adding live statistics,
  stream configuration, restream management, and media URL display.
- Enhances the media player with a custom seekbar and improved audio
  playback logic for MPD and non-MPD sources.
- Lays foundational groundwork for chat encryption with new models and APIs.
- Refactors critical UI components like PlaylistView and PagePanel.
- Standardizes monorepo development scripts to use npm.
- Updates comty.js submodule and adds various new UI components.
2025-05-10 02:32:41 +00:00

68 lines
1.5 KiB
JavaScript

//import { Server } from "../../../../linebridge/server/dist"
import { Server } from "linebridge"
import DbManager from "@shared-classes/DbManager"
import RedisClient from "@shared-classes/RedisClient"
import TaskQueueManager from "@shared-classes/TaskQueueManager"
import InjectedAuth from "@shared-lib/injectedAuth"
import SharedMiddlewares from "@shared-middlewares"
export default class API extends Server {
static refName = "posts"
static listenPort = process.env.HTTP_LISTEN_PORT ?? 3001
static websockets = true
static bypassCors = true
static useMiddlewares = ["logs"]
middlewares = {
...SharedMiddlewares,
}
handleWsUpgrade = async (context, token, res) => {
if (!token) {
return res.upgrade(context)
}
context = await InjectedAuth(context, token, res)
if (!context.user) {
res.close(401, "Unauthorized or missing auth token")
return false
}
return res.upgrade(context)
}
// handleWsConnection = (socket) => {
// console.log(`[WS] @${socket.context.user.username} connected`)
// }
// handleWsDisconnect = (socket) => {
// console.log(`[WS] @${socket.context.user.username} disconnected`)
// }
contexts = {
db: new DbManager(),
redis: RedisClient(),
}
queuesManager = new TaskQueueManager({
workersPath: `${__dirname}/queues`,
})
async onInitialize() {
await this.contexts.db.initialize()
await this.contexts.redis.initialize()
await this.queuesManager.initialize({
redisOptions: this.contexts.redis.client.options,
})
global.queues = this.queuesManager
}
}
Boot(API)