Fix the fix

This commit is contained in:
Privacy_Dragon 2023-01-19 20:13:24 +01:00
parent 4cfbee2524
commit 5c8b038a99
No known key found for this signature in database
13 changed files with 45 additions and 53 deletions

View File

@ -1,28 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<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>
<Target>
<type value="QUICK_BOOT_TARGET" />
<deviceKey>
<Key>
<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>
</deviceKey>
</Target>
</targetSelectedWithDropDown>
<timeTargetWasSelectedWithDropDown value="2023-01-18T19:46:02.696157Z" />
<timeTargetWasSelectedWithDropDown value="2023-01-19T17:01:06.009496Z" />
</component>
</project>

2
.idea/gradle.xml generated
View File

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

2
.idea/misc.xml generated
View File

@ -11,7 +11,7 @@
</map>
</option>
</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" />
</component>
<component name="ProjectType">

View File

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

Binary file not shown.

Binary file not shown.

View File

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

View File

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

View File

@ -256,7 +256,6 @@ public class HandlerActivity extends AppCompatActivity {
intentIntegrator.setPrompt("SCAN");
intentIntegrator.setBarcodeImageEnabled(false);
intentIntegrator.initiateScan();
//return "blup";
//return "bla";
}
@ -269,8 +268,14 @@ public class HandlerActivity extends AppCompatActivity {
Toast.makeText(this, "cancelled", Toast.LENGTH_SHORT).show();
} else {
Log.d("MainActivity", "Scanned");
myWebView.loadUrl("Javascript:(function() {document.getElementById('tour-search').value = " + Result.getContents() + ";" + "document.getElementById('search_input').value = " + Result.getContents() + ";" +
"document.getElementsByTagName('form')[0].submit(); ;})()");
myWebView.loadUrl("Javascript:(function() {" +
"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);
}

View File

@ -44,7 +44,7 @@ public class MainActivity extends AppCompatActivity {
SharedPreferences sharedPref = MainActivity.this.getSharedPreferences(getString(R.string.server), Context.MODE_PRIVATE);
String defaultValue = "none";
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));
}
}
@ -54,9 +54,10 @@ public class MainActivity extends AppCompatActivity {
String ALLOWED_CHARACTERS ="0123456789qwertyuiopasdfghjklzxcvbnm!@#$%^&*()_+=][{}";
final Random random=new Random();
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())));
return sb.toString();
}
return sb.toString();
}
public void LogIn(View view) throws IllegalBlockSizeException, BadPaddingException, KeyStoreException, CertificateException, IOException, NoSuchAlgorithmException, NoSuchProviderException, InvalidAlgorithmParameterException, UnrecoverableKeyException, NoSuchPaddingException, InvalidKeyException {
@ -81,7 +82,7 @@ public class MainActivity extends AppCompatActivity {
keyGenerator.init(
new KeyGenParameterSpec.Builder("BookWyrm",
KeyProperties.PURPOSE_ENCRYPT | KeyProperties.PURPOSE_DECRYPT)
.setBlockModes(KeyProperties.BLOCK_MODE_GCM) .setEncryptionPaddings(KeyProperties.ENCRYPTION_PADDING_NONE)
.setBlockModes(KeyProperties.BLOCK_MODE_GCM).setEncryptionPaddings(KeyProperties.ENCRYPTION_PADDING_NONE)
.setRandomizedEncryptionRequired(false)
.build());
keyGenerator.generateKey();

View File

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

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
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
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME