diff --git a/icons/agpl3.png b/icons/agpl3.png new file mode 100644 index 0000000..c3662b6 Binary files /dev/null and b/icons/agpl3.png differ diff --git a/icons/cc-by-sa.png b/icons/cc-by-sa.png new file mode 100644 index 0000000..ca6efde Binary files /dev/null and b/icons/cc-by-sa.png differ diff --git a/icons/cc-by.png b/icons/cc-by.png new file mode 100644 index 0000000..47ff464 Binary files /dev/null and b/icons/cc-by.png differ diff --git a/icons/cc0.png b/icons/cc0.png new file mode 100644 index 0000000..734f9e2 Binary files /dev/null and b/icons/cc0.png differ diff --git a/icons/gpl3-or-later.png b/icons/gpl3-or-later.png new file mode 100644 index 0000000..34379fa Binary files /dev/null and b/icons/gpl3-or-later.png differ diff --git a/icons/gpl3.png b/icons/gpl3.png new file mode 100644 index 0000000..6a4e606 Binary files /dev/null and b/icons/gpl3.png differ diff --git a/icons/lgpl3.png b/icons/lgpl3.png new file mode 100644 index 0000000..5f1a16d Binary files /dev/null and b/icons/lgpl3.png differ diff --git a/modules/Common.py b/modules/Common.py index d449b8d..3c17fc1 100644 --- a/modules/Common.py +++ b/modules/Common.py @@ -130,3 +130,38 @@ def IDcolor(ID): c = IDColors[ID] return c + +# Licenses for stuff +Licenses = { + "cc0":{ + "name":"CC0 Public Domain", + "link":"https://creativecommons.org/publicdomain/zero/1.0/" + }, + "cc-by":{ + "name":"Creative Commons Attribution", + "link":"https://creativecommons.org/licenses/by/4.0/" + }, + "cc-by-sa":{ + "name":"Creative Commons Attribution Share-Alike", + "link":"https://creativecommons.org/licenses/by-sa/4.0/" + }, + "gpl3":{ + "name":"GNU General Public License Version 3", + "link":"https://www.gnu.org/licenses/gpl.html" + }, + "lgpl3":{ + "name":"GNU Lesser General Public License Version 3", + "link":"https://www.gnu.org/licenses/lgpl.html" + }, + "agpl":{ + "name":"GNU Affero General Public License Version 3", + "link":"https://www.gnu.org/licenses/agpl.html" + }, + "gpl3-or-later":{ + "name":"GNU General Public License Version 3 or any later version", + "link":"https://www.gnu.org/licenses/" + } + + + +} diff --git a/modules/Render.py b/modules/Render.py index efd6b69..6c05c4e 100644 --- a/modules/Render.py +++ b/modules/Render.py @@ -469,6 +469,14 @@ def ArticlePage(server, url): """ html = html + '' + + License = Articles.get(article, {}).get("license", "") + if License: + html = html + '
' + html = html + 'License:
' + html = html + '' + html = html + Licenses.get(License, {}).get("name")+'' + html = html + '
' # Audio recording of the article recording = Articles.get(article, {}).get("recording", "") @@ -1120,26 +1128,27 @@ def Graph(server, url): except: article = {} - dates = article.get("views", {}).get("dates", {}) - largest = max(dates.values()) - dateformat = "%Y-%m-%d" - startdate = datetime.strptime(sorted(list(dates.keys()), reverse=True)[0], dateformat) - enddate = datetime.strptime(sorted(list(dates.keys()), reverse=True)[-1], dateformat) - - alldays = int((startdate - enddate).days) - - for n, date in enumerate(sorted(dates, reverse=True)): + dates = article.get("views", {}).get("dates", {}) + if dates: + largest = max(dates.values()) - amount = dates[date] - width = 100 / (alldays+1) - height = 60 * (amount / largest) + startdate = datetime.strptime(sorted(list(dates.keys()), reverse=True)[0], dateformat) + enddate = datetime.strptime(sorted(list(dates.keys()), reverse=True)[-1], dateformat) + + alldays = int((startdate - enddate).days) + + for n, date in enumerate(sorted(dates, reverse=True)): + + amount = dates[date] + width = 100 / (alldays+1) + height = 60 * (amount / largest) + + cd = datetime.strptime(date, dateformat) + nd = int((startdate - cd).days) + + html = html + '
\n' - cd = datetime.strptime(date, dateformat) - nd = int((startdate - cd).days) - - html = html + '
\n' - # Saving the view cookies = [server.cookie] @@ -1155,11 +1164,15 @@ def Graph(server, url): cookies.append(cookie) for cookie in cookies: - if cookie not in article.get("views", {}).get("viewers", []): + if cookie and cookie not in article.get("views", {}).get("viewers", []): article["views"]["amount"] += 1 article["views"]["viewers"].append(cookie) + dates = article["views"]["dates"] + date = datetime.now().strftime(dateformat) + dates[date] = dates.get(date, 0) + 1 + server.newview = True with open(Set.Folder()+"/tabs"+url+"/metadata.json", "w") as save: diff --git a/modules/Run.py b/modules/Run.py index 5bd81f4..9f0264d 100644 --- a/modules/Run.py +++ b/modules/Run.py @@ -28,16 +28,28 @@ class handler(BaseHTTPRequestHandler): q = clr["tbbl"] b = clr["tbbl"] - if self.newview: - b = clr["bold"]+clr["tbrd"] + #print(dir(self)) - for i in self.parsed: - if i != "password": - q = q + "[ "+i+" : "+self.parsed[i][0]+" ] " - else: - q = q + "[ "+i+" : ******* ] " + try: + if self.newview: + b = clr["bold"]+clr["tbrd"] + + for i in self.parsed: + if i != "password": + q = q + "[ "+i+" : "+self.parsed[i][0]+" ] " + else: + q = q + "[ "+i+" : ******* ] " - toprint = consoleForm(self.cookie)+" "+b+"[ "+str(datetime.datetime.now())+" ] "+self.path+" "+q + cookie = self.cookie + + toprint = consoleForm(cookie)+" "+b+"[ "+str(datetime.datetime.now())+" ] "+self.path+" "+q + + except: + + cookie = None + + toprint = consoleForm(cookie)+" "+b+"[ "+str(datetime.datetime.now())+" ] "+self.requestline + print(toprint) folder = Set.Folder()