]> git.llucax.com Git - personal/website.git/blobdiff - source/blog/blog.cgi
Update resume
[personal/website.git] / source / blog / blog.cgi
index ba9db9fc37a18d1db668f4ddb0b52de92f1264b9..2865925128a9e4f6cb691157c870fb5bc9ff3281 100755 (executable)
@@ -548,7 +548,7 @@ def valid_link(link):
        if re.match(mail_re, link, re.I):
                return 'mailto:' + link
        elif re.match(url_re, link, re.I):
        if re.match(mail_re, link, re.I):
                return 'mailto:' + link
        elif re.match(url_re, link, re.I):
-               return 'http://' + link
+               return 'https://' + link
 
        return None
 
 
        return None
 
@@ -559,11 +559,12 @@ def sanitize(obj):
 # find out our URL, needed for syndication
 try:
        n = os.environ['SERVER_NAME']
 # find out our URL, needed for syndication
 try:
        n = os.environ['SERVER_NAME']
-       p = os.environ['SERVER_PORT']
+        # Removed port because it messes up when behind a proxy
+       #p = os.environ['SERVER_PORT']
        s = os.environ['SCRIPT_NAME']
        s = os.environ['SCRIPT_NAME']
-       if p == '80': p = ''
-       else: p = ':' + p
-       full_url = 'http://%s%s%s' % (n, p, s)
+       #if p == '80': p = ''
+       #else: p = ':' + p
+       full_url = 'https://%s%s' % (n, s)
 except KeyError:
        full_url = 'Not needed'
 
 except KeyError:
        full_url = 'Not needed'
 
@@ -927,51 +928,21 @@ class Article (object):
                import re
                rst = re.sub(r'.. youtube:: (.*)', r'''.. raw:: html
 
                import re
                rst = re.sub(r'.. youtube:: (.*)', r'''.. raw:: html
 
-                       <div style="text-align: center; margin-bottom: 8pt">
-                       <object width="500" height="375">
-                           <param name="movie"
-                               value="http://www.youtube.com/v/\1&amp;hl=en&amp;fs=1"
-                               ></param>
-                           <param name="allowFullScreen" value="true"></param>
-                           <param name="allowscriptaccess" value="always"></param>
-                           <embed src="http://www.youtube.com/v/\1&amp;hl=en&amp;fs=1"
-                               type="application/x-shockwave-flash" allowscriptaccess="always"
-                               allowfullscreen="true" width="500" height="375"></embed>
-                       </object>
-                       </div>''', rst)
+                        <iframe width="560" height="315"
+                                src="https://www.youtube.com/embed/\1"
+                                frameborder="0" allowfullscreen></iframe>
+                       ''', rst)
                rst = re.sub(r'.. vimeo:: (\w*)', r'''.. raw:: html
 
                rst = re.sub(r'.. vimeo:: (\w*)', r'''.. raw:: html
 
-                       <div style="text-align: center; margin-bottom: 8pt">
-                       <object width="500" height="375">
-                           <param name="allowfullscreen" value="true" />
-                           <param name="allowscriptaccess" value="always" />
-                           <param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=\1&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" />
-                           <embed src="http://vimeo.com/moogaloop.swf?clip_id=\1&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1"
-                               type="application/x-shockwave-flash"
-                               allowfullscreen="true"
-                               allowscriptaccess="always"
-                               width="500"
-                               height="375">
-                           </embed>
-                       </object>
-                       </div>''', rst)
+                        <iframe src="https://player.vimeo.com/video/\1"
+                                width="500" height="281" frameborder="0"
+                                webkitallowfullscreen mozallowfullscreen
+                                allowfullscreen></iframe>
+                       ''', rst)
                rst = re.sub(r'.. grooveshark:: (\w*)', r'''.. raw:: html
 
                rst = re.sub(r'.. grooveshark:: (\w*)', r'''.. raw:: html
 
-                       <div class="grooveshark">
-                       <object width="220" height="300">
-                         <param name="movie"
-                           value="http://listen.grooveshark.com/widget.swf" />
-                         <param name="wmode" value="window" />
-                         <param name="allowScriptAccess" value="always" />
-                         <param name="flashvars"
-                           value="hostname=cowbell.grooveshark.com&playlistID=\1&style=metal&p=0" />
-                         <embed src="http://listen.grooveshark.com/widget.swf"
-                           type="application/x-shockwave-flash"
-                           width="220" height="300"
-                           flashvars="hostname=cowbell.grooveshark.com&playlistID=\1&style=metal&p=0"
-                           allowScriptAccess="always" wmode="window" />
-                       </object>
-                       </div>''', rst)
+                        Grooveshark is no more! This was supposed to show \1.
+                       ''', rst)
                return rst_to_html(rst)
 
        def to_vars(self):
                return rst_to_html(rst)
 
        def to_vars(self):
@@ -982,7 +953,6 @@ class Article (object):
                        'uuid': self.uuid,
                        'tags': self.get_tags_links(),
                        'comments': len(self.comments),
                        'uuid': self.uuid,
                        'tags': self.get_tags_links(),
                        'comments': len(self.comments),
-                       'flattrbtn': self.get_flattr_btn(),
 
                        'created': self.created.isoformat(' '),
                        'ciso': self.created.isoformat(),
 
                        'created': self.created.isoformat(' '),
                        'ciso': self.created.isoformat(),
@@ -1012,33 +982,6 @@ class Article (object):
                                (blog_url, urllib.quote(t), sanitize(t) ))
                return ', '.join(l)
 
                                (blog_url, urllib.quote(t), sanitize(t) ))
                return ', '.join(l)
 
-       def get_flattr_btn(self):
-               v = dict()
-               v['tags'] = ','.join([sanitize(tag) for tag in self.tags])
-               v['tags'] = v['tags'].replace('"', '-').replace(':', '-')
-               v['tags'] = v['tags'].replace(';', '-')
-               v['title'] = sanitize(self.title)
-               v['qtitle'] = title.replace('"', '')
-               v['url'] = full_url + '/post/' + self.uuid
-               v['furl'] = 'https://flattr.com/submit/auto?' + urllib.urlencode(
-                               dict(user_id='llucax', url=v['url'],
-                                       title=self.title,
-                                       description="Blog article titled: " +
-                                               self.title,
-                                       language='en', tags=','.join(self.tags),
-                                       category='text'))
-               return '''
-<a class="FlattrButton" style="display:none;"
-   rel="flattr;uid:llucax;category:text;tags:%(tags)s;button:compact;"
-   title="%(qtitle)s" lang="en"
-   href="%(url)s">Blog article titled: %(title)s</a>
-<noscript><a href="%(furl)s" target="_blank">
-        <img src="http://api.flattr.com/button/flattr-badge-large.png"
-            alt="Flattr this" title="Flattr this" border="0" />
-       </a>
-</noscript>
-''' % v
-
 
 class ArticleDB (object):
        def __init__(self, dbpath):
 
 class ArticleDB (object):
        def __init__(self, dbpath):