/telegram/ redirect

This commit is contained in:
j 2023-09-23 17:27:24 +02:00
parent 113dd622b2
commit 29b99d2cd2
3 changed files with 8 additions and 2 deletions

View file

@ -173,5 +173,6 @@ RATELIMIT_CACHE_BACKEND = "app.brake_backend.BrakeBackend"
SITENAME = "Phantas.ma" SITENAME = "Phantas.ma"
URL = "https://phantas.ma" URL = "https://phantas.ma"
TELEGRAM_CHANNEL = "/"
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https') SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')

View file

@ -27,6 +27,7 @@ urlpatterns = [
path('robots.txt', views.robots_txt, name='robots_txt'), path('robots.txt', views.robots_txt, name='robots_txt'),
path('sitemap.xml', views.sitemap_xml, name='sitemap_xml'), path('sitemap.xml', views.sitemap_xml, name='sitemap_xml'),
path('atom.xml', item_views.atom_xml, name='atom_xml'), path('atom.xml', item_views.atom_xml, name='atom_xml'),
path('telegram/', views.telegram, name='telegram'),
path('login/', user_views.login, name='login'), path('login/', user_views.login, name='login'),
path('logout/', user_views.logout, name='logout'), path('logout/', user_views.logout, name='logout'),
path('register/', user_views.register, name='register'), path('register/', user_views.register, name='register'),

View file

@ -1,8 +1,9 @@
import xml.etree.ElementTree as ET import xml.etree.ElementTree as ET
from django.utils.timezone import datetime, timedelta from django.conf import settings
from django.shortcuts import render
from django.http import HttpResponse from django.http import HttpResponse
from django.shortcuts import render, redirect
from django.utils.timezone import datetime, timedelta
def robots_txt(request): def robots_txt(request):
@ -65,3 +66,6 @@ def sitemap_xml(request):
data = b'<?xml version="1.0" encoding="UTF-8"?>\n' + ET.tostring(urlset) data = b'<?xml version="1.0" encoding="UTF-8"?>\n' + ET.tostring(urlset)
return HttpResponse(data, 'application/xml') return HttpResponse(data, 'application/xml')
def telegram(request):
return redirect(settings.TELEGRAM_CHANNEL)