From 75bf3d8d51671353c2f533f3675283941e94beb2 Mon Sep 17 00:00:00 2001 From: thevickypedia <vignesh.sivanandarao@gmail.com> Date: Sun, 18 Feb 2024 21:34:13 -0600 Subject: [PATCH] Change env var `website` to `websites` Update README.md and runbook --- README.md | 8 ++--- doc_gen/index.rst | 7 ---- docs/README.html | 6 ++-- docs/README.md | 6 ++-- docs/_sources/README.md.txt | 6 ++-- docs/_sources/index.rst.txt | 14 -------- docs/genindex.html | 49 ++++--------------------- docs/index.html | 70 ++++++------------------------------ docs/objects.inv | Bin 1223 -> 1175 bytes docs/py-modindex.html | 10 ------ docs/searchindex.js | 2 +- pystream/main.py | 4 +-- pystream/models/config.py | 6 ++-- 13 files changed, 38 insertions(+), 150 deletions(-) diff --git a/README.md b/README.md index 6f67ef2..2f257ab 100644 --- a/README.md +++ b/README.md @@ -46,13 +46,13 @@ if __name__ == '__main__': - **VIDEO_PORT**: Port number to host the application. Defaults to `8000` - **FILE_FORMATS**: Sequence of supported video file formats. Defaults to `(.mp4, .mov)` - **WORKERS**: Number of workers to spin up the `uvicorn` server. Defaults to `1` -- **WEBSITE**: List of websites (_supports regex_) to add to CORS configuration. _Required only if tunneled via CDN_ +- **WEBSITES**: List of websites (_supports regex_) to add to CORS configuration. _Required only if tunneled via CDN_ - **AUTO_THUMBNAIL**: Boolean flag to auto generate thumbnail images for preview. Defaults to `True` -- **SECURE_SESSION**: Boolean flag to secure the cookie `session_token` to restrict serving **_ONLY_** via **HTTPS**. -Defaults to `False` - **KEY_FILE**: Path to the private key file for SSL certificate. Defaults to `None` - **CERT_FILE**: Path to the full chain file for SSL certificate. Defaults to `None` -> :bulb: `KEY_FILE` and `CERT_FILE` becomes mandatory when `VIDEO_PORT` is set to `443` +- **SECURE_SESSION**: Boolean flag to secure the cookie `session_token`. Defaults to `False` +> :bulb: If `SECURE_SESSION` to set to `true`, the cookie `session_token` will only be sent via HTTPS<br> +> This means that the server can **ONLY** be hosted via `HTTPS` or `localhost` ## Coding Standards Docstring format: [`Google`][google-docs] <br> diff --git a/doc_gen/index.rst b/doc_gen/index.rst index a9519b7..ff8317e 100644 --- a/doc_gen/index.rst +++ b/doc_gen/index.rst @@ -79,13 +79,6 @@ Basics :members: :undoc-members: -Secure -====== - -.. automodule:: pystream.routers.secure - :members: - :undoc-members: - Video ===== diff --git a/docs/README.html b/docs/README.html index 6432ba5..ad50f20 100644 --- a/docs/README.html +++ b/docs/README.html @@ -94,13 +94,15 @@ <h3>Env Variables<a class="headerlink" href="#env-variables" title="Permalink to <li><p><strong>VIDEO_PORT</strong>: Port number to host the application. Defaults to <code class="docutils literal notranslate"><span class="pre">8000</span></code></p></li> <li><p><strong>FILE_FORMATS</strong>: Sequence of supported video file formats. Defaults to <code class="docutils literal notranslate"><span class="pre">(.mp4,</span> <span class="pre">.mov)</span></code></p></li> <li><p><strong>WORKERS</strong>: Number of workers to spin up the <code class="docutils literal notranslate"><span class="pre">uvicorn</span></code> server. Defaults to <code class="docutils literal notranslate"><span class="pre">1</span></code></p></li> -<li><p><strong>WEBSITE</strong>: List of websites (<em>supports regex</em>) to add to CORS configuration. <em>Required only if tunneled via CDN</em></p></li> +<li><p><strong>WEBSITES</strong>: List of websites (<em>supports regex</em>) to add to CORS configuration. <em>Required only if tunneled via CDN</em></p></li> <li><p><strong>AUTO_THUMBNAIL</strong>: Boolean flag to auto generate thumbnail images for preview. Defaults to <code class="docutils literal notranslate"><span class="pre">True</span></code></p></li> <li><p><strong>KEY_FILE</strong>: Path to the private key file for SSL certificate. Defaults to <code class="docutils literal notranslate"><span class="pre">None</span></code></p></li> <li><p><strong>CERT_FILE</strong>: Path to the full chain file for SSL certificate. Defaults to <code class="docutils literal notranslate"><span class="pre">None</span></code></p></li> +<li><p><strong>SECURE_SESSION</strong>: Boolean flag to secure the cookie <code class="docutils literal notranslate"><span class="pre">session_token</span></code>. Defaults to <code class="docutils literal notranslate"><span class="pre">False</span></code></p></li> </ul> <blockquote> -<div><p>:bulb: <code class="docutils literal notranslate"><span class="pre">KEY_FILE</span></code> and <code class="docutils literal notranslate"><span class="pre">CERT_FILE</span></code> becomes mandatory when <code class="docutils literal notranslate"><span class="pre">VIDEO_PORT</span></code> is set to <code class="docutils literal notranslate"><span class="pre">443</span></code></p> +<div><p>:bulb: If <code class="docutils literal notranslate"><span class="pre">SECURE_SESSION</span></code> to set to <code class="docutils literal notranslate"><span class="pre">true</span></code>, the cookie <code class="docutils literal notranslate"><span class="pre">session_token</span></code> will only be sent via HTTPS<br> +This means that the server can <strong>ONLY</strong> be hosted via <code class="docutils literal notranslate"><span class="pre">HTTPS</span></code> or <code class="docutils literal notranslate"><span class="pre">localhost</span></code></p> </div></blockquote> </section> </section> diff --git a/docs/README.md b/docs/README.md index 2f1fc55..2f257ab 100644 --- a/docs/README.md +++ b/docs/README.md @@ -46,11 +46,13 @@ if __name__ == '__main__': - **VIDEO_PORT**: Port number to host the application. Defaults to `8000` - **FILE_FORMATS**: Sequence of supported video file formats. Defaults to `(.mp4, .mov)` - **WORKERS**: Number of workers to spin up the `uvicorn` server. Defaults to `1` -- **WEBSITE**: List of websites (_supports regex_) to add to CORS configuration. _Required only if tunneled via CDN_ +- **WEBSITES**: List of websites (_supports regex_) to add to CORS configuration. _Required only if tunneled via CDN_ - **AUTO_THUMBNAIL**: Boolean flag to auto generate thumbnail images for preview. Defaults to `True` - **KEY_FILE**: Path to the private key file for SSL certificate. Defaults to `None` - **CERT_FILE**: Path to the full chain file for SSL certificate. Defaults to `None` -> :bulb: `KEY_FILE` and `CERT_FILE` becomes mandatory when `VIDEO_PORT` is set to `443` +- **SECURE_SESSION**: Boolean flag to secure the cookie `session_token`. Defaults to `False` +> :bulb: If `SECURE_SESSION` to set to `true`, the cookie `session_token` will only be sent via HTTPS<br> +> This means that the server can **ONLY** be hosted via `HTTPS` or `localhost` ## Coding Standards Docstring format: [`Google`][google-docs] <br> diff --git a/docs/_sources/README.md.txt b/docs/_sources/README.md.txt index 2f1fc55..2f257ab 100644 --- a/docs/_sources/README.md.txt +++ b/docs/_sources/README.md.txt @@ -46,11 +46,13 @@ if __name__ == '__main__': - **VIDEO_PORT**: Port number to host the application. Defaults to `8000` - **FILE_FORMATS**: Sequence of supported video file formats. Defaults to `(.mp4, .mov)` - **WORKERS**: Number of workers to spin up the `uvicorn` server. Defaults to `1` -- **WEBSITE**: List of websites (_supports regex_) to add to CORS configuration. _Required only if tunneled via CDN_ +- **WEBSITES**: List of websites (_supports regex_) to add to CORS configuration. _Required only if tunneled via CDN_ - **AUTO_THUMBNAIL**: Boolean flag to auto generate thumbnail images for preview. Defaults to `True` - **KEY_FILE**: Path to the private key file for SSL certificate. Defaults to `None` - **CERT_FILE**: Path to the full chain file for SSL certificate. Defaults to `None` -> :bulb: `KEY_FILE` and `CERT_FILE` becomes mandatory when `VIDEO_PORT` is set to `443` +- **SECURE_SESSION**: Boolean flag to secure the cookie `session_token`. Defaults to `False` +> :bulb: If `SECURE_SESSION` to set to `true`, the cookie `session_token` will only be sent via HTTPS<br> +> This means that the server can **ONLY** be hosted via `HTTPS` or `localhost` ## Coding Standards Docstring format: [`Google`][google-docs] <br> diff --git a/docs/_sources/index.rst.txt b/docs/_sources/index.rst.txt index 79b0c84..ff8317e 100644 --- a/docs/_sources/index.rst.txt +++ b/docs/_sources/index.rst.txt @@ -42,13 +42,6 @@ Images :members: :undoc-members: -Secure -====== - -.. automodule:: pystream.models.secure - :members: - :undoc-members: - Squire ====== @@ -86,13 +79,6 @@ Basics :members: :undoc-members: -Secure -====== - -.. automodule:: pystream.routers.secure - :members: - :undoc-members: - Video ===== diff --git a/docs/genindex.html b/docs/genindex.html index 6fe153e..1bfa41d 100644 --- a/docs/genindex.html +++ b/docs/genindex.html @@ -42,7 +42,6 @@ <h1 id="index">Index</h1> <div class="genindex-jumpbox"> <a href="#A"><strong>A</strong></a> - | <a href="#B"><strong>B</strong></a> | <a href="#C"><strong>C</strong></a> | <a href="#D"><strong>D</strong></a> | <a href="#E"><strong>E</strong></a> @@ -80,23 +79,9 @@ <h2 id="A">A</h2> </ul></td> </tr></table> -<h2 id="B">B</h2> -<table style="width: 100%" class="indextable genindextable"><tr> - <td style="width: 33%; vertical-align: top;"><ul> - <li><a href="index.html#pystream.models.secure.base64_decode">base64_decode() (in module pystream.models.secure)</a> -</li> - </ul></td> - <td style="width: 33%; vertical-align: top;"><ul> - <li><a href="index.html#pystream.models.secure.base64_encode">base64_encode() (in module pystream.models.secure)</a> -</li> - </ul></td> -</tr></table> - <h2 id="C">C</h2> <table style="width: 100%" class="indextable genindextable"><tr> <td style="width: 33%; vertical-align: top;"><ul> - <li><a href="index.html#pystream.models.secure.calculate_hash">calculate_hash() (in module pystream.models.secure)</a> -</li> <li><a href="index.html#pystream.models.config.EnvConfig.cert_file">cert_file (pystream.models.config.EnvConfig attribute)</a> </li> </ul></td> @@ -189,10 +174,6 @@ <h2 id="G">G</h2> <h2 id="H">H</h2> <table style="width: 100%" class="indextable genindextable"><tr> <td style="width: 33%; vertical-align: top;"><ul> - <li><a href="index.html#pystream.models.secure.hex_decode">hex_decode() (in module pystream.models.secure)</a> -</li> - <li><a href="index.html#pystream.models.secure.hex_encode">hex_encode() (in module pystream.models.secure)</a> -</li> <li><a href="index.html#pystream.models.config.EnvConfig.Config.hide_input_in_errors">hide_input_in_errors (pystream.models.config.EnvConfig.Config attribute)</a> </li> </ul></td> @@ -200,8 +181,6 @@ <h2 id="H">H</h2> <li><a href="index.html#pystream.models.config.Static.home_endpoint">home_endpoint (pystream.models.config.Static attribute)</a> </li> <li><a href="index.html#pystream.routers.auth.home_page">home_page() (in module pystream.routers.auth)</a> -</li> - <li><a href="index.html#pystream.routers.secure.https_redirect">https_redirect() (in module pystream.routers.secure)</a> </li> </ul></td> </tr></table> @@ -274,8 +253,6 @@ <h2 id="M">M</h2> <li><a href="index.html#module-pystream.models.config">pystream.models.config</a> </li> <li><a href="index.html#module-pystream.models.images">pystream.models.images</a> -</li> - <li><a href="index.html#module-pystream.models.secure">pystream.models.secure</a> </li> <li><a href="index.html#module-pystream.models.squire">pystream.models.squire</a> </li> @@ -286,8 +263,6 @@ <h2 id="M">M</h2> <li><a href="index.html#module-pystream.routers.auth">pystream.routers.auth</a> </li> <li><a href="index.html#module-pystream.routers.basics">pystream.routers.basics</a> -</li> - <li><a href="index.html#module-pystream.routers.secure">pystream.routers.secure</a> </li> <li><a href="index.html#module-pystream.routers.video">pystream.routers.video</a> </li> @@ -312,7 +287,7 @@ <h2 id="P">P</h2> </li> <li><a href="index.html#pystream.models.config.EnvConfig.parse_video_host">parse_video_host() (pystream.models.config.EnvConfig class method)</a> </li> - <li><a href="index.html#pystream.models.config.EnvConfig.parse_website">parse_website() (pystream.models.config.EnvConfig class method)</a> + <li><a href="index.html#pystream.models.config.EnvConfig.parse_websites">parse_websites() (pystream.models.config.EnvConfig class method)</a> </li> <li><a href="index.html#pystream.models.config.Static.preview">preview (pystream.models.config.Static attribute)</a> </li> @@ -351,13 +326,6 @@ <h2 id="P">P</h2> <ul> <li><a href="index.html#module-pystream.models.images">module</a> -</li> - </ul></li> - <li> - pystream.models.secure - - <ul> - <li><a href="index.html#module-pystream.models.secure">module</a> </li> </ul></li> </ul></td> @@ -395,13 +363,6 @@ <h2 id="P">P</h2> <ul> <li><a href="index.html#module-pystream.routers.basics">module</a> -</li> - </ul></li> - <li> - pystream.routers.secure - - <ul> - <li><a href="index.html#module-pystream.routers.secure">module</a> </li> </ul></li> <li> @@ -454,6 +415,8 @@ <h2 id="R">R</h2> <h2 id="S">S</h2> <table style="width: 100%" class="indextable genindextable"><tr> <td style="width: 33%; vertical-align: top;"><ul> + <li><a href="index.html#pystream.models.config.EnvConfig.secure_session">secure_session (pystream.models.config.EnvConfig attribute)</a> +</li> <li><a href="index.html#pystream.models.stream.send_bytes_range_requests">send_bytes_range_requests() (in module pystream.models.stream)</a> </li> <li><a href="index.html#pystream.models.config.Session">Session (class in pystream.models.config)</a> @@ -463,11 +426,11 @@ <h2 id="S">S</h2> <li><a href="index.html#pystream.main.shutdown_tasks">shutdown_tasks() (in module pystream.main)</a> </li> <li><a href="index.html#pystream.models.subtitles.srt_to_vtt">srt_to_vtt() (in module pystream.models.subtitles)</a> -</li> - <li><a href="index.html#pystream.main.start">start() (in module pystream.main)</a> </li> </ul></td> <td style="width: 33%; vertical-align: top;"><ul> + <li><a href="index.html#pystream.main.start">start() (in module pystream.main)</a> +</li> <li><a href="index.html#pystream.main.startup_tasks">startup_tasks() (in module pystream.main)</a> </li> <li><a href="index.html#pystream.models.config.Static">Static (class in pystream.models.config)</a> @@ -532,7 +495,7 @@ <h2 id="V">V</h2> <h2 id="W">W</h2> <table style="width: 100%" class="indextable genindextable"><tr> <td style="width: 33%; vertical-align: top;"><ul> - <li><a href="index.html#pystream.models.config.EnvConfig.website">website (pystream.models.config.EnvConfig attribute)</a> + <li><a href="index.html#pystream.models.config.EnvConfig.websites">websites (pystream.models.config.EnvConfig attribute)</a> </li> </ul></td> <td style="width: 33%; vertical-align: top;"><ul> diff --git a/docs/index.html b/docs/index.html index b34b986..034224d 100644 --- a/docs/index.html +++ b/docs/index.html @@ -182,7 +182,7 @@ <h1>Models<a class="headerlink" href="#models" title="Permalink to this heading" <dl class="py class"> <dt class="sig sig-object py" id="pystream.models.config.EnvConfig"> -<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">pystream.models.config.</span></span><span class="sig-name descname"><span class="pre">EnvConfig</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">_case_sensitive</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">bool</span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">None</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">_env_prefix</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">None</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">_env_file</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">DotenvType</span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">None</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">PosixPath('.')</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">_env_file_encoding</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">None</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">_env_nested_delimiter</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">None</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">_secrets_dir</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">Path</span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">None</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">*</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">authorization</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Any</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">video_source</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Path</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">video_host</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">IPv4Address</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">'127.0.0.1'</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">video_port</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">8000</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">session_duration</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">3600</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">file_formats</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Sequence</span><span class="p"><span class="pre">[</span></span><span class="pre">str</span><span class="p"><span class="pre">]</span></span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">('.mov',</span> <span class="pre">'.mp4')</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">workers</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">1</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">website</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><span class="pre">List</span><span class="p"><span class="pre">[</span></span><span class="pre">str</span><span class="p"><span class="pre">]</span></span><span class="p"><span class="pre">]</span></span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">[]</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">auto_thumbnail</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">bool</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">True</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">key_file</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><span class="pre">Path</span><span class="p"><span class="pre">]</span></span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">cert_file</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><span class="pre">Path</span><span class="p"><span class="pre">]</span></span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#pystream.models.config.EnvConfig" title="Permalink to this definition">¶</a></dt> +<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">pystream.models.config.</span></span><span class="sig-name descname"><span class="pre">EnvConfig</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">_case_sensitive</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">bool</span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">None</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">_env_prefix</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">None</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">_env_file</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">DotenvType</span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">None</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">PosixPath('.')</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">_env_file_encoding</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">None</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">_env_nested_delimiter</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">None</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">_secrets_dir</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">Path</span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">None</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">*</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">authorization</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Any</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">video_source</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Path</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">video_host</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">IPv4Address</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">'127.0.0.1'</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">video_port</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">8000</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">session_duration</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">3600</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">file_formats</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Sequence</span><span class="p"><span class="pre">[</span></span><span class="pre">str</span><span class="p"><span class="pre">]</span></span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">('.mov',</span> <span class="pre">'.mp4')</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">workers</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">1</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">websites</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><span class="pre">List</span><span class="p"><span class="pre">[</span></span><span class="pre">str</span><span class="p"><span class="pre">]</span></span><span class="p"><span class="pre">]</span></span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">[]</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">auto_thumbnail</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">bool</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">True</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">key_file</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><span class="pre">Path</span><span class="p"><span class="pre">]</span></span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">cert_file</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><span class="pre">Path</span><span class="p"><span class="pre">]</span></span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">secure_session</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">bool</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#pystream.models.config.EnvConfig" title="Permalink to this definition">¶</a></dt> <dd><p>Configure all env vars and validate using <code class="docutils literal notranslate"><span class="pre">pydantic</span></code> to share across modules.</p> <div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">EnvConfig</span> </pre></div> @@ -228,8 +228,8 @@ <h1>Models<a class="headerlink" href="#models" title="Permalink to this heading" <dd></dd></dl> <dl class="py attribute"> -<dt class="sig sig-object py" id="pystream.models.config.EnvConfig.website"> -<span class="sig-name descname"><span class="pre">website</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><span class="pre">List</span><span class="p"><span class="pre">[</span></span><span class="pre">str</span><span class="p"><span class="pre">]</span></span><span class="p"><span class="pre">]</span></span></em><a class="headerlink" href="#pystream.models.config.EnvConfig.website" title="Permalink to this definition">¶</a></dt> +<dt class="sig sig-object py" id="pystream.models.config.EnvConfig.websites"> +<span class="sig-name descname"><span class="pre">websites</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><span class="pre">List</span><span class="p"><span class="pre">[</span></span><span class="pre">str</span><span class="p"><span class="pre">]</span></span><span class="p"><span class="pre">]</span></span></em><a class="headerlink" href="#pystream.models.config.EnvConfig.websites" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="py attribute"> @@ -247,6 +247,11 @@ <h1>Models<a class="headerlink" href="#models" title="Permalink to this heading" <span class="sig-name descname"><span class="pre">cert_file</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><span class="pre">Path</span><span class="p"><span class="pre">]</span></span></em><a class="headerlink" href="#pystream.models.config.EnvConfig.cert_file" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> +<dl class="py attribute"> +<dt class="sig sig-object py" id="pystream.models.config.EnvConfig.secure_session"> +<span class="sig-name descname"><span class="pre">secure_session</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="pre">bool</span></em><a class="headerlink" href="#pystream.models.config.EnvConfig.secure_session" title="Permalink to this definition">¶</a></dt> +<dd></dd></dl> + <dl class="py class"> <dt class="sig sig-object py" id="pystream.models.config.EnvConfig.Config"> <em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">Config</span></span><a class="headerlink" href="#pystream.models.config.EnvConfig.Config" title="Permalink to this definition">¶</a></dt> @@ -286,8 +291,8 @@ <h1>Models<a class="headerlink" href="#models" title="Permalink to this heading" </dd></dl> <dl class="py method"> -<dt class="sig sig-object py" id="pystream.models.config.EnvConfig.parse_website"> -<em class="property"><span class="pre">classmethod</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">parse_website</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">value</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">→</span> <span class="sig-return-typehint"><span class="pre">List</span><span class="p"><span class="pre">[</span></span><span class="pre">str</span><span class="p"><span class="pre">]</span></span></span></span><a class="headerlink" href="#pystream.models.config.EnvConfig.parse_website" title="Permalink to this definition">¶</a></dt> +<dt class="sig sig-object py" id="pystream.models.config.EnvConfig.parse_websites"> +<em class="property"><span class="pre">classmethod</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">parse_websites</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">value</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">→</span> <span class="sig-return-typehint"><span class="pre">List</span><span class="p"><span class="pre">[</span></span><span class="pre">str</span><span class="p"><span class="pre">]</span></span></span></span><a class="headerlink" href="#pystream.models.config.EnvConfig.parse_websites" title="Permalink to this definition">¶</a></dt> <dd><p>Evaluates the string as a list and returns the list of strings.</p> </dd></dl> @@ -566,39 +571,6 @@ <h1>Models<a class="headerlink" href="#models" title="Permalink to this heading" </dd></dl> -</section> -<section id="module-pystream.models.secure"> -<span id="secure"></span><h1>Secure<a class="headerlink" href="#module-pystream.models.secure" title="Permalink to this heading">¶</a></h1> -<dl class="py function"> -<dt class="sig sig-object py" id="pystream.models.secure.calculate_hash"> -<em class="property"><span class="k"><span class="pre">async</span></span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">pystream.models.secure.</span></span><span class="sig-name descname"><span class="pre">calculate_hash</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">value</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Any</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">→</span> <span class="sig-return-typehint"><span class="pre">str</span></span></span><a class="headerlink" href="#pystream.models.secure.calculate_hash" title="Permalink to this definition">¶</a></dt> -<dd><p>Generate hash value for the given payload.</p> -</dd></dl> - -<dl class="py function"> -<dt class="sig sig-object py" id="pystream.models.secure.base64_encode"> -<em class="property"><span class="k"><span class="pre">async</span></span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">pystream.models.secure.</span></span><span class="sig-name descname"><span class="pre">base64_encode</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">value</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Any</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">→</span> <span class="sig-return-typehint"><span class="pre">str</span></span></span><a class="headerlink" href="#pystream.models.secure.base64_encode" title="Permalink to this definition">¶</a></dt> -<dd><p>Base64 encode the given payload.</p> -</dd></dl> - -<dl class="py function"> -<dt class="sig sig-object py" id="pystream.models.secure.base64_decode"> -<em class="property"><span class="k"><span class="pre">async</span></span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">pystream.models.secure.</span></span><span class="sig-name descname"><span class="pre">base64_decode</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">value</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Any</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">→</span> <span class="sig-return-typehint"><span class="pre">str</span></span></span><a class="headerlink" href="#pystream.models.secure.base64_decode" title="Permalink to this definition">¶</a></dt> -<dd><p>Base64 decode the given payload.</p> -</dd></dl> - -<dl class="py function"> -<dt class="sig sig-object py" id="pystream.models.secure.hex_decode"> -<em class="property"><span class="k"><span class="pre">async</span></span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">pystream.models.secure.</span></span><span class="sig-name descname"><span class="pre">hex_decode</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">value</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Any</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">→</span> <span class="sig-return-typehint"><span class="pre">str</span></span></span><a class="headerlink" href="#pystream.models.secure.hex_decode" title="Permalink to this definition">¶</a></dt> -<dd><p>Convert hex value to a string.</p> -</dd></dl> - -<dl class="py function"> -<dt class="sig sig-object py" id="pystream.models.secure.hex_encode"> -<em class="property"><span class="k"><span class="pre">async</span></span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">pystream.models.secure.</span></span><span class="sig-name descname"><span class="pre">hex_encode</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">value</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#pystream.models.secure.hex_encode" title="Permalink to this definition">¶</a></dt> -<dd><p>Convert string value to hex.</p> -</dd></dl> - </section> <section id="module-pystream.models.squire"> <span id="squire"></span><h1>Squire<a class="headerlink" href="#module-pystream.models.squire" title="Permalink to this heading">¶</a></h1> @@ -925,26 +897,6 @@ <h1>Routers<a class="headerlink" href="#routers" title="Permalink to this headin </dl> </dd></dl> -</section> -<section id="id1"> -<h1>Secure<a class="headerlink" href="#id1" title="Permalink to this heading">¶</a></h1> -<span class="target" id="module-pystream.routers.secure"></span><dl class="py function"> -<dt class="sig sig-object py" id="pystream.routers.secure.https_redirect"> -<em class="property"><span class="k"><span class="pre">async</span></span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">pystream.routers.secure.</span></span><span class="sig-name descname"><span class="pre">https_redirect</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">request</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Request</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">→</span> <span class="sig-return-typehint"><span class="pre">RedirectResponse</span></span></span><a class="headerlink" href="#pystream.routers.secure.https_redirect" title="Permalink to this definition">¶</a></dt> -<dd><p>Redirects HTTP connection to HTTPS.</p> -<dl class="field-list simple"> -<dt class="field-odd">Parameters<span class="colon">:</span></dt> -<dd class="field-odd"><p><strong>request</strong> – Takes the <code class="docutils literal notranslate"><span class="pre">Request</span></code> object as an argument.</p> -</dd> -<dt class="field-even">Returns<span class="colon">:</span></dt> -<dd class="field-even"><p>Returns a RedirectResponse changing the scheme to https.</p> -</dd> -<dt class="field-odd">Return type<span class="colon">:</span></dt> -<dd class="field-odd"><p>RedirectResponse</p> -</dd> -</dl> -</dd></dl> - </section> <section id="module-pystream.routers.video"> <span id="video"></span><h1>Video<a class="headerlink" href="#module-pystream.routers.video" title="Permalink to this heading">¶</a></h1> @@ -1134,14 +1086,12 @@ <h3><a href="#">Table of Contents</a></h3> <li><a class="reference internal" href="#module-pystream.models.authenticator">Authenticator</a></li> <li><a class="reference internal" href="#module-pystream.models.config">Config</a></li> <li><a class="reference internal" href="#module-pystream.models.images">Images</a></li> -<li><a class="reference internal" href="#module-pystream.models.secure">Secure</a></li> <li><a class="reference internal" href="#module-pystream.models.squire">Squire</a></li> <li><a class="reference internal" href="#module-pystream.models.stream">Stream</a></li> <li><a class="reference internal" href="#module-pystream.models.subtitles">Subtitles</a></li> <li><a class="reference internal" href="#routers">Routers</a></li> <li><a class="reference internal" href="#module-pystream.routers.auth">Authentication</a></li> <li><a class="reference internal" href="#module-pystream.routers.basics">Basics</a></li> -<li><a class="reference internal" href="#id1">Secure</a></li> <li><a class="reference internal" href="#module-pystream.routers.video">Video</a></li> <li><a class="reference internal" href="#support-modules">Support Modules</a></li> <li><a class="reference internal" href="#module-pystream.logger">Logger</a></li> diff --git a/docs/objects.inv b/docs/objects.inv index 32b2f1f0f9975122b094a184fdc48c231b6da876..1137f5d14a42c6a5df4391ea578eb143fe904423 100644 GIT binary patch delta 1072 zcmV-01kd}&36}|wc7IWi<0cTt-}5OfwXZ?F*Lyp)TWO`9y4tPOM}+Y>MzMi|AsgSP z?_iv4a^2em<CiGL{D0tKU}mtRM+ahHz1i)+Rd)P5m?rd4{Z=X6z>#%0^uMIG?XT5# zW3LtL*%<s&^_ax67v5K&F0~(vSbNqEfSqYR5D!A>oEgUc%zr_n97yDFlweUA%{!r+ zK8@K1Eo0k_QJL=oHs)1x6n^islqei#3xdrX$u!V=CIWV#QAvR&Yc1c?GdQ9XWH?DC zjIE+CnGS1(>Y?GWkxLUa-oFCx;haz&I5=mDFb8m|9Xa`B@~uJ+nmuH4q|vR~Em*B2 zWDolA`x$X-|9|~N%GM$<&<9Ri8X`&{I#maRGMshLs^eO~=+rB*I@JJI+6JWG<chu& z9lgpp^<7NPQw}p6yD-$6HeV@Cg2PqTHZpi?+#s;nUV9i<nUfWcj+6gc|8`9Jkar*t zF}yP#SAe}j?G=JALV1wE0r%kj3Jx}7coW<z4ts5{a(|LFZY7d8!O3DTyIjH|j&XZf zde~6n1&@E{pY=({rp_fJv!3!VrFUfv<#93NdCmzRPAOr;ob$uGF)weMD9@6!kWAT{ zWnb_{IEY>~WspHwyV#a5NIPFHu)(BToOoQxnQ*nDxb7$c8!dP)`rf=kQ}RVjc0upC zSKpxwqkn7%j{89Sz6eB35Z%)kQ93hF)~p+Al*S^`lrpb|GL%HE!lG>Ppy0KL@ht$k z5=C7x6minK6%e#L*Rf8l==RG9|3dxGsk+JAt0yHxH2{^jgDsl@J6Bl+jNrj(F)ZAZ z!t+K+TvF-9nkI8lHHh7u_vMv{Nyr}0`a2iyN`J?8pn>u`;1_%A-URd~q;pZ?OJF!B z*gfbSb~z;fEl>uqz@kYwjZHy@r<a^o7C~pa!v%`ck+o1N`(9-hQzf;_y}OvDbbiNq zYmld8DjT5%QVl@{rHq}^R2D%T4CVmW6>kRQd|K!FM0$$WcS7%gcOaVVRY*?>;DADq zM}JR$yrqy2i&&mQ2Cqk|H~2L+lNM@J*e^PO&RXVaUD5CZ;=<7xNh87EeVytksh}!p zx>L!S`=xGLRXAGZ#s#CMbj#9lwM3kADfy$29y67-@Jjk6c1lW?a~J!AG#a@T2PKVO z25`pYe(w}ImVE9cJms0ZHyL~V8Zn>v=YNT01Ey@QWCkgGUS^heAOfDk_ML{C1k)P# zM$#FtY|coN(1yBK@}~0n;maRiA1aT{=f=ot`>9GTQ;+Ite3`f#igW1}BX;aX4Sno- zYE7LV<KN9&x0!d*Bf++R#c!IfthUvcD&4O&)Q`;E3JDdOYK|<Ewf%-n^v>vZ+$o-3 qB>dN8-87Gjw>M-@BV|DPTJ1qN*<A}$+x#Wz{S%#2oBsf-oHGjieGpv$ delta 1120 zcmV-m1fTnt3C9VLc7MT+BPS4s@ADKbC0C=Y6y>nDRWgxA$||FoNI4=*m)*!TuuypH zefkuQ?R9TvXAJbka?|`DP!wHNxMM&MVr1HGx8OT>{5aY^YUqCHl<DEX1|0QIxo!1x zx4Lt41$(j<|5O^YSZWbM_u*Rmwuo&m+7WQD{Tt#@C{r@S)PJ9O=#>YF91ap3Dr@*4 zOt15pn`mTeduLP@hKRj=F&stMg(4*ikHv!M%0{w1=)gq80SqcB&=&3GYkCF;^nwg0 z$%Ls@=$7fQjZhkTo*KEd(ctYn@EXnw6@Y{Hwh6NbuQo?cewlr%k%M*zg&b+kMr|v0 zD+}4Z+5dh)ynlE8ejsH_5g3>~ry~ssB@n$@M}#(<^RQ8erGUw)7h(;n2d<2ZNWa+? zLn}IYmG$bYn4G5_W;qUVTpK!ktuzT97unmy;2Y~lfz9^X!Euo}IpOJZ@;~dpACunX z?a4zdA8fz{U@x!^3ZaP<AcPbG`{)<(u=xVpNzVF(NPodbFPq)s%H~ZN>vvH5aiByA z9{w)>HfJ51I=76>H04XmY}*(rU^V0El*8ShQ@Dh=<a0M;p0o3pTk<3%Q*LbC3ceBc zLaV+FG79IaZTXCJ@MVP!CS7%+Fq1Rk*NWn>r-bR~AaJ3zeSyAZMNAIS?08ULp$((l z0G@|feShpvAZmi-o}q~{*paea(>tpSHj$<jcQKTuq-PNpWp{f8FHMXu5y+J&N{X?G zliw|XpwqdGby5Ykt0Vji>wnJGNZDCED;cU0s2m+#+YH#HDr#WF0N#kP@=S`rdnK`^ zGD|f`;h<_1TL={;T^6#3i~h!qo9WmV3{ZLp{D10f-I_7}fOIJ$LJJH}39$yV#i4{0 zKt>N07R^Go76E?ymG>a2xy%dZ1TfVEDYT3_S#uC!s6q^IXjwy&S1sU6RCU&$gwxJb zi0Anwr*nm1ux1Vuiju*lP^$PA>LjMRb6a}TbCOc@O!GD%!N!U&`SjtolW5~rzD zL4Q1qb`SIWfda@SR+joieoEH&!ffd@far^NAwOk+2TA|}2Ko~mC0tO&3KX#U`iPW{ z&as8GxJHG#>hpimvOxQamhTZOM`t8WgmClav!|4fYSifls$}lhx@lM8;FLdBjGB{O zN5P^-Tyll`y^tOYl@tz?3^jJjN>*}n{ePV_8F?f2N?KC~@Ya^Dw>$vPmDCSiI-$9e zFC2YJ8)^ohgy$NAYg_Q8nIlf|<}#6Dz?8|i%pj*u*Hy(0h=}Ku?MA~*g2}_QrG$km zS2EHhbaAbfd{_B&|LKp<_g%pLV{c`*`q1T;sYmyCe4e;>6lL=bR_dt58g%M<ZduKp zAJX5uZ{1G3s~#D)`YWwzx~*JwpStXsJ@q3qZ-j&nZFh=mleNPgndp_#-Enn(k@26i mb@M!~-o7JyJW}>+=IQ{#%V93eZKsvw_mA|Iy!#J>In4~TFDe57 diff --git a/docs/py-modindex.html b/docs/py-modindex.html index 233c16e..976c788 100644 --- a/docs/py-modindex.html +++ b/docs/py-modindex.html @@ -82,11 +82,6 @@ <h1>Python Module Index</h1> <td>    <a href="index.html#module-pystream.models.images"><code class="xref">pystream.models.images</code></a></td><td> <em></em></td></tr> - <tr class="cg-1"> - <td></td> - <td>    - <a href="index.html#module-pystream.models.secure"><code class="xref">pystream.models.secure</code></a></td><td> - <em></em></td></tr> <tr class="cg-1"> <td></td> <td>    @@ -112,11 +107,6 @@ <h1>Python Module Index</h1> <td>    <a href="index.html#module-pystream.routers.basics"><code class="xref">pystream.routers.basics</code></a></td><td> <em></em></td></tr> - <tr class="cg-1"> - <td></td> - <td>    - <a href="index.html#module-pystream.routers.secure"><code class="xref">pystream.routers.secure</code></a></td><td> - <em></em></td></tr> <tr class="cg-1"> <td></td> <td>    diff --git a/docs/searchindex.js b/docs/searchindex.js index 8d0e2e4..7b3df75 100644 --- a/docs/searchindex.js +++ b/docs/searchindex.js @@ -1 +1 @@ -Search.setIndex({"docnames": ["README", "index"], "filenames": ["README.md", "index.rst"], "titles": ["PyStream", "Stream-Localhost - A secured interface to stream videos"], "terms": {"deploy": 0, "python": 0, "modul": 0, "stream": 0, "video": 0, "via": [0, 1], "authent": 0, "session": [0, 1], "us": [0, 1], "fastapi": [0, 1], "pip": 0, "localhost": 0, "import": 0, "asyncio": 0, "o": 0, "__name__": 0, "__main__": 0, "kwarg": [0, 1], "dict": [0, 1], "author": [0, 1], "alan": 0, "ture": 0, "pr0gramm1ng": 0, "linu": 0, "torvald": 0, "linuxo": 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, 1], "plain": [0, 1], "text": [0, 1], "file": [0, 1], "refer": [0, 1], "wiki": 0, "page": [0, 1], "more": [0, 1], "inform": [0, 1], "mandatori": 0, "dictionari": [0, 1], "kei": [0, 1], "valu": [0, 1], "pair": [0, 1], "usernam": [0, 1], "password": [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, 1], "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], "privat": [0, 1], "ssl": 0, "certif": 0, "none": [0, 1], "cert": 0, "full": 0, "chain": 0, "key_fil": [0, 1], "cert_fil": [0, 1], "becom": 0, "when": [0, 1], "video_port": [0, 1], "i": [0, 1], "set": [0, 1], "443": 0, "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, "pystream": 1, "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, "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, "extract_credenti": 1, "str": 1, "extract": 1, "credenti": 1, "header": 1, "decod": 1, "befor": 1, "string": 1, "raise_error": 1, "noreturn": 1, "rais": 1, "401": 1, "unauthor": 1, "error": 1, "case": 1, "bad": 1, "verify_login": 1, "union": 1, "int": 1, "verifi": 1, "token": 1, "user": 1, "payload": 1, "creat": 1, "verify_token": 1, "decrypt": 1, "symmetr": 1, "encrypt": 1, "expir": 1, "as_dict": 1, "tupl": 1, "json": 1, "pass": 1, "object_pairs_hook": 1, "duplic": 1, "order": 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, "ipv4address": 1, "session_dur": 1, "3600": 1, "file_format": 1, "auto_thumbnail": 1, "var": 1, "pydant": 1, "share": 1, "across": 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_author": 1, "secretstr": 1, "convert": 1, "parse_video_host": 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, "pathlib": 1, "cipher_suit": 1, "cryptographi": 1, "fernet": 1, "store": 1, "arbitrary_types_allow": 1, "info": 1, "invalid": 1, "map": 1, "webtoken": 1, "timestamp": 1, "ecrypt": 1, "locat": 1, "detail": 1, "within": 1, "sinc": 1, "httpexcept": 1, "doesn": 1, "demand": 1, "where": 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, "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, "timedelta": 1, "get": 1, "calcul": 1, "length": 1, "datetim": 1, "generate_preview": 1, "at_second": 1, "which": 1, "should": 1, "calculate_hash": 1, "hash": 1, "given": 1, "base64_encod": 1, "base64": 1, "encod": 1, "base64_decod": 1, "hex_decod": 1, "hex": 1, "hex_encod": 1, "log_connect": 1, "log": 1, "connect": 1, "devic": 1, "avoid": 1, "multipl": 1, "same": 1, "differ": 1, "natural_sort_kei": 1, "filenam": 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, "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, "keygen": 1, "secret": 1, "so": 1, "forc": 1, "restart": 1, "url": 1, "safe": 1, "64": 1, "bit": 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, "size": 1, "range_requests_respons": 1, "file_path": 1, "streamingrespons": 1, "respons": 1, "srt_to_vtt": 1, "srt": 1, "vtt": 1, "compat": 1, "j": 1, "vtt_to_srt": 1, "auth": 1, "get_expiri": 1, "lease_start": 1, "lease_dur": 1, "expiri": 1, "max": 1, "ag": 1, "wa": 1, "made": 1, "until": 1, "date": 1, "gmt": 1, "home_pag": 1, "session_token": 1, "templaterespons": 1, "ui": 1, "after": 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, "https_redirect": 1, "chang": 1, "scheme": 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, "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, "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, "-", "secure"], [1, 0, 0, "-", "squire"], [1, 0, 0, "-", "stream"], [1, 0, 0, "-", "subtitles"]], "pystream.models.authenticator": [[1, 3, 1, "", "extract_credentials"], [1, 3, 1, "", "failed_auth_counter"], [1, 3, 1, "", "raise_error"], [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, 3, 1, "", "as_dict"], [1, 4, 1, "", "env"]], "pystream.models.config.EnvConfig": [[1, 1, 1, "", "Config"], [1, 4, 1, "", "authorization"], [1, 4, 1, "", "auto_thumbnail"], [1, 4, 1, "", "cert_file"], [1, 4, 1, "", "file_formats"], [1, 4, 1, "", "key_file"], [1, 2, 1, "", "parse_authorization"], [1, 2, 1, "", "parse_video_host"], [1, 2, 1, "", "parse_website"], [1, 4, 1, "", "session_duration"], [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"], [1, 4, 1, "", "mapping"]], "pystream.models.config.Static": [[1, 1, 1, "", "Config"], [1, 4, 1, "", "chunk_size"], [1, 4, 1, "", "cipher_suite"], [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, "", "stream"], [1, 4, 1, "", "streaming_endpoint"], [1, 4, 1, "", "track"]], "pystream.models.config.Static.Config": [[1, 4, 1, "", "arbitrary_types_allowed"]], "pystream.models.config.WebToken": [[1, 4, 1, "", "timestamp"], [1, 4, 1, "", "token"], [1, 4, 1, "", "username"]], "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.secure": [[1, 3, 1, "", "base64_decode"], [1, 3, 1, "", "base64_encode"], [1, 3, 1, "", "calculate_hash"], [1, 3, 1, "", "hex_decode"], [1, 3, 1, "", "hex_encode"]], "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, "", "keygen"], [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, "-", "secure"], [1, 0, 0, "-", "video"]], "pystream.routers.auth": [[1, 3, 1, "", "get_expiry"], [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.secure": [[1, 3, 1, "", "https_redirect"]], "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": {"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, "stream": 1, "localhost": 1, "A": 1, "secur": 1, "interfac": 1, "video": 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", "index"], "filenames": ["README.md", "index.rst"], "titles": ["PyStream", "Stream-Localhost - A secured interface to stream videos"], "terms": {"deploy": 0, "python": 0, "modul": 0, "stream": 0, "video": 0, "via": [0, 1], "authent": 0, "session": [0, 1], "us": [0, 1], "fastapi": [0, 1], "pip": 0, "localhost": 0, "import": 0, "asyncio": 0, "o": 0, "__name__": 0, "__main__": 0, "kwarg": [0, 1], "dict": [0, 1], "author": [0, 1], "alan": 0, "ture": 0, "pr0gramm1ng": 0, "linu": 0, "torvald": 0, "linuxo": 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, 1], "plain": [0, 1], "text": [0, 1], "file": [0, 1], "refer": [0, 1], "wiki": 0, "page": [0, 1], "more": [0, 1], "inform": [0, 1], "mandatori": 0, "dictionari": [0, 1], "kei": [0, 1], "valu": [0, 1], "pair": [0, 1], "usernam": [0, 1], "password": [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, 1], "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], "privat": [0, 1], "ssl": 0, "certif": 0, "none": [0, 1], "cert": 0, "full": 0, "chain": 0, "secur": 0, "cooki": [0, 1], "session_token": [0, 1], "fals": [0, 1], "If": [0, 1], "secure_sess": [0, 1], "set": [0, 1], "sent": 0, "http": [0, 1], "thi": [0, 1], "mean": 0, "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, "org": 0, "project": 0, "thevickypedia": 0, "github": 0, "io": 0, "vignesh": 0, "rao": 0, "under": 0, "mit": 0, "pystream": 1, "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, "type": 1, "startup_task": 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, "extract_credenti": 1, "str": 1, "extract": 1, "credenti": 1, "header": 1, "decod": 1, "befor": 1, "string": 1, "raise_error": 1, "noreturn": 1, "rais": 1, "401": 1, "unauthor": 1, "error": 1, "case": 1, "bad": 1, "verify_login": 1, "union": 1, "int": 1, "verifi": 1, "token": 1, "user": 1, "payload": 1, "creat": 1, "verify_token": 1, "decrypt": 1, "symmetr": 1, "encrypt": 1, "expir": 1, "as_dict": 1, "tupl": 1, "json": 1, "pass": 1, "object_pairs_hook": 1, "duplic": 1, "order": 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, "ipv4address": 1, "video_port": 1, "session_dur": 1, "3600": 1, "file_format": 1, "auto_thumbnail": 1, "key_fil": 1, "cert_fil": 1, "var": 1, "pydant": 1, "share": 1, "across": 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_author": 1, "secretstr": 1, "convert": 1, "parse_video_host": 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, "pathlib": 1, "cipher_suit": 1, "cryptographi": 1, "fernet": 1, "store": 1, "arbitrary_types_allow": 1, "info": 1, "invalid": 1, "map": 1, "webtoken": 1, "timestamp": 1, "ecrypt": 1, "locat": 1, "detail": 1, "within": 1, "sinc": 1, "httpexcept": 1, "doesn": 1, "demand": 1, "where": 1, "i": 1, "solut": 1, "There": 1, "ar": 1, "altern": 1, "work": 1, "our": 1, "javascript": 1, "wai": 1, "come": 1, "handi": 1, "mani": 1, "unexpect": 1, "scenario": 1, "tiangolo": 1, "com": 1, "tutori": 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, "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, "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, "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, "keygen": 1, "secret": 1, "so": 1, "forc": 1, "restart": 1, "url": 1, "safe": 1, "64": 1, "bit": 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, "size": 1, "range_requests_respons": 1, "file_path": 1, "streamingrespons": 1, "given": 1, "respons": 1, "srt_to_vtt": 1, "srt": 1, "vtt": 1, "compat": 1, "j": 1, "vtt_to_srt": 1, "auth": 1, "get_expiri": 1, "lease_start": 1, "lease_dur": 1, "expiri": 1, "max": 1, "ag": 1, "wa": 1, "made": 1, "until": 1, "date": 1, "gmt": 1, "home_pag": 1, "templaterespons": 1, "ui": 1, "after": 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, "overrid": 1, "implement": 1, "subclass": 1, "The": 1, "method": 1, "record": 1, "examin": 1, "discard": 1, "togeth": 1, "its": 1, "children": 1, "have": 1, "event": 1, "through": 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, "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, "", "extract_credentials"], [1, 3, 1, "", "failed_auth_counter"], [1, 3, 1, "", "raise_error"], [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, 3, 1, "", "as_dict"], [1, 4, 1, "", "env"]], "pystream.models.config.EnvConfig": [[1, 1, 1, "", "Config"], [1, 4, 1, "", "authorization"], [1, 4, 1, "", "auto_thumbnail"], [1, 4, 1, "", "cert_file"], [1, 4, 1, "", "file_formats"], [1, 4, 1, "", "key_file"], [1, 2, 1, "", "parse_authorization"], [1, 2, 1, "", "parse_video_host"], [1, 2, 1, "", "parse_websites"], [1, 4, 1, "", "secure_session"], [1, 4, 1, "", "session_duration"], [1, 4, 1, "", "video_host"], [1, 4, 1, "", "video_port"], [1, 4, 1, "", "video_source"], [1, 4, 1, "", "websites"], [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"], [1, 4, 1, "", "mapping"]], "pystream.models.config.Static": [[1, 1, 1, "", "Config"], [1, 4, 1, "", "chunk_size"], [1, 4, 1, "", "cipher_suite"], [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, "", "stream"], [1, 4, 1, "", "streaming_endpoint"], [1, 4, 1, "", "track"]], "pystream.models.config.Static.Config": [[1, 4, 1, "", "arbitrary_types_allowed"]], "pystream.models.config.WebToken": [[1, 4, 1, "", "timestamp"], [1, 4, 1, "", "token"], [1, 4, 1, "", "username"]], "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, "", "keygen"], [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, "", "get_expiry"], [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": {"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, "stream": 1, "localhost": 1, "A": 1, "secur": 1, "interfac": 1, "video": 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 diff --git a/pystream/main.py b/pystream/main.py index 87d0e0c..b5b836e 100644 --- a/pystream/main.py +++ b/pystream/main.py @@ -46,8 +46,8 @@ async def startup_tasks() -> None: logger.info("Users allowed [%d]: %s", len(config.env.authorization), list(config.env.authorization.keys())) logger.info('Setting up CORS policy.') origins = ["http://localhost.com", "https://localhost.com"] - origins.extend(config.env.website) - origins.extend(map((lambda x: x + '/*'), config.env.website)) + origins.extend(config.env.websites) + origins.extend(map((lambda x: x + '/*'), config.env.websites)) # noinspection PyTypeChecker app.add_middleware(CORSMiddleware, allow_origins=origins, allow_methods=["GET", "POST"], allow_credentials=True) diff --git a/pystream/models/config.py b/pystream/models/config.py index 0e7bdc8..8fad828 100644 --- a/pystream/models/config.py +++ b/pystream/models/config.py @@ -49,7 +49,7 @@ class EnvConfig(BaseSettings): file_formats: Sequence[str] = (".mov", ".mp4") workers: int = Field(1, le=os.cpu_count(), ge=1, env="WORKERS") - website: Union[List[str], None] = [] + websites: Union[List[str], None] = [] auto_thumbnail: bool = True key_file: Union[FilePath, None] = None cert_file: Union[FilePath, None] = None @@ -90,8 +90,8 @@ def parse_video_host(cls, value: IPv4Address) -> str: return str(value) # noinspection PyMethodParameters - @field_validator("website", mode='before', check_fields=True) - def parse_website(cls, value: str) -> List[str]: + @field_validator("websites", mode='before', check_fields=True) + def parse_websites(cls, value: str) -> List[str]: """Evaluates the string as a list and returns the list of strings.""" if not value: return []