enhancement(lint): Fix lint errors for hackclub-spotify-bot/src/index.js
Some checks failed
Remote SSH Command / Build (push) Has been cancelled

Co-authored-by: NeonGamerBot-QK <saahilattud@gmail.com>
Signed-off-by: zeon-neon[bot] <136533918+zeon-neon[bot]@users.noreply.github.com>
This commit is contained in:
zeon-neon[bot] 2024-11-03 23:08:33 +00:00 committed by GitHub
parent 380f922013
commit 6e06c8ed98
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -2,7 +2,7 @@ const path = require("path");
require("dotenv").config(); require("dotenv").config();
const express = require("express"); const express = require("express");
const session = require("express-session"); const session = require("express-session");
const rateLimit = require('express-rate-limit'); const rateLimit = require("express-rate-limit");
const FileStore = require("session-file-store")(session); const FileStore = require("session-file-store")(session);
const { InstallProvider, FileInstallationStore } = require("@slack/oauth"); const { InstallProvider, FileInstallationStore } = require("@slack/oauth");
const { const {
@ -186,15 +186,15 @@ app.get("/download/db", async (req, res) => {
res.send(csvData); res.send(csvData);
}); });
const limiter = rateLimit({ const limiter = rateLimit({
windowMs: 1 * 60 * 1000, // 1 minutes windowMs: 1 * 60 * 1000, // 1 minutes
limit: 5, // Limit each IP to 100 requests per `window` (here, per 15 minutes). limit: 5, // Limit each IP to 100 requests per `window` (here, per 15 minutes).
standardHeaders: 'draft-7', // draft-6: `RateLimit-*` headers; draft-7: combined `RateLimit` header standardHeaders: "draft-7", // draft-6: `RateLimit-*` headers; draft-7: combined `RateLimit` header
legacyHeaders: false, // Disable the `X-RateLimit-*` headers. legacyHeaders: false, // Disable the `X-RateLimit-*` headers.
// store: ... , // Redis, Memcached, etc. See below. // store: ... , // Redis, Memcached, etc. See below.
}) });
// Apply the rate limiting middleware to all requests. // Apply the rate limiting middleware to all requests.
app.use(limiter) app.use(limiter);
app.post("/spotify/submitsong", async (req, res) => { app.post("/spotify/submitsong", async (req, res) => {
if (!req.session.token) return res.redirect("/login"); if (!req.session.token) return res.redirect("/login");
if (!cacheDb[req.query.token]) return res.redirect(`/home?error=0`); if (!cacheDb[req.query.token]) return res.redirect(`/home?error=0`);