modificatons

This commit is contained in:
Hamza Iseric
2018-12-24 23:31:26 +01:00
parent 5086745d8b
commit 784ef18836
9 changed files with 171 additions and 48 deletions

15
.idea/chat-example.iml generated Normal file
View File

@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
<component name="TemplatesService">
<option name="TEMPLATE_FOLDERS">
<list>
<option value="$MODULE_DIR$/node_modules/istanbul-reports/lib/html/templates" />
</list>
</option>
</component>
</module>

4
.idea/encodings.xml generated Normal file
View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding" addBOMForNewFiles="with NO BOM" />
</project>

7
.idea/misc.xml generated Normal file
View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="JavaScriptSettings">
<option name="languageLevel" value="JSX" />
</component>
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.5" project-jdk-type="Python SDK" />
</project>

8
.idea/modules.xml generated Normal file
View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/chat-example.iml" filepath="$PROJECT_DIR$/.idea/chat-example.iml" />
</modules>
</component>
</project>

6
.idea/vcs.xml generated Normal file
View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

85
.idea/workspace.xml generated Normal file
View File

@@ -0,0 +1,85 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ChangeListManager">
<list default="true" id="9cc67e50-00db-4a45-8df7-04c3fb0d4132" name="Default Changelist" comment="">
<change beforePath="$PROJECT_DIR$/src/Chat.js" beforeDir="false" afterPath="$PROJECT_DIR$/src/Chat.js" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/MessageList.js" beforeDir="false" afterPath="$PROJECT_DIR$/src/MessageList.js" afterDir="false" />
</list>
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="ProjectFrameBounds">
<option name="x" value="260" />
<option name="y" value="20" />
<option name="width" value="1400" />
<option name="height" value="1000" />
</component>
<component name="ProjectView">
<navigator proportions="" version="1">
<foldersAlwaysOnTop value="true" />
</navigator>
<panes>
<pane id="Scope" />
<pane id="ProjectPane" />
</panes>
</component>
<component name="PropertiesComponent">
<property name="WebServerToolWindowFactoryState" value="false" />
<property name="nodejs_interpreter_path.stuck_in_default_project" value="undefined stuck path" />
<property name="nodejs_npm_path_reset_for_default_project" value="true" />
</component>
<component name="RunDashboard">
<option name="ruleStates">
<list>
<RuleState>
<option name="name" value="ConfigurationTypeDashboardGroupingRule" />
</RuleState>
<RuleState>
<option name="name" value="StatusDashboardGroupingRule" />
</RuleState>
</list>
</option>
</component>
<component name="TaskManager">
<task active="true" id="Default" summary="Default task">
<changelist id="9cc67e50-00db-4a45-8df7-04c3fb0d4132" name="Default Changelist" comment="" />
<created>1545684502781</created>
<option name="number" value="Default" />
<option name="presentableId" value="Default" />
<updated>1545684502781</updated>
<workItem from="1545684514629" duration="4000" />
</task>
<servers />
</component>
<component name="TimeTrackingManager">
<option name="totallyTimeSpent" value="4000" />
</component>
<component name="ToolWindowManager">
<frame x="260" y="20" width="1400" height="1000" extended-state="0" />
<layout>
<window_info id="Favorites" side_tool="true" />
<window_info active="true" content_ui="combo" id="Project" order="0" visible="true" weight="0.25" />
<window_info id="Structure" order="1" side_tool="true" weight="0.25" />
<window_info anchor="bottom" id="Database Changes" />
<window_info anchor="bottom" id="Version Control" />
<window_info anchor="bottom" id="Python Console" />
<window_info anchor="bottom" id="Terminal" />
<window_info anchor="bottom" id="Event Log" side_tool="true" />
<window_info anchor="bottom" id="Message" order="0" />
<window_info anchor="bottom" id="Find" order="1" />
<window_info anchor="bottom" id="Run" order="2" />
<window_info anchor="bottom" id="Debug" order="3" weight="0.4" />
<window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
<window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
<window_info anchor="bottom" id="TODO" order="6" />
<window_info anchor="right" id="SciView" />
<window_info anchor="right" id="Database" />
<window_info anchor="right" id="Commander" internal_type="SLIDING" order="0" type="SLIDING" weight="0.4" />
<window_info anchor="right" id="Ant Build" order="1" weight="0.25" />
<window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" />
</layout>
</component>
</project>

