mirror of
https://git.waldn.net/git/knotteye/satyr.git
synced 2025-12-09 08:12:21 +00:00
Implement an API call for getting the current stream key.
This commit is contained in:
13
src/http.ts
13
src/http.ts
@@ -274,6 +274,19 @@ async function initAPI() {
|
||||
}
|
||||
});
|
||||
});
|
||||
app.get('/api/user/streamkey/current', (req, res) => {
|
||||
validToken(req.cookies.Authorization).then((t) => {
|
||||
if(t) {
|
||||
db.query('SELECT stream_key FROM users WHERE username='+db.raw.escape(t['username'])).then(o => {
|
||||
if(o[0]) res.send(o[0]);
|
||||
else res.send('{"error":""}');
|
||||
});
|
||||
}
|
||||
else {
|
||||
res.send('{"error":"invalid token"}');
|
||||
}
|
||||
});
|
||||
});
|
||||
app.post('/api/user/streamkey', (req, res) => {
|
||||
validToken(req.cookies.Authorization).then((t) => {
|
||||
if(t) {
|
||||
|
||||
Reference in New Issue
Block a user