File tree Expand file tree Collapse file tree 1 file changed +28
-11
lines changed
Expand file tree Collapse file tree 1 file changed +28
-11
lines changed Original file line number Diff line number Diff line change 33
44const code = window . location . toString ( ) . replace ( / .+ c o d e = / , '' ) ;
55
6- try {
7-
8- // check for cross-origin frame
9- console . log ( window . opener . location . href ) ;
6+ let isMobile = false ;
7+
8+ if ( navigator . userAgentData
9+ && navigator . userAgentData . mobile ) isMobile = true ;
10+
11+ if ( navigator . userAgent
12+ && navigator . userAgent . includes ( 'Mobile' ) ) isMobile = true ;
13+
14+
15+ if ( ! isMobile ) {
1016
11- // post login token to opening window
12- window . opener . postMessage ( code , window . location ) ;
13- window . close ( ) ;
17+ try {
18+
19+ // check for cross-origin frame
20+ console . log ( window . opener . location . href ) ;
21+
22+ // post login token to opening window
23+ window . opener . postMessage ( code , window . location ) ;
24+ window . close ( ) ;
25+
26+ } catch ( e ) {
27+
28+ // if cannot access opening window (window is cross-origin)
29+ // redirect to dev version and try posting login token from there
30+ window . location . href = window . location . protocol + '//' + 'dev.' + window . location . host + window . location . pathname + window . location . search ;
31+
32+ }
1433
15- } catch ( e ) {
34+ } else {
1635
17- // if cannot access opening window (window is cross-origin)
18- // redirect to dev version and try posting login token from there
19- window . location . href = window . location . protocol + '//' + 'dev.' + window . location . host + window . location . pathname + window . location . search ;
36+ window . location . href = '/full?gitToken=' + code ;
2037
2138}
2239
You can’t perform that action at this time.
0 commit comments