6 Commits

Author SHA1 Message Date
Privacy_Dragon
bd1dbb645e Update StartActivity.java 2024-01-23 16:22:21 +01:00
Privacy_Dragon
a8f1849710 Update HandlerActivity.java
Change quotation marks for password.
2024-01-23 16:20:03 +01:00
Privacy_Dragon
f79d9300ed Update README.md 2023-08-25 16:08:19 +02:00
Privacy_Dragon
78b7654b8d Merge pull request #5 from Poussinou/patch-1
Update README.md
2023-05-08 21:26:05 +02:00
Poussinou
e55426bc90 Update README.md 2023-05-02 12:27:57 +08:00
Privacy_Dragon
5c8b038a99 Fix the fix 2023-01-19 20:13:24 +01:00
14 changed files with 58 additions and 60 deletions

View File

@@ -1,28 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="deploymentTargetDropDown"> <component name="deploymentTargetDropDown">
<runningDeviceTargetSelectedWithDropDown>
<Target>
<type value="RUNNING_DEVICE_TARGET" />
<deviceKey>
<Key>
<type value="VIRTUAL_DEVICE_PATH" />
<value value="$USER_HOME$/.android/avd/Pixel_5_API_26.avd" />
</Key>
</deviceKey>
</Target>
</runningDeviceTargetSelectedWithDropDown>
<targetSelectedWithDropDown> <targetSelectedWithDropDown>
<Target> <Target>
<type value="QUICK_BOOT_TARGET" /> <type value="QUICK_BOOT_TARGET" />
<deviceKey> <deviceKey>
<Key> <Key>
<type value="VIRTUAL_DEVICE_PATH" /> <type value="VIRTUAL_DEVICE_PATH" />
<value value="$USER_HOME$/.android/avd/Pixel_5_API_26.avd" /> <value value="$USER_HOME$/.android/avd/Pixel_2_API_24.avd" />
</Key> </Key>
</deviceKey> </deviceKey>
</Target> </Target>
</targetSelectedWithDropDown> </targetSelectedWithDropDown>
<timeTargetWasSelectedWithDropDown value="2023-01-18T19:46:02.696157Z" /> <timeTargetWasSelectedWithDropDown value="2023-01-19T17:01:06.009496Z" />
</component> </component>
</project> </project>

2
.idea/gradle.xml generated
View File

@@ -7,13 +7,13 @@
<option name="testRunner" value="GRADLE" /> <option name="testRunner" value="GRADLE" />
<option name="distributionType" value="DEFAULT_WRAPPED" /> <option name="distributionType" value="DEFAULT_WRAPPED" />
<option name="externalProjectPath" value="$PROJECT_DIR$" /> <option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="gradleJvm" value="11" />
<option name="modules"> <option name="modules">
<set> <set>
<option value="$PROJECT_DIR$" /> <option value="$PROJECT_DIR$" />
<option value="$PROJECT_DIR$/app" /> <option value="$PROJECT_DIR$/app" />
</set> </set>
</option> </option>
<option name="resolveModulePerSourceSet" value="false" />
</GradleProjectSettings> </GradleProjectSettings>
</option> </option>
</component> </component>

2
.idea/misc.xml generated
View File

@@ -11,7 +11,7 @@
</map> </map>
</option> </option>
</component> </component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="true" project-jdk-name="Android Studio default JDK" project-jdk-type="JavaSDK"> <component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="true" project-jdk-name="11" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" /> <output url="file://$PROJECT_DIR$/build/classes" />
</component> </component>
<component name="ProjectType"> <component name="ProjectType">

View File

