structables 0.2.1__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.
- {structables-0.2.1 → structables-0.2.2}/PKG-INFO +8 -2
- {structables-0.2.1 → structables-0.2.2}/README.md +7 -1
- {structables-0.2.1 → structables-0.2.2}/pyproject.toml +1 -1
- {structables-0.2.1 → structables-0.2.2}/src/structables/main.py +44 -13
- {structables-0.2.1 → structables-0.2.2}/src/structables/static/css/style.css +31 -0
- structables-0.2.2/src/structables/templates/sitemap.html +27 -0
- structables-0.2.1/src/structables/templates/sitemap.html +0 -23
- {structables-0.2.1 → structables-0.2.2}/.gitignore +0 -0
- {structables-0.2.1 → structables-0.2.2}/LICENSE +0 -0
- {structables-0.2.1 → structables-0.2.2}/cronjob.txt +0 -0
- {structables-0.2.1 → structables-0.2.2}/src/structables/__init__.py +0 -0
- {structables-0.2.1 → structables-0.2.2}/src/structables/static/dist/css/bootstrap.min.css +0 -0
- {structables-0.2.1 → structables-0.2.2}/src/structables/static/dist/css/bootstrap.min.css.map +0 -0
- {structables-0.2.1 → structables-0.2.2}/src/structables/static/dist/js/bootstrap.bundle.min.js +0 -0
- {structables-0.2.1 → structables-0.2.2}/src/structables/static/dist/js/bootstrap.bundle.min.js.map +0 -0
- {structables-0.2.1 → structables-0.2.2}/src/structables/static/img/logo.png +0 -0
- {structables-0.2.1 → structables-0.2.2}/src/structables/static/img/logo_lg.png +0 -0
- {structables-0.2.1 → structables-0.2.2}/src/structables/static/img/magnifying-glass-solid.svg +0 -0
- {structables-0.2.1 → structables-0.2.2}/src/structables/templates/400.html +0 -0
- {structables-0.2.1 → structables-0.2.2}/src/structables/templates/404.html +0 -0
- {structables-0.2.1 → structables-0.2.2}/src/structables/templates/429.html +0 -0
- {structables-0.2.1 → structables-0.2.2}/src/structables/templates/500.html +0 -0
- {structables-0.2.1 → structables-0.2.2}/src/structables/templates/archives.html +0 -0
- {structables-0.2.1 → structables-0.2.2}/src/structables/templates/article-review.html +0 -0
- {structables-0.2.1 → structables-0.2.2}/src/structables/templates/article.html +0 -0
- {structables-0.2.1 → structables-0.2.2}/src/structables/templates/base.html +0 -0
- {structables-0.2.1 → structables-0.2.2}/src/structables/templates/category.html +0 -0
- {structables-0.2.1 → structables-0.2.2}/src/structables/templates/collection.html +0 -0
- {structables-0.2.1 → structables-0.2.2}/src/structables/templates/contest.html +0 -0
- {structables-0.2.1 → structables-0.2.2}/src/structables/templates/contests.html +0 -0
- {structables-0.2.1 → structables-0.2.2}/src/structables/templates/footer.html +0 -0
- {structables-0.2.1 → structables-0.2.2}/src/structables/templates/header.html +0 -0
- {structables-0.2.1 → structables-0.2.2}/src/structables/templates/iframe.html +0 -0
- {structables-0.2.1 → structables-0.2.2}/src/structables/templates/index.html +0 -0
- {structables-0.2.1 → structables-0.2.2}/src/structables/templates/member-instructables.html +0 -0
- {structables-0.2.1 → structables-0.2.2}/src/structables/templates/member.html +0 -0
- {structables-0.2.1 → structables-0.2.2}/src/structables/templates/privacypolicy.html +0 -0
- {structables-0.2.1 → structables-0.2.2}/src/structables/templates/projects.html +0 -0
- {structables-0.2.1 → structables-0.2.2}/src/structables/templates/style.html +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: structables
|
|
3
|
-
Version: 0.2.
|
|
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
|
[](https://private.coffee)
|
|
686
|
-
[](https://matrix.
|
|
686
|
+
[](https://matrix.pcof.fi/#/#structables:private.coffee)
|
|
687
687
|
[](https://pypi.org/project/structables/)
|
|
688
688
|
[](https://pypi.org/project/structables/)
|
|
689
689
|
[](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
|
[](https://private.coffee)
|
|
8
|
-
[](https://matrix.
|
|
8
|
+
[](https://matrix.pcof.fi/#/#structables:private.coffee)
|
|
9
9
|
[](https://pypi.org/project/structables/)
|
|
10
10
|
[](https://pypi.org/project/structables/)
|
|
11
11
|
[](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
|
|
@@ -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
|
-
|
|
406
|
-
|
|
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
|
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{% extends "base.html" %}
|
|
2
|
+
|
|
3
|
+
{% block content %}
|
|
4
|
+
<div class="container my-5">
|
|
5
|
+
<div class="text-center mb-5">
|
|
6
|
+
<h1>Sitemap</h1>
|
|
7
|
+
</div>
|
|
8
|
+
<div class="row">
|
|
9
|
+
{% for group in groups %}
|
|
10
|
+
<div class="sitemap-group col-xs-12 col-sm-6 col-lg-4 mb-4">
|
|
11
|
+
<div class="card h-100">
|
|
12
|
+
<div class="card-body">
|
|
13
|
+
<h2 class="card-title">
|
|
14
|
+
<a href="{{ group[1] }}" class="text-decoration-none">{{ group[0] }}</a>
|
|
15
|
+
</h2>
|
|
16
|
+
<ul class="list-unstyled">
|
|
17
|
+
{% for channel in group[2] %}
|
|
18
|
+
<li><a href="{{ channel[1] }}" class="text-decoration-none">{{ channel[0] }}</a></li>
|
|
19
|
+
{% endfor %}
|
|
20
|
+
</ul>
|
|
21
|
+
</div>
|
|
22
|
+
</div>
|
|
23
|
+
</div>
|
|
24
|
+
{% endfor %}
|
|
25
|
+
</div>
|
|
26
|
+
</div>
|
|
27
|
+
{% endblock %}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
{% extends "base.html" %}
|
|
2
|
-
|
|
3
|
-
{% block content %}
|
|
4
|
-
<center>
|
|
5
|
-
<h1>Sitemap</h1>
|
|
6
|
-
<div class="container">
|
|
7
|
-
<div class="row sitemap-groups"></div>
|
|
8
|
-
{% for group in groups %}
|
|
9
|
-
<div class="sitemap-group col-xs-12 col-sm-6 col-lg-4">
|
|
10
|
-
<a href="{{ group[1] }}">
|
|
11
|
-
<h2>{{ group[0] }}</h2>
|
|
12
|
-
</a>
|
|
13
|
-
<ul>
|
|
14
|
-
{% for channel in group[2] %}
|
|
15
|
-
<li><a href="{{ channel[1] }}">{{ channel[0] }}</a></li>
|
|
16
|
-
{% endfor %}
|
|
17
|
-
</ul>
|
|
18
|
-
</div>
|
|
19
|
-
{% endfor %}
|
|
20
|
-
</div>
|
|
21
|
-
</div>
|
|
22
|
-
</center>
|
|
23
|
-
{% endblock %}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{structables-0.2.1 → structables-0.2.2}/src/structables/static/dist/css/bootstrap.min.css.map
RENAMED
|
File without changes
|
{structables-0.2.1 → structables-0.2.2}/src/structables/static/dist/js/bootstrap.bundle.min.js
RENAMED
|
File without changes
|
{structables-0.2.1 → structables-0.2.2}/src/structables/static/dist/js/bootstrap.bundle.min.js.map
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{structables-0.2.1 → structables-0.2.2}/src/structables/static/img/magnifying-glass-solid.svg
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|