Merge remote-tracking branch 'origin/develop'
This commit is contained in:
commit
dbdb929a8f
|
@ -29,7 +29,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|||
### Fixed
|
||||
* z-index issue in dropdowns inside modals
|
||||
* Change search tab from menu
|
||||
* Requests in bulk DOIs upload in linkinh
|
||||
* Requests in bulk DOIs upload in linking
|
||||
* View all for search filters
|
||||
* Research products detailed page: Provenance label in funded by
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="uk-width-1-2@m uk-width-1-1 uk-text-center" uk-scrollspy-class>
|
||||
<img src="assets/explore-assets/funders/funders.png" loading="lazy">
|
||||
<img src="assets/explore-assets/funders/funders.png" alt="Funders advertisement image">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -121,88 +121,105 @@
|
|||
No funders available
|
||||
</div>
|
||||
<div class="uk-grid uk-grid-match uk-padding-small" [ngClass]="gridView ? 'uk-child-width-1-2@m uk-child-width-1-3@l' : 'uk-child-width-1-1'"
|
||||
uk-grid uk-height-match="target: .info;">
|
||||
uk-grid uk-height-match="target: .data;">
|
||||
<div *ngFor="let funder of displayedFunders.slice((currentPage-1)*pageSize, currentPage*pageSize)">
|
||||
<!-- funder's card for GRID view -->
|
||||
<ng-container *ngIf="gridView || isMobile; else elseBlock">
|
||||
<div class="uk-card uk-card-default uk-card-hover funder-grid">
|
||||
<!-- OA % -->
|
||||
<!-- <div class="percentage uk-flex uk-flex-right uk-margin-bottom">-->
|
||||
<div class="uk-position-top-right uk-padding-small">
|
||||
<div *ngIf="funder.openAccessResearchProducts && funder.researchProducts" class="uk-text-center">
|
||||
<div class="uk-flex uk-flex-middle uk-flex-center">
|
||||
<span class="uk-margin-xsmall-right open-access">
|
||||
<icon name="open_access" [flex]="true" [ratio]="1"></icon>
|
||||
</span>
|
||||
<h6 class="uk-margin-remove">{{funder.openAccessPercentage}}%</h6>
|
||||
<!-- <div class="uk-position-top-left uk-padding-small">
|
||||
<span class="uk-text-xsmall">flag</span>
|
||||
</div> -->
|
||||
<!-- <div class="uk-position-top-right uk-padding-small">
|
||||
<div class="uk-flex uk-flex-middle uk-text-xsmall uk-text-meta">
|
||||
<div class="uk-icon-bg uk-icon-bg-small">
|
||||
<icon name="done" [flex]="true"></icon>
|
||||
</div>
|
||||
<span class="uk-h6 uk-text-small">Open Access</span>
|
||||
<span class="uk-margin-xsmall-left">Registered</span>
|
||||
</div>
|
||||
</div> -->
|
||||
<div class="uk-card-media-top uk-margin-medium-top uk-padding-large uk-padding-remove-vertical uk-flex uk-flex-center uk-flex-middle uk-height-xsmall">
|
||||
<img *ngIf="funder.logoUrl; else elseBlock" [src]="funder | logoUrl" [alt]="funder.name + ' logo'" class="uk-height-max-xsmall uk-blend-multiply" loading="lazy">
|
||||
<ng-template #elseBlock>
|
||||
<img src="assets/common-assets/placeholder.png" alt="OpenAIRE placeholder logo" class="uk-height-max-xsmall uk-blend-multiply" loading="lazy">
|
||||
</ng-template>
|
||||
</div>
|
||||
<div class="uk-card-body">
|
||||
<!-- funder logo -->
|
||||
<div class="uk-card-media-top uk-margin-medium-top uk-padding-large uk-padding-remove-vertical uk-flex uk-flex-center uk-flex-middle uk-height-xsmall">
|
||||
<img *ngIf="funder.logoUrl; else elseBlock" [src]="funder | logoUrl" [alt]="funder.name + ' logo'" class="uk-height-max-xsmall uk-blend-multiply" loading="lazy">
|
||||
<ng-template #elseBlock>
|
||||
<img src="assets/common-assets/placeholder.png" alt="OpenAIRE placeholder logo" class="uk-height-max-xsmall uk-blend-multiply" loading="lazy">
|
||||
</ng-template>
|
||||
</div>
|
||||
<!-- funder alias -->
|
||||
<div class="uk-padding-small uk-padding-remove-vertical uk-padding-remove-left uk-margin-medium-left">
|
||||
<!-- alias -->
|
||||
<div class="alias uk-text-uppercase uk-text-small uk-margin-top type">
|
||||
<ng-container *ngIf="funder.alias">
|
||||
{{funder.alias}}
|
||||
</ng-container>
|
||||
</div>
|
||||
<!-- funder name -->
|
||||
<div class="name uk-h6 uk-margin-remove multi-line-ellipsis lines-2">
|
||||
<ng-container *ngIf="funder.name" >
|
||||
{{funder.name}}
|
||||
</ng-container>
|
||||
<div class="uk-flex">
|
||||
<div class="uk-width-expand name uk-h6 uk-margin-remove multi-line-ellipsis lines-2">
|
||||
<ng-container *ngIf="funder.name" >
|
||||
<span>{{funder.name}}</span>
|
||||
</ng-container>
|
||||
</div>
|
||||
<!-- <div class="uk-width-auto uk-margin-left">
|
||||
<a href="" class="uk-flex-inline uk-flex-middle uk-text-uppercase uk-button uk-button-text custom-external">
|
||||
<icon name="payment" [flex]="true"></icon>
|
||||
</a>
|
||||
</div> -->
|
||||
</div>
|
||||
<div class="info uk-margin-medium-top">
|
||||
<!-- Monitor dashboard -->
|
||||
<div class="monitor-dashboard">
|
||||
<!-- PUBLIC status -->
|
||||
<a *ngIf="funder.monitorDashboard && funder.monitorDashboardStatus != 'PRIVATE' && funder.monitorDashboardStatus != 'RESTRICTED'"
|
||||
class="uk-display-inline-block uk-text-uppercase uk-button uk-button-text"
|
||||
target="_blank" [href]="'https://'+(properties.environment =='beta' || properties.environment =='development'?'beta.':'')+'monitor.openaire.eu/dashboard/'+funder.alias">
|
||||
<span class="uk-flex uk-flex-middle">
|
||||
<img src="assets/common-assets/common/Symbol.png" alt="OpenAIRE logo"
|
||||
class="uk-margin-xsmall-right" style="width: 17px; height: 17px;" loading="lazy">
|
||||
<span class="monitor-dashboard-link uk-text-uppercase">Monitor Dashboard</span>
|
||||
</span>
|
||||
</a>
|
||||
<!-- RESTRICTED status -->
|
||||
<span *ngIf="funder.monitorDashboard && funder.monitorDashboardStatus == 'RESTRICTED'"
|
||||
class="uk-flex uk-flex-middle">
|
||||
<img src="assets/common-assets/common/Symbol.png" alt="OpenAIRE logo"
|
||||
class="uk-margin-xsmall-right" style="width: 17px; height: 17px;" loading="lazy">
|
||||
<span class="monitor-dashboard-link uk-text-uppercase uk-text-bold uk-text-small">Monitor Dashboard</span>
|
||||
<icon class="uk-margin-xsmall-left" name="closed_access" [flex]="true" [ratio]="1"></icon>
|
||||
</span>
|
||||
</div>
|
||||
<!-- Projects -->
|
||||
</div>
|
||||
<div class="data uk-background-muted uk-flex uk-flex-middle uk-padding-small uk-padding-remove-left uk-margin-top">
|
||||
<div class="uk-flex uk-flex-middle uk-width-1-1 uk-child-width-1-2 uk-margin-medium-left">
|
||||
<div>
|
||||
<a *ngIf="funder.projects"
|
||||
class="uk-display-inline-block uk-text-uppercase uk-button uk-button-text"
|
||||
[routerLink]="properties.searchLinkToProjects" [queryParams]="{'funder': urlEncodeAndQuote(funder.id)}">
|
||||
<span class="uk-flex uk-flex-middle">
|
||||
<span>Projects ({{funder.projects | number}})</span>
|
||||
<!-- Projects -->
|
||||
<div *ngIf="funder.projects" class="uk-flex uk-flex-column" [class.uk-margin-small-bottom]="funder.researchProducts">
|
||||
<span class="uk-text-meta uk-text-xsmall">
|
||||
Projects
|
||||
</span>
|
||||
</a>
|
||||
<a
|
||||
class="uk-link-text uk-text-large uk-text-bold"
|
||||
[routerLink]="properties.searchLinkToProjects" [queryParams]="{'funder': urlEncodeAndQuote(funder.id)}">
|
||||
<span>
|
||||
{{funder.projects | number}}
|
||||
</span>
|
||||
</a>
|
||||
</div>
|
||||
<!-- Research products -->
|
||||
<div *ngIf="funder.researchProducts" class="uk-flex uk-flex-column">
|
||||
<span class="uk-text-meta uk-text-xsmall">
|
||||
Research Products
|
||||
</span>
|
||||
<a
|
||||
class="uk-link-text uk-text-large uk-text-bold"
|
||||
[routerLink]="properties.searchLinkToResults" [queryParams]="{'relfunder': urlEncodeAndQuote(funder.id)}">
|
||||
<span>
|
||||
{{funder.researchProducts | number}}
|
||||
</span>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Research products -->
|
||||
<div>
|
||||
<a *ngIf="funder.researchProducts"
|
||||
class="uk-display-inline-block uk-text-uppercase uk-button uk-button-text"
|
||||
[routerLink]="properties.searchLinkToResults" [queryParams]="{'relfunder': urlEncodeAndQuote(funder.id)}">
|
||||
<span class="uk-flex uk-flex-middle">
|
||||
<span>Research Products ({{funder.researchProducts | number}})</span>
|
||||
</span>
|
||||
</a>
|
||||
<div class="uk-flex uk-flex-column uk-flex-middle uk-flex-center">
|
||||
<div class="uk-progress-semicircle uk-progress-semicircle-small" [attr.percentage]="funder.openAccessPercentage" [style]="'--percentage:' + funder.openAccessPercentage"></div>
|
||||
<div class="uk-flex uk-flex-middle uk-margin-top">
|
||||
<icon class="open-access" [name]="'open_access'" [flex]="true" [ratio]="0.8"></icon>
|
||||
<span class="uk-text-xsmall uk-margin-xsmall-left">Open Access</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="monitor-dashboard uk-padding-small uk-padding-remove-left uk-margin-medium-left">
|
||||
<a *ngIf="funder.monitorDashboard && funder.monitorDashboardStatus != 'PRIVATE' && funder.monitorDashboardStatus != 'RESTRICTED'"
|
||||
class="uk-display-inline-block uk-text-uppercase uk-button uk-button-text"
|
||||
target="_blank" [href]="'https://'+(properties.environment =='beta' || properties.environment =='development'?'beta.':'')+'monitor.openaire.eu/dashboard/'+funder.alias">
|
||||
<span class="uk-flex uk-flex-middle">
|
||||
<img src="assets/common-assets/common/Symbol.png" alt="OpenAIRE logo"
|
||||
class="uk-margin-xsmall-right" style="width: 17px; height: 17px;" loading="lazy">
|
||||
<span class="monitor-dashboard-link uk-text-uppercase">Monitor Dashboard</span>
|
||||
</span>
|
||||
</a>
|
||||
<span *ngIf="funder.monitorDashboard && funder.monitorDashboardStatus == 'RESTRICTED'"
|
||||
class="uk-flex uk-flex-middle">
|
||||
<img src="assets/common-assets/common/Symbol.png" alt="OpenAIRE logo"
|
||||
class="uk-margin-xsmall-right" style="width: 17px; height: 17px;" loading="lazy">
|
||||
<span class="monitor-dashboard-link uk-text-uppercase uk-text-bold uk-text-small">Monitor Dashboard</span>
|
||||
<icon class="uk-margin-xsmall-left" name="closed_access" [flex]="true" [ratio]="1"></icon>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</ng-container>
|
||||
<!-- funder's card for LIST view -->
|
||||
|
@ -216,19 +233,22 @@
|
|||
<img src="assets/common-assets/placeholder.png" alt="OpenAIRE placeholder logo" class="uk-height-max-xsmall uk-blend-multiply" loading="lazy">
|
||||
</ng-template>
|
||||
</div>
|
||||
<div class="uk-width-expand uk-margin-medium-left">
|
||||
<div class="name uk-h6 uk-text-truncate">
|
||||
<ng-container *ngIf="funder.name">
|
||||
{{funder.name}}
|
||||
</ng-container>
|
||||
<ng-container *ngIf="funder.alias" >
|
||||
<span class="uk-text-uppercase">
|
||||
({{funder.alias}})
|
||||
</span>
|
||||
</ng-container>
|
||||
</div>
|
||||
<div class="uk-grid uk-grid-divider uk-flex-nowrap" uk-grid>
|
||||
<div *ngIf="funder.monitorDashboard">
|
||||
<div class="uk-width-expand uk-grid uk-grid-divider uk-child-width-1-2 uk-margin-left" uk-grid>
|
||||
<div class="uk-flex uk-flex-column uk-flex-center">
|
||||
<div class="uk-flex uk-flex-middle">
|
||||
<!-- <span class="uk-text-xsmall uk-margin-small-right">flag</span> -->
|
||||
<div class="uk-h6 uk-margin-remove uk-text-truncate">
|
||||
<ng-container *ngIf="funder.name">
|
||||
<span>{{funder.name}}</span>
|
||||
</ng-container>
|
||||
<ng-container *ngIf="funder.alias" >
|
||||
<span class="uk-text-uppercase">
|
||||
({{funder.alias}})
|
||||
</span>
|
||||
</ng-container>
|
||||
</div>
|
||||
</div>
|
||||
<div *ngIf="funder.monitorDashboard" class="uk-margin-top">
|
||||
<a *ngIf="funder.monitorDashboard && funder.monitorDashboardStatus != 'PRIVATE' && funder.monitorDashboardStatus != 'RESTRICTED'"
|
||||
class="uk-display-inline-block uk-text-uppercase uk-button uk-button-text"
|
||||
target="_blank" [href]="'https://'+(properties.environment =='beta' || properties.environment =='development'?'beta.':'')+'monitor.openaire.eu/dashboard/'+funder.alias">
|
||||
|
@ -246,44 +266,70 @@
|
|||
<icon class="uk-margin-xsmall-left" name="closed_access" [flex]="true" [ratio]="1"></icon>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="uk-flex uk-flex-middle uk-child-width-1-3">
|
||||
<div>
|
||||
<a *ngIf="funder.projects"
|
||||
class="uk-display-inline-block uk-text-uppercase uk-button uk-button-text"
|
||||
[routerLink]="properties.searchLinkToProjects" [queryParams]="{'funder': urlEncodeAndQuote(funder.id)}">
|
||||
<span class="uk-flex uk-flex-middle">
|
||||
<span>Projects ({{funder.projects | number}})</span>
|
||||
<div *ngIf="funder.projects" class="uk-flex uk-flex-column">
|
||||
<span class="uk-text-meta uk-text-xsmall">
|
||||
Projects
|
||||
</span>
|
||||
</a>
|
||||
<a
|
||||
class="uk-link-text uk-text-large uk-text-bold"
|
||||
[routerLink]="properties.searchLinkToProjects" [queryParams]="{'funder': urlEncodeAndQuote(funder.id)}">
|
||||
<span>
|
||||
{{funder.projects | number}}
|
||||
</span>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<a *ngIf="funder.researchProducts"
|
||||
class="uk-display-inline-block uk-text-uppercase uk-button uk-button-text"
|
||||
[routerLink]="properties.searchLinkToResults" [queryParams]="{'relfunder': urlEncodeAndQuote(funder.id)}">
|
||||
<span class="uk-flex uk-flex-middle">
|
||||
<span>Research Products ({{funder.researchProducts | number}})</span>
|
||||
<div *ngIf="funder.researchProducts" class="uk-flex uk-flex-column">
|
||||
<span class="uk-text-meta uk-text-xsmall">
|
||||
Research Products
|
||||
</span>
|
||||
</a>
|
||||
<a
|
||||
class="uk-link-text uk-text-large uk-text-bold"
|
||||
[routerLink]="properties.searchLinkToResults" [queryParams]="{'relfunder': urlEncodeAndQuote(funder.id)}">
|
||||
<span>
|
||||
{{funder.researchProducts | number}}
|
||||
</span>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<div *ngIf="funder.openAccessResearchProducts && funder.researchProducts" class="uk-flex uk-flex-column">
|
||||
<span class="uk-text-meta uk-text-xsmall">Open Access</span>
|
||||
<div class="uk-flex uk-flex-middle">
|
||||
<span class="uk-margin-xsmall-right open-access">
|
||||
<icon name="open_access" [flex]="true" [ratio]="0.8"></icon>
|
||||
</span>
|
||||
<span class="uk-text-large uk-text-bold">{{funder.openAccessPercentage}}%</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="uk-width-auto uk-flex uk-flex-middle uk-flex-center">
|
||||
<div *ngIf="funder.openAccessResearchProducts && funder.researchProducts" class="uk-text-center">
|
||||
<div class="uk-flex uk-flex-middle uk-flex-center">
|
||||
<span class="uk-margin-xsmall-right open-access">
|
||||
<icon name="open_access" [flex]="true" [ratio]="1"></icon>
|
||||
</span>
|
||||
<h6 class="uk-margin-remove">{{funder.openAccessPercentage}}%</h6>
|
||||
<!-- <div class="uk-width-auto uk-flex uk-flex-column uk-flex-center uk-margin-right">
|
||||
<div class="uk-flex uk-flex-middle uk-text-xsmall uk-text-meta uk-margin-bottom">
|
||||
<div class="uk-icon-bg uk-icon-bg-small">
|
||||
<icon name="done" [flex]="true"></icon>
|
||||
</div>
|
||||
<span class="uk-h6 uk-text-small">Open Access</span>
|
||||
<span class="uk-margin-xsmall-left">Registered</span>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<a href="" class="uk-flex-inline uk-flex-middle uk-text-uppercase uk-button uk-button-text custom-external">
|
||||
<icon name="payment" [flex]="true"></icon>
|
||||
</a>
|
||||
</div>
|
||||
</div> -->
|
||||
</div>
|
||||
</div>
|
||||
</ng-template>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<paging-no-load *ngIf="displayedFunders.length > pageSize"
|
||||
(pageChange)="updateCurrentPage($event)"
|
||||
[currentPage]="currentPage" [size]="pageSize"
|
||||
|
|
|
@ -38,11 +38,11 @@
|
|||
}
|
||||
}
|
||||
|
||||
.uk-card {
|
||||
&.funder-grid {
|
||||
border-bottom: 4px solid fade(@funder-color, 30%);
|
||||
}
|
||||
&.funder-list {
|
||||
border-left: 4px solid fade(@funder-color, 30%);
|
||||
}
|
||||
}
|
||||
// .uk-card {
|
||||
// &.funder-grid {
|
||||
// border-bottom: 4px solid fade(@funder-color, 30%);
|
||||
// }
|
||||
// &.funder-list {
|
||||
// border-left: 4px solid fade(@funder-color, 30%);
|
||||
// }
|
||||
// }
|
|
@ -81,7 +81,7 @@
|
|||
<ng-container *ngFor="let type of getKeys(logos)">
|
||||
<li *ngFor="let range of createRange(logos[type].length) let j=index"
|
||||
class="uk-width-1-1 home-logo">
|
||||
<h1 class="uk-text-center uk-margin-bottom uk-text-primary uk-h4">
|
||||
<h2 class="uk-text-center uk-margin-bottom uk-text-primary uk-h4">
|
||||
<span *ngIf="type=='publication' && numbersComponent.showPublications && numbers?.publicationsSize">
|
||||
<span
|
||||
class="uk-text-bold">{{numbers.publicationsSize.number|number}}{{numbers.publicationsSize.size}}
|
||||
|
@ -119,7 +119,7 @@
|
|||
funded grants</span>
|
||||
</span>
|
||||
|
||||
</h1>
|
||||
</h2>
|
||||
<div class="uk-text-center uk-flex uk-flex-center uk-margin-medium-left uk-margin-medium-right">
|
||||
<ng-container *ngTemplateOutlet="_logos; context: { logo: logos[type][j], class: ' '}"></ng-container>
|
||||
<!-- <div-->
|
||||
|
@ -173,9 +173,9 @@
|
|||
</slider-column>
|
||||
<slider-column type="nav" class="slider-nav">
|
||||
<slider-nav-item [start]="0">
|
||||
<h6>
|
||||
<h3 class="uk-h6">
|
||||
<i class="uk-text-primary">Deposit</i> your research<span class="uk-text-primary">.</span>
|
||||
</h6>
|
||||
</h3>
|
||||
<div class="uk-margin-bottom">
|
||||
Whether it’s publications, data or software,
|
||||
select an OpenAIRE compatible repository and
|
||||
|
@ -190,9 +190,9 @@
|
|||
</div>
|
||||
</slider-nav-item>
|
||||
<slider-nav-item [start]="1">
|
||||
<h6>
|
||||
<h3 class="uk-h6">
|
||||
<i class="uk-text-primary">Link</i> your work<span class="uk-text-primary">.</span>
|
||||
</h6>
|
||||
</h3>
|
||||
<div class="uk-margin-bottom">
|
||||
Connect all your research. If you can't find your research
|
||||
results in OpenAIRE, don't worry! Use our Link service,
|
||||
|
|
|
@ -48,3 +48,5 @@
|
|||
color: @secondary-color;
|
||||
}
|
||||
}
|
||||
|
||||
@uk-label-secondary: @explore-color;
|
||||
|
|
|
@ -6,6 +6,7 @@ const { LRUCache } = require('lru-cache');
|
|||
const request = require('superagent');
|
||||
const prom = require('prom-client');
|
||||
const URL = require('url');
|
||||
let compression = require("compression");
|
||||
const PropertiesReader = require('properties-reader');
|
||||
const properties = PropertiesReader('./properties.file');
|
||||
const environment = properties.get("environment");
|
||||
|
@ -14,6 +15,7 @@ const preloadRequests = properties.get("preloadRequests").split(',');;
|
|||
const cacheMaxSize = 1000;
|
||||
let cors = require('cors');
|
||||
app.use(cors());
|
||||
app.use(compression());
|
||||
const lruCache = new LRUCache({ max: cacheMaxSize });
|
||||
const register = new prom.Registry();
|
||||
prom.collectDefaultMetrics({register: register});
|
||||
|
@ -42,18 +44,25 @@ const histogram = new prom.Histogram({
|
|||
let cache = () => {
|
||||
return (req, res, next) => {
|
||||
if (req.query.url) {
|
||||
let key = '__express__' + req.query.url;
|
||||
let key = req.query.url;
|
||||
const url = new URL.parse(req.query.url);
|
||||
// console.log(req.headers.origin, req.headers.referrer, req.headers.origin)
|
||||
const cacheControlHeader = req.headers['cache-control'];
|
||||
// Log the Cache-Control header
|
||||
// console.log('Cache-Control header sent by client:', cacheControlHeader);
|
||||
let forceReload = req.query.forceReload && req.query.forceReload == 'true'?true:false;
|
||||
forceReload = forceReload || (cacheControlHeader && (cacheControlHeader.indexOf("no-cache") || cacheControlHeader.indexOf("no-store") || cacheControlHeader.indexOf("must-revalidate")))?true:false;
|
||||
|
||||
const target = url.host + '/' + url.pathname.split('/')[1];
|
||||
const scheme = url.protocol.replace(':', '');
|
||||
if (lruCache.has(key)) {
|
||||
// console.log( key, "hit")
|
||||
if (lruCache.has(key) && !forceReload) {
|
||||
// console.log( key, "hit")
|
||||
const end = histogram.startTimer({scheme: scheme, target: target, cache: 'hit'});
|
||||
res.send(JSON.parse(lruCache.get(key)));
|
||||
responses.inc({scheme: scheme, target: target, code: res.statusCode});
|
||||
end();
|
||||
} else {
|
||||
// console.log( key, "miss")
|
||||
// console.log( key, "miss", forceReload)
|
||||
const end = histogram.startTimer({scheme: scheme, target: target, cache: 'miss'});
|
||||
res.sendResponse = res.send;
|
||||
res.send = (body) => {
|
||||
|
@ -85,9 +94,9 @@ let cache = () => {
|
|||
};
|
||||
function isAllowedToBeCached(scheme, target){
|
||||
if(environment != "development"){
|
||||
return scheme.indexOf("https")!=-1 && ( target.indexOf(".openaire.eu/") !=-1 || target.indexOf(".zenodo.org/api/") !=-1 || target.indexOf("lab.idiap.ch/enermaps" != -1))
|
||||
return scheme.indexOf("https")!=-1 && ( target.indexOf(".openaire.eu/") !=-1 || target.indexOf("zenodo.org/api") !=-1 || target.indexOf("lab.idiap.ch/enermaps" != -1))
|
||||
} else if(environment == "development"){
|
||||
return target.indexOf(".openaire.eu/") !=-1 || target.indexOf(".di.uoa.gr") !=-1 || target.indexOf("dev-openaire.d4science.org") !=-1 || target.indexOf("lab.idiap.ch/enermaps") != -1
|
||||
return target.indexOf(".openaire.eu/") !=-1 || target.indexOf(".di.uoa.gr") !=-1 || target.indexOf("zenodo.org/api") !=-1 || target.indexOf("dev-openaire.d4science.org") !=-1 || target.indexOf("lab.idiap.ch/enermaps") != -1
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
},
|
||||
"dependencies": {
|
||||
"axios": "^1.6.7",
|
||||
"compression": "^1.7.4",
|
||||
"cors": "^2.8.5",
|
||||
"express": "^4.18.2",
|
||||
"lru-cache": "^10.2.0",
|
||||
|
|
Loading…
Reference in New Issue