aboutsummaryrefslogtreecommitdiff
path: root/src/app
diff options
context:
space:
mode:
authorAlystrasz <contact@remyraes.com>2022-08-05 01:12:59 +0200
committerAlystrasz <contact@remyraes.com>2022-08-05 01:12:59 +0200
commit944363c06995196f68a57997973b11eac93d7d59 (patch)
tree8ba0592730b1f1ecc3f262fed19380ea19da416e /src/app
parentbea0f483d7bbfbd0d8311ff69c1f04d4798a4bbb (diff)
downloadViper-944363c06995196f68a57997973b11eac93d7d59.tar.gz
Viper-944363c06995196f68a57997973b11eac93d7d59.zip
feat: handle release notes fetching with no internet
When release notes (either Northstar or Viper) fetching fails, if cache contains data, we display it even if it's outdated; if cache is empty, we display an error message in place of release notes.
Diffstat (limited to 'src/app')
-rw-r--r--src/app/launcher.js14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/app/launcher.js b/src/app/launcher.js
index fbeb703..e1dbbe0 100644
--- a/src/app/launcher.js
+++ b/src/app/launcher.js
@@ -26,13 +26,17 @@ function page(page) {
function formatRelease(notes) {
let content = "";
- for (let release of notes) {
- if (release.prerelease) {continue}
- content += "# " + release.name + "\n\n" + release.body + "\n\n\n";
+ if (notes.length === 1) {
+ content = notes[0];
+ } else {
+ for (let release of notes) {
+ if (release.prerelease) {continue}
+ content += "# " + release.name + "\n\n" + release.body + "\n\n\n";
+ }
+
+ content = content.replaceAll(/\@(\S+)/g, `<a href="https://github.com/$1">@$1</a>`);
}
- content = content.replaceAll(/\@(\S+)/g, `<a href="https://github.com/$1">@$1</a>`);
-
return markdown(content, {
breaks: true
});