mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-10 19:14:16 +00:00
added get/stream_config_from_username
endpoint
This commit is contained in:
parent
fd31478636
commit
ec249b70db
@ -34,6 +34,31 @@ export default class StreamingController extends Controller {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get = {
|
get = {
|
||||||
|
"/stream_info_from_username": async (req, res) => {
|
||||||
|
const { username } = req.query
|
||||||
|
|
||||||
|
const userspace = await StreamingKey.findOne({ username })
|
||||||
|
|
||||||
|
if (!userspace) {
|
||||||
|
return res.status(403).json({
|
||||||
|
error: "This username has not a streaming key"
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: meanwhile linebridge remote linkers are in development we gonna use this methods to fetch
|
||||||
|
const { data } = await axios.get(`${streamingServerAPIUri}/streams`, {
|
||||||
|
params: {
|
||||||
|
username: userspace.username
|
||||||
|
}
|
||||||
|
}).catch((error) => {
|
||||||
|
res.status(500).json({
|
||||||
|
error: `Failed to fetch streams from [${streamingServerAPIAddress}]: ${error.message}`
|
||||||
|
})
|
||||||
|
return false
|
||||||
|
})
|
||||||
|
|
||||||
|
return res.json(data)
|
||||||
|
},
|
||||||
"/streams": async (req, res) => {
|
"/streams": async (req, res) => {
|
||||||
// TODO: meanwhile linebridge remote linkers are in development we gonna use this methods to fetch
|
// TODO: meanwhile linebridge remote linkers are in development we gonna use this methods to fetch
|
||||||
const { data } = await axios.get(`${streamingServerAPIUri}/streams`).catch((error) => {
|
const { data } = await axios.get(`${streamingServerAPIUri}/streams`).catch((error) => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user