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

Color scheme and more #800

Merged
merged 5 commits into from
Dec 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ repos:
- id: mixed-line-ending

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.7.1
rev: v0.8.4
hooks:
- id: ruff
# - id: ruff-format
Expand All @@ -42,7 +42,7 @@ repos:
- id: black

- repo: https://github.com/Riverside-Healthcare/djLint
rev: v1.35.2
rev: v1.36.4
hooks:
- id: djlint-reformat-django
- id: djlint-django
Expand Down
2 changes: 2 additions & 0 deletions boofilsic/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
NEODB_SITE_LOGO=(str, "/s/img/logo.svg"),
NEODB_SITE_ICON=(str, "/s/img/icon.png"),
NEODB_USER_ICON=(str, "/s/img/avatar.svg"),
NEODB_SITE_COLOR=(str, "azure"), # https://picocss.com/docs/colors
NEODB_SITE_INTRO=(str, ""),
NEODB_SITE_HEAD=(str, ""),
NEODB_SITE_DESCRIPTION=(
Expand Down Expand Up @@ -205,6 +206,7 @@
"site_logo": env("NEODB_SITE_LOGO"),
"site_icon": env("NEODB_SITE_ICON"),
"user_icon": env("NEODB_USER_ICON"),
"site_color": env("NEODB_SITE_COLOR"),
"site_intro": env("NEODB_SITE_INTRO"),
"site_description": env("NEODB_SITE_DESCRIPTION"),
"site_head": env("NEODB_SITE_HEAD"),
Expand Down
8 changes: 8 additions & 0 deletions catalog/migrations/0001_initial_0_10.py
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,10 @@ class Migration(migrations.Migration):
("apple_podcast", "Apple Podcast"),
("apple_music", "Apple Music"),
("fedi", "Fediverse"),
("qidian", "Qidian"),
("ypshuo", "Ypshuo"),
("ao3", "Archive of Our Own"),
("jjwxc", "JinJiang"),
],
max_length=50,
verbose_name="IdType of the source site",
Expand Down Expand Up @@ -582,6 +586,10 @@ class Migration(migrations.Migration):
("apple_podcast", "Apple Podcast"),
("apple_music", "Apple Music"),
("fedi", "Fediverse"),
("qidian", "Qidian"),
("ypshuo", "Ypshuo"),
("ao3", "Archive of Our Own"),
("jjwxc", "JinJiang"),
],
max_length=50,
verbose_name="source site",
Expand Down
3 changes: 2 additions & 1 deletion catalog/sites/bangumi.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,8 @@ def scrape(self):
if o.get("name_cn"):
titles[o.get("name_cn")] = "zh-cn"
localized_title = [
{"lang": l or detect_language(t), "text": t} for t, l in titles.items()
{"lang": lang or detect_language(t), "text": t}
for t, lang in titles.items()
]
localized_desc = (
[{"lang": detect_language(brief), "text": brief}] if brief else []
Expand Down
16 changes: 4 additions & 12 deletions catalog/templates/discover.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,10 @@
{% if not gallery.items %}style="display:none;"{% endif %}>
<span class="action">
<span>
<a _="on click set el to the next
<ul/>
then call el.scrollBy({left:-el.offsetWidth, behavior:'smooth'})"><i class="fa-solid fa-circle-left"></i></a>
<a _="on click set el to the next <ul/> then call el.scrollBy({left:-el.offsetWidth, behavior:'smooth'})"><i class="fa-solid fa-circle-left"></i></a>
</span>
<span>
<a _="on click set el to the next
<ul/>
then call el.scrollBy({left:el.offsetWidth, behavior:'smooth'})"><i class="fa-solid fa-circle-right"></i></a>
<a _="on click set el to the next <ul/> then call el.scrollBy({left:el.offsetWidth, behavior:'smooth'})"><i class="fa-solid fa-circle-right"></i></a>
</span>
</span>
<h5>{{ gallery.category.label }}</h5>
Expand All @@ -71,14 +67,10 @@ <h5>{{ gallery.category.label }}</h5>
{% if not featured_collections %}style="display:none;"{% endif %}>
<span class="action">
<span>
<a _="on click set el to the next
<ul/>
then call el.scrollBy({left:-el.offsetWidth, behavior:'smooth'})"><i class="fa-solid fa-circle-left"></i></a>
<a _="on click set el to the next <ul/> then call el.scrollBy({left:-el.offsetWidth, behavior:'smooth'})"><i class="fa-solid fa-circle-left"></i></a>
</span>
<span>
<a _="on click set el to the next
<ul/>
then call el.scrollBy({left:el.offsetWidth, behavior:'smooth'})"><i class="fa-solid fa-circle-right"></i></a>
<a _="on click set el to the next <ul/> then call el.scrollBy({left:el.offsetWidth, behavior:'smooth'})"><i class="fa-solid fa-circle-right"></i></a>
</span>
</span>
<h5>{% trans "Collections" %}</h5>
Expand Down
8 changes: 2 additions & 6 deletions catalog/templates/edition.html
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,10 @@ <h5>contents</h5>
<section class="entity-sort shelf" id="sibling">
<span class="action">
<span>
<a _="on click set el to the next
<ul/>
then call el.scrollBy({left:-el.offsetWidth, behavior:'smooth'})"><i class="fa-solid fa-circle-left"></i></a>
<a _="on click set el to the next <ul/> then call el.scrollBy({left:-el.offsetWidth, behavior:'smooth'})"><i class="fa-solid fa-circle-left"></i></a>
</span>
<span>
<a _="on click set el to the next
<ul/>
then call el.scrollBy({left:el.offsetWidth, behavior:'smooth'})"><i class="fa-solid fa-circle-right"></i></a>
<a _="on click set el to the next <ul/> then call el.scrollBy({left:el.offsetWidth, behavior:'smooth'})"><i class="fa-solid fa-circle-right"></i></a>
</span>
</span>
<h5>{% trans 'other editions' %}</h5>
Expand Down
37 changes: 32 additions & 5 deletions common/management/commands/jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@


class Command(BaseCommand):
help = "Show jobs in queue"
help = "Manage jobs in RQ"

def add_arguments(self, parser):
parser.add_argument("--retry", action="append")
parser.add_argument("--delete", action="append")
parser.add_argument("--list", action="store_true")
parser.add_argument("--prune", action="store_true")

def handle(self, *args, **options):
if options["retry"]:
Expand All @@ -30,7 +31,7 @@ def handle(self, *args, **options):
job = Job.fetch(job_id, connection=django_rq.get_connection("fetch"))
job.delete()
self.stdout.write(self.style.SUCCESS(f"Deleted {job}"))
if options["list"]:
if options["list"] or options["prune"]:
queues = settings.RQ_QUEUES.keys()
for q in queues:
queue = django_rq.get_queue(q)
Expand All @@ -42,13 +43,39 @@ def handle(self, *args, **options):
queue.failed_job_registry,
queue.canceled_job_registry,
]:
if options["prune"]:
registry.cleanup()
for job_id in registry.get_job_ids():
try:
job = Job.fetch(
job_id, connection=django_rq.get_connection(q)
)
if (
options["prune"]
and q != "cron"
and job.get_status()
in [
"finished",
"failed",
"canceled",
]
):
job.delete()
if options["list"]:
self.stdout.write(
registry.key.ljust(20)
+ str(job.get_status()).ljust(10)
+ job_id.ljust(40)
+ (
job.enqueued_at.strftime("%Y-%m-%d %H:%M:%S")
if job.enqueued_at
else ""
)
)
except Exception as e:
self.stdout.write(
self.style.SUCCESS(f"{registry.key} {repr(job)}")
registry.key.ljust(20)
+ "error".ljust(10)
+ job_id.ljust(40)
+ str(e)
)
except Exception as e:
print(f"Fetching {registry.key} {job_id} error: {e}")
1 change: 1 addition & 0 deletions common/templates/_header.html
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
<summary aria-haspopup="listbox">
<span class="avatar">
<img alt=""
title="{% if request.user.is_authenticated %}{{ request.user.username }}{% else %}{% endif %}"
src="{% if request.user.is_authenticated %}{{ request.user.avatar }}{% else %}{{ user_icon }}{% endif %}" />
</span>
</summary>
Expand Down
2 changes: 1 addition & 1 deletion common/templates/common_libs.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<script src="{{ cdn_url }}/npm/[email protected]/dist/htmx.min.js"></script>
<script src="{{ cdn_url }}/npm/[email protected]"></script>
<link rel="stylesheet"
href="{{ cdn_url }}/npm/@yohns/[email protected]/css/pico.min.css" />
href="{{ cdn_url }}/npm/@yohns/[email protected]/css/pico.{{ site_color }}.min.css" />
<link href="{% sass_src 'scss/neodb.scss' %}"
rel="stylesheet"
type="text/css" />
Expand Down
1 change: 1 addition & 0 deletions docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ if you are doing debug or development:
- `NEODB_SITE_LOGO`
- `NEODB_SITE_ICON`
- `NEODB_USER_ICON`
- `NEODB_SITE_COLOR` - one of [these color schemes](https://picocss.com/docs/colors)
- `NEODB_SITE_INTRO`
- `NEODB_SITE_HEAD`
- `NEODB_SITE_DESCRIPTION`
Expand Down
3 changes: 3 additions & 0 deletions journal/exporters/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from .doufen import DoufenExporter

__all__ = ["DoufenExporter"]
Loading
Loading