Skip to content

Commit fbc2d81

Browse files
committed
Bring docs in line with v1.0
- installation: Python 3.10 / boto3 1.34 / Flask 3.x baseline, note [auth] extra - templates: rewrite around template_folder= and the CLI -p / --with-static scaffold; drop the removed -t {base,mdl} flow and deprecated template_namespace examples - configuration: fix missing comma in the base_path dict example - rebuild HTML output
1 parent 267edd3 commit fbc2d81

16 files changed

Lines changed: 281 additions & 125 deletions

docs/doctrees/environment.pickle

1.27 KB
Binary file not shown.
4 Bytes
Binary file not shown.
296 Bytes
Binary file not shown.
7.82 KB
Binary file not shown.

docs/html/_sources/usage/configuration.rst.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,8 @@ You can mount a specific path in the bucket to the browser.
132132
object_hostname='http://anotherbucket.com',
133133
config={
134134
'profile_name': 'PROFILE_NAME',
135-
'bucket_name': 'S3_BUCKET_NAME'
136-
'base_path': 'path/to/your/folder'
135+
'bucket_name': 'S3_BUCKET_NAME',
136+
'base_path': 'path/to/your/folder',
137137
}
138138
)
139139

docs/html/_sources/usage/installation.rst.txt

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,19 @@ You can `download FlaskS3Viewer executable`_ and `binary distributions from PyPI
1212
Support versions
1313
----------------------------------------
1414

15-
======= ====== ========
15+
Since v1.0, FlaskS3Viewer targets a modern Flask 3 / boto3 1.34 baseline.
16+
17+
======= ====== ============
1618
Type Name Version
17-
======= ====== ========
18-
Runtime Python >=3.7
19-
Library boto3 >=1.12.2
20-
Library click >=7.1.1
21-
Library Flask >=1.1.1
22-
======= ====== ========
19+
======= ====== ============
20+
Runtime Python >=3.10
21+
Library boto3 >=1.34.0
22+
Library Flask >=3.0,<4
23+
======= ====== ============
24+
25+
The optional Google OAuth integration requires the ``[auth]`` extra::
26+
27+
pip install "flask_s3_viewer[auth]" # adds Authlib >=1.3.1
2328

2429
Using pip
2530
---------

docs/html/_sources/usage/templates.rst.txt

Lines changed: 80 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -4,61 +4,110 @@
44

55
Templates
66
=========
7-
Flask S3Viewer provides CLI to help customize templates.
87

9-
Get template source
10-
--------------------------------------
11-
You can customize the template with CLI tool.
8+
Since v1.0, Flask S3 Viewer ships a single unified UI built with
9+
**Tailwind CSS + HTMX**, with light/dark mode and inline heroicons.
10+
The legacy ``base/`` and ``mdl/`` template bundles are removed and the
11+
``template_namespace`` constructor argument is deprecated — passing it
12+
emits :class:`DeprecationWarning` and is otherwise ignored.
13+
14+
Use the CLI to scaffold a copy of the bundled templates into your own
15+
repository, edit them, then point the viewer at the scaffolded
16+
directory via ``template_folder=``.
17+
18+
Scaffold the templates
19+
----------------------
1220

1321
See help.
1422

1523
.. code-block:: bash
1624
17-
# You can see the details
1825
flask_s3_viewer -h
1926
=================== Flask S3Viewer Command Line Tool ====================
2027
2128
optional arguments:
2229
-h, --help show this help message and exit
2330
-p PATH, --path PATH Enter the directory path where the template will be
24-
located
25-
-t {base,mdl}, --template {base,mdl}
26-
Enter the name of the template to import. (mdl means
27-
material-design-lite and base means not designed
28-
template).
31+
located.
32+
--with-static Also copy the bundled static assets (CSS / HTMX /
33+
core.js) alongside the templates.
2934
30-
Get the template to your repository.
35+
Copy just the Jinja templates (most common):
3136

3237
.. code-block:: bash
3338
34-
# Get a Material-design-lite template
35-
flask_s3_viewer --path templates/mdl --template mdl
39+
flask_s3_viewer -p ./fsv-templates
3640
37-
# Get a base template (not designed at all)
38-
flask_s3_viewer -p templates/base -t base
41+
Or fork the whole UI bundle (templates + ``static/css/app.css`` + HTMX +
42+
``core.js``) when you need to restyle from scratch:
3943

44+
.. code-block:: bash
4045
41-
When you run the command, you can see the
42-
``{repository}/{path}/{template}`` has been created on your
43-
repository. then rerun the Flask application.
46+
flask_s3_viewer -p ./fsv-templates --with-static
4447
45-
And you can also change template directory if you want.
48+
After scaffolding, the directory contains:
4649

47-
For examples, Get Material-design-lite template to ``templates/customized`` directory on your root path.
50+
- ``layout.html`` — page chrome, theme toggle, brand widget, ``extra_head`` block
51+
- ``files.html`` — full listing page
52+
- ``_file_list.html`` — HTMX partial swapped on navigation / search / pagination
53+
- ``_pagination.html`` — pager partial
54+
- ``_upload_form.html`` — upload UI partial
55+
- ``error.html`` / ``_error_panel.html`` — error states
4856

49-
.. code-block:: bash
57+
Wire the override
58+
-----------------
5059

51-
flask_s3_viewer -p templates/customized -t mdl
60+
Point the viewer at the scaffolded directory:
5261

53-
Then change template_namespace. it will be routed to defined directory (``templates/customized``).
62+
.. code-block:: python
63+
:linenos:
5464
55-
.. code-block:: bash
65+
FlaskS3Viewer(
66+
app,
67+
namespace='my-bucket',
68+
template_folder='./fsv-templates',
69+
config={...},
70+
)
71+
72+
Behind the scenes the extension prepends a ``FileSystemLoader`` to the
73+
Flask app's Jinja loader via ``ChoiceLoader``, so any template you
74+
didn't override still resolves against the bundled defaults and other
75+
blueprints' templates remain unaffected.
76+
77+
Inject CSS / JS without forking
78+
-------------------------------
79+
80+
For the common case where you only need to add a stylesheet, script, or
81+
meta tag, extend ``layout.html`` and use the ``extra_head`` block — no
82+
``template_folder=`` needed if you place this template on Flask's
83+
existing search path:
84+
85+
.. code-block:: jinja
86+
87+
{% extends "flask_s3_viewer/layout.html" %}
88+
{% block extra_head %}
89+
<link rel="stylesheet" href="{{ url_for('static', filename='custom.css') }}">
90+
{% endblock %}
91+
92+
Branding without overriding templates
93+
-------------------------------------
94+
95+
If you only want a custom title and logo, prefer the constructor
96+
options over a template override:
97+
98+
.. code-block:: python
99+
:linenos:
56100
57-
s3viewer = FlaskS3Viewer(
58-
...
59-
template_namespace='customized',
60-
...
61-
)
101+
FlaskS3Viewer(
102+
app,
103+
namespace='my-bucket',
104+
title='ACME File Vault',
105+
logo_path='/opt/acme/assets/logo.svg', # local file, auto-inlined as data: URI
106+
# logo_url='https://cdn.acme.io/logo.svg', # alternatively, any URL
107+
config={...},
108+
)
62109
63-
.. warning::
64-
The template folder of Flask S3Viewer is fixed as ``templates``. so if you change ``template_namespace``, It will be routed **{repository}/templates/{defined template_namespace_by_you}**.
110+
``logo_path`` reads the file once at construction time and embeds it as
111+
a ``data:`` URI, so you don't need to expose it via a separate static
112+
route. ``logo_url`` accepts any browser-resolvable URL. ``logo_path``
113+
takes precedence over ``logo_url`` when both are provided.

docs/html/index.html

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,10 @@ <h1>Welcome to Flask-S3-Viewer’s documentation!<a class="headerlink" href="#we
121121
</ul>
122122
</li>
123123
<li class="toctree-l1"><a class="reference internal" href="usage/templates.html"> Templates</a><ul>
124-
<li class="toctree-l2"><a class="reference internal" href="usage/templates.html#get-template-source">Get template source</a></li>
124+
<li class="toctree-l2"><a class="reference internal" href="usage/templates.html#scaffold-the-templates">Scaffold the templates</a></li>
125+
<li class="toctree-l2"><a class="reference internal" href="usage/templates.html#wire-the-override">Wire the override</a></li>
126+
<li class="toctree-l2"><a class="reference internal" href="usage/templates.html#inject-css-js-without-forking">Inject CSS / JS without forking</a></li>
127+
<li class="toctree-l2"><a class="reference internal" href="usage/templates.html#branding-without-overriding-templates">Branding without overriding templates</a></li>
125128
</ul>
126129
</li>
127130
<li class="toctree-l1"><a class="reference internal" href="license.html"> License</a></li>

docs/html/searchindex.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/html/sitemap.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
<?xml version='1.0' encoding='utf-8'?>
2-
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"><url><loc>https://hidekuma.github.io/flask-s3-viewer/html/changelog.html</loc></url><url><loc>https://hidekuma.github.io/flask-s3-viewer/html/index.html</loc></url><url><loc>https://hidekuma.github.io/flask-s3-viewer/html/license.html</loc></url><url><loc>https://hidekuma.github.io/flask-s3-viewer/html/reference.html</loc></url><url><loc>https://hidekuma.github.io/flask-s3-viewer/html/usage/configuration.html</loc></url><url><loc>https://hidekuma.github.io/flask-s3-viewer/html/usage/installation.html</loc></url><url><loc>https://hidekuma.github.io/flask-s3-viewer/html/usage/templates.html</loc></url><url><loc>https://hidekuma.github.io/flask-s3-viewer/html/genindex.html</loc></url><url><loc>https://hidekuma.github.io/flask-s3-viewer/html/search.html</loc></url></urlset>
2+
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"><url><loc>https://hidekuma.github.io/flask-s3-viewer/html/index.html</loc></url><url><loc>https://hidekuma.github.io/flask-s3-viewer/html/usage/configuration.html</loc></url><url><loc>https://hidekuma.github.io/flask-s3-viewer/html/usage/installation.html</loc></url><url><loc>https://hidekuma.github.io/flask-s3-viewer/html/usage/templates.html</loc></url><url><loc>https://hidekuma.github.io/flask-s3-viewer/html/genindex.html</loc></url><url><loc>https://hidekuma.github.io/flask-s3-viewer/html/search.html</loc></url></urlset>

0 commit comments

Comments
 (0)