Permalink
Browse files

Fix mode config not being plumbed + remove extraneous bypass

  • Loading branch information...
1 parent 65b4311 commit cddbd1f7144e000318179abb4732f2fab03414b7 @joshuafcole joshuafcole committed Dec 12, 2016
Showing with 3 additions and 11 deletions.
  1. +2 −2 bin/eve.js
  2. +1 −9 src/runtime/server.ts
View
@@ -97,9 +97,9 @@ if(!filepath) {
}
let mode = Mode.workspace;
-if(filepath) mode = Mode.file
+if(filepath && !editor) mode = Mode.file
-var opts = {internal: internal, runtimeOwner: runtimeOwner, controlOwner: controlOwner, editor: editor, port: port, path: filepath, internal: internal, root: root, eveRoot: eveRoot};
+var opts = {internal: internal, runtimeOwner: runtimeOwner, controlOwner: controlOwner, editor: editor, port: port, path: filepath, internal: internal, root: root, eveRoot: eveRoot, mode};
config.init(opts);
server.run(opts);
View
@@ -186,22 +186,14 @@ function IDEMessageHandler(client:SocketRuntimeClient, message) {
let content:string;
let path:string;
- // If the client is locally controlled it's in charge of its own file management.
- // If it's requesting a gist, it needs to fetch elsewhere too.
- // This is pretty hacky, but we'll clean it up in post.
- if(config.controlOwner === Owner.client ||
- hash && hash.indexOf("gist:") === 0) {
- return ws.send(JSON.stringify({type: "initProgram", runtimeOwner, controlOwner, path, internal, withIDE: editor}));
- }
-
// If we're in file mode, the only valid file to serve is the one specified in `config.path`.
if(mode === Mode.file) {
content = eveSource.find(config.path);
path = config.path;
}
// Otherwise, anything goes. First we check if the client has requested a specific file in the URL hash.
- if(!content && hash) {
+ if(mode === Mode.workspace && hash) {
// @FIXME: This code to strip the editor hash segment out really needs to be abstacted.
let filepath = hash.split("#")[0];
if(filepath[filepath.length - 1] === "/") filepath = filepath.slice(0, -1);

0 comments on commit cddbd1f

Please sign in to comment.