Skip to content

Commit

Permalink
Add compatibility for Windows operating systems
Browse files Browse the repository at this point in the history
Enable logging into `*.log` files
Restructure code, update README.md and docstrings
  • Loading branch information
dormant-user committed Mar 23, 2024
1 parent 3df4eff commit c6a5c6f
Show file tree
Hide file tree
Showing 16 changed files with 538 additions and 417 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ doc_gen/_static
# Configuration and initator
temp.py
settings/
logs/
filebrowser
filebrowser.db

Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ way of handling the configuration and initialization.
[`pyfilebrowser`][repo] automatically downloads the system specific executable during startup.

<details>
<summary>Downloading Custom Built Executables</summary>
<summary><strong>Download custom-built executables</strong></summary>

Additionally, custom GitHub sources can be configured by specifying the environment variables, `GIT_OWNER` and `GIT_REPO`,
provided that the executables are uploaded to releases as assets, and follows the naming convention below.
Expand All @@ -47,7 +47,7 @@ import pyfilebrowser

if __name__ == '__main__':
browser = pyfilebrowser.FileBrowser()
browser.kickoff()
browser.start()
```

## Environment Variables
Expand Down Expand Up @@ -78,7 +78,7 @@ if __name__ == '__main__':
{"authentication": {"username": "user123", "password": "pwd456", "admin": False}}
]
)
file_browser.kickoff()
file_browser.start()
```

> :bulb:&nbsp;&nbsp;Object level instantiation might be complex for configuration settings. So it is better to use `.env` files instead.
Expand Down Expand Up @@ -115,8 +115,8 @@ Licensed under the [MIT License][license]
[repo]: https://github.com/thevickypedia/pyfilebrowser
[samples]: https://github.com/thevickypedia/pyfilebrowser/tree/main/samples
[license]: https://github.com/thevickypedia/pyfilebrowser/blob/main/LICENSE
[config]: https://filebrowser.org/cli/filebrowser-config-set
[users]: https://filebrowser.org/cli/filebrowser-users-add
[config]: https://thevickypedia.github.io/pyfilebrowser/#configuration
[users]: https://thevickypedia.github.io/pyfilebrowser/#users
[home]: https://filebrowser.org/
[pypi]: https://pypi.org/project/pyfilebrowser
[pypi-repo]: https://packaging.python.org/tutorials/packaging-projects/
Expand Down
20 changes: 10 additions & 10 deletions doc_gen/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Modals
Configuration
=============

.. autoclass:: pyfilebrowser.modals.config.Defaults(pydantic_settings.BaseSettings)
.. autoclass:: pyfilebrowser.modals.config.Server(pydantic_settings.BaseSettings)
:members:
:exclude-members: _abc_impl, model_config, model_fields, model_computed_fields

Expand All @@ -42,19 +42,19 @@ Configuration

====

.. autoclass:: pyfilebrowser.modals.config.Commands(pydantic_settings.BaseSettings)
.. autoclass:: pyfilebrowser.modals.config.Defaults(pydantic_settings.BaseSettings)
:members:
:exclude-members: _abc_impl, model_config, model_fields, model_computed_fields

====

.. autoclass:: pyfilebrowser.modals.config.Config(pydantic_settings.BaseSettings)
.. autoclass:: pyfilebrowser.modals.config.Commands(pydantic_settings.BaseSettings)
:members:
:exclude-members: _abc_impl, model_config, model_fields, model_computed_fields

====

.. autoclass:: pyfilebrowser.modals.config.Server(pydantic_settings.BaseSettings)
.. autoclass:: pyfilebrowser.modals.config.Config(pydantic_settings.BaseSettings)
:members:
:exclude-members: _abc_impl, model_config, model_fields, model_computed_fields

Expand All @@ -76,20 +76,20 @@ Configuration
:members:
:exclude-members: _abc_impl, model_config, model_fields, model_computed_fields

====
Models
======

.. autoclass:: pyfilebrowser.modals.config.Theme(StrEnum)
.. autoclass:: pyfilebrowser.modals.models.Log(StrEnum)
:members:
:exclude-members:

====

