changeset 32:c23acc88324b

client-side loginbar
author drewp@bigasterisk.com
date Sat, 21 Aug 2021 14:24:09 -0700
parents 9fd62089fbf3
children b82432594778
files lookup.py template/add.jade.mustache template/head.jade.mustache template/index.jade.mustache template/links.jade.mustache
diffstat 5 files changed, 5 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/lookup.py	Sun Jul 12 13:35:41 2020 -0700
+++ b/lookup.py	Sat Aug 21 14:24:09 2021 -0700
@@ -33,15 +33,6 @@
 log = logging.getLogger()
 
 
-def getLoginBar():
-    return requests.get(
-        "http://openid-proxy.default.svc.cluster.local:9023/_loginBar",
-        headers={
-            "Cookie": bottle.request.headers.get('cookie'),
-            'x-site': 'http://bigasterisk.com/openidProxySite/href',
-        }).text
-
-
 def getUser():
     agent = bottle.request.headers.get('x-foaf-agent', None)
     username = db['user'].find_one({'_id': agent
@@ -108,7 +99,6 @@
         'user': getUser()[0],
         'withKnockout': True,
         'fillHrefJson': json.dumps(bottle.request.params.get('url', '')),
-        'loginBar': getLoginBar(),
     }
     return renderWithTime('add.jade', out)
 
@@ -220,7 +210,6 @@
     tags = parseTags(tags)
     log.info('userLinks user=%r tags=%r', user, tags)
     data = recentLinks(user, tags, allowEdit=getUser()[0] == user)
-    data['loginBar'] = getLoginBar()
     data['desc'] = ("%s's recent links" % user) + (" tagged %s" %
                                                    (tags, ) if tags else "")
     data['toRoot'] = siteRoot()
@@ -241,7 +230,6 @@
 @bottle.route('/')
 def root():
     data = {
-        'loginBar': getLoginBar(),
         'toRoot': siteRoot(),
         'stats': {
             'template': 'TEMPLATETIME'
--- a/template/add.jade.mustache	Sun Jul 12 13:35:41 2020 -0700
+++ b/template/add.jade.mustache	Sat Aug 21 14:24:09 2021 -0700
@@ -4,7 +4,7 @@
     title add link
     {{> head.jade}}
   body
-    | {{{loginBar}}}
+    bigast-loginbar
   
     h2 add link  
 
--- a/template/head.jade.mustache	Sun Jul 12 13:35:41 2020 -0700
+++ b/template/head.jade.mustache	Sat Aug 21 14:24:09 2021 -0700
@@ -1,3 +1,4 @@
 meta(name="viewport", content="width=650")
 link(rel="stylesheet", href="{{toRoot}}/static/lib/select2/select2.css")
-link(rel="stylesheet", href="{{toRoot}}/static/style.css")
\ No newline at end of file
+link(rel="stylesheet", href="{{toRoot}}/static/style.css")
+script(type="module", src="https://bigasterisk.com/lib/bigast/v1/loginBar.js")
\ No newline at end of file
--- a/template/index.jade.mustache	Sun Jul 12 13:35:41 2020 -0700
+++ b/template/index.jade.mustache	Sat Aug 21 14:24:09 2021 -0700
@@ -4,7 +4,7 @@
     title href
     {{> head.jade}}
   body
-    | {{{loginBar}}}
+    bigast-loginbar
     
     h2 Users
 
--- a/template/links.jade.mustache	Sun Jul 12 13:35:41 2020 -0700
+++ b/template/links.jade.mustache	Sat Aug 21 14:24:09 2021 -0700
@@ -4,7 +4,7 @@
     title {{desc}}
     {{> head.jade}}
   body
-    | {{{loginBar}}}
+    bigast-loginbar
 
 
     p