Merge branch 'use-SITE_URL-in-templates' into 'master'

[ADDED] `SITE_URL` usage in templates

See merge request allianceauth/allianceauth!1456
This commit is contained in:
Ariel Rin 2022-09-11 13:51:21 +00:00
commit b232d9ab17
6 changed files with 55 additions and 47 deletions

View File

@ -8,7 +8,7 @@
<meta name="description" content=""> <meta name="description" content="">
<meta name="author" content=""> <meta name="author" content="">
<meta property="og:title" content="{{ SITE_NAME }}"> <meta property="og:title" content="{{ SITE_NAME }}">
<meta property="og:image" content="{{ request.scheme }}://{{ request.get_host }}{% static 'allianceauth/icons/apple-touch-icon.png' %}"> <meta property="og:image" content="{{ SITE_URL }}{% static 'allianceauth/icons/apple-touch-icon.png' %}">
<meta property="og:description" content="Alliance Auth - An auth system for EVE Online to help in-game organizations manage online service access."> <meta property="og:description" content="Alliance Auth - An auth system for EVE Online to help in-game organizations manage online service access.">
{% include 'allianceauth/icons.html' %} {% include 'allianceauth/icons.html' %}

View File

@ -5,5 +5,6 @@ from .views import NightModeRedirectView
def auth_settings(request): def auth_settings(request):
return { return {
'SITE_NAME': settings.SITE_NAME, 'SITE_NAME': settings.SITE_NAME,
'SITE_URL': settings.SITE_URL,
'NIGHT_MODE': NightModeRedirectView.night_mode_state(request), 'NIGHT_MODE': NightModeRedirectView.night_mode_state(request),
} }

View File

@ -60,7 +60,7 @@
<i class="glyphicon glyphicon-list-alt"></i> <i class="glyphicon glyphicon-list-alt"></i>
</a> </a>
<a id="clipboard-copy" data-clipboard-text="{{ request.scheme }}://{{request.get_host}}{% url 'groupmanagement:request_add' group.id %}" class="btn btn-warning" title="{% translate "Copy Direct Join Link" %}"> <a id="clipboard-copy" data-clipboard-text="{{ SITE_URL }}{% url 'groupmanagement:request_add' group.id %}" class="btn btn-warning" title="{% translate "Copy Direct Join Link" %}">
<i class="glyphicon glyphicon-copy"></i> <i class="glyphicon glyphicon-copy"></i>
</a> </a>
</td> </td>

View File

@ -25,7 +25,8 @@
{% else %} {% else %}
<div class="alert alert-info" role="alert">{% blocktranslate %}Give this link to the line members{% endblocktranslate %}.</div> <div class="alert alert-info" role="alert">{% blocktranslate %}Give this link to the line members{% endblocktranslate %}.</div>
<div class="alert alert-info" role="alert"> <div class="alert alert-info" role="alert">
{{ request.scheme }}://{{ request.get_host }}{% url 'srp:request' completed_srp_code %}</div> {{ SITE_URL }}{% url 'srp:request' completed_srp_code %}
</div>
<div class="text-center"> <div class="text-center">
<a href="{% url 'srp:management' %}" class="btn btn-primary btn-lg">{% translate "Continue" %}</a> <a href="{% url 'srp:management' %}" class="btn btn-primary btn-lg">{% translate "Continue" %}</a>
</div> </div>

View File

