unset region per user request

This commit is contained in:
fyears 2024-01-13 19:37:58 +08:00
parent 29a3c76b4e
commit 942e54961e
5 changed files with 10 additions and 11 deletions

View File

@ -163,7 +163,7 @@
"settings_s3_prod3": "Configuring CORS", "settings_s3_prod3": "Configuring CORS",
"settings_s3_endpoint": "Endpoint", "settings_s3_endpoint": "Endpoint",
"settings_s3_region": "Region", "settings_s3_region": "Region",
"settings_s3_region_desc": "If you are not sure what to enter, you could try the value: us-east-1", "settings_s3_region_desc": "If you are not sure what to enter, you could try the value: us-east-1 . If you leave it empty, the client will try to ignore this setting.",
"settings_s3_accesskeyid": "Access Key ID", "settings_s3_accesskeyid": "Access Key ID",
"settings_s3_accesskeyid_desc": "Access key ID. Attention: Access key ID and other info are saved locally.", "settings_s3_accesskeyid_desc": "Access key ID. Attention: Access key ID and other info are saved locally.",
"settings_s3_secretaccesskey": "Secret Access Key", "settings_s3_secretaccesskey": "Secret Access Key",

View File

@ -163,7 +163,7 @@
"settings_s3_prod3": "设置 CORS", "settings_s3_prod3": "设置 CORS",
"settings_s3_endpoint": "服务地址Endpoint", "settings_s3_endpoint": "服务地址Endpoint",
"settings_s3_region": "区域Region", "settings_s3_region": "区域Region",
"settings_s3_region_desc": "如果您不知道这个值填什么,可以尝试填写此默认值us-east-1", "settings_s3_region_desc": "如果您不知道这个值填什么,可以尝试填写us-east-1。如果您不填写,客户端会尝试不设置此选项。",
"settings_s3_accesskeyid": "Access Key ID", "settings_s3_accesskeyid": "Access Key ID",
"settings_s3_accesskeyid_desc": "Access key ID。注意access key ID 和其它信息都会在本地保存。", "settings_s3_accesskeyid_desc": "Access key ID。注意access key ID 和其它信息都会在本地保存。",
"settings_s3_secretaccesskey": "Secret Access Key", "settings_s3_secretaccesskey": "Secret Access Key",

View File

@ -163,7 +163,7 @@
"settings_s3_prod3": "設定 CORS", "settings_s3_prod3": "設定 CORS",
"settings_s3_endpoint": "服務地址Endpoint", "settings_s3_endpoint": "服務地址Endpoint",
"settings_s3_region": "區域Region", "settings_s3_region": "區域Region",
"settings_s3_region_desc": "如果您不知道這個值填什麼,可以嘗試填寫此預設值us-east-1", "settings_s3_region_desc": "如果您不知道這個值填什麼,可以嘗試填寫us-east-1。如果您不填寫,客戶端會嘗試不設定此選項。",
"settings_s3_accesskeyid": "Access Key ID", "settings_s3_accesskeyid": "Access Key ID",
"settings_s3_accesskeyid_desc": "Access key ID。注意access key ID 和其它資訊都會在本地儲存。", "settings_s3_accesskeyid_desc": "Access key ID。注意access key ID 和其它資訊都會在本地儲存。",
"settings_s3_secretaccesskey": "Secret Access Key", "settings_s3_secretaccesskey": "Secret Access Key",

View File

@ -277,7 +277,7 @@ export const getS3Client = (s3Config: S3Config) => {
if (VALID_REQURL && s3Config.bypassCorsLocally) { if (VALID_REQURL && s3Config.bypassCorsLocally) {
s3Client = new S3Client({ s3Client = new S3Client({
region: s3Config.s3Region, region: s3Config.s3Region !== "" ? s3Config.s3Region : undefined,
endpoint: endpoint, endpoint: endpoint,
forcePathStyle: s3Config.forcePathStyle, forcePathStyle: s3Config.forcePathStyle,
credentials: { credentials: {
@ -288,7 +288,7 @@ export const getS3Client = (s3Config: S3Config) => {
}); });
} else { } else {
s3Client = new S3Client({ s3Client = new S3Client({
region: s3Config.s3Region, region: s3Config.s3Region !== "" ? s3Config.s3Region : undefined,
endpoint: endpoint, endpoint: endpoint,
forcePathStyle: s3Config.forcePathStyle, forcePathStyle: s3Config.forcePathStyle,
credentials: { credentials: {

View File

@ -1015,13 +1015,13 @@ export class RemotelySaveSettingTab extends PluginSettingTab {
.setDesc(t("settings_s3_accuratemtime_desc")) .setDesc(t("settings_s3_accuratemtime_desc"))
.addDropdown((dropdown) => { .addDropdown((dropdown) => {
dropdown dropdown
.addOption("disable", t("disable")) .addOption("disable", t("disable"))
.addOption("enable", t("enable")); .addOption("enable", t("enable"));
dropdown dropdown
.setValue(`${ .setValue(
this.plugin.settings.s3.useAccurateMTime ? "enable" : "disable" `${this.plugin.settings.s3.useAccurateMTime ? "enable" : "disable"}`
}`) )
.onChange(async (val) => { .onChange(async (val) => {
if (val === "enable") { if (val === "enable") {
this.plugin.settings.s3.useAccurateMTime = true; this.plugin.settings.s3.useAccurateMTime = true;
@ -1032,7 +1032,6 @@ export class RemotelySaveSettingTab extends PluginSettingTab {
}); });
}); });
let newS3RemotePrefix = this.plugin.settings.s3.remotePrefix || ""; let newS3RemotePrefix = this.plugin.settings.s3.remotePrefix || "";
new Setting(s3Div) new Setting(s3Div)
.setName(t("settings_remoteprefix")) .setName(t("settings_remoteprefix"))