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