Add TURN server to personal settings.#84
Conversation
personal.php
Outdated
| $uid = \OC::$server->getUserSession()->getUser()->getUID(); | ||
|
|
||
| $settings = Util::getTurnSettings($config, $uid); | ||
| //server":"1","username":"2","password":"3","protocols |
There was a problem hiding this comment.
Whoops, some debugging leftover - will remove together with other feedback you might have.
LukasReschke
left a comment
There was a problem hiding this comment.
Looks good. Some remarks below.
I'm not entirely sure if it is really required that users can configure their own TURN server as well. But well 🙈
| ); | ||
| } | ||
|
|
||
| } |
There was a problem hiding this comment.
All hail to unit tests 😉 – At least as it is a new file. :-)
There was a problem hiding this comment.
Can you recommend an existing unittest for a controller I should use as starting point?
There was a problem hiding this comment.
Absolutely. Gimme some mins ;-)
There was a problem hiding this comment.
personal.php
Outdated
|
|
||
| use OCA\Spreed\Util; | ||
|
|
||
| \OC_Util::checkLoggedIn(); |
There was a problem hiding this comment.
Not required anymore since ownCloud 8 or so :-)
personal.php
Outdated
| $settings = Util::getTurnSettings($config, $uid); | ||
| //server":"1","username":"2","password":"3","protocols | ||
| $tmpl->assign('turnSettings', $settings); | ||
| return $tmpl->fetchPage(); |
There was a problem hiding this comment.
Would prefer something like https://github.com/nextcloud/activity/blob/master/personal.php instead :-)
lib/Util.php
Outdated
| return $config->getAppValue('spreed', 'stun_server', 'stun.l.google.com:19302'); | ||
| } | ||
|
|
||
| public static function getTurnSettings(IConfig $config, string $uid) { |
There was a problem hiding this comment.
Seems kinda strange to always have to inject IConfig and so on. Maybe make it non-static? :-)
There was a problem hiding this comment.
I will create a separate PR to change this, also for the existing code.
| parent::__construct($appName, $request); | ||
| $this->l10n = $l10n; | ||
| $this->config = $config; | ||
| $this->user = $userSession && $userSession->isLoggedIn() ? $userSession->getUser() : false; |
There was a problem hiding this comment.
If you just want the UID just use $UserId and it will automatically inject the current user id. It's like the appname thingy :)
There was a problem hiding this comment.
Well well, so much to learn... ;-)
| parent::__construct('spreed'); | ||
| $container = $this->getContainer(); | ||
|
|
||
| $container->registerAlias('PersonalSettingsController', PersonalSettingsController::class); |
There was a problem hiding this comment.
this should not be needed
There was a problem hiding this comment.
Hmm, if I remove it, loading the settings fails with this error (from nextcloud.log):
"Exception: {\"Exception\":\"OCP\\\\AppFramework\\\\QueryException\",\"Message\":\"Could not resolve PersonalSettingsController! Class PersonalSettingsController does not exist\",\"Code\":0,\"Trace\":\"#0 \\\/srv\\\/www\\\/lib\\\/private\\\/AppFramework\\\/Utility\\\/SimpleContainer.php(117): OC\\\\AppFramework\\\\Utility\\\\SimpleContainer->resolve('PersonalSetting...')\\n#1 \\\/srv\\\/www\\\/lib\\\/private\\\/AppFramework\\\/DependencyInjection\\\/DIContainer.php(540): OC\\\\AppFramework\\\\Utility\\\\SimpleContainer->query('PersonalSetting...')\\n#2 \\\/srv\\\/www\\\/apps\\\/spreed\\\/personal.php(24): OC\\\\AppFramework\\\\DependencyInjection\\\\DIContainer->query('PersonalSetting...')\\n#3 \\\/srv\\\/www\\\/lib\\\/private\\\/legacy\\\/app.php(757): include('\\\/srv\\\/www\\\/apps\\\/s...')\\n#4 \\\/srv\\\/www\\\/settings\\\/personal.php(184): OC_App::getForms('personal')\\n#5 \\\/srv\\\/www\\\/lib\\\/private\\\/Route\\\/Route.php(155) : runtime-created function(1): require_once('\\\/srv\\\/www\\\/settin...')\\n#6 [internal function]: __lambda_func()\\n#7 \\\/srv\\\/www\\\/lib\\\/private\\\/Route\\\/Router.php(298): call_user_func('\\\\x00lambda_603', Array)\\n#8 \\\/srv\\\/www\\\/lib\\\/base.php(1000): OC\\\\Route\\\\Router->match('\\\/settings\\\/perso...')\\n#9 \\\/srv\\\/www\\\/index.php(40): OC::handleRequest()\\n#10 {main}\",\"File\":\"\\\/srv\\\/www\\\/lib\\\/private\\\/AppFramework\\\/Utility\\\/SimpleContainer.php\",\"Line\":102}"
56094da to
2a3229d
Compare
fe97298 to
45e0267
Compare
|
Just FYI: I rebased this ;) |
| \OCP\Util::connectHook('OC_User', 'post_deleteUser', \OCA\Spreed\Util::class, 'deleteUser'); | ||
|
|
||
| OC_App::registerPersonal('spreed', 'personal'); | ||
| \OCP\App::registerPersonal('spreed', 'personal'); |
There was a problem hiding this comment.
@fancycode This fixes the app:check-code CI check ;)
|
I tested this and it works 👍 Code looks good :) |
|
I also fixed the naming to be »Spreed video calls« everywhere (appname and settings headers for both personal and admin settings) because we were calling it different names. :) |
214b03e to
d02b4a4
Compare
|
Squashed a couple of commits and added @LukasReschke please review |
Current coverage is 10.92% (diff: 46.15%)@@ master #84 diff @@
=========================================
Files 11 13 +2
Lines 577 641 +64
Methods 39 44 +5
Messages 0 0
Branches 0 0
=========================================
+ Hits 40 70 +30
- Misses 537 571 +34
Partials 0 0
|
|
So I know you @MorrisJobke @fancycode talked about why this is in the personal settings. But it is a really strange UX to have it there. That would mean every single user would have to specify it, and many even technical people probably never heard about it. So, let’s move it to the Admin settings please? ;) |
|
Well, the settings as-is (i.e. username and password) is per user, so the personal settings is the right place. For the Admin area we should have an additional setting to configure a shared secret to be used, but that requires some application-level code to generate TURN credentials dynamically for the different participants. I'm planning to add this in a separate PR. IMHO both settings make sense depending on the use case. |
|
@LukasReschke your call please :) (UX-wise I’d prefer if we start with it being in Admin settings first, and only then add per-user settings. Cause then they can edit based on the configured TURN server.) |
|
Agreeing with @jancborchardt. User settings do look rather confusing. An instance-wide setting seems way more user-friendly.
Based on https://github.com/andyet/signalmaster/blob/e98d388a2107330948616661064cb329d2749314/sockets.js#L105-L124 which is the signalling server that we ported this should likely be done at spreed/lib/Controller/SignallingController.php Lines 97 to 105 in 4911cc8 |
That's not how these are usually set up. Either the admin has one which creates the profiles for the users on demand or the users have a completely different one (also every user could have a different one very likely if they have one at all) |
|
I will rebase this one here to be able to merge it. Then I will look into the admin setting for the TURN server. |
This implements the second part of #2 to add TURN support. For now each user has to have an account on the TURN server. Support for shared credentials will be added in a separate PR. Signed-off-by: Joachim Bauch <[email protected]>
Signed-off-by: Joachim Bauch <[email protected]>
Signed-off-by: Joachim Bauch <[email protected]>
Signed-off-by: Joachim Bauch <[email protected]>
Signed-off-by: Morris Jobke <[email protected]>
Signed-off-by: Jan-Christoph Borchardt <[email protected]>
d02b4a4 to
df3f436
Compare
|
For the admin setting, I would recommend to use the shared-secret mode and generate username/password similar to what we are doing in spreed-webrtc: |
Yes. That was the plan :) |
|
Great 👍 |
|
Failing CI is also on master (eslint) I will fix this later. |
|
Talked with @LukasReschke and he is fine -> merge |
This implements the second part of #2 to add TURN support. For now each user
has to have an account on the TURN server. Support for shared credentials will
be added in a separate PR.
@nickvergessen @LukasReschke