chg: [search domain by name] sanityze domain name + show domain

This commit is contained in:
terrtia 2024-12-09 17:04:11 +01:00
parent ea12a44836
commit f4fca05524
No known key found for this signature in database
GPG key ID: 1E1B1F50D84613D0
2 changed files with 9 additions and 0 deletions

View file

@ -103,6 +103,10 @@ def api_get_onion_lookup(domain): # TODO check if object process done ???
meta['titles'].append(t.get_content()) meta['titles'].append(t.get_content())
return meta return meta
def api_get_domain_from_url(url):
url = url.lower()
url_unpack = unpack_url(url)
return url_unpack['domain']
# # # # # # # # # # # # # # # #
# # # #

View file

@ -587,12 +587,17 @@ def domains_search_name():
if not name: if not name:
return create_json_response({'error': 'Mandatory args name not provided'}, 400) return create_json_response({'error': 'Mandatory args name not provided'}, 400)
name = crawlers.api_get_domain_from_url(name)
domains_types = request.args.getlist('domain_types') domains_types = request.args.getlist('domain_types')
if domains_types: if domains_types:
domains_types = domains_types[0].split(',') domains_types = domains_types[0].split(',')
domains_types = Domains.sanitize_domains_types(domains_types) domains_types = Domains.sanitize_domains_types(domains_types)
dom = Domains.Domain(name)
if dom.exists():
return redirect(url_for('crawler_splash.showDomain', domain=dom.get_id()))
l_dict_domains = Domains.api_search_domains_by_name(name, domains_types, meta=True, page=page) l_dict_domains = Domains.api_search_domains_by_name(name, domains_types, meta=True, page=page)
return render_template("domains/domains_result_list.html", template_folder='../../', return render_template("domains/domains_result_list.html", template_folder='../../',
l_dict_domains=l_dict_domains, bootstrap_label=bootstrap_label, l_dict_domains=l_dict_domains, bootstrap_label=bootstrap_label,