This allows adding AUR package search to browsers and binding it to a
keyword.

In Firefox, right click the address bar when on aur.archlinux.org to add
the search provider.
---
Note: not tested. `docker compose up` got pull access denied on half the
images. it's all copied from archlinux.org/packages and slightly
altered, so i wouldn't expect anything to go wrong anyway

 static/opensearch.xml        | 16 ++++++++++++++++
 templates/partials/head.html |  3 +++
 2 files changed, 19 insertions(+)
 create mode 100644 static/opensearch.xml

diff --git a/static/opensearch.xml b/static/opensearch.xml
new file mode 100644
index 00000000..c14bf307
--- /dev/null
+++ b/static/opensearch.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/";>
+       <ShortName>AUR Packages</ShortName>
+       <LongName>Arch Linux User Repository (AUR) Package Search</LongName>
+       <Description>Search the Arch Linux User Repository by keyword in 
package names and descriptions.</Description>
+       <Tags>linux archlinux aur package software</Tags>
+       <Image height="16" width="16" 
type="image/png">https://archlinux.org/static/favicon.png</Image>
+       <Image height="64" width="64" 
type="image/png">https://archlinux.org/static/logos/icon-transparent-64x64.png</Image>
+       <Language>en-us</Language>
+       <InputEncoding>UTF-8</InputEncoding>
+       <OutputEncoding>UTF-8</OutputEncoding>
+       <Query role="example" searchTerms="autojump"/>
+       <Url type="text/html" 
template="https://aur.archlinux.org/packages?K={searchTerms}"/>
+       <Url rel="self" type="application/opensearchdescription+xml"
+               template="https://archlinux.org/static/opensearch.xml"/>
+</OpenSearchDescription>
diff --git a/templates/partials/head.html b/templates/partials/head.html
index 8bfde020..708bcb4f 100644
--- a/templates/partials/head.html
+++ b/templates/partials/head.html
@@ -11,6 +11,9 @@
     <!-- Alternate resources -->
     <link rel="alternate" type="application/rss+xml"
           title="Newest Packages RSS" href="/rss">
+    <link rel="search" type="application/opensearchdescription+xml"
+          href="/static/opensearch.xml"
+          title="Arch Linux User Repository (AUR) Package Search">
 
     <!-- Include local typeahead -->
     <script type="text/javascript" src="/static/js/typeahead.js"></script>
-- 
2.51.2

Reply via email to