From 554a5059c3b60d949075577611da7bceadbb4e49 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Mon, 12 Apr 2021 15:36:41 -0700 Subject: web: add goatcounter analytics Same setup as scholar.archive.org --- python/fatcat_web/web_config.py | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'python/fatcat_web/web_config.py') diff --git a/python/fatcat_web/web_config.py b/python/fatcat_web/web_config.py index 5d2da830..25c93114 100644 --- a/python/fatcat_web/web_config.py +++ b/python/fatcat_web/web_config.py @@ -52,6 +52,11 @@ class Config(object): IA_XAUTH_CLIENT_ID = os.environ.get("IA_XAUTH_CLIENT_ID", default=None) IA_XAUTH_CLIENT_SECRET = os.environ.get("IA_XAUTH_CLIENT_SECRET", default=None) + # analytics; used in production + ENABLE_GOATCOUNTER = bool(os.environ.get("ENABLE_GOATCOUNTER", default=False)) + GOATCOUNTER_ENDPOINT = os.environ.get("GOATCOUNTER_ENDPOINT", default="https://goatcounter.fatcat.wiki/count") + GOATCOUNTER_SCRIPT_URL = os.environ.get("GOATCOUNTER_SCRIPT_URL", default="https://goatcounter.fatcat.wiki/count.js") + # controls granularity of "shadow_only" preservation category FATCAT_MERGE_SHADOW_PRESERVATION = os.environ.get("FATCAT_MERGE_SHADOW_PRESERVATION", default=False) -- cgit v1.2.3 From b28547df2025afb7b5d8941e5553865ff5dc29a6 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Mon, 12 Apr 2021 16:11:42 -0700 Subject: web: consistent public API URLs --- python/fatcat_web/templates/changelog.html | 6 +----- python/fatcat_web/templates/editgroup_view.html | 2 +- python/fatcat_web/templates/entity_history.html | 2 +- python/fatcat_web/templates/entity_macros.html | 7 +------ python/fatcat_web/templates/entity_view_metadata.html | 2 +- python/fatcat_web/web_config.py | 4 ++++ 6 files changed, 9 insertions(+), 14 deletions(-) (limited to 'python/fatcat_web/web_config.py') diff --git a/python/fatcat_web/templates/changelog.html b/python/fatcat_web/templates/changelog.html index 3ad01d63..59630666 100644 --- a/python/fatcat_web/templates/changelog.html +++ b/python/fatcat_web/templates/changelog.html @@ -37,11 +37,7 @@ inspect every change all the way back to the start.
- {% if config.FATCAT_DOMAIN == "fatcat.wiki" %} - As JSON via API - {% else %} - As JSON via API - {% endif %} + As JSON via API
{% endblock %} diff --git a/python/fatcat_web/templates/editgroup_view.html b/python/fatcat_web/templates/editgroup_view.html index 6a9793f7..e1af719d 100644 --- a/python/fatcat_web/templates/editgroup_view.html +++ b/python/fatcat_web/templates/editgroup_view.html @@ -181,7 +181,7 @@ {{ edit_list(auth_to, editgroup, editgroup.edits.webcaptures, "webcapture", "Web Capture") }}
- As JSON via API + As JSON via API

diff --git a/python/fatcat_web/templates/entity_history.html b/python/fatcat_web/templates/entity_history.html index 0115b845..05fae0c3 100644 --- a/python/fatcat_web/templates/entity_history.html +++ b/python/fatcat_web/templates/entity_history.html @@ -35,7 +35,7 @@ This table only shows accepted edits included in the catalog, not any wor {% endfor %}
- As JSON via API + As JSON via API
diff --git a/python/fatcat_web/templates/entity_macros.html b/python/fatcat_web/templates/entity_macros.html index 9207bd48..4b0635e5 100644 --- a/python/fatcat_web/templates/entity_macros.html +++ b/python/fatcat_web/templates/entity_macros.html @@ -36,12 +36,7 @@
Revision: {{ entity.revision }} {% endif %}
API URL: - As JSON via API + As JSON via API {% if entity.extra %} diff --git a/python/fatcat_web/web_config.py b/python/fatcat_web/web_config.py index 25c93114..3dba933d 100644 --- a/python/fatcat_web/web_config.py +++ b/python/fatcat_web/web_config.py @@ -22,6 +22,10 @@ class Config(object): FATCAT_DOMAIN = os.environ.get("FATCAT_DOMAIN", default="dev.fatcat.wiki") FATCAT_API_AUTH_TOKEN = os.environ.get("FATCAT_API_AUTH_TOKEN", default=None) FATCAT_API_HOST = os.environ.get("FATCAT_API_HOST", default="https://{}/v0".format(FATCAT_DOMAIN)) + public_host_default = f"https://{FATCAT_DOMAIN}/v0" + if FATCAT_DOMAIN == "dev.fatcat.wiki": + public_host_default = FATCAT_API_HOST + FATCAT_PUBLIC_API_HOST = os.environ.get("FATCAT_PUBLIC_API_HOST", default=public_host_default) # can set this to https://search.fatcat.wiki for some experimentation ELASTICSEARCH_BACKEND = os.environ.get("ELASTICSEARCH_BACKEND", default="http://localhost:9200") -- cgit v1.2.3