structables 0.3.7__tar.gz → 0.3.9__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 (54) hide show
  1. {structables-0.3.7 → structables-0.3.9}/.gitignore +1 -1
  2. {structables-0.3.7 → structables-0.3.9}/PKG-INFO +1 -1
  3. structables-0.3.9/docker-compose-example.yml +18 -0
  4. {structables-0.3.7 → structables-0.3.9}/pyproject.toml +1 -1
  5. {structables-0.3.7 → structables-0.3.9}/src/structables/routes/member.py +32 -9
  6. structables-0.3.9/src/structables/static/dist/css/bootstrap.min.css +6 -0
  7. structables-0.3.9/src/structables/static/dist/css/bootstrap.min.css.map +1 -0
  8. structables-0.3.9/src/structables/static/dist/js/bootstrap.bundle.min.js +7 -0
  9. structables-0.3.9/src/structables/static/dist/js/bootstrap.bundle.min.js.map +1 -0
  10. {structables-0.3.7 → structables-0.3.9}/src/structables/templates/member-instructables.html +1 -1
  11. {structables-0.3.7 → structables-0.3.9}/src/structables/templates/member.html +1 -1
  12. {structables-0.3.7 → structables-0.3.9}/.env.example +0 -0
  13. {structables-0.3.7 → structables-0.3.9}/.forgejo/workflows/docker.yml +0 -0
  14. {structables-0.3.7 → structables-0.3.9}/.forgejo/workflows/release.yml +0 -0
  15. {structables-0.3.7 → structables-0.3.9}/Dockerfile +0 -0
  16. {structables-0.3.7 → structables-0.3.9}/LICENSE +0 -0
  17. {structables-0.3.7 → structables-0.3.9}/README.md +0 -0
  18. {structables-0.3.7 → structables-0.3.9}/cronjob.txt +0 -0
  19. /structables-0.3.7/docker-compose-example.yml → /structables-0.3.9/docker-compose-example-dev.yml +0 -0
  20. {structables-0.3.7 → structables-0.3.9}/entrypoint.sh +0 -0
  21. {structables-0.3.7 → structables-0.3.9}/src/structables/__init__.py +0 -0
  22. {structables-0.3.7 → structables-0.3.9}/src/structables/config.py +0 -0
  23. {structables-0.3.7 → structables-0.3.9}/src/structables/main.py +0 -0
  24. {structables-0.3.7 → structables-0.3.9}/src/structables/routes/__init__.py +0 -0
  25. {structables-0.3.7 → structables-0.3.9}/src/structables/routes/category.py +0 -0
  26. {structables-0.3.7 → structables-0.3.9}/src/structables/routes/contest.py +0 -0
  27. {structables-0.3.7 → structables-0.3.9}/src/structables/routes/main.py +0 -0
  28. {structables-0.3.7 → structables-0.3.9}/src/structables/routes/proxy.py +0 -0
  29. {structables-0.3.7 → structables-0.3.9}/src/structables/static/css/style.css +0 -0
  30. {structables-0.3.7 → structables-0.3.9}/src/structables/static/img/logo.png +0 -0
  31. {structables-0.3.7 → structables-0.3.9}/src/structables/static/img/logo_lg.png +0 -0
  32. {structables-0.3.7 → structables-0.3.9}/src/structables/static/img/magnifying-glass-solid.svg +0 -0
  33. {structables-0.3.7 → structables-0.3.9}/src/structables/templates/400.html +0 -0
  34. {structables-0.3.7 → structables-0.3.9}/src/structables/templates/404.html +0 -0
  35. {structables-0.3.7 → structables-0.3.9}/src/structables/templates/429.html +0 -0
  36. {structables-0.3.7 → structables-0.3.9}/src/structables/templates/500.html +0 -0
  37. {structables-0.3.7 → structables-0.3.9}/src/structables/templates/archives.html +0 -0
  38. {structables-0.3.7 → structables-0.3.9}/src/structables/templates/article-review.html +0 -0
  39. {structables-0.3.7 → structables-0.3.9}/src/structables/templates/article.html +0 -0
  40. {structables-0.3.7 → structables-0.3.9}/src/structables/templates/base.html +0 -0
  41. {structables-0.3.7 → structables-0.3.9}/src/structables/templates/category.html +0 -0
  42. {structables-0.3.7 → structables-0.3.9}/src/structables/templates/collection.html +0 -0
  43. {structables-0.3.7 → structables-0.3.9}/src/structables/templates/contest.html +0 -0
  44. {structables-0.3.7 → structables-0.3.9}/src/structables/templates/contests.html +0 -0
  45. {structables-0.3.7 → structables-0.3.9}/src/structables/templates/footer.html +0 -0
  46. {structables-0.3.7 → structables-0.3.9}/src/structables/templates/header.html +0 -0
  47. {structables-0.3.7 → structables-0.3.9}/src/structables/templates/iframe.html +0 -0
  48. {structables-0.3.7 → structables-0.3.9}/src/structables/templates/index.html +0 -0
  49. {structables-0.3.7 → structables-0.3.9}/src/structables/templates/privacypolicy.html +0 -0
  50. {structables-0.3.7 → structables-0.3.9}/src/structables/templates/projects.html +0 -0
  51. {structables-0.3.7 → structables-0.3.9}/src/structables/templates/sitemap.html +0 -0
  52. {structables-0.3.7 → structables-0.3.9}/src/structables/templates/style.html +0 -0
  53. {structables-0.3.7 → structables-0.3.9}/src/structables/utils/data.py +0 -0
  54. {structables-0.3.7 → structables-0.3.9}/src/structables/utils/helpers.py +0 -0