@@ -5,7 +5,13 @@ It can also open links to userpages of Bookwyrm users and it can scan ISBN codes
This application works on: Android 6 and above. This application works on: Android 6 and above.
And if you want to know, I am [`@StoryDragon@wyrms.de`](https://wyrms.de/user/storydragon) on BookWyrm. And if you want to know, I am [`@StoryDragon@books.storydragon.nl`](https://books.storydragon.nl/user/storydragon) on BookWyrm.
For the ISBN-scanning I use the library zxing-android-embedded. For the ISBN-scanning I use the library zxing-android-embedded.
The barcode icon that is added for instances that do not have ISBN-scanning by default comes from the Remix Icon project. The barcode icon that is added for instances that do not have ISBN-scanning by default comes from the Remix Icon project.
[<img src="https://fdroid.gitlab.io/artwork/badge/get-it-on.png"
alt="Get it on F-Droid"
height="80">](https://f-droid.org/packages/nl.privacydragon.bookwyrm/)
Or download the latest APK from the [Releases Section](https://github.com/PrivacyDragon/Bookwyrm_Android/releases/latest).

View File

@@ -8,9 +8,9 @@ android {
defaultConfig { defaultConfig {
applicationId "nl.privacydragon.bookwyrm" applicationId "nl.privacydragon.bookwyrm"
minSdk 23 minSdk 23
targetSdk 31 targetSdk 33
versionCode 10 versionCode 11
versionName "1.3.3" versionName "1.3.4"
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner' testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
} }
@@ -25,6 +25,7 @@ android {
sourceCompatibility JavaVersion.VERSION_1_8 sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8
} }
namespace 'nl.privacydragon.bookwyrm'
} }
dependencies { dependencies {

Binary file not shown.

Binary file not shown.

View File

@@ -11,8 +11,8 @@
"type": "SINGLE", "type": "SINGLE",
"filters": [], "filters": [],
"attributes": [], "attributes": [],
"versionCode": 10, "versionCode": 11,
"versionName": "1.3.3", "versionName": "1.3.4",
"outputFile": "app-release.apk" "outputFile": "app-release.apk"
} }
], ],

View File

@@ -1,7 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android">
xmlns:tools="http://schemas.android.com/tools"
package="nl.privacydragon.bookwyrm">
<uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.CAMERA" /> <uses-permission android:name="android.permission.CAMERA" />

View File

@@ -179,8 +179,8 @@ public class HandlerActivity extends AppCompatActivity {
LoadIndicator.setVisibility(View.GONE); LoadIndicator.setVisibility(View.GONE);
myWebView.setVisibility(View.VISIBLE); myWebView.setVisibility(View.VISIBLE);
view.loadUrl("javascript:(function() { document.getElementById('id_password').value = '" + passw + "'; ;})()"); view.loadUrl("javascript:(function() { document.getElementById('id_password').value = `" + passw + "`; ;})()");
view.loadUrl("javascript:(function() { document.getElementById('id_localname').value = '" + name + "'; ;})()"); view.loadUrl("javascript:(function() { document.getElementById('id_localname').value = `" + name + "`; ;})()");
view.loadUrl("javascript:(function() { if (window.location.href == '" + finalToGoServer + "' && !/(review|generatednote|quotation|comment)/i.test(window.location.href)) { document.getElementsByName(\"login\")[0].submit();} ;})()"); view.loadUrl("javascript:(function() { if (window.location.href == '" + finalToGoServer + "' && !/(review|generatednote|quotation|comment)/i.test(window.location.href)) { document.getElementsByName(\"login\")[0].submit();} ;})()");
view.loadUrl("javascript:(function() { if (window.location.href == 'https://" + server + "') { document.getElementsByName(\"login\")[0].submit();} ;})()"); view.loadUrl("javascript:(function() { if (window.location.href == 'https://" + server + "') { document.getElementsByName(\"login\")[0].submit();} ;})()");
view.loadUrl("javascript:(function() { if (/(review|generatednote|quotation|comment)/i.test(window.location.href)) {" + view.loadUrl("javascript:(function() { if (/(review|generatednote|quotation|comment)/i.test(window.location.href)) {" +
@@ -256,7 +256,6 @@ public class HandlerActivity extends AppCompatActivity {
intentIntegrator.setPrompt("SCAN"); intentIntegrator.setPrompt("SCAN");
intentIntegrator.setBarcodeImageEnabled(false); intentIntegrator.setBarcodeImageEnabled(false);
intentIntegrator.initiateScan(); intentIntegrator.initiateScan();
//return "blup"; //return "blup";
//return "bla"; //return "bla";
} }
@@ -269,8 +268,14 @@ public class HandlerActivity extends AppCompatActivity {
Toast.makeText(this, "cancelled", Toast.LENGTH_SHORT).show(); Toast.makeText(this, "cancelled", Toast.LENGTH_SHORT).show();
} else { } else {
Log.d("MainActivity", "Scanned"); Log.d("MainActivity", "Scanned");
myWebView.loadUrl("Javascript:(function() {document.getElementById('tour-search').value = " + Result.getContents() + ";" + "document.getElementById('search_input').value = " + Result.getContents() + ";" + myWebView.loadUrl("Javascript:(function() {" +
"document.getElementsByTagName('form')[0].submit(); ;})()"); "try {" +
"document.getElementById('tour-search').value = " + Result.getContents() + ";" +
"} catch {" +
"document.getElementById('search_input').value = " + Result.getContents() + ";" +
"}" +
"document.getElementsByTagName('form')[0].submit();" +
";})()");
LoadIndicator.setVisibility(View.VISIBLE); LoadIndicator.setVisibility(View.VISIBLE);
} }

View File

@@ -44,7 +44,7 @@ public class MainActivity extends AppCompatActivity {
SharedPreferences sharedPref = MainActivity.this.getSharedPreferences(getString(R.string.server), Context.MODE_PRIVATE); SharedPreferences sharedPref = MainActivity.this.getSharedPreferences(getString(R.string.server), Context.MODE_PRIVATE);
String defaultValue = "none"; String defaultValue = "none";
String server = sharedPref.getString(getString(R.string.server), defaultValue); String server = sharedPref.getString(getString(R.string.server), defaultValue);
if (server != "none") { if (!"none".equals(server)) {
startActivity(new Intent(MainActivity.this, nl.privacydragon.bookwyrm.StartActivity.class)); startActivity(new Intent(MainActivity.this, nl.privacydragon.bookwyrm.StartActivity.class));
} }
} }
@@ -54,8 +54,9 @@ public class MainActivity extends AppCompatActivity {
String ALLOWED_CHARACTERS ="0123456789qwertyuiopasdfghjklzxcvbnm!@#$%^&*()_+=][{}"; String ALLOWED_CHARACTERS ="0123456789qwertyuiopasdfghjklzxcvbnm!@#$%^&*()_+=][{}";
final Random random=new Random(); final Random random=new Random();
final StringBuilder sb=new StringBuilder(12); final StringBuilder sb=new StringBuilder(12);
for(int i = 0; i< 12; ++i) for(int i = 0; i< 12; ++i) {
sb.append(ALLOWED_CHARACTERS.charAt(random.nextInt(ALLOWED_CHARACTERS.length()))); sb.append(ALLOWED_CHARACTERS.charAt(random.nextInt(ALLOWED_CHARACTERS.length())));
}
return sb.toString(); return sb.toString();
} }

