mirror of
https://github.com/wekan/wekan.git
synced 2025-04-23 13:37:09 -04:00
commit
1d8347cc23
1 changed files with 26 additions and 1 deletions
|
@ -9,6 +9,31 @@ function acceptedIpAddress(ipAddress) {
|
|||
);
|
||||
}
|
||||
|
||||
function accessToken(req) {
|
||||
const valid_token = process.env.METRICS_ACCESS_TOKEN;
|
||||
let token;
|
||||
if (req.headers && req.headers.authorization) {
|
||||
var parts = req.headers.authorization.split(" ");
|
||||
|
||||
if (parts.length === 2) {
|
||||
var scheme = parts[0];
|
||||
var credentials = parts[1];
|
||||
|
||||
if (/^Bearer$/i.test(scheme)) {
|
||||
token = credentials;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!token && req.query && req.query.access_token) {
|
||||
token = req.query.access_token;
|
||||
}
|
||||
return (
|
||||
token !== undefined &&
|
||||
valid_token !== undefined &&
|
||||
token == valid_token
|
||||
);
|
||||
}
|
||||
|
||||
const getBoardTitleWithMostActivities = (dateWithXdaysAgo, nbLimit) => {
|
||||
return Promise.await(
|
||||
Activities.rawCollection()
|
||||
|
@ -49,7 +74,7 @@ Meteor.startup(() => {
|
|||
// }
|
||||
|
||||
// List of trusted ip adress will be found in environment variable "METRICS_ACCEPTED_IP_ADDRESS" (separeted with commas)
|
||||
if (acceptedIpAddress(ipAddress)) {
|
||||
if (acceptedIpAddress(ipAddress) || (accessToken(req)) {
|
||||
let metricsRes = '';
|
||||
let resCount = 0;
|
||||
//connected users
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue