@@ -66,6 +66,9 @@ class ConfigService {
66
66
const FORCE_NC_BASE = 'force_nc_base ' ;
67
67
const TEST_NC_BASE = 'test_nc_base ' ;
68
68
69
+ const FRONTAL_CLOUD_ID = 'frontal_cloud_id ' ;
70
+ const FRONTAL_CLOUD_SCHEME = 'frontal_cloud_scheme ' ;
71
+
69
72
const GS_ENABLED = 'enabled ' ;
70
73
const GS_MODE = 'mode ' ;
71
74
const GS_KEY = 'key ' ;
@@ -93,6 +96,8 @@ class ConfigService {
93
96
self ::LOCAL_CLOUD_ID => '' ,
94
97
self ::FORCE_NC_BASE => '' ,
95
98
self ::TEST_NC_BASE => '' ,
99
+ self ::FRONTAL_CLOUD_ID => '' ,
100
+ self ::FRONTAL_CLOUD_SCHEME => 'https ' ,
96
101
self ::CIRCLES_ACTIVITY_ON_CREATION => '1 ' ,
97
102
self ::CIRCLES_SKIP_INVITATION_STEP => '0 ' ,
98
103
self ::CIRCLES_SEARCH_FROM_COLLABORATOR => '0 '
@@ -684,5 +689,27 @@ private function cleanLinkToRoute(string $ncBase, string $routeName, array $args
684
689
return rtrim ($ ncBase , '/ ' ) . $ link ;
685
690
}
686
691
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
+
687
714
}
688
715
0 commit comments