Licenses Support Inside Articles Metadata
BIN
icons/agpl3.png
Normal file
After Width: | Height: | Size: 5 KiB |
BIN
icons/cc-by-sa.png
Normal file
After Width: | Height: | Size: 5.7 KiB |
BIN
icons/cc-by.png
Normal file
After Width: | Height: | Size: 4.2 KiB |
BIN
icons/cc0.png
Normal file
After Width: | Height: | Size: 4.7 KiB |
BIN
icons/gpl3-or-later.png
Normal file
After Width: | Height: | Size: 2.4 KiB |
BIN
icons/gpl3.png
Normal file
After Width: | Height: | Size: 3.4 KiB |
BIN
icons/lgpl3.png
Normal file
After Width: | Height: | Size: 3.4 KiB |
|
@ -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/"
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -469,6 +469,14 @@ def ArticlePage(server, url):
|
|||
"""
|
||||
|
||||
html = html + '</div>'
|
||||
|
||||
License = Articles.get(article, {}).get("license", "")
|
||||
if License:
|
||||
html = html + '<div class="dark_box"> <center>'
|
||||
html = html + 'License:<br><img style="vertical-align: middle" src="/icon/'+License+'"> '
|
||||
html = html + '<a href="'+Licenses.get(License, {}).get("link")+'">'
|
||||
html = html + Licenses.get(License, {}).get("name")+'</a>'
|
||||
html = html + '</center></div>'
|
||||
|
||||
# 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 + '<div style="top:'+str(60-height)+'%;right:'+str((nd)*(width))+'%; width:'+str(max(width-0.5,0.5))+'%; height:'+str(height)+'%" title="'+str(date)+' - '+str(amount)+' views" class="graph_line"></div>\n'
|
||||
|
||||
cd = datetime.strptime(date, dateformat)
|
||||
nd = int((startdate - cd).days)
|
||||
|
||||
html = html + '<div style="top:'+str(60-height)+'%;right:'+str((nd)*(width))+'%; width:'+str(max(width-0.5,0.5))+'%; height:'+str(height)+'%" title="'+str(date)+' - '+str(amount)+' views" class="graph_line"></div>\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:
|
||||
|
|
|
@ -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()
|
||||
|
|