fix types being returned
This commit is contained in:
parent
bca5d8236e
commit
0f37863c06
@ -88,11 +88,11 @@ export class LauncherV2Callbacks {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
public profile(): Error {
|
public profile(): any {
|
||||||
throw new Error("Method not implemented.");
|
throw new Error("Method not implemented.");
|
||||||
}
|
}
|
||||||
|
|
||||||
public profileMods(): Error {
|
public profileMods(): any {
|
||||||
throw new Error("Method not implemented.");
|
throw new Error("Method not implemented.");
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -52,37 +52,23 @@ export class LauncherV2Controller {
|
|||||||
*/
|
*/
|
||||||
public types(): Record<string, string> {
|
public types(): Record<string, string> {
|
||||||
|
|
||||||
const profileRecord: Record<string, string> = {};
|
const result = {};
|
||||||
|
|
||||||
// Get all possible profile types, excluding blacklisted ones
|
|
||||||
const profileKeys = Object.keys(this.databaseService.getProfiles()).filter(
|
|
||||||
(key) => !this.coreConfig.features.createNewProfileTypesBlacklist.includes(key),
|
|
||||||
);
|
|
||||||
|
|
||||||
// Add them to record with description
|
|
||||||
for (const profileKey in profileKeys) {
|
|
||||||
profileRecord[profileKey] = this.getProfileDescription(profileKey);
|
|
||||||
}
|
|
||||||
|
|
||||||
return profileRecord;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns a string that represents the Profile types description.
|
|
||||||
* - This is also localised.
|
|
||||||
*
|
|
||||||
* @param key Profile Type Name: eg "standard"
|
|
||||||
* @returns Profile Type Description
|
|
||||||
*/
|
|
||||||
protected getProfileDescription(key: string): string {
|
|
||||||
const dbProfiles = this.databaseService.getProfiles();
|
const dbProfiles = this.databaseService.getProfiles();
|
||||||
const descKey = dbProfiles[key]?.descriptionLocaleKey;
|
for (const profileKey in dbProfiles) {
|
||||||
if (!descKey) {
|
if (this.coreConfig.features.createNewProfileTypesBlacklist.includes(profileKey)) {
|
||||||
this.logger.warning(this.localisationService.getText("launcher-missing_property", key));
|
continue;
|
||||||
return "";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.localisationService.getText(key);
|
const localeKey = dbProfiles[profileKey]?.descriptionLocaleKey;
|
||||||
|
if (!localeKey) {
|
||||||
|
this.logger.warning(this.localisationService.getText("launcher-missing_property", profileKey));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
result[profileKey] = this.localisationService.getText(localeKey);
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -20,6 +20,6 @@ export interface ILauncherV2Callbacks {
|
|||||||
compatibleVersion(): ILauncherV2VersionResponse;
|
compatibleVersion(): ILauncherV2VersionResponse;
|
||||||
mods(): ILauncherV2ModsResponse;
|
mods(): ILauncherV2ModsResponse;
|
||||||
profiles(): ILauncherV2ProfilesResponse;
|
profiles(): ILauncherV2ProfilesResponse;
|
||||||
profile(): Error
|
profile(): any
|
||||||
profileMods(): Error
|
profileMods(): any
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user