Update app.py
This commit is contained in:
24
app.py
24
app.py
@@ -365,24 +365,24 @@ def favicon():
|
|||||||
def index():
|
def index():
|
||||||
generated_link = None
|
generated_link = None
|
||||||
recent_links = get_recent_links()
|
recent_links = get_recent_links()
|
||||||
url_param = request.args.get("url", config.DEFAULT_SOURCE_URL)
|
#url_param = request.args.get("url", config.DEFAULT_SOURCE_URL)
|
||||||
raw_ip = request.args.get("ip", "127.0.0.1")
|
raw_ip = request.args.get("ip", "127.0.0.1")
|
||||||
try:
|
try:
|
||||||
target_ip = validate_ip(raw_ip)
|
target_ip = validate_ip(raw_ip)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
target_ip = "127.0.0.1"
|
target_ip = "127.0.0.1"
|
||||||
|
|
||||||
if url_param:
|
#if url_param:
|
||||||
try:
|
# try:
|
||||||
normalized = validate_and_normalize_url(unquote(url_param))
|
# normalized = validate_and_normalize_url(unquote(url_param))
|
||||||
encoded = quote(normalized, safe="")
|
# encoded = quote(normalized, safe="")
|
||||||
generated_link = urljoin(
|
# generated_link = urljoin(
|
||||||
request.host_url, f"convert?url={encoded}&ip={target_ip}"
|
# request.host_url, f"convert?url={encoded}&ip={target_ip}"
|
||||||
)
|
# )
|
||||||
add_recent_link(normalized, target_ip)
|
# add_recent_link(normalized, target_ip)
|
||||||
recent_links = get_recent_links()
|
# recent_links = get_recent_links()
|
||||||
except Exception as e:
|
# except Exception as e:
|
||||||
app.logger.error(f"Error processing URL: {str(e)}")
|
# app.logger.error(f"Error processing URL: {str(e)}")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
return render_template(
|
return render_template(
|
||||||
|
Reference in New Issue
Block a user