Skip to content

Commit

Permalink
bump to v0.7.0, see change log
Browse files Browse the repository at this point in the history
  • Loading branch information
RaSan147 committed Mar 4, 2023
1 parent a7d687e commit a7d8970
Show file tree
Hide file tree
Showing 15 changed files with 2,315 additions and 2,176 deletions.
42 changes: 39 additions & 3 deletions CHANGELOG.MD
Original file line number Diff line number Diff line change
@@ -1,3 +1,28 @@
# Version 0.7.0
## Client-side Changes:
* Video plater page shows title of video
* Video player page predicts whether video is playable or not by Browser
## Server-side Changes:
* Added manual password, use `--password` or `-k` flag to set password
* Using pyroboxCore as External module
* all prints are now using `logger.log|info|warn|error|debug` instead of `print`
* `TODO`: To change log level, use `--log-level` or `-l` flag
* To change log level programmatically, use `pyroboxCore.logger.setLevel(logging.DEBUG|INFO|WARN|ERROR)`
* REMOVED `pyrobox.clone` module (stil available in `dev_src` folder)
* The Entire server is now using `@SimpleHTTPRequestHandler.on_req` decorator importing from pyroboxCore to handle requests
### check v0.6.1 for more info
* added send_file function to pyroboxCore
* improved POST request handling

## Fixes:
* FIXED Python 3.7 support
* Fixed Video player text issue https://github.com/RaSan147/py_httpserver_Ult/issues/70
* Fixed zip download not working
* Fixed many bugs
------------------------------------------------------------------------
------------------------------------------------------------------------


# Version 0.6.9
## Client-side Changes:
* Nothing to notice
Expand All @@ -6,6 +31,9 @@
## Fixes:
* Forgot to increment version number in `server.py`

------------------------------------------------------------------------
------------------------------------------------------------------------

# Version 0.6.8
## Client-side Changes:
* Nothing to notice
Expand All @@ -14,6 +42,8 @@
## Fixes:
* Reload_server button now works

------------------------------------------------------------------------
------------------------------------------------------------------------

# Version 0.6.7
## Client-side Changes:
Expand All @@ -23,6 +53,8 @@
## Fixes:
* Added requests in requirements

------------------------------------------------------------------------
------------------------------------------------------------------------

# Version 0.6.6
## Client-side Changes:
Expand All @@ -32,6 +64,8 @@
## Fixes:
* Fixed where files had "/" at the end of their name

------------------------------------------------------------------------
------------------------------------------------------------------------

# Version 0.6.5
## Client-side Changes:
Expand All @@ -45,9 +79,8 @@
## Fixes:
* Nothing to notice since 0.6.4



-----------------------------------------------------------------------
------------------------------------------------------------------------
------------------------------------------------------------------------


# Version 0.6.4
Expand All @@ -60,6 +93,7 @@


------------------------------------------------------------------------
------------------------------------------------------------------------


# Version 0.6.3
Expand All @@ -71,6 +105,7 @@
* fixed log_message not working


------------------------------------------------------------------------
------------------------------------------------------------------------

# Version 0.6.2
Expand All @@ -82,6 +117,7 @@
* fixed upload form not working due to missing `action="?upload"` which is required for POST requests


------------------------------------------------------------------------
------------------------------------------------------------------------

