@@ -38,7 +38,7 @@ const MY_BINDER_BASE_URL = 'https://mybinder.org/v2/gh';
3838/**
3939 * The GitHub base url.
4040 */
41- const GITHUB_BASE_URL = 'https://github.com' ;
41+ export const DEFAULT_GITHUB_BASE_URL = 'https://github.com' ;
4242
4343/**
4444 * The className for disabling the mybinder button.
@@ -64,12 +64,12 @@ class GitHubFileBrowser extends Widget {
6464 this . userName . node . title = 'Click to edit user/organization' ;
6565 this . _browser . toolbar . addItem ( 'user' , this . userName ) ;
6666 this . userName . name . changed . connect ( this . _onUserChanged , this ) ;
67-
67+ this . baseUrl = DEFAULT_GITHUB_BASE_URL ;
6868 // Create a button that opens GitHub at the appropriate
6969 // repo+directory.
7070 this . _openGitHubButton = new ToolbarButton ( {
7171 onClick : ( ) => {
72- let url = GITHUB_BASE_URL ;
72+ let url = this . baseUrl ;
7373 // If there is no valid user, open the GitHub homepage.
7474 if ( ! this . _drive . validUser ) {
7575 window . open ( url ) ;
@@ -117,13 +117,28 @@ class GitHubFileBrowser extends Widget {
117117 this . _onPathChanged ( ) ;
118118
119119 this . _drive . rateLimitedState . changed . connect ( this . _updateErrorPanel , this ) ;
120+
120121 }
121122
122123 /**
123124 * An editable widget hosting the current user name.
124125 */
125126 readonly userName : GitHubEditableName ;
126127
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+
127142 /**
128143 * React to a change in user.
129144 */
@@ -244,6 +259,7 @@ class GitHubFileBrowser extends Widget {
244259
245260 private _browser : FileBrowser ;
246261 private _drive : GitHubDrive ;
262+ private _baseUrl : string ;
247263 private _errorPanel : GitHubErrorPanel | null ;
248264 private _openGitHubButton : ToolbarButton ;
249265 private _launchBinderButton : ToolbarButton ;
0 commit comments