Update app.py
This commit is contained in:
21
app.py
21
app.py
@@ -359,31 +359,11 @@ def favicon():
|
||||
|
||||
@app.route("/", methods=["GET"])
|
||||
def index():
|
||||
generated_link = None
|
||||
recent_links = get_recent_links()
|
||||
#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)}")
|
||||
|
||||
try:
|
||||
return render_template(
|
||||
"form.html",
|
||||
generated_link=generated_link,
|
||||
recent_links=recent_links,
|
||||
client_ip=get_client_ip(),
|
||||
user_agent=request.headers.get("User-Agent", "Unknown"),
|
||||
@@ -391,7 +371,6 @@ def index():
|
||||
except Exception:
|
||||
return jsonify(
|
||||
{
|
||||
"generated_link": generated_link,
|
||||
"recent_links": recent_links,
|
||||
"client_ip": get_client_ip(),
|
||||
"user_agent": request.headers.get("User-Agent", "Unknown"),
|
||||
|
Reference in New Issue
Block a user