.. autoclass:: pyfilebrowser.modals.config.Log(StrEnum)
.. autoclass:: pyfilebrowser.modals.models.Theme(StrEnum)
:members:
:exclude-members:

Models
======
====

.. autoclass:: pyfilebrowser.modals.models.SortBy(StrEnum)
:members:
Expand All @@ -111,7 +111,7 @@ Models

.. automodule:: pyfilebrowser.modals.models
:members:
:exclude-members: SortBy, Sorting, Perm
:exclude-members: Log, Theme, SortBy, Sorting, Perm

Users
=====
Expand Down
10 changes: 5 additions & 5 deletions docs/README.html
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ <h1>PyFileBrowser<a class="headerlink" href="#pyfilebrowser" title="Permalink to
way of handling the configuration and initialization.</p>
<p><a class="reference external" href="https://github.com/thevickypedia/pyfilebrowser"><code class="docutils literal notranslate"><span class="pre">pyfilebrowser</span></code></a> automatically downloads the system specific executable during startup.</p>
<details>
<summary>Downloading Custom Built Executables</summary><p>Additionally, custom GitHub sources can be configured by specifying the environment variables, <code class="docutils literal notranslate"><span class="pre">GIT_OWNER</span></code> and <code class="docutils literal notranslate"><span class="pre">GIT_REPO</span></code>,
<summary><strong>Download custom-built executables</strong></summary><p>Additionally, custom GitHub sources can be configured by specifying the environment variables, <code class="docutils literal notranslate"><span class="pre">GIT_OWNER</span></code> and <code class="docutils literal notranslate"><span class="pre">GIT_REPO</span></code>,
provided that the executables are uploaded to releases as assets, and follows the naming convention below.</p>
<blockquote>
<div><p><strong>asset naming convention:</strong> <code class="docutils literal notranslate"><span class="pre">${operating</span> <span class="pre">system}-{architecture}-filebrowser-{extension}</span></code><br>
Expand All @@ -78,7 +78,7 @@ <h2>Kick Off<a class="headerlink" href="#kick-off" title="Permalink to this head

<span class="k">if</span> <span class="vm">__name__</span> <span class="o">==</span> <span class="s1">&#39;__main__&#39;</span><span class="p">:</span>
<span class="n">browser</span> <span class="o">=</span> <span class="n">pyfilebrowser</span><span class="o">.</span><span class="n">FileBrowser</span><span class="p">()</span>
<span class="n">browser</span><span class="o">.</span><span class="n">kickoff</span><span class="p">()</span>
<span class="n">browser</span><span class="o">.</span><span class="n">start</span><span class="p">()</span>
</pre></div>
</div>
</section>
Expand All @@ -88,8 +88,8 @@ <h2>Environment Variables<a class="headerlink" href="#environment-variables" tit
<section id="env-files">
<h3><code class="docutils literal notranslate"><span class="pre">.env</span></code> files<a class="headerlink" href="#env-files" title="Permalink to this heading"></a></h3>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">.config.env</span></code> - Loads the server’s default configuration. Reference: <a class="reference external" href="https://filebrowser.org/cli/filebrowser-config-set">config</a></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">.user*.env</span></code> - Loads each user’s profile specific configuration. Reference: <a class="reference external" href="https://filebrowser.org/cli/filebrowser-users-add">users</a></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">.config.env</span></code> - Loads the server’s default configuration. Reference: <a class="reference external" href="https://thevickypedia.github.io/pyfilebrowser/#configuration">config</a></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">.user*.env</span></code> - Loads each user’s profile specific configuration. Reference: <a class="reference external" href="https://thevickypedia.github.io/pyfilebrowser/#users">users</a></p></li>
</ul>
<p>Multiple user profiles can be loaded using <code class="docutils literal notranslate"><span class="pre">.user1.env</span></code>, <code class="docutils literal notranslate"><span class="pre">.user2.env</span></code> and so on.<br>
User profile’s permissions are automatically set based on the <code class="docutils literal notranslate"><span class="pre">admin</span></code> flag.</p>
Expand All @@ -108,7 +108,7 @@ <h3><code class="docutils literal notranslate"><span class="pre">.env</span></co
<span class="p">{</span><span class="s2">&quot;authentication&quot;</span><span class="p">:</span> <span class="p">{</span><span class="s2">&quot;username&quot;</span><span class="p">:</span> <span class="s2">&quot;user123&quot;</span><span class="p">,</span> <span class="s2">&quot;password&quot;</span><span class="p">:</span> <span class="s2">&quot;pwd456&quot;</span><span class="p">,</span> <span class="s2">&quot;admin&quot;</span><span class="p">:</span> <span class="kc">False</span><span class="p">}}</span>
<span class="p">]</span>
<span class="p">)</span>
<span class="n">file_browser</span><span class="o">.</span><span class="n">kickoff</span><span class="p">()</span>
<span class="n">file_browser</span><span class="o">.</span><span class="n">start</span><span class="p">()</span>
</pre></div>
</div>
<blockquote>
Expand Down
10 changes: 5 additions & 5 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ way of handling the configuration and initialization.
[`pyfilebrowser`][repo] automatically downloads the system specific executable during startup.