View File

@@ -285,6 +285,7 @@ app.post('/deCryptMessage', (req, res) => {
var receiverSessionCipher = new libsignal.SessionCipher(receiverStore, SENDER_ADDRESS); //ubaceno
receiverSessionCipher.decryptPreKeyWhisperMessage(buf5, 'binary').then(function (ciphertext) {
poruka = ciphertext.toString();
console.log(poruka)
res.json({
data: {
message: poruka

View File

@@ -17,7 +17,7 @@ class Chat extends Component {
messages: [],
receiverStore: null,
SENDER_ADDRESS: null,
message: ""
message: {}
}
@@ -38,14 +38,14 @@ class Chat extends Component {
this.setState({ currentUser })
console.log('Bleep bloop 🤖 You are connected to Chatkit')
return currentUser.subscribeToRoom({
roomId: 19377916, // Replace with YOUR ROOM ID
roomId: 19378901, // Replace with YOUR ROOM ID
messageLimit: 100,
hooks: {
onNewMessage: message => {
if (message != "") {
console.log("ČITAVA PORUKA:", message)
this.onDeCryptingMessage2(this.state.poruka);
this.onDeCryptingMessage2(message);
}
},
@@ -63,43 +63,6 @@ class Chat extends Component {
}
onDeCryptingMessage = message => {
console.log("DEKRIPCIJA, poruka primljena:", message);
fetch('http://localhost:3001/decryptMessage2', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
data: {
senderAdress: "xxxxxxxxx",
receiverAdress: "yyyyyyyyyyyyy",
receiverPreKeyId: 1337,
receiverSignedKeyId: 1,
message: message
}
})
})
.then(response => { console.log("REPSONSE:", response); return response.json(); })
.then(data => {
console.log("DATA:", data.data)
this.setState({
message: data.data.message
})
this.setState({
messages: [...this.state.messages, message]
})
return data.data.message
})
.catch(error => {
console.error('error', error)
}).catch(error => {
console.error('error', error)
})
}
onSend = text => {
//ubaceno
console.log("Primljena poruka:", text);
@@ -161,17 +124,16 @@ class Chat extends Component {
data: {
receiverStore: this.state.receiverStore,
SENDER_ADDRESS: this.state.SENDER_ADDRESS,
message: message,
message: message.text,
senderAdress: "xxxxxxxxx"
}
})
})
.then(response => { console.log("REPSONSE:", response); return response.json(); })
.then(data => {
console.log("DATA:", data.data)
this.setState({
message: data.data.message
})
message.text = data.data.message
this.state.message = message;
console.log("PORUKA 3:",this.state.message)
this.setState({
messages: [...this.state.messages, this.state.message]
})
@@ -240,4 +202,39 @@ export default Chat
})
}
*/
*/
/*onDeCryptingMessage = message => {
console.log("DEKRIPCIJA, poruka primljena:", message);
fetch('http://localhost:3001/decryptMessage2', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
data: {
senderAdress: "xxxxxxxxx",
receiverAdress: "yyyyyyyyyyyyy",
receiverPreKeyId: 1337,
receiverSignedKeyId: 1,
message: message
}
})
})
.then(response => { console.log("REPSONSE:", response); return response.json(); })
.then(data => {
console.log("DATA:", data.data)
this.setState({
message: data.data.message
})
this.setState({
messages: [...this.state.messages, message]
})
return data.data.message
})
.catch(error => {
console.error('error', error)
}).catch(error => {
console.error('error', error)
})
} */

View File

@@ -26,10 +26,10 @@ class MessageList extends Component {
return (
<ListViewRow key={message.id}>
<Text color="#414141" size="13" bold>
{"you"}:
{message.sender.name}:
</Text>
<Text color="#414141" size="13">
{message}
{message.text}
</Text>
</ListViewRow>
)