@@ -38,7 +38,7 @@ const MY_BINDER_BASE_URL = 'https://mybinder.org/v2/gh';
38
38
/**
39
39
* The GitHub base url.
40
40
*/
41
- const GITHUB_BASE_URL = 'https://github.com' ;
41
+ export const DEFAULT_GITHUB_BASE_URL = 'https://github.com' ;
42
42
43
43
/**
44
44
* The className for disabling the mybinder button.
@@ -64,12 +64,12 @@ class GitHubFileBrowser extends Widget {
64
64
this . userName . node . title = 'Click to edit user/organization' ;
65
65
this . _browser . toolbar . addItem ( 'user' , this . userName ) ;
66
66
this . userName . name . changed . connect ( this . _onUserChanged , this ) ;
67
-
67
+ this . baseUrl = DEFAULT_GITHUB_BASE_URL ;
68
68
// Create a button that opens GitHub at the appropriate
69
69
// repo+directory.
70
70
this . _openGitHubButton = new ToolbarButton ( {
71
71
onClick : ( ) => {
72
- let url = GITHUB_BASE_URL ;
72
+ let url = this . baseUrl ;
73
73
// If there is no valid user, open the GitHub homepage.
74
74
if ( ! this . _drive . validUser ) {
75
75
window . open ( url ) ;
@@ -117,13 +117,28 @@ class GitHubFileBrowser extends Widget {
117
117
this . _onPathChanged ( ) ;
118
118
119
119
this . _drive . rateLimitedState . changed . connect ( this . _updateErrorPanel , this ) ;
120
+
120
121
}
121
122
122
123
/**
123
124
* An editable widget hosting the current user name.
124
125
*/
125
126
readonly userName : GitHubEditableName ;
126
127
128
+ /**
129
+ * The GitHub base URL
130
+ */
131
+ get baseUrl ( ) : string {
132
+ return this . _baseUrl ;
133
+ }
134
+
135
+ /**
136
+ * The GitHub base URL is set by the settingsRegistry change hook
137
+ */
138
+ set baseUrl ( url : string ) {
139
+ this . _baseUrl = url ;
140
+ }
141
+
127
142
/**
128
143
* React to a change in user.
129
144
*/
@@ -244,6 +259,7 @@ class GitHubFileBrowser extends Widget {
244
259
245
260
private _browser : FileBrowser ;
246
261
private _drive : GitHubDrive ;
262
+ private _baseUrl : string ;
247
263
private _errorPanel : GitHubErrorPanel | null ;
248
264
private _openGitHubButton : ToolbarButton ;
249
265
private _launchBinderButton : ToolbarButton ;
0 commit comments