Skip to content

Commit 6e70ac0

Browse files
committed
frontal_local_id
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
1 parent 5234ffe commit 6e70ac0

File tree

3 files changed

+32
-0
lines changed

3 files changed

+32
-0
lines changed

lib/GlobalScale/FileShare.php

+2
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,8 @@ private function sharedByMail(
242242
['token' => $sharesToken->getToken()]
243243
);
244244

245+
$link = $this->configService->patchFrontalLink($link);
246+
245247
$lang = $this->configService->getCoreValueForUser($share->getSharedBy(), 'lang', '');
246248
if ($lang !== '') {
247249
$this->l10n = OC::$server->getL10N(Application::APP_NAME, $lang);

lib/GlobalScale/MemberAdd.php

+3
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,9 @@ private function getMailLinkFromShare(array $share, Member $member, string $pass
308308
'files_sharing.sharecontroller.showShare',
309309
['token' => $sharesToken->getToken()]
310310
);
311+
312+
$link = $this->configService->patchFrontalLink($link);
313+
311314
$author = $share['uid_initiator'];
312315
$filename = basename($share['file_target']);
313316

lib/Service/ConfigService.php

+27
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,9 @@ class ConfigService {
6666
const FORCE_NC_BASE = 'force_nc_base';
6767
const TEST_NC_BASE = 'test_nc_base';
6868

69+
const FRONTAL_CLOUD_ID = 'frontal_cloud_id';
70+
const FRONTAL_CLOUD_SCHEME = 'frontal_cloud_scheme';
71+
6972
const GS_ENABLED = 'enabled';
7073
const GS_MODE = 'mode';
7174
const GS_KEY = 'key';
@@ -93,6 +96,8 @@ class ConfigService {
9396
self::LOCAL_CLOUD_ID => '',
9497
self::FORCE_NC_BASE => '',
9598
self::TEST_NC_BASE => '',
99+
self::FRONTAL_CLOUD_ID => '',
100+
self::FRONTAL_CLOUD_SCHEME => 'https',
96101
self::CIRCLES_ACTIVITY_ON_CREATION => '1',
97102
self::CIRCLES_SKIP_INVITATION_STEP => '0',
98103
self::CIRCLES_SEARCH_FROM_COLLABORATOR => '0'
@@ -684,5 +689,27 @@ private function cleanLinkToRoute(string $ncBase, string $routeName, array $args
684689
return rtrim($ncBase, '/') . $link;
685690
}
686691

692+
693+
public function patchFrontalLink(string $link) {
694+
$frontal = $this->getAppValue(ConfigService::FRONTAL_CLOUD_ID);
695+
if ($frontal === '') {
696+
return $link;
697+
}
698+
699+
$parsed = parse_url($link);
700+
if (!is_array($parsed) || !array_key_exists('host', $parsed)) {
701+
return $link;
702+
}
703+
704+
if (array_key_exists('port', $parsed)) {
705+
$host = $parsed['host'] . ':' . $parsed['port'];
706+
} else {
707+
$host = $parsed['host'];
708+
}
709+
710+
return str_replace($host, $frontal, $link);
711+
}
712+
713+
687714
}
688715

0 commit comments

Comments
 (0)