diff --git a/README.md b/README.md index ec00ecc..c271cef 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ **Deployments** -[![book](https://github.com/thevickypedia/pystream/actions/workflows/pages/pages-build-deployment/badge.svg)][gha_pages] -[![pypi](https://github.com/thevickypedia/pystream/actions/workflows/python-publish.yml/badge.svg)][gha_pypi] -[![none-shall-pass](https://github.com/thevickypedia/pystream/actions/workflows/markdown.yml/badge.svg)][gha_none_shall_pass] +[![book][gha_pages_badge]][gha_pages] +[![pypi][gha_pypi_badge]][gha_pypi] +[![none-shall-pass][gha_none_shall_pass_badge]][gha_none_shall_pass] [![PyPI version shields.io](https://img.shields.io/pypi/v/stream-localhost)][pypi] [![Pypi-format](https://img.shields.io/pypi/format/stream-localhost)](https://pypi.org/project/stream-localhost/#files) @@ -99,8 +99,11 @@ Licensed under the [MIT License][license] [pypi-repo]: https://packaging.python.org/tutorials/packaging-projects/ [release-notes]: https://github.com/thevickypedia/pystream/blob/master/release_notes.rst [gha_pages]: https://github.com/thevickypedia/pystream/actions/workflows/pages/pages-build-deployment +[gha_pages_badge]: https://github.com/thevickypedia/pystream/actions/workflows/pages/pages-build-deployment/badge.svg [gha_pypi]: https://github.com/thevickypedia/pystream/actions/workflows/python-publish.yml +[gha_pypi_badge]: https://github.com/thevickypedia/pystream/actions/workflows/python-publish.yml/badge.svg [gha_none_shall_pass]: https://github.com/thevickypedia/pystream/actions/workflows/markdown.yml +[gha_none_shall_pass_badge]: https://github.com/thevickypedia/pystream/actions/workflows/markdown.yml/badge.svg [google-docs]: https://google.github.io/styleguide/pyguide.html#38-comments-and-docstrings [pep8]: https://www.python.org/dev/peps/pep-0008/ [isort]: https://pycqa.github.io/isort/ diff --git a/docs/README.html b/docs/README.html index d775c51..2182417 100644 --- a/docs/README.html +++ b/docs/README.html @@ -6,7 +6,7 @@ -
Python module to, stream videos via authenticated sessions using FastAPI
USERNAME: Any username of choice.
PASSWORD: Any password of choice.
SECRET: Any private key to encode and decode JWT.
AUTHORIZATION: Dictionary of key-value pairs with username
as key and password
as value.
VIDEO_SOURCE: Source path for video files.
@@ -158,7 +159,7 @@License & copyright
Table of Contents
-
- Video Streaming
+
- PyStream
- Install
- Sample Usage
- Env Variables
@@ -180,6 +181,11 @@Previous topic
Stream-Localhost - A secured interface to stream videos
++Next topic
+ +This Page
@@ -210,11 +216,14 @@
Navigation
- modules |
+- + next |
- previous |
- Stream documentation »
-- Video Streaming
+- PyStream
diff --git a/docs/README.md b/docs/README.md index ae5dbe6..c271cef 100644 --- a/docs/README.md +++ b/docs/README.md @@ -1,14 +1,14 @@ **Deployments** -[![book](https://github.com/thevickypedia/pystream/actions/workflows/pages/pages-build-deployment/badge.svg)][gha_pages] -[![pypi](https://github.com/thevickypedia/pystream/actions/workflows/python-publish.yml/badge.svg)][gha_pypi] -[![none-shall-pass](https://github.com/thevickypedia/pystream/actions/workflows/markdown.yml/badge.svg)][gha_none_shall_pass] +[![book][gha_pages_badge]][gha_pages] +[![pypi][gha_pypi_badge]][gha_pypi] +[![none-shall-pass][gha_none_shall_pass_badge]][gha_none_shall_pass] [![PyPI version shields.io](https://img.shields.io/pypi/v/stream-localhost)][pypi] [![Pypi-format](https://img.shields.io/pypi/format/stream-localhost)](https://pypi.org/project/stream-localhost/#files) [![Pypi-status](https://img.shields.io/pypi/status/stream-localhost)][pypi] -# Video Streaming +# PyStream Python module to, stream videos via authenticated sessions using FastAPI ## Install @@ -24,9 +24,8 @@ import pystream if __name__ == '__main__': kwargs = dict( - username="foo", - password="bar", - video_source=os.path.join(os.path.expanduser('~'), 'Downloads'), + authorization={"Alan Turing": "Pr0gRamM1ng", "Linus Torvalds": "LinuxOS"}, + 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() @@ -38,9 +37,7 @@ if __name__ == '__main__': > Refer the [wiki page][wiki] for more information. **Mandatory** -- **USERNAME**: Any username of choice. -- **PASSWORD**: Any password of choice. -- **SECRET**: Any private key to encode and decode JWT. +- **AUTHORIZATION**: Dictionary of key-value pairs with `username` as key and `password` as value. - **VIDEO_SOURCE**: Source path for video files. > :bulb: Files starting with `_` _(underscore)_ and `.` _(dot)_ will be ignored @@ -102,8 +99,11 @@ Licensed under the [MIT License][license] [pypi-repo]: https://packaging.python.org/tutorials/packaging-projects/ [release-notes]: https://github.com/thevickypedia/pystream/blob/master/release_notes.rst [gha_pages]: https://github.com/thevickypedia/pystream/actions/workflows/pages/pages-build-deployment +[gha_pages_badge]: https://github.com/thevickypedia/pystream/actions/workflows/pages/pages-build-deployment/badge.svg [gha_pypi]: https://github.com/thevickypedia/pystream/actions/workflows/python-publish.yml +[gha_pypi_badge]: https://github.com/thevickypedia/pystream/actions/workflows/python-publish.yml/badge.svg [gha_none_shall_pass]: https://github.com/thevickypedia/pystream/actions/workflows/markdown.yml +[gha_none_shall_pass_badge]: https://github.com/thevickypedia/pystream/actions/workflows/markdown.yml/badge.svg [google-docs]: https://google.github.io/styleguide/pyguide.html#38-comments-and-docstrings [pep8]: https://www.python.org/dev/peps/pep-0008/ [isort]: https://pycqa.github.io/isort/ diff --git a/docs/_sources/README.md.txt b/docs/_sources/README.md.txt index ae5dbe6..c271cef 100644 --- a/docs/_sources/README.md.txt +++ b/docs/_sources/README.md.txt @@ -1,14 +1,14 @@ **Deployments** -[![book](https://github.com/thevickypedia/pystream/actions/workflows/pages/pages-build-deployment/badge.svg)][gha_pages] -[![pypi](https://github.com/thevickypedia/pystream/actions/workflows/python-publish.yml/badge.svg)][gha_pypi] -[![none-shall-pass](https://github.com/thevickypedia/pystream/actions/workflows/markdown.yml/badge.svg)][gha_none_shall_pass] +[![book][gha_pages_badge]][gha_pages] +[![pypi][gha_pypi_badge]][gha_pypi] +[![none-shall-pass][gha_none_shall_pass_badge]][gha_none_shall_pass] [![PyPI version shields.io](https://img.shields.io/pypi/v/stream-localhost)][pypi] [![Pypi-format](https://img.shields.io/pypi/format/stream-localhost)](https://pypi.org/project/stream-localhost/#files) [![Pypi-status](https://img.shields.io/pypi/status/stream-localhost)][pypi] -# Video Streaming +# PyStream Python module to, stream videos via authenticated sessions using FastAPI ## Install @@ -24,9 +24,8 @@ import pystream if __name__ == '__main__': kwargs = dict( - username="foo", - password="bar", - video_source=os.path.join(os.path.expanduser('~'), 'Downloads'), + authorization={"Alan Turing": "Pr0gRamM1ng", "Linus Torvalds": "LinuxOS"}, + 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() @@ -38,9 +37,7 @@ if __name__ == '__main__': > Refer the [wiki page][wiki] for more information. **Mandatory** -- **USERNAME**: Any username of choice. -- **PASSWORD**: Any password of choice. -- **SECRET**: Any private key to encode and decode JWT. +- **AUTHORIZATION**: Dictionary of key-value pairs with `username` as key and `password` as value. - **VIDEO_SOURCE**: Source path for video files. > :bulb: Files starting with `_` _(underscore)_ and `.` _(dot)_ will be ignored @@ -102,8 +99,11 @@ Licensed under the [MIT License][license] [pypi-repo]: https://packaging.python.org/tutorials/packaging-projects/ [release-notes]: https://github.com/thevickypedia/pystream/blob/master/release_notes.rst [gha_pages]: https://github.com/thevickypedia/pystream/actions/workflows/pages/pages-build-deployment +[gha_pages_badge]: https://github.com/thevickypedia/pystream/actions/workflows/pages/pages-build-deployment/badge.svg [gha_pypi]: https://github.com/thevickypedia/pystream/actions/workflows/python-publish.yml +[gha_pypi_badge]: https://github.com/thevickypedia/pystream/actions/workflows/python-publish.yml/badge.svg [gha_none_shall_pass]: https://github.com/thevickypedia/pystream/actions/workflows/markdown.yml +[gha_none_shall_pass_badge]: https://github.com/thevickypedia/pystream/actions/workflows/markdown.yml/badge.svg [google-docs]: https://google.github.io/styleguide/pyguide.html#38-comments-and-docstrings [pep8]: https://www.python.org/dev/peps/pep-0008/ [isort]: https://pycqa.github.io/isort/ diff --git a/docs/index.html b/docs/index.html index f6bb951..2e2ab52 100644 --- a/docs/index.html +++ b/docs/index.html @@ -18,7 +18,7 @@ - +@@ -123,16 +129,28 @@Navigation
@@ -30,7 +30,7 @@Navigation
modules |- - next |
- Stream documentation »
- Stream-Localhost - A secured interface to stream videos
@@ -47,7 +47,7 @@Stream-Localhost - A secured interface to stream videos
-
- Video Streaming
++
- PyStream
- Install
- Sample Usage
- Coding Standards
@@ -58,6 +58,12 @@Stream-Localhost - A secured interface to stream videosLicense & copyright
- Authentication +
Models +
+
+ +- +async pystream.models.authenticator.extract_credentials(request: Request) → List[str]¶
+Extract the credentials from
+Authorization
headers and decode it before returning as a list of strings.+
+- +async pystream.models.authenticator.raise_error(request) → NoReturn¶
+Raises a 401 Unauthorized error in case of bad credentials.
+@@ -140,13 +158,10 @@
- -async pystream.models.authenticator.verify_login(request: Request) → JSONResponse¶
-Verifies authentication.
+async pystream.models.authenticator.verify_login(request: Request) → Dict[str, Union[str, int]]¶ +Verifies authentication and generates session token for each user.
- Returns:
-Returns JSON response with content and status code.
+Returns a dictionary with the payload required to create the session token.
- Return type:
-JSONResponse
+Dict[str, str]
Models
- async pystream.models.authenticator.verify_token(token: str) → None¶
-Decodes the JWT and validates the session token and expiration.
+- @@ -154,9 +169,26 @@
Decrypts the symmetric encrypted token and validates the session token and expiration.
- Parameters:
-- -
token – JSON web token.
-- Raises:
-- +
token – Symmetric encrypted key.
Models
Config¶
++
+- +pystream.models.config.as_dict(pairs: List[Tuple[str, str]]) → Dict[str, SecretStr]¶
+Custom decoder for
+json.loads
passed viaobject_pairs_hook
raising error on duplicate keys.+
+- Parameters:
+- +
pairs – Takes the ordered list of pairs as an argument.
+- Returns:
+- +
A dictionary of key as string and value as a secret.
+- Return type:
+- +
Dict[str, SecretStr]
+
- -class pystream.models.config.EnvConfig(_case_sensitive: bool | None = None, _env_prefix: str | None = None, _env_file: DotenvType | None = PosixPath('.'), _env_file_encoding: str | None = None, _env_nested_delimiter: str | None = None, _secrets_dir: str | Path | None = None, *, username: str, password: SecretStr, secret: SecretStr, video_source: Path, video_host: IPv4Address = '127.0.0.1', video_port: int = 8000, session_duration: int = 3600, file_formats: Sequence[str] = ('.mov', '.mp4'), workers: int = 1, website: Optional[List[str]] = [], auto_thumbnail: bool = True)¶
+class pystream.models.config.EnvConfig(_case_sensitive: bool | None = None, _env_prefix: str | None = None, _env_file: DotenvType | None = PosixPath('.'), _env_file_encoding: str | None = None, _env_nested_delimiter: str | None = None, _secrets_dir: str | Path | None = None, *, authorization: Any, video_source: Path, video_host: IPv4Address = '127.0.0.1', video_port: int = 8000, session_duration: int = 3600, file_formats: Sequence[str] = ('.mov', '.mp4'), workers: int = 1, website: Optional[List[str]] = [], auto_thumbnail: bool = True)¶Configure all env vars and validate using
pydantic
to share across modules.@@ -167,18 +199,8 @@>>> EnvConfigModels__init__ uses __pydantic_self__ instead of the more common self for the first arg to allow self as a field name.
-
- -- -username: str¶
--
- - +- -password: SecretStr¶
-+
+- +classmethod parse_authorization(value: Any) → Dict[str, SecretStr]¶
+Validates the authorization parameter.
+
- classmethod parse_video_host(value: IPv4Address) → str¶
@@ -292,7 +320,7 @@Models
- -class pystream.models.config.Static(*, track: str = 'track', stream: str = 'stream', preview: str = 'preview', query_param: str = 'file', home_endpoint: str = '/home', login_endpoint: str = '/login', logout_endpoint: str = '/logout', streaming_endpoint: str = '/video', chunk_size: int = 1048576, deletions: Set[PosixPath] = {}, session_token: str = 'kz44gggJYuC9O2D8r9yUu6bnzQvamheb')¶
+class pystream.models.config.Static(*, track: str = 'track', stream: str = 'stream', preview: str = 'preview', query_param: str = 'file', home_endpoint: str = '/home', login_endpoint: str = '/login', logout_endpoint: str = '/logout', streaming_endpoint: str = '/video', chunk_size: int = 1048576, deletions: ~typing.Set[~pathlib.PosixPath] = {}, cipher_suite: ~cryptography.fernet.Fernet = <cryptography.fernet.Fernet object>)¶Object to store static values.
@@ -353,15 +381,26 @@>>> StaticModels + + + +
- -class pystream.models.config.Session(*, info: dict = {}, invalid: dict = {})¶
+class pystream.models.config.Session(*, info: dict = {}, invalid: dict = {}, mapping: dict = {})¶Object to store session information.
@@ -381,12 +420,17 @@>>> SessionModelsinvalid: dict¶ +
+
+- +mapping: dict¶
++
- -class pystream.models.config.WebToken(*, token: str, timestamp: int)¶
-Object to store and validate JWT objects.
+class pystream.models.config.WebToken(*, token: str, username: str, timestamp: int)¶ +Object to store and validate the symmetric ecrypted payload.
@@ -400,6 +444,11 @@>>> WebTokenModelstoken: str¶
+
+- +username: str¶
+
- timestamp: int¶
@@ -459,7 +508,7 @@Models
- -generate_thumbnails(interval: int = 1, output_dir: PosixPath = None) → bool¶
+generate_thumbnails(interval: int = 1, output_dir: Optional[PosixPath] = None) → bool¶Generate thumbnails for a video file.
+
- Parameters:
@@ -493,7 +542,7 @@Models
- -generate_preview(path: str, at_second: int = None) → bool¶
+generate_preview(path: str, at_second: Optional[int] = None) → bool¶Generate preview image for a video.
+ ++ Secure¶
++
+ +- +async pystream.models.secure.calculate_hash(value: Any) → str¶
+Generate hash value for the given payload.
++
+ +- +async pystream.models.secure.base64_encode(value: Any) → str¶
+Base64 encode the given payload.
++
+ +- +async pystream.models.secure.base64_decode(value: Any) → str¶
+Base64 decode the given payload.
++
+ +- +async pystream.models.secure.hex_decode(value: Any) → str¶
+Convert hex value to a string.
++
+- +async pystream.models.secure.hex_encode(value: str)¶
+Convert string value to hex.
+Squire¶
@@ -608,6 +690,20 @@Models
+
+- +pystream.models.squire.keygen() → str¶
+Generate session token from secrets module, so that users are forced to log in when the server restarts.
++
+- Returns:
+- +
Returns a URL safe 64-bit token.
+- Return type:
+- +
str
+Stream¶
@@ -700,6 +796,26 @@Routers
Authentication¶
++
+- +pystream.routers.auth.get_expiry(lease_start: int, lease_duration: int) → str¶
+Get expiry datetime as string using max age.
++
+- Parameters:
+- +
+
+- +
lease_start – Time when the authentication was made.
- +
lease_duration – Number of seconds until expiry.
- Returns:
+- +
Returns the date and time of expiry in GMT.
+- Return type:
+- +
str
+
- async pystream.routers.auth.home_page(request: Request, session_token: str = Cookie(None)) → TemplateResponse¶
@@ -994,6 +1110,7 @@Table of Contents
- Authenticator
- Config
- Images
+- Secure
- Squire
- Stream
- Subtitles
@@ -1011,7 +1128,7 @@Table of Contents
Next topic
+ title="next chapter">PyStreamThis Page
@@ -1044,7 +1161,7 @@Navigation
modules |- - next |
- Stream documentation »
- Stream-Localhost - A secured interface to stream videos
diff --git a/docs/searchindex.js b/docs/searchindex.js index e8c1dee..68a74d4 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, "asyncio": 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], "run": [0, 1], "start": [0, 1], "bulb": 0, "environ": [0, 1], "can": 0, "option": [0, 1], "load": [0, 1], "from": [0, 1], "ani": 0, "file": [0, 1], "refer": [0, 1], "wiki": 0, "page": [0, 1], "more": [0, 1], "inform": [0, 1], "mandatori": 0, "choic": 0, "secret": [0, 1], "privat": [0, 1], "kei": [0, 1], "encod": 0, "decod": [0, 1], "jwt": [0, 1], "_": 0, "sourc": [0, 1], "underscor": 0, "dot": 0, "ignor": [0, 1], "default": 0, "port": 0, "number": [0, 1], "applic": 0, "8000": [0, 1], "format": 0, "sequenc": [0, 1], "support": 0, "mp4": [0, 1], "mov": [0, 1], "worker": [0, 1], "spin": 0, "up": 0, "uvicorn": 0, "server": 0, "websit": [0, 1], "list": [0, 1], "regex": 0, "cor": 0, "configur": [0, 1], "requir": [0, 1], "onli": [0, 1], "tunnel": 0, "cdn": 0, "auto": 0, "thumbnail": [0, 1], "boolean": [0, 1], "flag": [0, 1], "gener": [0, 1], "imag": 0, "preview": [0, 1], "true": [0, 1], "docstr": 0, "googl": 0, "style": 0, "convent": 0, "pep": 0, "8": 0, "isort": 0, "gitvers": 0, "revers": 0, "f": 0, "release_not": 0, "rst": 0, "t": [0, 1], "pre": 0, "commit": 0, "ensur": 0, "pytest": 0, "valid": [0, 1], "hyperlink": 0, "all": [0, 1], "markdown": 0, "includ": [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, "sampl": 1, "usag": 1, "code": 1, "standard": 1, "releas": 1, "note": 1, "lint": 1, "pypi": 1, "packag": 1, "runbook": 1, "licens": 1, "copyright": 1, "async": 1, "redirect_exception_handl": 1, "request": 1, "except": 1, "redirectexcept": 1, "jsonrespons": 1, "custom": 1, "handler": 1, "handl": 1, "redirect": 1, "paramet": 1, "take": 1, "object": 1, "an": 1, "argument": 1, "inherit": 1, "return": 1, "content": 1, "statu": 1, "cooki": 1, "type": 1, "startup_task": 1, "none": 1, "task": 1, "need": 1, "dure": 1, "api": 1, "startup": 1, "shutdown_task": 1, "shutdown": 1, "starter": 1, "function": 1, "keyword": 1, "env": 1, "failed_auth_count": 1, "keep": 1, "track": 1, "fail": 1, "login": 1, "attempt": 1, "each": 1, "3": 1, "time": 1, "verify_login": 1, "verifi": 1, "json": 1, "respons": 1, "verify_token": 1, "token": 1, "str": 1, "expir": 1, "web": 1, "rais": 1, "class": 1, "envconfig": 1, "_case_sensit": 1, "bool": 1, "_env_prefix": 1, "_env_fil": 1, "dotenvtyp": 1, "posixpath": 1, "_env_file_encod": 1, "_env_nested_delimit": 1, "_secrets_dir": 1, "secretstr": 1, "ipv4address": 1, "video_port": 1, "int": 1, "session_dur": 1, "3600": 1, "file_format": 1, "auto_thumbnail": 1, "var": 1, "pydant": 1, "share": 1, "across": 1, "creat": 1, "new": 1, "pars": 1, "input": 1, "data": 1, "validationerror": 1, "pydantic_cor": 1, "cannot": 1, "form": 1, "__init__": 1, "__pydantic_self__": 1, "instead": 1, "common": 1, "self": 1, "first": 1, "arg": 1, "allow": 1, "field": 1, "name": 1, "variabl": 1, "env_prefix": 1, "env_fil": 1, "extra": 1, "hide_input_in_error": 1, "classmethod": 1, "parse_video_host": 1, "valu": 1, "string": 1, "notion": 1, "parse_websit": 1, "evalu": 1, "fileio": 1, "index": 1, "html": 1, "land": 1, "static": 1, "query_param": 1, "home_endpoint": 1, "home": 1, "login_endpoint": 1, "logout_endpoint": 1, "logout": 1, "streaming_endpoint": 1, "chunk_siz": 1, "1048576": 1, "delet": 1, "set": 1, "session_token": 1, "kz44gggjyuc9o2d8r9yuu6bnzqvamheb": 1, "store": 1, "info": 1, "invalid": 1, "webtoken": 1, "timestamp": 1, "locat": 1, "detail": 1, "within": 1, "sinc": 1, "httpexcept": 1, "doesn": 1, "demand": 1, "case": 1, "where": 1, "i": 1, "solut": 1, "There": 1, "ar": 1, "altern": 1, "work": 1, "our": 1, "javascript": 1, "thi": 1, "wai": 1, "come": 1, "handi": 1, "mani": 1, "unexpect": 1, "scenario": 1, "tiangolo": 1, "com": 1, "tutori": 1, "error": 1, "instanti": 1, "reason": 1, "alia": 1, "filepath": 1, "initi": 1, "captur": 1, "frame": 1, "particular": 1, "opencv": 1, "": 1, "videocaptur": 1, "generate_thumbnail": 1, "interv": 1, "output_dir": 1, "second": 1, "output": 1, "directori": 1, "success": 1, "failur": 1, "get_video_length": 1, "tupl": 1, "timedelta": 1, "get": 1, "calcul": 1, "length": 1, "datetim": 1, "generate_preview": 1, "at_second": 1, "which": 1, "should": 1, "log_connect": 1, "log": 1, "connect": 1, "devic": 1, "avoid": 1, "multipl": 1, "when": 1, "same": 1, "differ": 1, "natural_sort_kei": 1, "filenam": 1, "union": 1, "sort": 1, "natur": 1, "element": 1, "deriv": 1, "split": 1, "part": 1, "regular": 1, "express": 1, "get_dir_stream_cont": 1, "parent": 1, "subdir": 1, "insid": 1, "displai": 1, "subdirectori": 1, "exist": 1, "dictionari": 1, "pair": 1, "get_all_stream_cont": 1, "folder": 1, "contain": 1, "section": 1, "get_it": 1, "purepath": 1, "current": 1, "serv": 1, "previou": 1, "next": 1, "render": 1, "remove_thumbnail": 1, "img_path": 1, "trigger": 1, "timer": 1, "remov": 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, "proce": 1, "header": 1, "size": 1, "range_requests_respons": 1, "file_path": 1, "streamingrespons": 1, "given": 1, "srt_to_vtt": 1, "convert": 1, "srt": 1, "vtt": 1, "compat": 1, "j": 1, "vtt_to_srt": 1, "auth": 1, "home_pag": 1, "templaterespons": 1, "ui": 1, "after": 1, "user": 1, "htmlrespons": 1, "termin": 1, "back": 1, "upon": 1, "refresh": 1, "base": 1, "get_favicon": 1, "filerespons": 1, "favicon": 1, "ico": 1, "endpoint": 1, "robinhood": 1, "script": 1, "root": 1, "redirectrespons": 1, "broken": 1, "relat": 1, "preview_load": 1, "ha": 1, "setup": 1, "track_load": 1, "track_path": 1, "stream_video": 1, "video_path": 1, "templat": 1, "video_endpoint": 1, "receiv": 1, "rootfilt": 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, "fals": 1, "discard": 1, "togeth": 1, "its": 1, "children": 1, "have": 1, "event": 1, "through": 1, "If": 1, "specifi": 1, "everi": 1, "logrecord": 1, "out": 1, "repres": 1, "someth": 1, "simpl": 1, "check": 1, "network": 1, "id": 1, "retriev": 1, "machin": 1, "get_public_ip": 1, "extract": 1, "public": 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, "", "redirect_exception_handler"], [1, 3, 1, "", "shutdown_tasks"], [1, 3, 1, "", "start"], [1, 3, 1, "", "startup_tasks"]], "pystream.models": [[1, 0, 0, "-", "authenticator"], [1, 0, 0, "-", "config"], [1, 0, 0, "-", "images"], [1, 0, 0, "-", "squire"], [1, 0, 0, "-", "stream"], [1, 0, 0, "-", "subtitles"]], "pystream.models.authenticator": [[1, 3, 1, "", "failed_auth_counter"], [1, 3, 1, "", "verify_login"], [1, 3, 1, "", "verify_token"]], "pystream.models.config": [[1, 1, 1, "", "EnvConfig"], [1, 1, 1, "", "FileIO"], [1, 5, 1, "", "RedirectException"], [1, 1, 1, "", "Session"], [1, 1, 1, "", "Static"], [1, 1, 1, "", "WebToken"], [1, 4, 1, "", "env"]], "pystream.models.config.EnvConfig": [[1, 1, 1, "", "Config"], [1, 4, 1, "", "auto_thumbnail"], [1, 4, 1, "", "file_formats"], [1, 2, 1, "", "parse_video_host"], [1, 2, 1, "", "parse_website"], [1, 4, 1, "", "password"], [1, 4, 1, "", "secret"], [1, 4, 1, "", "session_duration"], [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, "", "landing"], [1, 4, 1, "", "listing"]], "pystream.models.config.Session": [[1, 4, 1, "", "info"], [1, 4, 1, "", "invalid"]], "pystream.models.config.Static": [[1, 4, 1, "", "chunk_size"], [1, 4, 1, "", "deletions"], [1, 4, 1, "", "home_endpoint"], [1, 4, 1, "", "login_endpoint"], [1, 4, 1, "", "logout_endpoint"], [1, 4, 1, "", "preview"], [1, 4, 1, "", "query_param"], [1, 4, 1, "", "session_token"], [1, 4, 1, "", "stream"], [1, 4, 1, "", "streaming_endpoint"], [1, 4, 1, "", "track"]], "pystream.models.config.WebToken": [[1, 4, 1, "", "timestamp"], [1, 4, 1, "", "token"]], "pystream.models.images": [[1, 1, 1, "", "Images"]], "pystream.models.images.Images": [[1, 2, 1, "", "generate_preview"], [1, 2, 1, "", "generate_thumbnails"], [1, 2, 1, "", "get_video_length"]], "pystream.models.squire": [[1, 3, 1, "", "get_all_stream_content"], [1, 3, 1, "", "get_dir_stream_content"], [1, 3, 1, "", "get_iter"], [1, 3, 1, "", "log_connection"], [1, 3, 1, "", "natural_sort_key"], [1, 3, 1, "", "remove_thumbnail"]], "pystream.models.stream": [[1, 3, 1, "", "get_range_header"], [1, 3, 1, "", "range_requests_response"], [1, 3, 1, "", "send_bytes_range_requests"]], "pystream.models.subtitles": [[1, 3, 1, "", "srt_to_vtt"], [1, 3, 1, "", "vtt_to_srt"]], "pystream.routers": [[1, 0, 0, "-", "auth"], [1, 0, 0, "-", "basics"], [1, 0, 0, "-", "video"]], "pystream.routers.auth": [[1, 3, 1, "", "home_page"], [1, 3, 1, "", "login"], [1, 3, 1, "", "logout"]], "pystream.routers.basics": [[1, 3, 1, "", "error"], [1, 3, 1, "", "get_favicon"], [1, 3, 1, "", "root"]], "pystream.routers.video": [[1, 3, 1, "", "preview_loader"], [1, 3, 1, "", "stream_video"], [1, 3, 1, "", "track_loader"], [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", "5": "py:exception"}, "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"], "5": ["py", "exception", "Python exception"]}, "titleterms": {"video": [0, 1], "stream": [0, 1], "instal": 0, "sampl": 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, "config": 1, "imag": 1, "squir": 1, "subtitl": 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", "authentication", "index"], "filenames": ["README.md", "authentication.md", "index.rst"], "titles": ["PyStream", "Authentication", "Stream-Localhost - A secured interface to stream videos"], "terms": {"deploy": 0, "python": 0, "modul": 0, "stream": [0, 1], "video": 0, "via": [0, 2], "authent": 0, "session": [0, 2], "us": [0, 1, 2], "fastapi": [0, 1, 2], "m": 0, "pip": 0, "localhost": 0, "import": 0, "asyncio": 0, "o": 0, "__name__": 0, "__main__": 0, "kwarg": [0, 2], "dict": [0, 2], "author": [0, 1, 2], "alan": 0, "ture": 0, "pr0gramm1ng": 0, "linu": 0, "torvald": 0, "linuxo": 0, "video_sourc": [0, 2], "path": [0, 2], "join": 0, "expandus": 0, "download": 0, "add": [0, 2], "follow": [0, 1], "host": [0, 2], "local": [0, 2], "ip": [0, 2], "address": [0, 2], "skip": 0, "127": [0, 2], "0": [0, 2], "1": [0, 2], "video_host": [0, 2], "util": 0, "get_local_ip": [0, 2], "run": [0, 2], "start": [0, 2], "bulb": 0, "environ": [0, 2], "can": [0, 1], "option": [0, 2], "load": [0, 2], "from": [0, 1, 2], "ani": [0, 2], "file": [0, 2], "refer": [0, 2], "wiki": 0, "page": [0, 1, 2], "more": [0, 2], "inform": [0, 2], "mandatori": 0, "dictionari": [0, 2], "kei": [0, 1, 2], "valu": [0, 1, 2], "pair": [0, 2], "usernam": [0, 2], "password": [0, 2], "_": 0, "sourc": [0, 2], "underscor": 0, "dot": 0, "ignor": [0, 2], "default": 0, "port": 0, "number": [0, 2], "applic": 0, "8000": [0, 2], "format": 0, "sequenc": [0, 2], "support": 0, "mp4": [0, 2], "mov": [0, 2], "worker": [0, 2], "spin": 0, "up": 0, "uvicorn": 0, "server": [0, 1, 2], "websit": [0, 2], "list": [0, 2], "regex": 0, "cor": 0, "configur": [0, 2], "requir": [0, 2], "onli": [0, 1, 2], "tunnel": 0, "cdn": 0, "auto": 0, "thumbnail": [0, 2], "boolean": [0, 2], "flag": [0, 2], "gener": [0, 1, 2], "imag": 0, "preview": [0, 2], "true": [0, 2], "docstr": 0, "googl": 0, "style": 0, "convent": 0, "pep": 0, "8": 0, "isort": 0, "gitvers": 0, "revers": 0, "f": 0, "release_not": 0, "rst": 0, "t": [0, 2], "pre": 0, "commit": 0, "ensur": 0, "pytest": 0, "valid": [0, 2], "hyperlink": 0, "all": [0, 1, 2], "markdown": 0, "includ": [0, 1, 2], "sphinx": 0, "5": 0, "recommonmark": 0, "http": [0, 2], "org": 0, "project": 0, "thevickypedia": 0, "github": 0, "io": 0, "vignesh": 0, "rao": 0, "under": 0, "mit": 0, "pystream": [1, 2], "two": 1, "wai": [1, 2], "gain": 1, "access": [1, 2], "session_token": [1, 2], "directori": [1, 2], "content": [1, 2], "signatur": 1, "ui": [1, 2], "creat": [1, 2], "hex": [1, 2], "nativ": 1, "j": [1, 2], "These": 1, "ar": [1, 2], "calcul": [1, 2], "hash": [1, 2], "i": [1, 2], "base64": [1, 2], "encod": [1, 2], "befor": [1, 2], "send": [1, 2], "api": [1, 2], "an": [1, 2], "header": [1, 2], "decod": [1, 2], "ascii": 1, "string": [1, 2], "receiv": [1, 2], "Then": 1, "broken": [1, 2], "down": 1, "timestamp": [1, 2], "The": [1, 2], "get": [1, 2], "store": [1, 2], "env": [1, 2], "variabl": [1, 2], "which": [1, 2], "compar": 1, "purpos": 1, "symmetr": [1, 2], "encrypt": [1, 2], "onc": 1, "login": [1, 2], "ha": [1, 2], "been": 1, "success": [1, 2], "randomli": 1, "64": [1, 2], "bit": [1, 2], "url": [1, 2], "safe": [1, 2], "thi": [1, 2], "uniqu": 1, "each": [1, 2], "user": [1, 2], "form": [1, 2], "payload": [1, 2], "cryptographi": [1, 2], "": [1, 2], "fernet": [1, 2], "retriev": [1, 2], "cooki": [1, 2], "jsonrespons": [1, 2], "redirect_url": 1, "sinc": [1, 2], "ajax": 1, "post": 1, "call": 1, "redirectrespons": [1, 2], "work": [1, 2], "simpli": 1, "redirect": [1, 2], "instead": [1, 2], "json": [1, 2], "respons": [1, 2], "fetch": 1, "alter": 1, "locat": [1, 2], "href": 1, "transfer": 1, "new": [1, 2], "so": [1, 2], "lost": 1, "point": 1, "navig": 1, "carri": 1, "onward": 1, "instal": 2, "sampl": 2, "usag": 2, "code": 2, "standard": 2, "releas": 2, "note": 2, "lint": 2, "pypi": 2, "packag": 2, "runbook": 2, "licens": 2, "copyright": 2, "token": 2, "async": 2, "redirect_exception_handl": 2, "request": 2, "except": 2, "redirectexcept": 2, "custom": 2, "handler": 2, "handl": 2, "paramet": 2, "take": 2, "object": 2, "argument": 2, "inherit": 2, "return": 2, "statu": 2, "type": 2, "startup_task": 2, "none": 2, "task": 2, "need": 2, "dure": 2, "startup": 2, "shutdown_task": 2, "shutdown": 2, "starter": 2, "function": 2, "keyword": 2, "failed_auth_count": 2, "keep": 2, "track": 2, "fail": 2, "attempt": 2, "3": 2, "time": 2, "extract_credenti": 2, "str": 2, "extract": 2, "credenti": 2, "raise_error": 2, "noreturn": 2, "rais": 2, "401": 2, "unauthor": 2, "error": 2, "case": 2, "bad": 2, "verify_login": 2, "union": 2, "int": 2, "verifi": 2, "verify_token": 2, "decrypt": 2, "expir": 2, "as_dict": 2, "tupl": 2, "secretstr": 2, "pass": 2, "object_pairs_hook": 2, "duplic": 2, "order": 2, "secret": 2, "class": 2, "envconfig": 2, "_case_sensit": 2, "bool": 2, "_env_prefix": 2, "_env_fil": 2, "dotenvtyp": 2, "posixpath": 2, "_env_file_encod": 2, "_env_nested_delimit": 2, "_secrets_dir": 2, "ipv4address": 2, "video_port": 2, "session_dur": 2, "3600": 2, "file_format": 2, "auto_thumbnail": 2, "var": 2, "pydant": 2, "share": 2, "across": 2, "pars": 2, "input": 2, "data": 2, "validationerror": 2, "pydantic_cor": 2, "cannot": 2, "__init__": 2, "__pydantic_self__": 2, "common": 2, "self": 2, "first": 2, "arg": 2, "allow": 2, "field": 2, "name": 2, "env_prefix": 2, "env_fil": 2, "extra": 2, "hide_input_in_error": 2, "classmethod": 2, "parse_author": 2, "parse_video_host": 2, "notion": 2, "parse_websit": 2, "evalu": 2, "fileio": 2, "index": 2, "html": 2, "land": 2, "static": 2, "query_param": 2, "home_endpoint": 2, "home": 2, "login_endpoint": 2, "logout_endpoint": 2, "logout": 2, "streaming_endpoint": 2, "chunk_siz": 2, "1048576": 2, "delet": 2, "set": 2, "pathlib": 2, "cipher_suit": 2, "arbitrary_types_allow": 2, "info": 2, "invalid": 2, "map": 2, "webtoken": 2, "ecrypt": 2, "detail": 2, "within": 2, "httpexcept": 2, "doesn": 2, "demand": 2, "where": 2, "solut": 2, "There": 2, "altern": 2, "our": 2, "javascript": 2, "come": 2, "handi": 2, "mani": 2, "unexpect": 2, "scenario": 2, "tiangolo": 2, "com": 2, "tutori": 2, "instanti": 2, "reason": 2, "alia": 2, "filepath": 2, "initi": 2, "captur": 2, "frame": 2, "particular": 2, "opencv": 2, "videocaptur": 2, "generate_thumbnail": 2, "interv": 2, "output_dir": 2, "second": 2, "output": 2, "failur": 2, "get_video_length": 2, "timedelta": 2, "length": 2, "datetim": 2, "generate_preview": 2, "at_second": 2, "should": 2, "calculate_hash": 2, "given": 2, "base64_encod": 2, "base64_decod": 2, "hex_decod": 2, "convert": 2, "hex_encod": 2, "log_connect": 2, "log": 2, "connect": 2, "devic": 2, "avoid": 2, "multipl": 2, "when": 2, "same": 2, "differ": 2, "natural_sort_kei": 2, "filenam": 2, "sort": 2, "natur": 2, "element": 2, "deriv": 2, "split": 2, "part": 2, "regular": 2, "express": 2, "get_dir_stream_cont": 2, "parent": 2, "subdir": 2, "insid": 2, "displai": 2, "subdirectori": 2, "exist": 2, "get_all_stream_cont": 2, "folder": 2, "contain": 2, "section": 2, "get_it": 2, "purepath": 2, "current": 2, "serv": 2, "previou": 2, "next": 2, "render": 2, "remove_thumbnail": 2, "img_path": 2, "trigger": 2, "timer": 2, "remov": 2, "keygen": 2, "forc": 2, "restart": 2, "send_bytes_range_request": 2, "file_obj": 2, "binaryio": 2, "start_rang": 2, "end_rang": 2, "asynciter": 2, "bytestr": 2, "chunk": 2, "rang": 2, "specif": 2, "rfc7233": 2, "byte": 2, "end": 2, "yield": 2, "iter": 2, "get_range_head": 2, "range_head": 2, "file_s": 2, "proce": 2, "size": 2, "range_requests_respons": 2, "file_path": 2, "streamingrespons": 2, "srt_to_vtt": 2, "srt": 2, "vtt": 2, "compat": 2, "vtt_to_srt": 2, "auth": 2, "get_expiri": 2, "lease_start": 2, "lease_dur": 2, "expiri": 2, "max": 2, "ag": 2, "wa": 2, "made": 2, "until": 2, "date": 2, "gmt": 2, "home_pag": 2, "templaterespons": 2, "after": 2, "htmlrespons": 2, "termin": 2, "back": 2, "upon": 2, "refresh": 2, "base": 2, "get_favicon": 2, "filerespons": 2, "favicon": 2, "ico": 2, "endpoint": 2, "robinhood": 2, "script": 2, "root": 2, "relat": 2, "preview_load": 2, "setup": 2, "track_load": 2, "track_path": 2, "stream_video": 2, "video_path": 2, "templat": 2, "video_endpoint": 2, "rootfilt": 2, "filter": 2, "while": 2, "preserv": 2, "other": 2, "200": 2, "ok": 2, "307": 2, "temporari": 2, "vid_nam": 2, "redund": 2, "overrid": 2, "implement": 2, "subclass": 2, "method": 2, "record": 2, "examin": 2, "fals": 2, "discard": 2, "togeth": 2, "its": 2, "children": 2, "have": 2, "event": 2, "through": 2, "If": 2, "specifi": 2, "everi": 2, "logrecord": 2, "out": 2, "repres": 2, "someth": 2, "simpl": 2, "check": 2, "network": 2, "id": 2, "privat": 2, "machin": 2, "get_public_ip": 2, "public": 2, "make": 2, "extern": 2, "search": 2}, "objects": {"pystream": [[2, 0, 0, "-", "logger"], [2, 0, 0, "-", "main"], [2, 0, 0, "-", "utils"]], "pystream.logger": [[2, 1, 1, "", "RootFilter"]], "pystream.logger.RootFilter": [[2, 2, 1, "", "filter"]], "pystream.main": [[2, 3, 1, "", "redirect_exception_handler"], [2, 3, 1, "", "shutdown_tasks"], [2, 3, 1, "", "start"], [2, 3, 1, "", "startup_tasks"]], "pystream.models": [[2, 0, 0, "-", "authenticator"], [2, 0, 0, "-", "config"], [2, 0, 0, "-", "images"], [2, 0, 0, "-", "secure"], [2, 0, 0, "-", "squire"], [2, 0, 0, "-", "stream"], [2, 0, 0, "-", "subtitles"]], "pystream.models.authenticator": [[2, 3, 1, "", "extract_credentials"], [2, 3, 1, "", "failed_auth_counter"], [2, 3, 1, "", "raise_error"], [2, 3, 1, "", "verify_login"], [2, 3, 1, "", "verify_token"]], "pystream.models.config": [[2, 1, 1, "", "EnvConfig"], [2, 1, 1, "", "FileIO"], [2, 5, 1, "", "RedirectException"], [2, 1, 1, "", "Session"], [2, 1, 1, "", "Static"], [2, 1, 1, "", "WebToken"], [2, 3, 1, "", "as_dict"], [2, 4, 1, "", "env"]], "pystream.models.config.EnvConfig": [[2, 1, 1, "", "Config"], [2, 4, 1, "", "authorization"], [2, 4, 1, "", "auto_thumbnail"], [2, 4, 1, "", "file_formats"], [2, 2, 1, "", "parse_authorization"], [2, 2, 1, "", "parse_video_host"], [2, 2, 1, "", "parse_website"], [2, 4, 1, "", "session_duration"], [2, 4, 1, "", "video_host"], [2, 4, 1, "", "video_port"], [2, 4, 1, "", "video_source"], [2, 4, 1, "", "website"], [2, 4, 1, "", "workers"]], "pystream.models.config.EnvConfig.Config": [[2, 4, 1, "", "env_file"], [2, 4, 1, "", "env_prefix"], [2, 4, 1, "", "extra"], [2, 4, 1, "", "hide_input_in_errors"]], "pystream.models.config.FileIO": [[2, 4, 1, "", "index"], [2, 4, 1, "", "landing"], [2, 4, 1, "", "listing"]], "pystream.models.config.Session": [[2, 4, 1, "", "info"], [2, 4, 1, "", "invalid"], [2, 4, 1, "", "mapping"]], "pystream.models.config.Static": [[2, 1, 1, "", "Config"], [2, 4, 1, "", "chunk_size"], [2, 4, 1, "", "cipher_suite"], [2, 4, 1, "", "deletions"], [2, 4, 1, "", "home_endpoint"], [2, 4, 1, "", "login_endpoint"], [2, 4, 1, "", "logout_endpoint"], [2, 4, 1, "", "preview"], [2, 4, 1, "", "query_param"], [2, 4, 1, "", "stream"], [2, 4, 1, "", "streaming_endpoint"], [2, 4, 1, "", "track"]], "pystream.models.config.Static.Config": [[2, 4, 1, "", "arbitrary_types_allowed"]], "pystream.models.config.WebToken": [[2, 4, 1, "", "timestamp"], [2, 4, 1, "", "token"], [2, 4, 1, "", "username"]], "pystream.models.images": [[2, 1, 1, "", "Images"]], "pystream.models.images.Images": [[2, 2, 1, "", "generate_preview"], [2, 2, 1, "", "generate_thumbnails"], [2, 2, 1, "", "get_video_length"]], "pystream.models.secure": [[2, 3, 1, "", "base64_decode"], [2, 3, 1, "", "base64_encode"], [2, 3, 1, "", "calculate_hash"], [2, 3, 1, "", "hex_decode"], [2, 3, 1, "", "hex_encode"]], "pystream.models.squire": [[2, 3, 1, "", "get_all_stream_content"], [2, 3, 1, "", "get_dir_stream_content"], [2, 3, 1, "", "get_iter"], [2, 3, 1, "", "keygen"], [2, 3, 1, "", "log_connection"], [2, 3, 1, "", "natural_sort_key"], [2, 3, 1, "", "remove_thumbnail"]], "pystream.models.stream": [[2, 3, 1, "", "get_range_header"], [2, 3, 1, "", "range_requests_response"], [2, 3, 1, "", "send_bytes_range_requests"]], "pystream.models.subtitles": [[2, 3, 1, "", "srt_to_vtt"], [2, 3, 1, "", "vtt_to_srt"]], "pystream.routers": [[2, 0, 0, "-", "auth"], [2, 0, 0, "-", "basics"], [2, 0, 0, "-", "video"]], "pystream.routers.auth": [[2, 3, 1, "", "get_expiry"], [2, 3, 1, "", "home_page"], [2, 3, 1, "", "login"], [2, 3, 1, "", "logout"]], "pystream.routers.basics": [[2, 3, 1, "", "error"], [2, 3, 1, "", "get_favicon"], [2, 3, 1, "", "root"]], "pystream.routers.video": [[2, 3, 1, "", "preview_loader"], [2, 3, 1, "", "stream_video"], [2, 3, 1, "", "track_loader"], [2, 3, 1, "", "video_endpoint"]], "pystream.utils": [[2, 3, 1, "", "get_local_ip"], [2, 3, 1, "", "get_public_ip"]]}, "objtypes": {"0": "py:module", "1": "py:class", "2": "py:method", "3": "py:function", "4": "py:attribute", "5": "py:exception"}, "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"], "5": ["py", "exception", "Python exception"]}, "titleterms": {"pystream": 0, "instal": 0, "sampl": 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, "authent": [1, 2], "usernam": 1, "password": 1, "frontend": 1, "backend": 1, "session": 1, "token": 1, "refer": 1, "stream": 2, "localhost": 2, "A": 2, "secur": 2, "interfac": 2, "video": 2, "read": 2, "me": 2, "main": 2, "modul": 2, "model": 2, "config": 2, "imag": 2, "squir": 2, "subtitl": 2, "router": 2, "basic": 2, "support": 2, "logger": 2, "util": 2, "indic": 2, "tabl": 2}, "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/templates/index.html b/pystream/templates/index.html index 6f51116..0248d1c 100644 --- a/pystream/templates/index.html +++ b/pystream/templates/index.html @@ -9,6 +9,7 @@ + @@ -125,9 +126,17 @@ const message = username + password + timestamp; const encoder = new TextEncoder(); const data = encoder.encode(message); - const hashBuffer = await crypto.subtle.digest('SHA-512', data); - const hashArray = Array.from(new Uint8Array(hashBuffer)); - return hashArray.map(byte => byte.toString(16).padStart(2, '0')).join(''); + if (crypto.subtle === undefined) { + const wordArray = CryptoJS.lib.WordArray.create(data); + const hash = CryptoJS.SHA512(wordArray); + // Convert the hash to a hexadecimal string and return it + return hash.toString(CryptoJS.enc.Hex); + } else { + const hashBuffer = await crypto.subtle.digest('SHA-512', data); + const hashArray = Array.from(new Uint8Array(hashBuffer)); + // Convert each byte to a hexadecimal string, pad with zeros, and join them to form the final hash + return hashArray.map(byte => byte.toString(16).padStart(2, '0')).join(''); + } } let hex_user = await ConvertStringToHex(username); let hex_pass = await ConvertStringToHex(password);