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");
S3ClientOptions s3ClientOptions = S3ClientOptions.builder().build();
if (!endpoint.contains(getResources().getString(R.string.aws_endpoint))) {
s3ClientOptions.setPathStyleAccess(true);
}
s3ClientOptions.setPathStyleAccess(pathstyle.isChecked());
myCredentials = new BasicAWSCredentials(username, password);
s3client = new AmazonS3Client(myCredentials, region);
s3client.setEndpoint(endpoint);

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -24,7 +24,7 @@ import java.util.Date;
public class Share extends AppCompatActivity {
String username, password, endpoint, bucket, object, location, title;
boolean mediafile;
boolean mediafile, style;
Region region;
S3ClientOptions s3ClientOptions;
AWSCredentials myCredentials;
@ -84,6 +84,7 @@ public class Share extends AppCompatActivity {
password = getIntent().getStringExtra("password");
bucket = getIntent().getStringExtra("bucket");
location = getIntent().getStringExtra("region");
style = getIntent().getBooleanExtra("style", false);
object = getIntent().getStringExtra("object");
mediafile = getIntent().getBooleanExtra("mediafile", false);
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();
}
s3client.setEndpoint(endpoint);
if (!endpoint.contains(getResources().getString(R.string.aws_endpoint))) {
s3ClientOptions.setPathStyleAccess(true);
}
s3ClientOptions.setPathStyleAccess(style);
s3client.setS3ClientOptions(s3ClientOptions);
share.setOnClickListener(new View.OnClickListener(){
@Override

View file

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

View file

@ -1,6 +1,5 @@
<resources>
<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="pdf_reader" translatable="false">https://office.asgardius.company/pdfjs</string>
<string name="pdf_reader_notready">You need to setup a pdf.js server</string>