This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
import uuid | |
from datetime import datetime, timezone | |
def create_event(data): | |
"""Format each event for the iCalendar file with Apple-specific attributes.""" | |
event_template = """BEGIN:VEVENT | |
TRANSP:OPAQUE | |
DTSTART;TZID=Asia/Ho_Chi_Minh:{start_time} | |
DTEND;TZID=Asia/Ho_Chi_Minh:{end_time} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
addEventListener('fetch', event => { | |
event.respondWith(handleRequest(event.request)) | |
}) | |
async function handleRequest(request) { | |
const headers = { | |
'Access-Control-Allow-Origin': '*', | |
'Content-Type': 'application/json' | |
} |