mirror of
https://github.com/quantum5/qlinks.git
synced 2025-04-24 10:41:57 -04:00
Add X-Powered-By header to ease AGPL compliance
This commit is contained in:
parent
3dfc0a3682
commit
6f0c3c09a3
|
@ -92,3 +92,4 @@ QLINKS_CHECK_MIN = timedelta(days=6)
|
||||||
QLINKS_CHECK_MAX = timedelta(days=8)
|
QLINKS_CHECK_MAX = timedelta(days=8)
|
||||||
QLINKS_CHECK_THROTTLE = 1
|
QLINKS_CHECK_THROTTLE = 1
|
||||||
QLINKS_BROKEN_EMAIL = False
|
QLINKS_BROKEN_EMAIL = False
|
||||||
|
QLINKS_POWERED_BY = 'QLinks <https://github.com/quantum5/qlinks>'
|
||||||
|
|
|
@ -77,3 +77,7 @@ QLINKS_CANONICAL = None
|
||||||
|
|
||||||
# Enable emails.
|
# Enable emails.
|
||||||
# QLINKS_BROKEN_EMAIL = True
|
# QLINKS_BROKEN_EMAIL = True
|
||||||
|
|
||||||
|
# Update the X-Powered-By header to point to your fork if you are not running
|
||||||
|
# upstream code. This is required to comply with AGPLv3.
|
||||||
|
# QLINKS_POWERED_BY = 'QLinks <https://github.com/YOU/qlinks>'
|
||||||
|
|
|
@ -1,9 +1,12 @@
|
||||||
|
from django.conf import settings
|
||||||
from django.http import HttpResponseRedirect
|
from django.http import HttpResponseRedirect
|
||||||
from django.shortcuts import get_object_or_404, render
|
from django.shortcuts import get_object_or_404
|
||||||
|
|
||||||
from qlinks.models import Link
|
from qlinks.models import Link
|
||||||
|
|
||||||
|
|
||||||
def short_link(request, slug):
|
def short_link(request, slug):
|
||||||
link = get_object_or_404(Link.objects.values_list('long', flat=True), short=slug)
|
link = get_object_or_404(Link.objects.values_list('long', flat=True), short=slug)
|
||||||
return HttpResponseRedirect(link)
|
return HttpResponseRedirect(link, headers={
|
||||||
|
'X-Powered-By': settings.QLINKS_POWERED_BY
|
||||||
|
})
|
||||||
|
|
Loading…
Reference in a new issue