<details>
<summary>Downloading Custom Built Executables</summary>
<summary><strong>Download custom-built executables</strong></summary>

Additionally, custom GitHub sources can be configured by specifying the environment variables, `GIT_OWNER` and `GIT_REPO`,
provided that the executables are uploaded to releases as assets, and follows the naming convention below.
Expand All @@ -47,7 +47,7 @@ import pyfilebrowser

if __name__ == '__main__':
browser = pyfilebrowser.FileBrowser()
browser.kickoff()
browser.start()
```

## Environment Variables
Expand Down Expand Up @@ -78,7 +78,7 @@ if __name__ == '__main__':
{"authentication": {"username": "user123", "password": "pwd456", "admin": False}}
]
)
file_browser.kickoff()
file_browser.start()
```

> :bulb:&nbsp;&nbsp;Object level instantiation might be complex for configuration settings. So it is better to use `.env` files instead.
Expand Down Expand Up @@ -115,8 +115,8 @@ Licensed under the [MIT License][license]
[repo]: https://github.com/thevickypedia/pyfilebrowser
[samples]: https://github.com/thevickypedia/pyfilebrowser/tree/main/samples
[license]: https://github.com/thevickypedia/pyfilebrowser/blob/main/LICENSE
[config]: https://filebrowser.org/cli/filebrowser-config-set
[users]: https://filebrowser.org/cli/filebrowser-users-add
[config]: https://thevickypedia.github.io/pyfilebrowser/#configuration
[users]: https://thevickypedia.github.io/pyfilebrowser/#users
[home]: https://filebrowser.org/
[pypi]: https://pypi.org/project/pyfilebrowser
[pypi-repo]: https://packaging.python.org/tutorials/packaging-projects/
Expand Down
10 changes: 5 additions & 5 deletions docs/_sources/README.md.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ way of handling the configuration and initialization.
[`pyfilebrowser`][repo] automatically downloads the system specific executable during startup.

<details>
<summary>Downloading Custom Built Executables</summary>
<summary><strong>Download custom-built executables</strong></summary>

Additionally, custom GitHub sources can be configured by specifying the environment variables, `GIT_OWNER` and `GIT_REPO`,
provided that the executables are uploaded to releases as assets, and follows the naming convention below.
Expand All @@ -47,7 +47,7 @@ import pyfilebrowser

if __name__ == '__main__':
browser = pyfilebrowser.FileBrowser()
browser.kickoff()
browser.start()
```

## Environment Variables
Expand Down Expand Up @@ -78,7 +78,7 @@ if __name__ == '__main__':
{"authentication": {"username": "user123", "password": "pwd456", "admin": False}}
]
)
file_browser.kickoff()
file_browser.start()
```

