mirror of
https://github.com/modrinth/code.git
synced 2026-08-25 00:55:25 +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
|
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({
|
provideInstallationSettings({
|
||||||
closeSettings: serverSettings.closeModal,
|
closeSettings: serverSettings.closeModal,
|
||||||
onGameVersionHover: handleGameVersionHover,
|
onGameVersionHover: handleGameVersionHover,
|
||||||
@@ -612,18 +628,8 @@ provideInstallationSettings({
|
|||||||
if (!modpack.value) return
|
if (!modpack.value) return
|
||||||
if (modpack.value.spec.platform === 'local_file') {
|
if (modpack.value.spec.platform === 'local_file') {
|
||||||
debug('reinstallModpack: local file, opening file picker')
|
debug('reinstallModpack: local file, opening file picker')
|
||||||
const picked = await filePicker.pickModpackFile()
|
|
||||||
if (!picked?.file) return
|
|
||||||
try {
|
try {
|
||||||
const handle = client.kyros.content_v1.uploadModpackFile(
|
await uploadLocalModpackWithSoftOverride()
|
||||||
worldId.value!,
|
|
||||||
picked.file,
|
|
||||||
{ known: {} },
|
|
||||||
{ softOverride: true },
|
|
||||||
)
|
|
||||||
await uploadProgressModal.value!.track(handle)
|
|
||||||
emit('reinstall')
|
|
||||||
invalidateServerState()
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
emit('reinstall-failed')
|
emit('reinstall-failed')
|
||||||
addNotification({
|
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() {
|
async unlinkModpack() {
|
||||||
if (setupActionDisabled.value) return
|
if (setupActionDisabled.value) return
|
||||||
debug('unlinkModpack: called')
|
debug('unlinkModpack: called')
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ export interface PickedFile {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface PickedModpackFile extends Omit<PickedFile, 'file'> {
|
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
|
file?: File
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user