Skip to content

Commit

Permalink
Fix: Support S3 path connection
Browse files Browse the repository at this point in the history
  • Loading branch information
ollm committed Apr 1, 2024
1 parent 20258ff commit ec1340d
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 5 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),

##### 🚀 New Features

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

##### 🐛 Bug Fixes

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


## [v1.2.0](https://github.com/ollm/OpenComic/releases/tag/v1.2.0) (29-03-2024)
Expand Down
2 changes: 1 addition & 1 deletion scripts/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ function rand(min = 0, max = 10000000)
return Math.floor(Math.random() * (max - min + 1)) + min;
}

function extract(code, string, value)
function extract(code, string, value = 1)
{
string = string.match(code);
return (string !== null && typeof string[value] != 'undefined') ? string[value] : '';
Expand Down
21 changes: 18 additions & 3 deletions scripts/server-client.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@ function fixPath(path)
return path.replace(/^([a-z0-9]+)\:[\/\\]{1,2}/, '$1:'+p.sep+p.sep);
}

function isDomain(host)
{
return /\./.test(host) ? true : false;
}

var serverLastError = false;

var closeServersST = {};
Expand Down Expand Up @@ -1213,9 +1218,19 @@ var client = function(path) {

try
{
let client = {
region: serverInfo.host,
};
let client = {};

if(isDomain(serverInfo.host))
{
client.endpoint = 'https://'+serverInfo.host;
client.forcePathStyle = true;
client.s3BucketEndpoint = true;
client.region = app.extract(/^([^\/\\:\.]{3,})/, serverInfo.host) || app.extract(/^[^\/\\:\.]+\.([^\/\\:\.]{3,})/, serverInfo.host);
}
else
{
client.region = serverInfo.host;
}

if(serverInfo.user || serverInfo.pass) client.credentials = {}
if(serverInfo.user) client.credentials.accessKeyId = serverInfo.user;
Expand Down

0 comments on commit ec1340d

Please sign in to comment.