fix curseforge provider, general provider refactoring
This commit is contained in:
parent
f4a9e82f4b
commit
976dbbda4a
1 changed files with 7 additions and 8 deletions
|
@ -17,19 +17,19 @@ export abstract class Provider {
|
|||
public hashFormat: string,
|
||||
) {}
|
||||
|
||||
abstract getDownloadUrl(): Promise<Resource>;
|
||||
abstract get downloadUrl(): Resource;
|
||||
}
|
||||
|
||||
export class UrlProvider extends Provider {
|
||||
constructor(
|
||||
public hash: string,
|
||||
public hashFormat: string,
|
||||
public url: string,
|
||||
private url: string,
|
||||
) {
|
||||
super(hash, hashFormat);
|
||||
}
|
||||
|
||||
async getDownloadUrl(): Promise<Resource> {
|
||||
get downloadUrl(): Resource {
|
||||
return new Resource(this.url);
|
||||
}
|
||||
}
|
||||
|
@ -71,11 +71,10 @@ export class CurseForgeProvider extends Provider {
|
|||
super(hash, hashFormat);
|
||||
}
|
||||
|
||||
async getDownloadUrl(): Promise<Resource> {
|
||||
// const mod = await CURSE_CLIENT.getMod(this.projectId);
|
||||
// const file = await mod.getFile(this.fileId);
|
||||
// return new Resource(await file.getDownloadURL());
|
||||
return new Resource("https://google.com/search?q=curseforge+sucks"); // TODO: figure this out, i hate curseforge
|
||||
get downloadUrl(): Resource {
|
||||
return new Resource(
|
||||
`https://www.curseforge.com/api/v1/mods/${this.projectId}/files/${this.fileId}/download`,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Reference in a new issue