@ -10,40 +10,43 @@ from allianceauth.project_template.project_name.settings.base import *
CELERY_ALWAYS_EAGER = True # Forces celery to run locally for testing CELERY_ALWAYS_EAGER = True # Forces celery to run locally for testing
INSTALLED_APPS += [ INSTALLED_APPS += [
'allianceauth.eveonline.autogroups', "allianceauth.eveonline.autogroups",
'allianceauth.hrapplications', "allianceauth.hrapplications",
'allianceauth.timerboard', "allianceauth.timerboard",
'allianceauth.srp', "allianceauth.srp",
'allianceauth.optimer', "allianceauth.optimer",
'allianceauth.corputils', "allianceauth.corputils",
'allianceauth.fleetactivitytracking', "allianceauth.fleetactivitytracking",
'allianceauth.permissions_tool', "allianceauth.permissions_tool",
'allianceauth.services.modules.mumble', "allianceauth.services.modules.mumble",
'allianceauth.services.modules.discord', "allianceauth.services.modules.discord",
'allianceauth.services.modules.discourse', "allianceauth.services.modules.discourse",
'allianceauth.services.modules.ips4', "allianceauth.services.modules.ips4",
'allianceauth.services.modules.openfire', "allianceauth.services.modules.openfire",
'allianceauth.services.modules.smf', "allianceauth.services.modules.smf",
'allianceauth.services.modules.phpbb3', "allianceauth.services.modules.phpbb3",
'allianceauth.services.modules.xenforo', "allianceauth.services.modules.xenforo",
'allianceauth.services.modules.teamspeak3', "allianceauth.services.modules.teamspeak3",
] ]
ROOT_URLCONF = 'tests.urls' ROOT_URLCONF = "tests.urls"
SITE_URL = "https://example.com"
CSRF_TRUSTED_ORIGINS = [SITE_URL]
CACHES = { CACHES = {
"default": { "default": {
"BACKEND": "django_redis.cache.RedisCache", "BACKEND": "django_redis.cache.RedisCache",
"LOCATION": "redis://127.0.0.1:6379/1" "LOCATION": "redis://127.0.0.1:6379/1",
} }
} }
######################## ########################
# XenForo Configuration # XenForo Configuration
######################## ########################
XENFORO_ENDPOINT = 'example.com/api.php' XENFORO_ENDPOINT = "example.com/api.php"
XENFORO_DEFAULT_GROUP = 0 XENFORO_DEFAULT_GROUP = 0
XENFORO_APIKEY = 'yourapikey' XENFORO_APIKEY = "yourapikey"
##################### #####################
###################### ######################
@ -79,7 +82,7 @@ MUMBLE_SERVER_ID = 1
###################################### ######################################
# PHPBB3 Configuration # PHPBB3 Configuration
###################################### ######################################
PHPBB3_URL = '' PHPBB3_URL = ""
###################################### ######################################
# Teamspeak3 Configuration # Teamspeak3 Configuration
@ -92,12 +95,12 @@ PHPBB3_URL = ''
# TEAMSPEAK3_AUTHED_GROUP_ID - Default authed group id # TEAMSPEAK3_AUTHED_GROUP_ID - Default authed group id
# TEAMSPEAK3_PUBLIC_URL - teamspeak3 public url used for link creation # TEAMSPEAK3_PUBLIC_URL - teamspeak3 public url used for link creation
###################################### ######################################
TEAMSPEAK3_SERVER_IP = '127.0.0.1' TEAMSPEAK3_SERVER_IP = "127.0.0.1"
TEAMSPEAK3_SERVER_PORT = 10011 TEAMSPEAK3_SERVER_PORT = 10011
TEAMSPEAK3_SERVERQUERY_USER = 'serveradmin' TEAMSPEAK3_SERVERQUERY_USER = "serveradmin"
TEAMSPEAK3_SERVERQUERY_PASSWORD = 'passwordhere' TEAMSPEAK3_SERVERQUERY_PASSWORD = "passwordhere"
TEAMSPEAK3_VIRTUAL_SERVER = 1 TEAMSPEAK3_VIRTUAL_SERVER = 1
TEAMSPEAK3_PUBLIC_URL = 'example.com' TEAMSPEAK3_PUBLIC_URL = "example.com"
###################################### ######################################
# Discord Configuration # Discord Configuration
@ -110,13 +113,13 @@ TEAMSPEAK3_PUBLIC_URL = 'example.com'
# DISCORD_CALLBACK_URL - oauth callback url # DISCORD_CALLBACK_URL - oauth callback url
# DISCORD_SYNC_NAMES - enable to force discord nicknames to be set to eve char name (bot needs Manage Nicknames permission) # DISCORD_SYNC_NAMES - enable to force discord nicknames to be set to eve char name (bot needs Manage Nicknames permission)
###################################### ######################################
DISCORD_GUILD_ID = '0118999' DISCORD_GUILD_ID = "0118999"
DISCORD_BOT_TOKEN = 'bottoken' DISCORD_BOT_TOKEN = "bottoken"
DISCORD_INVITE_CODE = 'invitecode' DISCORD_INVITE_CODE = "invitecode"
DISCORD_APP_ID = 'appid' DISCORD_APP_ID = "appid"
DISCORD_APP_SECRET = 'secret' DISCORD_APP_SECRET = "secret"
DISCORD_CALLBACK_URL = 'http://example.com/discord/callback' DISCORD_CALLBACK_URL = "http://example.com/discord/callback"
DISCORD_SYNC_NAMES = 'True' == 'False' DISCORD_SYNC_NAMES = "True" == "False"
###################################### ######################################
# Discourse Configuration # Discourse Configuration
@ -126,10 +129,10 @@ DISCORD_SYNC_NAMES = 'True' == 'False'
# DISCOURSE_API_KEY - API Key # DISCOURSE_API_KEY - API Key
# DISCOURSE_SSO_SECRET - SSO secret key # DISCOURSE_SSO_SECRET - SSO secret key
###################################### ######################################
DISCOURSE_URL = 'https://example.com' DISCOURSE_URL = "https://example.com"
DISCOURSE_API_USERNAME = '' DISCOURSE_API_USERNAME = ""
DISCOURSE_API_KEY = '' DISCOURSE_API_KEY = ""
DISCOURSE_SSO_SECRET = 'd836444a9e4084d5b224a60c208dce14' DISCOURSE_SSO_SECRET = "d836444a9e4084d5b224a60c208dce14"
# Example secret from https://meta.discourse.org/t/official-single-sign-on-for-discourse/13045 # Example secret from https://meta.discourse.org/t/official-single-sign-on-for-discourse/13045
##################################### #####################################
@ -138,16 +141,16 @@ DISCOURSE_SSO_SECRET = 'd836444a9e4084d5b224a60c208dce14'
# IPS4_URL - base url of the IPS4 install (no trailing slash) # IPS4_URL - base url of the IPS4 install (no trailing slash)
# IPS4_API_KEY - API key provided by IPS4 # IPS4_API_KEY - API key provided by IPS4
##################################### #####################################
IPS4_URL = 'http://example.com/ips4' IPS4_URL = "http://example.com/ips4"
IPS4_API_KEY = '' IPS4_API_KEY = ""
###################################### ######################################
# SMF Configuration # SMF Configuration
###################################### ######################################
SMF_URL = '' SMF_URL = ""
PASSWORD_HASHERS = [ PASSWORD_HASHERS = [
'django.contrib.auth.hashers.MD5PasswordHasher', "django.contrib.auth.hashers.MD5PasswordHasher",
] ]
LOGGING = None # Comment out to enable logging for debugging LOGGING = None # Comment out to enable logging for debugging

View File

@ -10,17 +10,20 @@ from allianceauth.project_template.project_name.settings.base import *
CELERY_ALWAYS_EAGER = True # Forces celery to run locally for testing CELERY_ALWAYS_EAGER = True # Forces celery to run locally for testing
ROOT_URLCONF = 'tests.urls' ROOT_URLCONF = "tests.urls"
SITE_URL = "https://example.com"
CSRF_TRUSTED_ORIGINS = [SITE_URL]
CACHES = { CACHES = {
"default": { "default": {
"BACKEND": "django_redis.cache.RedisCache", "BACKEND": "django_redis.cache.RedisCache",
"LOCATION": "redis://127.0.0.1:6379/1" "LOCATION": "redis://127.0.0.1:6379/1",
} }
} }
PASSWORD_HASHERS = [ PASSWORD_HASHERS = [
'django.contrib.auth.hashers.MD5PasswordHasher', "django.contrib.auth.hashers.MD5PasswordHasher",
] ]
LOGGING = None # Comment out to enable logging for debugging LOGGING = None # Comment out to enable logging for debugging