mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-09 10:34:17 +00:00
29 lines
760 B
JavaScript
Executable File
29 lines
760 B
JavaScript
Executable File
import { StreamingProfile } from "@shared-classes/DbModels"
|
|
|
|
export default {
|
|
method: "POST",
|
|
route: "/stream/unpublish",
|
|
fn: async (req, res) => {
|
|
const { stream } = req.body
|
|
|
|
const streamingProfile = await StreamingProfile.findOne({
|
|
stream_key: stream
|
|
})
|
|
|
|
if (streamingProfile) {
|
|
global.engine.ws.io.of("/").emit(`streaming.end`, streamingProfile)
|
|
|
|
global.engine.ws.io.of("/").emit(`streaming.end.${streamingProfile.user_id}`, streamingProfile)
|
|
|
|
return res.json({
|
|
code: 0,
|
|
status: "ok"
|
|
})
|
|
}
|
|
|
|
return res.json({
|
|
code: 0,
|
|
status: "ok, but no streaming profile found"
|
|
})
|
|
}
|
|
} |