Read config, handle lastEventId in topicmanager
This commit is contained in:
@ -66,7 +66,7 @@ class ApiHandler
|
||||
$resolve($this->apiGetSubscriptions($topic, $subscription));
|
||||
return;
|
||||
|
||||
case preg_match('<^/.well-known/mercureact/status$>', $path):
|
||||
case preg_match('<^/.well-known/mercure/status$>', $path):
|
||||
$resolve([
|
||||
'server' => 'Mercureact/1.0',
|
||||
'topics' => $this->topicManager->getTopicCount(),
|
||||
@ -75,10 +75,6 @@ class ApiHandler
|
||||
'memoryUsage' => memory_get_usage(true)
|
||||
]);
|
||||
return;
|
||||
|
||||
case preg_match('<^/.well-known/mercureact/status$>', $path):
|
||||
$resolve([ 'version' => '1.0' ]);
|
||||
return;
|
||||
}
|
||||
|
||||
$resolve($next($request));
|
||||
@ -96,7 +92,7 @@ class ApiHandler
|
||||
// TODO implement once we can enumerate topics and subscriptions
|
||||
|
||||
$subscriptions = $this->topicManager->getSubscriptions();
|
||||
$lastEventId = "urn:uuid:5e94c686-2c0b-4f9b-958c-92ccc3bbb4eb";
|
||||
$lastEventId = $this->topicManager->getLastEventId();
|
||||
$data = [
|
||||
"@context" => "https://mercure.rocks/",
|
||||
"id" => "/.well-known/mercure/subscriptions",
|
||||
|
@ -17,6 +17,7 @@ use React\Http\Message\Response;
|
||||
use React\Promise\Promise;
|
||||
use React\Promise\PromiseInterface;
|
||||
use React\Stream\ThroughStream;
|
||||
use Rize\UriTemplate\UriTemplate;
|
||||
use Symfony\Component\Uid\Uuid;
|
||||
|
||||
class MercureHandler
|
||||
@ -194,11 +195,15 @@ class MercureHandler
|
||||
$matched = 0;
|
||||
foreach ((array)$topic as $match) {
|
||||
foreach ($claims as $claim) {
|
||||
// TODO implement matching of URI Templates
|
||||
if (($claim === "*") || ($claim === $match)) {
|
||||
$matched++;
|
||||
break;
|
||||
}
|
||||
// TODO make sure that UriTemplate parsing works
|
||||
if ((new UriTemplate())->extract($claim, $match, true)) {
|
||||
$matched++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return ($matched == count($topic));
|
||||
|
Reference in New Issue
Block a user