From 156c243be27d956255011e403423fcd1204330c9 Mon Sep 17 00:00:00 2001 From: Oliver Ni Date: Wed, 4 Oct 2023 23:24:53 -0700 Subject: [PATCH] Fix link --- hknweb/events/views/aggregate_displays/calendar.py | 8 +++++--- hknweb/settings/prod.py | 3 +++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/hknweb/events/views/aggregate_displays/calendar.py b/hknweb/events/views/aggregate_displays/calendar.py index 5f3a82e1..e25ee6e2 100644 --- a/hknweb/events/views/aggregate_displays/calendar.py +++ b/hknweb/events/views/aggregate_displays/calendar.py @@ -4,7 +4,7 @@ from django.http import HttpResponse from django.shortcuts import get_object_or_404, render -from hknweb.events.google_calendar_utils import get_calendar_link +from hknweb.events.google_calendar_utils import SHARE_LINK_TEMPLATE, get_calendar_link from hknweb.events.models import Event, EventType, GCalAccessLevelMapping, ICalView from hknweb.events.models.constants import ACCESS_LEVELS from hknweb.events.utils import get_events @@ -86,16 +86,18 @@ def get_calendars(request, user_access_level: int): if profile.google_calendar_id: calendars.append( { - "name": "personal", + "name": "personal (gcal)", "link": get_calendar_link(calendar_id=profile.google_calendar_id), } ) ical_view, _ = ICalView.objects.get_or_create(user=request.user) + ical_url = request.build_absolute_uri(ical_view.url) + ical_url = ical_url.replace("https://", "webcal://") calendars.append( { "name": "personal (ics)", - "link": get_calendar_link(calendar_id=ical_view.url), + "link": SHARE_LINK_TEMPLATE.format(cid=ical_url), } ) diff --git a/hknweb/settings/prod.py b/hknweb/settings/prod.py index 86b07062..dc41bdcb 100644 --- a/hknweb/settings/prod.py +++ b/hknweb/settings/prod.py @@ -25,3 +25,6 @@ # https://docs.djangoproject.com/en/2.1/howto/static-files/ STATIC_URL = "https://www.ocf.berkeley.edu/~hkn/hknweb/static/" STATIC_ROOT = "/home/h/hk/hkn/public_html/hknweb/static/" + +USE_X_FORWARDED_HOST = True +SECURE_PROXY_SSL_HEADER = ("HTTP_X_FORWARDED_PROTO", "https")