]> git.ktnx.net Git - icedeb.git/blobdiff - icedeb.js
extend dsa numbers with an optional trailing -\d+, treat DLA as DSA, add new 'securit...
[icedeb.git] / icedeb.js
index 60dfa66cb086252c9abb6bd9065bb706d0b3eb44..29327a85166cc6df8d45d018bf7421f6a4be7b20 100644 (file)
--- a/icedeb.js
+++ b/icedeb.js
@@ -30,6 +30,7 @@ function trim(word) {
     word = word.replace(/^[^a-zA-Z0-9]+/, '');
     word = word.replace(/[^a-zA-Z0-9]+$/, '');
     word = word.replace(/^Bug#/i, '');
+    word = word.replace(/^#/, '');
   } while ( oldword != word );
 
   return word;
@@ -146,8 +147,16 @@ function link_clicked(e) {
       url = 'https://buildd.debian.org/' + clip;
       break;
     case 'security':
+      clip = clip.replace(' ', '-');
+      clip = clip.toUpperCase();
       url = 'https://security-tracker.debian.org/tracker/' + clip;
       break;
+    case 'piuparts':
+      url = `https://piuparts.debian.org/sid/source/${clip.substring(0,1)}/${clip}.html`;
+      break;
+    case 'r-b':
+      url = 'https://tests.reproducible-builds.org/debian/rb-pkg/' + clip + '.html';
+      break;
   }
 
   open_link(url, e.button == 1)
@@ -165,13 +174,16 @@ function link_clicked(e) {
 function check_likely_inputs(q) {
   let cnt = document.getElementById('button-list-container').classList;
 
-  cnt.remove('like-b', 'like-p', 'like-m', 'like-i');
+  cnt.remove('like-b', 'like-p', 'like-m', 'like-i', 'like-s');
   document.querySelectorAll('.likely')
     .forEach((el) => {
         el.classList.remove('likely');
     });
 
-  if ( /^\d+$/.test(q) || /^CVE-/.test(q) )
+  q = q.replace(/^\s+/, '');
+  q = q.replace(/\s+$/, '');
+
+  if ( /^#?\d+$/.test(q) || /^CVE-/.test(q) )
     cnt.add('like-b');
 
   if ( /^[a-z0-9][a-z0-9\-+.]+$/.test(q) )
@@ -183,7 +195,10 @@ function check_likely_inputs(q) {
   if ( /^<.+@.+>$/.test(q) )
     cnt.add('like-i');
 
-  document.querySelectorAll('.like-b .hint.b, .like-p .hint.p, .like-m .hint.m, .like-i .hint.i')
+  if ( /^d[sl]a[- ]\d+(-\d+)?$/i.test(q) )
+    cnt.add('like-s');
+
+  document.querySelectorAll('.like-b .hint.b, .like-p .hint.p, .like-m .hint.m, .like-i .hint.i, .like-s .hint.s')
     .forEach((el) => {
       el.parentElement.parentElement.classList.add('likely');
     } );