mirror of
https://codeberg.org/diginaut/digimarks.git
synced 2026-02-04 10:20:26 +01:00
Compare commits
4 Commits
79be98abea
...
971ede6067
| Author | SHA1 | Date | |
|---|---|---|---|
| 971ede6067 | |||
| 96a8946a9a | |||
| 14f09a2dfb | |||
| 9d813b7ea6 |
@@ -32,9 +32,9 @@ dependencies = [
|
|||||||
|
|
||||||
[dependency-groups]
|
[dependency-groups]
|
||||||
dev = [
|
dev = [
|
||||||
{include-group = "lint"},
|
{ include-group = "lint" },
|
||||||
{include-group = "pub"},
|
{ include-group = "pub" },
|
||||||
{include-group = "test"}
|
{ include-group = "test" }
|
||||||
]
|
]
|
||||||
test = [
|
test = [
|
||||||
"pytest>=7.0.0",
|
"pytest>=7.0.0",
|
||||||
@@ -42,7 +42,7 @@ test = [
|
|||||||
]
|
]
|
||||||
lint = [
|
lint = [
|
||||||
"ruff>=0.1.0",
|
"ruff>=0.1.0",
|
||||||
"mypy>=1.0.0",
|
"pyrefly",
|
||||||
]
|
]
|
||||||
# Publishing on PyPI
|
# Publishing on PyPI
|
||||||
pub = [
|
pub = [
|
||||||
@@ -50,7 +50,7 @@ pub = [
|
|||||||
"twine"
|
"twine"
|
||||||
]
|
]
|
||||||
server = [
|
server = [
|
||||||
"gunicorn>=23.0.0",
|
"uvicorn",
|
||||||
]
|
]
|
||||||
# dynamic = ["version"]
|
# dynamic = ["version"]
|
||||||
|
|
||||||
@@ -58,8 +58,8 @@ server = [
|
|||||||
my-script = "digimarks:app"
|
my-script = "digimarks:app"
|
||||||
|
|
||||||
[project.urls]
|
[project.urls]
|
||||||
"Homepage" = "https://github.com/aquatix/digimarks"
|
"Homepage" = "https://codeberg.org/diginaut/digimarks"
|
||||||
"Bug Tracker" = "https://github.com/aquatix/digimarks/issues"
|
"Bug Tracker" = "https://codeberg.org/diginaut/digimarks/issues"
|
||||||
|
|
||||||
[tool.black]
|
[tool.black]
|
||||||
line-length = 120
|
line-length = 120
|
||||||
|
|||||||
@@ -2,9 +2,12 @@
|
|||||||
|
|
||||||
# Linting and fixing, including isort
|
# Linting and fixing, including isort
|
||||||
ruff
|
ruff
|
||||||
|
# Typing
|
||||||
|
pyrefly
|
||||||
|
|
||||||
# Test suite
|
# Test suite
|
||||||
pytest
|
pytest
|
||||||
|
pytest-cov
|
||||||
|
|
||||||
# Publishing on PyPI
|
# Publishing on PyPI
|
||||||
build
|
build
|
||||||
|
|||||||
@@ -92,7 +92,10 @@ async def list_bookmarks_for_user(
|
|||||||
offset: int = 0,
|
offset: int = 0,
|
||||||
limit: Annotated[int, Query(le=10000)] = 100,
|
limit: Annotated[int, Query(le=10000)] = 100,
|
||||||
) -> Sequence[Bookmark]:
|
) -> Sequence[Bookmark]:
|
||||||
"""List all bookmarks in the database. By default, 100 items are returned."""
|
"""List all bookmarks in the database. By default, 100 items are returned.
|
||||||
|
|
||||||
|
There is a limit of 10000 items.
|
||||||
|
"""
|
||||||
result = await session.exec(
|
result = await session.exec(
|
||||||
select(Bookmark)
|
select(Bookmark)
|
||||||
.where(Bookmark.user_key == user_key, Bookmark.status != Visibility.DELETED)
|
.where(Bookmark.user_key == user_key, Bookmark.status != Visibility.DELETED)
|
||||||
@@ -121,7 +124,7 @@ async def autocomplete_bookmark(
|
|||||||
user_key: str,
|
user_key: str,
|
||||||
bookmark: Bookmark,
|
bookmark: Bookmark,
|
||||||
strip_params: bool = False,
|
strip_params: bool = False,
|
||||||
):
|
) -> Bookmark:
|
||||||
"""Autofill some fields for this (new) bookmark for user `user_key`."""
|
"""Autofill some fields for this (new) bookmark for user `user_key`."""
|
||||||
bookmark.user_key = user_key
|
bookmark.user_key = user_key
|
||||||
|
|
||||||
@@ -149,7 +152,7 @@ async def add_bookmark(
|
|||||||
user_key: str,
|
user_key: str,
|
||||||
bookmark: Bookmark,
|
bookmark: Bookmark,
|
||||||
strip_params: bool = False,
|
strip_params: bool = False,
|
||||||
):
|
) -> Bookmark:
|
||||||
"""Add new bookmark for user `user_key`."""
|
"""Add new bookmark for user `user_key`."""
|
||||||
bookmark.user_key = user_key
|
bookmark.user_key = user_key
|
||||||
|
|
||||||
@@ -171,7 +174,7 @@ async def update_bookmark(
|
|||||||
bookmark: Bookmark,
|
bookmark: Bookmark,
|
||||||
url_hash: str,
|
url_hash: str,
|
||||||
strip_params: bool = False,
|
strip_params: bool = False,
|
||||||
):
|
) -> Bookmark:
|
||||||
"""Update existing bookmark `bookmark_key` for user `user_key`."""
|
"""Update existing bookmark `bookmark_key` for user `user_key`."""
|
||||||
result = await session.exec(
|
result = await session.exec(
|
||||||
select(Bookmark).where(
|
select(Bookmark).where(
|
||||||
@@ -202,7 +205,7 @@ async def delete_bookmark(
|
|||||||
session,
|
session,
|
||||||
user_key: str,
|
user_key: str,
|
||||||
url_hash: str,
|
url_hash: str,
|
||||||
):
|
) -> None:
|
||||||
"""(Soft)Delete bookmark `bookmark_key` for user `user_key`."""
|
"""(Soft)Delete bookmark `bookmark_key` for user `user_key`."""
|
||||||
result = await session.get(Bookmark, {'url_hash': url_hash, 'user_key': user_key})
|
result = await session.get(Bookmark, {'url_hash': url_hash, 'user_key': user_key})
|
||||||
bookmark = result
|
bookmark = result
|
||||||
|
|||||||
@@ -202,7 +202,7 @@ async def autocomplete_bookmark(
|
|||||||
user_key: str,
|
user_key: str,
|
||||||
bookmark: Bookmark,
|
bookmark: Bookmark,
|
||||||
strip_params: bool = False,
|
strip_params: bool = False,
|
||||||
):
|
) -> Bookmark:
|
||||||
"""Autofill some fields for this (new) bookmark for user `user_key`."""
|
"""Autofill some fields for this (new) bookmark for user `user_key`."""
|
||||||
logger.info('Autocompleting bookmark %s for user %s', bookmark.url_hash, user_key)
|
logger.info('Autocompleting bookmark %s for user %s', bookmark.url_hash, user_key)
|
||||||
return await bookmarks_service.autocomplete_bookmark(session, request, user_key, bookmark, strip_params)
|
return await bookmarks_service.autocomplete_bookmark(session, request, user_key, bookmark, strip_params)
|
||||||
@@ -248,7 +248,7 @@ async def delete_bookmark(
|
|||||||
"""(Soft)Delete bookmark `bookmark_key` for user `user_key`."""
|
"""(Soft)Delete bookmark `bookmark_key` for user `user_key`."""
|
||||||
logger.info('Deleting bookmark %s for user %s', url_hash, user_key)
|
logger.info('Deleting bookmark %s for user %s', url_hash, user_key)
|
||||||
try:
|
try:
|
||||||
result = await bookmarks_service.delete_bookmark(session, user_key, url_hash)
|
_ = await bookmarks_service.delete_bookmark(session, user_key, url_hash)
|
||||||
return {'ok': True}
|
return {'ok': True}
|
||||||
except Exception:
|
except Exception:
|
||||||
logger.exception('Failed to delete bookmark %s', url_hash)
|
logger.exception('Failed to delete bookmark %s', url_hash)
|
||||||
@@ -310,7 +310,7 @@ async def page_user_landing(
|
|||||||
session: SessionDep,
|
session: SessionDep,
|
||||||
request: Request,
|
request: Request,
|
||||||
user_key: str,
|
user_key: str,
|
||||||
):
|
) -> HTMLResponse:
|
||||||
"""HTML page with the main view for the user."""
|
"""HTML page with the main view for the user."""
|
||||||
result = await session.exec(select(User).where(User.key == user_key))
|
result = await session.exec(select(User).where(User.key == user_key))
|
||||||
user = result.first()
|
user = result.first()
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
.thumbnail {
|
.thumbnail {
|
||||||
/*width: 80px;*/
|
/*width: 80px;*/
|
||||||
width: 66;
|
width: 66px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.thumbnail img {
|
.thumbnail img {
|
||||||
|
|||||||
Reference in New Issue
Block a user