PHFS

This is a Python3 implementation of rejetto's HTTP File Server~

👏 Features that work:

  • Filelist, download
  • Sorting files, Archiving
  • Some macros, special:alias
  • Upload
  • Search
  • Translations, special:strings

🕳 Features that don't work:

  • Virtual File System
  • File actions
  • Accounts, Login, Ban, Limits, ...

🍉 Supported platforms:

  • All x86, x64 platforms that Python 3.7 supports:

    • Windows 7 and upper
    • GNU/Linux, *nix, *BSD
    • ...
  • Some ARM platforms:

    • Android, with QPython 3L
    • ARM Boards like Raspberry Pi, with PyPy
    • ...
  • Maybe more!

Developer Notes

👀 This project is only half working, it is not yet ready for production use. Testing only.

If you are interested in testing this project, please do the following:

  1. Install Werkzeug by either using pip or placing the folder Werkzeug-(version)/src/werkzeug from downloaded archive to cloned repo.

  2. Install WSGIserver by either using pip or placing the file WSGIserver-(version)/wsgiserver.py from downloaded archive to cloned repo.

  3. Pick a HFS template (for HFS 2.4), rename it to hfs.tpl and place into cloned repo.

  4. Configure port, base folder and upload-allowed folders in hfs.ini.

  5. For running a server, open run.py; for developing, open test.py.

Template choices:

Notes

  • To use in QPython 3L on Android:
    • Put repo into folder /sdcard/qpython/projects3, ensure folder is not nested.
    • Rename run.py to main.py.
    • In QPython 3L app, go to Programs, in Projects tab, select repo name then run.

Files

  • test.py: Run a server for testing, debugging. It also contains werkzeug's reload feature.

  • run.py: Run a simple server. Has no debug feature, but works on pypy on aarch64 architecture.

  • hfs.ini: Some configs, like port, are here. Currently you can set a base path as the root dir of served pages, also can set upload-allowed paths.

  • _test_macro.py: Run & test a macro, by entering as argv1 in commandline.

  • cfgLib.py: The Config object is inside this file.

  • classesLib.py: Some useful classes are here.

  • helpersLib.py: Some useful functions are here.

  • mimeLib.py: Manages MIME types. Get a defined MIME type with something like mimeLib.getmime('*.html'). You can define your own MIMEs in mime.ini.

  • scriptLib.py: When executing a macro/symbol, usually functions in this file will be called.

  • serverLib.py: Defines a WSGI application, which acts like original HFS.

  • tplLib.py: The template is interpreted by this.

GitHub

https://github.com/NaitLee/PHFS