Attention ! Gitlab fournissant maintenant nativement des certificats Let’s Encrypt aux domaines personnalisés des Gitlab Pages, nous avons coupé notre service qui le faisait automatiquement pour vous.

Il est impératif, pour que votre domaine personnalisé continue à avoir un certificat Let’s Encrypt à jour, d’activer la fonctionnalité native dans les paramètres de votre projet. Cette activation remplacera votre certificat actuel par un nouveau certificat Let’s Encrypt géré par Gitlab.

Voir les détails sur https://docs.framasoft.org/fr/gitlab/gitlab-pages-le.html

Commit 02bff814 authored by prx's avatar prx

../dontpanic.py

parent a6a9cf9b
......@@ -7,7 +7,7 @@ Package: dontpanic
Version: 1.6
Maintainer: Xavier Cartron <xcartron@april.org>
Pre-Depends:
Depends: python3, python3-bottle, python3-libtorrent, python3-bs4, python3-requests, sqlite3
Depends: python3, python3-bottle, python3-libtorrent, python3-bs4, sqlite3
Suggests: python3-cherrypy3, python3-paste, python3-tornado
Architecture: all
Copyright: LICENSE
......
......@@ -64,10 +64,6 @@ class DatabaseSqlite(object):
j = 0
new_element = dict()
for row in ele:
if sys.version_info < (3, 0):
if isinstance(row, unicode):
row = row.encode('utf-8')
new_element[rows[j]] = row
j += 1
......
......@@ -28,8 +28,4 @@ if language.info():
else:
logger.info("Your language ({}) is not translated".format(current_locale))
if sys.version_info >= (2, 7):
_ = language.gettext
else:
# Support of unicode for version of Python older than 3
_ = language.ugettext
_ = language.gettext
......@@ -60,10 +60,7 @@ class Subtitle:
if r:
with open(output, 'w') as output:
if sys.version_info[0] < 3:
output.write(r.encode('utf-8'))
else:
output.write(r)
output.write(r)
return True
else:
return False
......
......@@ -19,10 +19,7 @@ from .torrentsession import TorrentSession
from .utils import *
from .webutils import *
if sys.version_info >= (3, 0):
from urllib.parse import quote as quoteurl
else:
from urllib import quote as quoteurl
from urllib.parse import quote as quoteurl
import locale
......@@ -88,7 +85,7 @@ def search2html(keywords, extrawords=' ', searchengine='alphareign', page=0, iss
html += '</tr>'
html += '</tbody>'
html += '</table>'
if searchengine in [ 'alphareign', 'btdb', 'digbt' ]:
if searchengine in [ 'alphareign', 'btdb', 'digbt', 'p2psearch' ]:
html += '<a href="/moreresults/{}/{}/{}/{}/{}">{}</a>'.format(
keywords, int(page) + 1, searchengine, extrawords, isserie, _('More results'))
else: # If there is no result
......@@ -289,7 +286,7 @@ def watchlist(user):
def create_select_search_engine(selected):
#list_search_engines = ["btdigg", "kickasstorrents", "piratebay", "torrentproject", tpl_msg['tpl_all']]
list_search_engines = ["alphareign", "btdb", "digbt", "kickasstorrents", "piratebay", "isohunt", "torrent9", tpl_msg['tpl_all']]
list_search_engines = ["alphareign", "btdb", "digbt", "p2psearch", "kickasstorrents", "piratebay", "isohunt", "torrent9", tpl_msg['tpl_all']]
list_html = str()
for search_engine in list_search_engines:
......@@ -929,6 +926,7 @@ class DontPanic:
if self.magnet_as_arg:
webbrowser.open("http://localhost:{}/stream/dontpanic/{}/0".format(port, self.magnet_as_arg))
else:
print("Open your browser at : http://localhost:{}".format(self.port))
webbrowser.open("http://localhost:{}".format(self.port))
def stop(self):
......
......@@ -8,13 +8,9 @@ import socket
import sys
import logging
import tempfile
import requests
if sys.version_info >= (3, 0):
import configparser as cp
else:
import ConfigParser as cp
import urllib.request
import urllib.parse
import configparser as cp
try:
from i18nlib import _
......@@ -86,13 +82,31 @@ def prepdirs():
def prepconfig():
prepdirs()
def htmlget(url, params=None):
opener = urllib.request.build_opener()
opener.addheaders = [('User-agent', 'Mozilla/5.0')]
if params != None:
p = urllib.parse.urlencode(params)
if url.endswith('?'):
url = '{}{}'.format(url,p)
response = opener.open(url)
else:
p = p.encode('ascii')
response = opener.open(url, p)
else:
response = opener.open(url)
data = response.read()
text = data.decode('utf-8')
response.close()
return(text)
def islastversion():
"""
check if running version is the last one
"""
v = 0
try:
response = requests.get("{}/version".format(progurl))
response = htmlget("{}/version".format(progurl))
v = float(response.text)
except Exception as e:
logging.info("Can't check dontpanic version")
......@@ -234,7 +248,7 @@ def is_running():
port = 0
try:
retval = requests.get("http://localhost:{}".format(port))
retval = htmlget("http://localhost:{}".format(port))
# If we are here, Don't Panic is already running
running = True
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment