use stable UID for iCal events to prevent duplicates (#966)

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 <noreply@anthropic.com>
This commit is contained in:
Pedro Pombeiro
2025-12-20 16:04:41 +01:00
committed by GitHub
parent b6b0abed0d
commit 671763e78b
2 changed files with 2 additions and 2 deletions

View File

@@ -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');

View File

@@ -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']}";