Skip to content
Snippets Groups Projects
Commit 0962fb04 authored by Jonas Leder's avatar Jonas Leder
Browse files

fixed some bugs

parent e265f02f
No related branches found
No related tags found
No related merge requests found
......@@ -3,7 +3,7 @@
# OS Support also exists for jessie & stretch (slim and full).
# See https://hub.docker.com/r/library/python/ for all supported Python
# tags from Docker Hub.
FROM python:latest
FROM python:3
# If you prefer miniconda:
#FROM continuumio/miniconda3
......
......@@ -6,15 +6,20 @@ import os
str_encode = str.encode
app = Flask(__name__)
domain = "127.0.0.1:5000;2;3".split(";")#os.environ["domains"].split(";")
domain_to_index = {}
domain_prepared = ""
builddate = ""
#if(os.environ["show_build_date"] == "1"):
# builddate = ", Build date: " + open("builddate.txt", "r").read()
try:
domain = os.environ["domains"].split(";")
except:
domain = ["127.0.0.1:5000"]
builddate = ""
try:
if(os.environ["show_build_date"] == "1"):
builddate = ", Build date: " + open("builddate.txt", "r").read()
except:
pass
index = 0
for domains in domain:
......@@ -73,11 +78,6 @@ def home():
def throw404():
abort(404)
@app.route('/style.css')
def stylesheet():
content = get_file('style.css')
return Response(content, mimetype="text/css")
@app.route('/<short_url>')
def redirect_short_url(short_url):
host = request.headers['Host']
......@@ -94,6 +94,7 @@ def redirect_short_url(short_url):
error_404 = True
except Exception as e:
print(e)
abort(500)
if not error_404:
return redirect(url)
else:
......@@ -101,6 +102,5 @@ def redirect_short_url(short_url):
if __name__ == '__main__':
# This code checks whether database table is created or not
table_check()
table_check()# This code checks whether database table is created or not
serve(app, host='0.0.0.0', port= 5000)
......@@ -13,6 +13,7 @@
Domain: <select name="domain" id="domain">
{{domain | safe}}
</select>
<br><p> </p>
<input id="short" name="short" type="text" placeholder="short name" value="{{short_url_prefilled}}"/>
<button>short</button>
<p class="message">&copy; Made by jonasled {{builddate}}</p>
......@@ -22,7 +23,7 @@
{% endif %}
</div>
</div>
<div id="snackbar">URL already choosen</div>
<div id="snackbar">URL already used, please try another one</div>
{% if alreadychoosen %}
<script>
var x = document.getElementById("snackbar");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment