From 671763e78b018c1312aef9fef7fdb482ec2639cf Mon Sep 17 00:00:00 2001 From: Pedro Pombeiro Date: Sat, 20 Dec 2025 16:04:41 +0100 Subject: [PATCH] use stable UID for iCal events to prevent duplicates (#966) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Changed UID generation from uniqid() to a stable format based on subscription ID (wallos-subscription-{id}@wallos). This ensures that calendar applications update existing events instead of creating duplicates when the feed is refreshed. According to RFC 5545 section 3.8.4.7, the UID property must be globally unique and persistent for the lifetime of the event. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Sonnet 4.5 --- api/subscriptions/get_ical_feed.php | 2 +- endpoints/subscription/exportcalendar.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/api/subscriptions/get_ical_feed.php b/api/subscriptions/get_ical_feed.php index b454e4a..5e4c88f 100644 --- a/api/subscriptions/get_ical_feed.php +++ b/api/subscriptions/get_ical_feed.php @@ -172,7 +172,7 @@ if ($_SERVER["REQUEST_METHOD"] === "POST" || $_SERVER["REQUEST_METHOD"] === "GET $subscription['trigger'] = ($subscription['notify_days_before'] == -1) ? $globalNotificationDays : ($subscription['notify_days_before'] ?: 1); $subscription['price'] = number_format($subscription['price'], 2); - $uid = uniqid(); + $uid = 'wallos-subscription-' . $subscription['id'] . '@wallos'; $summary = html_entity_decode($subscription['name'], ENT_QUOTES, 'UTF-8'); $description = "Price: {$subscription['currency']}{$subscription['price']}\\nCategory: {$subscription['category']}\\nPayment Method: {$subscription['payment_method']}\\nPayer: {$subscription['payer_user']}\\nNotes: {$subscription['notes']}"; $dtstamp = gmdate('Ymd\THis\Z'); diff --git a/endpoints/subscription/exportcalendar.php b/endpoints/subscription/exportcalendar.php index bc7df00..b680dca 100644 --- a/endpoints/subscription/exportcalendar.php +++ b/endpoints/subscription/exportcalendar.php @@ -31,7 +31,7 @@ if ($subscription) { $subscription['price'] = number_format($subscription['price'], 2); // Create ICS from subscription information - $uid = uniqid(); + $uid = 'wallos-subscription-' . $subscription['id'] . '@wallos'; $summary = html_entity_decode($subscription['name'], ENT_QUOTES, 'UTF-8'); $description = "Price: {$subscription['currency']}{$subscription['price']}\nCategory: {$subscription['category']}\nPayment Method: {$subscription['payment_method']}\nPayer: {$subscription['payer_user']}\n\nNotes: {$subscription['notes']}";