diff --git a/_calendar/generate.py b/_calendar/generate.py index f0390a6..bae2814 100644 --- a/_calendar/generate.py +++ b/_calendar/generate.py @@ -2,6 +2,7 @@ from ics import Calendar, Event import requests import os +import hashlib @dataclass @@ -49,7 +50,9 @@ def main(): c = Calendar() for event in events: - e = Event() + e = Event(uid="asdasd") + e.uid = None # Explicitly remove the auto-generated uid again. Otherwise we can not distinguish between events + # that have a default uid or one that is based on the ctftime id. if event.ctftime_id: ctftime = ctftime_event(event.ctftime_id) @@ -64,9 +67,12 @@ def main(): e.end = event.end or e.end e.location = event.location or e.location e.description = event.comment - e.uid = e.uid or f"{hash(e.name)}@kitctf.de" + e.uid = e.uid or f"{hashlib.sha256(e.name.encode()).hexdigest()}@kitctf.de" c.events.add(e) + uids : list[str] = [e.uid for e in c.events] + assert len(uids) == len(set(uids)), "Duplicate UIDs detected" # For future me. + assert all(e.uid is not None for e in c.events), "All UIDs should be set" # For future me. with open(os.path.dirname(os.path.realpath(__file__)) + '/../hack_harder.ics', 'w') as f: f.writelines(c.serialize_iter()) diff --git a/hack_harder.ics b/hack_harder.ics index 35aada8..9e51b1e 100644 --- a/hack_harder.ics +++ b/hack_harder.ics @@ -37,9 +37,9 @@ SUMMARY:ENOWARS 7 UID:2040@ctftime.org END:VEVENT BEGIN:VEVENT -DTEND:20240505T130000Z +DTEND:20240512T130000Z LOCATION:https://hacking-meisterschaft.de/ -DTSTART:20240504T130000Z +DTSTART:20240511T130000Z SUMMARY:CyberSecurityRumble Quals UID:2224@ctftime.org END:VEVENT @@ -82,7 +82,13 @@ BEGIN:VEVENT DTEND:20230930T110000Z DTSTART:20230928T110000Z SUMMARY:CyberSecurityRumble Finals 2023 -UID:73c76f2d-88d3-4e9b-be28-275addd4bc6d@73c7.org +UID:254bc97986c9c1e17ed6c58b19067d3f291678c6cfdcbce18202b8e5e9a597ce@kitctf.de +END:VEVENT +BEGIN:VEVENT +DTEND:20230813T000000Z +DTSTART:20230810T000000Z +SUMMARY:DEF CON Finals +UID:19b82d2513f9ee43c5f8a6694c2f06524078a6ebeb8ce376e4445ac17b5a9c2f@kitctf.de END:VEVENT BEGIN:VEVENT DTEND:20230817T220000Z @@ -106,12 +112,6 @@ SUMMARY:FAUST CTF 2023 UID:2011@ctftime.org END:VEVENT BEGIN:VEVENT -DTEND:20230813T000000Z -DTSTART:20230810T000000Z -SUMMARY:DEF CON Finals -UID:8880306c-6546-4d7b-abbf-2dbb7c201e77@8880.org -END:VEVENT -BEGIN:VEVENT DTEND:20231029T120000Z LOCATION:https://platypwn.ctf.platypwnies.de/ DTSTART:20231028T120000Z