Skip to content
This repository has been archived by the owner on May 2, 2022. It is now read-only.
/ PHFS Public archive

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

License

Notifications You must be signed in to change notification settings

NaitLee/PHFS

Repository files navigation

English | 简体中文

Going to archive this repo. See #9 for some explanations.

Thank you for your interest!

PHFS

PHFS ~ Python HTTP File Server

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


🏗 Under construction...

🎉 Please help make this project grow. Contributions are welcome!


👏 Done Features: 🕳 To-do Features:
Filelist, download Virtual File System
Sorting files, Archiving Ban, Limits
Upload, Search Other
Accounts, Login
File actions

🍉 Supported platforms:

  • Windows 7 and upper
  • GNU/Linux, *nix, *BSD
  • Android, with QPython 3L or Termux with python3 package installed
  • ARM Boards like Raspberry Pi, with PyPy
  • ...

Tips

The release bundle for Windows platform have additional convenient features. Read them at here.

Drag-drop item(s) to batch file (start.bat) or command-line (run.py) for quick file-sharing.

You can just get all requirements for development in a PHFS release package.

Developer Notes

👀 This project is not yet ready for production use. But, please, have a try!

You can try by using a release, or:

  1. Install Python 3.

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

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

  4. Get sha256.js, place into repo folder.

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

  6. Configure port, base folder, upload-allowed folders and accounts in hfs.ini. Note: hfs.ini of original HFS is not compatible to PHFS.

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

Template choices:

Notes

  • To use in QPython 3L on Android:
    • Put a unix release into folder /sdcard/qpython/projects3, ensure folder is not nested.
    • Get dataclasses.py from Python 3 builtin libs, put into folder. Or, install dataclasses with PIP console.
    • Rename run.py to main.py.
    • In QPython 3L app, go to Programs, in Projects tab, select phfs-unix then run.

Files

  • run.py: Run a 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.

  • hash.py: Hash a password interactively by executing this directly.

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

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

  • cfgLib.py: The Config and Account 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.

  • hashLib.py: Classes inside can hash passwords from/to base-hash/token-hash.

  • i18n.ini: Contains localization data.

  • i18nLib.py: I18n.get_string() inside can get localization string.