> :bulb:&nbsp;&nbsp;Object level instantiation might be complex for configuration settings. So it is better to use `.env` files instead.
Expand Down Expand Up @@ -115,8 +115,8 @@ Licensed under the [MIT License][license]
[repo]: https://github.com/thevickypedia/pyfilebrowser
[samples]: https://github.com/thevickypedia/pyfilebrowser/tree/main/samples
[license]: https://github.com/thevickypedia/pyfilebrowser/blob/main/LICENSE
[config]: https://filebrowser.org/cli/filebrowser-config-set
[users]: https://filebrowser.org/cli/filebrowser-users-add
[config]: https://thevickypedia.github.io/pyfilebrowser/#configuration
[users]: https://thevickypedia.github.io/pyfilebrowser/#users
[home]: https://filebrowser.org/
[pypi]: https://pypi.org/project/pyfilebrowser
[pypi-repo]: https://packaging.python.org/tutorials/packaging-projects/
Expand Down
20 changes: 10 additions & 10 deletions docs/_sources/index.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Modals
Configuration
=============

.. autoclass:: pyfilebrowser.modals.config.Defaults(pydantic_settings.BaseSettings)
.. autoclass:: pyfilebrowser.modals.config.Server(pydantic_settings.BaseSettings)
:members:
:exclude-members: _abc_impl, model_config, model_fields, model_computed_fields

Expand All @@ -42,19 +42,19 @@ Configuration

====

.. autoclass:: pyfilebrowser.modals.config.Commands(pydantic_settings.BaseSettings)
.. autoclass:: pyfilebrowser.modals.config.Defaults(pydantic_settings.BaseSettings)
:members:
:exclude-members: _abc_impl, model_config, model_fields, model_computed_fields

====

.. autoclass:: pyfilebrowser.modals.config.Config(pydantic_settings.BaseSettings)
.. autoclass:: pyfilebrowser.modals.config.Commands(pydantic_settings.BaseSettings)
:members:
:exclude-members: _abc_impl, model_config, model_fields, model_computed_fields

====

.. autoclass:: pyfilebrowser.modals.config.Server(pydantic_settings.BaseSettings)
.. autoclass:: pyfilebrowser.modals.config.Config(pydantic_settings.BaseSettings)
:members:
:exclude-members: _abc_impl, model_config, model_fields, model_computed_fields

Expand All @@ -76,20 +76,20 @@ Configuration
:members:
:exclude-members: _abc_impl, model_config, model_fields, model_computed_fields

====
Models
======

.. autoclass:: pyfilebrowser.modals.config.Theme(StrEnum)
.. autoclass:: pyfilebrowser.modals.models.Log(StrEnum)
:members:
:exclude-members:

====

.. autoclass:: pyfilebrowser.modals.config.Log(StrEnum)
.. autoclass:: pyfilebrowser.modals.models.Theme(StrEnum)
:members:
:exclude-members:

Models
======
====

.. autoclass:: pyfilebrowser.modals.models.SortBy(StrEnum)
:members:
Expand All @@ -111,7 +111,7 @@ Models

.. automodule:: pyfilebrowser.modals.models
:members:
:exclude-members: SortBy, Sorting, Perm
:exclude-members: Log, Theme, SortBy, Sorting, Perm

Users
=====
Expand Down
24 changes: 11 additions & 13 deletions docs/genindex.html
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ <h2 id="B">B</h2>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="index.html#pyfilebrowser.modals.config.Commands.before_upload">before_upload (pyfilebrowser.modals.config.Commands attribute)</a>
</li>
<li><a href="index.html#pyfilebrowser.modals.config.Theme.blank">blank (pyfilebrowser.modals.config.Theme attribute)</a>
<li><a href="index.html#pyfilebrowser.modals.models.Theme.blank">blank (pyfilebrowser.modals.models.Theme attribute)</a>
</li>
<li><a href="index.html#pyfilebrowser.modals.config.Branding">Branding (class in pyfilebrowser.modals.config)</a>
</li>
Expand Down Expand Up @@ -184,7 +184,7 @@ <h2 id="C">C</h2>
<h2 id="D">D</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="index.html#pyfilebrowser.modals.config.Theme.dark">dark (pyfilebrowser.modals.config.Theme attribute)</a>
<li><a href="index.html#pyfilebrowser.modals.models.Theme.dark">dark (pyfilebrowser.modals.models.Theme attribute)</a>
</li>
<li><a href="index.html#pyfilebrowser.modals.config.Defaults.dateFormat">dateFormat (pyfilebrowser.modals.config.Defaults attribute)</a>

