Skip to content

Commit 9ed1a3f

Browse files
chore: add url/externalUrl & bingeGroup for info cards (v1.1.10)
1 parent 624b32d commit 9ed1a3f

File tree

3 files changed

+58
-89
lines changed

3 files changed

+58
-89
lines changed

index.js

Lines changed: 55 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -624,16 +624,15 @@ async function pDebridLink({
624624
}
625625
}
626626

627-
// --------------------------- Status + Rendering -----------------------------
627+
// --------------------------- Rendering -------------------------------------
628628
function statusInfo(days) {
629629
if (days <= 0) return { mark: "🔴 Status: Expired", bucket: QUOTES_EXPIRED };
630630
if (days <= 3) return { mark: "🟠 Status: Critical", bucket: QUOTES_CRIT };
631631
if (days <= 14) return { mark: "🟡 Status: Warning", bucket: QUOTES_WARN };
632632
return { mark: "🟢 Status: OK", bucket: QUOTES_OK };
633633
}
634634

635-
// platform ∈ "android-tv" | "tizen" | "desktop" | "mobile" | "unknown"
636-
function renderProviderCard(r, { platform = "unknown" } = {}) {
635+
function renderProviderCard(r) {
637636
const service = r.name;
638637
const user = r?.username ? `@${String(r.username)}` : "—";
639638
const days =
@@ -654,34 +653,19 @@ function renderProviderCard(r, { platform = "unknown" } = {}) {
654653
else if (mark.startsWith("🔴")) titlePrefix = "🔴 Expired";
655654

656655
const title = `${titlePrefix}${service}`;
657-
const isTv = platform === "android-tv" || platform === "tizen";
658-
659-
let description;
660-
661-
if (isTv) {
662-
// Super compact for TV clients (Android TV / Tizen)
663-
// Aim: 1–3 short lines, ~200 chars max
664-
const core =
665-
`Service: ${service}\n` +
666-
`User: ${user}\n` +
667-
`Until: ${dateStr}${numericDays}D\n` +
668-
`${mark}${quote}`;
669-
description = core.slice(0, 220); // hard cap
670-
} else {
671-
// Full rich card for desktop / mobile
672-
description = [
673-
LINE,
674-
`🤝 Service: ${service}`,
675-
`👤 ${user}`,
676-
`⭐ Premium until: ${dateStr}`,
677-
`⏳ Days remaining: ${days} D`,
678-
`${mark}`,
679-
`💬 ${quote}`,
680-
LINE
681-
].join("\n");
682-
}
683656

684-
return { title, description };
657+
const lines = [
658+
LINE,
659+
`🤝 Service: ${service}`,
660+
`👤 ${user}`,
661+
`⭐ Premium until: ${dateStr}`,
662+
`⏳ Days remaining: ${days} D`,
663+
`${mark}`,
664+
`💬 ${quote}`,
665+
LINE
666+
].join("\n");
667+
668+
return { title, description: lines };
685669
}
686670

687671
// --------------------------- External URL Builder ---------------------------
@@ -725,49 +709,20 @@ function buildExternalUrl(result, tokens) {
725709
}
726710
}
727711

728-
// --------------------------- Platform Detection -----------------------------
729-
function detectPlatform(args = {}, req = null) {
730-
// Prefer explicit header sent by some Stremio clients
731-
const extra = args.extra || {};
732-
const extraHeaders = extra.headers || {};
733-
734-
const headers = (req && req.headers) || extraHeaders || {};
735-
const stremioPlatform = headers["stremio-platform"];
736-
737-
if (stremioPlatform && typeof stremioPlatform === "string") {
738-
return stremioPlatform.toLowerCase();
739-
}
740-
741-
const uaRaw =
742-
headers["stremio-user-agent"] ||
743-
headers["user-agent"] ||
744-
extra.userAgent ||
745-
"";
746-
const ua = String(uaRaw).toLowerCase();
747-
748-
if (!ua) return "unknown";
749-
750-
if (ua.includes("tizen")) return "tizen";
751-
if (ua.includes("android tv") || ua.includes("androidtv") || ua.includes("bravia"))
752-
return "android-tv";
753-
if (ua.includes("mobile") || ua.includes("phone") || ua.includes("android"))
754-
return "mobile";
755-
if (ua.includes("windows") || ua.includes("macintosh") || ua.includes("linux"))
756-
return "desktop";
757-
758-
return "unknown";
759-
}
760-
761712
// --------------------------- Manifest & Config ------------------------------
762-
// v1.1.9platform-aware descriptions; compact on Android TV / Tizen
713+
// v1.1.10no stream.type (for stricter clients), url+externalUrl
763714
const manifest = {
764715
id: "a1337user.statusio.multi.simple",
765-
version: "1.1.9",
716+
version: "1.1.10",
766717
name: "Statusio",
767718
description:
768719
"Shows premium status & days remaining across multiple debrid providers.",
769720
resources: [
770-
{ name: "stream", types: ["movie", "series"], idPrefixes: ["tt"] }
721+
{
722+
name: "stream",
723+
types: ["movie", "series"],
724+
idPrefixes: ["tt"]
725+
}
771726
],
772727
types: ["movie", "series"],
773728
idPrefixes: ["tt"],
@@ -814,18 +769,11 @@ const manifest = {
814769
const builder = new addonBuilder(manifest);
815770

816771
// ---------------------------- Stream Handler -------------------------------
817-
builder.defineStreamHandler(async (args, req) => {
772+
builder.defineStreamHandler(async (args) => {
773+
// Quick filter: we only target Cinemeta items with tt IDs
818774
const reqType = String(args?.type || "");
819775
const reqId = String(args?.id || "");
820-
const platform = detectPlatform(args, req);
821-
822-
console.log("[Statusio] stream request:", {
823-
type: reqType,
824-
id: reqId,
825-
platform
826-
});
827-
828-
// Only Cinemeta items with tt IDs
776+
console.log("[Statusio] stream request:", { type: reqType, id: reqId });
829777
if (!reqId || !reqId.startsWith("tt")) {
830778
return { streams: [] };
831779
}
@@ -870,7 +818,6 @@ builder.defineStreamHandler(async (args, req) => {
870818
console.log("[Statusio enabled]", enabled);
871819

872820
const cacheKey = [
873-
platform,
874821
Object.entries(enabled)
875822
.filter(([, v]) => v)
876823
.map(([k]) => k)
@@ -920,14 +867,21 @@ builder.defineStreamHandler(async (args, req) => {
920867
String(e.message || e),
921868
LINE
922869
].join("\n");
870+
871+
const fallbackLink = STATUS_BASE_URL;
872+
923873
return {
924874
streams: [
925875
{
926876
name: "🔐 Statusio",
927877
title: "⚠️ Status unavailable",
928878
description: lines,
929-
behaviorHints: { notWebReady: true },
930-
externalUrl: "about:blank"
879+
url: fallbackLink,
880+
externalUrl: fallbackLink,
881+
behaviorHints: {
882+
notWebReady: true,
883+
bingeGroup: "statusio-info"
884+
}
931885
}
932886
],
933887
cacheMaxAge: 60
@@ -937,18 +891,25 @@ builder.defineStreamHandler(async (args, req) => {
937891

938892
const streams = [];
939893
for (const r of results) {
940-
const card = renderProviderCard(r, { platform });
894+
const card = renderProviderCard(r);
895+
const link = buildExternalUrl(r, tokens);
896+
941897
streams.push({
942898
name: "🔐 Statusio",
943899
title: card.title,
944900
description: card.description,
945-
behaviorHints: { notWebReady: true }, // info-only card hint
946-
externalUrl: buildExternalUrl(r, tokens)
901+
url: link,
902+
externalUrl: link,
903+
behaviorHints: {
904+
notWebReady: true,
905+
bingeGroup: "statusio-info"
906+
}
947907
});
948908
}
949909

950910
if (streams.length === 0) {
951911
const hasAnyCfg = Object.keys(cfg).length > 0;
912+
const fallbackLink = STATUS_BASE_URL;
952913

953914
if (!hasAnyCfg) {
954915
streams.push({
@@ -964,8 +925,12 @@ builder.defineStreamHandler(async (args, req) => {
964925
"• Debrid-Link (dl_key)",
965926
LINE
966927
].join("\n"),
967-
behaviorHints: { notWebReady: true },
968-
externalUrl: "about:blank"
928+
url: fallbackLink,
929+
externalUrl: fallbackLink,
930+
behaviorHints: {
931+
notWebReady: true,
932+
bingeGroup: "statusio-info"
933+
}
969934
});
970935
} else {
971936
streams.push({
@@ -984,8 +949,12 @@ builder.defineStreamHandler(async (args, req) => {
984949
"Check that your tokens are valid and saved in Configure.",
985950
LINE
986951
].join("\n"),
987-
behaviorHints: { notWebReady: true },
988-
externalUrl: "about:blank"
952+
url: fallbackLink,
953+
externalUrl: fallbackLink,
954+
behaviorHints: {
955+
notWebReady: true,
956+
bingeGroup: "statusio-info"
957+
}
989958
});
990959
}
991960
}

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "statusio",
3-
"version": "1.1.9",
3+
"version": "1.1.10",
44
"description": "Statusio • Stremio Debrid Status Addon",
55
"type": "module",
66
"main": "index.js",

0 commit comments

Comments
 (0)