Skip to content
Open
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
3 changes: 3 additions & 0 deletions .env-sample
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,9 @@ TMDB_READ_ACCESS_TOKEN= # Optional: Provide your own TMDB Read Access Token to a
# ============================== #
# UI Customization #
# ============================== #
CUSTOM_LOGO_URL=None
CUSTOM_ADDON_NAME=None
CUSTOM_DISCORD_URL=None
CUSTOM_HEADER_HTML=None

# ============================== #
Expand Down
20 changes: 17 additions & 3 deletions comet/api/endpoints/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,27 @@
description="Renders the configuration page with existing configuration.",
)
async def configure(request: Request):
html_keys = [
"CUSTOM_LOGO_URL",
"CUSTOM_ADDON_NAME",
"CUSTOM_DISCORD_URL",
"CUSTOM_HEADER_HTML",
]

def normalize(v):
if v is None:
return ""
if isinstance(v, str) and v.strip().lower() in ("none", "null"):
return ""
return v

html_context = {k: normalize(getattr(settings, k)) for k in html_keys}

response = templates.TemplateResponse(
"index.html",
{
"request": request,
"CUSTOM_HEADER_HTML": settings.CUSTOM_HEADER_HTML
if settings.CUSTOM_HEADER_HTML
else "",
**html_context,
"webConfig": web_config,
"proxyDebridStream": settings.PROXY_DEBRID_STREAM,
"disableTorrentStreams": settings.DISABLE_TORRENT_STREAMS,
Expand Down
3 changes: 3 additions & 0 deletions comet/core/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,9 @@ def get_urls_with_passwords(urls, passwords):
"COMET",
f"TMDB Read Access Token: {settings.TMDB_READ_ACCESS_TOKEN if settings.TMDB_READ_ACCESS_TOKEN else 'Shared'}",
)
logger.log("COMET", f"Custom Logo URL: {bool(settings.CUSTOM_LOGO_URL)}")
logger.log("COMET", f"Custom Addon Name: {bool(settings.CUSTOM_ADDON_NAME)}")
logger.log("COMET", f"Custom Discord URL: {bool(settings.CUSTOM_DISCORD_URL)}")
Comment on lines +446 to +448
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Logging always shows True due to non-None defaults.

These settings have hardcoded defaults in models.py (e.g., CUSTOM_ADDON_NAME = "Comet"), so bool(settings.CUSTOM_...) will always evaluate to True. This differs from CUSTOM_HEADER_HTML on line 449, which defaults to None and thus correctly shows False when unconfigured.

Consider checking whether the value differs from the default, or simply log the actual value (truncated if needed) for better operator visibility:

Suggested approach
-    logger.log("COMET", f"Custom Logo URL: {bool(settings.CUSTOM_LOGO_URL)}")
-    logger.log("COMET", f"Custom Addon Name: {bool(settings.CUSTOM_ADDON_NAME)}")
-    logger.log("COMET", f"Custom Discord URL: {bool(settings.CUSTOM_DISCORD_URL)}")
+    logger.log("COMET", f"Custom Logo URL: {settings.CUSTOM_LOGO_URL}")
+    logger.log("COMET", f"Custom Addon Name: {settings.CUSTOM_ADDON_NAME}")
+    logger.log("COMET", f"Custom Discord URL: {settings.CUSTOM_DISCORD_URL}")

Alternatively, define the defaults as constants and check settings.CUSTOM_LOGO_URL != DEFAULT_LOGO_URL etc.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
logger.log("COMET", f"Custom Logo URL: {bool(settings.CUSTOM_LOGO_URL)}")
logger.log("COMET", f"Custom Addon Name: {bool(settings.CUSTOM_ADDON_NAME)}")
logger.log("COMET", f"Custom Discord URL: {bool(settings.CUSTOM_DISCORD_URL)}")
logger.log("COMET", f"Custom Logo URL: {settings.CUSTOM_LOGO_URL}")
logger.log("COMET", f"Custom Addon Name: {settings.CUSTOM_ADDON_NAME}")
logger.log("COMET", f"Custom Discord URL: {settings.CUSTOM_DISCORD_URL}")
🤖 Prompt for AI Agents
In `@comet/core/logger.py` around lines 446 - 448, The current logger.log calls
(logger.log in comet/core/logger.py) use bool(settings.CUSTOM_LOGO_URL),
bool(settings.CUSTOM_ADDON_NAME), and bool(settings.CUSTOM_DISCORD_URL) which
always evaluate True because those settings have non-None defaults; change the
logging to either log the actual values (truncated if long) or compare against
the real defaults (e.g., DEFAULT_LOGO_URL / DEFAULT_ADDON_NAME constants) so the
log reflects whether the value differs from the default—update the three
logger.log calls to use settings.CUSTOM_... != DEFAULT_... or to log the actual
setting string and keep the existing CUSTOM_HEADER_HTML behavior for reference.

logger.log("COMET", f"Custom Header HTML: {bool(settings.CUSTOM_HEADER_HTML)}")

http_cache_info = (
Expand Down
3 changes: 3 additions & 0 deletions comet/core/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,9 @@ class AppSettings(BaseSettings):
TORBOX_API_KEY: Optional[str] = None
SCRAPE_TORRENTSDB: Union[bool, str] = False
SCRAPE_PEERFLIX: Union[bool, str] = False
CUSTOM_ADDON_NAME: Optional[str] = "Comet"
CUSTOM_LOGO_URL: Optional[str] = "https://fonts.gstatic.com/s/e/notoemoji/latest/1f4ab/512.gif"
CUSTOM_DISCORD_URL: Optional[str] = "https://discord.com/invite/UJEqpT42nb"
CUSTOM_HEADER_HTML: Optional[str] = None
PROXY_DEBRID_STREAM: Optional[bool] = False
PROXY_DEBRID_STREAM_PASSWORD: Optional[str] = "".join(
Expand Down
36 changes: 14 additions & 22 deletions comet/templates/index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!doctype html>
<!DOCTYPE html>
<html class="sl-theme-dark">
<head>
<meta charset="UTF-8" />
Expand Down Expand Up @@ -52,19 +52,9 @@
#25292c 0%,
#0c0d13 100%
);
font-family:
system-ui,
-apple-system,
"Segoe UI",
Roboto,
"Helvetica Neue",
"Noto Sans",
"Liberation Sans",
Arial,
sans-serif,
"Apple Color Emoji",
"Segoe UI Emoji",
"Segoe UI Symbol",
font-family: system-ui, -apple-system, "Segoe UI", Roboto,
"Helvetica Neue", "Noto Sans", "Liberation Sans", Arial, sans-serif,
"Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol",
"Noto Color Emoji";
font-size: 1rem;
font-weight: 400;
Expand Down Expand Up @@ -147,8 +137,7 @@
border-radius: 50%;
filter: drop-shadow(0 0 6px currentColor);
transform: translate3d(104em, 0, 0);
animation:
fall var(--fall-duration) var(--fall-delay) linear infinite,
animation: fall var(--fall-duration) var(--fall-delay) linear infinite,
tail-fade var(--tail-fade-duration) var(--fall-delay) ease-out
infinite;
}
Expand Down Expand Up @@ -367,7 +356,7 @@
star.style.setProperty("--top-offset", `${randomTopOffset}vh`);
star.style.setProperty(
"--star-tail-length",
`${randomTailLength}em`,
`${randomTailLength}em`
);
star.style.setProperty("--fall-duration", `${randomFallDuration}s`);
star.style.setProperty("--fall-delay", "0s");
Expand All @@ -393,15 +382,17 @@
class="comet-text"
style="margin: 0; display: flex; align-items: center; line-height: 1"
>
{% if CUSTOM_LOGO_URL %}
<img
class="emoji"
src="https://fonts.gstatic.com/s/e/notoemoji/latest/1f4ab/512.gif"
src="{{CUSTOM_LOGO_URL}}"
style="margin-right: 10px"
/>
Comet
{% endif %} {{CUSTOM_ADDON_NAME}}
</p>
{% if CUSTOM_DISCORD_URL %}
<sl-button
href="https://discord.com/invite/UJEqpT42nb"
href="{{CUSTOM_DISCORD_URL}}"
target="_blank"
size="small"
pill
Expand All @@ -415,6 +406,7 @@
></sl-icon>
Discord
</sl-button>
{% endif %}
</div>
{{CUSTOM_HEADER_HTML|safe}}
</div>
Expand Down Expand Up @@ -958,8 +950,8 @@
}

// resultFormat default is ["all"]
if (!settings.resultFormat ||
settings.resultFormat.length !== 1 ||
if (!settings.resultFormat ||
settings.resultFormat.length !== 1 ||
settings.resultFormat[0] !== "all") {
return false;
}
Expand Down