Skip to content

Commit

Permalink
la til range hour
Browse files Browse the repository at this point in the history
  • Loading branch information
eilifjohansen committed Sep 13, 2024
1 parent 19d54b0 commit d3d78a0
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,20 @@ app.get('/umami/v2/api/*', (req, res) => {
console.log(req.url);
}

if (req.url.includes('range=hour')) {
// Get the current date and time
let now = new Date();
// Get the timestamp in milliseconds
let nowTimestamp = now.getTime();
// Calculate the timestamp for 48 hours ago
let startAtTimestamp = new Date(now.setHours(now.getHours() - 48)).getTime();
// Append the parameters to the URL
req.url += `&startAt=${startAtTimestamp}&endAt=${nowTimestamp}&unit=hour`;
console.log(req.url);
}



if (req.url.match(/users/)) {
res.end("APIet har blitt blokkert av Team ResearchOps i NAV, ta kontakt med oss for hjelp.");
} else {
Expand Down

0 comments on commit d3d78a0

Please sign in to comment.