mirror of
https://git.selfprivacy.org/SelfPrivacy/selfprivacy-rest-api.git
synced 2025-01-30 20:56:39 +00:00
Merge branch 'master' into def/add_users_repositories
This commit is contained in:
commit
6fa8adca7c
|
@ -49,12 +49,13 @@ in
|
|||
pkgs.kanidm
|
||||
];
|
||||
after = [ "network-online.target" ];
|
||||
wantedBy = [ "network-online.target" ];
|
||||
wants = [ "network-online.target" ];
|
||||
serviceConfig = {
|
||||
User = "root";
|
||||
ExecStart = "${selfprivacy-graphql-api}/bin/app.py";
|
||||
Restart = "always";
|
||||
RestartSec = "5";
|
||||
Slice = "selfprivacy_api.slice";
|
||||
};
|
||||
};
|
||||
systemd.services.selfprivacy-api-worker = {
|
||||
|
@ -82,14 +83,19 @@ in
|
|||
pkgs.iproute2
|
||||
];
|
||||
after = [ "network-online.target" ];
|
||||
wantedBy = [ "network-online.target" ];
|
||||
wants = [ "network-online.target" ];
|
||||
serviceConfig = {
|
||||
User = "root";
|
||||
ExecStart = "${pkgs.python312Packages.huey}/bin/huey_consumer.py selfprivacy_api.task_registry.huey";
|
||||
Restart = "always";
|
||||
RestartSec = "5";
|
||||
Slice = "selfprivacy_api.slice";
|
||||
};
|
||||
};
|
||||
systemd.slices."selfprivacy_api" = {
|
||||
name = "selfprivacy_api.slice";
|
||||
description = "Slice for SelfPrivacy API services";
|
||||
};
|
||||
# One shot systemd service to rebuild NixOS using nixos-rebuild
|
||||
systemd.services.sp-nixos-rebuild = {
|
||||
description = "nixos-rebuild switch";
|
||||
|
|
|
@ -27,4 +27,4 @@ async def get_token_header(
|
|||
|
||||
def get_api_version() -> str:
|
||||
"""Get API version"""
|
||||
return "3.3.0"
|
||||
return "3.4.0"
|
||||
|
|
|
@ -21,11 +21,17 @@ async def log_stream() -> AsyncGenerator[LogEntry, None]:
|
|||
|
||||
asyncio.get_event_loop().add_reader(j, lambda: asyncio.ensure_future(callback()))
|
||||
|
||||
while True:
|
||||
entry = await queue.get()
|
||||
try:
|
||||
yield LogEntry(entry)
|
||||
except Exception:
|
||||
asyncio.get_event_loop().remove_reader(j)
|
||||
return
|
||||
queue.task_done()
|
||||
try:
|
||||
while True:
|
||||
entry = await queue.get()
|
||||
try:
|
||||
yield LogEntry(entry)
|
||||
except Exception:
|
||||
asyncio.get_event_loop().remove_reader(j)
|
||||
j.close()
|
||||
return
|
||||
queue.task_done()
|
||||
except asyncio.CancelledError:
|
||||
asyncio.get_event_loop().remove_reader(j)
|
||||
j.close()
|
||||
return
|
||||
|
|
|
@ -88,7 +88,7 @@ class ServiceManager(Service):
|
|||
@staticmethod
|
||||
def get_id() -> str:
|
||||
"""Return service id."""
|
||||
return "api"
|
||||
return "selfprivacy-api"
|
||||
|
||||
@staticmethod
|
||||
def get_display_name() -> str:
|
||||
|
@ -98,7 +98,7 @@ class ServiceManager(Service):
|
|||
@staticmethod
|
||||
def get_description() -> str:
|
||||
"""Return service description."""
|
||||
return "A proto-service for API itself. Currently manages backups of settings."
|
||||
return "Enables communication between the SelfPrivacy app and the server."
|
||||
|
||||
@staticmethod
|
||||
def get_svg_icon() -> str:
|
||||
|
@ -135,7 +135,7 @@ class ServiceManager(Service):
|
|||
|
||||
@staticmethod
|
||||
def get_backup_description() -> str:
|
||||
return "How did we get here?"
|
||||
return "General server settings."
|
||||
|
||||
@classmethod
|
||||
def get_status(cls) -> ServiceStatus:
|
||||
|
|
|
@ -10,6 +10,7 @@ from selfprivacy_api.services.service import Service, ServiceStatus
|
|||
from selfprivacy_api.services.nextcloud.icon import NEXTCLOUD_ICON
|
||||
from selfprivacy_api.services.config_item import (
|
||||
StringServiceConfigItem,
|
||||
BoolServiceConfigItem,
|
||||
ServiceConfigItem,
|
||||
)
|
||||
from selfprivacy_api.utils.regex_strings import SUBDOMAIN_REGEX
|
||||
|
@ -26,6 +27,11 @@ class Nextcloud(Service):
|
|||
regex=SUBDOMAIN_REGEX,
|
||||
widget="subdomain",
|
||||
),
|
||||
"enableImagemagick": BoolServiceConfigItem(
|
||||
id="enableImagemagick",
|
||||
default_value=True,
|
||||
description="Enable ImageMagick",
|
||||
),
|
||||
}
|
||||
|
||||
@staticmethod
|
||||
|
|
|
@ -42,6 +42,8 @@ def get_paginated_logs(
|
|||
events = get_events_from_journal(j, limit, lambda j: j.get_previous())
|
||||
events.reverse()
|
||||
|
||||
j.close()
|
||||
|
||||
return events
|
||||
elif up_cursor is None and down_cursor is not None:
|
||||
j.seek_cursor(down_cursor)
|
||||
|
@ -50,6 +52,8 @@ def get_paginated_logs(
|
|||
events = get_events_from_journal(j, limit, lambda j: j.get_previous())
|
||||
events.reverse()
|
||||
|
||||
j.close()
|
||||
|
||||
return events
|
||||
elif up_cursor is not None and down_cursor is None:
|
||||
j.seek_cursor(up_cursor)
|
||||
|
@ -57,8 +61,12 @@ def get_paginated_logs(
|
|||
|
||||
events = get_events_from_journal(j, limit, lambda j: j.get_next())
|
||||
|
||||
j.close()
|
||||
|
||||
return events
|
||||
else:
|
||||
j.close()
|
||||
|
||||
raise NotImplementedError(
|
||||
"Pagination by both up_cursor and down_cursor is not implemented"
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue