fixed few annoyances
This commit is contained in:
parent
786962980b
commit
151efdfc8a
4 changed files with 31 additions and 10 deletions
|
@ -35,6 +35,7 @@ def Create(name):
|
||||||
"description":"",
|
"description":"",
|
||||||
"author":"",
|
"author":"",
|
||||||
"thumbnail":"",
|
"thumbnail":"",
|
||||||
|
"license":"cc-by-sa",
|
||||||
"views":{
|
"views":{
|
||||||
"amount":0,
|
"amount":0,
|
||||||
"viewers":[],
|
"viewers":[],
|
||||||
|
@ -103,3 +104,5 @@ def Publish(name):
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(clr["bold"]+clr["tdrd"]+"Error:"+clr["norm"]+" Could not publish!", e)
|
print(clr["bold"]+clr["tdrd"]+"Error:"+clr["norm"]+" Could not publish!", e)
|
||||||
|
|
||||||
|
print(destination, "has been published!")
|
||||||
|
|
|
@ -640,11 +640,15 @@ def AccountPage(server, account):
|
||||||
if mastodon:
|
if mastodon:
|
||||||
|
|
||||||
# It could be mastodon url and not handle.
|
# It could be mastodon url and not handle.
|
||||||
|
|
||||||
|
# https://social.trom.tf/@morsmortium
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if "/" in mastodon:
|
if "/" in mastodon:
|
||||||
mastodon = mastodon.replace("https://", "").replace("http://", "")
|
mastodon = mastodon.replace("https://", "").replace("http://", "")
|
||||||
mastodon = mastodon.split("/")[1]+"@"+mastodon.split("/")[0]
|
mastodon = mastodon.split("/")[1]+"@"+mastodon.split("/")[0]
|
||||||
|
|
||||||
|
if not mastodon.startswith("@"): mastodon = "@"+mastodon
|
||||||
mastolink = "https://"+mastodon[1:].split("@")[1]+"/@"+mastodon[1:].split("@")[0]
|
mastolink = "https://"+mastodon[1:].split("@")[1]+"/@"+mastodon[1:].split("@")[0]
|
||||||
|
|
||||||
html = html + '<center>'
|
html = html + '<center>'
|
||||||
|
@ -1483,7 +1487,7 @@ def Login(server):
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Redirect(server, "/")
|
Redirect(server, "/settings")
|
||||||
|
|
||||||
def Register(server):
|
def Register(server):
|
||||||
|
|
||||||
|
|
|
@ -84,12 +84,18 @@ class handler(BaseHTTPRequestHandler):
|
||||||
elif self.path[1:].startswith(tuple(categories)):
|
elif self.path[1:].startswith(tuple(categories)):
|
||||||
url = self.path[1:]
|
url = self.path[1:]
|
||||||
if "?" in url: url = url[:url.find("?")]
|
if "?" in url: url = url[:url.find("?")]
|
||||||
|
try:
|
||||||
Render.ArticlePage(self, url)
|
Render.ArticlePage(self, url)
|
||||||
|
except:
|
||||||
|
Render.NotFound(self)
|
||||||
|
|
||||||
elif self.path[1:].startswith("account"):
|
elif self.path[1:].startswith("account"):
|
||||||
url = self.path[9:]
|
url = self.path[9:]
|
||||||
if "?" in url: url = url[:url.find("?")]
|
if "?" in url: url = url[:url.find("?")]
|
||||||
|
try:
|
||||||
Render.AccountPage(self, url)
|
Render.AccountPage(self, url)
|
||||||
|
except:
|
||||||
|
Render.NotFound(self)
|
||||||
|
|
||||||
elif self.path[1:].startswith("login"):
|
elif self.path[1:].startswith("login"):
|
||||||
Render.LoginPage(self)
|
Render.LoginPage(self)
|
||||||
|
@ -138,11 +144,14 @@ class handler(BaseHTTPRequestHandler):
|
||||||
|
|
||||||
elif self.path.startswith("/pictures/"):
|
elif self.path.startswith("/pictures/"):
|
||||||
|
|
||||||
|
try:
|
||||||
folder = Set.Folder()
|
folder = Set.Folder()
|
||||||
f = open(folder+self.path, "rb")
|
f = open(folder+self.path, "rb")
|
||||||
f = f.read()
|
f = f.read()
|
||||||
Render.headers(self, 200)
|
Render.headers(self, 200)
|
||||||
self.wfile.write(f)
|
self.wfile.write(f)
|
||||||
|
except:
|
||||||
|
Render.NotFound(self)
|
||||||
|
|
||||||
elif self.path == "/css":
|
elif self.path == "/css":
|
||||||
|
|
||||||
|
|
|
@ -143,7 +143,7 @@ def Open(md):
|
||||||
# untill it's untagged
|
# untill it's untagged
|
||||||
|
|
||||||
code = ""
|
code = ""
|
||||||
print("#####", n)
|
#print("#####", n)
|
||||||
for l in md[n+1:]:
|
for l in md[n+1:]:
|
||||||
if not l.startswith("```"):
|
if not l.startswith("```"):
|
||||||
code = code + l + "\n"
|
code = code + l + "\n"
|
||||||
|
@ -151,10 +151,15 @@ def Open(md):
|
||||||
else:
|
else:
|
||||||
skip = n + code.count("\n") + 2
|
skip = n + code.count("\n") + 2
|
||||||
break
|
break
|
||||||
print("!!!!!!!!!", skip)
|
#print("!!!!!!!!!", skip)
|
||||||
tree.append(["text_cm", code+"\n"])
|
tree.append(["text_cm", code+"\n"])
|
||||||
te = ""
|
te = ""
|
||||||
|
|
||||||
|
elif line.startswith("---"):
|
||||||
|
|
||||||
|
# Line break in markdown. In this case will be done like this:
|
||||||
|
te = '</div><div class="dark_box">'
|
||||||
|
|
||||||
elif line.startswith("#"):
|
elif line.startswith("#"):
|
||||||
# The titles of the chapter. The Headers are usually written similar
|
# The titles of the chapter. The Headers are usually written similar
|
||||||
# to how here in python you write comments. It's a # , space, and the
|
# to how here in python you write comments. It's a # , space, and the
|
||||||
|
|
Loading…
Add table
Reference in a new issue