aboutsummaryrefslogtreecommitdiff
path: root/p/scripts/api.js
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2021-10-21 11:44:03 +0200
committerGravatar GitHub <noreply@github.com> 2021-10-21 11:44:03 +0200
commitb438d8bb3d4b3dea6d28d0b0c73da9393c9d8299 (patch)
treefe3c9550c2f3cd46edefae7ceda56407c80d8e36 /p/scripts/api.js
parentcfd625c5596f2ce20ab4341bb04ddb263552e417 (diff)
ESLint upgrade from JSHint (#3906)
* ESLint upgrade from JSHint * commit corresponding package.json * `npm run fix` for automatic JS and CSS fixes * Keep JSHint config for now
Diffstat (limited to 'p/scripts/api.js')
-rw-r--r--p/scripts/api.js75
1 files changed, 37 insertions, 38 deletions
diff --git a/p/scripts/api.js b/p/scripts/api.js
index f9dcabf01..ce52c50ad 100644
--- a/p/scripts/api.js
+++ b/p/scripts/api.js
@@ -1,6 +1,5 @@
// @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPL-3.0
-"use strict";
-/* jshint esversion:6, strict:global */
+'use strict';
function check(url, next) {
if (!url || !next) {
@@ -10,8 +9,8 @@ function check(url, next) {
req.open('GET', url, true);
req.setRequestHeader('Authorization', 'GoogleLogin auth=test/1');
req.onerror = function (e) {
- next('FAIL: HTTP ' + e);
- };
+ next('FAIL: HTTP ' + e);
+ };
req.onload = function () {
if (this.status == 200) {
next(this.response);
@@ -25,40 +24,40 @@ function check(url, next) {
const jsonVars = JSON.parse(document.getElementById('jsonVars').innerHTML);
check(jsonVars.greader + '/check/compatibility', function next(result1) {
- const greaderOutput = document.getElementById('greaderOutput');
- if (result1 === 'PASS') {
- greaderOutput.innerHTML = '✔️ ' + result1;
- } else {
- check(jsonVars.greader + '/check%2Fcompatibility', function next(result2) {
- if (result2 === 'PASS') {
- greaderOutput.innerHTML = '⚠️ WARN: no <code>%2F</code> support, so some clients will not work!';
- } else {
- check('./greader.php/check/compatibility', function next(result3) {
- if (result3 === 'PASS') {
- greaderOutput.innerHTML = '⚠️ WARN: Probable invalid base URL in ./data/config.php';
- } else {
- greaderOutput.innerHTML = '❌ ' + result1;
- }
- });
- }
- });
- }
- });
-
-check(jsonVars.fever + '?api', function next(result1) {
- const feverOutput = document.getElementById('feverOutput');
- try {
- JSON.parse(result1);
- feverOutput.innerHTML = '✔️ PASS';
- } catch (ex) {
- check('./fever.php?api', function next(result2) {
- try {
- JSON.parse(result2);
- feverOutput.innerHTML = '⚠️ WARN: Probable invalid base URL in ./data/config.php';
- } catch (ex) {
- feverOutput.innerHTML = '❌ ' + result1;
+ const greaderOutput = document.getElementById('greaderOutput');
+ if (result1 === 'PASS') {
+ greaderOutput.innerHTML = '✔️ ' + result1;
+ } else {
+ check(jsonVars.greader + '/check%2Fcompatibility', function next(result2) {
+ if (result2 === 'PASS') {
+ greaderOutput.innerHTML = '⚠️ WARN: no <code>%2F</code> support, so some clients will not work!';
+ } else {
+ check('./greader.php/check/compatibility', function next(result3) {
+ if (result3 === 'PASS') {
+ greaderOutput.innerHTML = '⚠️ WARN: Probable invalid base URL in ./data/config.php';
+ } else {
+ greaderOutput.innerHTML = '❌ ' + result1;
}
});
- }
- });
+ }
+ });
+ }
+});
+
+check(jsonVars.fever + '?api', function next(result1) {
+ const feverOutput = document.getElementById('feverOutput');
+ try {
+ JSON.parse(result1);
+ feverOutput.innerHTML = '✔️ PASS';
+ } catch (ex) {
+ check('./fever.php?api', function next(result2) {
+ try {
+ JSON.parse(result2);
+ feverOutput.innerHTML = '⚠️ WARN: Probable invalid base URL in ./data/config.php';
+ } catch (ex) {
+ feverOutput.innerHTML = '❌ ' + result1;
+ }
+ });
+ }
+});
// @license-end