@app.route('/',methods=['POST'])#This function is used to create a new url
defhome_post():
ifnotgrecaptcha_verify(request)andnotskipCaptcha:
returnrender_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,loginbar=loginbar)#return the user the prefilled form with an error message, because no url to short was provided
returnrender_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,loginbar=loginbar)#return the user the prefilled form with an error message, because no url to short was provided
if (request.form.get('url').replace("","")==""):
returnrender_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,loginbar=loginbar)#return the user the prefilled form with an error message, because no url to short was provided