fix: proper CurseForge capitalization
This commit is contained in:
parent
766d3a24c4
commit
56777c8230
14 changed files with 44 additions and 35 deletions
|
|
@ -133,7 +133,7 @@ export type ProcessPayload = { type: "Starting"; command: string } | { type: "St
|
|||
|
||||
export type ProfileUpdate = { res: Resolution | null; force_fullscreen: boolean | null; mem_max: number | null; launch_args: string | null; launch_env: string | null; hook_pre: string | null; hook_wrapper: string | null; hook_post: string | null }
|
||||
|
||||
export type Provider = "Modrinth" | "Curseforge" | "SkyClient"
|
||||
export type Provider = "Modrinth" | "CurseForge" | "SkyClient"
|
||||
|
||||
export type Resolution = { width: number; height: number }
|
||||
|
||||
|
|
@ -212,8 +212,11 @@ export type VersionType =
|
|||
*/
|
||||
"old_beta"
|
||||
|
||||
const ARGS_MAP = { 'events':'{"ingress":["event"],"message":["event"],"process":["event"]}', 'core':'{"removeUser":["uuid"],"writeSettings":["setting"],"updateClusterById":["id","request"],"getScreenshots":["id"],"getClusters":[],"getWorlds":["id"],"getGameVersions":[],"getPackage":["provider","slug"],"getLoadersForVersion":["mc_version"],"getMultiplePackages":["provider","slugs"],"getPackageUser":["provider","slug"],"downloadPackage":["provider","package_id","version_id","cluster_id","skip_compatibility"],"getUsersFromAuthor":["provider","author"],"searchPackages":["provider","query"],"getUser":["uuid"],"getProfileOrDefault":["name"],"updateClusterProfile":["name","profile"],"getPackageVersions":["provider","slug","mc_versions","loaders","offset","limit"],"launchCluster":["id","uuid"],"setDefaultUser":["uuid"],"openMsaLogin":[],"getGlobalProfile":[],"getClusterById":["id"],"getDefaultUser":["fallback"],"readSettings":[],"removeCluster":["id"],"createCluster":["options"],"getUsers":[]}', 'onelauncher':'{"set_window_style":["decorations"],"return_error":[],"open_dev_tools":[]}' }
|
||||
export type Router = { 'core': { getClusters: () => Promise<ClusterModel[]>,
|
||||
const ARGS_MAP = { 'onelauncher':'{"open_dev_tools":[],"set_window_style":["decorations"],"return_error":[]}', 'core':'{"setDefaultUser":["uuid"],"openMsaLogin":[],"writeSettings":["setting"],"getPackage":["provider","slug"],"getLoadersForVersion":["mc_version"],"getUsersFromAuthor":["provider","author"],"getPackageUser":["provider","slug"],"readSettings":[],"createCluster":["options"],"getPackageVersions":["provider","slug","mc_versions","loaders","offset","limit"],"downloadPackage":["provider","package_id","version_id","cluster_id","skip_compatibility"],"getMultiplePackages":["provider","slugs"],"searchPackages":["provider","query"],"getUser":["uuid"],"removeCluster":["id"],"updateClusterById":["id","request"],"getClusters":[],"getClusterById":["id"],"launchCluster":["id","uuid"],"getProfileOrDefault":["name"],"updateClusterProfile":["name","profile"],"getScreenshots":["id"],"getGameVersions":[],"getGlobalProfile":[],"getUsers":[],"removeUser":["uuid"],"getDefaultUser":["fallback"],"getWorlds":["id"]}', 'events':'{"message":["event"],"process":["event"],"ingress":["event"]}' }
|
||||
export type Router = { 'onelauncher': { return_error: () => Promise<null>,
|
||||
open_dev_tools: () => Promise<void>,
|
||||
set_window_style: (decorations: boolean) => Promise<void> },
|
||||
'core': { getClusters: () => Promise<ClusterModel[]>,
|
||||
getClusterById: (id: bigint) => Promise<ClusterModel | null>,
|
||||
removeCluster: (id: bigint) => Promise<null>,
|
||||
createCluster: (options: CreateCluster) => Promise<ClusterModel>,
|
||||
|
|
@ -243,10 +246,7 @@ downloadPackage: (provider: Provider, packageId: string, versionId: string, clus
|
|||
getUsersFromAuthor: (provider: Provider, author: PackageAuthor) => Promise<ManagedUser[]> },
|
||||
'events': { ingress: (event: IngressPayload) => Promise<void>,
|
||||
message: (event: MessagePayload) => Promise<void>,
|
||||
process: (event: ProcessPayload) => Promise<void> },
|
||||
'onelauncher': { return_error: () => Promise<null>,
|
||||
open_dev_tools: () => Promise<void>,
|
||||
set_window_style: (decorations: boolean) => Promise<void> } };
|
||||
process: (event: ProcessPayload) => Promise<void> } };
|
||||
|
||||
|
||||
export type { InferCommandOutput }
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import type { ImgHTMLAttributes, JSX } from 'react';
|
||||
import { Show } from '@onelauncher/common/components';
|
||||
import CurseforgeIcon from '../../assets/logos/curseforge.svg';
|
||||
import CurseForgeIcon from '../../assets/logos/curseforge.svg';
|
||||
import AtLauncherIcon from '../../assets/logos/launchers/atlauncher.svg';
|
||||
import FTBIcon from '../../assets/logos/launchers/ftb.svg';
|
||||
import GDLauncherImage from '../../assets/logos/launchers/gdlauncher.png';
|
||||
|
|
@ -22,7 +22,7 @@ export function getLauncherLogoElement(launcher: string): ElementType {
|
|||
// [provider logo, is svg]
|
||||
const mapping: Record<Lowercase<string>, ElementType | string> = {
|
||||
modrinth: ModrinthIcon,
|
||||
curseforge: CurseforgeIcon,
|
||||
curseforge: CurseForgeIcon,
|
||||
prismlauncher: PrismIcon,
|
||||
atlauncher: AtLauncherIcon,
|
||||
gdlauncher: GDLauncherImage,
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ export function PackageItem({ provider, ...item }: SearchResult & { provider: Pr
|
|||
{' '}
|
||||
on
|
||||
{' '}
|
||||
<span className="text-fg-primary">{provider}</span>
|
||||
{provider}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import type { ImgHTMLAttributes, RefAttributes } from 'react';
|
||||
import CurseforgeIcon from '@/assets/logos/curseforge.svg';
|
||||
import CurseForgeIcon from '@/assets/logos/curseforge.svg';
|
||||
import VanillaImage from '@/assets/logos/minecraft.png';
|
||||
import ModrinthIcon from '@/assets/logos/modrinth.svg';
|
||||
import SkyClientImage from '@/assets/logos/skyclient.png';
|
||||
|
|
@ -9,7 +9,7 @@ export function getProviderLogoSrc(provider: string): string {
|
|||
|
||||
const mapping: Record<string, string> = {
|
||||
modrinth: ModrinthIcon,
|
||||
curseforge: CurseforgeIcon,
|
||||
curseforge: CurseForgeIcon,
|
||||
skyclient: SkyClientImage,
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -116,7 +116,7 @@ function RouteComponent() {
|
|||
function getPackageUrl(pkg: ManagedPackage): string {
|
||||
switch (pkg.provider) {
|
||||
case 'Modrinth': return `https://modrinth.com/project/${pkg.slug}`;
|
||||
case 'Curseforge': return `https://www.curseforge.com/minecraft/${pkg.package_type}s/${pkg.slug}`;
|
||||
case 'CurseForge': return `https://www.curseforge.com/minecraft/${pkg.package_type}s/${pkg.slug}`;
|
||||
case 'SkyClient': return ``;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,13 +17,13 @@ export const browserCategories = {
|
|||
return [];
|
||||
},
|
||||
|
||||
mod(provider: string = 'Modrinth'): Array<CategoryItem> {
|
||||
mod(provider: Provider = 'Modrinth'): Array<CategoryItem> {
|
||||
return Object.values(modMapping[provider]);
|
||||
},
|
||||
};
|
||||
|
||||
const modMapping: Record<string, Array<CategoryItem>> = {
|
||||
Curseforge: [
|
||||
const modMapping: Record<Provider, Array<CategoryItem>> = {
|
||||
CurseForge: [
|
||||
{ display: 'Adventure', id: '422' },
|
||||
{ display: 'API and Library', id: '421' },
|
||||
{ display: 'Armor and Tools', id: '434' },
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
export const LAUNCHER_IMPORT_TYPES = [
|
||||
'PrismLauncher',
|
||||
'Curseforge',
|
||||
'CurseForge',
|
||||
// 'Modrinth',
|
||||
'ATLauncher',
|
||||
'GDLauncher',
|
||||
|
|
@ -18,7 +18,16 @@ export const LOADERS = [
|
|||
'fabric',
|
||||
'legacyfabric',
|
||||
] as const;
|
||||
export const PROVIDERS = ['Modrinth', 'Curseforge', 'SkyClient'] as const;
|
||||
export const ProviderNames: Record<typeof LOADERS[number], string> = {
|
||||
vanilla: 'Vanilla',
|
||||
forge: 'Forge',
|
||||
neoforge: 'NeoForge',
|
||||
quilt: 'Quilt',
|
||||
fabric: 'Fabric',
|
||||
legacyfabric: 'Legacy Fabric',
|
||||
} as const;
|
||||
|
||||
export const PROVIDERS = ['Modrinth', 'CurseForge', 'SkyClient'] as const;
|
||||
export const PACKAGE_TYPES = ['mod', 'resourcepack', 'datapack', 'shaderpack'] as const;
|
||||
|
||||
export function pluralize(n: number, word: string, locale: string = 'en'): string {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import type { ImportType } from '@onelauncher/client/bindings';
|
||||
import CurseforgeIcon from '~assets/logos/curseforge.svg?component-solid';
|
||||
import CurseForgeIcon from '~assets/logos/curseforge.svg?component-solid';
|
||||
import AtLauncherIcon from '~assets/logos/launchers/atlauncher.svg?component-solid';
|
||||
import FTBIcon from '~assets/logos/launchers/ftb.svg?component-solid';
|
||||
import GDLauncherImage from '~assets/logos/launchers/gdlauncher.png';
|
||||
|
|
@ -21,7 +21,7 @@ export function getLauncherLogoElement(launcher: ImportType): ElementType {
|
|||
// [provider logo, is svg]
|
||||
const mapping: Record<Lowercase<ImportType>, ElementType | string> = {
|
||||
modrinth: ModrinthIcon,
|
||||
curseforge: CurseforgeIcon,
|
||||
curseforge: CurseForgeIcon,
|
||||
prismlauncher: PrismIcon,
|
||||
atlauncher: AtLauncherIcon,
|
||||
gdlauncher: GDLauncherImage,
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import type { ManagedPackage, Providers } from '@onelauncher/client/bindings';
|
||||
import CurseforgeIcon from '~assets/logos/curseforge.svg?component-solid';
|
||||
import CurseForgeIcon from '~assets/logos/curseforge.svg?component-solid';
|
||||
import ModrinthImage from '~assets/logos/modrinth.svg?component-solid';
|
||||
import SkyClientImage from '~assets/logos/skyclient.png';
|
||||
import { type Component, type JSX, Match, Show, splitProps, Switch } from 'solid-js';
|
||||
|
|
@ -10,7 +10,7 @@ export function getProviderLogoElement(provider: ManagedPackage | Providers): st
|
|||
// [provider logo, is svg]
|
||||
const mapping: Record<Lowercase<Providers>, string | Component> = {
|
||||
modrinth: ModrinthImage,
|
||||
curseforge: CurseforgeIcon,
|
||||
curseforge: CurseForgeIcon,
|
||||
skyclient: SkyClientImage,
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ export const browserCategories = {
|
|||
};
|
||||
|
||||
const modMapping: Record<Providers, CategoryItem[]> = {
|
||||
Curseforge: [
|
||||
CurseForge: [
|
||||
{ display: 'Adventure', id: '422' },
|
||||
{ display: 'API and Library', id: '421' },
|
||||
{ display: 'Armor and Tools', id: '434' },
|
||||
|
|
|
|||
|
|
@ -172,7 +172,7 @@ export function getLicenseUrl(licenseId: string | License | null | undefined): s
|
|||
export function getPackageUrl(pkg: ManagedPackage): string {
|
||||
const mapping: Record<Providers, () => string> = {
|
||||
Modrinth: () => `https://modrinth.com/${pkg.package_type}/${pkg.id}`,
|
||||
Curseforge: () => {
|
||||
CurseForge: () => {
|
||||
const packageTypeMapping: Record<PackageType, string> = {
|
||||
mod: 'mc-mods',
|
||||
shaderpack: 'shaders',
|
||||
|
|
@ -190,11 +190,11 @@ export function getPackageUrl(pkg: ManagedPackage): string {
|
|||
}
|
||||
|
||||
export const LOADERS: Loader[] = ['vanilla', 'fabric', 'forge', 'neoforge', 'quilt'] as const;
|
||||
export const PROVIDERS: Providers[] = ['Modrinth', 'Curseforge', 'SkyClient'] as const;
|
||||
export const PROVIDERS: Providers[] = ['Modrinth', 'CurseForge', 'SkyClient'] as const;
|
||||
export const PACKAGE_TYPES: PackageType[] = ['mod', 'resourcepack', 'datapack', 'shaderpack'] as const;
|
||||
export const LAUNCHER_IMPORT_TYPES: ImportType[] = [
|
||||
'PrismLauncher',
|
||||
'Curseforge',
|
||||
'CurseForge',
|
||||
// 'Modrinth',
|
||||
'ATLauncher',
|
||||
'GDLauncher',
|
||||
|
|
|
|||
|
|
@ -19,9 +19,9 @@ pub const MINECRAFT_SCOPES: &str = "service::user.auth.xboxlive.com::MBI_SSL";
|
|||
// !!! URLS must NOT have a trailing slash. !!!
|
||||
/// The Modrinth API base url.
|
||||
pub const MODRINTH_API_URL: &str = "https://api.modrinth.com";
|
||||
/// The Curseforge API base url.
|
||||
/// The CurseForge API base url.
|
||||
pub const CURSEFORGE_API_URL: &str = "https://api.curseforge.com";
|
||||
/// The Minecraft game ID on Curseforge.
|
||||
/// The Minecraft game ID on CurseForge.
|
||||
pub const CURSEFORGE_GAME_ID: u32 = 432;
|
||||
/// Our metadata API base url.
|
||||
pub const METADATA_API_URL: &str = "https://meta.polyfrost.org";
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ impl PackageType {
|
|||
#[sea_orm(rs_type = "u8", db_type = "Integer")]
|
||||
pub enum Provider {
|
||||
Modrinth = 0,
|
||||
Curseforge = 1,
|
||||
CurseForge = 1,
|
||||
SkyClient = 2,
|
||||
}
|
||||
|
||||
|
|
@ -48,7 +48,7 @@ impl Provider {
|
|||
pub fn name(&self) -> &str {
|
||||
match self {
|
||||
Self::Modrinth => "Modrinth",
|
||||
Self::Curseforge => "Curseforge",
|
||||
Self::CurseForge => "CurseForge",
|
||||
Self::SkyClient => "SkyClient",
|
||||
}
|
||||
}
|
||||
|
|
@ -58,13 +58,13 @@ impl Provider {
|
|||
pub fn website(&self) -> &str {
|
||||
match self {
|
||||
Self::Modrinth => "https://modrinth.com/",
|
||||
Self::Curseforge => "https://curseforge.com/",
|
||||
Self::CurseForge => "https://curseforge.com/",
|
||||
Self::SkyClient => "https://skyclient.co/",
|
||||
}
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
pub const fn get_providers() -> &'static [Self] {
|
||||
&[Self::Modrinth, Self::Curseforge, Self::SkyClient]
|
||||
&[Self::Modrinth, Self::CurseForge, Self::SkyClient]
|
||||
}
|
||||
}
|
||||
|
|
@ -18,7 +18,7 @@ async function loadEnv() {
|
|||
dotenv.config({ path: `${path}/.env` });
|
||||
}
|
||||
|
||||
async function fetchCategoriesCurseforge(packageType: PackageType): Promise<MappingList> {
|
||||
async function fetchCategoriesCurseForge(packageType: PackageType): Promise<MappingList> {
|
||||
const key = process.env.CURSEFORGE_API_KEY;
|
||||
|
||||
if (key === undefined) {
|
||||
|
|
@ -55,7 +55,7 @@ async function fetchCategoriesCurseforge(packageType: PackageType): Promise<Mapp
|
|||
|
||||
const mapping: MappingList = {};
|
||||
|
||||
mapping.Curseforge = data
|
||||
mapping.CurseForge = data
|
||||
.filter((category) => {
|
||||
return category.isClass !== true && category.classId === classIds[packageType];
|
||||
})
|
||||
|
|
@ -108,7 +108,7 @@ async function fetchCategoriesModrinth(packageType: PackageType): Promise<Mappin
|
|||
|
||||
await loadEnv();
|
||||
|
||||
const cfCategories = await fetchCategoriesCurseforge(packageType);
|
||||
const cfCategories = await fetchCategoriesCurseForge(packageType);
|
||||
const modrinthCategories = await fetchCategoriesModrinth(packageType);
|
||||
|
||||
const categories = {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue