Merge remote-tracking branch 'origin/main'

This commit is contained in:
Jai A 2025-01-16 16:43:38 -08:00
commit abbfb3ca2f
No known key found for this signature in database
GPG Key ID: 9A9F9B7250E9883C
3 changed files with 37 additions and 34 deletions

View File

@ -257,7 +257,7 @@
v-else-if="getPyroCharge(subscription).status === 'processing'" v-else-if="getPyroCharge(subscription).status === 'processing'"
class="text-sm text-orange" class="text-sm text-orange"
> >
Your payment is being processed. Perks will activate once payment is Your payment is being processed. Your server will activate once payment is
complete. complete.
</span> </span>
<span <span
@ -270,7 +270,8 @@
v-else-if="getPyroCharge(subscription).status === 'failed'" v-else-if="getPyroCharge(subscription).status === 'failed'"
class="text-sm text-red" class="text-sm text-red"
> >
Your subscription payment failed. Please update your payment method. Your subscription payment failed. Please update your payment method, then
resubscribe.
</span> </span>
</div> </div>
</div> </div>
@ -278,7 +279,8 @@
<ButtonStyled <ButtonStyled
v-if=" v-if="
getPyroCharge(subscription) && getPyroCharge(subscription) &&
getPyroCharge(subscription).status !== 'cancelled' getPyroCharge(subscription).status !== 'cancelled' &&
getPyroCharge(subscription).status !== 'failed'
" "
type="standard" type="standard"
@click="showPyroCancelModal(subscription.id)" @click="showPyroCancelModal(subscription.id)"
@ -291,7 +293,8 @@
<ButtonStyled <ButtonStyled
v-else-if=" v-else-if="
getPyroCharge(subscription) && getPyroCharge(subscription) &&
getPyroCharge(subscription).status === 'cancelled' (getPyroCharge(subscription).status === 'cancelled' ||
getPyroCharge(subscription).status === 'failed')
" "
type="standard" type="standard"
color="green" color="green"

View File

