diff --git a/index.js b/index.js index e4e7998..ec44e28 100644 --- a/index.js +++ b/index.js @@ -5,14 +5,14 @@ */ const vsc = require('vscode') -const { join } = require('path') +const { join, basename } = require('path') const { parse } = require('url') const http = require('http') const fs = require('iofs') const { WebSocketServer } = require('ws') -const std = vsc.window.createOutputChannel('http.server') const decode = decodeURIComponent +const statItem = vsc.window.createStatusBarItem(vsc.StatusBarAlignment.Left, 0) const MIME_TYPES = { html: 'text/html;charset=utf-8', @@ -49,6 +49,8 @@ const COMMON_HEADERS = { 'X-Powered-By': 'VS Code simple.http' } +const CONFIG_FILE = '.httpserver' + MIME_TYPES.htm = MIME_TYPES.html MIME_TYPES.jpeg = MIME_TYPES.jpg MIME_TYPES.tif = MIME_TYPES.tiff @@ -57,13 +59,9 @@ let root let enabled = false let port = 23333 let baseUrl = 'http://127.0.0.1:' + port +let server let ws = null -std.out = function (...args) { - std.appendLine('[simple.http]: ' + args.join(' ')) - // console.log('[simple.http]: ' + args.join(' ')) -} - const HMR_SCRIPT = `