Implement an API call for getting the current stream key.

This commit is contained in:
knotteye committed 2020-07-30 01:34:22 -05:00
1 parent df51432a8f
commit f7c7f05786
2 files changed
+27 -4

No files matched your search

+13
View File
@@ -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) {