From a540f194a874355f9146a967563b0a692a5044ac Mon Sep 17 00:00:00 2001 From: Wei Ouyang Date: Sat, 14 Oct 2023 23:38:10 +0200 Subject: [PATCH] Add notification for maintaince --- src/store.js | 23 ++++++++++++++++++----- src/utils.js | 10 +++++++++- src/views/Home.vue | 14 ++++++++++++++ 3 files changed, 41 insertions(+), 6 deletions(-) diff --git a/src/store.js b/src/store.js index 0efb8a99..f7d568e2 100644 --- a/src/store.js +++ b/src/store.js @@ -50,12 +50,25 @@ function normalizeItem(item) { item.authors = item.authors || []; item.description = item.description || ""; - item.root_url = + if ( item.rdf_source && - item.rdf_source - .split("/") - .slice(0, -1) - .join("/"); + item.rdf_source.startsWith("https://zenodo.org/api/records/") && + item.rdf_source.endsWith("/content") + ) { + item.root_url = + item.rdf_source && + item.rdf_source + .split("/") + .slice(0, -2) + .join("/"); + } else { + item.root_url = + item.rdf_source && + item.rdf_source + .split("/") + .slice(0, -1) + .join("/"); + } if (item.covers && !Array.isArray(item.covers)) { item.covers = [item.covers]; } diff --git a/src/utils.js b/src/utils.js index 72f023eb..6804ba5c 100644 --- a/src/utils.js +++ b/src/utils.js @@ -990,7 +990,15 @@ export function concatAndResolveUrl(url, concat) { url3.push(url2[i]); } } - return url3.join("/"); + + const ret = url3.join("/"); + const regex = /https:\/\/zenodo\.org\/api\/records\/(\d+)\/files\/([\w.]+)/; + const match = ret.match(regex); + if (match) { + return ret + "/content"; + } else { + return ret; + } } function rel2abs(url, base_url) { diff --git a/src/views/Home.vue b/src/views/Home.vue index cb217ff0..75c66c88 100644 --- a/src/views/Home.vue +++ b/src/views/Home.vue @@ -4,6 +4,20 @@ class="hero is-link is-fullheight is-fullheight-with-navbar" style="max-height: 1024px!important;min-height:380px;background-image:url(/static/img/bg.jpg)" > + + Dear ShareLoc Users, our website is currently undergoing maintenance due + to a significant API change in Zenodo (https://zenodo.org), which we + used for our storage. This affects downloads and other features. Our + developer team is actively working on a fix to restore access as soon as + possible. We apologize for any inconvenience and appreciate your + patience. +