mirror of
https://github.com/modrinth/code.git
synced 2026-08-25 09:04:55 +00:00
fix: server panel not using correct endpoint for mrpack reupload (#6539)
fix: server panel not using correct endpoint for local modpack reupload
This commit is contained in:
@@ -390,6 +390,22 @@ function toApiLoader(loader: string): Archon.Content.v1.Modloader {
|
||||
return loader as Archon.Content.v1.Modloader
|
||||
}
|
||||
|
||||
async function uploadLocalModpackWithSoftOverride() {
|
||||
const picked = await filePicker.pickModpackFile()
|
||||
if (!picked?.file) return false
|
||||
|
||||
const handle = client.kyros.content_v1.uploadModpackFile(
|
||||
worldId.value!,
|
||||
picked.file,
|
||||
{ known: {} },
|
||||
{ softOverride: true },
|
||||
)
|
||||
await uploadProgressModal.value!.track(handle)
|
||||
emit('reinstall')
|
||||
await invalidateServerState()
|
||||
return true
|
||||
}
|
||||
|
||||
provideInstallationSettings({
|
||||
closeSettings: serverSettings.closeModal,
|
||||
onGameVersionHover: handleGameVersionHover,
|
||||
@@ -612,18 +628,8 @@ provideInstallationSettings({
|
||||
if (!modpack.value) return
|
||||
if (modpack.value.spec.platform === 'local_file') {
|
||||
debug('reinstallModpack: local file, opening file picker')
|
||||
const picked = await filePicker.pickModpackFile()
|
||||
if (!picked?.file) return
|
||||
try {
|
||||
const handle = client.kyros.content_v1.uploadModpackFile(
|
||||
worldId.value!,
|
||||
picked.file,
|
||||
{ known: {} },
|
||||
{ softOverride: true },
|
||||
)
|
||||
await uploadProgressModal.value!.track(handle)
|
||||
emit('reinstall')
|
||||
invalidateServerState()
|
||||
await uploadLocalModpackWithSoftOverride()
|
||||
} catch (err) {
|
||||
emit('reinstall-failed')
|
||||
addNotification({
|
||||
@@ -664,6 +670,21 @@ provideInstallationSettings({
|
||||
}
|
||||
},
|
||||
|
||||
async swapModpack() {
|
||||
if (setupActionDisabled.value) return
|
||||
if (modpack.value?.spec.platform !== 'local_file') return
|
||||
debug('swapModpack: local file, opening file picker')
|
||||
try {
|
||||
await uploadLocalModpackWithSoftOverride()
|
||||
} catch (err) {
|
||||
emit('reinstall-failed')
|
||||
addNotification({
|
||||
type: 'error',
|
||||
text: err instanceof Error ? err.message : formatMessage(messages.failedToChangeVersion),
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
async unlinkModpack() {
|
||||
if (setupActionDisabled.value) return
|
||||
debug('unlinkModpack: called')
|
||||
|
||||
@@ -10,7 +10,7 @@ export interface PickedFile {
|
||||
}
|
||||
|
||||
export interface PickedModpackFile extends Omit<PickedFile, 'file'> {
|
||||
/** Only present for upload flows; native imports avoid copying huge packs into the webview heap. */
|
||||
/** Only present for upload flows; native imports avoid copying huge packs into the browser heap. */
|
||||
file?: File
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user