From a4da8a4f52c99289a5ccab7067e7e6b3748b0daa Mon Sep 17 00:00:00 2001 From: BlenderDumbass Date: Mon, 25 Nov 2024 23:17:19 +0200 Subject: [PATCH] Changed output rendering --- modules/Common.py | 20 ++++++++++++++++++-- modules/Render.py | 2 ++ modules/Run.py | 11 +++++++++-- 3 files changed, 29 insertions(+), 4 deletions(-) diff --git a/modules/Common.py b/modules/Common.py index 937ed43..d449b8d 100644 --- a/modules/Common.py +++ b/modules/Common.py @@ -86,12 +86,28 @@ IDColors = {} def consoleForm(obj): + from modules.Render import accounts + + # Username preview + username = "" + Accounts = accounts() + for account in Accounts: + if obj in Accounts[account].get("sessions"): + username = account + break + + + # Function that prints a pretty object info about - if not obj: obj = "ANONYMOUS " + if not obj: obj = " ANONYMOUS " ID = obj - NAME = obj[-10:] + + if not username: + NAME = obj[-14:] + else: + NAME = username[:15].upper() c = IDcolor(ID) diff --git a/modules/Render.py b/modules/Render.py index 6948b7e..4bd6d3b 100644 --- a/modules/Render.py +++ b/modules/Render.py @@ -1128,6 +1128,8 @@ def Graph(server, url): article["views"]["amount"] += 1 article["views"]["viewers"].append(cookie) + server.newview = True + with open(Set.Folder()+"/tabs"+url+"/metadata.json", "w") as save: json.dump(article, save, indent=4) diff --git a/modules/Run.py b/modules/Run.py index 4f940af..5bd81f4 100644 --- a/modules/Run.py +++ b/modules/Run.py @@ -25,14 +25,19 @@ class handler(BaseHTTPRequestHandler): if "?" in self.path: self.path = self.path[:self.path.find("?")] - q = "" + q = clr["tbbl"] + b = clr["tbbl"] + + 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)+" "+"[ "+str(datetime.datetime.now())+" ] "+self.path+" "+q + toprint = consoleForm(self.cookie)+" "+b+"[ "+str(datetime.datetime.now())+" ] "+self.path+" "+q print(toprint) folder = Set.Folder() @@ -52,6 +57,8 @@ class handler(BaseHTTPRequestHandler): self.cookie = self.headers.get("Cookie") if self.cookie: self.cookie = self.cookie[-50:] + self.newview = False + categories = list(Render.tabs().keys()) if self.path[:self.path.find("?")] == "/" or self.path == "/":