Giter Club home page Giter Club logo

nfile's Introduction

NFile

Build Status

A file system based on nodejs & easyui. You can use it to edit / view / upload / download file.

how to run it.

# prepare directory(it makes deploy more easier.)
mkdir -p /shushanfx/node/data
cd /shushanfx/node
# check out from github 
git clone "https://github.com/shushanfx/nfile.git"
# install dependencies and start it.
cd nfile
npm install && npm start

use npm run dev for development and make use you have already installed supervisor.

config

You can adjust the config as your wish. Config is placed in server.json.

{
    "port": 18081,
    "name": "File System",
    "cnName": "文件管理系统",
    "company": "shushanfx.com",
    "description": "文件管理系统",
    "base": "/", // you can set to /nfile
    "workspace": {
        "path": "/shushanfx/node/data", // file path.
        "workspace": "/shushanfx/node/nfile"
    }
}

When the base parameter is not null or /, it means that you have set a prefix for your webside, thus you must browser your website by http://${host}:${port}/${base}

preview

It looks like the follow:
index.png contextmenu.png

Add a new preview path/file/list, it can display like this:

list.png

Thanks

Thanks to those who made contribution a lot:

  • [shushanfx]
  • [dengjianxin]

Deloy with docker

Those days, i tried to delopy the project on docker, fortunately, it successed. The deploy command as follow:

# docker command
docker run --name shushanfx-node -v /shushanfx/node/data:/shushanfx/node/data -v /shushanfx/node/nfile:/usr/src/app -p 127.0.0.1:18081:18081 -d node:onbuild sh -c "npm install && npm start"
  • Mount two direcories:/shushanfx/node/data to /shushanfx/node/data(in docker container), /shushanfx/node/nfile to /usr/src/app(in docker container).
  • Parameter -d means run in background
  • The command sh -c "npm install && npm start", which execute two commands in one time, you must use sh -c [parameter], or the second command will be executed in docker container.

SSH into docker image

In case you need to ssh into the docker image you can do so:

# asume the docker name is shushanfx-node
docker exec -t -i shushanfx-node /bin/bash

You can refer docker exec command here

With Nginx

If you want to deloy the server by nginx, you can make the nginx config like this:

upstream node_file {
        server 127.0.0.1:18081;
        keepalive 10;
}

server {
        listen 80;
        server_name your.server.name;

        # use nginx to server static file. 
        root /shushanfx/node/nfile/static;

        location ~* \.(js|css|png|gif|jpg|ico) {
                expires 30d;
        }
        location / {
                proxy_pass http://node_file;
                proxy_set_header Host "your.server.name";
                proxy_set_header X-Real-IP $remote_addr;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_connect_timeout 2;
                proxy_read_timeout 5;
        }
}

Change logs

Please refer to change logs

nfile's People

Contributors

shushanfx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

nfile's Issues

when npm install && npm start error!

