Skip to content

Commit

Permalink
Merge pull request #25 from ayushch80/main
Browse files Browse the repository at this point in the history
Added `.env.example`
  • Loading branch information
ghoshRitesh12 authored Feb 28, 2024
2 parents 10ab4ad + 3dc9d80 commit 55d1d43
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
6 changes: 6 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
DOMAIN = "aniwatchtv.to"
PORT = 4000

# RATE LIMIT
WINDOWMS = 1800000 # duration to track requests (in milliseconds) for rate limiting. here, 30*60*1000 = 1800000 = 30 minutes
MAX = 70 # maximum number of requests in this timeperiod
6 changes: 4 additions & 2 deletions src/config/ratelimit.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import { rateLimit } from "express-rate-limit";
import { config } from "dotenv";
config();

export const ratelimit = rateLimit({
windowMs: 30 * 60 * 1000,
max: 70,
windowMs: Number(process.env.WINDOWMS) || 30 * 60 * 1000,
max: Number(process.env.MAX) || 70,
legacyHeaders: true,
standardHeaders: "draft-7",
message: "Too many API requests, try again later",
Expand Down
7 changes: 6 additions & 1 deletion src/utils/constants.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import { config } from "dotenv";
config();

export const ACCEPT_ENCODING_HEADER = "gzip, deflate, br";

export const USER_AGENT_HEADER =
Expand All @@ -6,7 +9,9 @@ export const USER_AGENT_HEADER =
export const ACCEPT_HEADER =
"text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9";

export const SRC_BASE_URL = "https://aniwatchtv.to";
const DOMAIN = process.env.DOMAIN || "aniwatchtv.to"

export const SRC_BASE_URL = `https://${DOMAIN}`;
export const SRC_AJAX_URL = `${SRC_BASE_URL}/ajax`;
export const SRC_HOME_URL = `${SRC_BASE_URL}/home`;
export const SRC_SEARCH_URL = `${SRC_BASE_URL}/search`;

0 comments on commit 55d1d43

Please sign in to comment.