-
Notifications
You must be signed in to change notification settings - Fork 440
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add TURN server to personal settings. #84
Conversation
$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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whoops, some debugging leftover - will remove together with other feedback you might have.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All hail to unit tests 😉 – At least as it is a new file. :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you recommend an existing unittest for a controller I should use as starting point?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Absolutely. Gimme some mins ;-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a test in b6b263a
|
||
use OCA\Spreed\Util; | ||
|
||
\OC_Util::checkLoggedIn(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not required anymore since ownCloud 8 or so :-)
$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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would prefer something like https://github.com/nextcloud/activity/blob/master/personal.php instead :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, will update.
@@ -29,4 +29,12 @@ public static function getStunServer(IConfig $config) { | |||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems kinda strange to always have to inject IConfig and so on. Maybe make it non-static? :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well well, so much to learn... ;-)
parent::__construct('spreed'); | ||
$container = $this->getContainer(); | ||
|
||
$container->registerAlias('PersonalSettingsController', PersonalSettingsController::class); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should not be needed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 ;) |
@@ -47,4 +47,4 @@ | |||
|
|||
\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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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 <bauch@struktur.de>
Signed-off-by: Joachim Bauch <bauch@struktur.de>
Signed-off-by: Joachim Bauch <bauch@struktur.de>
Signed-off-by: Joachim Bauch <bauch@struktur.de>
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
Signed-off-by: Jan-Christoph Borchardt <hey@jancborchardt.net>
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