upd: create usingBunnyCDN
This commit is contained in:
parent
76b0c1ce26
commit
0481b25a62
2 changed files with 8 additions and 3 deletions
|
|
@ -29,6 +29,11 @@ export class BunnyService {
|
|||
};
|
||||
}
|
||||
|
||||
@bindThis
|
||||
public usingBunnyCDN(meta: MiMeta) {
|
||||
return meta.objectStorageEndpoint && meta.objectStorageEndpoint.includes('bunnycdn.com') ? true : false;
|
||||
}
|
||||
|
||||
@bindThis
|
||||
public async upload(meta: MiMeta, path: string, input: fs.ReadStream | Buffer) {
|
||||
const client = this.getBunnyInfo(meta);
|
||||
|
|
@ -41,7 +46,7 @@ export class BunnyService {
|
|||
const data = Buffer.isBuffer(input) ? Readable.from(input) : input;
|
||||
|
||||
const agent = this.httpRequestService.getAgentByUrl(new URL(`${client.fullUrl}/${path}`), !meta.objectStorageUseProxy, true);
|
||||
|
||||
|
||||
// Seperation of path and host/domain is required here
|
||||
const options = {
|
||||
method: 'PUT',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue