From 90c35a72aa50aebd4f8f8e6a37a9fee5cae3b6cf Mon Sep 17 00:00:00 2001 From: thevickypedia Date: Mon, 4 Dec 2023 20:06:02 -0600 Subject: [PATCH] Update entrypoint for `/login` page and README.md --- README.md | 10 +++++++++- docs/README.html | 12 ++++++++++-- docs/README.md | 10 +++++++++- docs/_sources/README.md.txt | 10 +++++++++- docs/genindex.html | 8 ++++---- docs/index.html | 10 +++++----- docs/objects.inv | Bin 818 -> 822 bytes docs/searchindex.js | 2 +- pystream/__init__.py | 1 + pystream/models/config.py | 2 +- pystream/routers/auth.py | 7 +++---- pystream/routers/basics.py | 2 +- pystream/routers/video.py | 2 +- 13 files changed, 54 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index e23c0cf..c57a950 100644 --- a/README.md +++ b/README.md @@ -17,10 +17,18 @@ python -m pip install stream-localhost ## Usage ```python +import os import pystream if __name__ == '__main__': - pystream.start() + kwargs = dict( + username="foo", + password="bar", + video_source=os.path.join(os.path.expanduser('~'), 'Downloads'), + ) + # Add the following to host on local IP address, skip for localhost (127.0.0.1) + kwargs["video_host"] = pystream.utils.get_local_ip() + pystream.start(**kwargs) ``` ### Env Variables diff --git a/docs/README.html b/docs/README.html index cd736b6..cb2c59b 100644 --- a/docs/README.html +++ b/docs/README.html @@ -59,10 +59,18 @@

Install

Usage

-
import pystream
+
import os
+import pystream
 
 if __name__ == '__main__':
-    pystream.start()
+    kwargs = dict(
+        username="foo",
+        password="bar",
+        video_source=os.path.join(os.path.expanduser('~'), 'Downloads'),
+    )
+    # Add the following to host on local IP address, skip for localhost (127.0.0.1)
+    kwargs["video_host"] = pystream.utils.get_local_ip()
+    pystream.start(**kwargs)
 
diff --git a/docs/README.md b/docs/README.md index e23c0cf..c57a950 100644 --- a/docs/README.md +++ b/docs/README.md @@ -17,10 +17,18 @@ python -m pip install stream-localhost ## Usage ```python +import os import pystream if __name__ == '__main__': - pystream.start() + kwargs = dict( + username="foo", + password="bar", + video_source=os.path.join(os.path.expanduser('~'), 'Downloads'), + ) + # Add the following to host on local IP address, skip for localhost (127.0.0.1) + kwargs["video_host"] = pystream.utils.get_local_ip() + pystream.start(**kwargs) ``` ### Env Variables diff --git a/docs/_sources/README.md.txt b/docs/_sources/README.md.txt index e23c0cf..c57a950 100644 --- a/docs/_sources/README.md.txt +++ b/docs/_sources/README.md.txt @@ -17,10 +17,18 @@ python -m pip install stream-localhost ## Usage ```python +import os import pystream if __name__ == '__main__': - pystream.start() + kwargs = dict( + username="foo", + password="bar", + video_source=os.path.join(os.path.expanduser('~'), 'Downloads'), + ) + # Add the following to host on local IP address, skip for localhost (127.0.0.1) + kwargs["video_host"] = pystream.utils.get_local_ip() + pystream.start(**kwargs) ``` ### Env Variables diff --git a/docs/genindex.html b/docs/genindex.html index bb42a97..be19099 100644 --- a/docs/genindex.html +++ b/docs/genindex.html @@ -134,9 +134,13 @@

I

@@ -148,13 +152,9 @@

