aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAjay <[email protected]>2024-09-06 02:45:32 -0400
committerAjay <[email protected]>2024-09-06 02:45:32 -0400
commite7eeee1b9de24d2a6daa2933b58a85cdf9ea68f3 (patch)
tree1e98b1b494b992c1c1d5336b55343628612914f9
parentc0a579e84b532cd53accb04a47094cca432e568c (diff)
downloadSponsorBlock-e7eeee1b9de24d2a6daa2933b58a85cdf9ea68f3.tar.gz
SponsorBlock-e7eeee1b9de24d2a6daa2933b58a85cdf9ea68f3.zip
Fix invidious CI
-rw-r--r--ci/invidiousCI.ts16
-rw-r--r--ci/invidiousType.ts45
2 files changed, 11 insertions, 50 deletions
diff --git a/ci/invidiousCI.ts b/ci/invidiousCI.ts
index d27a3a4e..0782288d 100644
--- a/ci/invidiousCI.ts
+++ b/ci/invidiousCI.ts
@@ -3,25 +3,21 @@ import { InvidiousInstance, instanceMap } from "./invidiousType"
import * as data from "../ci/invidious_instances.json";
// only https servers
-const mapped: instanceMap = data
- .filter((i: InvidiousInstance) => i[1]?.type === "https")
- .map((instance: InvidiousInstance) => {
+const mapped: instanceMap = (data as InvidiousInstance[])
+ .filter((i) => i[1]?.type === "https")
+ .map((instance) => {
return {
name: instance[0],
url: instance[1].uri,
- dailyRatios: instance[1].monitor.dailyRatios,
- thirtyDayUptime: instance[1]?.monitor["30dRatio"].ratio,
+ uptime: instance[1].monitor?.uptime || 0,
+ down: instance[1].monitor?.down ?? false
}
});
// reliability and sanity checks
const reliableCheck = mapped
.filter(instance => {
- // 30d uptime >= 90%
- const thirtyDayUptime = Number(instance.thirtyDayUptime) >= 90;
- // available for at least 80/90 days
- const dailyRatioCheck = instance.dailyRatios.filter(status => status.label !== "black");
- return thirtyDayUptime && dailyRatioCheck.length >= 80;
+ return instance.uptime > 80 && !instance.down;
})
// url includes name
.filter(instance => instance.url.includes(instance.name));
diff --git a/ci/invidiousType.ts b/ci/invidiousType.ts
index e5f682bb..eab05240 100644
--- a/ci/invidiousType.ts
+++ b/ci/invidiousType.ts
@@ -1,54 +1,19 @@
-type ratio = {
- ratio: string;
- label: string;
-}
export type instanceMap = {
name: string;
url: string;
- dailyRatios: {ratio: string; label: string }[];
- thirtyDayUptime: string;
+ uptime: number;
+ down: boolean;
}[]
export type InvidiousInstance = [
string,
{
- flag: string;
- region: string;
- stats: null | {
- version: string;
- software: {
- name: string;
- version: string;
- branch: string;
- };
- openRegistrations: boolean;
- usage: {
- users: {
- total: number;
- activeHalfyear: number;
- activeMonth: number;
- };
- };
- metadata: {
- updatedAt: number;
- lastChannelRefreshedAt: number;
- };
- };
- cors: boolean | null;
- api: boolean | null;
- type: "https" | "http" | "onion" | "i2p";
uri: string;
+ type: "https" | "http" | "onion" | "i2p";
monitor: null | {
- monitorId: number;
- createdAt: number;
- statusClass: string;
- name: string;
- url: string | null;
- type: "HTTP(s)";
- dailyRatios: ratio[];
- "90dRatio": ratio;
- "30dRatio": ratio;
+ uptime: number;
+ down: boolean;
};
}
] \ No newline at end of file