my eye

Add preliminary cache support

Committed 1245bd

--- a/webint_search/__init__.py
+++ b/webint_search/__init__.py

 import typesense
 import web
 import webagt
+import webint_cache
 import webint_owner
 import wn
 import youtube_search
         query = form.q
         if not query:
             raise web.SeeOther("/search")
+        resource = None
+        if " " not in query:
+            query_url = easyuri.parse(query)
+            if query_url.suffix:
+                try:
+                    resource = webint_cache.get_resource(query_url)
+                except web.SeeOther as r:
+                    resource = r.body
+                except web.Accepted as r:
+                    resource = "Enqueued..."
 
         conversion = None
         units = {
             query,
             # scope,
             conversion,
+            resource,
             iw_profile,
             ap_profile,
             formatted_query,

--- a/webint_search/templates/results.html
+++ b/webint_search/templates/results.html

-$def with (query, conversion, iw_profile, ap_profile, formatted_query, result, ipa_pronunciation, cmu_pronunciation, definition, rhymes, web_results, code_projects, code_files, books)
+$def with (query, conversion, resource, iw_profile, ap_profile, formatted_query, result, ipa_pronunciation, cmu_pronunciation, definition, rhymes, web_results, code_projects, code_files, books)
 $var breadcrumbs = ("search", "Search")
 $var title: $query
 $var query = query
   margin-top: 1em; }
 </style>
 
+$if resource:
+    $if isinstance(resource, str):
+        <p>$resource</p>
+    $elif resource[1]["card"]:
+        <div>$resource[1]["card"]</div>
+    $else:
+        $ items = resource[1]["mf2json"]["items"]
+        $if items:
+            <div>$items[0]["properties"]</div>
+
 $if iw_profile or ap_profile:
     <div class=profile
     style="display:grid;grid-gap:1em;grid-template-columns:20% auto;margin:2em 0 0 0">