-
-
Notifications
You must be signed in to change notification settings - Fork 365
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
load all assets from localhost to set origin properly #387
Changes from all commits
6db4b65
63a6a60
2f03f27
7f1a723
a813a9b
3d4d393
7f5396b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,6 +29,18 @@ import * as path from 'path'; | |
import * as fs from 'fs'; | ||
import log from 'electron-log'; | ||
|
||
export | ||
interface IAppConfiguration { | ||
jlabPort: number; | ||
token: string; | ||
}; | ||
|
||
export | ||
const appConfig: IAppConfiguration = { | ||
jlabPort: 8888, | ||
token: 'jlab-token' | ||
}; | ||
Comment on lines
+39
to
+42
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I anticipate that a hard-coded global will cause issues once we will go for full front/back separation. But I am happy to address it myself later. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes, we can definitely improve this when we support remote backends etc. by the way, these are just default values and token is generated on the fly before server launch. |
||
|
||
export | ||
interface ISaveOptions { | ||
id: string; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you elaborate on what is happening in the
else
clause? My current understanding is that theif ()
clase is for hosting static assets andelse
assumes that if it is not a static asset, then this is a server request and modifies cookies and handles file upload, but it is not clear to me why specific parts are needed.Should we split up the handler code into separate methods to better signal the intent and have easier time in the future?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, you are right. since interceptBufferProtocol doesn't provide a default callback handler, we are having to make the requests to JupyterLab server in the
else
section. During my experiments, I found out that cookies were not properly set for some of the requests (websocket handshake?). So, to be on the safe side, I am setting them with boththis._window.webContents.session.cookies.set(cookieObject);
andrequestHeaders['Cookie'] = Array.from(cookies.values()).join('; ');
for every request. I am not sure at the moment how we can optimize this.