-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
32 lines (27 loc) · 891 Bytes
/
index.js
File metadata and controls
32 lines (27 loc) · 891 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
const express = require("express")
const cookieParser = require("cookie-parser")
const { createProxyMiddleware } = require("http-proxy-middleware")
const app = express()
const storedcookies = []
const port = 8080
app.use(cookieParser())
const gamedb = createProxyMiddleware({
target: "https://html5.gamedistribution.com/rvvASMiM/?gd_sdk_referrer_url=yjgames.gamedistribution.com",
changeOrigin: true,
pathRewrite: (path, req) => {
if (path.includes("?")) {
return `${path}&gd_sdk_referrer_url=yjgames.gamedistribution.com`
} else {
return `${path}?gd_sdk_referrer_url=yjgames.gamedistribution.com`
}
},
onProxyReq: (proxyReq) => {
storedcookies.forEach((cookie) => {
proxyReq.setHeader("cookie", `${cookie.name}=${cookie.value}`)
})
}
})
app.use(gamedb)
app.listen(port, () => {
console.log(`listening on http://localhost${port}`)
})