Merge branch 'Victrid-master'

This commit is contained in:
fyears 2022-03-20 23:37:45 +08:00
commit 79fb1d90d0
5 changed files with 29 additions and 1 deletions

View File

@ -15,6 +15,7 @@ export interface S3Config {
s3BucketName: string;
bypassCorsLocally?: boolean;
partsConcurrency?: number;
forcePathStyle?: boolean;
}
export interface DropboxConfig {

@ -1 +1 @@
Subproject commit 4b69d60d8956f2c2bb9e642e2524d6f2404c2e24
Subproject commit 28730585f8cef9625b2b5a2296318c1c071ff7ba

View File

@ -658,6 +658,9 @@ export default class RemotelySavePlugin extends Plugin {
if (this.settings.s3.partsConcurrency === undefined) {
this.settings.s3.partsConcurrency = 20;
}
if (this.settings.s3.forcePathStyle === undefined) {
this.settings.s3.forcePathStyle = false;
}
}
async saveSettings() {

View File

@ -155,6 +155,7 @@ export const DEFAULT_S3_CONFIG = {
s3BucketName: "",
bypassCorsLocally: true,
partsConcurrency: 20,
forcePathStyle: false,
};
export type S3ObjectType = _Object;
@ -192,6 +193,7 @@ export const getS3Client = (s3Config: S3Config) => {
const s3Client = new S3Client({
region: s3Config.s3Region,
endpoint: endpoint,
forcePathStyle: s3Config.forcePathStyle,
credentials: {
accessKeyId: s3Config.s3AccessKeyID,
secretAccessKey: s3Config.s3SecretAccessKey,
@ -203,6 +205,7 @@ export const getS3Client = (s3Config: S3Config) => {
const s3Client = new S3Client({
region: s3Config.s3Region,
endpoint: endpoint,
forcePathStyle: s3Config.forcePathStyle,
credentials: {
accessKeyId: s3Config.s3AccessKeyID,
secretAccessKey: s3Config.s3SecretAccessKey,

View File

@ -745,6 +745,27 @@ export class RemotelySaveSettingTab extends PluginSettingTab {
})
);
new Setting(s3Div)
.setName(t("settings_s3_urlstyle"))
.setDesc(t("settings_s3_urlstyle_desc"))
.addDropdown((dropdown) => {
dropdown.addOption(
"virtualHostedStyle",
"Virtual Hosted-Style (default)"
);
dropdown.addOption("pathStyle", "Path-Style");
dropdown
.setValue(
this.plugin.settings.s3.forcePathStyle
? "pathStyle"
: "virtualHostedStyle"
)
.onChange(async (val: string) => {
this.plugin.settings.s3.forcePathStyle = val === "pathStyle";
await this.plugin.saveSettings();
});
});
if (requireApiVersion(API_VER_REQURL)) {
new Setting(s3Div)
.setName(t("settings_s3_bypasscorslocally"))