this is message:
E:\WorkSpace\WebStorm\nfile-master>npm install && npm start
[email protected] E:\WorkSpace\WebStorm\nfile-master
+-- UNMET PEER DEPENDENCY [email protected] - 3
`-- UNMET PEER DEPENDENCY popper.js@^1.12.3

npm WARN enoent ENOENT: no such file or directory, open 'E:\WorkSpace\WebStorm\nfile-master\node_modules_@[email protected]@@types\package.json'
npm WARN [email protected] requires a peer of [email protected] - 3 but none was installed.
npm WARN [email protected] requires a peer of popper.js@^1.12.3 but none was installed.
npm WARN [email protected] requires a peer of [email protected] - 3 but none was installed.
npm WARN [email protected] requires a peer of popper.js@^1.12.3 but none was installed.
npm WARN [email protected] requires a peer of [email protected] - 3 but none was installed.
npm WARN [email protected] requires a peer of popper.js@^1.12.3 but none was installed.

配置完后,报错。不知道怎么搞。Cannot read property 'length' of undefined

[root@SZB-L0036176 nfile]# cat server.json
{
{
"port": 18081,
"name": "File System",
"cnName": "文件管理系统",
"company": "file.shushanfx.com",
"description": "文件管理系统",
"base": "/",
"workspace": {
"path": "/root/apps/data",
"pwd": "/root/apps/nfile"
},
"logger": {
"format": ":remote-addr - :remote-user [:date[iso]] ":method :url HTTP/:http-version" :status :res[content-length] ":referrer" ":user-agent""
},
"marked": {
"sanitize": false
}
}
[root@SZB-L0036176 nfile]# vi server.json
[root@SZB-L0036176 nfile]# npm start

[email protected] start /root/apps/nfile
node index.js

local server file is not exits, use default config...
Express server listening on port 18081
^C
[root@SZB-L0036176 nfile]# ls
doc gulpconfig.json index.js jade_dist npm-debug.log package-lock.json server.json src
Dockerfile gulpfile.js jade node_modules package.json readme.md spec static
[root@SZB-L0036176 nfile]# npm start

[email protected] start /root/apps/nfile
node index.js

local server file is not exits, use default config...
Express server listening on port 18081
^C
[root@SZB-L0036176 nfile]# vi server.json
[root@SZB-L0036176 nfile]# npm start

[email protected] start /root/apps/nfile
node index.js

local server file is not exits, use default config...
Express server listening on port 18081
{ TypeError: /root/apps/nfile/jade/file/list.jade:85
83| h4.title 最新文章
84| .content.recent-post

85| for item, index in topList
86| .recent-single-post
87| a.post-title(href="#{base}#{'/readme/'}#{item.fsPath}",target="#{item.tag == '下载' ? '' : '_blank'}") #{item.fsPath}
88| .date #{item.mtime}

Cannot read property 'length' of undefined
at eval (:1018:31)
at eval (:1085:4)
at eval (:1426:22)
at res (/root/apps/nfile/node_modules/jade/lib/index.js:219:38)
at Object.exports.renderFile (/root/apps/nfile/node_modules/jade/lib/index.js:380:38)
at Object.exports.renderFile (/root/apps/nfile/node_modules/jade/lib/index.js:370:21)
at View.exports.__express [as engine] (/root/apps/nfile/node_modules/jade/lib/index.js:417:11)
at View.render (/root/apps/nfile/node_modules/express/lib/view.js:128:8)
at tryRender (/root/apps/nfile/node_modules/express/lib/application.js:640:10)
at EventEmitter.render (/root/apps/nfile/node_modules/express/lib/application.js:592:3)
at ServerResponse.render (/root/apps/nfile/node_modules/express/lib/response.js:971:7)
at /root/apps/nfile/src/router/FileView.js:121:17
at Layer.handle [as handle_request] (/root/apps/nfile/node_modules/express/lib/router/layer.js:95:5)
at next (/root/apps/nfile/node_modules/express/lib/router/route.js:137:13)
at Route.dispatch (/root/apps/nfile/node_modules/express/lib/router/route.js:112:3)
at Layer.handle [as handle_request] (/root/apps/nfile/node_modules/express/lib/router/layer.js:95:5)
at /root/apps/nfile/node_modules/express/lib/router/index.js:281:22
at Function.process_params (/root/apps/nfile/node_modules/express/lib/router/index.js:335:12)
at next (/root/apps/nfile/node_modules/express/lib/router/index.js:275:10)
at /root/apps/nfile/src/router.js:80:9
at Layer.handle [as handle_request] (/root/apps/nfile/node_modules/express/lib/router/layer.js:95:5)
at trim_prefix (/root/apps/nfile/node_modules/express/lib/router/index.js:317:13)
at /root/apps/nfile/node_modules/express/lib/router/index.js:284:7
at Function.process_params (/root/apps/nfile/node_modules/express/lib/router/index.js:335:12)
at next (/root/apps/nfile/node_modules/express/lib/router/index.js:275:10)
at /root/apps/nfile/src/router.js:49:9
at Layer.handle [as handle_request] (/root/apps/nfile/node_modules/express/lib/router/layer.js:95:5)
at trim_prefix (/root/apps/nfile/node_modules/express/lib/router/index.js:317:13)
at /root/apps/nfile/node_modules/express/lib/router/index.js:284:7
at Function.process_params (/root/apps/nfile/node_modules/express/lib/router/index.js:335:12)
at next (/root/apps/nfile/node_modules/express/lib/router/index.js:275:10)
at Function.handle (/root/apps/nfile/node_modules/express/lib/router/index.js:174:3)
at router (/root/apps/nfile/node_modules/express/lib/router/index.js:47:12)
at Layer.handle [as handle_request] (/root/apps/nfile/node_modules/express/lib/router/layer.js:95:5)
at trim_prefix (/root/apps/nfile/node_modules/express/lib/router/index.js:317:13)
at /root/apps/nfile/node_modules/express/lib/router/index.js:284:7
at Function.process_params (/root/apps/nfile/node_modules/express/lib/router/index.js:335:12)
at next (/root/apps/nfile/node_modules/express/lib/router/index.js:275:10)
at Layer.handle [as handle_request] (/root/apps/nfile/node_modules/express/lib/router/layer.js:91:12)
at trim_prefix (/root/apps/nfile/node_modules/express/lib/router/index.js:317:13)
at /root/apps/nfile/node_modules/express/lib/router/index.js:284:7
at Function.process_params (/root/apps/nfile/node_modules/express/lib/router/index.js:335:12)
at next (/root/apps/nfile/node_modules/express/lib/router/index.js:275:10)
at SendStream.error (/root/apps/nfile/node_modules/serve-static/index.js:121:7)
at emitOne (events.js:96:13)
at SendStream.emit (events.js:188:7)
at SendStream.error (/root/apps/nfile/node_modules/send/index.js:282:17)
at SendStream.onStatError (/root/apps/nfile/node_modules/send/index.js:433:12)
at next (/root/apps/nfile/node_modules/send/index.js:771:28)
at /root/apps/nfile/node_modules/send/index.js:779:23
at FSReqWrap.oncomplete (fs.js:123:15)
path: '/root/apps/nfile/jade/file/list.jade' }
::ffff:10.6.180.14 - - [2018-04-10T10:37:11.901Z] "GET / HTTP/1.1" 200 1078 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36"
::ffff:10.6.180.14 - - [2018-04-10T10:37:11.944Z] "GET /admin/css/default.css HTTP/1.1" 304 - "http://10.20.15.190:18081/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36"
::ffff:10.6.180.14 - - [2018-04-10T10:37:11.951Z] "GET /theme/default/easyui.css HTTP/1.1" 304 - "http://10.20.15.190:18081/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36"
::ffff:10.6.180.14 - - [2018-04-10T10:37:11.952Z] "GET /theme/icon.css HTTP/1.1" 304 - "http://10.20.15.190:18081/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36"
::ffff:10.6.180.14 - - [2018-04-10T10:37:11.953Z] "GET /css/icon.css HTTP/1.1" 304 - "http://10.20.15.190:18081/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36"
::ffff:10.6.180.14 - - [2018-04-10T10:37:11.953Z] "GET /js/jquery.min.js HTTP/1.1" 304 - "http://10.20.15.190:18081/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36"
::ffff:10.6.180.14 - - [2018-04-10T10:37:11.953Z] "GET /js/jquery.easyui.min.js HTTP/1.1" 304 - "http://10.20.15.190:18081/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36"
::ffff:10.6.180.14 - - [2018-04-10T10:37:11.954Z] "GET /js/utils.js HTTP/1.1" 304 - "http://10.20.15.190:18081/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36"
{ TypeError: /root/apps/nfile/jade/file/list.jade:85
83| h4.title 最新文章
84| .content.recent-post

85| for item, index in topList
86| .recent-single-post
87| a.post-title(href="#{base}#{'/readme/'}#{item.fsPath}",target="#{item.tag == '下载' ? '' : '_blank'}") #{item.fsPath}
88| .date #{item.mtime}

Cannot read property 'length' of undefined
at eval (:1018:31)
at eval (:1085:4)
at eval (:1426:22)
at res (/root/apps/nfile/node_modules/jade/lib/index.js:219:38)
at Object.exports.renderFile (/root/apps/nfile/node_modules/jade/lib/index.js:380:38)
at Object.exports.renderFile (/root/apps/nfile/node_modules/jade/lib/index.js:370:21)
at View.exports.__express [as engine] (/root/apps/nfile/node_modules/jade/lib/index.js:417:11)
at View.render (/root/apps/nfile/node_modules/express/lib/view.js:128:8)
at tryRender (/root/apps/nfile/node_modules/express/lib/application.js:640:10)
at EventEmitter.render (/root/apps/nfile/node_modules/express/lib/application.js:592:3)
at ServerResponse.render (/root/apps/nfile/node_modules/express/lib/response.js:971:7)
at /root/apps/nfile/src/router/FileView.js:121:17
at Layer.handle [as handle_request] (/root/apps/nfile/node_modules/express/lib/router/layer.js:95:5)
at next (/root/apps/nfile/node_modules/express/lib/router/route.js:137:13)
at Route.dispatch (/root/apps/nfile/node_modules/express/lib/router/route.js:112:3)
at Layer.handle [as handle_request] (/root/apps/nfile/node_modules/express/lib/router/layer.js:95:5)
at /root/apps/nfile/node_modules/express/lib/router/index.js:281:22
at Function.process_params (/root/apps/nfile/node_modules/express/lib/router/index.js:335:12)
at next (/root/apps/nfile/node_modules/express/lib/router/index.js:275:10)
at /root/apps/nfile/src/router.js:80:9
at Layer.handle [as handle_request] (/root/apps/nfile/node_modules/express/lib/router/layer.js:95:5)
at trim_prefix (/root/apps/nfile/node_modules/express/lib/router/index.js:317:13)
at /root/apps/nfile/node_modules/express/lib/router/index.js:284:7
at Function.process_params (/root/apps/nfile/node_modules/express/lib/router/index.js:335:12)
at next (/root/apps/nfile/node_modules/express/lib/router/index.js:275:10)
at /root/apps/nfile/src/router.js:49:9
at Layer.handle [as handle_request] (/root/apps/nfile/node_modules/express/lib/router/layer.js:95:5)
at trim_prefix (/root/apps/nfile/node_modules/express/lib/router/index.js:317:13)
at /root/apps/nfile/node_modules/express/lib/router/index.js:284:7
at Function.process_params (/root/apps/nfile/node_modules/express/lib/router/index.js:335:12)
at next (/root/apps/nfile/node_modules/express/lib/router/index.js:275:10)
at Function.handle (/root/apps/nfile/node_modules/express/lib/router/index.js:174:3)
at router (/root/apps/nfile/node_modules/express/lib/router/index.js:47:12)
at Layer.handle [as handle_request] (/root/apps/nfile/node_modules/express/lib/router/layer.js:95:5)
at trim_prefix (/root/apps/nfile/node_modules/express/lib/router/index.js:317:13)
at /root/apps/nfile/node_modules/express/lib/router/index.js:284:7
at Function.process_params (/root/apps/nfile/node_modules/express/lib/router/index.js:335:12)
at next (/root/apps/nfile/node_modules/express/lib/router/index.js:275:10)
at Layer.handle [as handle_request] (/root/apps/nfile/node_modules/express/lib/router/layer.js:91:12)
at trim_prefix (/root/apps/nfile/node_modules/express/lib/router/index.js:317:13)
at /root/apps/nfile/node_modules/express/lib/router/index.js:284:7
at Function.process_params (/root/apps/nfile/node_modules/express/lib/router/index.js:335:12)
at next (/root/apps/nfile/node_modules/express/lib/router/index.js:275:10)
at SendStream.error (/root/apps/nfile/node_modules/serve-static/index.js:121:7)
at emitOne (events.js:96:13)
at SendStream.emit (events.js:188:7)
at SendStream.error (/root/apps/nfile/node_modules/send/index.js:282:17)
at SendStream.onStatError (/root/apps/nfile/node_modules/send/index.js:433:12)
at next (/root/apps/nfile/node_modules/send/index.js:771:28)
at /root/apps/nfile/node_modules/send/index.js:779:23
at FSReqWrap.oncomplete (fs.js:123:15)
path: '/root/apps/nfile/jade/file/list.jade' }
::ffff:10.6.180.14 - - [2018-04-10T10:37:15.494Z] "GET / HTTP/1.1" 304 - "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36"
::ffff:10.6.180.14 - - [2018-04-10T10:37:15.577Z] "GET /admin/css/default.css HTTP/1.1" 304 - "http://10.20.15.190:18081/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36"
::ffff:10.6.180.14 - - [2018-04-10T10:37:15.578Z] "GET /theme/default/easyui.css HTTP/1.1" 304 - "http://10.20.15.190:18081/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36"
::ffff:10.6.180.14 - - [2018-04-10T10:37:15.580Z] "GET /theme/icon.css HTTP/1.1" 304 - "http://10.20.15.190:18081/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36"
::ffff:10.6.180.14 - - [2018-04-10T10:37:15.580Z] "GET /css/icon.css HTTP/1.1" 304 - "http://10.20.15.190:18081/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36"
::ffff:10.6.180.14 - - [2018-04-10T10:37:15.581Z] "GET /js/jquery.min.js HTTP/1.1" 304 - "http://10.20.15.190:18081/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36"
::ffff:10.6.180.14 - - [2018-04-10T10:37:15.581Z] "GET /js/jquery.easyui.min.js HTTP/1.1" 304 - "http://10.20.15.190:18081/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36"
::ffff:10.6.180.14 - - [2018-04-10T10:37:15.582Z] "GET /js/utils.js HTTP/1.1" 304 - "http://10.20.15.190:18081/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36"
packet_write_wait: Connection to 10.20.15.190 port 22: Broken pipe

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.