mirror of
https://github.com/KevinMidboe/zoff.git
synced 2025-10-29 18:00:23 +00:00
RESTApi is timed for 2 seconds
This commit is contained in:
@@ -4,7 +4,7 @@ Under ``` /server/apps/ ```, there are two files, ``` admin.js ``` and ``` clien
|
|||||||
|
|
||||||
## REST
|
## REST
|
||||||
|
|
||||||
All PUT, DELETE and POST endpoints have a 5-second waitlimit for each command per client. The same with shuffling in a player, even when using the client and socket-connection. You'll get a response with Retry-After header for how long you have to wait.
|
All PUT, DELETE and POST endpoints have a 2-second waitlimit for each command per client. You'll get a response with Retry-After header for how long you have to wait. Shuffling in a player has a 5-second waitlimit, but per channel instead of per client.
|
||||||
|
|
||||||
Add song
|
Add song
|
||||||
|
|
||||||
@@ -143,9 +143,9 @@ Still to come: SKIP and SHUFFLE RESTApi calls..
|
|||||||
adminpass: AES-CBC-Pkcs7 with Base64 IV(PASSWORD)
|
adminpass: AES-CBC-Pkcs7 with Base64 IV(PASSWORD)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sends shuffle to the server
|
// Sends shuffle to the server (Only works every 5 seconds per list)
|
||||||
'shuffle', {
|
'shuffle', {
|
||||||
adminpass: AES-CBC-Pkcs7 with Base64 IV(PASSWORD),
|
adminpass: AES-CBC-Pkcs7 with Base64 IV(PASSWORD),
|
||||||
channel: CHANNELNAME,
|
channel: CHANNELNAME,
|
||||||
pass: USER_PASSWORD
|
pass: USER_PASSWORD
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ router.route('/api/list/:channel_name/:video_id').delete(function(req, res) {
|
|||||||
}, function(err, docs) {
|
}, function(err, docs) {
|
||||||
if(docs.length > 0) {
|
if(docs.length > 0) {
|
||||||
var date = new Date(docs[0].createdAt);
|
var date = new Date(docs[0].createdAt);
|
||||||
date.setSeconds(date.getSeconds() + 5);
|
date.setSeconds(date.getSeconds() + 2);
|
||||||
var now = new Date();
|
var now = new Date();
|
||||||
var retry_in = (date.getTime() - now.getTime()) / 1000;
|
var retry_in = (date.getTime() - now.getTime()) / 1000;
|
||||||
if(retry_in > 0) {
|
if(retry_in > 0) {
|
||||||
@@ -187,7 +187,7 @@ router.route('/api/conf/:channel_name').put(function(req, res) {
|
|||||||
}, function(err, docs) {
|
}, function(err, docs) {
|
||||||
if(docs.length > 0) {
|
if(docs.length > 0) {
|
||||||
var date = new Date(docs[0].createdAt);
|
var date = new Date(docs[0].createdAt);
|
||||||
date.setSeconds(date.getSeconds() + 5);
|
date.setSeconds(date.getSeconds() + 2);
|
||||||
var now = new Date();
|
var now = new Date();
|
||||||
var retry_in = (date.getTime() - now.getTime()) / 1000;
|
var retry_in = (date.getTime() - now.getTime()) / 1000;
|
||||||
if(retry_in > 0) {
|
if(retry_in > 0) {
|
||||||
@@ -287,7 +287,7 @@ router.route('/api/list/:channel_name/:video_id').put(function(req,res) {
|
|||||||
}, function(err, docs) {
|
}, function(err, docs) {
|
||||||
if(docs.length > 0) {
|
if(docs.length > 0) {
|
||||||
var date = new Date(docs[0].createdAt);
|
var date = new Date(docs[0].createdAt);
|
||||||
date.setSeconds(date.getSeconds() + 5);
|
date.setSeconds(date.getSeconds() + 2);
|
||||||
var now = new Date();
|
var now = new Date();
|
||||||
var retry_in = (date.getTime() - now.getTime()) / 1000;
|
var retry_in = (date.getTime() - now.getTime()) / 1000;
|
||||||
if(retry_in > 0) {
|
if(retry_in > 0) {
|
||||||
@@ -373,7 +373,7 @@ router.route('/api/list/:channel_name/:video_id').post(function(req,res) {
|
|||||||
}, function(err, docs) {
|
}, function(err, docs) {
|
||||||
if(docs.length > 0) {
|
if(docs.length > 0) {
|
||||||
var date = new Date(docs[0].createdAt);
|
var date = new Date(docs[0].createdAt);
|
||||||
date.setSeconds(date.getSeconds() + 5);
|
date.setSeconds(date.getSeconds() + 2);
|
||||||
var now = new Date();
|
var now = new Date();
|
||||||
var retry_in = (date.getTime() - now.getTime()) / 1000;
|
var retry_in = (date.getTime() - now.getTime()) / 1000;
|
||||||
if(retry_in > 0) {
|
if(retry_in > 0) {
|
||||||
|
|||||||
Reference in New Issue
Block a user