mirror of
https://git.selfprivacy.org/SelfPrivacy/selfprivacy-rest-api.git
synced 2025-01-23 17:26:46 +00:00
chore: Recover fixes destroyed by force push
Please don't do this again
This commit is contained in:
parent
63bcfa3077
commit
6340ad348c
|
@ -3,11 +3,10 @@
|
||||||
import base64
|
import base64
|
||||||
import typing
|
import typing
|
||||||
from typing import List
|
from typing import List
|
||||||
from os import path, mkdir, remove
|
from os import path, remove
|
||||||
from os import makedirs
|
from os import makedirs
|
||||||
from os import listdir
|
from os import listdir
|
||||||
from os.path import join
|
from os.path import join
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
from selfprivacy_api.services.bitwarden import Bitwarden
|
from selfprivacy_api.services.bitwarden import Bitwarden
|
||||||
from selfprivacy_api.services.forgejo import Forgejo
|
from selfprivacy_api.services.forgejo import Forgejo
|
||||||
|
@ -23,8 +22,8 @@ from selfprivacy_api.services.service import Service, ServiceDnsRecord
|
||||||
from selfprivacy_api.services.service import ServiceStatus
|
from selfprivacy_api.services.service import ServiceStatus
|
||||||
import selfprivacy_api.utils.network as network_utils
|
import selfprivacy_api.utils.network as network_utils
|
||||||
|
|
||||||
from selfprivacy_api.services.test_service.icon import BITWARDEN_ICON
|
from selfprivacy_api.services.api_icon import API_ICON
|
||||||
from selfprivacy_api.utils import USERDATA_FILE, DKIM_DIR, SECRETS_FILE
|
from selfprivacy_api.utils import USERDATA_FILE, DKIM_DIR, SECRETS_FILE, get_domain
|
||||||
from selfprivacy_api.utils.block_devices import BlockDevices
|
from selfprivacy_api.utils.block_devices import BlockDevices
|
||||||
from shutil import copyfile, copytree, rmtree
|
from shutil import copyfile, copytree, rmtree
|
||||||
|
|
||||||
|
@ -105,17 +104,18 @@ class ServiceManager(Service):
|
||||||
def get_svg_icon() -> str:
|
def get_svg_icon() -> str:
|
||||||
"""Read SVG icon from file and return it as base64 encoded string."""
|
"""Read SVG icon from file and return it as base64 encoded string."""
|
||||||
# return ""
|
# return ""
|
||||||
return base64.b64encode(BITWARDEN_ICON.encode("utf-8")).decode("utf-8")
|
return base64.b64encode(API_ICON.encode("utf-8")).decode("utf-8")
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_url() -> typing.Optional[str]:
|
def get_url() -> typing.Optional[str]:
|
||||||
"""Return service url."""
|
"""Return service url."""
|
||||||
# TODO : placeholder, get actual domain here
|
domain = get_domain()
|
||||||
return f"https://domain"
|
subdomain = ServiceManager.get_subdomain()
|
||||||
|
return f"https://{subdomain}.{domain}" if subdomain else None
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_subdomain() -> typing.Optional[str]:
|
def get_subdomain() -> typing.Optional[str]:
|
||||||
return None
|
return "api"
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def is_always_active() -> bool:
|
def is_always_active() -> bool:
|
||||||
|
|
5
selfprivacy_api/services/api_icon.py
Normal file
5
selfprivacy_api/services/api_icon.py
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
API_ICON = """
|
||||||
|
<svg width="33" height="33" viewBox="0 0 33 33" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M0.98671 4.79425C0.98671 2.58511 2.77757 0.79425 4.98671 0.79425H28.9867C31.1958 0.79425 32.9867 2.58511 32.9867 4.79425V28.7943C32.9867 31.0034 31.1958 32.7943 28.9867 32.7943H4.98671C2.77757 32.7943 0.98671 31.0034 0.98671 28.7943V4.79425ZM26.9867 21.1483L24.734 18.8956V18.8198H24.6582L22.5047 16.6674V18.8198H11.358V23.2785H22.5047V25.6315L26.9867 21.1483ZM9.23944 10.1584H9.26842L11.4688 7.95697V10.1584H22.6154V14.6171H11.4688V16.9233L6.98671 12.439L9.23944 10.1863V10.1584Z" fill="black"/>
|
||||||
|
</svg>
|
||||||
|
"""
|
|
@ -427,7 +427,7 @@ class Service(ABC):
|
||||||
Jobs.update(
|
Jobs.update(
|
||||||
job=job,
|
job=job,
|
||||||
status=JobStatus.FINISHED,
|
status=JobStatus.FINISHED,
|
||||||
result=f"{service_name} moved successfully(no folders).",
|
result=f"{service_name} moved successfully (no folders).",
|
||||||
status_text=f"NOT starting {service_name}",
|
status_text=f"NOT starting {service_name}",
|
||||||
progress=100,
|
progress=100,
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue