diff --git a/README.md b/README.md index 22a106b..64244a0 100644 --- a/README.md +++ b/README.md @@ -20,10 +20,12 @@ ReCast is a multi platform streaming tool written in PHP and uses nginx RTMP. Yo ## Screenshots -![Dashboard](https://i.imgur.com/CJFRqFM.png) +![Dashboard](https://i.imgur.com/6gcqWTh.png) -![List Streams](https://i.imgur.com/xRi6eQT.png) +![List Streams](https://i.imgur.com/E5FVy9K.png) -![Add Endpoint](https://i.imgur.com/OvLihhw.png) +![Edit Stream](https://i.imgur.com/PHYjnQn.png) -![Setup](https://i.imgur.com/gPDnIfr.png) \ No newline at end of file +![Add Endpoint](https://i.imgur.com/bYteEQR.png) + +![Setup](https://i.imgur.com/ZfP7Tpv.png) \ No newline at end of file diff --git a/public/theme/src/components/ReCast/Streams/EditStream.vue b/public/theme/src/components/ReCast/Streams/EditStream.vue index 4be2d63..0d7c43c 100644 --- a/public/theme/src/components/ReCast/Streams/EditStream.vue +++ b/public/theme/src/components/ReCast/Streams/EditStream.vue @@ -39,6 +39,7 @@ {{ endpoint.server }} Edit + {{ endpoint.active ? 'Disable' : 'Enable' }} Delete @@ -101,6 +102,13 @@ deleteEndpoint: function (endpoint) { this.endpoints.splice(this.endpoints.indexOf(endpoint), 1); this.axios.post('/streams/deleteEndpoint', {id: endpoint.id}); + }, + toggleEndpoint: function (endpoint) { + this.axios.post('/streams/toggleEndpoint', {id: endpoint.id}).then(response => { + this.axios.get('/streams/' + this.$route.params.id + '/endpoints/').then(response => { + this.endpoints = response.data; + }); + }); } } } diff --git a/src/Controller/Streams.php b/src/Controller/Streams.php index 89b5142..c2483e5 100644 --- a/src/Controller/Streams.php +++ b/src/Controller/Streams.php @@ -241,6 +241,33 @@ class Streams extends Controller return new JsonResponse($endpoint); } + /** + * @Route(path="/toggleEndpoint") + * @param Request $request + * @return JsonResponse + * @throws \Doctrine\ORM\ORMException + * @throws \Doctrine\ORM\OptimisticLockException + * @author Soner Sayakci + */ + public function toggleEndpoint(Request $request) : JsonResponse + { + $id = $request->request->get('id'); + $endpoint = $this->endpointRepository->find($id); + + if ($endpoint === null || $endpoint->getStream()->getUserId() !== $this->getUser()->getId()) { + return new JsonResponse([]); + } + + $endpoint->setActive(!$endpoint->isActive()); + + $manager = $this->get('doctrine.orm.entity_manager'); + + $manager->persist($endpoint); + $manager->flush(); + + return new JsonResponse($endpoint); + } + /** * @Route(path="/deleteEndpoint") * @author Soner Sayakci