Move hardcoded stuff to db (#728)

* Move download count offset and first release date override

No longer hardcoded

* Add CR offset and override

because fork

* Move repo variations from website to db

* convert to url

* Doesn't require update
This commit is contained in:
Noah Pilarski 2023-06-30 15:27:10 -04:00 committed by GitHub
parent aede0a099c
commit 2c25441e4a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 156 additions and 61 deletions

160
mods.json
View File

@ -20,7 +20,10 @@
"gameplay", "gameplay",
"integration" "integration"
], ],
"uniqueName": "Raicuparta.NomaiVR" "uniqueName": "Raicuparta.NomaiVR",
"repoVariations": [
"Raicuparta/NomaiVR"
]
}, },
{ {
"name": "Quantum Space Buddies", "name": "Quantum Space Buddies",
@ -30,7 +33,10 @@
"integration" "integration"
], ],
"uniqueName": "Raicuparta.QuantumSpaceBuddies", "uniqueName": "Raicuparta.QuantumSpaceBuddies",
"authorDisplay": "_nebula, JohnCorby, and friends" "authorDisplay": "_nebula, JohnCorby, and friends",
"repoVariations": [
"Raicuparta/quantum-space-buddies"
]
}, },
{ {
"name": "Light Bramble", "name": "Light Bramble",
@ -170,7 +176,9 @@
], ],
"uniqueName": "PacificEngine.OW_CommonResources", "uniqueName": "PacificEngine.OW_CommonResources",
"utility": true, "utility": true,
"authorDisplay": "PacificEngine" "authorDisplay": "PacificEngine",
"downloadCountOffset": 8555,
"firstReleaseDateOverride": "2021-11-04T17:05:47Z"
}, },
{ {
"name": "No Alt Tab Pause", "name": "No Alt Tab Pause",
@ -289,7 +297,10 @@
"content", "content",
"story" "story"
], ],
"uniqueName": "xen.NewHorizons" "uniqueName": "xen.NewHorizons",
"repoVariations": [
"xen-42/outer-wilds-new-horizons"
]
}, },
{ {
"authorDisplay": "xen", "authorDisplay": "xen",
@ -299,7 +310,10 @@
"tags": [ "tags": [
"content" "content"
], ],
"uniqueName": "xen.NewHorizonsExamples" "uniqueName": "xen.NewHorizonsExamples",
"repoVariations": [
"xen-42/ow-new-horizons-examples"
]
}, },
{ {
"name": "Real Solar System", "name": "Real Solar System",
@ -352,7 +366,9 @@
"tags": [ "tags": [
"content" "content"
], ],
"uniqueName": "Jammer.OuterWildsGalaxy" "uniqueName": "Jammer.OuterWildsGalaxy",
"downloadCountOffset": 4828,
"firstReleaseDateOverride": "2021-12-31T23:31:02Z"
}, },
{ {
"name": "Signals+", "name": "Signals+",
@ -464,11 +480,14 @@
}, },
{ {
"name": "Collider Visualizer", "name": "Collider Visualizer",
"repo": "ShoosGun/ColliderVisualizer", "repo": "loco-choco/ColliderVisualizer",
"tags": [ "tags": [
"tool" "tool"
], ],
"uniqueName": "Locochoco.ColliderVisualizer" "uniqueName": "Locochoco.ColliderVisualizer",
"repoVariations": [
"ShoosGun/ColliderVisualizer"
]
}, },
{ {
"name": "Archaeologist Achievement Helper", "name": "Archaeologist Achievement Helper",
@ -534,19 +553,25 @@
}, },
{ {
"name": "Input Demo Recorder", "name": "Input Demo Recorder",
"repo": "ShoosGun/InputDemoRecorder", "repo": "loco-choco/InputDemoRecorder",
"tags": [ "tags": [
"tool" "tool"
], ],
"uniqueName": "Locochoco.InputDemoRecorder" "uniqueName": "Locochoco.InputDemoRecorder",
"repoVariations": [
"ShoosGun/InputDemoRecorder"
]
}, },
{ {
"name": "Celeste Wilds", "name": "Celeste Wilds",
"repo": "ShoosGun/CelesteWilds", "repo": "loco-choco/CelesteWilds",
"tags": [ "tags": [
"gameplay" "gameplay"
], ],
"uniqueName": "Locochoco.CelesteWilds" "uniqueName": "Locochoco.CelesteWilds",
"repoVariations": [
"ShoosGun/CelesteWilds"
]
}, },
{ {
"name": "Grapefruit", "name": "Grapefruit",
@ -677,7 +702,9 @@
"tags": [ "tags": [
"content" "content"
], ],
"uniqueName": "Jammer.jammerlore" "uniqueName": "Jammer.jammerlore",
"downloadCountOffset": 373,
"firstReleaseDateOverride": "2022-04-17T14:52:12Z"
}, },
{ {
"name": "Ghostbuster", "name": "Ghostbuster",
@ -943,77 +970,103 @@
{ {
"alpha": true, "alpha": true,
"name": "OWAML", "name": "OWAML",
"repo": "ShoosGun/OWAML", "repo": "ow-mods/owaml",
"required": true, "required": true,
"tags": [ "tags": [
"library" "library"
], ],
"uniqueName": "Locochoco.OWAML", "uniqueName": "Locochoco.OWAML",
"utility": true "authorDisplay": "Locochoco & MegaPiggy",
"utility": true,
"repoVariations": [
"ShoosGun/OWAML",
"loco-choco/OWAML"
]
}, },
{ {
"alpha": true, "alpha": true,
"name": "CAMOWA", "name": "CAMOWA",
"repo": "ShoosGun/CAMOWA", "repo": "loco-choco/CAMOWA",
"tags": [ "tags": [
"library" "library"
], ],
"uniqueName": "Locochoco.CAMOWA", "uniqueName": "Locochoco.CAMOWA",
"utility": true "utility": true,
"repoVariations": [
"ShoosGun/CAMOWA"
]
}, },
{ {
"alpha": true, "alpha": true,
"name": "Alpha Fixes", "name": "Alpha Fixes",
"repo": "ShoosGun/AlphaFixes", "repo": "loco-choco/AlphaFixes",
"tags": [ "tags": [
"tweaks" "tweaks"
], ],
"uniqueName": "Locochoco.AlphaFixes" "uniqueName": "Locochoco.AlphaFixes",
"repoVariations": [
"ShoosGun/AlphaFixes"
]
}, },
{ {
"alpha": true, "alpha": true,
"name": "Navinha", "name": "Navinha",
"repo": "ShoosGun/navinha", "repo": "loco-choco/Navinha",
"tags": [ "tags": [
"gameplay" "gameplay"
], ],
"uniqueName": "Locochoco.NAVE" "uniqueName": "Locochoco.NAVE",
"repoVariations": [
"ShoosGun/navinha"
]
}, },
{ {
"alpha": true, "alpha": true,
"name": "Free Cam Mod", "name": "Free Cam Mod",
"repo": "ShoosGun/FreeCamMod", "repo": "loco-choco/FreeCamMod",
"tags": [ "tags": [
"tool" "tool"
], ],
"uniqueName": "Locochoco.FreeCamMod" "uniqueName": "Locochoco.FreeCamMod",
"repoVariations": [
"ShoosGun/FreeCamMod"
]
}, },
{ {
"alpha": true, "alpha": true,
"name": "Probe Grapple", "name": "Probe Grapple",
"repo": "ShoosGun/ProbeGrappleMod", "repo": "loco-choco/ProbeGrappleMod",
"tags": [ "tags": [
"gameplay" "gameplay"
], ],
"uniqueName": "Locochoco.ProbeGrapple" "uniqueName": "Locochoco.ProbeGrapple",
"repoVariations": [
"ShoosGun/ProbeGrappleMod"
]
}, },
{ {
"alpha": true, "alpha": true,
"name": "Cooler Bottom Cams", "name": "Cooler Bottom Cams",
"repo": "ShoosGun/CBC", "repo": "loco-choco/CBC",
"tags": [ "tags": [
"tweaks" "tweaks"
], ],
"uniqueName": "Locochoco.CoolerBottomCams" "uniqueName": "Locochoco.CoolerBottomCams",
"repoVariations": [
"ShoosGun/CBC"
]
}, },
{ {
"alpha": true, "alpha": true,
"name": "Enhanced Mallows", "name": "Enhanced Mallows",
"repo": "ShoosGun/EM", "repo": "loco-choco/EM",
"tags": [ "tags": [
"tweaks" "tweaks"
], ],
"uniqueName": "Locochoco.EnhancedMallows" "uniqueName": "Locochoco.EnhancedMallows",
"repoVariations": [
"ShoosGun/EM"
]
}, },
{ {
"alpha": true, "alpha": true,
@ -1036,11 +1089,14 @@
{ {
"alpha": true, "alpha": true,
"name": "Runtime Unity Editor", "name": "Runtime Unity Editor",
"repo": "ShoosGun/RuntimeUnityEditor", "repo": "loco-choco/RuntimeUnityEditor",
"tags": [ "tags": [
"tool" "tool"
], ],
"uniqueName": "Locochoco.RuntimeUnityEditor" "uniqueName": "Locochoco.RuntimeUnityEditor",
"repoVariations": [
"ShoosGun/RuntimeUnityEditor"
]
}, },
{ {
"name": "Cloudless Giant's Deep", "name": "Cloudless Giant's Deep",
@ -1292,12 +1348,15 @@
{ {
"authorDisplay": "Locochoco", "authorDisplay": "Locochoco",
"name": "Gizmos Library", "name": "Gizmos Library",
"repo": "ShoosGun/GizmosLibrary", "repo": "loco-choco/GizmosLibrary",
"tags": [ "tags": [
"library" "library"
], ],
"uniqueName": "Locochoco.GizmosLibrary", "uniqueName": "Locochoco.GizmosLibrary",
"utility": true "utility": true,
"repoVariations": [
"ShoosGun/GizmosLibrary"
]
}, },
{ {
"authorDisplay": "coderCleric", "authorDisplay": "coderCleric",
@ -1332,7 +1391,7 @@
{ {
"authorDisplay": "Locochoco", "authorDisplay": "Locochoco",
"name": "Slate's Shipyard", "name": "Slate's Shipyard",
"repo": "ShoosGun/SlateShipyard", "repo": "loco-choco/SlateShipyard",
"tags": [ "tags": [
"library", "library",
"gameplay", "gameplay",
@ -1340,17 +1399,23 @@
"content" "content"
], ],
"uniqueName": "Locochoco.SlateShipyard", "uniqueName": "Locochoco.SlateShipyard",
"utility": true "utility": true,
"repoVariations": [
"ShoosGun/SlateShipyard"
]
}, },
{ {
"authorDisplay": "Locochoco", "authorDisplay": "Locochoco",
"name": "Spaceshipinha", "name": "Spaceshipinha",
"parent": "Locochoco.SlateShipyard", "parent": "Locochoco.SlateShipyard",
"repo": "ShoosGun/Spaceshipinha", "repo": "loco-choco/Spaceshipinha",
"tags": [ "tags": [
"gameplay" "gameplay"
], ],
"uniqueName": "Locochoco.Spaceshipinha" "uniqueName": "Locochoco.Spaceshipinha",
"repoVariations": [
"ShoosGun/Spaceshipinha"
]
}, },
{ {
"authorDisplay": "Hawkbar", "authorDisplay": "Hawkbar",
@ -1365,11 +1430,14 @@
"authorDisplay": "Locochoco", "authorDisplay": "Locochoco",
"name": "Car Example", "name": "Car Example",
"parent": "Locochoco.SlateShipyard", "parent": "Locochoco.SlateShipyard",
"repo": "ShoosGun/CarExample", "repo": "loco-choco/CarExample",
"tags": [ "tags": [
"gameplay" "gameplay"
], ],
"uniqueName": "Locochoco.CarExample" "uniqueName": "Locochoco.CarExample",
"repoVariations": [
"ShoosGun/CarExample"
]
}, },
{ {
"authorDisplay": "clay", "authorDisplay": "clay",
@ -1577,13 +1645,16 @@
{ {
"name": "Slate's Shipyard for Outer Wilds Online", "name": "Slate's Shipyard for Outer Wilds Online",
"uniqueName": "Locochoco.ShipyardOWOAddon", "uniqueName": "Locochoco.ShipyardOWOAddon",
"repo": "ShoosGun/ShipyardOWOCompat", "repo": "loco-choco/ShipyardOWOCompat",
"tags": [ "tags": [
"library" "library"
], ],
"parent": "Vesper.OuterWildsMMO", "parent": "Vesper.OuterWildsMMO",
"utility": true, "utility": true,
"authorDisplay": "Locochoco" "authorDisplay": "Locochoco",
"repoVariations": [
"ShoosGun/ShipyardOWOCompat"
]
}, },
{ {
"name": "i let the voices on the discord server make bad ideas for planets", "name": "i let the voices on the discord server make bad ideas for planets",
@ -1638,13 +1709,16 @@
{ {
"name": "Kerbal Space Ventures", "name": "Kerbal Space Ventures",
"uniqueName": "Locochoco.KSPShips", "uniqueName": "Locochoco.KSPShips",
"repo": "ShoosGun/Kerbal-Space-Ventures", "repo": "loco-choco/Kerbal-Space-Ventures",
"tags": [ "tags": [
"gameplay", "gameplay",
"tool" "tool"
], ],
"parent": "Locochoco.SlateShipyard", "parent": "Locochoco.SlateShipyard",
"authorDisplay": "Locochoco & FunkyShoeMan" "authorDisplay": "Locochoco & FunkyShoeMan",
"repoVariations": [
"ShoosGun/Kerbal-Space-Ventures"
]
}, },
{ {
"name": "Solar Systems I Made as a Kid", "name": "Solar Systems I Made as a Kid",

View File

@ -69,7 +69,20 @@
"localization" "localization"
] ]
} }
} },
"downloadCountOffset": {
"type": "number",
"description": "An amount that will be added to the mod's current download count."
},
"firstReleaseDateOverride": {
"type": "string",
"description": "A date that will override the current first release date. Format: YYYY-MM-DDThh:mm:ssZ"
},
"repoVariations": {
"type": "array",
"description": "List of previous GitHub repository names. Used for merging download count history. Do not use if current repo is fork of original repo.",
"items": {"type": "string"}
},
} }
} }
} }

View File

@ -13,4 +13,7 @@ export type ModInfo = {
parent?: string; parent?: string;
authorDisplay?: string; authorDisplay?: string;
tags: string[]; tags: string[];
downloadCountOffset?: number;
firstReleaseDateOverride?: string;
repoVariations?: string[];
}; };

View File

@ -35,6 +35,7 @@ export interface BaseMod {
downloadUrl: string; downloadUrl: string;
date: string; date: string;
}; };
repoVariations?: string[];
} }
export interface OutputMod extends BaseMod { export interface OutputMod extends BaseMod {

View File

@ -16,17 +16,6 @@ import type { ModList } from "../mod-info.js";
const REPO_URL_BASE = "https://github.com"; const REPO_URL_BASE = "https://github.com";
const FULL_UPDATE_RATE_HOURS = 12; const FULL_UPDATE_RATE_HOURS = 12;
const downloadCountOffsets: { [key: string]: number } = {
// Jammer deleted the repositories
"Jammer.OuterWildsGalaxy": 4828,
"Jammer.jammerlore": 373,
};
const firstReleaseDateOverrides: { [key: string]: string } = {
"Jammer.OuterWildsGalaxy": "2021-12-31T23:31:02Z",
"Jammer.jammerlore": "2022-04-17T14:52:12Z"
};
export async function fetchMods( export async function fetchMods(
modsJson: string, modsJson: string,
outputDirectory: string, outputDirectory: string,
@ -76,12 +65,26 @@ export async function fetchMods(
) )
: {}; : {};
const repoURL = `${REPO_URL_BASE}/${modInfo.repo}`;
const repoVariations =
modInfo.repoVariations
? modInfo.repoVariations.map(
(value: string) => `${REPO_URL_BASE}/${value}`
)
: [];
if (!requiresUpdate) { if (!requiresUpdate) {
return { return {
...previousMod, ...previousMod,
latestPrereleaseDescription: "", alpha: modInfo.alpha,
latestReleaseDescription: "", required: modInfo.required,
utility: modInfo.utility,
parent: modInfo.parent,
repo: repoURL,
authorDisplay: modInfo.authorDisplay,
tags: modInfo.tags,
thumbnail: thumbnailInfo ?? {}, thumbnail: thumbnailInfo ?? {},
repoVariations,
}; };
} }
@ -123,11 +126,11 @@ export async function fetchMods(
0 0
); );
if (modInfo.uniqueName in downloadCountOffsets) { if (modInfo.downloadCountOffset) {
totalDownloadCount += downloadCountOffsets[modInfo.uniqueName]; totalDownloadCount += modInfo.downloadCountOffset;
} }
const firstReleaseDate = modInfo.uniqueName in firstReleaseDateOverrides ? firstReleaseDateOverrides[modInfo.uniqueName]: const firstReleaseDate = modInfo.firstReleaseDateOverride ??
(releases[releases.length - 1] ?? cleanLatestRelease).date; (releases[releases.length - 1] ?? cleanLatestRelease).date;
const latestPrerelease = prereleases[0]; const latestPrerelease = prereleases[0];
@ -144,7 +147,7 @@ export async function fetchMods(
downloadCount: totalDownloadCount, downloadCount: totalDownloadCount,
latestReleaseDate: cleanLatestRelease.date, latestReleaseDate: cleanLatestRelease.date,
firstReleaseDate, firstReleaseDate,
repo: `${REPO_URL_BASE}/${modInfo.repo}`, repo: repoURL,
version: cleanLatestRelease.version, version: cleanLatestRelease.version,
readme, readme,
authorDisplay: modInfo.authorDisplay, authorDisplay: modInfo.authorDisplay,
@ -162,6 +165,7 @@ export async function fetchMods(
thumbnail: thumbnailInfo ?? {}, thumbnail: thumbnailInfo ?? {},
repoUpdatedAt, repoUpdatedAt,
databaseEntryUpdatedAt: new Date().toISOString(), databaseEntryUpdatedAt: new Date().toISOString(),
repoVariations,
}; };
return mod; return mod;