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