Skip to content

Commit 5d14488

Browse files
ArtificialOwlbackportbot[bot]
authored andcommitted
generate gskey on first use
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
1 parent 4a7f40c commit 5d14488

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

lib/Service/ConfigService.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ class ConfigService {
4949
const CIRCLES_NON_SSL_LOCAL = 'local_is_non_ssl';
5050
const CIRCLES_SELF_SIGNED = 'self_signed_cert';
5151
const LOCAL_CLOUD_ID = 'local_cloud_id';
52+
const CIRCLES_LOCAL_GSKEY = 'local_gskey';
5253
const CIRCLES_ACTIVITY_ON_CREATION = 'creation_activity';
5354
const CIRCLES_SKIP_INVITATION_STEP = 'skip_invitation_to_closed_circles';
5455
const CIRCLES_SEARCH_FROM_COLLABORATOR = 'search_from_collaborator';
@@ -76,6 +77,7 @@ class ConfigService {
7677
self::CIRCLES_ALLOW_LINKED_GROUPS => '0',
7778
self::CIRCLES_ALLOW_FEDERATED_CIRCLES => '0',
7879
self::CIRCLES_GS_ENABLED => '0',
80+
self::CIRCLES_LOCAL_GSKEY => '',
7981
self::CIRCLES_ALLOW_NON_SSL_LINKS => '0',
8082
self::CIRCLES_NON_SSL_LOCAL => '0',
8183
self::CIRCLES_SELF_SIGNED => '0',

lib/Service/GlobalScaleService.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,11 +182,14 @@ public function getGlobalScaleEvent(GSEvent $event): AGlobalScaleEvent {
182182
* @return string
183183
*/
184184
public function getKey(): string {
185-
// TODO: include a webfinger loader in core to share public keys
186185
try {
187186
$key = $this->configService->getGSStatus(ConfigService::GS_KEY);
188187
} catch (GSStatusException $e) {
189-
$key = $this->configService->getSystemValue('instanceid');
188+
$key = $this->configService->getAppValue(ConfigService::CIRCLES_LOCAL_GSKEY);
189+
if ($key === '') {
190+
$key = $this->token(31);
191+
$this->configService->setAppValue(ConfigService::CIRCLES_LOCAL_GSKEY, $key);
192+
}
190193
}
191194

192195
return md5('gskey:' . $key);

0 commit comments

Comments
 (0)