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

homarr: use v2 #1036

Merged
merged 4 commits into from
Nov 27, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
add lib
  • Loading branch information
stavros-k committed Nov 27, 2024
commit c76322fb182f4c12e7db167822c9ecf28ca7ed56
37 changes: 18 additions & 19 deletions ix-dev/community/homarr/app.yaml
Original file line number Diff line number Diff line change
@@ -1,35 +1,34 @@
app_version: 0.15.7
capabilities: []
categories:
- productivity
description:
Homarr is a sleek, modern dashboard that puts all of your apps and services
- productivity
description: Homarr is a sleek, modern dashboard that puts all of your apps and services
at your fingertips.
home: https://homarr.dev/
host_mounts: []
icon: https://media.sys.truenas.net/apps/homarr/icons/icon.svg
keywords:
- dashboard
lib_version: 2.0.21
lib_version_hash: d05e43e25b7dc1736be6cc1efa4b9255368aa346e3e7a4350a38440f29b73186
- dashboard
lib_version: 2.0.22
lib_version_hash: a5314152df87f4b7a76f4fa3a2923e4508d82b530ac48f033466114befe2db3b
maintainers:
- email: [email protected]
name: truenas
url: https://www.truenas.com/
- email: [email protected]
name: truenas
url: https://www.truenas.com/
name: homarr
run_as_context:
- description: Homarr runs as any non-root user.
gid: 568
group_name: homarr
uid: 568
user_name: homarr
- description: Homarr runs as any non-root user.
gid: 568
group_name: homarr
uid: 568
user_name: homarr
screenshots:
- https://media.sys.truenas.net/apps/homarr/screenshots/screenshot1.png
- https://media.sys.truenas.net/apps/homarr/screenshots/screenshot2.png
- https://media.sys.truenas.net/apps/homarr/screenshots/screenshot3.png
- https://media.sys.truenas.net/apps/homarr/screenshots/screenshot1.png
- https://media.sys.truenas.net/apps/homarr/screenshots/screenshot2.png
- https://media.sys.truenas.net/apps/homarr/screenshots/screenshot3.png
sources:
- https://homarr.dev/
- https://github.com/ajnart/homarr
- https://homarr.dev/
- https://github.com/ajnart/homarr
title: Homarr
train: community
version: 1.1.0
Empty file.
86 changes: 86 additions & 0 deletions ix-dev/community/homarr/templates/library/base_v2_0_22/configs.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
from typing import TYPE_CHECKING

if TYPE_CHECKING:
from render import Render

try:
from .error import RenderError
from .formatter import escape_dollar
from .validations import valid_octal_mode_or_raise, valid_fs_path_or_raise
except ImportError:
from error import RenderError
from formatter import escape_dollar
from validations import valid_octal_mode_or_raise, valid_fs_path_or_raise


class Configs:
def __init__(self, render_instance: "Render"):
self._render_instance = render_instance
self._configs: dict[str, dict] = {}

def add(self, name: str, data: str):
if not isinstance(data, str):
raise RenderError(f"Expected [data] to be a string, got [{type(data)}]")

if name not in self._configs:
self._configs[name] = {"name": name, "data": data}
return

if data == self._configs[name]["data"]:
return

raise RenderError(f"Config [{name}] already added with different data")

def has_configs(self):
return bool(self._configs)

def render(self):
return {
c["name"]: {"content": escape_dollar(c["data"])}
for c in sorted(self._configs.values(), key=lambda c: c["name"])
}


class ContainerConfigs:
def __init__(self, render_instance: "Render", configs: Configs):
self._render_instance = render_instance
self.top_level_configs: Configs = configs
self.container_configs: set[ContainerConfig] = set()

def add(self, name: str, data: str, target: str, mode: str = ""):
self.top_level_configs.add(name, data)

if target == "":
raise RenderError(f"Expected [target] to be set for config [{name}]")
if mode != "":
mode = valid_octal_mode_or_raise(mode)

if target in [c.target for c in self.container_configs]:
raise RenderError(f"Target [{target}] already used for another config")
target = valid_fs_path_or_raise(target)
self.container_configs.add(ContainerConfig(self._render_instance, name, target, mode))

def has_configs(self):
return bool(self.container_configs)

def render(self):
return [c.render() for c in sorted(self.container_configs, key=lambda c: c.source)]


class ContainerConfig:
def __init__(self, render_instance: "Render", source: str, target: str, mode: str):
self._render_instance = render_instance
self.source = source
self.target = target
self.mode = mode

def render(self):
result: dict[str, str | int] = {
"source": self.source,
"target": self.target,
}

if self.mode:
result["mode"] = int(self.mode, 8)

return result
Loading