Skip to content

Commit

Permalink
Codefactor issues 1
Browse files Browse the repository at this point in the history
  • Loading branch information
inventionpro committed Dec 15, 2024
1 parent 981cb03 commit 50449a9
Show file tree
Hide file tree
Showing 20 changed files with 27 additions and 33 deletions.
2 changes: 1 addition & 1 deletion apis/ad.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ module.exports = {
})
})
})
.catch(err => {
.catch(() => {
res.error('Could not generate', 500);
return;
})
Expand Down
8 changes: 1 addition & 7 deletions apis/animal.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,8 @@ module.exports = {
})
break;
case 'frog':
let uu = Math.floor(Math.random() * 54 + 1);
if (uu.length == 1) {
uu = "000" + uu
} else {
uu = "00" + uu
}
res.json({
image: 'http://allaboutfrogs.org/funstuff/random/'+uu+'.jpg'
image: `http://allaboutfrogs.org/funstuff/random/${String(Math.floor(Math.random() * 54 + 1)).padStart(4, '0')}.jpg`
})
break;
case 'bunny':
Expand Down
4 changes: 2 additions & 2 deletions apis/ascii.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ module.exports = {

let { width, height } = await image
.metadata()
.catch(err => {
.catch(() => {
res.error('Could not read');
return;
});
Expand Down Expand Up @@ -61,7 +61,7 @@ module.exports = {
image: 'data:image/png;base64,' + outputBuffer.toString('base64')
})
})
.catch(err => {
.catch(() => {
res.error('Could not generate', 500);
return;
});
Expand Down
2 changes: 1 addition & 1 deletion apis/audio.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ module.exports = {
download: `https://api.fsh.plus/download/audio/${id}.mp3`
})
})
.on('error', (err) => {
.on('error', () => {
res.error('Could not download', 500);
});
} catch (err) {
Expand Down
2 changes: 1 addition & 1 deletion apis/bi.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ module.exports = {
})
})
})
.catch(err => {
.catch(() => {
res.error('Could not generate', 500);
return;
})
Expand Down
2 changes: 1 addition & 1 deletion apis/biden.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ module.exports = {
image: 'data:image/png;base64,' + outputBuffer.toString('base64')
})
})
.catch(err => {
.catch(() => {
res.error('Could not generate')
return;
})
Expand Down
2 changes: 1 addition & 1 deletion apis/blur.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ module.exports = {
image: 'data:image/png;base64,' + outputBuffer.toString('base64')
})
})
.catch(err => {
.catch(() => {
res.error('Could not generate', 500);
return;
})
Expand Down
6 changes: 3 additions & 3 deletions apis/colorify.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,17 @@ module.exports = {
image: 'data:image/png;base64,' + outputBuffer.toString('base64')
})
})
.catch(err => {
.catch(() => {
res.error('Could not generate', 500);
return;
})
})
.catch(err => {
.catch(() => {
res.error('Could not create color layer', 500);
return;
})
})
.catch(err => {
.catch(() => {
res.error('Could not read image', 500);
return;
})
Expand Down
2 changes: 1 addition & 1 deletion apis/communism.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ module.exports = {
})
})
})
.catch(err => {
.catch(() => {
res.error('Could not generate', 500);
return;
})
Expand Down
4 changes: 2 additions & 2 deletions apis/deepfry.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,12 @@ module.exports = {
image: 'data:image/png;base64,' + outputBuffer.toString('base64')
})
})
.catch(err => {
.catch(() => {
res.error('Could not generate', 500);
return;
})
})
.catch(err => {
.catch(() => {
res.error('Could not generate', 500);
return;
})
Expand Down
2 changes: 1 addition & 1 deletion apis/flip.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ module.exports = {
image: 'data:image/png;base64,' + outputBuffer.toString('base64')
})
})
.catch(err => {
.catch(() => {
res.error('Could not generate', 500);
return;
})
Expand Down
2 changes: 1 addition & 1 deletion apis/flop.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ module.exports = {
image: 'data:image/png;base64,' + outputBuffer.toString('base64')
})
})
.catch(err => {
.catch(() => {
res.error('Could not generate', 500);
return;
})
Expand Down
2 changes: 1 addition & 1 deletion apis/gay.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ module.exports = {
})
})
})
.catch(err => {
.catch(() => {
res.error('Could not generate', 500);
return;
})
Expand Down
2 changes: 1 addition & 1 deletion apis/image-format.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ module.exports = {
image: 'data:image/'+format+';base64,' + outputBuffer.toString('base64')
})
})
.catch(err => {
.catch(() => {
res.error('Could not generate', 500);
return;
})
Expand Down
2 changes: 1 addition & 1 deletion apis/imagine.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ module.exports = {
if (req.query["model"] == "dall-e") {
let img = await fetch(`https://hercai.onrender.com/v3/text2image?prompt=${req.query["text"].replaceAll(" ","%20")}`);
img = await img.json();
if ((String(img.status)??'2').startsWith('4')) {
if (!String(img.status).startsWith('2')) {
res.error('Error, wait a bit or check prompt', 500);
return;
}
Expand Down
6 changes: 3 additions & 3 deletions apis/join.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ let cache = {};

async function getUrl(url) {
if (!url.includes('://')) url = 'https://'+url;
return new Promise(async(resolve, reject) => {
return new Promise(async(resolve) => {
if (!url) {
resolve();
return;
Expand All @@ -30,7 +30,7 @@ async function getUrl(url) {
} else {
resolve();
}
} catch (err) { resolve(); }
} catch (err) { resolve() }
});
}

Expand Down Expand Up @@ -235,7 +235,7 @@ module.exports = {
image: 'data:image/png;base64,' + outputBuffer.toString('base64')
})
})
.catch(err => {
.catch(() => {
res.error('Could not generate', 500);
return;
})
Expand Down
4 changes: 2 additions & 2 deletions apis/pixelate.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@ module.exports = {
image: 'data:image/png;base64,' + outputBuffer.toString('base64')
})
})
.catch(err => {
.catch(() => {
res.error('Could not generate', 500);
return;
})
})
.catch(err => {
.catch(() => {
res.error('Could not generate', 500);
return;
})
Expand Down
2 changes: 1 addition & 1 deletion apis/resize.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ module.exports = {
image: 'data:image/png;base64,' + outputBuffer.toString('base64')
})
})
.catch(err => {
.catch(() => {
res.error('Could not generate', 500);
return;
})
Expand Down
2 changes: 1 addition & 1 deletion apis/video.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ module.exports = {
})
}
})
.on('error', (error) => {
.on('error', () => {
res.error('Could not download', 500);
});
} catch (err) {
Expand Down
2 changes: 1 addition & 1 deletion apis/wanted.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ module.exports = {
})
})
})
.catch(err => {
.catch(() => {
res.error('Could not generate', 500);
return;
})
Expand Down

0 comments on commit 50449a9

Please sign in to comment.