Skip to content

Commit 668a711

Browse files
committed
feat: add option to not use avatars in BBB rooms
This commit adds an admin option to disable the use of Nextcloud avatars in BBB rooms. If an avatar-cache is configured and a meeting is running while changing this setting, the avatars of these meetings will not be cleared. In that case the command-line argument (see README) needs to be used. Fixes issue #268
1 parent 5935c09 commit 668a711

File tree

5 files changed

+24
-7
lines changed

5 files changed

+24
-7
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ Key | Description
7979
`app.shortener` | Value of your shortener service. Should start with `https://` and contain `{token}`.
8080
`avatar.path` | Absolute path to an optional avatar cache directory.
8181
`avatar.url` | URL which serves `avatar.path` to be used as avatar cache.
82+
`avatar.enabled` | Set to `false` if you want to disable the use of Nextcloud avatars in BBB rooms.
8283

8384
### Avatar cache (v2.2+)
8485
The generation of avatars puts a high load on your Nextcloud instance, since the
@@ -113,8 +114,8 @@ For additional security, we recommend to disable directory listing, symlinks and
113114
any language interpreter such as php for the cache directory.
114115

115116
Cached avatars are usually deleted as soon as the meeting ends. In cases the BBB
116-
server shuts down unexpected, we provide the `bbb:clear-avatar-cache` occ
117-
command (example use: `./occ bbb:clear-avatar-cache`).
117+
server shuts down unexpected or you set `avatar.enabled` to `false` (via gui or manually) while a meeting was running,
118+
we provide the `bbb:clear-avatar-cache` occ command (example use: `./occ bbb:clear-avatar-cache`).
118119

119120

120121
## :bowtie: User guide

lib/BigBlueButton/API.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,10 +130,12 @@ public function createJoinUrl(Room $room, float $creationTime, string $displayna
130130
}
131131

132132
if ($uid) {
133-
$avatarUrl = $this->avatarRepository->getAvatarUrl($room, $uid);
134-
135133
$joinMeetingParams->setUserID($uid);
136-
$joinMeetingParams->setAvatarURL($avatarUrl);
134+
135+
if ($this->config->getAppValue('bbb', 'avatar.enabled', 'true') === 'true') {
136+
$avatarUrl = $this->avatarRepository->getAvatarUrl($room, $uid);
137+
$joinMeetingParams->setAvatarURL($avatarUrl);
138+
}
137139
}
138140

139141
return $this->getServer()->getJoinMeetingURL($joinMeetingParams);

lib/Controller/HookController.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use OCA\BigBlueButton\Event\MeetingEndedEvent;
88
use OCA\BigBlueButton\Event\RecordingReadyEvent;
99
use OCA\BigBlueButton\Service\RoomService;
10+
use OCP\IConfig;
1011
use OCP\AppFramework\Controller;
1112
use OCP\EventDispatcher\IEventDispatcher;
1213
use OCP\IRequest;
@@ -27,18 +28,23 @@ class HookController extends Controller {
2728
/** @var IEventDispatcher */
2829
private $eventDispatcher;
2930

31+
/** @var IConfig */
32+
private $config;
33+
3034
public function __construct(
3135
string $appName,
3236
IRequest $request,
3337
RoomService $service,
3438
AvatarRepository $avatarRepository,
35-
IEventDispatcher $eventDispatcher
39+
IEventDispatcher $eventDispatcher,
40+
IConfig $config
3641
) {
3742
parent::__construct($appName, $request);
3843

3944
$this->service = $service;
4045
$this->avatarRepository = $avatarRepository;
4146
$this->eventDispatcher = $eventDispatcher;
47+
$this->config = $config;
4248
}
4349

4450
public function setToken(string $token): void {
@@ -65,7 +71,9 @@ public function meetingEnded($recordingmarks = false): void {
6571

6672
$this->service->updateRunning($room->getId(), false);
6773

68-
$this->avatarRepository->clearRoom($room->uid);
74+
if ($this->config->getAppValue('bbb', 'avatar.enabled', 'true') === 'true') {
75+
$this->avatarRepository->clearRoom($room->uid);
76+
}
6977

7078
$this->eventDispatcher->dispatch(MeetingEndedEvent::class, new MeetingEndedEvent($room, $recordingmarks));
7179
}

lib/Settings/Admin.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ public function getForm() {
3030
'join.theme' => $this->config->getAppValue('bbb', 'join.theme') === 'true' ? 'checked' : '',
3131
'app.shortener' => $this->config->getAppValue('bbb', 'app.shortener'),
3232
'join.mediaCheck' => $this->config->getAppValue('bbb', 'join.mediaCheck', 'true') === 'true' ? 'checked' : '',
33+
'avatar.enabled' => $this->config->getAppValue('bbb', 'avatar.enabled', 'true') === 'true' ? 'checked' : '',
3334
];
3435

3536
return new TemplateResponse('bbb', 'admin', $parameters);

templates/admin.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@
2929
<label for="bbb-join-theme"><?php p($l->t('Use Nextcloud theme in BigBlueButton.')); ?></label>
3030
</p>
3131

32+
<p>
33+
<input type="checkbox" name="avatar.enabled" id="bbb-avatar-enabled" class="checkbox bbb-setting" value="1" <?php p($_['avatar.enabled']); ?> />
34+
<label for="bbb-avatar-enabled"><?php p($l->t('Use Nextcloud avatars in BBB rooms.')); ?></label>
35+
</p>
36+
3237
<h3><?php p($l->t('Default Room Settings')); ?></h3>
3338
<p><?php p($l->t('Below you can change some default values, which are used to create a new room.')); ?></p>
3439

0 commit comments

Comments
 (0)