@ -180,9 +180,8 @@ pub async fn import_mmc(
instance_folder: String, // instance folder in mmc_base_path instance_folder: String, // instance folder in mmc_base_path
profile_path: &str, // path to profile profile_path: &str, // path to profile
) -> crate::Result<()> { ) -> crate::Result<()> {
let mmc_instance_path = mmc_base_path let mmc_instance_path =
.join("instances") mmc_base_path.join("instances").join(instance_folder);
.join(instance_folder.clone());
let mmc_pack = let mmc_pack =
io::read_to_string(&mmc_instance_path.join("mmc-pack.json")).await?; io::read_to_string(&mmc_instance_path.join("mmc-pack.json")).await?;
@ -209,9 +208,18 @@ pub async fn import_mmc(
profile_path: profile_path.to_string(), profile_path: profile_path.to_string(),
}; };
// Managed pack let mut minecraft_folder = mmc_instance_path.join("minecraft");
let backup_name = "Imported Modpack".to_string(); if !minecraft_folder.is_dir() {
minecraft_folder = mmc_instance_path.join(".minecraft");
if !minecraft_folder.is_dir() {
return Err(crate::ErrorKind::InputError(
"Instance is missing Minecraft directory".to_string(),
)
.into());
}
}
// Managed pack
if instance_cfg.managed_pack.unwrap_or(false) { if instance_cfg.managed_pack.unwrap_or(false) {
match instance_cfg.managed_pack_type { match instance_cfg.managed_pack_type {
Some(MMCManagedPackType::Modrinth) => { Some(MMCManagedPackType::Modrinth) => {
@ -220,38 +228,26 @@ pub async fn import_mmc(
// Modrinth Managed Pack // Modrinth Managed Pack
// Kept separate as we may in the future want to add special handling for modrinth managed packs // Kept separate as we may in the future want to add special handling for modrinth managed packs
let backup_name = "Imported Modrinth Modpack".to_string(); import_mmc_unmanaged(profile_path, minecraft_folder, "Imported Modrinth Modpack".to_string(), description, mmc_pack).await?;
let minecraft_folder = mmc_base_path.join("instances").join(instance_folder).join(".minecraft");
import_mmc_unmanaged(profile_path, minecraft_folder, backup_name, description, mmc_pack).await?;
} }
Some(MMCManagedPackType::Flame) | Some(MMCManagedPackType::ATLauncher) => { Some(MMCManagedPackType::Flame) | Some(MMCManagedPackType::ATLauncher) => {
// For flame/atlauncher managed packs // For flame/atlauncher managed packs
// Treat as unmanaged, but with 'minecraft' folder instead of '.minecraft' // Treat as unmanaged, but with 'minecraft' folder instead of '.minecraft'
let minecraft_folder = mmc_base_path.join("instances").join(instance_folder).join("minecraft"); import_mmc_unmanaged(profile_path, minecraft_folder, "Imported Modpack".to_string(), description, mmc_pack).await?;
import_mmc_unmanaged(profile_path, minecraft_folder, backup_name, description, mmc_pack).await?;
}, },
Some(_) => { Some(_) => {
// For managed packs that aren't modrinth, flame, atlauncher // For managed packs that aren't modrinth, flame, atlauncher
// Treat as unmanaged // Treat as unmanaged
let backup_name = "ImportedModpack".to_string(); import_mmc_unmanaged(profile_path, minecraft_folder, "ImportedModpack".to_string(), description, mmc_pack).await?;
let minecraft_folder = mmc_base_path.join("instances").join(instance_folder).join(".minecraft");
import_mmc_unmanaged(profile_path, minecraft_folder, backup_name, description, mmc_pack).await?;
}, },
_ => return Err(crate::ErrorKind::InputError({ _ => return Err(crate::ErrorKind::InputError("Instance is managed, but managed pack type not specified in instance.cfg".to_string()).into())
"Instance is managed, but managed pack type not specified in instance.cfg".to_string()
}).into())
} }
} else { } else {
// Direclty import unmanaged pack // Direclty import unmanaged pack
let backup_name = "Imported Modpack".to_string();
let minecraft_folder = mmc_base_path
.join("instances")
.join(instance_folder)
.join(".minecraft");
import_mmc_unmanaged( import_mmc_unmanaged(
profile_path, profile_path,
minecraft_folder, minecraft_folder,
backup_name, "Imported Modpack".to_string(),
description, description,
mmc_pack, mmc_pack,
) )

View File

@ -10,7 +10,7 @@
<template #menu> <template #menu>
<template v-for="(option, index) in options.filter((x) => x.shown === undefined || x.shown)"> <template v-for="(option, index) in options.filter((x) => x.shown === undefined || x.shown)">
<div <div
v-if="option.divider" v-if="isDivider(option)"
:key="`divider-${index}`" :key="`divider-${index}`"
class="h-px mx-3 my-2 bg-button-bg" class="h-px mx-3 my-2 bg-button-bg"
></div> ></div>
@ -25,15 +25,15 @@
:v-close-popper="!option.remainOnClick" :v-close-popper="!option.remainOnClick"
:action=" :action="
option.action option.action
? (event) => { ? (event: MouseEvent) => {
option.action(event) option.action?.(event)
if (!option.remainOnClick) { if (!option.remainOnClick) {
close() close()
} }
} }
: null : undefined
" "
:link="option.link ? option.link : null" :link="option.link ? option.link : undefined"
:external="option.external ? option.external : false" :external="option.external ? option.external : false"
:disabled="option.disabled" :disabled="option.disabled"
@click=" @click="
@ -67,7 +67,7 @@ interface Divider extends BaseOption {
interface Item extends BaseOption { interface Item extends BaseOption {
id: string id: string
action?: () => void action?: (event?: MouseEvent) => void
link?: string link?: string
external?: boolean external?: boolean
color?: color?:
@ -99,8 +99,8 @@ withDefaults(
{ {
options: () => [], options: () => [],
disabled: false, disabled: false,
dropdownId: null, dropdownId: undefined,
tooltip: null, tooltip: undefined,
}, },
) )
@ -118,6 +118,10 @@ const open = () => {
dropdown.value?.show() dropdown.value?.show()
} }
function isDivider(option: BaseOption): option is Divider {
return 'divider' in option
}
defineExpose({ open, close }) defineExpose({ open, close })
</script> </script>