From c5729f13c0e222af2bdb15612868f5a87fa94022 Mon Sep 17 00:00:00 2001 From: afornerot Date: Tue, 16 Jul 2019 12:10:32 +0200 Subject: [PATCH] svg --- dicos/90_ninegate.xml | 7 + src/ninegate-1.0/app/AppKernel.php | 8 +- src/ninegate-1.0/app/config/config.yml | 14 + src/ninegate-1.0/app/config/routing.yml | 4 + src/ninegate-1.0/app/config/twig.yml | 1 - src/ninegate-1.0/composer.lock | 755 +++++++++++++++++- .../scripts/ninegate-postservice-01.sh | 34 +- .../CoreBundle/Command/data/core-init-01.sql | 2 +- .../src/Cadoles/CoreBundle/Entity/Group.php | 43 + .../src/Cadoles/CoreBundle/Entity/User.php | 47 +- .../CoreBundle/Resources/views/base.html.twig | 4 + .../views/Pagewidget/viewinfo.html.twig | 2 +- .../CadolesWebsocketBundle.php | 9 + .../Controller/ChatController.php | 49 ++ .../WebsocketBundle/Entity/Message.php | 158 ++++ .../WebsocketBundle/RPC/RPCService.php | 37 + .../Resources/config/routing.yml | 3 + .../Resources/config/services.yml | 11 + .../Resources/config/topic.yml | 15 + .../Resources/views/Chat/client.html.twig | 81 ++ .../WebsocketBundle/Topic/WebsocketTopic.php | 121 +++ tmpl/ninegate-template.yml | 48 +- tmpl/ninegate.nginx.conf | 24 + 23 files changed, 1406 insertions(+), 71 deletions(-) create mode 100644 src/ninegate-1.0/src/Cadoles/WebsocketBundle/CadolesWebsocketBundle.php create mode 100644 src/ninegate-1.0/src/Cadoles/WebsocketBundle/Controller/ChatController.php create mode 100644 src/ninegate-1.0/src/Cadoles/WebsocketBundle/Entity/Message.php create mode 100755 src/ninegate-1.0/src/Cadoles/WebsocketBundle/RPC/RPCService.php create mode 100644 src/ninegate-1.0/src/Cadoles/WebsocketBundle/Resources/config/routing.yml create mode 100644 src/ninegate-1.0/src/Cadoles/WebsocketBundle/Resources/config/services.yml create mode 100644 src/ninegate-1.0/src/Cadoles/WebsocketBundle/Resources/config/topic.yml create mode 100644 src/ninegate-1.0/src/Cadoles/WebsocketBundle/Resources/views/Chat/client.html.twig create mode 100644 src/ninegate-1.0/src/Cadoles/WebsocketBundle/Topic/WebsocketTopic.php create mode 100644 tmpl/ninegate.nginx.conf diff --git a/dicos/90_ninegate.xml b/dicos/90_ninegate.xml index f117ee22..277ae646 100644 --- a/dicos/90_ninegate.xml +++ b/dicos/90_ninegate.xml @@ -12,7 +12,14 @@ + + ninegate + + + 5555 + + diff --git a/src/ninegate-1.0/app/AppKernel.php b/src/ninegate-1.0/app/AppKernel.php index 56314d7d..600c5c6e 100644 --- a/src/ninegate-1.0/app/AppKernel.php +++ b/src/ninegate-1.0/app/AppKernel.php @@ -28,14 +28,18 @@ class AppKernel extends Kernel new LightSaml\SymfonyBridgeBundle\LightSamlSymfonyBridgeBundle(), new LightSaml\SpBundle\LightSamlSpBundle(), new Debril\RssAtomBundle\DebrilRssAtomBundle(), - + new Gos\Bundle\WebSocketBundle\GosWebSocketBundle(), + new Gos\Bundle\PubSubRouterBundle\GosPubSubRouterBundle(), + new AppBundle\AppBundle(), new Cadoles\SAMLBundle\CadolesSAMLBundle(), new Cadoles\CASBundle\CadolesCASBundle(), new Cadoles\CoreBundle\CadolesCoreBundle(), new Cadoles\CronBundle\CadolesCronBundle(), - new Cadoles\PortalBundle\CadolesPortalBundle() + new Cadoles\PortalBundle\CadolesPortalBundle(), + new Cadoles\PortalBundle\CadolesWebsocketBundle(), + ]; if (in_array($this->getEnvironment(), ['dev', 'test'], true)) { diff --git a/src/ninegate-1.0/app/config/config.yml b/src/ninegate-1.0/app/config/config.yml index 3fdd9260..45cddc71 100644 --- a/src/ninegate-1.0/app/config/config.yml +++ b/src/ninegate-1.0/app/config/config.yml @@ -5,6 +5,7 @@ imports: - { resource: services.yml } - { resource: "@CadolesCoreBundle/Resources/config/services.yml" } - { resource: "@CadolesPortalBundle/Resources/config/services.yml" } + - { resource: "@CadolesWebsocketBundle/Resources/config/services.yml" } - { resource: twig.yml } # Put parameters here that don't need to change on each machine where the app is deployed @@ -125,6 +126,19 @@ light_saml_symfony_bridge: idp: files: '%saml_idps_list%' +# websocket configuration +gos_web_socket: + client: + session_handler: session.handler.native_file + firewall: main + shared_config: true + server: + port: %websocket_port% #The port the socket server will listen on + host: %weburl% #The host ip to bind to + router: + resources: + - "@CadolesWebsocketBundle/Resources/config/topic.yml" + # ckeditor configuration ivory_ck_editor: base_path: "ckeditor" diff --git a/src/ninegate-1.0/app/config/routing.yml b/src/ninegate-1.0/app/config/routing.yml index 8493b3d8..0a403f88 100644 --- a/src/ninegate-1.0/app/config/routing.yml +++ b/src/ninegate-1.0/app/config/routing.yml @@ -10,6 +10,10 @@ portal: resource: "@CadolesPortalBundle/Resources/config/routing.yml" prefix: / +websocket: + resource: "@CadolesWebsocketBundle/Resources/config/routing.yml" + prefix: / + lightsaml_sp: resource: "@LightSamlSpBundle/Resources/config/routing.yml" prefix: saml diff --git a/src/ninegate-1.0/app/config/twig.yml b/src/ninegate-1.0/app/config/twig.yml index 4d51cd0a..41f2689f 100644 --- a/src/ninegate-1.0/app/config/twig.yml +++ b/src/ninegate-1.0/app/config/twig.yml @@ -13,7 +13,6 @@ twig: activate_widsonde: %activate_widsonde% widsonde_url: %widsonde_url% - eportail_sync: %eportail_sync% moderegistration: %moderegistration% labelniveau01: %labelniveau01% labelsniveau01: %labelsniveau01% diff --git a/src/ninegate-1.0/composer.lock b/src/ninegate-1.0/composer.lock index ce1a9993..4fb47c91 100644 --- a/src/ninegate-1.0/composer.lock +++ b/src/ninegate-1.0/composer.lock @@ -4,8 +4,8 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "8ad66c1cc79500add7118e829f63f6a9", - "content-hash": "15efa0e4514b73fe595c60779f3eec40", + "hash": "f60fc0c21429506c604cf52a1c57f8b1", + "content-hash": "ad29a4c36418b2be7c6f60297d160623", "packages": [ { "name": "composer/ca-bundle", @@ -1328,6 +1328,54 @@ ], "time": "2017-02-27 20:18:54" }, + { + "name": "evenement/evenement", + "version": "v2.1.0", + "source": { + "type": "git", + "url": "https://github.com/igorw/evenement.git", + "reference": "6ba9a777870ab49f417e703229d53931ed40fd7a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/igorw/evenement/zipball/6ba9a777870ab49f417e703229d53931ed40fd7a", + "reference": "6ba9a777870ab49f417e703229d53931ed40fd7a", + "shasum": "" + }, + "require": { + "php": ">=5.4.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.0||^5.7||^4.8.35" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, + "autoload": { + "psr-0": { + "Evenement": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Igor Wiedler", + "email": "igor@wiedler.ch" + } + ], + "description": "Événement is a very simple event dispatching library for PHP", + "keywords": [ + "event-dispatcher", + "event-emitter" + ], + "time": "2017-07-17 17:39:19" + }, { "name": "fig/link-util", "version": "1.0.0", @@ -1382,6 +1430,333 @@ ], "time": "2016-10-17 18:31:11" }, + { + "name": "gos/pnctl-event-loop-emitter", + "version": "v0.1.7", + "source": { + "type": "git", + "url": "https://github.com/GeniusesOfSymfony/PNCTLEventLoopEmitter.git", + "reference": "93bb0f0e60e4e1f4025f77c8a4fd9ae0c3b45fb3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/GeniusesOfSymfony/PNCTLEventLoopEmitter/zipball/93bb0f0e60e4e1f4025f77c8a4fd9ae0c3b45fb3", + "reference": "93bb0f0e60e4e1f4025f77c8a4fd9ae0c3b45fb3", + "shasum": "" + }, + "require": { + "evenement/evenement": "~2.0|~3.0", + "php": ">=5.4", + "react/event-loop": "~0.4.0|^0.5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Gos\\Component\\PnctlEventLoopEmitter\\": "src/" + }, + "files": [ + "src/functions.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Johann Saunier", + "email": "johann_27@hotmail.fr" + } + ], + "description": "Pnctl event emitter for event loop", + "homepage": "https://github.com/GeniusesOfSymfony/PnctlEventLoopEmitter", + "keywords": [ + "Pnctl", + "event loop", + "reactphp" + ], + "time": "2018-04-09 11:12:07" + }, + { + "name": "gos/pubsub-router-bundle", + "version": "v0.3.5", + "source": { + "type": "git", + "url": "https://github.com/GeniusesOfSymfony/PubSubRouterBundle.git", + "reference": "a3f9666455dc42f38a7ce31ca2fc55bd27421ea0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/GeniusesOfSymfony/PubSubRouterBundle/zipball/a3f9666455dc42f38a7ce31ca2fc55bd27421ea0", + "reference": "a3f9666455dc42f38a7ce31ca2fc55bd27421ea0", + "shasum": "" + }, + "require": { + "doctrine/cache": "~1.4", + "php": ">=5.5", + "symfony/console": "~3.4|~4.0", + "symfony/framework-bundle": "~3.4|~4.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.35" + }, + "type": "symfony-bundle", + "extra": { + "branch-alias": { + "dev-master": "0.3.x-dev" + } + }, + "autoload": { + "psr-4": { + "Gos\\Bundle\\PubSubRouterBundle\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Johann Saunier", + "email": "johann_27@hotmail.fr" + } + ], + "description": "Symfony PubSub Router Bundle", + "homepage": "https://github.com/GeniusesOfSymfony/PubSubRouterBundle", + "keywords": [ + "PubSub Bundle", + "WAMP", + "bundle", + "pubsub", + "redis", + "zmq" + ], + "time": "2018-10-04 17:09:23" + }, + { + "name": "gos/ratchet", + "version": "v0.3.6", + "source": { + "type": "git", + "url": "https://github.com/GeniusesOfSymfony/Ratchet.git", + "reference": "f72ee4f70f24da1fc232537088e6c368ae4211e0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/GeniusesOfSymfony/Ratchet/zipball/f72ee4f70f24da1fc232537088e6c368ae4211e0", + "reference": "f72ee4f70f24da1fc232537088e6c368ae4211e0", + "shasum": "" + }, + "require": { + "guzzle/http": "^3.6", + "php": ">=5.3.9", + "react/socket": "^0.3 || ^0.4", + "symfony/http-foundation": "^2.2|^3.0|^4.0", + "symfony/routing": "^2.2|^3.0|^4.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Ratchet\\": "src/Ratchet" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Chris Boden", + "email": "cboden@gmail.com", + "role": "Developer" + } + ], + "description": "PHP WebSocket library", + "homepage": "http://socketo.me", + "keywords": [ + "Ratchet", + "WebSockets", + "server", + "sockets" + ], + "time": "2017-12-12 16:15:11" + }, + { + "name": "gos/ratchet-stack", + "version": "v0.2.0", + "source": { + "type": "git", + "url": "https://github.com/GeniusesOfSymfony/RatchetStack.git", + "reference": "a7dfc817bf8b786c575022e290ab0769dbf09814" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/GeniusesOfSymfony/RatchetStack/zipball/a7dfc817bf8b786c575022e290ab0769dbf09814", + "reference": "a7dfc817bf8b786c575022e290ab0769dbf09814", + "shasum": "" + }, + "require": { + "cboden/ratchet": "^0.3|^0.4", + "php": ">=5.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Gos\\Component\\RatchetStack\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Johann Saunier", + "email": "johann_27@hotmail.fr" + } + ], + "description": "Ratchet Stack", + "homepage": "https://github.com/GeniusesOfSymfony/RatchetStack", + "keywords": [ + "Ratchet", + "application", + "stack" + ], + "time": "2018-05-02 13:03:51" + }, + { + "name": "gos/web-socket-bundle", + "version": "v1.8.11", + "source": { + "type": "git", + "url": "https://github.com/GeniusesOfSymfony/WebSocketBundle.git", + "reference": "a26b71e9014a73b95ddbb02a813157563a296a48" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/GeniusesOfSymfony/WebSocketBundle/zipball/a26b71e9014a73b95ddbb02a813157563a296a48", + "reference": "a26b71e9014a73b95ddbb02a813157563a296a48", + "shasum": "" + }, + "require": { + "gos/pnctl-event-loop-emitter": "~0.1", + "gos/pubsub-router-bundle": "~0.2", + "gos/ratchet": "~0.3.5", + "gos/ratchet-stack": "~0.1", + "gos/websocket-client": "~0.1.0", + "php": ">=5.4", + "symfony/framework-bundle": "~2.3|~3.0" + }, + "replace": { + "cboden/ratchet": "~0.3.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.8" + }, + "suggest": { + "ext-amqp": "*", + "ext-libev": "*", + "ext-libevent": ">=0.0.5", + "ext-zmq": "*", + "ocramius/proxy-manager": "~1.0", + "symfony/proxy-manager-bridge": "~2.3" + }, + "type": "symfony-bundle", + "extra": { + "branch-alias": { + "dev-master": "1.8.x-dev" + } + }, + "autoload": { + "psr-4": { + "Gos\\Bundle\\WebSocketBundle\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jeremy Dare", + "email": "jeremy.d.dare@gmail.com" + }, + { + "name": "Johann Saunier", + "email": "johann_27@hotmail.fr" + } + ], + "description": "Symfony Web Socket Bundle", + "homepage": "https://github.com/GeniusesOfSymfony/WebSocketBundle", + "keywords": [ + "Ratchet", + "WAMP", + "Web Socket Bundle", + "io", + "websocket" + ], + "time": "2017-09-29 16:00:43" + }, + { + "name": "gos/websocket-client", + "version": "v0.1.2", + "source": { + "type": "git", + "url": "https://github.com/GeniusesOfSymfony/WebSocketPhpClient.git", + "reference": "13bb38cb01acee648fea1a6ca4ad3dc6148da7fe" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/GeniusesOfSymfony/WebSocketPhpClient/zipball/13bb38cb01acee648fea1a6ca4ad3dc6148da7fe", + "reference": "13bb38cb01acee648fea1a6ca4ad3dc6148da7fe", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "0.1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Gos\\Component\\WebSocketClient\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Johann Saunier", + "email": "johann_27@hotmail.fr" + }, + { + "name": "Martin Bažík", + "email": "martin@bazo.sk" + } + ], + "description": "WAMP client in PHP", + "keywords": [ + "Ratchet", + "WAMP", + "websocket" + ], + "time": "2015-08-04 11:43:11" + }, { "name": "gregwar/captcha", "version": "v1.1.7", @@ -1489,6 +1864,208 @@ ], "time": "2018-11-20 10:41:34" }, + { + "name": "guzzle/common", + "version": "v3.9.2", + "target-dir": "Guzzle/Common", + "source": { + "type": "git", + "url": "https://github.com/Guzzle3/common.git", + "reference": "2e36af7cf2ce3ea1f2d7c2831843b883a8e7b7dc" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Guzzle3/common/zipball/2e36af7cf2ce3ea1f2d7c2831843b883a8e7b7dc", + "reference": "2e36af7cf2ce3ea1f2d7c2831843b883a8e7b7dc", + "shasum": "" + }, + "require": { + "php": ">=5.3.2", + "symfony/event-dispatcher": ">=2.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.7-dev" + } + }, + "autoload": { + "psr-0": { + "Guzzle\\Common": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Common libraries used by Guzzle", + "homepage": "http://guzzlephp.org/", + "keywords": [ + "collection", + "common", + "event", + "exception" + ], + "abandoned": "guzzle/guzzle", + "time": "2014-08-11 04:32:36" + }, + { + "name": "guzzle/http", + "version": "v3.9.2", + "target-dir": "Guzzle/Http", + "source": { + "type": "git", + "url": "https://github.com/Guzzle3/http.git", + "reference": "1e8dd1e2ba9dc42332396f39fbfab950b2301dc5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Guzzle3/http/zipball/1e8dd1e2ba9dc42332396f39fbfab950b2301dc5", + "reference": "1e8dd1e2ba9dc42332396f39fbfab950b2301dc5", + "shasum": "" + }, + "require": { + "guzzle/common": "self.version", + "guzzle/parser": "self.version", + "guzzle/stream": "self.version", + "php": ">=5.3.2" + }, + "suggest": { + "ext-curl": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.7-dev" + } + }, + "autoload": { + "psr-0": { + "Guzzle\\Http": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + } + ], + "description": "HTTP libraries used by Guzzle", + "homepage": "http://guzzlephp.org/", + "keywords": [ + "Guzzle", + "client", + "curl", + "http", + "http client" + ], + "abandoned": "guzzle/guzzle", + "time": "2014-08-11 04:32:36" + }, + { + "name": "guzzle/parser", + "version": "v3.9.2", + "target-dir": "Guzzle/Parser", + "source": { + "type": "git", + "url": "https://github.com/Guzzle3/parser.git", + "reference": "6874d171318a8e93eb6d224cf85e4678490b625c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Guzzle3/parser/zipball/6874d171318a8e93eb6d224cf85e4678490b625c", + "reference": "6874d171318a8e93eb6d224cf85e4678490b625c", + "shasum": "" + }, + "require": { + "php": ">=5.3.2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.7-dev" + } + }, + "autoload": { + "psr-0": { + "Guzzle\\Parser": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Interchangeable parsers used by Guzzle", + "homepage": "http://guzzlephp.org/", + "keywords": [ + "URI Template", + "cookie", + "http", + "message", + "url" + ], + "abandoned": "guzzle/guzzle", + "time": "2014-02-05 18:29:46" + }, + { + "name": "guzzle/stream", + "version": "v3.9.2", + "target-dir": "Guzzle/Stream", + "source": { + "type": "git", + "url": "https://github.com/Guzzle3/stream.git", + "reference": "60c7fed02e98d2c518dae8f97874c8f4622100f0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Guzzle3/stream/zipball/60c7fed02e98d2c518dae8f97874c8f4622100f0", + "reference": "60c7fed02e98d2c518dae8f97874c8f4622100f0", + "shasum": "" + }, + "require": { + "guzzle/common": "self.version", + "php": ">=5.3.2" + }, + "suggest": { + "guzzle/http": "To convert Guzzle request objects to PHP streams" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.7-dev" + } + }, + "autoload": { + "psr-0": { + "Guzzle\\Stream": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + } + ], + "description": "Guzzle stream wrapper component", + "homepage": "http://guzzlephp.org/", + "keywords": [ + "Guzzle", + "component", + "stream" + ], + "abandoned": "guzzle/guzzle", + "time": "2014-05-01 21:36:02" + }, { "name": "guzzlehttp/guzzle", "version": "6.3.3", @@ -2798,6 +3375,180 @@ ], "time": "2018-07-19 23:38:55" }, + { + "name": "react/event-loop", + "version": "v0.4.3", + "source": { + "type": "git", + "url": "https://github.com/reactphp/event-loop.git", + "reference": "8bde03488ee897dc6bb3d91e4e17c353f9c5252f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/reactphp/event-loop/zipball/8bde03488ee897dc6bb3d91e4e17c353f9c5252f", + "reference": "8bde03488ee897dc6bb3d91e4e17c353f9c5252f", + "shasum": "" + }, + "require": { + "php": ">=5.4.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.8" + }, + "suggest": { + "ext-event": "~1.0", + "ext-libev": "*", + "ext-libevent": ">=0.1.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "React\\EventLoop\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Event loop abstraction layer that libraries can use for evented I/O.", + "keywords": [ + "asynchronous", + "event-loop" + ], + "time": "2017-04-27 10:56:23" + }, + { + "name": "react/promise", + "version": "v2.7.1", + "source": { + "type": "git", + "url": "https://github.com/reactphp/promise.git", + "reference": "31ffa96f8d2ed0341a57848cbb84d88b89dd664d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/reactphp/promise/zipball/31ffa96f8d2ed0341a57848cbb84d88b89dd664d", + "reference": "31ffa96f8d2ed0341a57848cbb84d88b89dd664d", + "shasum": "" + }, + "require": { + "php": ">=5.4.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.8" + }, + "type": "library", + "autoload": { + "psr-4": { + "React\\Promise\\": "src/" + }, + "files": [ + "src/functions_include.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jan Sorgalla", + "email": "jsorgalla@gmail.com" + } + ], + "description": "A lightweight implementation of CommonJS Promises/A for PHP", + "keywords": [ + "promise", + "promises" + ], + "time": "2019-01-07 21:25:54" + }, + { + "name": "react/socket", + "version": "v0.4.6", + "source": { + "type": "git", + "url": "https://github.com/reactphp/socket.git", + "reference": "cf074e53c974df52388ebd09710a9018894745d2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/reactphp/socket/zipball/cf074e53c974df52388ebd09710a9018894745d2", + "reference": "cf074e53c974df52388ebd09710a9018894745d2", + "shasum": "" + }, + "require": { + "evenement/evenement": "~2.0|~1.0", + "php": ">=5.3.0", + "react/event-loop": "0.4.*|0.3.*", + "react/promise": "^2.0 || ^1.1", + "react/stream": "^0.4.5" + }, + "require-dev": { + "clue/block-react": "^1.1", + "phpunit/phpunit": "~4.8", + "react/socket-client": "^0.5.1" + }, + "type": "library", + "autoload": { + "psr-4": { + "React\\Socket\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Async, streaming plaintext TCP/IP and secure TLS socket server for React PHP", + "keywords": [ + "Socket" + ], + "time": "2017-01-26 09:23:38" + }, + { + "name": "react/stream", + "version": "v0.4.6", + "source": { + "type": "git", + "url": "https://github.com/reactphp/stream.git", + "reference": "44dc7f51ea48624110136b535b9ba44fd7d0c1ee" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/reactphp/stream/zipball/44dc7f51ea48624110136b535b9ba44fd7d0c1ee", + "reference": "44dc7f51ea48624110136b535b9ba44fd7d0c1ee", + "shasum": "" + }, + "require": { + "evenement/evenement": "^2.0|^1.0", + "php": ">=5.3.8" + }, + "require-dev": { + "clue/stream-filter": "~1.2", + "react/event-loop": "^0.4|^0.3", + "react/promise": "^2.0|^1.0" + }, + "suggest": { + "react/event-loop": "^0.4", + "react/promise": "^2.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "React\\Stream\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Basic readable and writable stream interfaces that support piping.", + "keywords": [ + "pipe", + "stream" + ], + "time": "2017-01-25 14:44:14" + }, { "name": "robrichards/xmlseclibs", "version": "3.0.3", diff --git a/src/ninegate-1.0/scripts/ninegate-postservice-01.sh b/src/ninegate-1.0/scripts/ninegate-postservice-01.sh index a7e1a0fb..3f472fac 100755 --- a/src/ninegate-1.0/scripts/ninegate-postservice-01.sh +++ b/src/ninegate-1.0/scripts/ninegate-postservice-01.sh @@ -7,6 +7,7 @@ iconniveau01=$(CreoleGet ninegate_niveau01icon non) affniveau02=$(CreoleGet ninegate_niveau02view non) labelsniveau02=$(CreoleGet ninegate_niveau02labels non) iconniveau02=$(CreoleGet ninegate_niveau02icon non) +weburl=$(CreoleGet web_url non) www_dir="$container_path_web/var/www/html" eportail_dir="$www_dir/eportail" @@ -48,26 +49,13 @@ fi # Permissions ./perm.sh www-data -# Paramétrage eportail -if [[ "$ninegate_synceportail" = 'oui' ]] -then - echo " $eportail_dir/local/config/externe.php - echo "\$config['modeUserExterne'] = 'true';" >> $eportail_dir/local/config/externe.php - echo "\$config['affResgistrationExterne'] = '$moderegistration';" >> $eportail_dir/local/config/externe.php - echo "\$config['urlRegistrationExterne'] = '/ninegate/registration';" >> $eportail_dir/local/config/externe.php - echo "\$config['urlConfigRegistrationExterne'] = '/ninegate/config/registration';" >> $eportail_dir/local/config/externe.php - echo "\$config['urlWhitelistExterne'] = '/ninegate/config/whitelist';" >> $eportail_dir/local/config/externe.php - echo "\$config['urlNiveau01Externe'] = '/ninegate/config/niveau01';" >> $eportail_dir/local/config/externe.php - echo "\$config['labNiveau01Externe'] = '$labelsniveau01';" >> $eportail_dir/local/config/externe.php - echo "\$config['icoNiveau01Externe'] = '$iconniveau01';" >> $eportail_dir/local/config/externe.php - echo "\$config['affNiveau02Externe'] = '$affniveau02';" >> $eportail_dir/local/config/externe.php - echo "\$config['urlNiveau02Externe'] = '/ninegate/config/niveau02';" >> $eportail_dir/local/config/externe.php - echo "\$config['labNiveau02Externe'] = '$labelsniveau02';" >> $eportail_dir/local/config/externe.php - echo "\$config['icoNiveau02Externe'] = '$iconniveau02';" >> $eportail_dir/local/config/externe.php - echo "\$config['urlGroupeExterne'] = '/ninegate/config/group';" >> $eportail_dir/local/config/externe.php - echo "\$config['urlProfilExterne'] = '/ninegate/profil';" >> $eportail_dir/local/config/externe.php - echo "\$config['urlAnnuaireExterne'] = '/ninegate/profil/users';" >> $eportail_dir/local/config/externe.php - echo "\$config['urlUserExterne'] = '/ninegate/config/user';" >> $eportail_dir/local/config/externe.php - echo "\$config['urlLogoutExterne'] = '/ninegate/kill?redirect=/eportail/logout.php';" >> $eportail_dir/local/config/externe.php - echo "?>" >> $eportail_dir/local/config/externe.php -fi \ No newline at end of file +# Server Websocket +echo "" +echo WEBSOCKET = STOP +pid="$(pgrep -f gos:websocket)" +if [ -n "${pid}" ]; then + kill -9 ${pid}; +fi + +echo WEBSOCKET = START +bin/console gos:websocket:server --port 5556 -a $web_url --no-debug -n -q --env=prod & disown \ No newline at end of file diff --git a/src/ninegate-1.0/src/Cadoles/CoreBundle/Command/data/core-init-01.sql b/src/ninegate-1.0/src/Cadoles/CoreBundle/Command/data/core-init-01.sql index f6d8a88f..b351eb90 100644 --- a/src/ninegate-1.0/src/Cadoles/CoreBundle/Command/data/core-init-01.sql +++ b/src/ninegate-1.0/src/Cadoles/CoreBundle/Command/data/core-init-01.sql @@ -8,7 +8,7 @@ INSERT IGNORE INTO `niveau01` (`id`, `label`, `siren`) VALUES (-100, 'DRAAF', '130007107'); INSERT IGNORE INTO `user` (`id`, `niveau01_id`, `username`, `firstname`, `lastname`, `password`, `email`, `avatar`, `role`,`siren`,`authlevel`) VALUES -(-100, -100, 'admin', 'Administrateur', 'draaf', '{SSHA}HNhgaEb5yI9ZX4o5Ydrf1+D/YeNPLIdF +(-100, -100, 'admin', 'Administrateur', 'draaf', '{SSHA}TkQTsvHn9GzwqtA6jPZ/ubyfp+ZwNbmH ', 'admin@ldapbundle.ac-arno.fr', 'admin.jpg', 'ROLE_ADMIN', '130007107', 'simple'); diff --git a/src/ninegate-1.0/src/Cadoles/CoreBundle/Entity/Group.php b/src/ninegate-1.0/src/Cadoles/CoreBundle/Entity/Group.php index fb91f04b..0a3463dd 100644 --- a/src/ninegate-1.0/src/Cadoles/CoreBundle/Entity/Group.php +++ b/src/ninegate-1.0/src/Cadoles/CoreBundle/Entity/Group.php @@ -148,6 +148,15 @@ class Group */ protected $blogs; + + /** + * @var ArrayCollection $message + * @var Message + * + * @ORM\OneToMany(targetEntity="Cadoles\WebsocketBundle\Entity\Message", mappedBy="user", cascade={"persist"}, orphanRemoval=true) + */ + protected $messages; + // ATTENTION NE SURTOUT PAS REGEN TOTALEMENT LES SETTER // Methode custom sur les Addxxx et Removexxx @@ -821,4 +830,38 @@ class Group { return $this->pagetemplate; } + + /** + * Add message + * + * @param \Cadoles\WebsocketBundle\Entity\Message $message + * + * @return Group + */ + public function addMessage(\Cadoles\WebsocketBundle\Entity\Message $message) + { + $this->messages[] = $message; + + return $this; + } + + /** + * Remove message + * + * @param \Cadoles\WebsocketBundle\Entity\Message $message + */ + public function removeMessage(\Cadoles\WebsocketBundle\Entity\Message $message) + { + $this->messages->removeElement($message); + } + + /** + * Get messages + * + * @return \Doctrine\Common\Collections\Collection + */ + public function getMessages() + { + return $this->messages; + } } diff --git a/src/ninegate-1.0/src/Cadoles/CoreBundle/Entity/User.php b/src/ninegate-1.0/src/Cadoles/CoreBundle/Entity/User.php index 11a2f953..77c8882c 100644 --- a/src/ninegate-1.0/src/Cadoles/CoreBundle/Entity/User.php +++ b/src/ninegate-1.0/src/Cadoles/CoreBundle/Entity/User.php @@ -222,7 +222,7 @@ class User implements UserInterface, \Serializable /** * @ORM\ManyToMany(targetEntity="Cadoles\PortalBundle\Entity\Notice", mappedBy="users") */ - protected $notices; + private $notices; /** * @var ArrayCollection $blog @@ -235,7 +235,7 @@ class User implements UserInterface, \Serializable /** * @ORM\ManyToMany(targetEntity="Cadoles\PortalBundle\Entity\Blog", mappedBy="writers") */ - protected $blogwriters; + private $blogwriters; /** * @var ArrayCollection $blogarticle @@ -253,6 +253,15 @@ class User implements UserInterface, \Serializable */ private $icons; + /** + * @var ArrayCollection $message + * @var Message + * + * @ORM\OneToMany(targetEntity="Cadoles\WebsocketBundle\Entity\Message", mappedBy="user", cascade={"persist"}, orphanRemoval=true) + */ + private $messages; + + //== CODE A NE PAS REGENERER /** * @ORM\PostLoad @@ -1339,4 +1348,38 @@ class User implements UserInterface, \Serializable { return $this->ownergroups; } + + /** + * Add message + * + * @param \Cadoles\WebsocketBundle\Entity\Message $message + * + * @return User + */ + public function addMessage(\Cadoles\WebsocketBundle\Entity\Message $message) + { + $this->messages[] = $message; + + return $this; + } + + /** + * Remove message + * + * @param \Cadoles\WebsocketBundle\Entity\Message $message + */ + public function removeMessage(\Cadoles\WebsocketBundle\Entity\Message $message) + { + $this->messages->removeElement($message); + } + + /** + * Get messages + * + * @return \Doctrine\Common\Collections\Collection + */ + public function getMessages() + { + return $this->messages; + } } diff --git a/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/views/base.html.twig b/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/views/base.html.twig index f75c96ca..282d47bc 100644 --- a/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/views/base.html.twig +++ b/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/views/base.html.twig @@ -149,6 +149,10 @@ {{ include('@CadolesCore/Include/footer.html.twig') }} + {% block localexternalscript %} + + {% endblock %} + + +{% endblock %} + +{% block localjavascript %} + $(document).ready(function(){ + var dateoptions = {weekday: "long", year: "numeric", month: "long", day: "numeric", hour: "2-digit", minute: "2-digit" }; + + + {% if app.user %} + var _WS_URI = "wss://{{ gos_web_socket_server_host }}:{{ gos_web_socket_server_port }}"; + var _WS_URI = "wss://{{ gos_web_socket_server_host }}:5555"; + console.log(_WS_URI); + + var webSocket = WS.connect(_WS_URI); + + webSocket.on("socket/connect", function (session) { + + session.call("websocket/rpc/update_connection_data", {"userkey": "{{userkey}}" }).then( + function (result) + { + console.log("RPC Valid!", result); + }, + function (error, desc) + { + console.log("RPC Error", error, desc); + } + ); + + //the callback function in "subscribe" is called everytime an event is published in that channel. + session.subscribe("websocket/channel/{{groupid}}", function (uri, payload) { + html ="
"; + html+="
"; + html+="
" + html+="
"+payload.msg.lastname+"
"+new Date(payload.msg.submitdate.date).toLocaleDateString("fr-FR", dateoptions)+"
"; + html+="
"+payload.msg.message+"
"; + html+="
"; + html+="
"; + $(".mychat").append(html); + + console.log("Received message", payload.msg); + }); + + session.publish("websocket/channel/{{groupid}}", "This is a message!"); + session.publish("websocket/channel/{{groupid}}", "This is a message!"); + session.publish("websocket/channel/{{groupid}}", "This is a message!"); + }) + {% endif %} + }); +{% endblock %} \ No newline at end of file diff --git a/src/ninegate-1.0/src/Cadoles/WebsocketBundle/Topic/WebsocketTopic.php b/src/ninegate-1.0/src/Cadoles/WebsocketBundle/Topic/WebsocketTopic.php new file mode 100644 index 00000000..e175b688 --- /dev/null +++ b/src/ninegate-1.0/src/Cadoles/WebsocketBundle/Topic/WebsocketTopic.php @@ -0,0 +1,121 @@ +clientManipulator = $clientManipulator; + $this->em = $em; + $this->container = $container; + } + + /** + * This will receive any Subscription requests for this topic. + * + * @param ConnectionInterface $connection + * @param Topic $topic + * @param WampRequest $request + * @return void + */ + public function onSubscribe(ConnectionInterface $connection, Topic $topic, WampRequest $request) + { + /* + $userkey=$request->getAttributes()->get('user'); + $groupid=$request->getAttributes()->get('group'); + + $user=$this->em->getRepository("CadolesCoreBundle:User")->findOneBy(['keyvalue'=> $userkey]); + if(!$user) $topic->broadcast(['msg' => 'user NOT FIND']); + else $topic->broadcast(['msg' => $user->getUsername()]); + + //this will broadcast the message to ALL subscribers of this topic. + $topic->broadcast(['msg' => $connection->resourceId . " group = $groupid && user = $userkey has joined " . $topic->getId()]); + */ + } + + /** + * This will receive any UnSubscription requests for this topic. + * + * @param ConnectionInterface $connection + * @param Topic $topic + * @param WampRequest $request + * @return void + */ + public function onUnSubscribe(ConnectionInterface $connection, Topic $topic, WampRequest $request) + { + //this will broadcast the message to ALL subscribers of this topic. + //$topic->broadcast(['msg' => $connection->resourceId . " has left " . $topic->getId()]); + } + + + /** + * This will receive any Publish requests for this topic. + * + * @param ConnectionInterface $connection + * @param Topic $topic + * @param WampRequest $request + * @param $event + * @param array $exclude + * @param array $eligible + * @return mixed|void + */ + public function onPublish(ConnectionInterface $connection, Topic $topic, WampRequest $request, $event, array $exclude, array $eligible) + { + $userkey=$connection->userkey; + $groupid=$request->getAttributes()->get('group'); + + $group=$this->em->getRepository("CadolesCoreBundle:Group")->find($groupid); + if(!$group) { + $topic->broadcast(['msg' => 'group NOT FIND']); + } + + $user=$this->em->getRepository("CadolesCoreBundle:User")->findOneBy(['keyvalue'=> $userkey]); + if(!$user) { + $topic->broadcast(['msg' => 'user NOT FIND']); + } + + if($group&&$user) { + $message=new Message(); + $message->setTopic($event); + $message->setUser($user); + $message->setGroup($group); + $this->em->persist($message); + $this->em->flush(); + + $return["lastname"]=$user->getLastname()." ".$user->getFirstname(); + $return["avatar"]=$user->getAvatar(); + $return["submitdate"]=$message->getSubmitdate(); + $return["message"]=$event; + + //this will broadcast the message to ALL subscribers of this topic. + $topic->broadcast([ + 'msg' => $return, + ]); + } + } + + /** + * Like RPC is will use to prefix the channel + * @return string + */ + public function getName() + { + return 'websocket.topic'; + } +} \ No newline at end of file diff --git a/tmpl/ninegate-template.yml b/tmpl/ninegate-template.yml index eaa7b19e..846ba35f 100644 --- a/tmpl/ninegate-template.yml +++ b/tmpl/ninegate-template.yml @@ -36,6 +36,13 @@ parameters: %else syncenvole_activate: false %end if +%if %%getVar("ninegate_activate_websocket", 'non') == "oui" + websocket_activate: true + websocket_port: 5555 +%else + websocket_activate: false + websocket_port: 5555 +%end if %if %%getVar("ninegate_activate_portal", 'non') == "oui" portal_activate: true module_activate: false @@ -218,27 +225,6 @@ parameters: activate_widwordpress: false %end if - # Synchrinisation eportail -%if %%getVar("ninegate_synceportail", 'non') == "oui" - eportail_sync: true - eportail_url: /eportail - eportail_login: /eportail/login.php - eportail_database_host: '%database_host%' - eportail_database_port: 3306 - eportail_database_name: eportail - eportail_database_user: eportail - eportail_database_password: "changme" -%else - eportail_sync: false - eportail_url: # /eportail - eportail_login: # /eportail/login.php - eportail_database_host: # 172.27.7.64 - eportail_database_port: # 3306 - eportail_database_name: # eportail - eportail_database_user: # eportail - eportail_database_password: # "changme" -%end if - # Si mode_auth = CAS cas_host: %%eolesso_adresse cas_path: %%eolesso_cas_folder @@ -285,16 +271,6 @@ doctrine: user: '%database_user%' password: '%database_password%' charset: UTF8 -%if %%getVar("ninegate_synceportail", 'non') == "oui" - eportail: - driver: pdo_mysql - host: '%eportail_database_host%' - port: '%eportail_database_port%' - dbname: '%eportail_database_name%' - user: '%eportail_database_user%' - password: '%eportail_database_password%' - charset: UTF8 -%end if orm: default_entity_manager: default entity_managers: @@ -304,13 +280,7 @@ doctrine: CadolesCoreBundle: ~ CadolesCronBundle: ~ CadolesPortalBundle: ~ -%if %%getVar("ninegate_synceportail", 'non') == "oui" - eportail: - connection: eportail - mappings: - CadolesCoreBundle: ~ - CadolesCronBundle: ~ - CadolesPortalBundle: ~ -%end if + CadolesWebsocketBundle: ~ + \ No newline at end of file diff --git a/tmpl/ninegate.nginx.conf b/tmpl/ninegate.nginx.conf new file mode 100644 index 00000000..d411e94a --- /dev/null +++ b/tmpl/ninegate.nginx.conf @@ -0,0 +1,24 @@ +server { + listen 5555 ssl; + + ssl on; + ssl_certificate %%server_cert; + ssl_certificate_key %%server_key; + + proxy_connect_timeout 600; + proxy_send_timeout 600; + proxy_read_timeout 600; + send_timeout 600; + + location / { + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "Upgrade"; + proxy_set_header Proxy ""; + proxy_set_header Host $http_host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_pass http://%%web_url:5556; + } +} \ No newline at end of file