structables 0.3.3__tar.gz → 0.3.5__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. structables-0.3.5/.forgejo/workflows/release.yml +32 -0
  2. {structables-0.3.3 → structables-0.3.5}/PKG-INFO +1 -1
  3. {structables-0.3.3 → structables-0.3.5}/pyproject.toml +1 -1
  4. {structables-0.3.3 → structables-0.3.5}/src/structables/routes/main.py +12 -3
  5. {structables-0.3.3 → structables-0.3.5}/src/structables/routes/proxy.py +12 -2
  6. {structables-0.3.3 → structables-0.3.5}/src/structables/templates/privacypolicy.html +1 -1
  7. {structables-0.3.3 → structables-0.3.5}/src/structables/utils/helpers.py +2 -2
  8. {structables-0.3.3 → structables-0.3.5}/.gitignore +0 -0
  9. {structables-0.3.3 → structables-0.3.5}/LICENSE +0 -0
  10. {structables-0.3.3 → structables-0.3.5}/README.md +0 -0
  11. {structables-0.3.3 → structables-0.3.5}/cronjob.txt +0 -0
  12. {structables-0.3.3 → structables-0.3.5}/src/structables/__init__.py +0 -0
  13. {structables-0.3.3 → structables-0.3.5}/src/structables/config.py +0 -0
  14. {structables-0.3.3 → structables-0.3.5}/src/structables/main.py +0 -0
  15. {structables-0.3.3 → structables-0.3.5}/src/structables/routes/__init__.py +0 -0
  16. {structables-0.3.3 → structables-0.3.5}/src/structables/routes/category.py +0 -0
  17. {structables-0.3.3 → structables-0.3.5}/src/structables/routes/contest.py +0 -0
  18. {structables-0.3.3 → structables-0.3.5}/src/structables/routes/member.py +0 -0
  19. {structables-0.3.3 → structables-0.3.5}/src/structables/static/css/style.css +0 -0
  20. {structables-0.3.3 → structables-0.3.5}/src/structables/static/dist/css/bootstrap.min.css +0 -0
  21. {structables-0.3.3 → structables-0.3.5}/src/structables/static/dist/css/bootstrap.min.css.map +0 -0
  22. {structables-0.3.3 → structables-0.3.5}/src/structables/static/dist/js/bootstrap.bundle.min.js +0 -0
  23. {structables-0.3.3 → structables-0.3.5}/src/structables/static/dist/js/bootstrap.bundle.min.js.map +0 -0
  24. {structables-0.3.3 → structables-0.3.5}/src/structables/static/img/logo.png +0 -0
  25. {structables-0.3.3 → structables-0.3.5}/src/structables/static/img/logo_lg.png +0 -0
  26. {structables-0.3.3 → structables-0.3.5}/src/structables/static/img/magnifying-glass-solid.svg +0 -0
  27. {structables-0.3.3 → structables-0.3.5}/src/structables/templates/400.html +0 -0
  28. {structables-0.3.3 → structables-0.3.5}/src/structables/templates/404.html +0 -0
  29. {structables-0.3.3 → structables-0.3.5}/src/structables/templates/429.html +0 -0
  30. {structables-0.3.3 → structables-0.3.5}/src/structables/templates/500.html +0 -0
  31. {structables-0.3.3 → structables-0.3.5}/src/structables/templates/archives.html +0 -0
  32. {structables-0.3.3 → structables-0.3.5}/src/structables/templates/article-review.html +0 -0
  33. {structables-0.3.3 → structables-0.3.5}/src/structables/templates/article.html +0 -0
  34. {structables-0.3.3 → structables-0.3.5}/src/structables/templates/base.html +0 -0
  35. {structables-0.3.3 → structables-0.3.5}/src/structables/templates/category.html +0 -0
  36. {structables-0.3.3 → structables-0.3.5}/src/structables/templates/collection.html +0 -0
  37. {structables-0.3.3 → structables-0.3.5}/src/structables/templates/contest.html +0 -0
  38. {structables-0.3.3 → structables-0.3.5}/src/structables/templates/contests.html +0 -0
  39. {structables-0.3.3 → structables-0.3.5}/src/structables/templates/footer.html +0 -0
  40. {structables-0.3.3 → structables-0.3.5}/src/structables/templates/header.html +0 -0
  41. {structables-0.3.3 → structables-0.3.5}/src/structables/templates/iframe.html +0 -0
  42. {structables-0.3.3 → structables-0.3.5}/src/structables/templates/index.html +0 -0
  43. {structables-0.3.3 → structables-0.3.5}/src/structables/templates/member-instructables.html +0 -0
  44. {structables-0.3.3 → structables-0.3.5}/src/structables/templates/member.html +0 -0
  45. {structables-0.3.3 → structables-0.3.5}/src/structables/templates/projects.html +0 -0
  46. {structables-0.3.3 → structables-0.3.5}/src/structables/templates/sitemap.html +0 -0
  47. {structables-0.3.3 → structables-0.3.5}/src/structables/templates/style.html +0 -0
  48. {structables-0.3.3 → structables-0.3.5}/src/structables/utils/data.py +0 -0
