mirror of
https://github.com/Kir-Antipov/mc-publish.git
synced 2024-11-22 08:20:58 -05:00
Added fetch
to the generic uploader options
This allows us to have better control over the behavior of a generic uploader.
This commit is contained in:
parent
dfd4e9ac5b
commit
1d6cb47d45
1 changed files with 12 additions and 0 deletions
|
@ -6,6 +6,7 @@ import { JavaVersion } from "@/utils/java";
|
|||
import { Logger, LoggingStopwatch, NULL_LOGGER } from "@/utils/logging";
|
||||
import { SecureString } from "@/utils/security";
|
||||
import { VersionType } from "@/utils/versioning";
|
||||
import { Fetch, fetch } from "@/utils/net";
|
||||
import { CurseForgeUploaderOptions } from "./curseforge/curseforge-uploader";
|
||||
import { GitHubUploaderOptions } from "./github/github-uploader";
|
||||
import { ModrinthUploaderOptions } from "./modrinth/modrinth-uploader";
|
||||
|
@ -20,6 +21,11 @@ export interface GenericPlatformUploaderOptions {
|
|||
* An optional logger that can be used for recording log messages.
|
||||
*/
|
||||
logger?: Logger;
|
||||
|
||||
/**
|
||||
* The Fetch implementation used for making HTTP requests.
|
||||
*/
|
||||
fetch?: Fetch;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -123,6 +129,11 @@ export abstract class GenericPlatformUploader<TOptions extends GenericPlatformUp
|
|||
*/
|
||||
protected readonly _logger: Logger;
|
||||
|
||||
/**
|
||||
* The Fetch implementation used for making HTTP requests.
|
||||
*/
|
||||
protected readonly _fetch: Fetch;
|
||||
|
||||
/**
|
||||
* Constructs a new {@link PlatformUploader} instance.
|
||||
*
|
||||
|
@ -130,6 +141,7 @@ export abstract class GenericPlatformUploader<TOptions extends GenericPlatformUp
|
|||
*/
|
||||
protected constructor(options?: TOptions) {
|
||||
this._logger = options?.logger || NULL_LOGGER;
|
||||
this._fetch = options?.fetch || fetch;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue