-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Run a proxy over Folding@home web client and capture response data on each work progress update request.
- Loading branch information
0 parents
commit 0180407
Showing
4 changed files
with
34 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
node_modules/ | ||
package-lock.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
package-lock=false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
const app = require('express')(); | ||
const proxy = require('express-http-proxy'); | ||
|
||
const HOST = 'http://127.0.0.1'; | ||
const PORT = 4444; | ||
const FAH = `${HOST}:7396`; | ||
|
||
app.use(proxy(FAH, { | ||
userResDecorator: (_, proxyData, userReq) => { | ||
if (userReq.path === '/api/updates' && proxyData) { | ||
console.log(JSON.parse(proxyData.toString('utf-8'))[0]); | ||
} | ||
return new Promise(resolve => resolve(proxyData)); | ||
} | ||
})); | ||
app.listen(PORT, () => console.log(`Proxy is running at ${HOST}:${PORT}\n`)); | ||
|
||
module.exports = app; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"name": "fah-web-proxy", | ||
"version": "0.1.0", | ||
"private": true, | ||
"main": "app.js", | ||
"scripts": { | ||
"start": "node app.js" | ||
}, | ||
"dependencies": { | ||
"express": "4.16.1", | ||
"express-http-proxy": "1.6.0" | ||
} | ||
} |