mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core: storage: fix aliyun-oss support
This commit is contained in:
1 file changed
+1
-10
@@ -61,7 +61,6 @@ class RemoteStorageService {
|
|||||||
public client: S3Client;
|
public client: S3Client;
|
||||||
public error = '';
|
public error = '';
|
||||||
public bucket = 'hydro';
|
public bucket = 'hydro';
|
||||||
private replaceWithAlternativeUrlFor: Record<'user' | 'judge', (originalUrl: string) => string>;
|
|
||||||
private alternatives: Record<'user' | 'judge', S3Client> = {
|
private alternatives: Record<'user' | 'judge', S3Client> = {
|
||||||
user: null,
|
user: null,
|
||||||
judge: null,
|
judge: null,
|
||||||
@@ -93,10 +92,6 @@ class RemoteStorageService {
|
|||||||
endpoint: endPoint,
|
endpoint: endPoint,
|
||||||
...base,
|
...base,
|
||||||
});
|
});
|
||||||
this.replaceWithAlternativeUrlFor = {
|
|
||||||
user: parseAlternativeEndpointUrl(endPointForUser),
|
|
||||||
judge: parseAlternativeEndpointUrl(endPointForJudge),
|
|
||||||
};
|
|
||||||
if (/^https?:\/\//.test(endPointForUser)) {
|
if (/^https?:\/\//.test(endPointForUser)) {
|
||||||
this.alternatives.user = new S3Client({
|
this.alternatives.user = new S3Client({
|
||||||
endpoint: endPointForUser,
|
endpoint: endPointForUser,
|
||||||
@@ -210,7 +205,6 @@ class RemoteStorageService {
|
|||||||
}), {
|
}), {
|
||||||
expiresIn: noExpire ? 24 * 60 * 60 * 7 : 10 * 60,
|
expiresIn: noExpire ? 24 * 60 * 60 * 7 : 10 * 60,
|
||||||
});
|
});
|
||||||
if (useAlternativeEndpointFor) return this.replaceWithAlternativeUrlFor[useAlternativeEndpointFor](url);
|
|
||||||
return url;
|
return url;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -230,10 +224,7 @@ class RemoteStorageService {
|
|||||||
},
|
},
|
||||||
Expires: 600,
|
Expires: 600,
|
||||||
});
|
});
|
||||||
return {
|
return { url, fields };
|
||||||
url: this.replaceWithAlternativeUrlFor.user(url),
|
|
||||||
fields,
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async copy(src: string, target: string) {
|
async copy(src: string, target: string) {
|
||||||
|
|||||||
Reference in new issue
Block a user