Skip to content

Commit ec1340d

Browse files
committed
Fix: Support S3 path connection
1 parent 20258ff commit ec1340d

File tree

3 files changed

+21
-5
lines changed

3 files changed

+21
-5
lines changed

CHANGELOG.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
88

99
##### 🚀 New Features
1010

11-
- Shortcut to go next/prev chapter
11+
- Shortcut to go next/prev chapter [`20258ff`](https://github.com/ollm/OpenComic/commit/20258ff0ebf57d5a8064dec821ce745b7d9242a3)
1212

1313
##### 🐛 Bug Fixes
1414

1515
- Scroll does not work correctly when zooming and then resizing the window [`65a447c`](https://github.com/ollm/OpenComic/commit/65a447c1ce395214b1f787e5eb0824f003655f11)
16+
- Support S3 path connection
1617

1718

1819
## [v1.2.0](https://github.com/ollm/OpenComic/releases/tag/v1.2.0) (29-03-2024)

scripts/app.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ function rand(min = 0, max = 10000000)
180180
return Math.floor(Math.random() * (max - min + 1)) + min;
181181
}
182182

183-
function extract(code, string, value)
183+
function extract(code, string, value = 1)
184184
{
185185
string = string.match(code);
186186
return (string !== null && typeof string[value] != 'undefined') ? string[value] : '';

scripts/server-client.js

+18-3
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,11 @@ function fixPath(path)
7171
return path.replace(/^([a-z0-9]+)\:[\/\\]{1,2}/, '$1:'+p.sep+p.sep);
7272
}
7373

74+
function isDomain(host)
75+
{
76+
return /\./.test(host) ? true : false;
77+
}
78+
7479
var serverLastError = false;
7580

7681
var closeServersST = {};
@@ -1213,9 +1218,19 @@ var client = function(path) {
12131218

12141219
try
12151220
{
1216-
let client = {
1217-
region: serverInfo.host,
1218-
};
1221+
let client = {};
1222+
1223+
if(isDomain(serverInfo.host))
1224+
{
1225+
client.endpoint = 'https://'+serverInfo.host;
1226+
client.forcePathStyle = true;
1227+
client.s3BucketEndpoint = true;
1228+
client.region = app.extract(/^([^\/\\:\.]{3,})/, serverInfo.host) || app.extract(/^[^\/\\:\.]+\.([^\/\\:\.]{3,})/, serverInfo.host);
1229+
}
1230+
else
1231+
{
1232+
client.region = serverInfo.host;
1233+
}
12191234

12201235
if(serverInfo.user || serverInfo.pass) client.credentials = {}
12211236
if(serverInfo.user) client.credentials.accessKeyId = serverInfo.user;

0 commit comments

Comments
 (0)