You've already forked AstralRinth
forked from didirus/AstralRinth
Server Content Tab Fixes & Improvements (#3230)
* fix cancel button on edit modal * make hardcoded mod text dynamic for plugins * fix files path when clicking an external plugin * fix plugins path for file uploads * improve friendly mod name logic * fix toggling plugins * update pyroServers content definitions * install then remove for changing version Reinstall isn't currently implemented properly * make the edit dialog pretty * make new admonition component * fix warning admonition colour * new edit version modal * cleanup * make latest version default * final touches * lint
This commit is contained in:
@@ -252,7 +252,7 @@ export interface DirectoryResponse {
|
||||
current?: number;
|
||||
}
|
||||
|
||||
type ContentType = "Mod" | "Plugin";
|
||||
type ContentType = "mod" | "plugin";
|
||||
|
||||
const constructServerProperties = (properties: any): string => {
|
||||
let fileContent = `#Minecraft server properties\n#${new Date().toUTCString()}\n`;
|
||||
@@ -519,8 +519,8 @@ const installContent = async (contentType: ContentType, projectId: string, versi
|
||||
await PyroFetch(`servers/${internalServerRefrence.value.serverId}/mods`, {
|
||||
method: "POST",
|
||||
body: {
|
||||
install_as: contentType,
|
||||
rinth_ids: { project_id: projectId, version_id: versionId },
|
||||
install_as: contentType,
|
||||
},
|
||||
});
|
||||
} catch (error) {
|
||||
@@ -529,13 +529,12 @@ const installContent = async (contentType: ContentType, projectId: string, versi
|
||||
}
|
||||
};
|
||||
|
||||
const removeContent = async (contentType: ContentType, contentId: string) => {
|
||||
const removeContent = async (path: string) => {
|
||||
try {
|
||||
await PyroFetch(`servers/${internalServerRefrence.value.serverId}/deleteMod`, {
|
||||
method: "POST",
|
||||
body: {
|
||||
install_as: contentType,
|
||||
path: contentId,
|
||||
path,
|
||||
},
|
||||
});
|
||||
} catch (error) {
|
||||
@@ -544,15 +543,11 @@ const removeContent = async (contentType: ContentType, contentId: string) => {
|
||||
}
|
||||
};
|
||||
|
||||
const reinstallContent = async (
|
||||
contentType: ContentType,
|
||||
contentId: string,
|
||||
newContentId: string,
|
||||
) => {
|
||||
const reinstallContent = async (replace: string, projectId: string, versionId: string) => {
|
||||
try {
|
||||
await PyroFetch(`servers/${internalServerRefrence.value.serverId}/mods/${contentId}`, {
|
||||
method: "PUT",
|
||||
body: { install_as: contentType, version_id: newContentId },
|
||||
await PyroFetch(`servers/${internalServerRefrence.value.serverId}/mods/update`, {
|
||||
method: "POST",
|
||||
body: { replace, project_id: projectId, version_id: versionId },
|
||||
});
|
||||
} catch (error) {
|
||||
console.error("Error reinstalling mod:", error);
|
||||
@@ -1160,18 +1155,17 @@ type ContentFunctions = {
|
||||
|
||||
/**
|
||||
* Removes a mod from a server.
|
||||
* @param contentType - The type of content to remove.
|
||||
* @param contentId - The ID of the content.
|
||||
* @param path - The path of the mod file.
|
||||
*/
|
||||
remove: (contentType: ContentType, contentId: string) => Promise<void>;
|
||||
remove: (path: string) => Promise<void>;
|
||||
|
||||
/**
|
||||
* Reinstalls a mod to a server.
|
||||
* @param contentType - The type of content to reinstall.
|
||||
* @param contentId - The ID of the content.
|
||||
* @param newContentId - The ID of the new version.
|
||||
* @param replace - The path of the mod to replace.
|
||||
* @param projectId - The ID of the content.
|
||||
* @param versionId - The ID of the new version.
|
||||
*/
|
||||
reinstall: (contentType: ContentType, contentId: string, newContentId: string) => Promise<void>;
|
||||
reinstall: (replace: string, projectId: string, versionId: string) => Promise<void>;
|
||||
};
|
||||
|
||||
type BackupFunctions = {
|
||||
|
||||
Reference in New Issue
Block a user