Skip to content

Commit

Permalink
arsenic deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
smartfoloo committed Nov 5, 2024
1 parent d8f0d6a commit 659503f
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 0 deletions.
33 changes: 33 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
const express = require("express");
const cookieParser = require("cookie-parser");
const { createProxyMiddleware } = require("http-proxy-middleware");

const app = express();
const storedCookies = [];
const PORT = 5000;

app.use(cookieParser());

const customProxy = createProxyMiddleware({
target: "https://arsenic.smartfoloo.space/",
changeOrigin: true,
onProxyReq: (proxyReq) => {
storedCookies.forEach((cookie) => {
proxyReq.setHeader("cookie", `${cookie.name}=${cookie.value}`);
});
}
});

app.use((req, res, next) => {
const ignoredPaths = ["/404.html"];

if (!ignoredPaths.includes(req.url)) {
customProxy(req, res, next);
} else {
next();
}
});

app.listen(PORT, () => {
console.log(`FA-v2 server listening on port ${PORT}`);
});
20 changes: 20 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"name": "arsenic-deploy",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"@types/node": "^18.0.6",
"cheerio": "^1.0.0-rc.12",
"cookie-parser": "^1.4.6",
"express": "^4.18.2",
"http-proxy-middleware": "^2.0.6",
"node-fetch": "^3.2.6"
}
}
16 changes: 16 additions & 0 deletions vercel.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"version": 2,
"devCommand": "node index.js",
"builds": [
{
"src": "index.js",
"use": "@vercel/node"
}
],
"routes": [
{
"src": "/(.*)",
"dest": "index.js"
}
]
}

0 comments on commit 659503f

Please sign in to comment.