Merge pull request 'videofix' (#9) from videofix into main

Reviewed-on: https://patrice.asgardius.company/gitea/asgardius/s3manager/pulls/9
This commit is contained in:
Page Asgardius 2022-10-03 18:40:08 -07:00
commit b7d4dd8677
9 changed files with 66 additions and 12 deletions

View file

@ -31,7 +31,19 @@ This app is a work in progress, so it have some bugs that need to be fixed
You need to setup a pdf.js server to use pdf viewer. Just download latest version from official website and upload to any web server with ssl on same root domain than S3 server (can be same subdomain or a different one). Then set url to pdfjs root folder like https://example.com/pdfjs-dist
Steps to joining to Google Play Alpha testing channel are available at https://forum.asgardius.company/d/1-asgardius-s3-manager-testing
[<img src="app-store-badges/fdroid.png"
alt="Get it on F-Droid"
height="80">](https://f-droid.org/packages/asgardius.page.s3manager/)
[<img src="app-store-badges/play-store.png"
alt="Get it on Google Play"
height="80">](https://play.google.com/store/apps/details?id=asgardius.page.s3manager)
F-droid release may take a few days to get updated [More info here](https://www.f-droid.org/en/docs/FAQ_-_App_Developers/#ive-published-a-new-release-why-is-it-not-in-the-repository)
[Steps to joining to Google Play Alpha testing channel are available here](https://forum.asgardius.company/d/1-asgardius-s3-manager-testing)
You can get help at https://forum.asgardius.company/t/s3-manager
Supported languages

BIN
app-store-badges/fdroid.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

View file

@ -9,8 +9,8 @@ android {
applicationId "asgardius.page.s3manager"
minSdk 24
targetSdk 33
versionCode 18
versionName "0.1.16"
versionCode 19
versionName "0.1.17"
setProperty("archivesBaseName", "s3-manager-$versionName")
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

View file

@ -98,6 +98,7 @@ public class MainActivity extends AppCompatActivity {
if (db != null) {
// Database Queries
try {
//This retrieves credentials from selected account
String query = "SELECT endpoint, username, password, region, pdfendpoint FROM account where id=\""+ Name.get(position).toString()+ "\"";
Cursor cursor = db.rawQuery(query,null);
if (cursor.moveToNext()){
@ -107,6 +108,7 @@ public class MainActivity extends AppCompatActivity {
location = cursor.getString(3);
pdfendpoint = cursor.getString(4);
db.close();
//This launch file explorer using selected account
explorer();
}
} catch (Exception e) {
@ -132,6 +134,7 @@ public class MainActivity extends AppCompatActivity {
if (menuItem.getTitle() == getResources().getString(R.string.accountedit_button)) {
try {
db = dbHelper.getWritableDatabase();
//This retrieves credentials from selected account
String query = "SELECT id, endpoint, username, password, region, pdfendpoint FROM account where id=\""+ Name.get(position).toString()+ "\"";
System.out.println(query);
Cursor cursor = db.rawQuery(query,null);
@ -144,6 +147,7 @@ public class MainActivity extends AppCompatActivity {
pdfendpoint = cursor.getString(5);
}
db.close();
//This launch account editor
addaccount(true);
//Toast.makeText(MainActivity.this, "This feature is not yet implemented", Toast.LENGTH_SHORT).show();
} catch (Exception e) {
@ -161,7 +165,7 @@ public class MainActivity extends AppCompatActivity {
public void onClick(DialogInterface dialog, int which) {
db = dbHelper.getWritableDatabase();
if (db != null) {
// Database Queries
// This remove selected user account from local database
try {
db.execSQL("DELETE FROM account where id=\""+ Name.get(position).toString()+ "\"");
Toast.makeText(getApplicationContext(),getResources().getString(R.string.accountdel_success), Toast.LENGTH_SHORT).show();
@ -192,17 +196,18 @@ public class MainActivity extends AppCompatActivity {
}
}));
//This is to launch video playback test
//This is to add new user account
Button addaccount = (Button)findViewById(R.id.addaccount);
addaccount.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View view) {
//buttonaction
//This launch account add screen
addaccount(false);
}
});
//This is to launch file explorer test
//This is to view app credits
Button about = (Button)findViewById(R.id.about_button);
about.setOnClickListener(new View.OnClickListener(){
@Override

View file

@ -30,6 +30,8 @@ import com.amazonaws.services.s3.model.S3ObjectSummary;
import java.net.URL;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Locale;
@ -277,7 +279,14 @@ public class ObjectSelect extends AppCompatActivity {
} else if (Img.get(position).equals(R.drawable.audiofile) || Img.get(position).equals(R.drawable.videofile)) {
//load media file
try {
GeneratePresignedUrlRequest request = new GeneratePresignedUrlRequest(bucket, prefix + Name.get(position).toString());
Date expiration = new Date();
Calendar mycal = Calendar.getInstance();
mycal.setTime(expiration);
//System.out.println("today is " + mycal.getTime());
mycal.add(Calendar.HOUR, 6);
//System.out.println("Expiration date: " + mycal.getTime());
expiration = mycal.getTime();
GeneratePresignedUrlRequest request = new GeneratePresignedUrlRequest(bucket, prefix + Name.get(position).toString()).withExpiration(expiration);;
URL objectURL = s3client.generatePresignedUrl(request);
videoPlayer(objectURL.toString());
} catch (Exception e) {
@ -338,7 +347,11 @@ public class ObjectSelect extends AppCompatActivity {
//Toast.makeText(ObjectSelect.this, getResources().getString(R.string.pending_feature), Toast.LENGTH_SHORT).show();
upload();
} else if (menuItem.getTitle() == getResources().getString(R.string.create_link)) {
share(prefix + Name.get(position).toString());
if (Img.get(position).equals(R.drawable.audiofile) || Img.get(position).equals(R.drawable.videofile)) {
share(prefix + Name.get(position).toString(), true);
} else {
share(prefix + Name.get(position).toString(), false);
}
} else if (menuItem.getTitle() == getResources().getString(R.string.object_info)) {
objectInfo(prefix + Name.get(position).toString());
} else if (menuItem.getTitle() == getResources().getString(R.string.file_del)) {
@ -408,7 +421,7 @@ public class ObjectSelect extends AppCompatActivity {
}
private void share(String object) {
private void share(String object, boolean mediafile) {
Intent intent = new Intent(this, Share.class);
//treelevel ++;
@ -418,6 +431,7 @@ public class ObjectSelect extends AppCompatActivity {
intent.putExtra("bucket", bucket);
intent.putExtra("object", object);
intent.putExtra("region", location);
intent.putExtra("mediafile", mediafile);
startActivity(intent);
}

View file

@ -24,6 +24,7 @@ import java.util.Date;
public class Share extends AppCompatActivity {
String username, password, endpoint, bucket, object, location;
boolean mediafile;
Region region;
S3ClientOptions s3ClientOptions;
AWSCredentials myCredentials;
@ -32,6 +33,8 @@ public class Share extends AppCompatActivity {
EditText datepick, monthpick, yearpick, hourpick, minutepick;
int date, month, year, hour, minute;
Button share, external;
GeneratePresignedUrlRequest request;
Date expiration;
public static String URLify(String str) {
str = str.trim();
@ -80,6 +83,7 @@ public class Share extends AppCompatActivity {
bucket = getIntent().getStringExtra("bucket");
location = getIntent().getStringExtra("region");
object = getIntent().getStringExtra("object");
mediafile = getIntent().getBooleanExtra("mediafile", false);
region = Region.getRegion(location);
s3ClientOptions = S3ClientOptions.builder().build();
myCredentials = new BasicAWSCredentials(username, password);
@ -114,9 +118,9 @@ public class Share extends AppCompatActivity {
mycal.set(Calendar.HOUR, hour);
mycal.set(Calendar.MINUTE, minute);
mycal.set(Calendar.SECOND, 0);
Date expiration = mycal.getTime();
expiration = mycal.getTime();
//System.out.println(expiration);
GeneratePresignedUrlRequest request = new GeneratePresignedUrlRequest(bucket, object).withExpiration(expiration);
request = new GeneratePresignedUrlRequest(bucket, object).withExpiration(expiration);
URL objectURL = s3client.generatePresignedUrl(request);
//System.out.println(URLify(objectURL.toString()));
Intent shareIntent = new Intent(Intent.ACTION_SEND);
@ -135,7 +139,17 @@ public class Share extends AppCompatActivity {
public void onClick(View view) {
//buttonaction
try {
GeneratePresignedUrlRequest request = new GeneratePresignedUrlRequest(bucket, object);
if (mediafile) {
expiration = new Date();
mycal.setTime(expiration);
//System.out.println("today is " + mycal.getTime());
mycal.add(Calendar.HOUR, 6);
//System.out.println("Expiration date: " + mycal.getTime());
expiration = mycal.getTime();
request = new GeneratePresignedUrlRequest(bucket, object).withExpiration(expiration);
} else {
request = new GeneratePresignedUrlRequest(bucket, object);
}
URL objectURL = s3client.generatePresignedUrl(request);
//System.out.println(URLify(objectURL.toString()));
Intent shareIntent = new Intent(Intent.ACTION_SEND);

View file

@ -30,6 +30,7 @@
android:layout_weight="1"
android:focusable="true"
android:hint="@string/share_date"
android:maxLength="2"
android:inputType="date"
android:textColorHint="?attr/colorOnSecondary"
tools:ignore="MissingConstraints" />
@ -41,6 +42,7 @@
android:layout_weight="1"
android:focusable="true"
android:hint="@string/share_month"
android:maxLength="2"
android:inputType="date"
android:textColorHint="?attr/colorOnSecondary"
tools:ignore="MissingConstraints" />
@ -52,6 +54,7 @@
android:layout_weight="1"
android:focusable="true"
android:hint="@string/share_year"
android:maxLength="4"
android:inputType="date"
android:textColorHint="?attr/colorOnSecondary"
tools:ignore="MissingConstraints" />
@ -81,6 +84,7 @@
android:layout_weight="1"
android:focusable="true"
android:hint="@string/share_hour"
android:maxLength="2"
android:inputType="date"
android:textColorHint="?attr/colorOnSecondary"
tools:ignore="MissingConstraints" />
@ -92,6 +96,7 @@
android:layout_weight="1"
android:focusable="true"
android:hint="@string/share_minute"
android:maxLength="2"
android:inputType="date"
android:textColorHint="?attr/colorOnSecondary"
tools:ignore="MissingConstraints" />

View file

@ -50,3 +50,7 @@ Known not supported providers
<li>Google Cloud</li>
Please report all issues at https://forum.asgardius.company/t/s3-manager
This app has nonfreenet antifeature because its compatibility list.
You can use MinIO to have a FOSS selfhosted server to use with this app