View File

@@ -88,48 +88,35 @@ public class StartActivity extends AppCompatActivity {
//Then, load it. or something. To make sure that it can be used. //Then, load it. or something. To make sure that it can be used.
try { try {
keyStore.load(null); keyStore.load(null);
} catch (CertificateException e) { } catch (CertificateException | IOException | NoSuchAlgorithmException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} catch (NoSuchAlgorithmException e) {
e.printStackTrace(); e.printStackTrace();
} }
//Next, retrieve the key to be used for the decryption. //Next, retrieve the key to be used for the decryption.
Key DragonLikeKey = null; Key DragonLikeKey = null;
try { try {
DragonLikeKey = keyStore.getKey("BookWyrm", null); DragonLikeKey = keyStore.getKey("BookWyrm", null);
} catch (KeyStoreException e) { } catch (KeyStoreException | NoSuchAlgorithmException | UnrecoverableKeyException e) {
e.printStackTrace();
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
} catch (UnrecoverableKeyException e) {
e.printStackTrace(); e.printStackTrace();
} }
//Do something with getting the/a cipher or something. //Do something with getting the/a cipher or something.
Cipher c = null; Cipher c = null;
try { try {
c = Cipher.getInstance("AES/GCM/NoPadding"); c = Cipher.getInstance("AES/GCM/NoPadding");
} catch (NoSuchAlgorithmException e) { } catch (NoSuchAlgorithmException | NoSuchPaddingException e) {
e.printStackTrace();
} catch (NoSuchPaddingException e) {
e.printStackTrace(); e.printStackTrace();
} }
//And then initiating the cipher, so it can be used. //And then initiating the cipher, so it can be used.
try { try {
assert c != null;
c.init(Cipher.DECRYPT_MODE, DragonLikeKey, new GCMParameterSpec(128, codeMagic.getBytes())); c.init(Cipher.DECRYPT_MODE, DragonLikeKey, new GCMParameterSpec(128, codeMagic.getBytes()));
} catch (InvalidAlgorithmParameterException e) { } catch (InvalidAlgorithmParameterException | InvalidKeyException e) {
e.printStackTrace();
} catch (InvalidKeyException e) {
e.printStackTrace(); e.printStackTrace();
} }
//Decrypt the password! //Decrypt the password!
byte[] truePass = null; byte[] truePass = null;
try { try {
truePass = c.doFinal(Base64.decode(pass, Base64.DEFAULT)); truePass = c.doFinal(Base64.decode(pass, Base64.DEFAULT));
} catch (BadPaddingException e) { } catch (BadPaddingException | IllegalBlockSizeException e) {
e.printStackTrace();
} catch (IllegalBlockSizeException e) {
e.printStackTrace(); e.printStackTrace();
} }
//Convert the decrypted password back to a string. //Convert the decrypted password back to a string.
@@ -141,8 +128,8 @@ public class StartActivity extends AppCompatActivity {
LoadIndicator.setVisibility(View.GONE); LoadIndicator.setVisibility(View.GONE);
myWebView.setVisibility(View.VISIBLE); myWebView.setVisibility(View.VISIBLE);
view.loadUrl("javascript:(function() { document.getElementById('id_password_confirm').value = '" + passw + "'; ;})()"); view.loadUrl("javascript:(function() { document.getElementById('id_password_confirm').value = `" + passw + "`; ;})()");
view.loadUrl("javascript:(function() { document.getElementById('id_localname_confirm').value = '" + name + "'; ;})()"); view.loadUrl("javascript:(function() { document.getElementById('id_localname_confirm').value = `" + name + "`; ;})()");
view.loadUrl("javascript:(function() { if (window.location.href == 'https://" + server + "/login') { document.getElementsByName(\"login-confirm\")[0].submit();} ;})()"); view.loadUrl("javascript:(function() { if (window.location.href == 'https://" + server + "/login') { document.getElementsByName(\"login-confirm\")[0].submit();} ;})()");
view.loadUrl("javascript:(function() { " + view.loadUrl("javascript:(function() { " +
"if (document.querySelectorAll(\"[data-modal-open]\")[0]) {" + "if (document.querySelectorAll(\"[data-modal-open]\")[0]) {" +
@@ -177,7 +164,7 @@ public class StartActivity extends AppCompatActivity {
} }
IntentIntegrator intentIntegrator = new IntentIntegrator(StartActivity.this); IntentIntegrator intentIntegrator = new IntentIntegrator(StartActivity.this);
intentIntegrator.setDesiredBarcodeFormats(intentIntegrator.EAN_13); intentIntegrator.setDesiredBarcodeFormats(IntentIntegrator.EAN_13);
intentIntegrator.setBeepEnabled(false); intentIntegrator.setBeepEnabled(false);
intentIntegrator.setCameraId(0); intentIntegrator.setCameraId(0);
intentIntegrator.setPrompt("SCAN ISBN"); intentIntegrator.setPrompt("SCAN ISBN");
@@ -196,8 +183,14 @@ public class StartActivity extends AppCompatActivity {
Toast.makeText(this, "cancelled", Toast.LENGTH_SHORT).show(); Toast.makeText(this, "cancelled", Toast.LENGTH_SHORT).show();
} else { } else {
Log.d("MainActivity", "Scanned"); Log.d("MainActivity", "Scanned");
myWebView.loadUrl("Javascript:(function() {document.getElementById('tour-search').value = " + Result.getContents() + ";" + "document.getElementById('search_input').value = " + Result.getContents() + ";" + myWebView.loadUrl("Javascript:(function() {" +
"document.getElementsByTagName('form')[0].submit(); ;})()"); "try {" +
"document.getElementById('tour-search').value = " + Result.getContents() + ";" +
"} catch {" +
"document.getElementById('search_input').value = " + Result.getContents() + ";" +
"}" +
"document.getElementsByTagName('form')[0].submit();" +
";})()");
LoadIndicator.setVisibility(View.VISIBLE); LoadIndicator.setVisibility(View.VISIBLE);
} }

View File

@@ -0,0 +1,5 @@
The same as release 1.3.3, but not the one bug is actually fixed for real...
* Fixed a bug with the barcode scanning. Now you can scan barcodes again.
* Dependencies have been updated to newest versions.
* More Bookwyrm instances have been added.

View File

@@ -1,6 +1,6 @@
#Mon Feb 14 18:09:26 CET 2022 #Mon Feb 14 18:09:26 CET 2022
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip
distributionPath=wrapper/dists distributionPath=wrapper/dists
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME