MOdifikacije
This commit is contained in:
@@ -212,7 +212,7 @@ function generatePreKeyBundle(store, preKeyId, signedPreKeyId) {
|
||||
//---------
|
||||
|
||||
app.post("/cryptMessage", async (req, res) => {
|
||||
console.log("UĐEEEEEEEEEEEEE");
|
||||
|
||||
//sessionPromise=req.body.data.sessionPromise;
|
||||
message = req.body.data.message;
|
||||
//senderStore = req.body.data.senderStore;
|
||||
@@ -228,10 +228,6 @@ app.post("/cryptMessage", async (req, res) => {
|
||||
var SENDER_ADDRESS = new libsignal.ProtocolAddress(senderAdress, 1);
|
||||
var RECEIVER_ADDRESS = new libsignal.ProtocolAddress(receiverAdress, 1);
|
||||
|
||||
//var senderStore = new SignalProtocolStore();
|
||||
|
||||
//var receiverStore = new SignalProtocolStore();
|
||||
|
||||
var receiverSignedKeyId = 1;
|
||||
|
||||
var Curve = libsignal.Curve;
|
||||
|
||||
22
src/Chat.js
22
src/Chat.js
@@ -38,13 +38,13 @@ class Chat extends Component {
|
||||
this.setState({ currentUser })
|
||||
console.log('Bleep bloop 🤖 You are connected to Chatkit')
|
||||
return currentUser.subscribeToRoom({
|
||||
roomId: 19377773, // Replace with YOUR ROOM ID
|
||||
roomId: 19377916, // Replace with YOUR ROOM ID
|
||||
messageLimit: 100,
|
||||
hooks: {
|
||||
onNewMessage: message => {
|
||||
|
||||
|
||||
if (message != "") {
|
||||
console.log(message)
|
||||
console.log("ČITAVA PORUKA:", message)
|
||||
this.onDeCryptingMessage2(this.state.poruka);
|
||||
|
||||
}
|
||||
@@ -102,7 +102,7 @@ class Chat extends Component {
|
||||
|
||||
onSend = text => {
|
||||
//ubaceno
|
||||
console.log("Primljena poruka:",text);
|
||||
console.log("Primljena poruka:", text);
|
||||
fetch('http://localhost:3001/cryptMessage', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
@@ -120,12 +120,17 @@ class Chat extends Component {
|
||||
})
|
||||
.then(response => { console.log("REPSONSE:", response); return response.json(); })
|
||||
.then(data => {
|
||||
this.state.poruka = data.data.message.data.toString();
|
||||
this.state.poruka = data.data.message.data.toString();
|
||||
this.setState({
|
||||
receiverStore: data.data.receiverStore,
|
||||
SENDER_ADDRESS: data.data.SENDER_ADDRESS
|
||||
})
|
||||
|
||||
this.state.currentUser.sendMessage({
|
||||
text:this.state.poruka,
|
||||
roomId: this.state.currentRoom.id
|
||||
})
|
||||
console.log("PORUKA:",this.state.poruka);
|
||||
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('error', error)
|
||||
@@ -135,11 +140,12 @@ class Chat extends Component {
|
||||
|
||||
|
||||
//kraj
|
||||
|
||||
/*
|
||||
console.log("TEKST:", text);
|
||||
this.state.currentUser.sendMessage({
|
||||
text,
|
||||
roomId: this.state.currentRoom.id
|
||||
})
|
||||
})*/
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ class MessageList extends Component {
|
||||
return (
|
||||
<ListViewRow key={message.id}>
|
||||
<Text color="#414141" size="13" bold>
|
||||
{"Posiljalac:"}:
|
||||
{"you"}:
|
||||
</Text>
|
||||
<Text color="#414141" size="13">
|
||||
{message}
|
||||
|
||||
Reference in New Issue
Block a user