Skip to content

Commit 8d118c9

Browse files
committed
fix: default config + prevent old configs
1 parent 5b17dc6 commit 8d118c9

File tree

4 files changed

+32
-10
lines changed

4 files changed

+32
-10
lines changed

comet/api/core.py

+13-6
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,9 @@ async def configure(request: Request):
4545

4646
@main.get("/manifest.json")
4747
@main.get("/{b64config}/manifest.json")
48-
async def manifest(b64config: str = None):
49-
config = config_check(b64config)
50-
debrid_extension = get_debrid_extension(config["debridService"])
51-
52-
return {
48+
async def manifest(request: Request, b64config: str = None):
49+
base_manifest = {
5350
"id": f"{settings.ADDON_ID}.{''.join(random.choice(string.ascii_letters) for _ in range(4))}",
54-
"name": f"{settings.ADDON_NAME}{(' | ' + debrid_extension) if debrid_extension is not None else ''}",
5551
"description": "Stremio's fastest torrent/debrid search add-on.",
5652
"version": "1.0.0",
5753
"catalogs": [],
@@ -68,6 +64,17 @@ async def manifest(b64config: str = None):
6864
"behaviorHints": {"configurable": True, "configurationRequired": False},
6965
}
7066

67+
config = config_check(b64config)
68+
if not config:
69+
base_manifest["name"] = "❌ | Comet"
70+
base_manifest["description"] = f"⚠️ OBSOLETE CONFIGURATION, PLEASE RE-CONFIGURE ON {request.url.scheme}://{request.url.netloc} ⚠️"
71+
return base_manifest
72+
73+
debrid_extension = get_debrid_extension(config["debridService"])
74+
base_manifest["name"] = f"{settings.ADDON_NAME}{(' | ' + debrid_extension) if debrid_extension is not None else ''}"
75+
76+
return base_manifest
77+
7178

7279
class CustomORJSONResponse(Response):
7380
media_type = "application/json"

comet/api/stream.py

+13-2
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,17 @@ async def stream(
6969
b64config: str = None,
7070
):
7171
config = config_check(b64config)
72+
if not config:
73+
return {
74+
"streams": [
75+
{
76+
"name": "[❌] Comet",
77+
"description": f"⚠️ OBSOLETE CONFIGURATION, PLEASE RE-CONFIGURE ON {request.url.scheme}://{request.url.netloc} ⚠️",
78+
"url": "https://comet.fast",
79+
}
80+
]
81+
}
82+
7283

7384
ongoing_search = await database.fetch_one(
7485
"SELECT timestamp FROM ongoing_searches WHERE media_id = :media_id",
@@ -304,8 +315,8 @@ async def playback(
304315
episode: str,
305316
):
306317
config = config_check(b64config)
307-
if not config:
308-
return FileResponse("comet/assets/invalidconfig.mp4")
318+
# if not config:
319+
# return FileResponse("comet/assets/invalidconfig.mp4")
309320

310321
season = int(season) if season != "n" else None
311322
episode = int(episode) if episode != "n" else None

comet/utils/general.py

+4
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@
1616
def config_check(b64config: str):
1717
try:
1818
config = orjson.loads(base64.b64decode(b64config).decode())
19+
20+
if "indexers" in config:
21+
return False
22+
1923
validated_config = ConfigModel(**config)
2024
validated_config = validated_config.model_dump()
2125

comet/utils/models.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -577,8 +577,8 @@ def check_debrid_service(cls, v):
577577

578578

579579
default_config = ConfigModel().model_dump()
580-
# default_config["rtnSettings"] = SettingsModel(**default_config["rtnSettings"])
581-
# default_config["rtnRanking"] = BestRanking(**default_config["rtnRanking"])
580+
default_config["rtnSettings"] = rtn_settings_default
581+
default_config["rtnRanking"] = rtn_ranking_default
582582

583583

584584
# Web Config Initialization

0 commit comments

Comments
 (0)