structables 0.2.0__tar.gz → 0.2.2__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 (39) hide show
  1. {structables-0.2.0 → structables-0.2.2}/.gitignore +1 -1
  2. {structables-0.2.0 → structables-0.2.2}/PKG-INFO +8 -2
  3. {structables-0.2.0 → structables-0.2.2}/README.md +7 -1
  4. {structables-0.2.0 → structables-0.2.2}/pyproject.toml +1 -1
  5. {structables-0.2.0 → structables-0.2.2}/src/structables/main.py +44 -13
  6. {structables-0.2.0 → structables-0.2.2}/src/structables/static/css/style.css +31 -0
  7. structables-0.2.2/src/structables/static/dist/css/bootstrap.min.css +6 -0
  8. structables-0.2.2/src/structables/static/dist/css/bootstrap.min.css.map +1 -0
  9. structables-0.2.2/src/structables/static/dist/js/bootstrap.bundle.min.js +7 -0
  10. structables-0.2.2/src/structables/static/dist/js/bootstrap.bundle.min.js.map +1 -0
  11. structables-0.2.2/src/structables/templates/sitemap.html +27 -0
  12. structables-0.2.0/src/structables/templates/sitemap.html +0 -23
  13. {structables-0.2.0 → structables-0.2.2}/LICENSE +0 -0
  14. {structables-0.2.0 → structables-0.2.2}/cronjob.txt +0 -0
  15. {structables-0.2.0 → structables-0.2.2}/src/structables/__init__.py +0 -0
  16. {structables-0.2.0 → structables-0.2.2}/src/structables/static/img/logo.png +0 -0
  17. {structables-0.2.0 → structables-0.2.2}/src/structables/static/img/logo_lg.png +0 -0
  18. {structables-0.2.0 → structables-0.2.2}/src/structables/static/img/magnifying-glass-solid.svg +0 -0
  19. {structables-0.2.0 → structables-0.2.2}/src/structables/templates/400.html +0 -0
  20. {structables-0.2.0 → structables-0.2.2}/src/structables/templates/404.html +0 -0
  21. {structables-0.2.0 → structables-0.2.2}/src/structables/templates/429.html +0 -0
  22. {structables-0.2.0 → structables-0.2.2}/src/structables/templates/500.html +0 -0
  23. {structables-0.2.0 → structables-0.2.2}/src/structables/templates/archives.html +0 -0
  24. {structables-0.2.0 → structables-0.2.2}/src/structables/templates/article-review.html +0 -0
  25. {structables-0.2.0 → structables-0.2.2}/src/structables/templates/article.html +0 -0
  26. {structables-0.2.0 → structables-0.2.2}/src/structables/templates/base.html +0 -0
  27. {structables-0.2.0 → structables-0.2.2}/src/structables/templates/category.html +0 -0
  28. {structables-0.2.0 → structables-0.2.2}/src/structables/templates/collection.html +0 -0
  29. {structables-0.2.0 → structables-0.2.2}/src/structables/templates/contest.html +0 -0
  30. {structables-0.2.0 → structables-0.2.2}/src/structables/templates/contests.html +0 -0
  31. {structables-0.2.0 → structables-0.2.2}/src/structables/templates/footer.html +0 -0
  32. {structables-0.2.0 → structables-0.2.2}/src/structables/templates/header.html +0 -0
  33. {structables-0.2.0 → structables-0.2.2}/src/structables/templates/iframe.html +0 -0
  34. {structables-0.2.0 → structables-0.2.2}/src/structables/templates/index.html +0 -0
  35. {structables-0.2.0 → structables-0.2.2}/src/structables/templates/member-instructables.html +0 -0
  36. {structables-0.2.0 → structables-0.2.2}/src/structables/templates/member.html +0 -0
  37. {structables-0.2.0 → structables-0.2.2}/src/structables/templates/privacypolicy.html +0 -0
  38. {structables-0.2.0 → structables-0.2.2}/src/structables/templates/projects.html +0 -0
  39. {structables-0.2.0 → structables-0.2.2}/src/structables/templates/style.html +0 -0
@@ -3,4 +3,4 @@ venv/
3
3
  __pycache__/
4
4
  .vscode
5
5
  privacy.txt
6
- dist/
6
+ /dist/
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: structables
3
- Version: 0.2.0
3
+ Version: 0.2.2
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
@@ -683,7 +683,7 @@ Description-Content-Type: text/markdown
683
683
  An open source alternative front-end to Instructables. This is a fork of <a href="https://codeberg.org/indestructables/indestructables">snowcatridge10's Indestructables</a> to get rid of Selenium. Indestructables itself is a fork of <a href="https://git.vern.cc/cobra/Destructables">Cobra's Destructables</a>.