L

  • list_files (pystream.models.config.FileIO attribute)
  • log_connection() (in module pystream.models.squire) -
  • -
  • login() (in module pystream.routers.auth)
    • -
    • login_endpoint (pystream.models.config.Static attribute) -
    • logout() (in module pystream.routers.auth)
    • logout_endpoint (pystream.models.config.Static attribute) diff --git a/docs/index.html b/docs/index.html index 59b63f8..3c97dde 100644 --- a/docs/index.html +++ b/docs/index.html @@ -243,7 +243,7 @@

      Models
      -class pystream.models.config.Static(*, vault: str = 'stream', query_param: str = 'file', login_endpoint: str = '/login', logout_endpoint: str = '/logout', streaming_endpoint: str = '/video', chunk_size: int = 1048576)
      +class pystream.models.config.Static(*, vault: str = 'stream', query_param: str = 'file', index_endpoint: str = '/index', logout_endpoint: str = '/logout', streaming_endpoint: str = '/video', chunk_size: int = 1048576)

      Object to store static values.

      >>> Static
       
      @@ -264,8 +264,8 @@

      Models

      -
      -login_endpoint: str
      +
      +index_endpoint: str
      @@ -456,8 +456,8 @@

      Routers

      Authentication

      -
      -async pystream.routers.auth.login(request: Request, credentials: HTTPBasicCredentials = Depends(HTTPBasic)) TemplateResponse
      +
      +async pystream.routers.auth.index(request: Request, credentials: HTTPBasicCredentials = Depends(HTTPBasic)) TemplateResponse

      Login request handler.

      Parameters:
      diff --git a/docs/objects.inv b/docs/objects.inv index a800a72f30182fa8938bdd09109b36a4ea830fc6..6ebc9fd75a0f9eb18117c80efbecc10684ff231b 100644 GIT binary patch delta 697 zcmV;q0!IC^2DS!}iGL=oTGdK>MZ`YaC>SVrr1d`iFr;ZRbxpv2i5%efzvIAnXFDP} z5Cc=D>%diZydF&B6;xj;sT+78Tum@x4yHu3mS_#DJ>X`i)V(oz) zfO^w>01ray91o}U3`sbesMhP6q|s*#B*0rv0=IZ6Xc|z+gny?VG|5_!$%^HBJllbj z?U?65E$SW$EJu!!9H8L`jSRC!x3Vj-8$oufcV7<@=kCydP_~o;1HI$nTE-X%A}2SV zV4j?H(8`yk1YgLBg|vFv0GHZ&3cnnjGY;oU>&}@iC$j}TSIUNid^WC`tK$)z7Q^f# z-Gy)&-W#N4lz*&o3n`)TuAaTWXV{>m`7*|Bq4Xk!!T>*h<-f;?V{!2u%S=h6m;eel z@Cb-g+RWa;9t>M(O`&NLp?nlrjvT9dueTiKADCl49RUa3SR*yfk_ruj3At$zttSs| zvn1dkyjDmU z9?%+%P^5+7P2!u80Qsrxg=#J&iBNE22b~j^WA3eTWE$KjsZ4SsP}W%DY$D?!wqhsi zi*L_A0)H-ig=Lbl*C_Ehg8S3v2bEmQ`(Ecb?Oq_^NvfG8GPtUA!?j!x^9*n~tHh}Y4?{FokBZ_DMZ`YaC>SVrr1d`iFt}MFbxXm1iEQBazvIAn7ds+3 z5Cc=D>%diZydF&B6;xj;sT+7@Jq_wp8ry!Zwi|m+ut#I)yHu3mS_#DJ>XiLI#M&b} z0QIK%4?GB|b3B~ZGbG_?qFS$Ol15)JkN|Hv3EbmHLDPUjCVxEjph?z(Oja!4CgI2z-CHP8CtfbY;2DsGLQ~2fJoN>5RT6fOuIhj4^rBXH=W}GEHfpMVge}K zz!M-&X)}8VGZ?nennKegLis4L9646^Uhg@|->}5|ROP2+q8n?ZrlnFQD?Uq=n&2;=7Rm`MK-|)m%stq2R<0IwvfrTuNI72InM|N$v#78cUo_WIV)H9As^D zk?HVia(|tUy+(=85u8t(A60TK&%MrR+WmlpC#kXm9f25MWon_gv^ka{X#Gyf`Xc#w zd-Lu7wnA#I8&g-?t16Ae71gg8r>D1av*|#m?q*uA#4aS#K)j76=5Bi2{9QK7o~%fE z+aJ@`Vkf(;ZYqS@J7~hX5baikPLfPDru+qa1%f1iS!{5YAtfIW=i b-@iVm5rnJzb1;p~J4y2oqJzyJTd@*1y$n*R diff --git a/docs/searchindex.js b/docs/searchindex.js index 188a17e..5639902 100644 --- a/docs/searchindex.js +++ b/docs/searchindex.js @@ -1 +1 @@ -Search.setIndex({"docnames": ["README", "index"], "filenames": ["README.md", "index.rst"], "titles": ["Video Streaming", "Stream-Localhost - A secured interface to stream videos"], "terms": {"deploy": 0, "python": 0, "modul": 0, "via": 0, "authent": 0, "session": [0, 1], "us": [0, 1], "fastapi": [0, 1], "m": 0, "pip": 0, "localhost": 0, "import": 0, "pystream": [0, 1], "__name__": 0, "__main__": 0, "start": [0, 1], "environ": [0, 1], "can": 0, "load": [0, 1], "from": [0, 1], "ani": [0, 1], "file": [0, 1], "default": 0, "set": 0, "var": [0, 1], "env_fil": [0, 1], "filenam": [0, 1], "mandatori": 0, "usernam": [0, 1], "choic": 0, "password": [0, 1], "_": 0, "sourc": [0, 1], "path": [0, 1], "mp4": 0, "option": [0, 1], "host": [0, 1], "ip": [0, 1], "address": [0, 1], "127": [0, 1], "0": [0, 1], "1": [0, 1], "port": [0, 1], "number": 0, "applic": 0, "8000": [0, 1], "websit": [0, 1], "add": [0, 1], "cor": 0, "configur": [0, 1], "worker": [0, 1], "spin": 0, "up": 0, "uvicorn": [0, 1], "server": 0, "docstr": 0, "format": 0, "googl": 0, "style": 0, "convent": 0, "pep": 0, "8": 0, "isort": 0, "requir": [0, 1], "gitvers": 0, "revers": [0, 1], "f": 0, "release_not": 0, "rst": 0, "t": 0, "pre": 0, "commit": 0, "ensur": 0, "run": [0, 1], "pytest": 0, "gener": 0, "valid": [0, 1], "hyperlink": 0, "all": [0, 1], "markdown": 0, "includ": [0, 1], "wiki": 0, "page": [0, 1], "sphinx": 0, "5": 0, "recommonmark": 0, "http": [0, 1], "org": 0, "project": 0, "thevickypedia": 0, "github": 0, "io": 0, "vignesh": 0, "rao": 0, "under": 0, "mit": 0, "instal": 1, "usag": 1, "code": 1, "standard": 1, "releas": 1, "note": 1, "lint": 1, "pypi": 1, "packag": 1, "runbook": 1, "licens": 1, "copyright": 1, "startup_task": 1, "none": 1, "task": 1, "need": 1, "dure": 1, "api": 1, "startup": 1, "kwarg": 1, "starter": 1, "function": 1, "paramet": 1, "keyword": 1, "argument": 1, "env": 1, "async": 1, "verifi": 1, "credenti": 1, "httpbasiccredenti": 1, "jsonrespons": 1, "client": 1, "return": 1, "json": 1, "respons": 1, "content": 1, "statu": 1, "type": 1, "timed_cach": 1, "max_ag": 1, "int": 1, "maxsiz": 1, "128": 1, "bool": 1, "fals": 1, "least": 1, "recent": 1, "decor": 1, "time": 1, "base": 1, "invalid": 1, "live": 1, "result": 1, "second": 1, "maximum": 1, "size": 1, "see": 1, "functool": 1, "lru_cach": 1, "distinct": 1, "input": 1, "take": 1, "param": 1, "creat": 1, "kei": 1, "If": 1, "even": 1, "one": 1, "i": 1, "chang": 1, "map": 1, "new": 1, "entri": 1, "thu": 1, "refresh": 1, "thi": 1, "just": 1, "trick": 1, "forc": 1, "lrc_cach": 1, "lib": 1, "provid": 1, "ttl": 1, "top": 1, "max": 1, "monoton": 1, "sinc": 1, "guarante": 1, "alwai": 1, "increas": 1, "mai": 1, "fact": 1, "decreas": 1, "machin": 1, "sync": 1, "its": 1, "system": 1, "clock": 1, "over": 1, "network": 1, "class": 1, "envconfig": 1, "_case_sensit": 1, "_env_prefix": 1, "str": 1, "_env_fil": 1, "dotenvtyp": 1, "posixpath": 1, "_env_file_encod": 1, "_env_nested_delimit": 1, "_secrets_dir": 1, "secretstr": 1, "video_sourc": 1, "video_port": 1, "url": 1, "ngrok_token": 1, "video_host": 1, "ipv4address": 1, "pydant": 1, "share": 1, "across": 1, "pars": 1, "data": 1, "rais": 1, "validationerror": 1, "pydantic_cor": 1, "cannot": 1, "form": 1, "__init__": 1, "__pydantic_self__": 1, "instead": 1, "more": 1, "common": 1, "self": 1, "first": 1, "arg": 1, "allow": 1, "field": 1, "name": 1, "variabl": 1, "env_prefix": 1, "extra": 1, "ignor": 1, "hide_input_in_error": 1, "true": 1, "fileio": 1, "index": 1, "html": 1, "list_fil": 1, "static": 1, "vault": 1, "query_param": 1, "login_endpoint": 1, "login": 1, "logout_endpoint": 1, "logout": 1, "streaming_endpoint": 1, "chunk_siz": 1, "1048576": 1, "object": 1, "store": 1, "valu": 1, "info": 1, "dict": 1, "inform": 1, "alia": 1, "get_tunnel": 1, "union": 1, "noreturn": 1, "check": 1, "activ": 1, "public": 1, "tunnel": 1, "httpurl": 1, "run_tunnel": 1, "proxi": 1, "expos": 1, "custom": 1, "an": 1, "log_connect": 1, "request": 1, "log": 1, "connect": 1, "onli": 1, "devic": 1, "avoid": 1, "multipl": 1, "when": 1, "same": 1, "differ": 1, "get_dir_stream_cont": 1, "parent": 1, "subdir": 1, "list": 1, "get": 1, "insid": 1, "particular": 1, "directori": 1, "displai": 1, "subdirectori": 1, "within": 1, "which": 1, "exist": 1, "dictionari": 1, "filepath": 1, "pair": 1, "get_all_stream_cont": 1, "folder": 1, "contain": 1, "each": 1, "section": 1, "send_bytes_range_request": 1, "file_obj": 1, "binaryio": 1, "start_rang": 1, "end_rang": 1, "asynciter": 1, "bytestr": 1, "send": 1, "chunk": 1, "rang": 1, "specif": 1, "rfc7233": 1, "byte": 1, "end": 1, "yield": 1, "iter": 1, "get_range_head": 1, "range_head": 1, "file_s": 1, "tupl": 1, "proce": 1, "header": 1, "range_requests_respons": 1, "file_path": 1, "streamingrespons": 1, "given": 1, "auth": 1, "depend": 1, "httpbasic": 1, "templaterespons": 1, "handler": 1, "templat": 1, "redirectrespons": 1, "401": 1, "out": 1, "user": 1, "httpexcept": 1, "messag": 1, "get_favicon": 1, "filerespons": 1, "favicon": 1, "ico": 1, "endpoint": 1, "robinhood": 1, "script": 1, "": 1, "root": 1, "render": 1, "redirect": 1, "stream_video": 1, "video_path": 1, "ha": 1, "video_endpoint": 1, "receiv": 1, "cooki": 1, "rootfilt": 1, "initi": 1, "filter": 1, "while": 1, "preserv": 1, "other": 1, "access": 1, "200": 1, "ok": 1, "307": 1, "temporari": 1, "vid_nam": 1, "redund": 1, "pass": 1, "overrid": 1, "implement": 1, "subclass": 1, "The": 1, "method": 1, "record": 1, "examin": 1, "discard": 1, "togeth": 1, "children": 1, "have": 1, "event": 1, "through": 1, "specifi": 1, "everi": 1, "logrecord": 1, "repres": 1, "someth": 1, "flag": 1, "get_local_ip": 1, "simpl": 1, "id": 1, "retriev": 1, "local": 1, "privat": 1, "get_public_ip": 1, "extract": 1, "make": 1, "extern": 1, "search": 1}, "objects": {"pystream": [[1, 0, 0, "-", "logger"], [1, 0, 0, "-", "main"], [1, 0, 0, "-", "utils"]], "pystream.logger": [[1, 1, 1, "", "RootFilter"]], "pystream.logger.RootFilter": [[1, 2, 1, "", "filter"]], "pystream.main": [[1, 3, 1, "", "start"], [1, 3, 1, "", "startup_tasks"]], "pystream.models": [[1, 0, 0, "-", "authenticator"], [1, 0, 0, "-", "cache"], [1, 0, 0, "-", "config"], [1, 0, 0, "-", "ngrok"], [1, 0, 0, "-", "squire"], [1, 0, 0, "-", "stream"]], "pystream.models.authenticator": [[1, 3, 1, "", "verify"]], "pystream.models.cache": [[1, 3, 1, "", "timed_cache"]], "pystream.models.config": [[1, 1, 1, "", "EnvConfig"], [1, 1, 1, "", "FileIO"], [1, 1, 1, "", "Session"], [1, 1, 1, "", "Static"], [1, 4, 1, "", "env"]], "pystream.models.config.EnvConfig": [[1, 1, 1, "", "Config"], [1, 4, 1, "", "ngrok_token"], [1, 4, 1, "", "password"], [1, 4, 1, "", "username"], [1, 4, 1, "", "video_host"], [1, 4, 1, "", "video_port"], [1, 4, 1, "", "video_source"], [1, 4, 1, "", "website"], [1, 4, 1, "", "workers"]], "pystream.models.config.EnvConfig.Config": [[1, 4, 1, "", "env_file"], [1, 4, 1, "", "env_prefix"], [1, 4, 1, "", "extra"], [1, 4, 1, "", "hide_input_in_errors"]], "pystream.models.config.FileIO": [[1, 4, 1, "", "index"], [1, 4, 1, "", "list_files"]], "pystream.models.config.Session": [[1, 4, 1, "", "info"]], "pystream.models.config.Static": [[1, 4, 1, "", "chunk_size"], [1, 4, 1, "", "login_endpoint"], [1, 4, 1, "", "logout_endpoint"], [1, 4, 1, "", "query_param"], [1, 4, 1, "", "streaming_endpoint"], [1, 4, 1, "", "vault"]], "pystream.models.ngrok": [[1, 3, 1, "", "get_tunnel"], [1, 3, 1, "", "run_tunnel"]], "pystream.models.squire": [[1, 3, 1, "", "get_all_stream_content"], [1, 3, 1, "", "get_dir_stream_content"], [1, 3, 1, "", "log_connection"]], "pystream.models.stream": [[1, 3, 1, "", "get_range_header"], [1, 3, 1, "", "range_requests_response"], [1, 3, 1, "", "send_bytes_range_requests"]], "pystream.routers": [[1, 0, 0, "-", "auth"], [1, 0, 0, "-", "basics"], [1, 0, 0, "-", "video"]], "pystream.routers.auth": [[1, 3, 1, "", "login"], [1, 3, 1, "", "logout"]], "pystream.routers.basics": [[1, 3, 1, "", "get_favicon"], [1, 3, 1, "", "root"]], "pystream.routers.video": [[1, 3, 1, "", "stream_video"], [1, 3, 1, "", "video_endpoint"]], "pystream.utils": [[1, 3, 1, "", "get_local_ip"], [1, 3, 1, "", "get_public_ip"]]}, "objtypes": {"0": "py:module", "1": "py:class", "2": "py:method", "3": "py:function", "4": "py:attribute"}, "objnames": {"0": ["py", "module", "Python module"], "1": ["py", "class", "Python class"], "2": ["py", "method", "Python method"], "3": ["py", "function", "Python function"], "4": ["py", "attribute", "Python attribute"]}, "titleterms": {"video": [0, 1], "stream": [0, 1], "instal": 0, "usag": 0, "env": 0, "variabl": 0, "code": 0, "standard": 0, "releas": 0, "note": 0, "lint": 0, "pypi": 0, "packag": 0, "runbook": 0, "licens": 0, "copyright": 0, "localhost": 1, "A": 1, "secur": 1, "interfac": 1, "read": 1, "me": 1, "main": 1, "modul": 1, "model": 1, "authent": 1, "cach": 1, "config": 1, "ngrok": 1, "squir": 1, "router": 1, "basic": 1, "support": 1, "logger": 1, "util": 1, "indic": 1, "tabl": 1}, "envversion": {"sphinx.domains.c": 2, "sphinx.domains.changeset": 1, "sphinx.domains.citation": 1, "sphinx.domains.cpp": 6, "sphinx.domains.index": 1, "sphinx.domains.javascript": 2, "sphinx.domains.math": 2, "sphinx.domains.python": 3, "sphinx.domains.rst": 2, "sphinx.domains.std": 2, "sphinx": 56}}) \ No newline at end of file +Search.setIndex({"docnames": ["README", "index"], "filenames": ["README.md", "index.rst"], "titles": ["Video Streaming", "Stream-Localhost - A secured interface to stream videos"], "terms": {"deploy": 0, "python": 0, "modul": 0, "via": 0, "authent": 0, "session": [0, 1], "us": [0, 1], "fastapi": [0, 1], "m": 0, "pip": 0, "localhost": 0, "import": 0, "o": 0, "pystream": [0, 1], "__name__": 0, "__main__": 0, "kwarg": [0, 1], "dict": [0, 1], "usernam": [0, 1], "foo": 0, "password": [0, 1], "bar": 0, "video_sourc": [0, 1], "path": [0, 1], "join": 0, "expandus": 0, "download": 0, "add": [0, 1], "follow": 0, "host": [0, 1], "local": [0, 1], "ip": [0, 1], "address": [0, 1], "skip": 0, "127": [0, 1], "0": [0, 1], "1": [0, 1], "video_host": [0, 1], "util": 0, "get_local_ip": [0, 1], "start": [0, 1], "environ": [0, 1], "can": 0, "load": [0, 1], "from": [0, 1], "ani": [0, 1], "file": [0, 1], "default": 0, "set": 0, "var": [0, 1], "env_fil": [0, 1], "filenam": [0, 1], "mandatori": 0, "choic": 0, "_": 0, "sourc": [0, 1], "mp4": 0, "option": [0, 1], "port": [0, 1], "number": 0, "applic": 0, "8000": [0, 1], "websit": [0, 1], "cor": 0, "configur": [0, 1], "worker": [0, 1], "spin": 0, "up": 0, "uvicorn": [0, 1], "server": 0, "docstr": 0, "format": 0, "googl": 0, "style": 0, "convent": 0, "pep": 0, "8": 0, "isort": 0, "requir": [0, 1], "gitvers": 0, "revers": [0, 1], "f": 0, "release_not": 0, "rst": 0, "t": 0, "pre": 0, "commit": 0, "ensur": 0, "run": [0, 1], "pytest": 0, "gener": 0, "valid": [0, 1], "hyperlink": 0, "all": [0, 1], "markdown": 0, "includ": [0, 1], "wiki": 0, "page": [0, 1], "sphinx": 0, "5": 0, "recommonmark": 0, "http": [0, 1], "org": 0, "project": 0, "thevickypedia": 0, "github": 0, "io": 0, "vignesh": 0, "rao": 0, "under": 0, "mit": 0, "instal": 1, "usag": 1, "code": 1, "standard": 1, "releas": 1, "note": 1, "lint": 1, "pypi": 1, "packag": 1, "runbook": 1, "licens": 1, "copyright": 1, "startup_task": 1, "none": 1, "task": 1, "need": 1, "dure": 1, "api": 1, "startup": 1, "starter": 1, "function": 1, "paramet": 1, "keyword": 1, "argument": 1, "env": 1, "async": 1, "verifi": 1, "credenti": 1, "httpbasiccredenti": 1, "jsonrespons": 1, "client": 1, "return": 1, "json": 1, "respons": 1, "content": 1, "statu": 1, "type": 1, "timed_cach": 1, "max_ag": 1, "int": 1, "maxsiz": 1, "128": 1, "bool": 1, "fals": 1, "least": 1, "recent": 1, "decor": 1, "time": 1, "base": 1, "invalid": 1, "live": 1, "result": 1, "second": 1, "maximum": 1, "size": 1, "see": 1, "functool": 1, "lru_cach": 1, "distinct": 1, "input": 1, "take": 1, "param": 1, "creat": 1, "kei": 1, "If": 1, "even": 1, "one": 1, "i": 1, "chang": 1, "map": 1, "new": 1, "entri": 1, "thu": 1, "refresh": 1, "thi": 1, "just": 1, "trick": 1, "forc": 1, "lrc_cach": 1, "lib": 1, "provid": 1, "ttl": 1, "top": 1, "max": 1, "monoton": 1, "sinc": 1, "guarante": 1, "alwai": 1, "increas": 1, "mai": 1, "fact": 1, "decreas": 1, "machin": 1, "sync": 1, "its": 1, "system": 1, "clock": 1, "over": 1, "network": 1, "class": 1, "envconfig": 1, "_case_sensit": 1, "_env_prefix": 1, "str": 1, "_env_fil": 1, "dotenvtyp": 1, "posixpath": 1, "_env_file_encod": 1, "_env_nested_delimit": 1, "_secrets_dir": 1, "secretstr": 1, "video_port": 1, "url": 1, "ngrok_token": 1, "ipv4address": 1, "pydant": 1, "share": 1, "across": 1, "pars": 1, "data": 1, "rais": 1, "validationerror": 1, "pydantic_cor": 1, "cannot": 1, "form": 1, "__init__": 1, "__pydantic_self__": 1, "instead": 1, "more": 1, "common": 1, "self": 1, "first": 1, "arg": 1, "allow": 1, "field": 1, "name": 1, "variabl": 1, "env_prefix": 1, "extra": 1, "ignor": 1, "hide_input_in_error": 1, "true": 1, "fileio": 1, "index": 1, "html": 1, "list_fil": 1, "static": 1, "vault": 1, "query_param": 1, "index_endpoint": 1, "logout_endpoint": 1, "logout": 1, "streaming_endpoint": 1, "chunk_siz": 1, "1048576": 1, "object": 1, "store": 1, "valu": 1, "info": 1, "inform": 1, "alia": 1, "get_tunnel": 1, "union": 1, "noreturn": 1, "check": 1, "activ": 1, "public": 1, "tunnel": 1, "httpurl": 1, "run_tunnel": 1, "proxi": 1, "expos": 1, "custom": 1, "an": 1, "log_connect": 1, "request": 1, "log": 1, "connect": 1, "onli": 1, "devic": 1, "avoid": 1, "multipl": 1, "when": 1, "same": 1, "differ": 1, "get_dir_stream_cont": 1, "parent": 1, "subdir": 1, "list": 1, "get": 1, "insid": 1, "particular": 1, "directori": 1, "displai": 1, "login": 1, "subdirectori": 1, "within": 1, "which": 1, "exist": 1, "dictionari": 1, "filepath": 1, "pair": 1, "get_all_stream_cont": 1, "folder": 1, "contain": 1, "each": 1, "section": 1, "send_bytes_range_request": 1, "file_obj": 1, "binaryio": 1, "start_rang": 1, "end_rang": 1, "asynciter": 1, "bytestr": 1, "send": 1, "chunk": 1, "rang": 1, "specif": 1, "rfc7233": 1, "byte": 1, "end": 1, "yield": 1, "iter": 1, "get_range_head": 1, "range_head": 1, "file_s": 1, "tupl": 1, "proce": 1, "header": 1, "range_requests_respons": 1, "file_path": 1, "streamingrespons": 1, "given": 1, "auth": 1, "depend": 1, "httpbasic": 1, "templaterespons": 1, "handler": 1, "templat": 1, "redirectrespons": 1, "401": 1, "out": 1, "user": 1, "httpexcept": 1, "messag": 1, "get_favicon": 1, "filerespons": 1, "favicon": 1, "ico": 1, "endpoint": 1, "robinhood": 1, "script": 1, "": 1, "root": 1, "render": 1, "redirect": 1, "stream_video": 1, "video_path": 1, "ha": 1, "video_endpoint": 1, "receiv": 1, "cooki": 1, "rootfilt": 1, "initi": 1, "filter": 1, "while": 1, "preserv": 1, "other": 1, "access": 1, "200": 1, "ok": 1, "307": 1, "temporari": 1, "vid_nam": 1, "redund": 1, "pass": 1, "overrid": 1, "implement": 1, "subclass": 1, "The": 1, "method": 1, "record": 1, "examin": 1, "discard": 1, "togeth": 1, "children": 1, "have": 1, "event": 1, "through": 1, "specifi": 1, "everi": 1, "logrecord": 1, "repres": 1, "someth": 1, "flag": 1, "simpl": 1, "id": 1, "retriev": 1, "privat": 1, "get_public_ip": 1, "extract": 1, "make": 1, "extern": 1, "search": 1}, "objects": {"pystream": [[1, 0, 0, "-", "logger"], [1, 0, 0, "-", "main"], [1, 0, 0, "-", "utils"]], "pystream.logger": [[1, 1, 1, "", "RootFilter"]], "pystream.logger.RootFilter": [[1, 2, 1, "", "filter"]], "pystream.main": [[1, 3, 1, "", "start"], [1, 3, 1, "", "startup_tasks"]], "pystream.models": [[1, 0, 0, "-", "authenticator"], [1, 0, 0, "-", "cache"], [1, 0, 0, "-", "config"], [1, 0, 0, "-", "ngrok"], [1, 0, 0, "-", "squire"], [1, 0, 0, "-", "stream"]], "pystream.models.authenticator": [[1, 3, 1, "", "verify"]], "pystream.models.cache": [[1, 3, 1, "", "timed_cache"]], "pystream.models.config": [[1, 1, 1, "", "EnvConfig"], [1, 1, 1, "", "FileIO"], [1, 1, 1, "", "Session"], [1, 1, 1, "", "Static"], [1, 4, 1, "", "env"]], "pystream.models.config.EnvConfig": [[1, 1, 1, "", "Config"], [1, 4, 1, "", "ngrok_token"], [1, 4, 1, "", "password"], [1, 4, 1, "", "username"], [1, 4, 1, "", "video_host"], [1, 4, 1, "", "video_port"], [1, 4, 1, "", "video_source"], [1, 4, 1, "", "website"], [1, 4, 1, "", "workers"]], "pystream.models.config.EnvConfig.Config": [[1, 4, 1, "", "env_file"], [1, 4, 1, "", "env_prefix"], [1, 4, 1, "", "extra"], [1, 4, 1, "", "hide_input_in_errors"]], "pystream.models.config.FileIO": [[1, 4, 1, "", "index"], [1, 4, 1, "", "list_files"]], "pystream.models.config.Session": [[1, 4, 1, "", "info"]], "pystream.models.config.Static": [[1, 4, 1, "", "chunk_size"], [1, 4, 1, "", "index_endpoint"], [1, 4, 1, "", "logout_endpoint"], [1, 4, 1, "", "query_param"], [1, 4, 1, "", "streaming_endpoint"], [1, 4, 1, "", "vault"]], "pystream.models.ngrok": [[1, 3, 1, "", "get_tunnel"], [1, 3, 1, "", "run_tunnel"]], "pystream.models.squire": [[1, 3, 1, "", "get_all_stream_content"], [1, 3, 1, "", "get_dir_stream_content"], [1, 3, 1, "", "log_connection"]], "pystream.models.stream": [[1, 3, 1, "", "get_range_header"], [1, 3, 1, "", "range_requests_response"], [1, 3, 1, "", "send_bytes_range_requests"]], "pystream.routers": [[1, 0, 0, "-", "auth"], [1, 0, 0, "-", "basics"], [1, 0, 0, "-", "video"]], "pystream.routers.auth": [[1, 3, 1, "", "index"], [1, 3, 1, "", "logout"]], "pystream.routers.basics": [[1, 3, 1, "", "get_favicon"], [1, 3, 1, "", "root"]], "pystream.routers.video": [[1, 3, 1, "", "stream_video"], [1, 3, 1, "", "video_endpoint"]], "pystream.utils": [[1, 3, 1, "", "get_local_ip"], [1, 3, 1, "", "get_public_ip"]]}, "objtypes": {"0": "py:module", "1": "py:class", "2": "py:method", "3": "py:function", "4": "py:attribute"}, "objnames": {"0": ["py", "module", "Python module"], "1": ["py", "class", "Python class"], "2": ["py", "method", "Python method"], "3": ["py", "function", "Python function"], "4": ["py", "attribute", "Python attribute"]}, "titleterms": {"video": [0, 1], "stream": [0, 1], "instal": 0, "usag": 0, "env": 0, "variabl": 0, "code": 0, "standard": 0, "releas": 0, "note": 0, "lint": 0, "pypi": 0, "packag": 0, "runbook": 0, "licens": 0, "copyright": 0, "localhost": 1, "A": 1, "secur": 1, "interfac": 1, "read": 1, "me": 1, "main": 1, "modul": 1, "model": 1, "authent": 1, "cach": 1, "config": 1, "ngrok": 1, "squir": 1, "router": 1, "basic": 1, "support": 1, "logger": 1, "util": 1, "indic": 1, "tabl": 1}, "envversion": {"sphinx.domains.c": 2, "sphinx.domains.changeset": 1, "sphinx.domains.citation": 1, "sphinx.domains.cpp": 6, "sphinx.domains.index": 1, "sphinx.domains.javascript": 2, "sphinx.domains.math": 2, "sphinx.domains.python": 3, "sphinx.domains.rst": 2, "sphinx.domains.std": 2, "sphinx": 56}}) \ No newline at end of file diff --git a/pystream/__init__.py b/pystream/__init__.py index d5f0da8..04160fa 100644 --- a/pystream/__init__.py +++ b/pystream/__init__.py @@ -1,3 +1,4 @@ +from . import utils # noqa: F401 from .main import start # noqa: F401 version = "0.0.1" diff --git a/pystream/models/config.py b/pystream/models/config.py index f608d35..eee381f 100644 --- a/pystream/models/config.py +++ b/pystream/models/config.py @@ -54,7 +54,7 @@ class Static(BaseModel): vault: str = "stream" # Use a masked location to hide real path in the URL (will still be visible in html though) query_param: str = "file" - login_endpoint: str = "/login" + index_endpoint: str = "/index" logout_endpoint: str = "/logout" streaming_endpoint: str = "/video" chunk_size: PositiveInt = 1024 * 1024 diff --git a/pystream/routers/auth.py b/pystream/routers/auth.py index 8b4037b..2518680 100644 --- a/pystream/routers/auth.py +++ b/pystream/routers/auth.py @@ -14,8 +14,8 @@ templates = Jinja2Templates(directory=os.path.join(pathlib.Path(__file__).parent.parent, "templates")) -@router.get("%s" % config.static.login_endpoint, response_model=None) -async def login(request: Request, +@router.get("%s" % config.static.index_endpoint, response_model=None) +async def index(request: Request, credentials: HTTPBasicCredentials = Depends(security)) -> templates.TemplateResponse: """Login request handler. @@ -27,7 +27,6 @@ async def login(request: Request, templates.TemplateResponse: Template response for listing page. """ - # fixme: this is just an index landing page, so throw it out or throw it under root endpoint and kill all redirects await authenticator.verify(credentials) squire.log_connection(request) content = squire.get_all_stream_content() @@ -59,4 +58,4 @@ async def logout(request: Request) -> RedirectResponse: ) else: logger.info("Redirecting connection from %s to login page", request.client.host) - return RedirectResponse(url=config.static.login_endpoint, headers=None) + return RedirectResponse(url=config.static.index_endpoint, headers=None) diff --git a/pystream/routers/basics.py b/pystream/routers/basics.py index 6cb39ba..f9f81dc 100644 --- a/pystream/routers/basics.py +++ b/pystream/routers/basics.py @@ -28,4 +28,4 @@ async def root() -> RedirectResponse: RedirectResponse: Redirects to login page. """ - return RedirectResponse(url=config.static.login_endpoint, headers=None) + return RedirectResponse(url=config.static.index_endpoint, headers=None) diff --git a/pystream/routers/video.py b/pystream/routers/video.py index dcc214c..1814bd3 100644 --- a/pystream/routers/video.py +++ b/pystream/routers/video.py @@ -75,7 +75,7 @@ async def video_endpoint(request: Request, range: Optional[str] = Header(None), squire.log_connection(request) if not range or not range.startswith("bytes"): logger.info("/video endpoint accessed directly. Redirecting to login page.") - return RedirectResponse(url=config.static.login_endpoint, headers=None) + return RedirectResponse(url=config.static.index_endpoint, headers=None) if not request.query_params.get(config.static.query_param): raise HTTPException(status_code=status.HTTP_421_MISDIRECTED_REQUEST, detail="Misdirected request, please route through the login page.")