mirror of
https://github.com/ajayyy/SponsorBlockServer.git
synced 2025-12-16 08:26:59 +03:00
fix non-format eslint in src/
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import {NextFunction, Request, Response} from 'express';
|
||||
import {NextFunction, Request, Response} from "express";
|
||||
|
||||
export function apiCspMiddleware(req: Request, res: Response, next: NextFunction): void {
|
||||
res.header("Content-Security-Policy", "script-src 'none'; object-src 'none'");
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {NextFunction, Request, Response} from 'express';
|
||||
import {NextFunction, Request, Response} from "express";
|
||||
|
||||
export function corsMiddleware(req: Request, res: Response, next: NextFunction): void {
|
||||
res.header("Access-Control-Allow-Origin", "*");
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import {Logger} from '../utils/logger';
|
||||
import {NextFunction, Request, Response} from 'express';
|
||||
import {Logger} from "../utils/logger";
|
||||
import {NextFunction, Request, Response} from "express";
|
||||
|
||||
export function loggerMiddleware(req: Request, res: Response, next: NextFunction): void {
|
||||
Logger.info(`Request received: ${req.method} ${req.url}`);
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import {getIP} from '../utils/getIP';
|
||||
import {getHash} from '../utils/getHash';
|
||||
import rateLimit from 'express-rate-limit';
|
||||
import {RateLimitConfig} from '../types/config.model';
|
||||
import {Request} from 'express';
|
||||
import { isUserVIP } from '../utils/isUserVIP';
|
||||
import { UserID } from '../types/user.model';
|
||||
import {getIP} from "../utils/getIP";
|
||||
import {getHash} from "../utils/getHash";
|
||||
import rateLimit from "express-rate-limit";
|
||||
import {RateLimitConfig} from "../types/config.model";
|
||||
import {Request} from "express";
|
||||
import { isUserVIP } from "../utils/isUserVIP";
|
||||
import { UserID } from "../types/user.model";
|
||||
|
||||
export function rateLimitMiddleware(limitConfig: RateLimitConfig, getUserID?: (req: Request) => UserID): rateLimit.RateLimit {
|
||||
return rateLimit({
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import fetch from 'node-fetch';
|
||||
import {Logger} from '../utils/logger';
|
||||
import {config} from '../config';
|
||||
import {getIP} from '../utils/getIP';
|
||||
import {getHash} from '../utils/getHash';
|
||||
import {NextFunction, Request, Response} from 'express';
|
||||
import fetch from "node-fetch";
|
||||
import {Logger} from "../utils/logger";
|
||||
import {config} from "../config";
|
||||
import {getIP} from "../utils/getIP";
|
||||
import {getHash} from "../utils/getHash";
|
||||
import {NextFunction, Request, Response} from "express";
|
||||
|
||||
export function userCounter(req: Request, res: Response, next: NextFunction): void {
|
||||
fetch(config.userCounterURL + "/api/v1/addIP?hashedIP=" + getHash(getIP(req), 1), {method: "POST"})
|
||||
.catch(() => Logger.debug("Failing to connect to user counter at: " + config.userCounterURL));
|
||||
fetch(`${config.userCounterURL}/api/v1/addIP?hashedIP=${getHash(getIP(req), 1)}`, {method: "POST"})
|
||||
.catch(() => Logger.debug(`Failing to connect to user counter at: ${config.userCounterURL}`));
|
||||
|
||||
next();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user