forked from jordanlambrecht/tracker-tracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtracker-registry.ts
More file actions
90 lines (80 loc) · 2.23 KB
/
tracker-registry.ts
File metadata and controls
90 lines (80 loc) · 2.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
// src/data/tracker-registry.ts
import type { PlatformType } from "@/lib/adapters/constants"
import type { GazelleAuthStyle, Unit3dAuthStyle } from "@/lib/adapters/types"
import { normalizeUrl } from "@/lib/data-transforms"
import { ALL_TRACKERS } from "./trackers"
export interface ReleaseGroup {
name: string
description?: string
}
export type RankPerkType =
| "download-slots"
| "upload"
| "invite"
| "freeleech"
| "double-upload"
| "hnr-immune"
| "mod-bypass"
| "custom"
export interface RankPerk {
type: RankPerkType
label: string
}
export interface TrackerUserClass {
name: string
requirements?: string
perks?: RankPerk[]
icon?: string
}
export interface TrackerRules {
minimumRatio: number // 0 = no minimum
seedTimeHours: number // 0 = no minimum
loginIntervalDays: number // days until prune/disable
fulfillmentPeriodHours?: number // null = not applicable
hnrBanLimit?: number // null = not applicable
fullRulesMarkdown?: string[]
}
export interface TrackerRegistryEntry {
slug: string
name: string
abbreviation?: string
url: string
description: string
platform: PlatformType
apiPath: string
specialty: string
contentCategories: string[]
userClasses: TrackerUserClass[]
releaseGroups: (string | ReleaseGroup)[]
notableMembers: string[]
bannedGroups?: string[]
stats?: {
userCount?: number
activeUsers?: number
torrentCount?: number
seedSize?: string
statsUpdatedAt?: string
}
rules?: TrackerRules
language?: string
color: string
logo?: string
trackerHubSlug?: string
statusPageUrl?: string
draft?: boolean
warning?: boolean
warningNote?: string
supportsTransitPapers?: boolean
profileUrlPattern?: string
gazelleAuthStyle?: GazelleAuthStyle
gazelleEnrich?: boolean
unit3dAuthStyle?: Unit3dAuthStyle
}
export const TRACKER_REGISTRY: TrackerRegistryEntry[] = ALL_TRACKERS.filter((t) => !t.draft)
export function getTrackerBySlug(slug: string): TrackerRegistryEntry | undefined {
return TRACKER_REGISTRY.find((t) => t.slug === slug)
}
export function findRegistryEntry(baseUrl: string): TrackerRegistryEntry | undefined {
const normalized = normalizeUrl(baseUrl)
return TRACKER_REGISTRY.find((r) => normalizeUrl(r.url) === normalized)
}