'title required']); exit; } $key = md5($title); $acks[$key] = [ 'title' => $title, 'ts' => date('c'), 'expires_h' => $expires_h, 'note' => $note, 'owner' => $owner ]; @file_put_contents($ACK_FILE, json_encode($acks, JSON_PRETTY_PRINT)); echo json_encode(['ok' => true, 'key' => $key, 'acked' => true, 'expires_h' => $expires_h]); exit; } if ($action === 'unack' && $method === 'POST') { $title = $_POST['title'] ?? ''; $key = md5($title); unset($acks[$key]); @file_put_contents($ACK_FILE, json_encode($acks, JSON_PRETTY_PRINT)); echo json_encode(['ok' => true, 'unacked' => true]); exit; } if ($action === 'clear' && $method === 'POST') { @unlink($ACK_FILE); echo json_encode(['ok' => true, 'cleared' => true]); exit; } // Default: list echo json_encode(['acks' => $acks, 'count' => count($acks), 'ts' => date('c')]);