style access working

This commit is contained in:
Page Asgardius 2022-12-23 11:53:23 -07:00
parent ddffa7ccfe
commit cb50a01854
10 changed files with 32 additions and 27 deletions

View file

@ -155,9 +155,7 @@ public class AccountAdd extends AppCompatActivity {
} }
region = Region.getRegion("us-east-1"); region = Region.getRegion("us-east-1");
S3ClientOptions s3ClientOptions = S3ClientOptions.builder().build(); S3ClientOptions s3ClientOptions = S3ClientOptions.builder().build();
if (!endpoint.contains(getResources().getString(R.string.aws_endpoint))) { s3ClientOptions.setPathStyleAccess(pathstyle.isChecked());
s3ClientOptions.setPathStyleAccess(true);
}
myCredentials = new BasicAWSCredentials(username, password); myCredentials = new BasicAWSCredentials(username, password);
s3client = new AmazonS3Client(myCredentials, region); s3client = new AmazonS3Client(myCredentials, region);
s3client.setEndpoint(endpoint); s3client.setEndpoint(endpoint);

View file

@ -41,6 +41,7 @@ public class BucketSelect extends AppCompatActivity {
ArrayList Img; ArrayList Img;
RecyclerView recyclerView; RecyclerView recyclerView;
String username, password, endpoint, prefix, location, file, pdfendpoint; String username, password, endpoint, prefix, location, file, pdfendpoint;
boolean style;
int treelevel; int treelevel;
Region region; Region region;
S3ClientOptions s3ClientOptions; S3ClientOptions s3ClientOptions;
@ -57,6 +58,7 @@ public class BucketSelect extends AppCompatActivity {
password = getIntent().getStringExtra("password"); password = getIntent().getStringExtra("password");
location = getIntent().getStringExtra("region"); location = getIntent().getStringExtra("region");
pdfendpoint = getIntent().getStringExtra("pdfendpoint"); pdfendpoint = getIntent().getStringExtra("pdfendpoint");
style = getIntent().getBooleanExtra("style", false);
videocache = getIntent().getIntExtra("videocache", 40); videocache = getIntent().getIntExtra("videocache", 40);
videotime = getIntent().getIntExtra("videotime", 1); videotime = getIntent().getIntExtra("videotime", 1);
buffersize = getIntent().getIntExtra("buffersize", 2000); buffersize = getIntent().getIntExtra("buffersize", 2000);
@ -64,9 +66,7 @@ public class BucketSelect extends AppCompatActivity {
setContentView(R.layout.activity_bucket_select); setContentView(R.layout.activity_bucket_select);
region = Region.getRegion("us-east-1"); region = Region.getRegion("us-east-1");
s3ClientOptions = S3ClientOptions.builder().build(); s3ClientOptions = S3ClientOptions.builder().build();
if (!endpoint.contains(getResources().getString(R.string.aws_endpoint))) { s3ClientOptions.setPathStyleAccess(style);
s3ClientOptions.setPathStyleAccess(true);
}
myCredentials = new BasicAWSCredentials(username, password); myCredentials = new BasicAWSCredentials(username, password);
s3client = new AmazonS3Client(myCredentials, region); s3client = new AmazonS3Client(myCredentials, region);
s3client.setEndpoint(endpoint); s3client.setEndpoint(endpoint);
@ -197,6 +197,7 @@ public class BucketSelect extends AppCompatActivity {
intent.putExtra("treelevel", treelevel); intent.putExtra("treelevel", treelevel);
intent.putExtra("region", location); intent.putExtra("region", location);
intent.putExtra("pdfendpoint", pdfendpoint); intent.putExtra("pdfendpoint", pdfendpoint);
intent.putExtra("style", style);
intent.putExtra("videocache", videocache); intent.putExtra("videocache", videocache);
intent.putExtra("videotime", videotime); intent.putExtra("videotime", videotime);
intent.putExtra("buffersize", buffersize); intent.putExtra("buffersize", buffersize);
@ -294,6 +295,7 @@ public class BucketSelect extends AppCompatActivity {
intent.putExtra("bucket", bucket); intent.putExtra("bucket", bucket);
intent.putExtra("prefix", prefix); intent.putExtra("prefix", prefix);
intent.putExtra("region", location); intent.putExtra("region", location);
intent.putExtra("style", style);
startActivity(intent); startActivity(intent);
} }
@ -306,6 +308,7 @@ public class BucketSelect extends AppCompatActivity {
intent.putExtra("password", password); intent.putExtra("password", password);
intent.putExtra("bucket", bucket); intent.putExtra("bucket", bucket);
intent.putExtra("region", location); intent.putExtra("region", location);
intent.putExtra("style", style);
startActivity(intent); startActivity(intent);
} }
@ -316,6 +319,7 @@ public class BucketSelect extends AppCompatActivity {
intent.putExtra("username", username); intent.putExtra("username", username);
intent.putExtra("password", password); intent.putExtra("password", password);
intent.putExtra("region", location); intent.putExtra("region", location);
intent.putExtra("style", style);
startActivity(intent); startActivity(intent);
} }

View file

@ -27,6 +27,7 @@ import java.util.List;
public class CreateBucket extends AppCompatActivity { public class CreateBucket extends AppCompatActivity {
String username, password, endpoint, bucket, location; String username, password, endpoint, bucket, location;
boolean style;
EditText bname; EditText bname;
Region region; Region region;
S3ClientOptions s3ClientOptions; S3ClientOptions s3ClientOptions;
@ -42,11 +43,10 @@ public class CreateBucket extends AppCompatActivity {
username = getIntent().getStringExtra("username"); username = getIntent().getStringExtra("username");
password = getIntent().getStringExtra("password"); password = getIntent().getStringExtra("password");
location = getIntent().getStringExtra("region"); location = getIntent().getStringExtra("region");
style = getIntent().getBooleanExtra("style", false);
region = Region.getRegion("us-east-1"); region = Region.getRegion("us-east-1");
s3ClientOptions = S3ClientOptions.builder().build(); s3ClientOptions = S3ClientOptions.builder().build();
if (!endpoint.contains(getResources().getString(R.string.aws_endpoint))) { s3ClientOptions.setPathStyleAccess(style);
s3ClientOptions.setPathStyleAccess(true);
}
myCredentials = new BasicAWSCredentials(username, password); myCredentials = new BasicAWSCredentials(username, password);
s3client = new AmazonS3Client(myCredentials, region); s3client = new AmazonS3Client(myCredentials, region);
s3client.setEndpoint(endpoint); s3client.setEndpoint(endpoint);

View file

@ -45,6 +45,7 @@ public class Downloader extends AppCompatActivity {
S3Object object; S3Object object;
boolean started = false; boolean started = false;
boolean cancel = false; boolean cancel = false;
boolean style;
long filesize = 0; long filesize = 0;
long transfered = 0; long transfered = 0;
private WifiManager.WifiLock mWifiLock; private WifiManager.WifiLock mWifiLock;
@ -65,14 +66,13 @@ public class Downloader extends AppCompatActivity {
password = getIntent().getStringExtra("password"); password = getIntent().getStringExtra("password");
bucket = getIntent().getStringExtra("bucket"); bucket = getIntent().getStringExtra("bucket");
location = getIntent().getStringExtra("region"); location = getIntent().getStringExtra("region");
style = getIntent().getBooleanExtra("style", false);
prefix = getIntent().getStringExtra("prefix"); prefix = getIntent().getStringExtra("prefix");
simpleProgressBar = (ProgressBar) findViewById(R.id.simpleProgressBar); simpleProgressBar = (ProgressBar) findViewById(R.id.simpleProgressBar);
fileDownload = (Button)findViewById(R.id.filedownload); fileDownload = (Button)findViewById(R.id.filedownload);
region = Region.getRegion(location); region = Region.getRegion(location);
s3ClientOptions = S3ClientOptions.builder().build(); s3ClientOptions = S3ClientOptions.builder().build();
if (!endpoint.contains(getResources().getString(R.string.aws_endpoint))) { s3ClientOptions.setPathStyleAccess(style);
s3ClientOptions.setPathStyleAccess(true);
}
myCredentials = new BasicAWSCredentials(username, password); myCredentials = new BasicAWSCredentials(username, password);
s3client = new AmazonS3Client(myCredentials, region); s3client = new AmazonS3Client(myCredentials, region);
s3client.setEndpoint(endpoint); s3client.setEndpoint(endpoint);

View file

@ -356,6 +356,7 @@ public class MainActivity extends AppCompatActivity {
intent.putExtra("password", password); intent.putExtra("password", password);
intent.putExtra("region", location); intent.putExtra("region", location);
intent.putExtra("pdfendpoint", pdfendpoint); intent.putExtra("pdfendpoint", pdfendpoint);
intent.putExtra("style", style);
intent.putExtra("videocache", videocache); intent.putExtra("videocache", videocache);
intent.putExtra("videotime", videotime); intent.putExtra("videotime", videotime);
intent.putExtra("buffersize", buffersize); intent.putExtra("buffersize", buffersize);

View file

@ -31,7 +31,7 @@ public class ObjectInfo extends AppCompatActivity {
AmazonS3 s3client; AmazonS3 s3client;
ProgressBar simpleProgressBar; ProgressBar simpleProgressBar;
TextView filesize, filesizeinfo, objectcount; TextView filesize, filesizeinfo, objectcount;
boolean isobject, isfolder; boolean isobject, isfolder, style;
long totalSize = 0; long totalSize = 0;
int totalItems = 0; int totalItems = 0;
ListObjectsRequest orequest; ListObjectsRequest orequest;
@ -53,6 +53,7 @@ public class ObjectInfo extends AppCompatActivity {
username = getIntent().getStringExtra("username"); username = getIntent().getStringExtra("username");
password = getIntent().getStringExtra("password"); password = getIntent().getStringExtra("password");
bucket = getIntent().getStringExtra("bucket"); bucket = getIntent().getStringExtra("bucket");
style = getIntent().getBooleanExtra("style", false);
location = getIntent().getStringExtra("region"); location = getIntent().getStringExtra("region");
object = getIntent().getStringExtra("object"); object = getIntent().getStringExtra("object");
if (object == null) { if (object == null) {
@ -69,9 +70,7 @@ public class ObjectInfo extends AppCompatActivity {
Toast.makeText(getApplicationContext(),getResources().getString(R.string.media_list_fail), Toast.LENGTH_SHORT).show(); Toast.makeText(getApplicationContext(),getResources().getString(R.string.media_list_fail), Toast.LENGTH_SHORT).show();
} }
s3client.setEndpoint(endpoint); s3client.setEndpoint(endpoint);
if (!endpoint.contains(getResources().getString(R.string.aws_endpoint))) { s3ClientOptions.setPathStyleAccess(style);
s3ClientOptions.setPathStyleAccess(true);
}
s3client.setS3ClientOptions(s3ClientOptions); s3client.setS3ClientOptions(s3ClientOptions);
Thread getInfo = new Thread(new Runnable() { Thread getInfo = new Thread(new Runnable() {

View file

@ -48,6 +48,7 @@ public class ObjectSelect extends AppCompatActivity {
//ArrayList object; //ArrayList object;
RecyclerView recyclerView; RecyclerView recyclerView;
String username, password, endpoint, bucket, prefix, location, pdfendpoint, query; String username, password, endpoint, bucket, prefix, location, pdfendpoint, query;
boolean style;
int treelevel; int treelevel;
String[] filename; String[] filename;
Region region; Region region;
@ -67,6 +68,7 @@ public class ObjectSelect extends AppCompatActivity {
bucket = getIntent().getStringExtra("bucket"); bucket = getIntent().getStringExtra("bucket");
location = getIntent().getStringExtra("region"); location = getIntent().getStringExtra("region");
pdfendpoint = getIntent().getStringExtra("pdfendpoint"); pdfendpoint = getIntent().getStringExtra("pdfendpoint");
style = getIntent().getBooleanExtra("style", false);
prefix = getIntent().getStringExtra("prefix"); prefix = getIntent().getStringExtra("prefix");
treelevel = getIntent().getIntExtra("treelevel", 0); treelevel = getIntent().getIntExtra("treelevel", 0);
videocache = getIntent().getIntExtra("videocache", 40); videocache = getIntent().getIntExtra("videocache", 40);
@ -84,9 +86,7 @@ public class ObjectSelect extends AppCompatActivity {
Toast.makeText(getApplicationContext(),getResources().getString(R.string.media_list_fail), Toast.LENGTH_SHORT).show(); Toast.makeText(getApplicationContext(),getResources().getString(R.string.media_list_fail), Toast.LENGTH_SHORT).show();
} }
s3client.setEndpoint(endpoint); s3client.setEndpoint(endpoint);
if (!endpoint.contains(getResources().getString(R.string.aws_endpoint))) { s3ClientOptions.setPathStyleAccess(style);
s3ClientOptions.setPathStyleAccess(true);
}
s3client.setS3ClientOptions(s3ClientOptions); s3client.setS3ClientOptions(s3ClientOptions);
@ -496,6 +496,7 @@ public class ObjectSelect extends AppCompatActivity {
intent.putExtra("treelevel", treelevel+1); intent.putExtra("treelevel", treelevel+1);
intent.putExtra("region", location); intent.putExtra("region", location);
intent.putExtra("pdfendpoint", pdfendpoint); intent.putExtra("pdfendpoint", pdfendpoint);
intent.putExtra("style", style);
intent.putExtra("videocache", videocache); intent.putExtra("videocache", videocache);
intent.putExtra("videotime", videotime); intent.putExtra("videotime", videotime);
intent.putExtra("buffersize", buffersize); intent.putExtra("buffersize", buffersize);
@ -516,6 +517,7 @@ public class ObjectSelect extends AppCompatActivity {
intent.putExtra("region", location); intent.putExtra("region", location);
intent.putExtra("mediafile", mediafile); intent.putExtra("mediafile", mediafile);
intent.putExtra("videotime", videotime); intent.putExtra("videotime", videotime);
intent.putExtra("style", style);
startActivity(intent); startActivity(intent);
} }
@ -531,6 +533,7 @@ public class ObjectSelect extends AppCompatActivity {
intent.putExtra("object", object); intent.putExtra("object", object);
intent.putExtra("title", title); intent.putExtra("title", title);
intent.putExtra("region", location); intent.putExtra("region", location);
intent.putExtra("style", style);
startActivity(intent); startActivity(intent);
} }
@ -641,6 +644,7 @@ public class ObjectSelect extends AppCompatActivity {
intent.putExtra("bucket", bucket); intent.putExtra("bucket", bucket);
intent.putExtra("prefix", prefix); intent.putExtra("prefix", prefix);
intent.putExtra("region", location); intent.putExtra("region", location);
intent.putExtra("style", style);
startActivity(intent); startActivity(intent);
} }
@ -653,6 +657,7 @@ public class ObjectSelect extends AppCompatActivity {
intent.putExtra("password", password); intent.putExtra("password", password);
intent.putExtra("prefix", prefix); intent.putExtra("prefix", prefix);
intent.putExtra("region", location); intent.putExtra("region", location);
intent.putExtra("style", style);
intent.putExtra("bucket", bucket); intent.putExtra("bucket", bucket);
startActivity(intent); startActivity(intent);
} }

View file

@ -24,7 +24,7 @@ import java.util.Date;
public class Share extends AppCompatActivity { public class Share extends AppCompatActivity {
String username, password, endpoint, bucket, object, location, title; String username, password, endpoint, bucket, object, location, title;
boolean mediafile; boolean mediafile, style;
Region region; Region region;
S3ClientOptions s3ClientOptions; S3ClientOptions s3ClientOptions;
AWSCredentials myCredentials; AWSCredentials myCredentials;
@ -84,6 +84,7 @@ public class Share extends AppCompatActivity {
password = getIntent().getStringExtra("password"); password = getIntent().getStringExtra("password");
bucket = getIntent().getStringExtra("bucket"); bucket = getIntent().getStringExtra("bucket");
location = getIntent().getStringExtra("region"); location = getIntent().getStringExtra("region");
style = getIntent().getBooleanExtra("style", false);
object = getIntent().getStringExtra("object"); object = getIntent().getStringExtra("object");
mediafile = getIntent().getBooleanExtra("mediafile", false); mediafile = getIntent().getBooleanExtra("mediafile", false);
videotime = getIntent().getIntExtra("videotime", 1); videotime = getIntent().getIntExtra("videotime", 1);
@ -98,9 +99,7 @@ public class Share extends AppCompatActivity {
Toast.makeText(getApplicationContext(),getResources().getString(R.string.media_list_fail), Toast.LENGTH_SHORT).show(); Toast.makeText(getApplicationContext(),getResources().getString(R.string.media_list_fail), Toast.LENGTH_SHORT).show();
} }
s3client.setEndpoint(endpoint); s3client.setEndpoint(endpoint);
if (!endpoint.contains(getResources().getString(R.string.aws_endpoint))) { s3ClientOptions.setPathStyleAccess(style);
s3ClientOptions.setPathStyleAccess(true);
}
s3client.setS3ClientOptions(s3ClientOptions); s3client.setS3ClientOptions(s3ClientOptions);
share.setOnClickListener(new View.OnClickListener(){ share.setOnClickListener(new View.OnClickListener(){
@Override @Override

View file

@ -59,6 +59,7 @@ public class Uploader extends AppCompatActivity {
Intent intent; Intent intent;
Button fileUpload; Button fileUpload;
Thread uploadFile, uploadProgress; Thread uploadFile, uploadProgress;
boolean style;
boolean started = false; boolean started = false;
long transfered = 0; long transfered = 0;
private static final long MAX_SINGLE_PART_UPLOAD_BYTES = 5 * 1024 * 1024; private static final long MAX_SINGLE_PART_UPLOAD_BYTES = 5 * 1024 * 1024;
@ -79,13 +80,12 @@ public class Uploader extends AppCompatActivity {
password = getIntent().getStringExtra("password"); password = getIntent().getStringExtra("password");
bucket = getIntent().getStringExtra("bucket"); bucket = getIntent().getStringExtra("bucket");
location = getIntent().getStringExtra("region"); location = getIntent().getStringExtra("region");
style = getIntent().getBooleanExtra("style", false);
prefix = getIntent().getStringExtra("prefix"); prefix = getIntent().getStringExtra("prefix");
fprefix = (EditText)findViewById(R.id.fprefix); fprefix = (EditText)findViewById(R.id.fprefix);
region = Region.getRegion(location); region = Region.getRegion(location);
s3ClientOptions = S3ClientOptions.builder().build(); s3ClientOptions = S3ClientOptions.builder().build();
if (!endpoint.contains(getResources().getString(R.string.aws_endpoint))) { s3ClientOptions.setPathStyleAccess(style);
s3ClientOptions.setPathStyleAccess(true);
}
myCredentials = new BasicAWSCredentials(username, password); myCredentials = new BasicAWSCredentials(username, password);
s3client = new AmazonS3Client(myCredentials, region); s3client = new AmazonS3Client(myCredentials, region);
s3client.setEndpoint(endpoint); s3client.setEndpoint(endpoint);

View file

@ -1,6 +1,5 @@
<resources> <resources>
<string name="app_name" translatable="false">S3 Manager</string> <string name="app_name" translatable="false">S3 Manager</string>
<string name="aws_endpoint" translatable="false">.amazonaws.com</string>
<string name="endpoint_url" translatable="false">https://s3.asgardius.company</string> <string name="endpoint_url" translatable="false">https://s3.asgardius.company</string>
<string name="pdf_reader" translatable="false">https://office.asgardius.company/pdfjs</string> <string name="pdf_reader" translatable="false">https://office.asgardius.company/pdfjs</string>
<string name="pdf_reader_notready">You need to setup a pdf.js server</string> <string name="pdf_reader_notready">You need to setup a pdf.js server</string>