diff --git a/VERSION b/VERSION deleted file mode 100644 index 1acb46a42ac884acd88654241127964d24dd728d..0000000000000000000000000000000000000000 --- a/VERSION +++ /dev/null @@ -1 +0,0 @@ -1.20.1 \ No newline at end of file diff --git a/app/newurl.py b/app/newurl.py index 2ee4433c408616da6815c4c7f659ee4eddd22519..7a7baff47f1278ca6439564a2e74abad91d76bcf 100644 --- a/app/newurl.py +++ b/app/newurl.py @@ -4,7 +4,7 @@ from flask import render_template from sqlite3 import connect from makeqr import makeQR -def newurl(request, skipCaptcha, recaptchaPrivateKey, recaptchaPublicKey, builddate, version, domain_prepared, domain_to_index, showDomainSelect, cookieNotice, s, url_scheme, loginEnabled, passwordProtected, password): +def newurl(request, skipCaptcha, recaptchaPrivateKey, recaptchaPublicKey, builddate, domain_prepared, domain_to_index, showDomainSelect, cookieNotice, s, url_scheme, loginEnabled, passwordProtected, password): try: userID = s.loads(request.cookies.get('userID')) loginbar = "Hello " + s.loads(request.cookies.get('username')) + ' (<a href="/user/links" >your links</a>, <a href="/user/logout" >logout</a>)' @@ -12,13 +12,13 @@ def newurl(request, skipCaptcha, recaptchaPrivateKey, recaptchaPublicKey, buildd userID = "null" loginbar = '<a href="/user/login" >login</a>' if not grecaptcha_verify(request, skipCaptcha, recaptchaPrivateKey): - return render_template('home.html', builddate=builddate, version=version, domain=domain_prepared, snackbar="There was an error validating, that you are a human, please try again.", long_url_prefilled=request.form.get('url'), short_url_prefilled=request.form.get('short').lower(), domain_prefilled=domain_to_index[request.form.get('domain')], recaptchaPublicKey=recaptchaPublicKey, showDomainSelect=showDomainSelect, loginEnabled=loginEnabled, loginbar=loginbar, cookieNotice=cookieNotice, passwordProtected=passwordProtected) #return the user the prefilled form with an error message, because recaptcha failed + return render_template('home.html', builddate=builddate, domain=domain_prepared, snackbar="There was an error validating, that you are a human, please try again.", long_url_prefilled=request.form.get('url'), short_url_prefilled=request.form.get('short').lower(), domain_prefilled=domain_to_index[request.form.get('domain')], recaptchaPublicKey=recaptchaPublicKey, showDomainSelect=showDomainSelect, loginEnabled=loginEnabled, loginbar=loginbar, cookieNotice=cookieNotice, passwordProtected=passwordProtected) #return the user the prefilled form with an error message, because recaptcha failed if passwordProtected and (request.form.get("password") != password): - return render_template('home.html', builddate=builddate, version=version, domain=domain_prepared, snackbar="Wrong password, please try again.", long_url_prefilled=request.form.get('url'), short_url_prefilled=request.form.get('short').lower(), domain_prefilled=domain_to_index[request.form.get('domain')], recaptchaPublicKey=recaptchaPublicKey, showDomainSelect=showDomainSelect, loginEnabled=loginEnabled, loginbar=loginbar, cookieNotice=cookieNotice, passwordProtected=passwordProtected) #return the user the prefilled form with an error message, because the password was wrong + return render_template('home.html', builddate=builddate, domain=domain_prepared, snackbar="Wrong password, please try again.", long_url_prefilled=request.form.get('url'), short_url_prefilled=request.form.get('short').lower(), domain_prefilled=domain_to_index[request.form.get('domain')], recaptchaPublicKey=recaptchaPublicKey, showDomainSelect=showDomainSelect, loginEnabled=loginEnabled, loginbar=loginbar, cookieNotice=cookieNotice, passwordProtected=passwordProtected) #return the user the prefilled form with an error message, because the password was wrong if (request.form.get('url').replace(" ", "") == ""): - return render_template('home.html', builddate=builddate, version=version, domain=domain_prepared, snackbar="Please enter a url to short, before submitting this form", long_url_prefilled=request.form.get('url'), short_url_prefilled=request.form.get('short').lower(), domain_prefilled=domain_to_index[request.form.get('domain')], recaptchaPublicKey=recaptchaPublicKey, showDomainSelect=showDomainSelect, loginEnabled=loginEnabled, loginbar=loginbar, cookieNotice=cookieNotice, passwordProtected=passwordProtected) #return the user the prefilled form with an error message, because no url to short was provided + return render_template('home.html', builddate=builddate, domain=domain_prepared, snackbar="Please enter a url to short, before submitting this form", long_url_prefilled=request.form.get('url'), short_url_prefilled=request.form.get('short').lower(), domain_prefilled=domain_to_index[request.form.get('domain')], recaptchaPublicKey=recaptchaPublicKey, showDomainSelect=showDomainSelect, loginEnabled=loginEnabled, loginbar=loginbar, cookieNotice=cookieNotice, passwordProtected=passwordProtected) #return the user the prefilled form with an error message, because no url to short was provided if (request.form.get('short').replace(" ", "") == ""): - return render_template('home.html', builddate=builddate, version=version, domain=domain_prepared, snackbar="Please enter a short name, before submitting this form", long_url_prefilled=request.form.get('url'), short_url_prefilled=request.form.get('short').lower(), domain_prefilled=domain_to_index[request.form.get('domain')], recaptchaPublicKey=recaptchaPublicKey, showDomainSelect=showDomainSelect, loginEnabled=loginEnabled, loginbar=loginbar, cookieNotice=cookieNotice, passwordProtected=passwordProtected) #return the user the prefilled form with an error message, because no short link was provided + return render_template('home.html', builddate=builddate, domain=domain_prepared, snackbar="Please enter a short name, before submitting this form", long_url_prefilled=request.form.get('url'), short_url_prefilled=request.form.get('short').lower(), domain_prefilled=domain_to_index[request.form.get('domain')], recaptchaPublicKey=recaptchaPublicKey, showDomainSelect=showDomainSelect, loginEnabled=loginEnabled, loginbar=loginbar, cookieNotice=cookieNotice, passwordProtected=passwordProtected) #return the user the prefilled form with an error message, because no short link was provided shorturl = (request.form.get('domain') + "/" + request.form.get('short').replace(" ", "_").replace("/", "").replace("?","")).lower() url = request.form.get('url') @@ -38,9 +38,9 @@ def newurl(request, skipCaptcha, recaptchaPrivateKey, recaptchaPublicKey, buildd 'INSERT INTO WEB_URL (LONG_URL, SHORT_URL, USERNAME) VALUES (?, ?, ?)', [url, shorturl, userID] ) - return render_template('home.html', short_url=shorturl, recaptchaPublicKey=recaptchaPublicKey, builddate=builddate, version=version, domain=domain_prepared, qrcode=makeQR(url_scheme + "://" + shorturl), loginbar=loginbar, cookieNotice=cookieNotice, loginEnabled=loginEnabled) #return the shorten link to the user + return render_template('home.html', short_url=shorturl, recaptchaPublicKey=recaptchaPublicKey, builddate=builddate, domain=domain_prepared, qrcode=makeQR(url_scheme + "://" + shorturl), loginbar=loginbar, cookieNotice=cookieNotice, loginEnabled=loginEnabled) #return the shorten link to the user else: - return render_template('home.html', builddate=builddate, version=version, recaptchaPublicKey=recaptchaPublicKey, domain=domain_prepared, snackbar="URL already used, please try another one", long_url_prefilled=request.form.get('url'), short_url_prefilled=request.form.get('short').lower(), domain_prefilled=domain_to_index[request.form.get('domain')], showDomainSelect=showDomainSelect, loginbar=loginbar, cookieNotice=cookieNotice, loginEnabled=loginEnabled) #return the user the prefilled form with an error message, because the url was already used + return render_template('home.html', builddate=builddate, recaptchaPublicKey=recaptchaPublicKey, domain=domain_prepared, snackbar="URL already used, please try another one", long_url_prefilled=request.form.get('url'), short_url_prefilled=request.form.get('short').lower(), domain_prefilled=domain_to_index[request.form.get('domain')], showDomainSelect=showDomainSelect, loginbar=loginbar, cookieNotice=cookieNotice, loginEnabled=loginEnabled) #return the user the prefilled form with an error message, because the url was already used if (__name__ == "__main__"): print("This file is not made for direct call, please run the main.py") diff --git a/docker-compose-build.yml b/docker-compose-build.yml index 6cfdf3401c88e740edfcb6a93fa0ef5549a1614b..5a07622a139d472730736777c0ba8228b4183db8 100644 --- a/docker-compose-build.yml +++ b/docker-compose-build.yml @@ -10,7 +10,6 @@ services: environment: - domains= #List of domains (with port if not 80/443) seperated with ";" - show_build_date=0 #Disable this, if you don't want to see the builddate - - show_version=0 #Normaly disable this. - production=1 #Enable this, if you want to run the server in production - url_scheme=https #If you use a reverse Proxy with https set this to https - recaptcha_private= #Please enter here your private Key for google recaptcha diff --git a/docker-compose.yml b/docker-compose.yml index 34063dfda0ff45970798e18102f39caa43e68197..62caf7c1498560368858490871ca530bf86879af 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -10,7 +10,6 @@ services: environment: - domains= #List of domains (with port if not 80/443) seperated with ";" - show_build_date=0 #Normaly disable this. - - show_version=0 #Normaly disable this. - production=1 #You should only disable this for debugging - url_scheme=https #If you use a reverse Proxy with https set this to https - recaptcha_private= #Please enter here your private Key for google recaptcha