mirror of
https://github.com/minetest/contentdb.git
synced 2024-11-08 08:33:45 +01:00
Add config for admin contact url
This commit is contained in:
parent
ba6b7d6dcf
commit
2867856d40
@ -18,9 +18,10 @@ import datetime
|
||||
import os
|
||||
import redis
|
||||
|
||||
from flask import redirect, url_for, render_template, flash, request, Flask, send_from_directory, make_response
|
||||
from flask import redirect, url_for, render_template, flash, request, Flask, send_from_directory, make_response, render_template_string
|
||||
from flask_babel import Babel, gettext
|
||||
from flask_flatpages import FlatPages
|
||||
from flask_flatpages.utils import pygmented_markdown
|
||||
from flask_github import GitHub
|
||||
from flask_gravatar import Gravatar
|
||||
from flask_login import logout_user, current_user, LoginManager
|
||||
@ -30,10 +31,20 @@ from flask_wtf.csrf import CSRFProtect
|
||||
from app.markdown import init_markdown, MARKDOWN_EXTENSIONS, MARKDOWN_EXTENSION_CONFIG
|
||||
|
||||
app = Flask(__name__, static_folder="public/static")
|
||||
|
||||
|
||||
def my_flatpage_renderer(text):
|
||||
# Render with jinja first
|
||||
prerendered_body = render_template_string(text)
|
||||
return pygmented_markdown(prerendered_body)
|
||||
|
||||
|
||||
app.config["FLATPAGES_ROOT"] = "flatpages"
|
||||
app.config["FLATPAGES_EXTENSION"] = ".md"
|
||||
app.config["FLATPAGES_MARKDOWN_EXTENSIONS"] = MARKDOWN_EXTENSIONS
|
||||
app.config["FLATPAGES_EXTENSION_CONFIG"] = MARKDOWN_EXTENSION_CONFIG
|
||||
app.config["FLATPAGES_HTML_RENDERER"] = my_flatpage_renderer
|
||||
|
||||
app.config["BABEL_TRANSLATION_DIRECTORIES"] = "../translations"
|
||||
app.config["LANGUAGES"] = {
|
||||
"en": "English",
|
||||
@ -55,6 +66,9 @@ app.config["LANGUAGES"] = {
|
||||
|
||||
app.config.from_pyfile(os.environ["FLASK_CONFIG"])
|
||||
|
||||
if not app.config["ADMIN_CONTACT_URL"]:
|
||||
raise Exception("Missing config property: ADMIN_CONTACT_URL")
|
||||
|
||||
redis_client = redis.Redis.from_url(app.config["REDIS_URL"])
|
||||
|
||||
github = GitHub(app)
|
||||
|
@ -12,8 +12,10 @@ ContentDB is open source software, licensed under AGPLv3.0.
|
||||
|
||||
<a href="https://github.com/minetest/contentdb/" class="btn btn-primary me-1">Source code</a>
|
||||
<a href="https://github.com/minetest/contentdb/issues/" class="btn btn-secondary me-1">Issue tracker</a>
|
||||
<a href="https://rubenwardy.com/contact/" class="btn btn-secondary me-1">Contact admin</a>
|
||||
<a href="https://monitor.rubenwardy.com/d/3ELzFy3Wz/contentdb" class="btn btn-secondary">Stats / monitoring</a>
|
||||
<a href="{{ admin_contact_url }}" class="btn btn-secondary me-1">Contact admin</a>
|
||||
{% if monitoring_url -%}
|
||||
<a href="{{ monitoring_url }}" class="btn btn-secondary">Stats / monitoring</a>
|
||||
{%- endif %}
|
||||
|
||||
## Why was ContentDB created?
|
||||
|
||||
|
@ -11,4 +11,4 @@ We take copyright violation and other offenses very seriously.
|
||||
|
||||
## Other
|
||||
|
||||
<a href="https://rubenwardy.com/contact/" class="btn btn-primary">Contact the admin</a>
|
||||
<a href="{{ admin_contact_url }}" class="btn btn-primary">Contact the admin</a>
|
||||
|
@ -135,7 +135,8 @@ ContentDB editors will check packages to make sure the package page's license ma
|
||||
inside the package download, but do not investigate each piece of media or line of code.
|
||||
|
||||
If a copyright violation is reported to us, we will unlist the package and contact the author/maintainers.
|
||||
Once the problem has been fixed, the package can be restored.
|
||||
Once the problem has been fixed, the package can be restored. Repeated copyright infringement may lead to
|
||||
permanent bans.
|
||||
|
||||
|
||||
## Where can I get help?
|
||||
|
@ -54,5 +54,4 @@ A simplified process for reviewing a package is as follows:
|
||||
usually incorrect.
|
||||
4. check source, etc links to make sure they work and are correct.
|
||||
5. verify that the package has license file that matches what is on the contentdb fields
|
||||
6. verify that all assets and code are licensed correctly
|
||||
7. if the above steps pass, approve the package, else request changes needed from the author
|
||||
6. if the above steps pass, approve the package, else request changes needed from the author
|
||||
|
@ -34,7 +34,7 @@ then you can just set a new email in
|
||||
[Settings > Email and Notifications](/user/settings/email/).
|
||||
|
||||
If you have previously unsubscribed this email, then ContentDB is completely prevented from sending emails to that
|
||||
address. You'll need to use a different email address, or [contact rubenwardy](https://rubenwardy.com/contact/) to
|
||||
address. You'll need to use a different email address, or [contact the admin]({{ admin_contact_url }}) to
|
||||
remove your email from the blacklist.
|
||||
|
||||
|
||||
|
@ -9,11 +9,13 @@ and modern alerting approach".
|
||||
Prometheus Metrics can be accessed at [/metrics](/metrics), or you can view them
|
||||
on the Grafana instance below.
|
||||
|
||||
{% if monitoring_url %}
|
||||
<p>
|
||||
<a class="btn btn-primary" href="https://monitor.rubenwardy.com/d/3ELzFy3Wz/contentdb">
|
||||
<a class="btn btn-primary" href="{{ monitoring_url }}">
|
||||
View ContentDB on Grafana
|
||||
</a>
|
||||
</p>
|
||||
{% endif %}
|
||||
|
||||
## Metrics
|
||||
|
||||
|
@ -34,7 +34,9 @@ def inject_misc():
|
||||
hide_nonfree = False
|
||||
if has_request_context():
|
||||
hide_nonfree = request.cookies.get("hide_nonfree") == "1"
|
||||
return dict(debug=app.debug, hide_nonfree=hide_nonfree, locale=get_locale())
|
||||
return dict(debug=app.debug, hide_nonfree=hide_nonfree, locale=get_locale(),
|
||||
admin_contact_url=app.config["ADMIN_CONTACT_URL"],
|
||||
monitoring_url=app.config.get("MONITORING_URL"))
|
||||
|
||||
|
||||
@app.context_processor
|
||||
|
@ -6,7 +6,7 @@
|
||||
</p>
|
||||
<p>
|
||||
{{ _("You can use GitHub to log in if it is associated with your account.") }}
|
||||
{{ _("Otherwise, you may need to contact rubenwardy for help.") }}
|
||||
{{ _("Otherwise, you may need to contact the admin for help.") }}
|
||||
</p>
|
||||
<p>
|
||||
{{ _("If you weren't expecting to receive this email, then you can safely ignore it.") }}
|
||||
|
@ -13,11 +13,11 @@
|
||||
|
||||
<p>
|
||||
{{ _("Due to spam, we no longer accept reports from anonymous users on this form.") }}
|
||||
{{ _("Please sign in or contact the admin in another way") }}
|
||||
{{ _("Please sign in or contact the admin using the link below.") }}
|
||||
</p>
|
||||
<p>
|
||||
<a href="{{ url_for('users.login') }}" class="btn btn-primary me-2">Login</a>
|
||||
<a href="https://rubenwardy.com/contact/" class="btn btn-secondary">Contact the admin</a>
|
||||
<a href="{{ admin_contact_url }}" class="btn btn-secondary">Contact the admin</a>
|
||||
</p>
|
||||
|
||||
{% else %}
|
||||
|
@ -35,3 +35,6 @@ TEMPLATES_AUTO_RELOAD = False
|
||||
LOG_SQL = False
|
||||
|
||||
BLOCKED_DOMAINS = []
|
||||
|
||||
ADMIN_CONTACT_URL = ""
|
||||
MONITORING_URL = None
|
||||
|
@ -29,3 +29,5 @@ TEMPLATES_AUTO_RELOAD = True
|
||||
LANGUAGES = {
|
||||
'en': 'English',
|
||||
}
|
||||
|
||||
ADMIN_CONTACT_URL = "https://example.org"
|
||||
|
Loading…
Reference in New Issue
Block a user