]> git.llucax.com Git - personal/website.git/blobdiff - source/blog/blog.cgi
blog: Publish old post from 2016
[personal/website.git] / source / blog / blog.cgi
index f59201af49d5c03d521e6871fe2472c689731729..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):
-               return 'http://' + link
+               return 'https://' + link
 
        return None
 
@@ -559,11 +559,12 @@ def sanitize(obj):
 # 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']
-       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'
 
@@ -927,51 +928,21 @@ class Article (object):
                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
 
-                       <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
 
-                       <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):