Comparing version
21
index.js
@@ -26,15 +26,7 @@ #!/usr/bin/env node | ||
else { | ||
// static dir | ||
if (options.static && typeof options.static === "string") { | ||
const staticServer = require("koa-static") | ||
const staticDir = path.resolve(".", options.static) | ||
app.use(staticServer(staticDir)) | ||
} | ||
// routes | ||
const router_index = new Router() | ||
// any (log) | ||
router_index.get(/^\/.*$/, (ctx, next) => { | ||
router_index.get(/^\/.*$/, async (ctx, next) => { | ||
console.info( | ||
@@ -47,4 +39,5 @@ "[INFO] ".cyan + | ||
) | ||
next() | ||
await next() | ||
}) | ||
// index | ||
@@ -60,2 +53,10 @@ router_index.get("/", (ctx, next) => { | ||
// static dir | ||
if (options.static && typeof options.static === "string") { | ||
const staticServer = require("koa-static") | ||
const staticDir = path.resolve(".", options.static) | ||
app.use(staticServer(staticDir)) | ||
} | ||
// detect the port | ||
@@ -62,0 +63,0 @@ isPortOccupied(parseInt(options.serverPort)).then(occupied => { |
{ | ||
"name": "cshell", | ||
"version": "1.1.3", | ||
"version": "1.1.4", | ||
"description": "HTTP server for bounce shell downloading", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
12475
0.1%