Skip to content

Commit

Permalink
remove change origin option from hpm, add fwd option
Browse files Browse the repository at this point in the history
  • Loading branch information
tdjsnelling committed Feb 15, 2023
1 parent fb580ff commit 3f2a725
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion api/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sqtracker/api",
"version": "1.0.0-beta.7",
"version": "1.0.0-beta.8",
"private": true,
"license": "GPL-3.0-only",
"scripts": {
Expand Down
12 changes: 7 additions & 5 deletions api/src/routes/tracker.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,19 @@ import bencode from 'bencode'
export const createUserTrackerRoutes = () =>
createProxyMiddleware({
target: process.env.SQ_TRACKER_URL,
changeOrigin: true,
xfwd: true,
selfHandleResponse: true,
pathRewrite: {
'^/sq/(.*)/': '',
},
onProxyRes: responseInterceptor(async (responseBuffer) => {
onProxyRes: responseInterceptor(async (responseBuffer, proxyRes, req) => {
const trackerResponse = bencode.decode(responseBuffer)
const updatedResponse = {
...trackerResponse,
interval: 30,
'min interval': 30,
}
if (req.path.includes('announce')) {
updatedResponse['interval'] = 30
updatedResponse['min interval'] = 30
}
const bencoded = bencode.encode(updatedResponse)
console.log(`[DEBUG] tracker response: ${bencoded}`)
Expand All @@ -28,5 +30,5 @@ export const createUserTrackerRoutes = () =>
export const createOtherTrackerRoutes = () =>
createProxyMiddleware({
target: process.env.SQ_TRACKER_URL,
changeOrigin: true,
xfwd: true,
})
2 changes: 1 addition & 1 deletion client/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sqtracker/client",
"version": "1.0.0-beta.7",
"version": "1.0.0-beta.8",
"private": true,
"license": "GPL-3.0-only",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "sqtracker",
"version": "1.0.0-beta.7",
"version": "1.0.0-beta.8",
"private": true,
"license": "GPL-3.0-only",
"workspaces": [
Expand Down

0 comments on commit 3f2a725

Please sign in to comment.