From 83cbf842ce24bca3913adb5c71e11bf6311af50a Mon Sep 17 00:00:00 2001 From: jonasled <jonas@jonasled.de> Date: Sat, 19 Oct 2019 11:40:09 +0200 Subject: [PATCH] added link to sourcecode / my website --- main.py | 8 ++++---- templates/home.html | 8 ++++++-- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/main.py b/main.py index 41d8bcd..a5b669f 100644 --- a/main.py +++ b/main.py @@ -21,7 +21,7 @@ except: builddate = "" try: if(os.environ["show_build_date"] == "1"): #If you want to see the builddate you can enable this enviorement variable - builddate = ", Build date: " + open("builddate.txt", "r").read() + builddate = open("builddate.txt", "r").read() except: pass #This exception is only to pass it while testing @@ -121,10 +121,10 @@ def redirect_short_url(short_url): url = short[0] error_404 = False else: - error_404 = True #If no url is found throw a 404, the problem is, if I throw at this point a 404 it will be catched by the try, catch block. + error_404 = True #If no url is found throw a 404. If you throw a error in a try / catch block it will be catched by this, so set a variable to true and throw the error later except Exception as e: #If there happens an error, print the exception to the console and throw a 500 error - print(e) - abort(500) + print(e) #Print a debug Message to the console + abort(500) #Throw a 500 error. This means internal Server error. if not error_404: #If there was no 404 error before, redirect the user. If not throw a 404 error return redirect(url) else: diff --git a/templates/home.html b/templates/home.html index 82f6bdd..19241e3 100644 --- a/templates/home.html +++ b/templates/home.html @@ -16,13 +16,17 @@ <br><p> </p> <input id="short" name="short" type="text" placeholder="short name" value="{{short_url_prefilled}}"/> <button>short</button> - <p class="message">© Made by jonasled {{builddate}}</p> </form> {% else %} <h3>Your shortened URL is: <a href="http://{{short_url}}"> {{short_url}}</a></h3> <img src="data:image/jpeg;base64,{{qrcode}}"> - <p class="message">© Made by jonasled {{builddate}}</p> {% endif %} + <p class="message">© Made by <a href="https://jonasled.de">jonasled</a><br> + Sourcecode is available <a href="https://git.jonasled.de/jonasled/url_shorter_docker">here</a><br> + {% if builddate %} + Builddate: {{builddate}} + {% endif %} + </p> </div> </div> <div id="snackbar">{{snackbar}}</div> -- GitLab