From 7cc4197952367c66f27de67aecf40b9dd858003d Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Thu, 14 Dec 2017 12:12:29 +0100 Subject: [PATCH] server: allow resolving absolute file paths (issue #64) --- app/browser/index.html | 18 +++++++++--------- app/main/server.js | 6 ++++-- src/browser/js/app/sourcemap.js | 2 +- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/app/browser/index.html b/app/browser/index.html index 3bcbe379..7e9fcc91 100644 --- a/app/browser/index.html +++ b/app/browser/index.html @@ -3,15 +3,15 @@ - - - - - - - - - + + + + + + + + + diff --git a/app/main/server.js b/app/main/server.js index f2ecc90d..387c8274 100644 --- a/app/main/server.js +++ b/app/main/server.js @@ -1,4 +1,3 @@ - var express = require('express')(), path = require('path'), http = require('http'), @@ -13,6 +12,7 @@ var express = require('express')(), express.get('/', function(req, res){ res.sendFile(path.resolve(__dirname + '/../browser/index.html')) }) + express.get('*', function(req, res){ if (req.path.indexOf('theme.css') != -1) { res.set('Content-Type', 'text/css'); @@ -21,8 +21,10 @@ express.get('*', function(req, res){ } else { res.send('') } + } else if (req.path.indexOf('browser/') != -1){ + res.sendFile(path.resolve(__dirname + '/..' + req.path)) } else { - res.sendFile(path.resolve(__dirname + '/../browser' + req.path)) + res.sendFile(path.resolve(req.path)) } }) diff --git a/src/browser/js/app/sourcemap.js b/src/browser/js/app/sourcemap.js index 71e916b6..23504f85 100644 --- a/src/browser/js/app/sourcemap.js +++ b/src/browser/js/app/sourcemap.js @@ -2,7 +2,7 @@ var sourceMap = require('../libs/source-map.min.js'), request = new XMLHttpRequest(), ipc = require('./ipc/') -request.open('GET', 'scripts.js.map', true) +request.open('GET', 'browser/scripts.js.map', true) request.onload = function() {