# Version 0.6.1
Expand Down
16 changes: 13 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ And also for the same reason, I'm punching too many updates (acually bug fixes)
"""
# pyrobox 🔥

` Note ` UPLOAD PASSWORD: `SECret`
**`Note :`** DEFAULT UPLOAD PASSWORD: `SECret`
* you can change it by editing the code (see `config` class at top)
* to set password from command line, use `-k` or `--password` flag

# Status
[![Downloads](https://static.pepy.tech/badge/pyrobox)](https://pepy.tech/project/pyrobox)
Expand Down Expand Up @@ -50,6 +52,7 @@ Server side requirement
# Installation
----------------------------------------------------------------
* **Install Python 3.7 or higher**
* **Close older pyrobox process if already running**
1. Install using PIP
### On Windows:
* Open `CMD` or `PowerShell`
Expand All @@ -61,6 +64,7 @@ Server side requirement
* Run `pip3 install pyrobox`
* Run `pyrobox` to launch the server


CHECK [FAQ](#faq) FOR FUTURE HELP AND ISSUE FIX


Expand All @@ -81,7 +85,14 @@ CHECK [FAQ](#faq) FOR FUTURE HELP AND ISSUE FIX
- `pyrobox -d . 45678` # will run on port 45678 in current directory

1. To specify alternate bind address
- Add bind add `-bind {address}` # idk if it works and how it works, but it's there
- Add bind add `-bind {address}` # ie: `-bind 127.0.0.2` or `-bind 127.0.0.99`

1. To change upload password
- i) or add `-k` or `--password` command line argument when launching the program
- `pyrobox -k "my new password"` to launch the server with new password
- `pyrobox -k ""` to launch the server without password
- `pyrobox` to launch the server with default password (SECret)
- ii) just edit the code for permanent change (see `config` class at top)

TODO:
--------------------------------------------------------------
Expand All @@ -91,7 +102,6 @@ CHECK [FAQ](#faq) FOR FUTURE HELP AND ISSUE FIX
* https://github.com/RaSan147/py_httpserver_Ult/issues/36 Add side bar to do something 🤔
* check output ip and port accuracy on multiple os
* https://github.com/RaSan147/py_httpserver_Ult/issues/37 Backup code if Reload causes unhandled issue and can't be accessed
* https://github.com/RaSan147/py_httpserver_Ult/issues/38 command line arg for passwords (vulnerable on reload)
* https://github.com/RaSan147/py_httpserver_Ult/issues/39 User login and user based permission set. 🔑

# Support for more features
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.6.9
0.7.0
File renamed without changes.
2 changes: 2 additions & 0 deletions dev_src/html_vid.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<!-- using from http://plyr.io -->
<link rel="stylesheet" href="https://raw.githack.com/RaSan147/py_httpserver_Ult/main/assets/video.css" />

<p><b>Watching:</b> ${PY_FILE_NAME}</p>

<h2>${PY_UNSUPPORT_WARNING}</h2>

<div id="container">
Expand Down
29 changes: 19 additions & 10 deletions dev_src/local_server_pyrobox.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
false = F = False


config.parser.add_argument('--password', '-k',
config.parser.add_argument('--password', '-k',
default=config.PASSWORD,
type=str,
help='Upload Password (default: %(default)s)')
Expand Down Expand Up @@ -439,14 +439,21 @@ def get_dir_m_time(path):



def get_titles(path):
def get_titles(path, file=False):
"""Make titles for the header directory
path: the path of the file or directory
file: if True, path is a file, else it's a directory
output: `Viewing NAME`"""

paths = path.split('/')
if file:
return 'Viewing ' + paths[-1]
if paths[-2]=='':
return 'Viewing &#127968; HOME'
else:
return 'Viewing ' + paths[-2]



def dir_navigator(path):
Expand Down Expand Up @@ -637,7 +644,7 @@ def list_directory(self:SH, path):


encoded = '\n'.join(r).encode(enc, 'surrogateescape')

return self.send_txt(HTTPStatus.OK, encoded)


Expand Down Expand Up @@ -1089,7 +1096,7 @@ def send_video_page(self: SH, *args, **kwargs):



title = get_titles(displaypath)
title = get_titles(displaypath, file=True)

r.append(directory_explorer_header().safe_substitute(PY_PAGE_TITLE=title,
PY_PUBLIC_URL=config.address(),
Expand All @@ -1101,8 +1108,9 @@ def send_video_page(self: SH, *args, **kwargs):
if ctype not in ['video/mp4', 'video/ogg', 'video/webm']:
warning = ('<h2>It seems HTML player may not be able to play this Video format, Try Downloading</h2>')


r.append(_video_script().safe_substitute(PY_VID_SOURCE=vid_source,
PY_FILE_NAME = displaypath.split("/")[-1],
PY_CTYPE=ctype,
PY_UNSUPPORT_WARNING=warning))

Expand Down Expand Up @@ -1241,7 +1249,7 @@ def upload(self: SH, *args, **kwargs):

# PASSWORD SYSTEM
password = post.get_part(verify_name='password', decode=T)[1]

self.log_debug(f'post password: {[password]} by client')
if password != config.PASSWORD: # readline returns password with \r\n at end
self.log_info(f"Incorrect password by {uid}")
Expand Down Expand Up @@ -1627,8 +1635,9 @@ def default_post(self: SH, *args, **kwargs):



def main():
run_server(handler=SH)

# proxy for old versions
run = run_server

if __name__ == '__main__':
main()
run()

0 comments on commit a7d8970

Please sign in to comment.