684
684
 
685
685
  [![Support Private.coffee!](https://shields.private.coffee/badge/private.coffee-support%20us!-pink?logo=coffeescript)](https://private.coffee)
686
- [![Matrix](https://shields.private.coffee/badge/Matrix-join%20us!-blue?logo=matrix)](https://matrix.to/#/#structables:private.coffee)
686
+ [![Matrix](https://shields.private.coffee/badge/Matrix-join%20us!-blue?logo=matrix)](https://matrix.pcof.fi/#/#structables:private.coffee)
687
687
  [![PyPI](https://shields.private.coffee/pypi/v/structables)](https://pypi.org/project/structables/)
688
688
  [![PyPI - Python Version](https://shields.private.coffee/pypi/pyversions/structables)](https://pypi.org/project/structables/)
689
689
  [![PyPI - License](https://shields.private.coffee/pypi/l/structables)](https://pypi.org/project/structables/)
@@ -697,6 +697,12 @@ An open source alternative front-end to Instructables. This is a fork of <a href
697
697
 
698
698
  To add your own instance to this list, please open a pull request or issue.
699
699
 
700
+ ## Opening Issues
701
+
702
+ If you're having problems using Structables, or if you have ideas or feedback for us, feel free to open an issue in the [Private.coffee Git](https://git.private.coffee/PrivateCoffee/structables/issues) or on [Github](https://github.com/PrivateCoffee/structables/issues).
703
+
704
+ Of course, you can also join our [Matrix room](https://matrix.pcof.fi/#/#structables:private.coffee) to discuss your ideas with us.
705
+
700
706
  ## Run your own instance
701
707
 
702
708
  ### Production
@@ -5,7 +5,7 @@
5
5
  An open source alternative front-end to Instructables. This is a fork of <a href="https://codeberg.org/indestructables/indestructables">snowcatridge10's Indestructables</a> to get rid of Selenium. Indestructables itself is a fork of <a href="https://git.vern.cc/cobra/Destructables">Cobra's Destructables</a>.
6
6
 
7
7
  [![Support Private.coffee!](https://shields.private.coffee/badge/private.coffee-support%20us!-pink?logo=coffeescript)](https://private.coffee)
8
- [![Matrix](https://shields.private.coffee/badge/Matrix-join%20us!-blue?logo=matrix)](https://matrix.to/#/#structables:private.coffee)
8
+ [![Matrix](https://shields.private.coffee/badge/Matrix-join%20us!-blue?logo=matrix)](https://matrix.pcof.fi/#/#structables:private.coffee)
9
9
  [![PyPI](https://shields.private.coffee/pypi/v/structables)](https://pypi.org/project/structables/)
10
10
  [![PyPI - Python Version](https://shields.private.coffee/pypi/pyversions/structables)](https://pypi.org/project/structables/)
11
11
  [![PyPI - License](https://shields.private.coffee/pypi/l/structables)](https://pypi.org/project/structables/)
@@ -19,6 +19,12 @@ An open source alternative front-end to Instructables. This is a fork of <a href
19
19
 
20
20
  To add your own instance to this list, please open a pull request or issue.
21
21
 
22
+ ## Opening Issues
23
+
24
+ If you're having problems using Structables, or if you have ideas or feedback for us, feel free to open an issue in the [Private.coffee Git](https://git.private.coffee/PrivateCoffee/structables/issues) or on [Github](https://github.com/PrivateCoffee/structables/issues).
25
+
26
+ Of course, you can also join our [Matrix room](https://matrix.pcof.fi/#/#structables:private.coffee) to discuss your ideas with us.
27
+
22
28
  ## Run your own instance
23
29
 
24
30
  ### Production
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "structables"
7
- version = "0.2.0"
7
+ version = "0.2.2"
8
8
  authors = [
9
9
  { name="Private.coffee Team", email="support@private.coffee" },
10
10
  ]
@@ -14,6 +14,7 @@ from urllib.error import HTTPError
14
14
  from traceback import print_exc
15
15
  from urllib.parse import urlparse
16
16
  from argparse import ArgumentParser
17
+ from typing import List
17
18
 
18
19
  from werkzeug.exceptions import BadRequest, abort, InternalServerError, NotFound
19
20
  from bs4 import BeautifulSoup
@@ -59,6 +60,26 @@ invidious = None
59
60
  unsafe = False
60
61
 
61
62
 
63
+ def unslugify(slug: str) -> List[str]:
64
+ """Return a list of possible original titles for a slug.
65
+
66
+ Args:
67
+ slug (str): The slug to unslugify.
68
+
69
+ Returns:
70
+ List[str]: A list of possible original titles for the slug.
71
+ """
72
+
73
+ results = []
74
+
75
+ results.append(slug.replace("-", " ").title())
76
+
77
+ if "and" in slug:
78
+ results.append(results[0].replace("And", "&").title())
79
+
80
+ return results
81
+
82
+
62
83
  def projects_search(
63
84
  query="*",
64
85
  category="",
@@ -402,9 +423,18 @@ def project_list(head, sort="", per_page=20):
402
423
  category = parts[1]
403
424
  channel = "" if parts[2] == "projects" else parts[2]
404
425
 
405
- project_ibles, total = projects_search(
406
- category=category, channel=channel, per_page=per_page, page=page
407
- )
426
+ channel_names = unslugify(channel)
427
+
428
+ for channel_name in channel_names:
429
+ project_ibles, total = projects_search(
430
+ category=category,
431
+ channel=channel_name,
432
+ per_page=per_page,
433
+ page=page,
434
+ )
435
+
436
+ if project_ibles:
437
+ break
408
438
 
409
439
  elif "search" in path.split("/"):
410
440
  ibles = []
@@ -492,6 +522,10 @@ def route_sitemap(path=""):
492
522
  for li in main.select("ul.sitemap-listing li"):
493
523
  channel = li.a.text
494
524
  channel_link = li.a["href"]
525
+
526
+ if channel_link.startswith("https://"):
527
+ channel_link = f'/{"/".join(channel_link.split("/")[3:])}'
528
+
495
529
  channels.append([channel, channel_link])
496
530
  groups.append(["", "", channels])
497
531
 
@@ -1191,22 +1225,22 @@ def privacypolicy():
1191
1225
 
1192
1226
  @app.errorhandler(404)
1193
1227
  def not_found(e):
1194
- return render_template("404.html")
1228
+ return render_template("404.html"), 404
1195
1229
 
1196
1230
 
1197
1231
  @app.errorhandler(400)
1198
1232
  def bad_request(e):
1199
- return render_template("400.html")
1233
+ return render_template("400.html"), 400
1200
1234
 
1201
1235
 
1202
1236
  @app.errorhandler(429)
1203
1237
  def too_many_requests(e):
1204
- return render_template("429.html")
1238
+ return render_template("429.html"), 429
1205
1239
 
1206
1240
 
1207
1241
  @app.errorhandler(500)
1208
1242
  def internal_server_error(e):
1209
- return render_template("500.html")
1243
+ return render_template("500.html"), 500
1210
1244
 
1211
1245
 
1212
1246
  def main():
@@ -1266,12 +1300,6 @@ def main():
1266
1300
  if args.unsafe:
1267
1301
  unsafe = True
1268
1302
 
1269
- print("Loading initial data...")
1270
-
1271
- update_data()
1272
-
1273
- print("Started!")
1274
-
1275
1303
  if debugmode:
1276
1304
  app.logger.setLevel(logging.DEBUG)
1277
1305
 
@@ -1280,3 +1308,6 @@ def main():
1280
1308
 
1281
1309
  if __name__ == "__main__":
1282
1310
  main()
1311
+
1312
+ # Initialize data when the server starts
1313
+ update_data()
@@ -320,4 +320,35 @@ iframe {
320
320
 
321
321
  .text-muted {
322
322
  color: #6c757d !important;
323
+ }
324
+
325
+
326
+
327
+ .sitemap-group .card {
328
+ background-color: var(--primary-bg);
329
+ border: 1px solid var(--border-color);
330
+ border-radius: 8px;
331
+ box-shadow: 0 2px 4px var(--shadow-color);
332
+ overflow: hidden;
333
+ }
334
+
335
+ .sitemap-group .card-title {
336
+ font-size: 1.5em;
337
+ margin-bottom: 0.5em;
338
+ }
339
+
340
+ .sitemap-group .list-unstyled {
341
+ padding-left: 0;
342
+ }
343
+
344
+ .sitemap-group .list-unstyled li {
345
+ margin-bottom: 0.5em;
346
+ }
347
+
348
+ .sitemap-group .list-unstyled li a {
349
+ color: var(--link-color);
350
+ }
351
+
352
+ .sitemap-group .list-unstyled li a:hover {
353
+ text-decoration: underline;
323
354
  }