Better interface
parent
6baff41d8e
commit
8ccc9c1b4d
|
@ -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
|
||||
|
|
10
index.js
10
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");
|
||||
|
|
16
package.json
16
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"
|
||||
|
|
|
@ -21,15 +21,15 @@
|
|||
</main>
|
||||
</div>
|
||||
|
||||
<nav class="navbar navbar-light bg-light fixed-bottom justify-content-between">
|
||||
<div class="btn-group mr-auto" role="group">
|
||||
<a class="btn btn-primary" href="/{{path}}">
|
||||
<span class="octicon octicon-chevron-left"></span>
|
||||
Back to file list
|
||||
<nav class="navbar navbar-light bg-light fixed-bottom p-1 px-2">
|
||||
<div class="btn-group m-1" role="group">
|
||||
<a class="btn btn-primary" href="/{{path}}" data-placement="top" title="Return to folder">
|
||||
{{octicon "chevron-left"}}
|
||||
<span class="d-none d-sm-inline">Back</span>
|
||||
</a>
|
||||
<a class="btn btn-warning" href="@cmd" data-toggle="modal" data-target="#cmd">
|
||||
<span class="octicon octicon-terminal"></span>
|
||||
Run command
|
||||
<a class="btn btn-warning" href="@cmd" data-toggle="modal" data-target="#cmd" data-placement="top" title="Run another command">
|
||||
{{octicon "terminal"}}
|
||||
<span class="d-none d-sm-inline">Run command</span>
|
||||
</a>
|
||||
</div>
|
||||
</nav>
|
||||
|
|
|
@ -5,10 +5,12 @@
|
|||
<meta name="viewport" content="width=device-width" />
|
||||
<title>File Manager</title>
|
||||
|
||||
<link rel="stylesheet" href="/octicons/font/octicons.min.css" />
|
||||
<link rel="stylesheet" href="/bootstrap/css/bootstrap.min.css" />
|
||||
<link rel="stylesheet" href="/octicons/octicons.min.css" />
|
||||
|
||||
<script src="/jquery/jquery.min.js"></script>
|
||||
<link rel="stylesheet" href="/bootstrap/css/bootstrap.min.css" />
|
||||
<script src="/bootstrap/js/bootstrap.bundle.min.js"></script>
|
||||
|
||||
<script src="/filesize/filesize.js"></script>
|
||||
<script src="/socket.io/socket.io.js"></script>
|
||||
<script src="/assets/hterm_all.js"></script>
|
||||
|
|
|
@ -1,43 +1,43 @@
|
|||
<nav class="navbar navbar-light bg-light fixed-bottom p-1 px-2">
|
||||
<div class="btn-group m-1" role="group">
|
||||
<a class="btn btn-primary" href="@upload" data-toggle="modal" data-target="#upload" data-placement="top" title="Upload">
|
||||
<span class="octicon octicon-cloud-upload"></span>
|
||||
{{octicon "cloud-upload"}}
|
||||
<span class="d-none d-sm-inline">Upload</span>
|
||||
</a>
|
||||
<a class="btn btn-secondary" href="@mkdir" data-toggle="modal" data-target="#mkdir" data-placement="top" title="New folder">
|
||||
<span class="octicon octicon-file-directory"></span>
|
||||
{{octicon "file-directory"}}
|
||||
<span class="d-none d-md-inline">New folder</span>
|
||||
</a>
|
||||
</div>
|
||||
<div class="btn-group m-1" role="group">
|
||||
{{#if cmdable}}
|
||||
<a class="btn btn-warning" href="@cmd" data-toggle="modal" data-target="#cmd" data-placement="top" title="Run command">
|
||||
<span class="octicon octicon-terminal"></span>
|
||||
<span class="d-none d-md-inline">Run command</span>
|
||||
<a class="btn btn-info" href="@cmd" data-toggle="modal" data-target="#cmd" data-placement="top" title="Run command">
|
||||
{{octicon "terminal"}}
|
||||
<span class="d-none d-lg-inline">Run command</span>
|
||||
</a>
|
||||
{{/if}}
|
||||
{{#if shellable}}
|
||||
<a class="btn btn-warning" href="@shell" data-placement="top" title="Open shell">
|
||||
<span class="octicon octicon-terminal"></span>
|
||||
{{octicon "terminal"}}
|
||||
<span class="d-none d-md-inline">Open shell</span>
|
||||
</a>
|
||||
{{/if}}
|
||||
</div>
|
||||
<div class="btn-group m-1" role="group">
|
||||
<a class="btn btn-success" href="@download" data-toggle="modal" data-target="#download" data-placement="top" title="Download files as zip">
|
||||
<span class="octicon octicon-file-zip"></span>
|
||||
{{octicon "file-zip"}}
|
||||
<span class="d-none d-md-inline">Download</span>
|
||||
</a>
|
||||
</div>
|
||||
<div class="btn-group m-1" role="group">
|
||||
<a class="btn btn-danger" href="@delete" data-toggle="modal" data-target="#delete" data-placement="top" title="Delete files">
|
||||
<span class="octicon octicon-trashcan"></span>
|
||||
{{octicon "trashcan"}}
|
||||
<span class="d-none d-md-inline">Delete</span>
|
||||
</a>
|
||||
</div>
|
||||
<div class="btn-group m-1 ml-auto" role="group">
|
||||
<a class="btn btn-warning" href="./" data-placement="top" title="Refresh list">
|
||||
<span class="octicon octicon-sync"></span>
|
||||
{{octicon "sync"}}
|
||||
<span class="d-none d-lg-inline">Refresh</span>
|
||||
</a>
|
||||
</div>
|
||||
|
|
|
@ -4,14 +4,14 @@
|
|||
<main id="shell" data-path="/{{path}}"></main>
|
||||
</div>
|
||||
|
||||
<nav class="navbar navbar-light bg-light fixed-bottom justify-content-between">
|
||||
<div class="btn-group mr-auto" role="group">
|
||||
<nav class="navbar navbar-light bg-light fixed-bottom p-1 px-2">
|
||||
<div class="btn-group m-1" role="group">
|
||||
<a class="btn btn-danger" href="/{{path}}" class="shell-close" data-placement="top" title="Close and return to folder">
|
||||
<span class="octicon octicon-chevron-left"></span>
|
||||
{{octicon "chevron-left"}}
|
||||
<span class="d-none d-sm-inline">Close shell</span>
|
||||
</a>
|
||||
<a class="btn btn-warning" href="@shell" target="_blank" data-placement="top" title="Open shell in new tab">
|
||||
<span class="octicon octicon-terminal"></span>
|
||||
{{octicon "terminal"}}
|
||||
<span class="d-none d-sm-inline">New shell</span>
|
||||
</a>
|
||||
</div>
|
||||
|
|
39
yarn.lock
39
yarn.lock
|
@ -36,9 +36,9 @@ archiver-utils@^1.3.0:
|
|||
normalize-path "^2.0.0"
|
||||
readable-stream "^2.0.0"
|
||||
|
||||
archiver@^1.1.0:
|
||||
version "1.3.0"
|
||||
resolved "https://registry.yarnpkg.com/archiver/-/archiver-1.3.0.tgz#4f2194d6d8f99df3f531e6881f14f15d55faaf22"
|
||||
archiver@^2.1.1:
|
||||
version "2.1.1"
|
||||
resolved "https://registry.yarnpkg.com/archiver/-/archiver-2.1.1.tgz#ff662b4a78201494a3ee544d3a33fe7496509ebc"
|
||||
dependencies:
|
||||
archiver-utils "^1.3.0"
|
||||
async "^2.0.0"
|
||||
|
@ -47,8 +47,7 @@ archiver@^1.1.0:
|
|||
lodash "^4.8.0"
|
||||
readable-stream "^2.0.0"
|
||||
tar-stream "^1.5.0"
|
||||
walkdir "^0.0.11"
|
||||
zip-stream "^1.1.0"
|
||||
zip-stream "^1.2.0"
|
||||
|
||||
array-flatten@1.1.1:
|
||||
version "1.1.1"
|
||||
|
@ -108,7 +107,7 @@ blob@0.0.4:
|
|||
version "0.0.4"
|
||||
resolved "https://registry.yarnpkg.com/blob/-/blob-0.0.4.tgz#bcf13052ca54463f30f9fc7e95b9a47630a94921"
|
||||
|
||||
body-parser@1.18.2, body-parser@^1.15.2:
|
||||
body-parser@1.18.2, body-parser@^1.18.2:
|
||||
version "1.18.2"
|
||||
resolved "https://registry.yarnpkg.com/body-parser/-/body-parser-1.18.2.tgz#87678a19d84b47d859b83199bd59bce222b10454"
|
||||
dependencies:
|
||||
|
@ -197,7 +196,7 @@ concat-map@0.0.1:
|
|||
version "0.0.1"
|
||||
resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b"
|
||||
|
||||
connect-busboy@0.0.2:
|
||||
connect-busboy@^0.0.2:
|
||||
version "0.0.2"
|
||||
resolved "https://registry.yarnpkg.com/connect-busboy/-/connect-busboy-0.0.2.tgz#ac5c9c96672171885e576c66b2bfd95d3bb11097"
|
||||
dependencies:
|
||||
|
@ -355,7 +354,7 @@ express-handlebars@^3.0.0:
|
|||
object.assign "^4.0.3"
|
||||
promise "^7.0.0"
|
||||
|
||||
express-session@^1.14.1:
|
||||
express-session@^1.15.6:
|
||||
version "1.15.6"
|
||||
resolved "https://registry.yarnpkg.com/express-session/-/express-session-1.15.6.tgz#47b4160c88f42ab70fe8a508e31cbff76757ab0a"
|
||||
dependencies:
|
||||
|
@ -369,7 +368,7 @@ express-session@^1.14.1:
|
|||
uid-safe "~2.1.5"
|
||||
utils-merge "1.0.1"
|
||||
|
||||
express@^4.14.0:
|
||||
express@^4.16.2:
|
||||
version "4.16.2"
|
||||
resolved "https://registry.yarnpkg.com/express/-/express-4.16.2.tgz#e35c6dfe2d64b7dca0a5cd4f21781be3299e076c"
|
||||
dependencies:
|
||||
|
@ -408,7 +407,7 @@ extend@~1.2.1:
|
|||
version "1.2.1"
|
||||
resolved "https://registry.yarnpkg.com/extend/-/extend-1.2.1.tgz#a0f5fd6cfc83a5fe49ef698d60ec8a624dd4576c"
|
||||
|
||||
filesize@^3.3.0:
|
||||
filesize@^3.6.0:
|
||||
version "3.6.0"
|
||||
resolved "https://registry.yarnpkg.com/filesize/-/filesize-3.6.0.tgz#22d079615624bb6fd3c04026120628a41b3f4efa"
|
||||
|
||||
|
@ -541,7 +540,7 @@ isarray@~1.0.0:
|
|||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11"
|
||||
|
||||
jquery@^3.1.1:
|
||||
jquery@^3.3.1:
|
||||
version "3.3.1"
|
||||
resolved "https://registry.yarnpkg.com/jquery/-/jquery-3.3.1.tgz#958ce29e81c9790f31be7792df5d4d95fc57fbca"
|
||||
|
||||
|
@ -627,6 +626,10 @@ notp@^2.0.3:
|
|||
version "2.0.3"
|
||||
resolved "https://registry.yarnpkg.com/notp/-/notp-2.0.3.tgz#a9fd11e25cfe1ccb39fc6689544ee4c10ef9a577"
|
||||
|
||||
object-assign@^4.1.1:
|
||||
version "4.1.1"
|
||||
resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863"
|
||||
|
||||
object-component@0.0.3:
|
||||
version "0.0.3"
|
||||
resolved "https://registry.yarnpkg.com/object-component/-/object-component-0.0.3.tgz#f0c69aa50efc95b866c186f400a33769cb2f1291"
|
||||
|
@ -644,9 +647,11 @@ object.assign@^4.0.3:
|
|||
has-symbols "^1.0.0"
|
||||
object-keys "^1.0.11"
|
||||
|
||||
octicons@^4.4.0:
|
||||
version "4.4.0"
|
||||
resolved "https://registry.yarnpkg.com/octicons/-/octicons-4.4.0.tgz#aca3bd32f5dc1d907a8d0de744f78e0c54e19446"
|
||||
octicons@^6.0.1:
|
||||
version "6.0.1"
|
||||
resolved "https://registry.yarnpkg.com/octicons/-/octicons-6.0.1.tgz#481f4947780c495e42eef113e5b764075e226b84"
|
||||
dependencies:
|
||||
object-assign "^4.1.1"
|
||||
|
||||
on-finished@~2.3.0:
|
||||
version "2.3.0"
|
||||
|
@ -954,10 +959,6 @@ vary@~1.1.2:
|
|||
version "1.1.2"
|
||||
resolved "https://registry.yarnpkg.com/vary/-/vary-1.1.2.tgz#2299f02c6ded30d4a5961b0b9f74524a18f634fc"
|
||||
|
||||
walkdir@^0.0.11:
|
||||
version "0.0.11"
|
||||
resolved "https://registry.yarnpkg.com/walkdir/-/walkdir-0.0.11.tgz#a16d025eb931bd03b52f308caed0f40fcebe9532"
|
||||
|
||||
window-size@0.1.0:
|
||||
version "0.1.0"
|
||||
resolved "https://registry.yarnpkg.com/window-size/-/window-size-0.1.0.tgz#5438cd2ea93b202efa3a19fe8887aee7c94f9c9d"
|
||||
|
@ -1003,7 +1004,7 @@ yeast@0.1.2:
|
|||
version "0.1.2"
|
||||
resolved "https://registry.yarnpkg.com/yeast/-/yeast-0.1.2.tgz#008e06d8094320c372dbc2f8ed76a0ca6c8ac419"
|
||||
|
||||
zip-stream@^1.1.0:
|
||||
zip-stream@^1.2.0:
|
||||
version "1.2.0"
|
||||
resolved "https://registry.yarnpkg.com/zip-stream/-/zip-stream-1.2.0.tgz#a8bc45f4c1b49699c6b90198baacaacdbcd4ba04"
|
||||
dependencies:
|
||||
|
|
Loading…
Reference in New Issue