1
0

2 Commity 1a19bbc4c8 ... b24ee766bd

Autor SHA1 Správa Dátum
  pezcurrel b24ee766bd Updated “ckrl()” to “ckratelimit.php” “lib” version 2 týždňov pred
  pezcurrel 50e8720adb Updated to “lib” version 2 týždňov pred
2 zmenil súbory, kde vykonal 5 pridanie a 7 odobranie
  1. 1 4
      lib/ckratelimit.php
  2. 4 3
      pfaltgall

+ 1 - 4
lib/ckratelimit.php

@@ -19,10 +19,7 @@ function ckratelimit($headers) {
 	if (!is_int($reset)) return ['ok'=>false,'error'=>'«x-ratelimit-reset» header could not be converted to a unix timestamp'];
 	// don't do the one on the line below, since it happens lots of times
 	//if ($reset<$date) return ['ok'=>false,'error'=>'the unix timestamp parsed from «x-ratelimit-reset» header is less than the unix timestamp parsed from «date» header'];
-	if ($remaining==0)
-		return ['ok'=>true,'sleep'=>$reset-$date+1,'remaining'=>$remaining];
-	else
-		return ['ok'=>true,'sleep'=>0,'remaining'=>$remaining];
+	return ['ok'=>true,'sleep'=>$reset-$date+1,'remaining'=>$remaining];
 }
 
 /*

+ 4 - 3
pfaltgall

@@ -56,8 +56,9 @@ token=as7f8a7s0d89f7as97df09a8s7d90f81jkl2h34lkj12h3jkl4
 ---
 
  Then run {$SCRIPTNAME} with the path of the configuration file you have
-created. This will create an «index.html» file that will be ready to be put
-where you want (you can also see it locally, obviously).
+created as an argument. This will create an «index.html» file in the current
+directory, that will be ready to be put where you want (you can also see it
+locally, obviously).
 
 [[[ OPTIONS ]]]
 
@@ -407,7 +408,7 @@ function eecho($text) {
 
 function ckrl($headers) {
 	$rl=ckratelimit($headers);
-	if ($rl['ok'] && $rl['sleep']>0) {
+	if ($rl['ok'] && $rl['remaining']==0) {
 		echo "\rInfo: reached rate limit, sleeping for {$rl['sleep']} second(s)... ";
 		sleep($rl['sleep']);
 		echo "\n";