├── .styleci.yml ├── CHANGELOG.md ├── config └── config.php ├── src ├── LaravelJitsiFacade.php ├── Traits │ └── HasJitsiAttributes.php ├── Http │ └── Controllers │ │ └── ViewRoomController.php ├── LaravelJitsi.php └── LaravelJitsiServiceProvider.php ├── canvas.yaml ├── LICENSE.md ├── resources └── views │ └── room.blade.php ├── composer.json ├── CONTRIBUTING.md └── README.md /.styleci.yml: -------------------------------------------------------------------------------- 1 | preset: laravel 2 | 3 | disabled: 4 | - single_class_element_per_statement 5 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | All notable changes to `laravel-jitsi` will be documented in this file 4 | 5 | ## 1.0.0 - 2020-11-11 6 | 7 | - initial release 8 | -------------------------------------------------------------------------------- /config/config.php: -------------------------------------------------------------------------------- 1 | env('JITSI_APP_DOMAIN'), 5 | 'id' => env('JITSI_APP_ID'), 6 | 'secret' => env('JITSI_APP_SECRET'), 7 | ]; 8 | -------------------------------------------------------------------------------- /src/LaravelJitsiFacade.php: -------------------------------------------------------------------------------- 1 | name; 13 | } 14 | 15 | /** 16 | * @return string 17 | */ 18 | public function getJitsiEmail() 19 | { 20 | return $this->email; 21 | } 22 | 23 | /** 24 | * @return string 25 | */ 26 | public function getJitsiAvatar() 27 | { 28 | return $this->avatar; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Http/Controllers/ViewRoomController.php: -------------------------------------------------------------------------------- 1 | user()); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) Azmi Makarima 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /resources/views/room.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 8 | 10 | {{ $room }} 11 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "amyisme13/laravel-jitsi", 3 | "description": "A package to generate view of a Jitsi Meet room using Jitsi Meet IFrame API", 4 | "keywords": [ 5 | "amyisme13", 6 | "laravel-jitsi" 7 | ], 8 | "homepage": "https://github.com/amyisme13/laravel-jitsi", 9 | "license": "MIT", 10 | "type": "library", 11 | "authors": [ 12 | { 13 | "name": "Azmi Makarima", 14 | "email": "amy.azmim@gmail.com", 15 | "role": "Developer" 16 | } 17 | ], 18 | "require": { 19 | "php": "^7.1", 20 | "firebase/php-jwt": "^5.2", 21 | "illuminate/support": "~6.0|~7.0|~8.0" 22 | }, 23 | "require-dev": { 24 | "orchestra/canvas": "^4.6", 25 | "orchestra/testbench": "^4.0", 26 | "phpunit/phpunit": "^8.0" 27 | }, 28 | "autoload": { 29 | "psr-4": { 30 | "Amyisme13\\LaravelJitsi\\": "src" 31 | } 32 | }, 33 | "autoload-dev": { 34 | "psr-4": { 35 | "Amyisme13\\LaravelJitsi\\Tests\\": "tests" 36 | } 37 | }, 38 | "scripts": { 39 | "test": "vendor/bin/phpunit", 40 | "test-coverage": "vendor/bin/phpunit --coverage-html coverage" 41 | }, 42 | "config": { 43 | "sort-packages": true 44 | }, 45 | "extra": { 46 | "laravel": { 47 | "providers": [ 48 | "Amyisme13\\LaravelJitsi\\LaravelJitsiServiceProvider" 49 | ], 50 | "aliases": { 51 | "LaravelJitsi": "Amyisme13\\LaravelJitsi\\LaravelJitsiFacade" 52 | } 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/LaravelJitsi.php: -------------------------------------------------------------------------------- 1 | $user->getKey(), 22 | 'name' => $user->getJitsiName(), 23 | 'email' => $user->getJitsiEmail(), 24 | 'avatar' => $user->getJitsiAvatar(), 25 | ]); 26 | 27 | $payload = [ 28 | 'iss' => config('laravel-jitsi.id'), 29 | 'aud' => config('laravel-jitsi.id'), 30 | 'sub' => config('laravel-jitsi.domain'), 31 | 'exp' => now()->addMinutes(5)->timestamp, 32 | 'room' => $room, 33 | 'user' => $user->filter()->all(), 34 | ]; 35 | 36 | return JWT::encode($payload, config('laravel-jitsi.secret')); 37 | } 38 | 39 | /** 40 | * Return a view instance for the given room 41 | * 42 | * @param string|null $room will be assigned random string when null 43 | * @param \Illuminate\Database\Eloquent\Model|null $user 44 | * @return \Illuminate\View\View 45 | */ 46 | public function viewRoom($room = null, $user = null) 47 | { 48 | if (is_null($room)) { 49 | $room = Str::random(); 50 | } 51 | 52 | $jwt = null; 53 | if (! is_null($user)) { 54 | $jwt = $this->generateJwt($user, $room); 55 | } 56 | 57 | return view('laravel-jitsi::room', compact('room', 'jwt')); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /src/LaravelJitsiServiceProvider.php: -------------------------------------------------------------------------------- 1 | loadTranslationsFrom(__DIR__.'/../resources/lang', 'laravel-jitsi'); 19 | $this->loadViewsFrom(__DIR__.'/../resources/views', 'laravel-jitsi'); 20 | // $this->loadMigrationsFrom(__DIR__.'/../database/migrations'); 21 | // $this->loadRoutesFrom(__DIR__.'/routes.php'); 22 | 23 | if ($this->app->runningInConsole()) { 24 | $this->publishes([ 25 | __DIR__.'/../config/config.php' => config_path('laravel-jitsi.php'), 26 | ], 'config'); 27 | 28 | // Publishing the views. 29 | $this->publishes([ 30 | __DIR__.'/../resources/views' => resource_path('views/vendor/laravel-jitsi'), 31 | ], 'views'); 32 | 33 | // Publishing assets. 34 | /*$this->publishes([ 35 | __DIR__.'/../resources/assets' => public_path('vendor/laravel-jitsi'), 36 | ], 'assets');*/ 37 | 38 | // Publishing the translation files. 39 | /*$this->publishes([ 40 | __DIR__.'/../resources/lang' => resource_path('lang/vendor/laravel-jitsi'), 41 | ], 'lang');*/ 42 | 43 | // Registering package commands. 44 | // $this->commands([]); 45 | } 46 | } 47 | 48 | /** 49 | * Register the application services. 50 | */ 51 | public function register() 52 | { 53 | // Automatically apply the package configuration 54 | $this->mergeConfigFrom(__DIR__.'/../config/config.php', 'laravel-jitsi'); 55 | 56 | // Register the main class to use with the facade 57 | $this->app->singleton('laravel-jitsi', function () { 58 | return new LaravelJitsi; 59 | }); 60 | 61 | $this->registerRoutesMacro(); 62 | } 63 | 64 | /** 65 | * Register routes macro. 66 | * 67 | * @param void 68 | * @return void 69 | */ 70 | protected function registerRoutesMacro() 71 | { 72 | $router = $this->app['router']; 73 | 74 | $router->macro('jitsi', function () use ($router) { 75 | $router 76 | ->get('/jitsi/{room?}', ViewRoomController::class) 77 | ->name('jitsi.view-room'); 78 | }); 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | Contributions are **welcome** and will be fully **credited**. 4 | 5 | Please read and understand the contribution guide before creating an issue or pull request. 6 | 7 | ## Etiquette 8 | 9 | This project is open source, and as such, the maintainers give their free time to build and maintain the source code 10 | held within. They make the code freely available in the hope that it will be of use to other developers. It would be 11 | extremely unfair for them to suffer abuse or anger for their hard work. 12 | 13 | Please be considerate towards maintainers when raising issues or presenting pull requests. Let's show the 14 | world that developers are civilized and selfless people. 15 | 16 | It's the duty of the maintainer to ensure that all submissions to the project are of sufficient 17 | quality to benefit the project. Many developers have different skillsets, strengths, and weaknesses. Respect the maintainer's decision, and do not be upset or abusive if your submission is not used. 18 | 19 | ## Viability 20 | 21 | When requesting or submitting new features, first consider whether it might be useful to others. Open 22 | source projects are used by many developers, who may have entirely different needs to your own. Think about 23 | whether or not your feature is likely to be used by other users of the project. 24 | 25 | ## Procedure 26 | 27 | Before filing an issue: 28 | 29 | - Attempt to replicate the problem, to ensure that it wasn't a coincidental incident. 30 | - Check to make sure your feature suggestion isn't already present within the project. 31 | - Check the pull requests tab to ensure that the bug doesn't have a fix in progress. 32 | - Check the pull requests tab to ensure that the feature isn't already in progress. 33 | 34 | Before submitting a pull request: 35 | 36 | - Check the codebase to ensure that your feature doesn't already exist. 37 | - Check the pull requests to ensure that another person hasn't already submitted the feature or fix. 38 | 39 | ## Requirements 40 | 41 | If the project maintainer has any additional requirements, you will find them listed here. 42 | 43 | - **[PSR-2 Coding Standard](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md)** - The easiest way to apply the conventions is to install [PHP Code Sniffer](https://pear.php.net/package/PHP_CodeSniffer). 44 | 45 | - **Add tests!** - Your patch won't be accepted if it doesn't have tests. 46 | 47 | - **Document any change in behaviour** - Make sure the `README.md` and any other relevant documentation are kept up-to-date. 48 | 49 | - **Consider our release cycle** - We try to follow [SemVer v2.0.0](https://semver.org/). Randomly breaking public APIs is not an option. 50 | 51 | - **One pull request per feature** - If you want to do more than one thing, send multiple pull requests. 52 | 53 | - **Send coherent history** - Make sure each individual commit in your pull request is meaningful. If you had to make multiple intermediate commits while developing, please [squash them](https://www.git-scm.com/book/en/v2/Git-Tools-Rewriting-History#Changing-Multiple-Commit-Messages) before submitting. 54 | 55 | **Happy coding**! 56 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Laravel Jitsi 2 | 3 | [![Latest Version on Packagist](https://img.shields.io/packagist/v/amyisme13/laravel-jitsi.svg?style=flat-square)](https://packagist.org/packages/amyisme13/laravel-jitsi) 4 | [![Build Status](https://img.shields.io/travis/amyisme13/laravel-jitsi/master.svg?style=flat-square)](https://travis-ci.org/amyisme13/laravel-jitsi) 5 | [![Total Downloads](https://img.shields.io/packagist/dt/amyisme13/laravel-jitsi.svg?style=flat-square)](https://packagist.org/packages/amyisme13/laravel-jitsi) 6 | 7 | A package to generate view of a Jitsi Meet room using Jitsi Meet IFrame API. 8 | 9 | ## Jitsi Meet Prerequisites 10 | 11 | Your Jitsi Meet host must use the token authentication. Currently this package also require your Jitsi Host to allow anonymous user to join by configuring the anonymousdomain (might change later). 12 | 13 | If you are self-hosting your Jitsi Meet instance, here are some article that might help: 14 | 15 | - [JWT token authentication Prosody plugin](https://github.com/jitsi/lib-jitsi-meet/blob/master/doc/tokens.md) 16 | - [Rocket Chat part 3: Installing Jitsi with JWT for secure video conferencing](https://medium.com/@szewong/rocket-chat-part-3-installing-jitsi-with-jwt-for-secure-video-conferencing-b6f909e7f92c) 17 | - [Here’s how you should install jitsi-meet-tokens on debian 10 (luajwtjitsi problem)](https://community.jitsi.org/t/heres-how-you-should-install-jitsi-meet-tokens-on-debian-10/59606) 18 | - [Compile your own lua_cjson](https://community.jitsi.org/t/jwt-token-authentication-broken-on-debian-10-with-openssl-1-1/31027/5) 19 | - [Prosody token + anonymous authentication config](https://github.com/jitsi/jitsi-meet/pull/5025#issuecomment-580013383) 20 | 21 | ## Installation 22 | 23 | You can install the package via composer: 24 | 25 | ```bash 26 | composer require amyisme13/laravel-jitsi 27 | ``` 28 | 29 | Add these variables to your .env file 30 | 31 | ```bash 32 | # Domain of the jitsi meet instance 33 | JITSI_APP_DOMAIN= 34 | # App id 35 | JITSI_APP_ID= 36 | # Secret key used to generate jwt 37 | JITSI_APP_SECRET= 38 | ``` 39 | 40 | Add the trait `\Amyisme13\LaravelJitsi\Traits\HasJitsiAttributes` to your **User** model. 41 | 42 | ```php 43 | use Amyisme13\LaravelJitsi\Traits\HasJitsiAttributes; 44 | use Illuminate\Notifications\Notifiable; 45 | use Illuminate\Contracts\Auth\MustVerifyEmail; 46 | use Illuminate\Foundation\Auth\User as Authenticatable; 47 | 48 | class User extends Authenticatable 49 | { 50 | <...> 51 | use HasJitsiAttributes; 52 | <...> 53 | } 54 | ``` 55 | 56 | ## Simple Usage 57 | 58 | In your `web.php` route file, call the `jitsi` route macro. 59 | 60 | ```php 61 | Route::jitsi(); 62 | ``` 63 | 64 | Then visit `/jitsi/` to join a conference call. Visiting this url when you are authenticated will set your display name, email, avatar and also grant you the moderator role. 65 | 66 | ## TODO: More Usage 67 | 68 | ## Testing 69 | 70 | ```bash 71 | composer test 72 | ``` 73 | 74 | ## Changelog 75 | 76 | Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently. 77 | 78 | ## Contributing 79 | 80 | Please see [CONTRIBUTING](CONTRIBUTING.md) for details. 81 | 82 | ## Security 83 | 84 | If you discover any security related issues, please email amy.azmim@gmail.com instead of using the issue tracker. 85 | 86 | ## Credits 87 | 88 | - [Azmi Makarima](https://github.com/amyisme13) 89 | - [All Contributors](../../contributors) 90 | 91 | ## License 92 | 93 | The MIT License (MIT). Please see [License File](LICENSE.md) for more information. 94 | 95 | ## Laravel Package Boilerplate 96 | 97 | This package was generated using the [Laravel Package Boilerplate](https://laravelpackageboilerplate.com). 98 | --------------------------------------------------------------------------------