From 8ccc9c1b4dd43abcf96369e2ce9f7df0844fb4d8 Mon Sep 17 00:00:00 2001 From: Ambrose Chua Date: Mon, 12 Mar 2018 20:17:47 +0900 Subject: [PATCH] Better interface --- README.md | 8 +++++++ index.js | 10 +++++++- package.json | 16 ++++++------- views/cmd.handlebars | 16 ++++++------- views/layouts/main.handlebars | 6 +++-- views/partials/toolbar.handlebars | 18 +++++++------- views/shell.handlebars | 8 +++---- yarn.lock | 39 ++++++++++++++++--------------- 8 files changed, 70 insertions(+), 51 deletions(-) diff --git a/README.md b/README.md index 8a99a91..6cb16ae 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,8 @@ A basic node.js file manager. ## Screenshots +These screenshots are not up-to-date. + ![](https://ambrose.makerforce.io/file-manager/login1.png) ![](https://ambrose.makerforce.io/file-manager/upl2.png) @@ -38,6 +40,12 @@ A basic node.js file manager. ## Usage +```zsh +docker run --rm -it -v $PWD:/data -p 8080:8080 registry.labs.0x.no/file-manager +``` + +OR + ```zsh git clone https://github.com/ambrosechua/file-manager.git ~/path/to/file-manager node ~/path/to/file-manager/index.js diff --git a/index.js b/index.js index b8c780d..c3d155a 100755 --- a/index.js +++ b/index.js @@ -20,6 +20,8 @@ const fs = require("fs"); const path = require("path"); const filesize = require("filesize"); +const octicons = require("octicons"); +const handlebars = require("handlebars"); let app = express(); let http = app.listen(process.env.PORT || 8080); @@ -30,6 +32,12 @@ app.engine("handlebars", hbs({ layoutsDir: path.join(__dirname, "views", "layouts"), defaultLayout: "main", helpers: { + octicon: (i, options) => { + if (!octicons[i]) { + return new handlebars.SafeString(octicons.question.toSVG()); + } + return new handlebars.SafeString(octicons[i].toSVG()); + }, eachpath: (path, options) => { if (typeof path != "string") { return ""; @@ -46,7 +54,7 @@ app.engine("handlebars", hbs({ }); }); return out; - } + }, } })); app.set("view engine", "handlebars"); diff --git a/package.json b/package.json index 20478cc..5d111e2 100644 --- a/package.json +++ b/package.json @@ -6,18 +6,18 @@ "file-manager": "./index.js" }, "dependencies": { - "archiver": "^1.1.0", - "body-parser": "^1.15.2", + "archiver": "^2.1.1", + "body-parser": "^1.18.2", "bootstrap": "^4.0.0", - "connect-busboy": "0.0.2", + "connect-busboy": "^0.0.2", "connect-flash": "^0.1.1", - "express": "^4.14.0", + "express": "^4.16.2", "express-handlebars": "^3.0.0", - "express-session": "^1.14.1", - "filesize": "^3.3.0", - "jquery": "^3.1.1", + "express-session": "^1.15.6", + "filesize": "^3.6.0", + "jquery": "^3.3.1", "notp": "^2.0.3", - "octicons": "^4.4.0", + "octicons": "^6.0.1", "pty.js": "^0.3.1", "socket.io": "^2.0.4", "thirty-two": "^1.0.2" diff --git a/views/cmd.handlebars b/views/cmd.handlebars index 0331a55..2755a1e 100644 --- a/views/cmd.handlebars +++ b/views/cmd.handlebars @@ -21,15 +21,15 @@ -