Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Addition of usage with adafruit_templateengine and other minor changes #72

Merged
merged 12 commits into from
Nov 6, 2023

Conversation

michalpokusa
Copy link
Contributor

@michalpokusa michalpokusa commented Oct 26, 2023

⭐ Added:

  • Example of using adafruit_httpserver with adafruit_templateengine

🛠️ Updated/Changed:

  • Docs now include the new example
  • EDIT2: Debug message after handling request now contains query params in path

🏗️ Refactor:

  • EDIT2: Removed unnecessary keyword argument when serving files
  • EDIT2: 'home.html' now uses HTML comments for Copyright info instead of hashtag ones

@michalpokusa
Copy link
Contributor Author

michalpokusa commented Oct 29, 2023

This example is similar to Python's "http.server" which serves files from current directory.

image
EDIT1: Updated image so that it shows the version after adding trailing slash to folders.

It also includes a very basic prevention against path traversal, so just as is, it should not be possible to access e.g. settings.toml etc.

@michalpokusa michalpokusa marked this pull request as ready for review October 29, 2023 23:11
@@ -0,0 +1,54 @@
# SPDX-FileCopyrightText: 2023 Michal Pokusa
#
# SPDX-License-Identifier: Unlicense
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can use html comments to match it's filetype

<!--
SPDX-FileCopyrightText: 2023 Michal Pokusa

SPDX-License-Identifier: Unlicense
-->

Beyond that, this looks good to me. I tested successfully on a feather esp32-s2 TFT.

Thank you @michalpokusa

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed in latest version, I didn't know HTML comments are allowed there, thanks.

@michalpokusa
Copy link
Contributor Author

Your suggestion from live to add trailing slash for directories was very interesting, so I decided to add that. Items in the directory listing are now also sorted, so first is "..", then folders and then files.

Thanks for review.

@michalpokusa michalpokusa changed the title Addition of usage with adafruit_templateengine Addition of usage with adafruit_templateengine and other minor changes Nov 6, 2023
Copy link
Contributor

@FoamyGuy FoamyGuy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. Tested successfully on Feather ESP32-S2 TFT.

Thanks for the new example and improvements @michalpokusa

@FoamyGuy FoamyGuy merged commit 1c5c41a into adafruit:main Nov 6, 2023
1 check passed
adafruit-adabot added a commit to adafruit/Adafruit_CircuitPython_Bundle that referenced this pull request Nov 7, 2023
Updating https://github.com/adafruit/Adafruit_CircuitPython_DisplayIO_SSD1305 to 1.4.0 from 1.3.12:
  > Merge pull request adafruit/Adafruit_CircuitPython_DisplayIO_SSD1305#18 from RetiredWizard/main

Updating https://github.com/adafruit/Adafruit_CircuitPython_FocalTouch to 1.5.0 from 1.4.11:
  > Merge pull request adafruit/Adafruit_CircuitPython_FocalTouch#31 from Fexiven/main

Updating https://github.com/adafruit/Adafruit_CircuitPython_SSD1675 to 1.3.0 from 1.2.3:
  > Merge pull request adafruit/Adafruit_CircuitPython_SSD1675#18 from RetiredWizard/main

Updating https://github.com/adafruit/Adafruit_CircuitPython_ST7789 to 1.6.0 from 1.5.18:
  > Merge pull request adafruit/Adafruit_CircuitPython_ST7789#37 from RetiredWizard/main

Updating https://github.com/adafruit/Adafruit_CircuitPython_HTTPServer to 4.4.4 from 4.4.3:
  > Merge pull request adafruit/Adafruit_CircuitPython_HTTPServer#72 from michalpokusa/template-example

Updating https://github.com/adafruit/Adafruit_CircuitPython_Qualia to 1.0.1 from 1.0.0:
  > Fix Display ID in paint example

Updating https://github.com/adafruit/Adafruit_CircuitPython_Bundle/circuitpython_library_list.md to NA from NA:
  > Added the following libraries: Adafruit_CircuitPython_Qualia

Updating https://github.com/adafruit/Adafruit_CircuitPython_Bundle/circuitpython_library_list.md to NA from NA:
  > Updated download stats for the libraries
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants