Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable reCaptcha for www.lmfdb.org #6129

Merged
merged 5 commits into from
Aug 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 0 additions & 25 deletions lmfdb/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,31 +308,6 @@ def netloc_redirect():
return redirect(urlunparse(replaced), code=302)


@cached_function
def bad_bots_list():
return [
elt.lower()
for elt in [
"The Knowledge AI",
"Wolfram",
"petalbot",
"Bytespider",
"Sogou",
"MJ12bot",
"Amazonbot",
"meta",
"facebook",
]
]


@app.before_request
def badbot():
ua = request.user_agent.string.lower()
for elt in bad_bots_list():
if elt in ua:
return render_template("404.html", title='Too many requests'), 429


def timestamp():
return '[%s UTC]' % time.strftime("%Y-%m-%d %H:%M:%S", time.gmtime())
Expand Down
2 changes: 1 addition & 1 deletion lmfdb/static/robots.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
User-agent: *
Crawl-delay: 15
Crawl-delay: 30
Disallow: /static/
Disallow: /api/

Expand Down
2 changes: 2 additions & 0 deletions lmfdb/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/themes/smoothness/jquery-ui.css"
integrity="sha384-Nlo8b0yiGl7Dn+BgLn4mxhIIBU6We7aeeiulNCjHdUv/eKHx59s3anfSUjExbDxn"
crossorigin="anonymous">
<!--reCAPTCHA-->
<script src="https://www.google.com/recaptcha/enterprise.js?render=6LchHWwpAAAAACFe52hZNEkUP5Bn5_0FfLiEuF3i&waf=session" async defer></script>



Expand Down
5 changes: 5 additions & 0 deletions lmfdb/templates/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -2630,3 +2630,8 @@ span.raw-tset-container:hover > span.raw-tset-copy-btn {
div.upload_section {
margin-bottom: 60px;
}

/* hidge google badge */
.grecaptcha-badge {
visibility: hidden;
}
Loading