Skip to content
This repository was archived by the owner on Jun 22, 2025. It is now read-only.

Commit 5e551f3

Browse files
authored
Merge pull request #121 from ChrisKnott/shw-only-render-templates
Only render jinja templates
2 parents da4198c + 07706ac commit 5e551f3

File tree

3 files changed

+15
-7
lines changed

3 files changed

+15
-7
lines changed

CHANGELOG.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,17 @@
11
# Change log
22

3+
### v0.10.2
4+
* Only render templates from within the declared jinja template directory.
5+
6+
### v0.10.1
7+
* Avoid name collisions when using Electron, so jQuery etc work normally
8+
39
## v0.10.0
410
* Corrective version bump after new feature included in 0.9.13
511
* Fix a bug with example 06 for Jinja templating; the `templates` kwarg to `eel.start` takes a filepath, not a bool.
612

7-
## v0.9.13
13+
### v0.9.13
814
* Add support for Jinja templating.
915

10-
## Earlier
16+
### Earlier
1117
* No changelog notes for earlier versions.

eel/__init__.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -153,12 +153,14 @@ def _eel():
153153

154154
@btl.route('/<path:path>')
155155
def _static(path):
156-
if _jinja_env != None:
157-
n = len(_jinja_templates + '/')
156+
template_prefix = _jinja_templates + '/'
157+
158+
if _jinja_env != None and path.startswith(template_prefix):
159+
n = len(template_prefix)
158160
template = _jinja_env.get_template(path[n:])
159161
return template.render()
160-
else:
161-
return btl.static_file(path, root=root_path)
162+
163+
return btl.static_file(path, root=root_path)
162164

163165

164166
@btl.get('/eel', apply=[wbs.websocket])

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
setup(
55
name='Eel',
6-
version='0.10.1',
6+
version='0.10.2',
77
author='Chris Knott',
88
author_email='chrisknott@hotmail.co.uk',
99
packages=['eel'],

0 commit comments

Comments
 (0)