M README.md => README.md +1 -1
@@ 80,7 80,7 @@ $ ./gradlew build -Ddb-url=mongodb://user:password@host:27017/database
```
Decentralized chat software
-Copyright (C) 2020 swissChili
+Copyright (C) 2021 swissChili
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
M client/src/main/java/sh/swisschili/chat/client/AddGroupDialog.java => client/src/main/java/sh/swisschili/chat/client/AddGroupDialog.java +1 -3
@@ 1,6 1,6 @@
/*
Decentralized chat software
-Copyright (C) 2020 swissChili
+Copyright (C) 2021 swissChili
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
@@ 25,8 25,6 @@ import javax.swing.*;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import java.awt.*;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
M client/src/main/java/sh/swisschili/chat/client/ColoredIcon.java => client/src/main/java/sh/swisschili/chat/client/ColoredIcon.java +1 -1
@@ 1,6 1,6 @@
/*
Decentralized chat software
-Copyright (C) 2020 swissChili
+Copyright (C) 2021 swissChili
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
M client/src/main/java/sh/swisschili/chat/client/InfiniteScrollPane.java => client/src/main/java/sh/swisschili/chat/client/InfiniteScrollPane.java +2 -6
@@ 1,6 1,6 @@
/*
Decentralized chat software
-Copyright (C) 2020 swissChili
+Copyright (C) 2021 swissChili
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
@@ 24,7 24,6 @@ import org.slf4j.LoggerFactory;
import javax.swing.*;
import javax.swing.event.ChangeEvent;
import java.awt.*;
-import java.awt.event.AdjustmentEvent;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.atomic.AtomicBoolean;
@@ 58,10 57,7 @@ public class InfiniteScrollPane<T> extends JScrollPane {
int visible = getVerticalScrollBar().getVisibleAmount();
int maxPossible = max - visible;
- if (isAtBottom) {
- LOGGER.info("At bottom of " + maxPossible);
- getVerticalScrollBar().setValue(max);
- }
+ getVerticalScrollBar().setValue(max);
}
};
M client/src/main/java/sh/swisschili/chat/client/ItemAddedListener.java => client/src/main/java/sh/swisschili/chat/client/ItemAddedListener.java +1 -1
@@ 1,6 1,6 @@
/*
Decentralized chat software
-Copyright (C) 2020 swissChili
+Copyright (C) 2021 swissChili
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
M client/src/main/java/sh/swisschili/chat/client/LoginDialog.java => client/src/main/java/sh/swisschili/chat/client/LoginDialog.java +1 -1
@@ 1,6 1,6 @@
/*
Decentralized chat software
-Copyright (C) 2020 swissChili
+Copyright (C) 2021 swissChili
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
M client/src/main/java/sh/swisschili/chat/client/MainWindow.java => client/src/main/java/sh/swisschili/chat/client/MainWindow.java +2 -2
@@ 1,6 1,6 @@
/*
Decentralized chat software
-Copyright (C) 2020 swissChili
+Copyright (C) 2021 swissChili
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
@@ 257,7 257,7 @@ public class MainWindow {
LafManager.installTheme(ThemeFactory.byName(preferences.get("theme.name", "IntelliJ")));
LafManager.install();
- if (!UserCredentials.userLoggedIn()) {
+ if (UserCredentials.notLoggedIn()) {
AtomicBoolean loggedIn = new AtomicBoolean(false);
JFrame loginFrame = new JFrame();
M client/src/main/java/sh/swisschili/chat/client/MessageCell.form => client/src/main/java/sh/swisschili/chat/client/MessageCell.form +3 -4
@@ 2,7 2,7 @@
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="sh.swisschili.chat.client.MessageCell">
<grid id="27dc6" binding="rootPanel" layout-manager="BorderLayout" hgap="0" vgap="5">
<constraints>
- <xy x="20" y="20" width="500" height="114"/>
+ <xy x="20" y="20" width="298" height="101"/>
</constraints>
<properties/>
<border type="none"/>
@@ 43,11 43,10 @@
</component>
</children>
</grid>
- <component id="19734" class="javax.swing.JTextArea" binding="body">
+ <component id="d0ad1" class="javax.swing.JLabel" binding="body">
<constraints border-constraint="Center"/>
<properties>
- <editable value="true"/>
- <lineWrap value="true"/>
+ <text value="Label"/>
</properties>
</component>
</children>
M client/src/main/java/sh/swisschili/chat/client/MessageCell.java => client/src/main/java/sh/swisschili/chat/client/MessageCell.java +7 -14
@@ 1,6 1,6 @@
/*
Decentralized chat software
-Copyright (C) 2020 swissChili
+Copyright (C) 2021 swissChili
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
@@ 22,8 22,6 @@ import com.github.weisj.darklaf.components.border.DarkBorders;
import com.jgoodies.forms.layout.CellConstraints;
import com.jgoodies.forms.layout.FormLayout;
import org.jetbrains.annotations.NotNull;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import sh.swisschili.chat.util.ChatProtos.Message;
import javax.swing.*;
@@ 35,7 33,7 @@ import java.util.Locale;
public class MessageCell implements ListCellRenderer<Message> {
private JPanel rootPanel;
- private JTextArea body;
+ private JLabel body;
private JLabel sender;
private JLabel time;
@@ 45,14 43,10 @@ public class MessageCell implements ListCellRenderer<Message> {
public MessageCell(@NotNull Message value, int parentWidth) {
$$$setupUI$$$();
- int width = parentWidth / 6;
- int lines = value.getBody().length() / width + 1;
+// int width = parentWidth / 6;
+// int lines = value.getBody().length() / width + 1;
- body.setText(value.getBody());
- body.setLineWrap(true);
- body.setWrapStyleWord(true);
-
- body.setRows(lines);
+ body.setText("<html><body style='width:100%'>" + value.getBody());
sender.setText(value.getSender().getName());
time.setText(new Date(value.getUnixTime()).toString());
@@ 91,9 85,8 @@ public class MessageCell implements ListCellRenderer<Message> {
if (timeFont != null) time.setFont(timeFont);
time.setText("Time");
panel1.add(time, cc.xy(3, 1));
- body = new JTextArea();
- body.setEditable(true);
- body.setLineWrap(true);
+ body = new JLabel();
+ body.setText("Label");
rootPanel.add(body, BorderLayout.CENTER);
}
M client/src/main/java/sh/swisschili/chat/client/NoSelectionModel.java => client/src/main/java/sh/swisschili/chat/client/NoSelectionModel.java +1 -1
@@ 1,6 1,6 @@
/*
Decentralized chat software
-Copyright (C) 2020 swissChili
+Copyright (C) 2021 swissChili
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
M client/src/main/java/sh/swisschili/chat/client/ServerChannel.java => client/src/main/java/sh/swisschili/chat/client/ServerChannel.java +5 -7
@@ 1,6 1,6 @@
/*
Decentralized chat software
-Copyright (C) 2020 swissChili
+Copyright (C) 2021 swissChili
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
@@ 20,19 20,18 @@ package sh.swisschili.chat.client;
import com.google.protobuf.ByteString;
import io.grpc.stub.StreamObserver;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import sh.swisschili.chat.util.ChatGrpc;
import sh.swisschili.chat.util.ChatProtos.*;
-
-import javax.swing.*;
-import org.slf4j.*;
import sh.swisschili.chat.util.ServerPool;
import sh.swisschili.chat.util.SignedAuth;
+import javax.swing.*;
import java.security.KeyException;
import java.security.KeyPair;
import java.security.SignatureException;
import java.util.LinkedList;
-import java.util.List;
import java.util.concurrent.CompletableFuture;
public class ServerChannel {
@@ 107,7 106,7 @@ public class ServerChannel {
return new InfiniteScrollPane.BufferedLoader<Message>() {
@Override
public CompletableFuture<Void> loadMore(int number) {
- LOGGER.info(String.format("Starting to fetch from %d length %d", messageModel.getSize(), number));
+// LOGGER.info(String.format("Starting to fetch from %d length %d", messageModel.getSize(), number));
CompletableFuture<Void> future = new CompletableFuture<>();
stub.getMessageRange(MessageRangeRequest.newBuilder()
@@ 131,7 130,6 @@ public class ServerChannel {
@Override
public void onCompleted() {
- LOGGER.info("getRange COMPLETED");
future.complete(null);
}
});
M client/src/main/java/sh/swisschili/chat/client/ServerGroup.java => client/src/main/java/sh/swisschili/chat/client/ServerGroup.java +2 -2
@@ 1,6 1,6 @@
/*
Decentralized chat software
-Copyright (C) 2020 swissChili
+Copyright (C) 2021 swissChili
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
@@ 185,6 185,6 @@ public class ServerGroup {
@Override
public String toString() {
- return groupName + "#" + server;
+ return groupName; // + "#" + server;
}
}
M client/src/main/java/sh/swisschili/chat/client/SettingsDialog.java => client/src/main/java/sh/swisschili/chat/client/SettingsDialog.java +4 -10
@@ 1,6 1,6 @@
/*
Decentralized chat software
-Copyright (C) 2020 swissChili
+Copyright (C) 2021 swissChili
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
@@ 18,26 18,20 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
package sh.swisschili.chat.client;
-import com.github.weisj.darklaf.DarkLaf;
-import com.github.weisj.darklaf.LafManager;
import com.github.weisj.darklaf.components.border.DarkBorders;
import com.github.weisj.darklaf.settings.ThemeSettings;
import com.github.weisj.darklaf.theme.*;
import com.intellij.uiDesigner.core.GridConstraints;
import com.intellij.uiDesigner.core.GridLayoutManager;
import com.intellij.uiDesigner.core.Spacer;
+import jiconfont.icons.font_awesome.FontAwesome;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import javax.swing.*;
import javax.swing.border.Border;
-import javax.swing.event.ListDataListener;
import java.awt.*;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
import java.util.Arrays;
-
-import jiconfont.icons.font_awesome.FontAwesome;
-import jiconfont.swing.IconFontSwing;
-import org.slf4j.*;
import java.util.prefs.Preferences;
public class SettingsDialog extends JDialog {
M client/src/main/java/sh/swisschili/chat/client/StreamingListModel.java => client/src/main/java/sh/swisschili/chat/client/StreamingListModel.java +1 -1
@@ 1,6 1,6 @@
/*
Decentralized chat software
-Copyright (C) 2020 swissChili
+Copyright (C) 2021 swissChili
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
M client/src/main/java/sh/swisschili/chat/client/ThemeFactory.java => client/src/main/java/sh/swisschili/chat/client/ThemeFactory.java +1 -1
@@ 1,6 1,6 @@
/*
Decentralized chat software
-Copyright (C) 2020 swissChili
+Copyright (C) 2021 swissChili
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
M client/src/main/java/sh/swisschili/chat/client/UserComponent.java => client/src/main/java/sh/swisschili/chat/client/UserComponent.java +1 -1
@@ 1,6 1,6 @@
/*
Decentralized chat software
-Copyright (C) 2020 swissChili
+Copyright (C) 2021 swissChili
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
M client/src/main/java/sh/swisschili/chat/client/UserCredentials.java => client/src/main/java/sh/swisschili/chat/client/UserCredentials.java +7 -6
@@ 1,6 1,6 @@
/*
Decentralized chat software
-Copyright (C) 2020 swissChili
+Copyright (C) 2021 swissChili
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
@@ 47,14 47,14 @@ public class UserCredentials extends SignedAuth {
}
}
- public static boolean userLoggedIn() {
+ public static boolean notLoggedIn() {
for (String key : PREF_KEYS) {
if (preferences.get(key, "").isEmpty()) {
LOGGER.warn("User preference undefined: " + key);
- return false;
+ return true;
}
}
- return true;
+ return false;
}
public static void clearUser() {
@@ 69,7 69,7 @@ public class UserCredentials extends SignedAuth {
}
public static ChatProtos.User getUser() throws CredentialsNotFound {
- if (!userLoggedIn())
+ if (notLoggedIn())
throw new CredentialsNotFound("User not logged in");
return ChatProtos.User.newBuilder()
@@ 83,7 83,7 @@ public class UserCredentials extends SignedAuth {
}
public static char[] getPassword() throws CredentialsNotFound {
- if (!userLoggedIn())
+ if (notLoggedIn())
throw new CredentialsNotFound("User not logged in");
return preferences.get("user.password", "").toCharArray();
@@ 108,6 108,7 @@ public class UserCredentials extends SignedAuth {
public static KeyPair createUserKeys() {
KeyPair keys = generateKeyPair();
+ assert keys != null;
preferences.putByteArray("user.credentials.privateKey", privateKeyToBytes(keys.getPrivate()));
preferences.putByteArray("user.credentials.publicKey", pubKeyToBytes(keys.getPublic()));
M client/src/main/java/sh/swisschili/chat/client/UserStatusComparator.java => client/src/main/java/sh/swisschili/chat/client/UserStatusComparator.java +2 -2
@@ 1,6 1,6 @@
/*
Decentralized chat software
-Copyright (C) 2020 swissChili
+Copyright (C) 2021 swissChili
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
@@ 18,7 18,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
package sh.swisschili.chat.client;
-import sh.swisschili.chat.util.ChatProtos.*;
+import sh.swisschili.chat.util.ChatProtos.UserStatus;
import java.util.Comparator;
M client/src/main/java/sh/swisschili/chat/client/UserStatusComponent.java => client/src/main/java/sh/swisschili/chat/client/UserStatusComponent.java +1 -1
@@ 1,6 1,6 @@
/*
Decentralized chat software
-Copyright (C) 2020 swissChili
+Copyright (C) 2021 swissChili
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
M server/src/main/java/sh/swisschili/chat/server/AuthService.java => server/src/main/java/sh/swisschili/chat/server/AuthService.java +1 -5
@@ 1,6 1,6 @@
/*
Decentralized chat software
-Copyright (C) 2020 swissChili
+Copyright (C) 2021 swissChili
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
@@ 23,11 23,7 @@ import io.grpc.stub.StreamObserver;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import sh.swisschili.chat.util.AuthGrpc;
-import sh.swisschili.chat.util.ChatGrpc;
import sh.swisschili.chat.util.ChatProtos;
-import sh.swisschili.chat.util.SignedAuth;
-
-import java.security.spec.InvalidKeySpecException;
public class AuthService extends AuthGrpc.AuthImplBase {
private final Logger LOGGER = LoggerFactory.getLogger(AuthService.class);
M server/src/main/java/sh/swisschili/chat/server/ChatServer.java => server/src/main/java/sh/swisschili/chat/server/ChatServer.java +3 -2
@@ 1,6 1,6 @@
/*
Decentralized chat software
-Copyright (C) 2020 swissChili
+Copyright (C) 2021 swissChili
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
@@ 22,11 22,12 @@ import com.beust.jcommander.JCommander;
import com.beust.jcommander.Parameter;
import io.grpc.Server;
import io.grpc.ServerBuilder;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import sh.swisschili.chat.util.Constants;
import java.io.IOException;
import java.util.concurrent.TimeoutException;
-import org.slf4j.*;
public class ChatServer {
private final int port;
M server/src/main/java/sh/swisschili/chat/server/ChatService.java => server/src/main/java/sh/swisschili/chat/server/ChatService.java +4 -5
@@ 1,6 1,6 @@
/*
Decentralized chat software
-Copyright (C) 2020 swissChili
+Copyright (C) 2021 swissChili
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
@@ 20,13 20,12 @@ package sh.swisschili.chat.server;
import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Connection;
-import com.rabbitmq.client.DeliverCallback;
import com.rabbitmq.client.ConnectionFactory;
+import com.rabbitmq.client.DeliverCallback;
import io.grpc.stub.StreamObserver;
import org.jetbrains.annotations.NotNull;
-import org.slf4j.*;
-import sh.swisschili.chat.util.ChatGrpc;
-import sh.swisschili.chat.util.ChatProtos;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import sh.swisschili.chat.util.*;
import java.io.IOException;
M server/src/main/java/sh/swisschili/chat/server/PasswordAuthentication.java => server/src/main/java/sh/swisschili/chat/server/PasswordAuthentication.java +1 -1
@@ 1,6 1,6 @@
/*
Decentralized chat software
-Copyright (C) 2020 swissChili
+Copyright (C) 2021 swissChili
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
M server/src/main/java/sh/swisschili/chat/server/ServerConstants.java => server/src/main/java/sh/swisschili/chat/server/ServerConstants.java +1 -3
@@ 1,6 1,6 @@
/*
Decentralized chat software
-Copyright (C) 2020 swissChili
+Copyright (C) 2021 swissChili
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
@@ 18,8 18,6 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
package sh.swisschili.chat.server;
-import sh.swisschili.chat.util.ChatProtos.*;
-
public class ServerConstants {
public static String getChannelExchange(String id) {
return "sh.swisschili.chat.channel.messages:" + id;
M server/src/main/java/sh/swisschili/chat/server/ServerDatabase.java => server/src/main/java/sh/swisschili/chat/server/ServerDatabase.java +1 -3
@@ 1,6 1,6 @@
/*
Decentralized chat software
-Copyright (C) 2020 swissChili
+Copyright (C) 2021 swissChili
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
@@ 34,7 34,6 @@ import org.bson.types.Binary;
import org.bson.types.ObjectId;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import sh.swisschili.chat.util.ChatProtos;
import sh.swisschili.chat.util.ChatProtos.*;
import java.util.ArrayList;
@@ 42,7 41,6 @@ import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
-import java.util.stream.Stream;
import java.util.stream.StreamSupport;
import static com.mongodb.client.model.Filters.eq;
M server/src/test/java/TestDatabase.java => server/src/test/java/TestDatabase.java +4 -2
@@ 1,6 1,6 @@
/*
Decentralized chat software
-Copyright (C) 2020 swissChili
+Copyright (C) 2021 swissChili
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
@@ 18,7 18,9 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
import org.junit.Test;
import sh.swisschili.chat.server.ServerDatabase;
-import sh.swisschili.chat.util.ChatProtos.*;
+import sh.swisschili.chat.util.ChatProtos.Channel;
+import sh.swisschili.chat.util.ChatProtos.Group;
+import sh.swisschili.chat.util.ChatProtos.User;
import java.util.List;
import java.util.logging.Logger;
M util/src/main/java/sh/swisschili/chat/util/ServerPool.java => util/src/main/java/sh/swisschili/chat/util/ServerPool.java +2 -4
@@ 1,6 1,6 @@
/*
Decentralized chat software
-Copyright (C) 2020 swissChili
+Copyright (C) 2021 swissChili
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
@@ 20,9 20,7 @@ package sh.swisschili.chat.util;
import io.grpc.Channel;
import io.grpc.ManagedChannelBuilder;
-import sh.swisschili.chat.util.AuthGrpc;
import sh.swisschili.chat.util.AuthGrpc.AuthStub;
-import sh.swisschili.chat.util.ChatGrpc;
import sh.swisschili.chat.util.ChatGrpc.ChatStub;
import java.util.HashMap;
@@ 35,7 33,7 @@ public class ServerPool {
private Channel channelFor(String server) {
if (!channels.containsKey(server)) {
- Channel channel = ManagedChannelBuilder.forAddress(server, Constants.DEFAULT_SERVER_PORT)
+ Channel channel = ManagedChannelBuilder.forAddress(server.trim(), Constants.DEFAULT_SERVER_PORT)
.usePlaintext()
.build();
channels.put(server, channel);
M util/src/main/java/sh/swisschili/chat/util/SignedAuth.java => util/src/main/java/sh/swisschili/chat/util/SignedAuth.java +1 -1
@@ 1,6 1,6 @@
/*
Decentralized chat software
-Copyright (C) 2020 swissChili
+Copyright (C) 2021 swissChili
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
M util/src/main/java/sh/swisschili/chat/util/SignedAuthenticationError.java => util/src/main/java/sh/swisschili/chat/util/SignedAuthenticationError.java +1 -1
@@ 1,6 1,6 @@
/*
Decentralized chat software
-Copyright (C) 2020 swissChili
+Copyright (C) 2021 swissChili
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
M util/src/test/java/TestSignedAuth.java => util/src/test/java/TestSignedAuth.java +1 -1
@@ 1,6 1,6 @@
/*
Decentralized chat software
-Copyright (C) 2020 swissChili
+Copyright (C) 2021 swissChili
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by