@@ -0,0 +1,32 @@
1
+ name: Python Package CI/CD
2
+
3
+ on:
4
+ workflow_dispatch:
5
+ push:
6
+ tags:
7
+ - "*"
8
+
9
+ jobs:
10
+ publish:
11
+ name: Publish to PyPI
12
+ container:
13
+ image: node:20-bookworm
14
+
15
+ steps:
16
+ - name: Check out code
17
+ uses: actions/checkout@v4
18
+
19
+ - name: Install dependencies
20
+ run: |
21
+ apt update
22
+ apt install -y python3 python3-venv
23
+
24
+ - name: Publish to PyPI
25
+ run: |
26
+ python3 -m venv venv
27
+ . ./venv/bin/activate
28
+ pip install -U twine build
29
+ python -m build .
30
+ python -m twine upload --username __token__ --password ${PYPI_TOKEN} dist/*
31
+ env:
32
+ PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: structables
3
- Version: 0.3.3
3
+ Version: 0.3.5
4
4
  Summary: A simple frontend for Instructables
5
5
  Project-URL: Homepage, https://git.private.coffee/privatecoffee/structables
6
6
  Project-URL: Bug Tracker, https://git.private.coffee/privatecoffee/structables/issues
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "structables"
7
- version = "0.3.3"
7
+ version = "0.3.5"
8
8
  authors = [
9
9
  { name="Private.coffee Team", email="support@private.coffee" },
10
10
  ]
@@ -157,13 +157,13 @@ def init_main_routes(app):
157
157
  for file in step["files"]:
158
158
  if file["image"] and "embedType" not in "file":
159
159
  step_imgs.append(
160
- {"src": proxy(file["downloadUrl"]), "alt": file["name"]}
160
+ {"src": proxy(file["downloadUrl"], file["name"]), "alt": file["name"]}
161
161
  )
162
162
 
163
163
  elif not file["image"]:
164
164
  step_downloads.append(
165
165
  {
166
- "src": proxy(file["downloadUrl"]),
166
+ "src": proxy(file["downloadUrl"], file["name"]),
167
167
  "name": file["name"],
168
168
  }
169
169
  )
@@ -333,10 +333,19 @@ def init_main_routes(app):
333
333
 
334
334
  @app.route("/privacypolicy/")
335
335
  def privacypolicy():
336
+ """Display the privacy policy.
337
+
338
+ The privacy policy is loaded from the file specified in the
339
+ `STRUCTABLES_PRIVACY_FILE` environment variable. If that variable is
340
+ unset or the file cannot be read, a default message is displayed.
341
+ """
342
+
336
343
  content = "No privacy policy found."
337
344
 
345
+ path = app.config.get("PRIVACY_FILE", "privacy.txt")
346
+
338
347
  try:
339
- with (pathlib.Path(__file__).parent / "privacy.txt").open() as f:
348
+ with pathlib.Path(path).open() as f:
340
349
  content = f.read()
341
350
  except OSError:
342
351
  pass
@@ -4,10 +4,13 @@ from urllib.parse import unquote
4
4
  from urllib.error import HTTPError
5
5
  from urllib.request import urlopen
6
6
 
7
+
7
8
  def init_proxy_routes(app):
8
9
  @app.route("/proxy/")
9
10
  def route_proxy():
10
11
  url = request.args.get("url")
12
+ filename = request.args.get("filename")
13
+
11
14
  if url is not None:
12
15
  if url.startswith("https://cdn.instructables.com/") or url.startswith(
13
16
  "https://content.instructables.com/"
@@ -34,7 +37,14 @@ def init_proxy_routes(app):
34
37
  except KeyError:
35
38
  raise InternalServerError()
36
39
 
37
- return Response(generate(), content_type=content_type)
40
+ headers = dict()
41
+
42
+ if filename is not None:
43
+ headers["Content-Disposition"] = (
44
+ f'attachment; filename="{filename}"'
45
+ )
46
+
47
+ return Response(generate(), content_type=content_type, headers=headers)
38
48
  else:
39
49
  raise BadRequest()
40
50
  else:
@@ -47,4 +57,4 @@ def init_proxy_routes(app):
47
57
  if url is not None:
48
58
  return render_template("iframe.html", url=url)
49
59
  else:
50
- raise BadRequest()
60
+ raise BadRequest()
@@ -5,6 +5,6 @@
5
5
  <br>
6
6
  <h1 style="font-size:2em;line-height:0em;">Privacy Policy</h1>
7
7
  <br>
8
- <p>{{ content }}</p>
8
+ <p>{{ content|safe }}</p>
9
9
  </center>
10
10
  {% endblock %}
@@ -9,9 +9,9 @@ from flask import request, render_template, abort
9
9
  logging.basicConfig(level=logging.DEBUG)
10
10
 
11
11
 
12
- def proxy(url):
12
+ def proxy(url, filename=None):
13
13
  logging.debug(f"Generating proxy URL for {url}")
14
- return f"/proxy/?url={url}"
14
+ return f"/proxy/?url={url}" + (f"&filename={filename}" if filename else "")
15
15
 
16
16
 
17
17
  def get_typesense_api_key():
File without changes
File without changes
File without changes
File without changes