mirror of
https://github.com/spacebarchat/server.git
synced 2026-08-14 09:00:07 +00:00
eslint: yoda
This commit is contained in:
@@ -63,8 +63,10 @@ export default defineConfig([
|
||||
// ignoreImports: true
|
||||
// }],
|
||||
// "consistent-return": "error",
|
||||
// "sort-imports": ["error", {}],
|
||||
"default-case": "error",
|
||||
"default-case-last": "error",
|
||||
"yoda": "error",
|
||||
// unsure what the defaults are here, but we want them to error
|
||||
"for-direction": "error",
|
||||
"constructor-super": "error",
|
||||
|
||||
@@ -44,12 +44,12 @@ export function checkPassword(password: string): number {
|
||||
}
|
||||
|
||||
// checks for amount of Numbers
|
||||
if (password.match(reNUMBER)?.length ?? 0 >= minNumbers - 1) {
|
||||
if ((password.match(reNUMBER)?.length ?? 0) >= minNumbers - 1) {
|
||||
strength += 0.05;
|
||||
}
|
||||
|
||||
// checks for amount of Uppercase Letters
|
||||
if (password.match(reUPPERCASELETTER)?.length ?? 0 >= minUpperCase - 1) {
|
||||
if ((password.match(reUPPERCASELETTER)?.length ?? 0) >= minUpperCase - 1) {
|
||||
strength += 0.05;
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ export class AbuseIpDbClient {
|
||||
static async checkIpAddress(ip: string): Promise<AbuseIpDbCheckResponse | null> {
|
||||
const { ipdataApiKey } = Config.get().security;
|
||||
if (!ipdataApiKey) return null;
|
||||
if (this.ipCheckCache.get(ip)?.expires ?? 0 > Date.now()) return this.ipCheckCache.get(ip)!.data;
|
||||
if ((this.ipCheckCache.get(ip)?.expires ?? 0) > Date.now()) return this.ipCheckCache.get(ip)!.data;
|
||||
|
||||
console.log(`[AbuseIPDB] Checking IP address ${ip}...`);
|
||||
const resp = (await (await fetch(`https://api.abuseipdb.com/api/v2/check?ipAddress=${ip}`)).json()) as Promise<AbuseIpDbCheckResponse>;
|
||||
@@ -32,7 +32,7 @@ export class AbuseIpDbClient {
|
||||
static async getBlacklist(): Promise<AbuseIpDbBlacklistResponse | null> {
|
||||
const { abuseIpDbApiKey, abuseipdbBlacklistRatelimit } = Config.get().security;
|
||||
if (!abuseIpDbApiKey) return null;
|
||||
if (this.blacklistCache?.expires ?? 0 > Date.now()) return this.blacklistCache!.data;
|
||||
if ((this.blacklistCache?.expires ?? 0) > Date.now()) return this.blacklistCache!.data;
|
||||
|
||||
console.log("[AbuseIPDB] Fetching blacklist...");
|
||||
const resp = (await (
|
||||
|
||||
@@ -13,7 +13,7 @@ export class IpDataClient {
|
||||
static async getIpInfo(ip: string): Promise<IpDataIpLookupResponse | null> {
|
||||
const { ipdataApiKey } = Config.get().security;
|
||||
if (!ipdataApiKey) return null;
|
||||
if (this.ipInfoCache.get(ip)?.expires ?? 0 > Date.now()) return this.ipInfoCache.get(ip)!.data;
|
||||
if ((this.ipInfoCache.get(ip)?.expires ?? 0) > Date.now()) return this.ipInfoCache.get(ip)!.data;
|
||||
|
||||
console.log(`[IpData] Fetching info for IP address ${ip}...`);
|
||||
const response = await fetch(`https://eu-api.ipdata.co/${ip}?api-key=${ipdataApiKey}`);
|
||||
|
||||
Reference in New Issue
Block a user