Update views

This commit is contained in:
Daniel Seripap 2016-12-28 10:47:28 -05:00
parent 5d66217e8e
commit fc8b2459b1
3 changed files with 21 additions and 9 deletions

View File

@ -42,8 +42,8 @@ app.get('/', (req, res) => generateNewRoom(req, res, 'lobby'));
app.get('/:roomId', (req, res) => { app.get('/:roomId', (req, res) => {
const stripName = (name) => { const stripName = (name) => {
const chatName = name.toLowerCase().replace(/[^A-Za-z0-9]/g, '-'); const chatName = name.toLowerCase().replace(/[^A-Za-z0-9]/g, '-');
if (chatName.length >= 25) { if (chatName.length >= 50) {
return chatName.substr(0, 25); return chatName.substr(0, 50);
} }
return chatName; return chatName;

View File

@ -4,6 +4,7 @@ import WindowHandler from './window';
import Chat from './chat'; import Chat from './chat';
import moment from 'moment'; import moment from 'moment';
import sanitizeHtml from 'sanitize-html'; import sanitizeHtml from 'sanitize-html';
import uuid from 'uuid';
import he from 'he'; import he from 'he';
export default class App { export default class App {
@ -18,8 +19,8 @@ export default class App {
stripName(name) { stripName(name) {
const chatName = name.replace('/','').toLowerCase().replace(/[^A-Za-z0-9]/g, '-'); const chatName = name.replace('/','').toLowerCase().replace(/[^A-Za-z0-9]/g, '-');
if (chatName.length >= 25) { if (chatName.length >= 50) {
const limitedChatName = chatName.substr(0, 25); const limitedChatName = chatName.substr(0, 50);
window.history.replaceState({}, limitedChatName, `/${limitedChatName}`); window.history.replaceState({}, limitedChatName, `/${limitedChatName}`);
return `/${limitedChatName}`; return `/${limitedChatName}`;
} }
@ -37,7 +38,6 @@ export default class App {
$('input.share-text').click(() => { $('input.share-text').click(() => {
$(this).focus(); $(this).focus();
$(this).select(); $(this).select();
$(this).setSelectionRange(0, 9999);
}); });
const windowHandler = new WindowHandler(this._darkwire, this._socket, this._chat); const windowHandler = new WindowHandler(this._darkwire, this._socket, this._chat);
@ -259,12 +259,22 @@ export default class App {
} }
this._chat.log(moment().format('MMMM Do YYYY, h:mm:ss a'), {info: true}); this._chat.log(moment().format('MMMM Do YYYY, h:mm:ss a'), {info: true});
$('#roomName').text(this._roomId); $('#roomName').text(this._roomId);
$('#chatNameModal').text(this._roomId);
this._darkwire.updateUsername(username).then((socketData) => { this._darkwire.updateUsername(username).then((socketData) => {
this._chat.chatPage.show(); this._chat.chatPage.show();
this._chat.inputMessage.focus(); this._chat.inputMessage.focus();
this._socket.emit('add user', socketData); this._socket.emit('add user', socketData);
}); });
$('#newRoom').on('click', (e) => {
e.preventDefault();
const newWindow = window.open();
newWindow.opener = null;
newWindow.location = window.location.protocol + '//' + window.location.host + '/' + uuid.v4().replace(/-/g,'');
});
} }
addParticipantsMessage(data) { addParticipantsMessage(data) {

View File

@ -39,7 +39,7 @@
<!-- Collect the nav links, forms, and other content for toggling --> <!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1"> <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav navbar-right"> <ul class="nav navbar-nav navbar-right">
<li><a href="/" target="_blank"><span class="glyphicon glyphicon-plus" aria-hidden="true"></span>&nbsp;New Room</a></li> <li><a id="newRoom" href="#" target="_blank"><span class="glyphicon glyphicon-plus" aria-hidden="true"></span>&nbsp;New Room</a></li>
<li><a href="javascript:void(0)" id="settings-nav"><span class="glyphicon glyphicon-cog" aria-hidden="true"></span>&nbsp;Settings</a></li> <li><a href="javascript:void(0)" id="settings-nav"><span class="glyphicon glyphicon-cog" aria-hidden="true"></span>&nbsp;Settings</a></li>
<li><a href="javascript:void(0)" id="about-nav"><span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span>&nbsp;About</a></li> <li><a href="javascript:void(0)" id="about-nav"><span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span>&nbsp;About</a></li>
</ul> </ul>
@ -78,7 +78,10 @@
<div class="modal-body"> <div class="modal-body">
{{>partials/ip}} {{>partials/ip}}
<p>Public lobby: <a href="/lobby">/lobby</a></p>
<p class="bold">WARNING: Darkwire does not mask IP addresses nor can verify the integrity of parties recieving messages. Proceed with caution and always confirm recipients before starting a chat session.</p> <p class="bold">WARNING: Darkwire does not mask IP addresses nor can verify the integrity of parties recieving messages. Proceed with caution and always confirm recipients before starting a chat session.</p>
<p>Please also note that <strong>ALL CHATROOMS</strong> are public. Anyone can guess your room URL. If you need a more-private room, we recommend using a randomly generated room (+New Room button) and stay away from dictionary words.</p>
<p>Questions/comments? Email us at hello[at]darkwire.io<br> <p>Questions/comments? Email us at hello[at]darkwire.io<br>
Found a bug or want a new feature? <a href="https://github.com/seripap/darkwire.io/issues" target="_blank">Open a ticket on Github</a>.</p> Found a bug or want a new feature? <a href="https://github.com/seripap/darkwire.io/issues" target="_blank">Open a ticket on Github</a>.</p>
@ -123,10 +126,9 @@
<small>TOR Mirror: <a href="http://darkwirevqhjfmla.onion" target="_blank">http://darkwirevqhjfmla.onion</a></small> <small>TOR Mirror: <a href="http://darkwirevqhjfmla.onion" target="_blank">http://darkwirevqhjfmla.onion</a></small>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<h6>We've placed you in a new chat room</h6> <h6>You're the first one in <span id="chatNameModal"></span></h6>
<p class="bold">This software uses the <a href="https://developer.mozilla.org/en-US/docs/Web/API/Crypto" target="_blank">Crypto Web API</a> to encrypt data which is transferred using <a href="https://en.wikipedia.org/wiki/WebSocket" target="_blank">secure WebSockets</a>. <a href="javascript:void(0)" id="about-nav" data-dismiss="modal">See Disclaimer</a>.</p> <p class="bold">This software uses the <a href="https://developer.mozilla.org/en-US/docs/Web/API/Crypto" target="_blank">Crypto Web API</a> to encrypt data which is transferred using <a href="https://en.wikipedia.org/wiki/WebSocket" target="_blank">secure WebSockets</a>. <a href="javascript:void(0)" id="about-nav" data-dismiss="modal">See Disclaimer</a>.</p>
<p><a href="https://github.com/seripap/darkwire.io" target="_blank">We believe in your privacy. View the source code and documentation on Github.</a></p>
<p><a href="https://github.com/seripap/darkwire.io" target="_blank">We believe in your privacy and full transparency. View the source code and documentation on Github.</a></p>
<br> <br>
<h6>Invite People to This Room</h6> <h6>Invite People to This Room</h6>
<p> <p>