From 56ddab0cd5f1fe55930d77b5ea47e1dbc3d3ede8 Mon Sep 17 00:00:00 2001 From: Christopher Vagnetoft Date: Mon, 11 Mar 2024 01:05:09 +0100 Subject: [PATCH] Added makefile, cleanup --- Makefile | 22 ++++++++++++++++++++++ bin/mercureactd | 1 + make-phar.sh | 12 ------------ src/Http/Server.php | 3 --- 4 files changed, 23 insertions(+), 15 deletions(-) create mode 100755 Makefile delete mode 100755 make-phar.sh diff --git a/Makefile b/Makefile new file mode 100755 index 0000000..5b5a49d --- /dev/null +++ b/Makefile @@ -0,0 +1,22 @@ +.DEFAULT_GOAL := help + +REPODIR="$(shell pwd)" +BUILDDIR="/tmp/mercureact.tmp" + +.PHONY: help +help: + @echo "Available Targets:"; grep -E '(^[a-zA-Z_-]+:.*?##.*$$)|(^##)' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[32m%-20s\033[0m %s\n", $$1, $$2}' | sed -e 's/\[32m##/[33m/' + +.PHONY: phar +phar: ## Build .phar using pharlite + rm -rf $(BUILDDIR) + git clone $(REPODIR) $(BUILDDIR) && \ + cd $(BUILDDIR) && \ + composer install --no-dev && \ + pharlite && \ + mv $(BUILDDIR)/*.phar . && \ + rm -rf $(BUILDDIR) + +.PHONY: phpstan +phpstan: ## Run static analysis + phpstan --no-progress diff --git a/bin/mercureactd b/bin/mercureactd index dfd4a99..e63337f 100755 --- a/bin/mercureactd +++ b/bin/mercureactd @@ -7,6 +7,7 @@ use NoccyLabs\Mercureact\Daemon; require_once __DIR__."/../vendor/autoload.php"; $config = Configuration::createDefault() + ->setAllowAnonymousSubscribe(true) ->setJwtSecret("!ChangeThisMercureHubJWTSecretKey!"); $daemon = new Daemon($config); diff --git a/make-phar.sh b/make-phar.sh deleted file mode 100755 index 916d350..0000000 --- a/make-phar.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash -REPO=$PWD -DIR=mercureact -pushd /tmp -rm -rf /tmp/$DIR -git clone "$REPO" -cd $DIR -composer install --no-dev -pharlite -popd -mv /tmp/$DIR/*.phar . -rm -rf /tmp/$DIR diff --git a/src/Http/Server.php b/src/Http/Server.php index 4ed9c34..db9d61a 100644 --- a/src/Http/Server.php +++ b/src/Http/Server.php @@ -26,8 +26,6 @@ class Server private SplObjectStorage $webSocketClients; - private SplObjectStorage $eventClients; - private TopicManager $topicManager; private ResponseMiddleware $responseMiddleware; @@ -50,7 +48,6 @@ class Server $this->topicManager = new TopicManager(); - $this->eventClients = new SplObjectStorage(); $this->webSocketClients = new SplObjectStorage(); $this->server = $this->createHttpServer();