You've already forked AstralRinth
@@ -2,6 +2,8 @@ import { AbstractModule } from '../../../core/abstract-module'
|
||||
import type { UploadHandle } from '../../../types/upload'
|
||||
import type { Labrinth } from '../types'
|
||||
|
||||
const VERSION_UPLOAD_TIMEOUT_MS = 30 * 60 * 1000
|
||||
|
||||
export class LabrinthVersionsV3Module extends AbstractModule {
|
||||
public getModuleID(): string {
|
||||
return 'labrinth_versions_v3'
|
||||
@@ -199,7 +201,7 @@ export class LabrinthVersionsV3Module extends AbstractModule {
|
||||
api: 'labrinth',
|
||||
version: 3,
|
||||
formData,
|
||||
timeout: 60 * 5 * 1000,
|
||||
timeout: VERSION_UPLOAD_TIMEOUT_MS,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -284,7 +286,7 @@ export class LabrinthVersionsV3Module extends AbstractModule {
|
||||
api: 'labrinth',
|
||||
version: 2,
|
||||
formData,
|
||||
timeout: 60 * 5 * 1000,
|
||||
timeout: VERSION_UPLOAD_TIMEOUT_MS,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -122,6 +122,11 @@ export abstract class XHRUploadClient extends AbstractModrinthClient {
|
||||
|
||||
xhr.addEventListener('error', () => reject(new ModrinthApiError('Upload failed')))
|
||||
xhr.addEventListener('abort', () => reject(new ModrinthApiError('Upload cancelled')))
|
||||
xhr.addEventListener('timeout', () => reject(new ModrinthApiError('Upload timed out')))
|
||||
|
||||
if (context.options.timeout !== undefined) {
|
||||
xhr.timeout = context.options.timeout
|
||||
}
|
||||
|
||||
// build URL with params (unlike $fetch, XHR doesn't handle params automatically)
|
||||
let url = context.url
|
||||
|
||||
Reference in New Issue
Block a user