diff --git a/.gitignore b/.gitignore index a5199f6..eb79dd5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,2 @@ -node_modules/ -.idea \ No newline at end of file +node_modules +.idea diff --git a/README.md b/README.md index 011cbcc..1840e59 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # Screen Shot -![screenshot](https://raw.githubusercontent.com/efeiefei/node-file-manager/master/example/screenshot.png) +![](/image.png) # Usage @@ -18,6 +18,6 @@ Or node --harmony index.js -p 8080 -d /path/to ``` -We can run node-file-manager in terminal directly. We can specify prot add data root dir by `-p` and `-d`, default with 5000 and scripts directory. +We can run node-file-manager in terminal directly. We can specify prot add data root dir by `-p` and `-d`, default with 8080 and scripts directory. -Then, we can view localhost:8080/ in our browr. +We can see the file in every single device connected to the same wi-fi network by typing the address, which the command line tells you in the browser. diff --git a/image.png b/image.png new file mode 100644 index 0000000..200867f Binary files /dev/null and b/image.png differ diff --git a/lib/index.js b/lib/index.js index 94c6a8f..32bc605 100644 --- a/lib/index.js +++ b/lib/index.js @@ -1,5 +1,5 @@ #!/usr/bin/env node - +var http = require('http') var koa =require('koa'); var path = require('path'); var tracer = require('tracer'); @@ -51,11 +51,11 @@ global.C = { // Start Server var Tools = require('./tools'); - -var startServer = function (app, port) { - app.listen(port); - C.logger.info('listening on *.' + port); -}; + require('dns').lookup(require('os').hostname(), function (err, add, fam) { + app.listen("8080", add , function(){ + console.log("The Home Server Has Started on "+ add + "! please open this link in your browser \"" + add + ":8080\" !!!" ); + }); + }); var app = koa(); app.proxy = true; @@ -67,5 +67,4 @@ var IndexRouter = require('./routes'); app.use(mount('/', IndexRouter)); app.use(koaStatic(path.join(__dirname,'./public/'))); -startServer(app, +argv.port); diff --git a/lib/public/js/app.js b/lib/public/js/app.js index 8875c6e..f1c3a8a 100644 --- a/lib/public/js/app.js +++ b/lib/public/js/app.js @@ -201,7 +201,6 @@ FMApp.controller('FileManagerCtr', ['$scope', '$http', '$location', console.log('rename target', target); httpRequest('PUT', url, {type: 'RENAME'}, {target: target}); }; - FM.createFolder = function (folderName) { var url = 'api' + FM.curFolderPath + encodeURI(folderName); httpRequest('POST', url, {type: 'CREATE_FOLDER'}, null); diff --git a/lib/views/files.html b/lib/views/files.html index 3d2529d..94329f5 100644 --- a/lib/views/files.html +++ b/lib/views/files.html @@ -1,176 +1,432 @@ + + - File Manager + Files On Air + + - - - + + + + + + -