mirror of
https://github.com/vanitasvitae/OmemoQRCodeGenerator.git
synced 2024-11-23 12:52:09 +01:00
commit
347e0fe022
7 changed files with 32 additions and 18 deletions
16
.gitignore
vendored
16
.gitignore
vendored
|
@ -1,8 +1,12 @@
|
||||||
.gradle/
|
/.gradle/
|
||||||
.idea/
|
/.idea/
|
||||||
|
|
||||||
*.iml
|
/*.iml
|
||||||
*/out
|
/build/
|
||||||
*/build/
|
|
||||||
|
|
||||||
out/
|
/out/
|
||||||
|
|
||||||
|
/.classpath
|
||||||
|
/.project
|
||||||
|
/.settings/
|
||||||
|
/bin/
|
||||||
|
|
|
@ -3,3 +3,9 @@ of authenticity.
|
||||||
|
|
||||||
![Login Screen](assets/qr_omemo_login.png)
|
![Login Screen](assets/qr_omemo_login.png)
|
||||||
![Main Screen](assets/qr_omemo_main.png)
|
![Main Screen](assets/qr_omemo_main.png)
|
||||||
|
|
||||||
|
# Executing the application
|
||||||
|
|
||||||
|
```bash
|
||||||
|
gradle jfxRun
|
||||||
|
```
|
||||||
|
|
|
@ -15,6 +15,7 @@ buildscript {
|
||||||
}
|
}
|
||||||
|
|
||||||
allprojects {
|
allprojects {
|
||||||
|
apply plugin: 'eclipse'
|
||||||
apply plugin: 'java'
|
apply plugin: 'java'
|
||||||
apply plugin: 'javafx-gradle-plugin'
|
apply plugin: 'javafx-gradle-plugin'
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package de.vanitasvitae.omemoqrgenerator;
|
package de.vanitasvitae.omemoqrgenerator;
|
||||||
|
|
||||||
import javafx.event.EventHandler;
|
|
||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
import javafx.scene.control.ListView;
|
import javafx.scene.control.ListView;
|
||||||
import javafx.scene.input.ScrollEvent;
|
import javafx.scene.input.ScrollEvent;
|
||||||
|
|
|
@ -1,24 +1,29 @@
|
||||||
package de.vanitasvitae.omemoqrgenerator;
|
package de.vanitasvitae.omemoqrgenerator;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import org.jivesoftware.smack.SmackConfiguration;
|
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.smack.tcp.XMPPTCPConnection;
|
||||||
|
import org.jivesoftware.smackx.omemo.exceptions.CorruptedOmemoKeyException;
|
||||||
import org.jivesoftware.smackx.omemo.internal.OmemoDevice;
|
import org.jivesoftware.smackx.omemo.internal.OmemoDevice;
|
||||||
import org.jivesoftware.smackx.omemo.trust.OmemoFingerprint;
|
import org.jivesoftware.smackx.omemo.trust.OmemoFingerprint;
|
||||||
|
|
||||||
import javafx.application.Application;
|
import javafx.application.Application;
|
||||||
import javafx.collections.FXCollections;
|
|
||||||
import javafx.collections.ObservableList;
|
import javafx.collections.ObservableList;
|
||||||
import javafx.fxml.FXMLLoader;
|
import javafx.fxml.FXMLLoader;
|
||||||
import javafx.scene.Parent;
|
import javafx.scene.Parent;
|
||||||
import javafx.scene.Scene;
|
import javafx.scene.Scene;
|
||||||
import javafx.stage.Stage;
|
import javafx.stage.Stage;
|
||||||
import org.jxmpp.jid.BareJid;
|
|
||||||
|
|
||||||
public class Main extends Application implements LoginCallback {
|
public class Main extends Application implements LoginCallback {
|
||||||
|
|
||||||
|
private static final Logger LOGGER = Logger.getLogger(Main.class.getName());
|
||||||
|
|
||||||
private Stage stage;
|
private Stage stage;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -104,12 +109,13 @@ public class Main extends Application implements LoginCallback {
|
||||||
Map<OmemoDevice, OmemoFingerprint> fingerprints = Util.getFingerprints(connection);
|
Map<OmemoDevice, OmemoFingerprint> fingerprints = Util.getFingerprints(connection);
|
||||||
|
|
||||||
ObservableList<OmemoIdentity> identities = repository.getIdentities();
|
ObservableList<OmemoIdentity> identities = repository.getIdentities();
|
||||||
|
LOGGER.info("Received " + identities.size() + " OMEMO identities");
|
||||||
for (OmemoDevice device : fingerprints.keySet()) {
|
for (OmemoDevice device : fingerprints.keySet()) {
|
||||||
identities.addAll(new OmemoIdentity(device, fingerprints.get(device)));
|
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();
|
FXMLLoader loader = new FXMLLoader();
|
||||||
loader.setLocation(getClass().getResource("/fxml/qrdisplay.fxml"));
|
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.setTitle("OMEMO QR-Code Generator");
|
||||||
stage.setScene(scene);
|
stage.setScene(scene);
|
||||||
stage.show();
|
stage.show();
|
||||||
} catch (Exception e) {
|
} catch (InterruptedException | XMPPException | SmackException | IOException | CorruptedOmemoKeyException e) {
|
||||||
e.printStackTrace();
|
LOGGER.log(Level.SEVERE, "Exception in login", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package de.vanitasvitae.omemoqrgenerator;
|
package de.vanitasvitae.omemoqrgenerator;
|
||||||
|
|
||||||
import java.awt.*;
|
import java.awt.Color;
|
||||||
|
import java.awt.Graphics2D;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
|
||||||
|
@ -8,13 +9,11 @@ import com.google.zxing.BarcodeFormat;
|
||||||
import com.google.zxing.WriterException;
|
import com.google.zxing.WriterException;
|
||||||
import com.google.zxing.common.BitMatrix;
|
import com.google.zxing.common.BitMatrix;
|
||||||
import com.google.zxing.qrcode.QRCodeWriter;
|
import com.google.zxing.qrcode.QRCodeWriter;
|
||||||
import com.jfoenix.controls.JFXListView;
|
|
||||||
import javafx.collections.ListChangeListener;
|
import javafx.collections.ListChangeListener;
|
||||||
import javafx.embed.swing.SwingFXUtils;
|
import javafx.embed.swing.SwingFXUtils;
|
||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
import javafx.scene.control.ListView;
|
import javafx.scene.control.ListView;
|
||||||
import javafx.scene.image.ImageView;
|
import javafx.scene.image.ImageView;
|
||||||
import javafx.scene.layout.GridPane;
|
|
||||||
|
|
||||||
public class QrDisplayController {
|
public class QrDisplayController {
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,6 @@ import org.jivesoftware.smackx.pubsub.PayloadItem;
|
||||||
import org.jivesoftware.smackx.pubsub.PubSubException;
|
import org.jivesoftware.smackx.pubsub.PubSubException;
|
||||||
import org.jivesoftware.smackx.pubsub.PubSubManager;
|
import org.jivesoftware.smackx.pubsub.PubSubManager;
|
||||||
|
|
||||||
import org.bouncycastle.util.Strings;
|
|
||||||
import org.jxmpp.jid.BareJid;
|
import org.jxmpp.jid.BareJid;
|
||||||
|
|
||||||
public class Util {
|
public class Util {
|
||||||
|
|
Loading…
Reference in a new issue