Add custom location url from environment variable
Remove trailing dollar in long and lat placeholder
This commit is contained in:
parent
14a7ec68f3
commit
3a01fefcff
11
TEMPLATE.env
11
TEMPLATE.env
@ -82,4 +82,13 @@ BLOCK_ALL_IPS=False
|
|||||||
# that IP collection is also disabled, and external keys (primary
|
# that IP collection is also disabled, and external keys (primary
|
||||||
# keys) aren't supplied. It will also prevent sessions from spanning
|
# keys) aren't supplied. It will also prevent sessions from spanning
|
||||||
# one day to another.
|
# one day to another.
|
||||||
AGGRESSIVE_HASH_SALTING=True
|
AGGRESSIVE_HASH_SALTING=True
|
||||||
|
|
||||||
|
# Custom location url to link to in frontend.
|
||||||
|
# $LATITUDE will get replaced by the latitude, $LONGITUDE will get
|
||||||
|
# replaced by the longitude.
|
||||||
|
# Examples:
|
||||||
|
# - https://www.openstreetmap.org/?mlat=$LATITUDE&mlon=$LONGITUDE (default)
|
||||||
|
# - https://www.google.com/maps/search/?api=1&query=$LATITUDE,$LONGITUDE
|
||||||
|
# - https://www.mapquest.com/near-$LATITUDE,$LONGITUDE
|
||||||
|
LOCATION_URL=https://www.openstreetmap.org/?mlat=$LATITUDE&mlon=$LONGITUDE
|
5
app.json
5
app.json
@ -122,6 +122,11 @@
|
|||||||
"description": "Set to 'False' if you do not want the version to be displayed on the frontend.",
|
"description": "Set to 'False' if you do not want the version to be displayed on the frontend.",
|
||||||
"value": "True",
|
"value": "True",
|
||||||
"required": false
|
"required": false
|
||||||
|
},
|
||||||
|
"LOCATION_URL": {
|
||||||
|
"description": "Custom location url to link to in frontend.",
|
||||||
|
"value": "https://www.openstreetmap.org/?mlat=$LATITUDE&mlon=$LONGITUDE",
|
||||||
|
"required": false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -51,7 +51,7 @@
|
|||||||
<p>Location</p>
|
<p>Location</p>
|
||||||
<p class="label">
|
<p class="label">
|
||||||
{% if session.latitude %}
|
{% if session.latitude %}
|
||||||
<a href="https://www.google.com/maps/search/?api=1&query={{session.latitude}},{{session.longitude}}">Open
|
<a href="{{session|location_url}}" target="_blank">Open
|
||||||
in Maps ↗</a>
|
in Maps ↗</a>
|
||||||
{% else %}
|
{% else %}
|
||||||
Unknown
|
Unknown
|
||||||
|
@ -225,3 +225,6 @@ def contextual_url(*args, **kwargs):
|
|||||||
urlnode = url_tag(*args, **kwargs)
|
urlnode = url_tag(*args, **kwargs)
|
||||||
return ContextualURLNode(urlnode)
|
return ContextualURLNode(urlnode)
|
||||||
|
|
||||||
|
@register.filter
|
||||||
|
def location_url(session):
|
||||||
|
return settings.LOCATION_URL.replace("$LATITUDE", str(session.latitude)).replace("$LONGITUDE", str(session.longitude))
|
||||||
|
@ -340,3 +340,6 @@ BLOCK_ALL_IPS = os.getenv("BLOCK_ALL_IPS", "False") == "True"
|
|||||||
|
|
||||||
# Include date and service ID in salt?
|
# Include date and service ID in salt?
|
||||||
AGGRESSIVE_HASH_SALTING = os.getenv("AGGRESSIVE_HASH_SALTING", "False") == "True"
|
AGGRESSIVE_HASH_SALTING = os.getenv("AGGRESSIVE_HASH_SALTING", "False") == "True"
|
||||||
|
|
||||||
|
# What location url should be linked to in the frontend?
|
||||||
|
LOCATION_URL = os.getenv("LOCATION_URL", "https://www.openstreetmap.org/?mlat=$LATITUDE&mlon=$LONGITUDE")
|
||||||
|
Loading…
Reference in New Issue
Block a user