@@ -148,47 +148,67 @@ class LoginManager {
148148 } )
149149 }
150150
151- setupGoogle ( ) {
152- gapi . load ( 'auth2' , ( ) => {
153- this . google_auth2 = gapi . auth2 . init ( {
154- client_id : '464424051073-loi5kmcc3qev5a1lr5hvrjiqb3kcu2cl.apps.googleusercontent.com' ,
155- cookiepolicy : 'single_host_origin' ,
156- } ) ;
151+ setupGoogle ( appId ) {
152+ if ( appId === undefined ) {
153+ this . googleSignIn . hide ( ) ;
154+ } else {
155+ this . googleSignIn . show ( ) ;
156+ gapi . load ( 'auth2' , ( ) => {
157+ this . google_auth2 = gapi . auth2 . init ( {
158+ client_id : appId ,
159+ cookiepolicy : 'single_host_origin' ,
160+ } ) ;
157161
158- this . google_auth2 . attachClickHandler ( this . googleSignIn [ 0 ] , { } ,
159- ( user ) => this . _googleSuccess ( user ) ,
160- ( error ) => Notifier . error ( "Failed signing in with Google." , error ) ) ;
161- } ) ;
162+ this . google_auth2 . attachClickHandler ( this . googleSignIn [ 0 ] , { } ,
163+ ( user ) => this . _googleSuccess ( user ) ,
164+ ( error ) => Notifier . error ( "Failed signing in with Google." , error ) ) ;
165+ } ) ;
166+ }
162167 }
163168
164- setupFacebook ( ) {
165- FB . init ( {
166- appId : '198497240899387' ,
167- cookie : true ,
168- xfbml : true ,
169- autoLogAppEvents : Notifier . _debug ,
170- version : 'v2.12'
171- } ) ;
169+ setupFacebook ( appId ) {
170+ if ( appId === undefined ) {
171+ this . facebookSignIn . hide ( ) ;
172+ } else {
173+ FB . init ( {
174+ appId : appId ,
175+ cookie : true ,
176+ xfbml : true ,
177+ autoLogAppEvents : Notifier . _debug ,
178+ version : 'v2.12'
179+ } ) ;
172180
173- FB . AppEvents . logPageView ( ) ;
181+ FB . AppEvents . logPageView ( ) ;
174182
175- this . facebookSignIn . on ( 'click' , ( ) => FB . login ( ( user ) => {
176- this . _facebookSuccess ( user ) ;
177- } , {
178- scope : 'email,public_profile' ,
179- } ) ) ;
183+ this . facebookSignIn . show ( ) ;
184+ this . facebookSignIn . on ( 'click' , ( ) => FB . login ( ( user ) => {
185+ this . _facebookSuccess ( user ) ;
186+ } , {
187+ scope : 'email,public_profile' ,
188+ } ) ) ;
189+ }
180190 }
181191
182- setupGitHub ( ) {
183- this . githubSignIn . on ( 'click' , ( ) => {
184- window . location = "https://github.com/login/oauth/authorize?scope=read:user,user:email&client_id=d7057c607cf69f592239"
185- } )
192+ setupGitHub ( appId ) {
193+ if ( appId === undefined ) {
194+ this . githubSignIn . hide ( ) ;
195+ } else {
196+ this . githubSignIn . show ( ) ;
197+ this . githubSignIn . on ( 'click' , ( ) => {
198+ window . location = "https://github.com/login/oauth/authorize?scope=read:user,user:email&client_id=" + appId
199+ } )
200+ }
186201 }
187202
188- setupTwitter ( ) {
189- this . twitterSignIn . on ( 'click' , ( ) => {
190- window . location = "/TwitterStartAuthFlow"
191- } )
203+ setupTwitter ( appId ) {
204+ if ( appId === undefined ) {
205+ this . twitterSignIn . hide ( ) ;
206+ } else {
207+ this . twitterSignIn . show ( ) ;
208+ this . twitterSignIn . on ( 'click' , ( ) => {
209+ window . location = "/TwitterStartAuthFlow"
210+ } )
211+ }
192212 }
193213
194214 _showNickDialog ( params , success ) {
@@ -354,6 +374,13 @@ class LoginManager {
354374
355375 setup ( ) {
356376 Requester . request ( "fl" , { } , ( data ) => {
377+ /**
378+ * @param {object } data.aC - Auth config
379+ * @param {string } data.aC.g - Google app id
380+ * @param {string } data.aC.fb - Facebook app id
381+ * @param {string } data.aC.gh - Github app id
382+ * @param {string } data.aC.tw - Twitter app id
383+ */
357384 data . css . sort ( function ( a , b ) {
358385 return a . w - b . w ;
359386 } ) ;
@@ -368,10 +395,13 @@ class LoginManager {
368395 window . location = "/games/" ;
369396 }
370397 } else {
371- this . setupGoogle ( ) ;
372- this . setupFacebook ( ) ;
373- this . setupGitHub ( ) ;
374- this . setupTwitter ( ) ;
398+ const authConfig = data . aC ;
399+ this . setupGoogle ( authConfig . g ) ;
400+ this . setupFacebook ( authConfig . fb ) ;
401+ this . setupGitHub ( authConfig . gh ) ;
402+ this . setupTwitter ( authConfig . tw ) ;
403+
404+ Notifier . debug ( authConfig ) ;
375405
376406 switch ( getURLParameter ( "aT" ) ) {
377407 case "gh" :
0 commit comments