From 643b992690c91b9bcfdfd7ce5f72ff7e3cf37b87 Mon Sep 17 00:00:00 2001 From: Mark Einon Date: Mon, 15 Oct 2018 09:51:18 +0100 Subject: [PATCH 1/2] Fix copy/paste-ability of default URL presented on startup Currently the default URL message given on the console on startup is: --- Copy/paste this URL into your browser when you connect for the first time, to login with a token: http://(myip.com or 127.0.0.1):8888/?token=8fdc8 ... --- This will always need editing to use. Replace with host IP (e.g. 'myip.com') to make it copy/pastable again. --- notebook/notebookapp.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/notebook/notebookapp.py b/notebook/notebookapp.py index 56ec6deba0..f26ad45ae2 100755 --- a/notebook/notebookapp.py +++ b/notebook/notebookapp.py @@ -1432,7 +1432,7 @@ def display_url(self): url += '/' else: if self.ip in ('', '0.0.0.0'): - ip = "(%s or 127.0.0.1)" % socket.gethostname() + ip = "%s" % socket.gethostname() else: ip = self.ip url = self._url(ip) From f140ba95c4c619cbe8fbe5f82ee38906c0580203 Mon Sep 17 00:00:00 2001 From: Mark Einon Date: Mon, 15 Oct 2018 20:27:22 +0100 Subject: [PATCH 2/2] Present both possible URL options as separate copy/pastable options Currently the default URL message given on the console on startup is: --- Copy/paste this URL into your browser when you connect for the first time, to login with a token: http://(myip.com or 127.0.0.1):8888/?token=8fdc8 ... --- This will always need editing to use. Replace with one host IP (e.g. 'myip.com') option and one local ip (127.0.0.1) option to make it copy/pastable again. --- notebook/notebookapp.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/notebook/notebookapp.py b/notebook/notebookapp.py index f26ad45ae2..4f6b8cb8b1 100755 --- a/notebook/notebookapp.py +++ b/notebook/notebookapp.py @@ -1439,7 +1439,9 @@ def display_url(self): if self.token: # Don't log full token if it came from config token = self.token if self._token_generated else '...' - url = url_concat(url, {'token': token}) + url = (url_concat(url, {'token': token}) + + '\n or ' + + url_concat(self._url('127.0.0.1'), {'token': token})) return url @property