X-Git-Url: https://git.llucax.com/personal/website.git/blobdiff_plain/1453a4609aa57e8a23beae626e4416468436824d..8cccc4d84a0feabb49c057b5b8850f694e4c60a0:/source/blog/blog.cgi diff --git a/source/blog/blog.cgi b/source/blog/blog.cgi index ba9db9f..2865925 100755 --- a/source/blog/blog.cgi +++ b/source/blog/blog.cgi @@ -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 -
- - - - - - -
''', rst) + + ''', rst) rst = re.sub(r'.. vimeo:: (\w*)', r'''.. raw:: html -
- - - - - - - -
''', rst) + + ''', rst) rst = re.sub(r'.. grooveshark:: (\w*)', r'''.. raw:: html -
- - - - - - - -
''', rst) + Grooveshark is no more! This was supposed to show \1. + ''', rst) 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), - 'flattrbtn': self.get_flattr_btn(), '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) - 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 ''' - - -''' % v - class ArticleDB (object): def __init__(self, dbpath):