mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-11 03:24:16 +00:00
fix /stream/info
endpoint
This commit is contained in:
parent
81ea9d1b17
commit
8ed292a6f1
@ -25,7 +25,7 @@ export default class Livestream {
|
|||||||
const { data } = await app.api.customRequest("main", {
|
const { data } = await app.api.customRequest("main", {
|
||||||
method: "GET",
|
method: "GET",
|
||||||
url: `/stream/info`,
|
url: `/stream/info`,
|
||||||
data: {
|
params: {
|
||||||
username,
|
username,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -173,15 +173,20 @@ export default class StreamingController extends Controller {
|
|||||||
"/stream/info": {
|
"/stream/info": {
|
||||||
middleware: ["withAuthentication"],
|
middleware: ["withAuthentication"],
|
||||||
fn: async (req, res) => {
|
fn: async (req, res) => {
|
||||||
let user_id = req.user?._id
|
let user_id = req.query.user_id
|
||||||
|
|
||||||
if (req.body.username || req.body.user_id) {
|
if (!req.query.username && !req.query.user_id) {
|
||||||
|
return res.status(400).json({
|
||||||
|
error: "Invalid request, missing username"
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!user_id) {
|
||||||
user_id = await User.findOne({
|
user_id = await User.findOne({
|
||||||
_id: req.body.user_id,
|
username: req.query.username,
|
||||||
username: req.body.username,
|
})
|
||||||
}).then((user) => user._id)
|
|
||||||
|
|
||||||
user_id = user_id.toString()
|
user_id = user_id["_id"].toString()
|
||||||
}
|
}
|
||||||
|
|
||||||
const info = await StreamingInfo.findOne({
|
const info = await StreamingInfo.findOne({
|
||||||
|
Loading…
x
Reference in New Issue
Block a user