@@ -187,10 +187,6 @@ public function settingsController_topcoder_create($sender) {
187
187
$ cf ->form ()->validateRule ('Plugins.Topcoder.RoleApiURI ' , 'ValidateRequired ' , t ('You must provide Role API URI. ' ));
188
188
$ cf ->form ()->validateRule ('Plugins.Topcoder.ResourceRolesApiURI ' , 'ValidateRequired ' , t ('You must provide Resource Roles API URI. ' ));
189
189
$ cf ->form ()->validateRule ('Plugins.Topcoder.ResourcesApiURI ' , 'ValidateRequired ' , t ('You must provide Resources API URI. ' ));
190
- $ isEmbedded = (bool ) c ('Garden.Embed.Allow ' );
191
- if ($ isEmbedded ) {
192
- $ cf ->form ()->validateRule ('Plugins.Topcoder.MicroFrontendsForumsURL ' , 'ValidateRequired ' , t ('You must provide Micro-Frontends Forums URL. ' ));
193
- }
194
190
$ cf ->form ()->validateRule ('Plugins.Topcoder.MemberProfileURL ' , 'ValidateRequired ' , t ('You must provide Member Profile URL. ' ));
195
191
if ($ cf ->form ()->getFormValue ('Plugins.Topcoder.UseTopcoderAuthToken ' ) == 1 ) {
196
192
$ cf ->form ()->validateRule ('AuthenticationProvider.SignInUrl ' , 'ValidateRequired ' , t ('You must provide SignIn URL. ' ));
@@ -213,7 +209,6 @@ public function settingsController_topcoder_create($sender) {
213
209
'Plugins.Topcoder.RoleApiURI ' => ['Control ' => 'TextBox ' , 'Default ' => '' , 'Description ' => 'Topcoder Role API URI ' ],
214
210
'Plugins.Topcoder.ResourceRolesApiURI ' => ['Control ' => 'TextBox ' , 'Default ' => '' , 'Description ' => 'Topcoder Resource Roles API URI ' ],
215
211
'Plugins.Topcoder.ResourcesApiURI ' => ['Control ' => 'TextBox ' , 'Default ' => '' , 'Description ' => 'Topcoder Resources API URI ' ],
216
- 'Plugins.Topcoder.MicroFrontendsForumsURL ' => ['Control ' => 'TextBox ' , 'Default ' => '' , 'Description ' => 'Topcoder Micro-Frontends Forums URL ' ],
217
212
'Plugins.Topcoder.MemberProfileURL ' => ['Control ' => 'TextBox ' , 'Default ' => '' , 'Description ' => 'Topcoder Member Profile URL ' ],
218
213
'Plugins.Topcoder.UseTopcoderAuthToken ' => ['Control ' => 'CheckBox ' , 'Default ' => false , 'Description ' => 'Use Topcoder access token to log in to Vanilla ' ],
219
214
'AuthenticationProvider.SignInUrl ' => ['Control ' => 'TextBox ' , 'Default ' => '' , 'Description ' => 'Topcoder SignIn URL ' ],
@@ -1964,67 +1959,19 @@ private static function topcoderUserCache($userFields) {
1964
1959
1965
1960
// Support Micro-frontends forums app
1966
1961
public function gdn_dispatcher_beforeDispatch_handler ($ sender , $ args ) {
1967
- $ mfeUrl = c ("Plugins.Topcoder.MicroFrontendsForumsURL " );
1968
- $ deliveryType = Gdn::request ()->getQueryItem ("DeliveryType " );
1969
- $ remoteUrl = Gdn::request ()->getQueryItem ("remote " )? urldecode (Gdn::request ()->getQueryItem ("remote " )):"" ;
1962
+ $ mfeUrl = c ("Garden.Embed.RemoteUrl " );
1970
1963
$ isEmbedded = (bool ) c ('Garden.Embed.Allow ' , false );
1971
1964
1972
1965
$ data = array (
1973
- 'Garden.Embed.Allow ' => c ( ' Garden.Embed.Allow ' ) ,
1966
+ 'Garden.Embed.Allow ' => $ isEmbedded ,
1974
1967
'MFEUrl ' => $ mfeUrl ,
1975
- 'RemoteQueryParam("remote") ' => $ remoteUrl ,
1976
- 'RemoteQueryParam("remote") == mfeUrl ' => strcmp ($ mfeUrl , $ remoteUrl ) === 0 ,
1977
1968
'Request(current fullPath) ' => Gdn::request ()->getFullPath (),
1978
- 'Request(current url) ' => Gdn::request ()->getUrl (),
1979
- 'currentUrl == mfeUrl ' => strcmp ($ mfeUrl , Gdn::request ()->getUrl ()) === 0 ,
1980
1969
'Request(pathAndQuery) ' => Gdn::request ()->pathAndQuery (),
1981
1970
'Request(Method) ' => Gdn::request ()->getMethod (),
1982
- 'Request(DeliveryType) ' =>Gdn::request ()->getQueryItem ("DeliveryType " ),
1983
- 'Request(DeliveryType calculated) ' => !($ deliveryType == "" || $ deliveryType == DELIVERY_TYPE_ALL ),
1984
1971
'Permissions ' => Gdn::session ()->getPermissionsArray (),
1985
- );
1972
+ );
1986
1973
logMessage (__FILE__ , __LINE__ , 'TopcoderPlugin ' , "Data " , json_encode ($ data ));
1987
-
1988
- self ::log ('gdn_dispatcher_beforeDispatch_handler ' , $ data );
1989
-
1990
-
1991
- if (!$ isEmbedded ) {
1992
- return ;
1993
- }
1994
-
1995
- if (Gdn::request ()->getMethod () != Gdn::request ()::METHOD_GET ) {
1996
- return ;
1997
- }
1998
- if (stringBeginsWith (Gdn::request ()->getPath (), '/api/ ' ) || stringBeginsWith (Gdn::request ()->getPath (), '/dashboard ' )
1999
- || stringBeginsWith (Gdn::request ()->getPath (), '/settings ' )
2000
- || stringBeginsWith (Gdn::request ()->getPath (), '/embed/ ' )
2001
- || stringBeginsWith (Gdn::request ()->getPath (), '/social/ ' )
2002
- || stringBeginsWith (Gdn::request ()->getPath (), '/vanilla/ ' )
2003
- || stringBeginsWith (Gdn::request ()->getPath (), '/utility/ ' ) || stringBeginsWith (Gdn::request ()->getPath (), '/notifications/ ' )
2004
- || stringBeginsWith (Gdn::request ()->getPath (), '/js/ ' )
2005
- || stringBeginsWith (Gdn::request ()->getPath (), '/applications/ ' )
2006
- || stringBeginsWith (Gdn::request ()->getPath (), '/themes/ ' )
2007
- || stringBeginsWith (Gdn::request ()->getPath (), '/dist/ ' )
2008
- || stringBeginsWith (Gdn::request ()->getPath (), '/css/ ' )
2009
- || stringBeginsWith (Gdn::request ()->getPath (), '/plugins/ ' )
2010
- || stringBeginsWith (Gdn::request ()->getPath (), '/resources/ ' )) {
2011
- return ;
2012
- }
2013
-
2014
- if (!($ deliveryType == "" || $ deliveryType == DELIVERY_TYPE_ALL )) {
2015
- return ;
2016
- }
2017
- if (stringBeginsWith (Gdn::request ()->getUrl (), $ mfeUrl )) {
2018
- return ;
2019
- }
2020
-
2021
- if (strlen ($ remoteUrl ) > 0 ){
2022
- return ;
2023
- } else {
2024
- safeHeader ("HTTP/1.1 301 Moved Permanently " );
2025
- safeHeader ("Location: " . url ($ mfeUrl ."/#/ " . Gdn::request ()->pathAndQuery ()));
2026
- exit ();
2027
- }
1974
+ // self::log('gdn_dispatcher_beforeDispatch_handler', $data);
2028
1975
}
2029
1976
2030
1977
// Topcoder Cache is used for caching Topcoder Users by handle.
0 commit comments