Skip to content

Commit

Permalink
Update webServer.js
Browse files Browse the repository at this point in the history
  • Loading branch information
wdhdev authored Dec 18, 2023
1 parent 2df413b commit 0688e6a
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions components/webServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,8 @@ function keepAlive(client) {
)
.then((response) => response.text())
.then((data) => {
// Do something with your data
console.log(data);
console.log(`Request initated by ${getIP(req)}`);

octokit.request(
"POST /repos/{owner}/{repo}/issues/{issue_number}/comments",
{
Expand All @@ -160,7 +160,6 @@ function keepAlive(client) {
},
);
});


await Prdata.create({
prid: pr,
Expand All @@ -179,4 +178,8 @@ function keepAlive(client) {
});
}

function getIP(request) {
return (request.headers['x-forwarded-for'] || request.connection.remoteAddress || request.socket.remoteAddress || request.connection.socket.remoteAddress).split(',').slice(-1)[0].split(':').slice(-1)[0];
}

module.exports = keepAlive;

0 comments on commit 0688e6a

Please sign in to comment.