@@ -1,7 +1,7 @@
1
1
  .env
2
2
  .vscode
3
3
  __pycache__/
4
- dist/
4
+ /dist/
5
5
  docker-compose.yml
6
6
  privacy.md
7
7
  privacy.txt
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: structables
3
- Version: 0.3.7
3
+ Version: 0.3.9
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
@@ -0,0 +1,18 @@
1
+ services:
2
+ structables:
3
+ container_name: structables
4
+ restart: unless-stopped
5
+ image: privatecoffee/structables:latest
6
+ ports:
7
+ - "127.0.0.1:8002:8002"
8
+ env_file: .env
9
+ security_opt:
10
+ - no-new-privileges:true
11
+ cap_drop:
12
+ - ALL
13
+ read_only: true
14
+ deploy:
15
+ resources:
16
+ limits:
17
+ cpus: '0.5'
18
+ memory: 300M
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "structables"
7
- version = "0.3.7"
7
+ version = "0.3.9"
8
8
  authors = [
9
9
  { name="Private.coffee Team", email="support@private.coffee" },
10
10
  ]
@@ -1,14 +1,32 @@
1
1
  from flask import render_template, abort
2
2
  from urllib.request import urlopen
3
3
  from urllib.error import HTTPError
4
+ from urllib.parse import quote
4
5
  from ..utils.helpers import proxy, member_header
5
6
  from bs4 import BeautifulSoup
6
7
  from urllib.request import Request
7
8
 
8
9
 
9
10
  def init_member_routes(app):
11
+ """This function initializes all the routes related to Instructables member profiles.
12
+
13
+ Args:
14
+ app (Flask): The Flask app instance.
15
+ """
16
+
10
17
  @app.route("/member/<member>/instructables/")
11
18
  def route_member_instructables(member):
19
+ """Route to display a member's Instructables.
20
+
21
+ Args:
22
+ member (str): The member's username.
23
+
24
+ Returns:
25
+ Response: The rendered HTML page.
26
+ """
27
+
28
+ member = quote(member)
29
+
12
30
  try:
13
31
  data = urlopen(
14
32
  f"https://www.instructables.com/member/{member}/instructables/"
@@ -55,13 +73,18 @@ def init_member_routes(app):
55
73
 
56
74
  @app.route("/member/<member>/")
57
75
  def route_member(member):
58
- headers = {
59
- "User-Agent": "Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/113.0"
60
- }
76
+ """Route to display a member's profile.
61
77
 
62
- request = Request(
63
- f"https://www.instructables.com/member/{member}/", headers=headers
64
- )
78
+ Args:
79
+ member (str): The member's username.
80
+
81
+ Returns:
82
+ Response: The rendered HTML page.
83
+ """
84
+
85
+ member = quote(member)
86
+
87
+ request = Request(f"https://www.instructables.com/member/{member}/")
65
88
 
66
89
  try:
67
90
  data = urlopen(request)
@@ -103,9 +126,9 @@ def init_member_routes(app):
103
126
  "div.achievements-section.main-achievements.contest-achievements div.achievement-item:not(.two-column-filler)"
104
127
  ):
105
128
  try:
106
- ach_title = ach.select("div.achievement-info span.achievement-title")[
107
- 0
108
- ].text
129
+ ach_title = ach.select(
130
+ "div.achievement-info span.achievement-title"
131
+ )[0].text
109
132
  ach_desc = ach.select(
110
133
  "div.achievement-info span.achievement-description"
111
134
  )[0].text