Expand Down Expand Up @@ -294,7 +294,7 @@ <h2 id="E">E</h2>
<h2 id="F">F</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="index.html#pyfilebrowser.modals.config.Log.file">file (pyfilebrowser.modals.config.Log attribute)</a>
<li><a href="index.html#pyfilebrowser.modals.models.Log.file">file (pyfilebrowser.modals.models.Log attribute)</a>
</li>
<li><a href="index.html#pyfilebrowser.main.FileBrowser">FileBrowser (class in pyfilebrowser.main)</a>
</li>
Expand Down Expand Up @@ -367,18 +367,14 @@ <h2 id="K">K</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="index.html#pyfilebrowser.modals.config.ReCAPTCHA.key">key (pyfilebrowser.modals.config.ReCAPTCHA attribute)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="index.html#pyfilebrowser.main.FileBrowser.kickoff">kickoff() (pyfilebrowser.main.FileBrowser method)</a>
</li>
</ul></td>
</tr></table>

<h2 id="L">L</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="index.html#pyfilebrowser.modals.config.Theme.light">light (pyfilebrowser.modals.config.Theme attribute)</a>
<li><a href="index.html#pyfilebrowser.modals.models.Theme.light">light (pyfilebrowser.modals.models.Theme attribute)</a>
</li>
<li><a href="index.html#pyfilebrowser.squire.steward.EnvConfig.load_user_profiles">load_user_profiles() (pyfilebrowser.squire.steward.EnvConfig class method)</a>
</li>
Expand All @@ -392,7 +388,7 @@ <h2 id="L">L</h2>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="index.html#pyfilebrowser.modals.users.UserSettings.lockPassword">lockPassword (pyfilebrowser.modals.users.UserSettings attribute)</a>
</li>
<li><a href="index.html#pyfilebrowser.modals.config.Log">Log (class in pyfilebrowser.modals.config)</a>
<li><a href="index.html#pyfilebrowser.modals.models.Log">Log (class in pyfilebrowser.modals.models)</a>
</li>
<li><a href="index.html#pyfilebrowser.modals.config.Server.log">log (pyfilebrowser.modals.config.Server attribute)</a>
</li>
Expand Down Expand Up @@ -551,10 +547,10 @@ <h2 id="S">S</h2>
</li>
<li><a href="index.html#pyfilebrowser.modals.config.Config.shell_">shell_ (pyfilebrowser.modals.config.Config attribute)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="index.html#pyfilebrowser.modals.config.Config.signup">signup (pyfilebrowser.modals.config.Config attribute)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="index.html#pyfilebrowser.modals.config.Defaults.singleClick">singleClick (pyfilebrowser.modals.config.Defaults attribute)</a>

<ul>
Expand All @@ -575,7 +571,9 @@ <h2 id="S">S</h2>
<li><a href="index.html#pyfilebrowser.modals.users.UserSettings.sorting">(pyfilebrowser.modals.users.UserSettings attribute)</a>
</li>
</ul></li>
<li><a href="index.html#pyfilebrowser.modals.config.Log.stdout">stdout (pyfilebrowser.modals.config.Log attribute)</a>
<li><a href="index.html#pyfilebrowser.main.FileBrowser.start">start() (pyfilebrowser.main.FileBrowser method)</a>
</li>
<li><a href="index.html#pyfilebrowser.modals.models.Log.stdout">stdout (pyfilebrowser.modals.models.Log attribute)</a>
</li>
<li><a href="index.html#pyfilebrowser.squire.download.Executable.system">system (pyfilebrowser.squire.download.Executable attribute)</a>
</li>
Expand All @@ -585,7 +583,7 @@ <h2 id="S">S</h2>
<h2 id="T">T</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="index.html#pyfilebrowser.modals.config.Theme">Theme (class in pyfilebrowser.modals.config)</a>
<li><a href="index.html#pyfilebrowser.modals.models.Theme">Theme (class in pyfilebrowser.modals.models)</a>
</li>
<li><a href="index.html#pyfilebrowser.modals.config.Branding.theme">theme (pyfilebrowser.modals.config.Branding attribute)</a>
</li>
Expand Down
Loading

0 comments on commit c6a5c6f

Please sign in to comment.