fix bug: not retriving self tweets from selfserver
This commit is contained in:
parent
9c8ae50ce8
commit
fed70a441c
@ -37,6 +37,8 @@ function userDataStartUp(){
|
|||||||
listProfiles();
|
listProfiles();
|
||||||
getFollowinglistFromIDB().then(function(result){
|
getFollowinglistFromIDB().then(function(result){
|
||||||
following = result;
|
following = result;
|
||||||
|
if(!following.includes(selfID))
|
||||||
|
following.push(selfID);
|
||||||
console.log(following);
|
console.log(following);
|
||||||
displayTweetsFromIDB().then(function(result){
|
displayTweetsFromIDB().then(function(result){
|
||||||
connectToAllFollowing();
|
connectToAllFollowing();
|
||||||
@ -361,9 +363,7 @@ function postTweet(){
|
|||||||
var data = JSON.stringify({floID:selfID,time:time,tweet:tweet,sign:sign});
|
var data = JSON.stringify({floID:selfID,time:time,tweet:tweet,sign:sign});
|
||||||
console.log(data);
|
console.log(data);
|
||||||
selfWebsocket.send(data);
|
selfWebsocket.send(data);
|
||||||
createTweetElement(selfID,time,tweet);
|
|
||||||
getLastTweetCount(selfID).then(function(result){
|
getLastTweetCount(selfID).then(function(result){
|
||||||
storeTweet({floID:selfID,time:time,data:tweet},result+1);
|
|
||||||
sendTweetToSuperNode(data,result+1);
|
sendTweetToSuperNode(data,result+1);
|
||||||
}).catch(function(error){
|
}).catch(function(error){
|
||||||
console.log(error.message);
|
console.log(error.message);
|
||||||
@ -477,8 +477,8 @@ function createTweetElement(floID,time,tweet){
|
|||||||
|
|
||||||
function connectToAllFollowing(){
|
function connectToAllFollowing(){
|
||||||
console.log("Connecting to All following servers...")
|
console.log("Connecting to All following servers...")
|
||||||
for(i=0;i<following.length;i++){
|
following.forEach(floid => {
|
||||||
var floid = following[i];
|
console.log(floid)
|
||||||
followingWebSockets[floid] = new WebSocket("ws://"+profiles[floid].onionAddr+"/ws");
|
followingWebSockets[floid] = new WebSocket("ws://"+profiles[floid].onionAddr+"/ws");
|
||||||
|
|
||||||
followingWebSockets[floid].onopen = function(ev){
|
followingWebSockets[floid].onopen = function(ev){
|
||||||
@ -512,7 +512,7 @@ function connectToAllFollowing(){
|
|||||||
console.log(error.message);
|
console.log(error.message);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function getLastTweetCount(floid){
|
function getLastTweetCount(floid){
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user