Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions lib/Controller/RoomController.php
Original file line number Diff line number Diff line change
Expand Up @@ -1342,7 +1342,6 @@ public function setPassword(string $password): DataResponse {

/**
* @PublicPage
* @UseSession
* @BruteForceProtection(action=talkRoomPassword)
*
* @param string $token
Expand Down Expand Up @@ -1483,7 +1482,6 @@ public function createGuestByDialIn(): DataResponse {

/**
* @PublicPage
* @UseSession
*
* @param string $token
* @return DataResponse
Expand Down
41 changes: 15 additions & 26 deletions lib/TalkSession.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,43 +92,32 @@ protected function getValues(string $key): array {

protected function getValue(string $key, string $token): ?string {
$values = $this->getValues($key);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you check how this behaves if you reopen the session before reading it again?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this function is "protected" and the usages in this file that "write" it afterwards do it already

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But still produces arrays like:

│[error] 2022-11-02T17:56:20.000 spreed           join before["deorokdx"]1667404580.026                                                                                                  │
│[error] 2022-11-02T17:56:20.000 spreed           leave before["deorokdx"]1667404580.0406                                                                                                │
│[error] 2022-11-02T17:56:20.000 spreed           leave after[]1667404580.0694                                                                                                           │
│[error] 2022-11-02T17:56:20.000 spreed           join after["deorokdx","8bitgnry"]1667404580.084    


if (!isset($values[$token])) {
return null;
}
return $values[$token];
return $values[$token] ?? null;
}

protected function setValue(string $key, string $token, string $value): void {
$values = $this->session->get($key);
if ($values === null) {
$values = [];
} else {
$values = json_decode($values, true);
if ($values === null) {
$values = [];
}
}

$reopened = $this->session->reopen();

$values = $this->getValues($key);
$values[$token] = $value;
$this->session->set($key, json_encode($values));


if ($reopened) {
$this->session->close();
}
}

protected function removeValue(string $key, string $token): void {
$values = $this->session->get($key);
if ($values === null) {
$values = [];
} else {
$values = json_decode($values, true);
if ($values === null) {
$values = [];
} else {
unset($values[$token]);
}
}
$reopened = $this->session->reopen();

$values = $this->getValues($key);
unset($values[$token]);
$this->session->set($key, json_encode($values));

if ($reopened) {
$this->session->close();
}
}

public function renewSessionId(): void {
Expand Down