added chat sendbox

This commit is contained in:
Kevin Froman 2019-08-18 15:10:28 -05:00
parent a5490b9f28
commit 315e860eff
4 changed files with 35 additions and 1 deletions

View File

@ -19,6 +19,7 @@
''' '''
import logger import logger
from communicatorutils import proxypicker from communicatorutils import proxypicker
import onionrexceptions
import onionrblockapi as block import onionrblockapi as block
from onionrutils import localcommand, stringvalidators, basicrequests from onionrutils import localcommand, stringvalidators, basicrequests
from communicator import onlinepeers from communicator import onlinepeers
@ -42,7 +43,11 @@ def upload_blocks_from_communicator(comm_inst):
continue continue
triedPeers.append(peer) triedPeers.append(peer)
url = 'http://' + peer + '/upload' url = 'http://' + peer + '/upload'
try:
data = {'block': block.Block(bl).getRaw()} data = {'block': block.Block(bl).getRaw()}
except onionrexceptions.NoDataAvailable:
finishedUploads.append(bl)
break
proxyType = proxypicker.pick_proxy(peer) proxyType = proxypicker.pick_proxy(peer)
logger.info("Uploading block %s to %s" % (bl[:8], peer), terminal=True) logger.info("Uploading block %s to %s" % (bl[:8], peer), terminal=True)
resp = basicrequests.do_post_request(url, data=data, proxyType=proxyType) resp = basicrequests.do_post_request(url, data=data, proxyType=proxyType)

View File

@ -17,3 +17,17 @@
.connectStatus{ .connectStatus{
float: right; float: right;
} }
.friendsTitle{
text-align: center;
display: block;
}
.chatInput{
position: fixed;
bottom: 0;
}
.chatInput textarea{
resize: none;
}

View File

@ -17,6 +17,7 @@
<script defer src='/shared/direct-connections.js'></script> <script defer src='/shared/direct-connections.js'></script>
<script defer src='/chat/js/messages.js'></script> <script defer src='/chat/js/messages.js'></script>
<script defer src='/chat/js/message-feed.js'></script> <script defer src='/chat/js/message-feed.js'></script>
<script defer src='/chat/js/resizes.js'></script>
<script defer src='/chat/js/main.js'></script> <script defer src='/chat/js/main.js'></script>
</head> </head>
@ -84,10 +85,18 @@
<div class="columns chatContent"> <div class="columns chatContent">
<div class="column has-background-grey-dark has-text-light is-one-fifths content convoListContainer"> <div class="column has-background-grey-dark has-text-light is-one-fifths content convoListContainer">
<span class='friendsTitle'>Friends</span>
<hr>
<ul class='conversationList'></ul> <ul class='conversationList'></ul>
</div> </div>
<div class="column chatBox has-text-light has-background-dark is-four-fifths"> <div class="column chatBox has-text-light has-background-dark is-four-fifths">
<span class="chatFeed"></span> <span class="chatFeed"></span>
<div class="field has-addons">
<p class="control chatInput">
<textarea class="textarea" name="message-to-send" id="message-to-send" placeholder="Type your message" rows="1"></textarea>
</p>
</div>
</div> </div>
</div> </div>
</body> </body>

View File

@ -0,0 +1,6 @@
let doResize = function(){
let chatInput = document.getElementsByClassName('chatInput')[0]
chatInput.style.width = "50%";
}
doResize()
window.onresize = doResize