GithubHelp home page GithubHelp logo

izissise / nginx-explorer Goto Github PK

View Code? Open in Web Editor NEW
10.0 1.0 3.0 581 KB

File explorer in javascript, file come from nginx autoindex

License: MIT License

JavaScript 94.08% Shell 5.92%
nginx-explorer javascript nginx file-upload files basicauth warez download

nginx-explorer's Introduction

nginx-explorer

File explorer in javascript, web based using nginx for directory listing

Support upload and basic auth

Icons must be downloaded see dev.sh

You can remove the upload and basic auth from the nginx conf and it will automatically disable it client side.

example

Quick launch with docker

./dev.sh

Go to 127.0.0.1:8080 with you browser.

Upload fixup command

Uploaded files might arrive chunked, the following command will concatenate the chunks into filename.

It should be ran into the upload directory

find ./ -type f | while read -r i; do if [ ! -f "$i" ]; then continue; fi && read -r -n 12 head < "$i" && if [ "$head" != "#upload_meta" ]; then continue; fi && name="$(grep -v "#" "$i" | jq -r ".name")" && find ./ -type f -size "$(grep -v "#" "$i" | jq -r ".chunk_size | @sh")"c -or -size "$(grep -v "#" "$i" | jq -r ".chunk_last_size | @sh")"c | while read -r j; do if (( 10#${i##*/} < 10#${j##*/} )); then echo "$j"; fi; done | sort -n | head -n "$(grep -v "#" "$i" | jq -r ".chunk_cnt | @sh")" | while read -r f; do cat "$f" >> "$name" && rm -f "$f"; done && rm -f "$i"; done

Auth Download

Auth download require streamsaver.js as a depencency for now.

nginx-explorer's People

Contributors

izissise avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

nginx-explorer's Issues

Project no longer builds

Log while following the steps listed in the readme:

~/tmp/nginx-explorer$ npm install bower
npm WARN deprecated [email protected]: We don't recommend using Bower for new projects. Please consider Yarn and Webpack or Parcel. You can read how to migrate legacy project here: https://bower.io/blog/2017/how-to-migrate-away-from-bower/

> [email protected] install ~/tmp/nginx-explorer/node_modules/fsevents
> node install

node-pre-gyp WARN Using needle for node-pre-gyp https download
[fsevents] Success: "~/tmp/nginx-explorer/node_modules/fsevents/lib/binding/Release/node-v72-darwin-x64/fse.node" is installed via remote
+ [email protected]
added 694 packages from 313 contributors and audited 7681 packages in 14.314s
found 5 vulnerabilities (3 low, 2 high)
  run `npm audit fix` to fix them, or `npm audit` for details
~/tmp/nginx-explorer$ npm install
audited 7681 packages in 3.665s
found 5 vulnerabilities (3 low, 2 high)
  run `npm audit fix` to fix them, or `npm audit` for details
~/tmp/nginx-explorer$ npm run build

> [email protected] build ~/tmp/nginx-explorer
> ./node_modules/gulp/bin/gulp.js build

assert.js:373
    throw err;
    ^

AssertionError [ERR_ASSERTION]: Task function must be specified
    at Gulp.set [as _setTask] (~/tmp/nginx-explorer/node_modules/undertaker/lib/set-task.js:10:3)
    at Gulp.task (~/tmp/nginx-explorer/node_modules/undertaker/lib/task.js:13:8)
    at Object.<anonymous> (~/tmp/nginx-explorer/gulpfile.js:18:6)
    at Module._compile (internal/modules/cjs/loader.js:936:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:947:10)
    at Module.load (internal/modules/cjs/loader.js:790:32)
    at Function.Module._load (internal/modules/cjs/loader.js:703:12)
    at Module.require (internal/modules/cjs/loader.js:830:19)
    at require (internal/modules/cjs/helpers.js:68:18)
    at execute (~/tmp/nginx-explorer/node_modules/gulp/node_modules/gulp-cli/lib/versioned/^4.0.0/index.js:36:18) {
  generatedMessage: false,
  code: 'ERR_ASSERTION',
  actual: false,
  expected: true,
  operator: '=='
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] build: `./node_modules/gulp/bin/gulp.js build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     ~/.npm/_logs/2019-09-01T19_18_36_084Z-debug.log
~/tmp/nginx-explorer$

Activate html listing with an url param

Some software prefer html listing (eg: kodi), it should be possible to ask for html listing with an url param

Failed try with nginx conf

server {
    listen 80;

    root /home/user/downloads;
    #location for json requests
    location ^~ /files/ {
        #PathOnYourHardDrive Last slash is important
        alias /home/user/downloads/;

        # Random id so nginx doesn't serve random html files
        index aaaaaaaaaaaaaaaaaa;
        autoindex on;
        set $index_format "json";
        if ( $arg_html = "1" ) { set $index_format "html"; }
        autoindex_format $index_format;
        autoindex_exact_size on;

        sendfile           on;
        sendfile_max_chunk 2m;
        tcp_nopush         on;
        tcp_nodelay        on;
        keepalive_timeout  65;

        # error_page 418 = @htmllisting;
        # if ( $arg_html = "1" ) { return 418; }
    }

    # location @htmllisting {
    #     alias /;
    #     autoindex on;
    #     autoindex_format html;
    #     autoindex_exact_size on;
    #
    #     sendfile           on;
    #     sendfile_max_chunk 2m;
    #     tcp_nopush         on;
    #     tcp_nodelay        on;
    #     keepalive_timeout  65;
    # }

    location / {
        root /var/www/files/;
        # Try files so nginx serves the root index for all paths
        try_files $uri $uri/ /index.html;

        sendfile           on;
        sendfile_max_chunk 2m;
        tcp_nopush         on;
        tcp_nodelay        on;
        keepalive_timeout  65;
    }
}

Fix nginx.conf

Download folders location is broken
Make direct location work

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.