Browse Source

Merge pull request #1 from Flowdalic/flow

Add changes by Flow
master
Paul Schaub 3 years ago
committed by GitHub
parent
commit
347e0fe022
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 16
      .gitignore
  2. 6
      README.md
  3. 1
      build.gradle
  4. 1
      src/main/java/de/vanitasvitae/omemoqrgenerator/ListViewController.java
  5. 20
      src/main/java/de/vanitasvitae/omemoqrgenerator/Main.java
  6. 5
      src/main/java/de/vanitasvitae/omemoqrgenerator/QrDisplayController.java
  7. 1
      src/main/java/de/vanitasvitae/omemoqrgenerator/Util.java

16
.gitignore

@ -1,8 +1,12 @@
.gradle/
.idea/
/.gradle/
/.idea/
*.iml
*/out
*/build/
/*.iml
/build/
out/
/out/
/.classpath
/.project
/.settings/
/bin/

6
README.md

@ -3,3 +3,9 @@ of authenticity.
![Login Screen](assets/qr_omemo_login.png)
![Main Screen](assets/qr_omemo_main.png)
# Executing the application
```bash
gradle jfxRun
```

1
build.gradle

@ -15,6 +15,7 @@ buildscript {
}
allprojects {
apply plugin: 'eclipse'
apply plugin: 'java'
apply plugin: 'javafx-gradle-plugin'
}

1
src/main/java/de/vanitasvitae/omemoqrgenerator/ListViewController.java

@ -1,6 +1,5 @@
package de.vanitasvitae.omemoqrgenerator;
import javafx.event.EventHandler;
import javafx.fxml.FXML;
import javafx.scene.control.ListView;
import javafx.scene.input.ScrollEvent;

20
src/main/java/de/vanitasvitae/omemoqrgenerator/Main.java

@ -1,24 +1,29 @@
package de.vanitasvitae.omemoqrgenerator;
import java.io.IOException;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.jivesoftware.smack.SmackConfiguration;
import org.jivesoftware.smack.packet.Presence;
import org.jivesoftware.smack.SmackException;
import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smack.tcp.XMPPTCPConnection;
import org.jivesoftware.smackx.omemo.exceptions.CorruptedOmemoKeyException;
import org.jivesoftware.smackx.omemo.internal.OmemoDevice;
import org.jivesoftware.smackx.omemo.trust.OmemoFingerprint;
import javafx.application.Application;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;
import org.jxmpp.jid.BareJid;
public class Main extends Application implements LoginCallback {
private static final Logger LOGGER = Logger.getLogger(Main.class.getName());
private Stage stage;
/*
@ -104,12 +109,13 @@ public class Main extends Application implements LoginCallback {
Map<OmemoDevice, OmemoFingerprint> fingerprints = Util.getFingerprints(connection);
ObservableList<OmemoIdentity> identities = repository.getIdentities();
LOGGER.info("Received " + identities.size() + " OMEMO identities");
for (OmemoDevice device : fingerprints.keySet()) {
identities.addAll(new OmemoIdentity(device, fingerprints.get(device)));
System.out.println(Util.twoLinesFingerprint(fingerprints.get(device)));
LOGGER.info(Util.twoLinesFingerprint(fingerprints.get(device)));
}
connection.disconnect(new Presence(Presence.Type.unavailable));
connection.disconnect();
FXMLLoader loader = new FXMLLoader();
loader.setLocation(getClass().getResource("/fxml/qrdisplay.fxml"));
@ -119,8 +125,8 @@ public class Main extends Application implements LoginCallback {
stage.setTitle("OMEMO QR-Code Generator");
stage.setScene(scene);
stage.show();
} catch (Exception e) {
e.printStackTrace();
} catch (InterruptedException | XMPPException | SmackException | IOException | CorruptedOmemoKeyException e) {
LOGGER.log(Level.SEVERE, "Exception in login", e);
}
}
}

5
src/main/java/de/vanitasvitae/omemoqrgenerator/QrDisplayController.java

@ -1,6 +1,7 @@
package de.vanitasvitae.omemoqrgenerator;
import java.awt.*;
import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.image.BufferedImage;
import java.util.Iterator;
@ -8,13 +9,11 @@ import com.google.zxing.BarcodeFormat;
import com.google.zxing.WriterException;
import com.google.zxing.common.BitMatrix;
import com.google.zxing.qrcode.QRCodeWriter;
import com.jfoenix.controls.JFXListView;
import javafx.collections.ListChangeListener;
import javafx.embed.swing.SwingFXUtils;
import javafx.fxml.FXML;
import javafx.scene.control.ListView;
import javafx.scene.image.ImageView;
import javafx.scene.layout.GridPane;
public class QrDisplayController {

1
src/main/java/de/vanitasvitae/omemoqrgenerator/Util.java

@ -20,7 +20,6 @@ import org.jivesoftware.smackx.pubsub.PayloadItem;
import org.jivesoftware.smackx.pubsub.PubSubException;
import org.jivesoftware.smackx.pubsub.PubSubManager;
import org.bouncycastle.util.Strings;
import org.jxmpp.jid.BareJid;
public class Util {

Loading…
Cancel
Save