mirror of
https://github.com/irislib/iris-messenger.git
synced 2024-10-18 06:03:22 +00:00
Merge branch 'stateandbehavior-master'
This commit is contained in:
commit
bcc9b9ce54
@ -19,6 +19,7 @@ body {
|
||||
|
||||
a {
|
||||
text-decoration: none;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
a:hover {
|
||||
@ -51,10 +52,6 @@ img {
|
||||
max-height: 80vh;
|
||||
}
|
||||
|
||||
.hidden {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
@media (max-width: 575px) {
|
||||
.hidden-xs {
|
||||
display: none !important;
|
||||
@ -91,6 +88,10 @@ img {
|
||||
}
|
||||
}
|
||||
|
||||
.hidden {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.chat {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
@ -309,10 +310,8 @@ header #back-button {
|
||||
}
|
||||
|
||||
#login {
|
||||
display: none;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 15px;
|
||||
display: flex;
|
||||
overflow-y: scroll;
|
||||
color: white;
|
||||
position: fixed;
|
||||
@ -322,6 +321,10 @@ header #back-button {
|
||||
bottom: 0;
|
||||
background-color: var(--login-background);
|
||||
z-index: 1000;
|
||||
}
|
||||
|
||||
#login-content {
|
||||
margin: auto;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
|
@ -60,13 +60,29 @@
|
||||
|
||||
<body>
|
||||
<div class="chat">
|
||||
<section id="login">
|
||||
<img style="width: 86px" src="img/android-chrome-192x192.png" alt="Iris">
|
||||
<h1>Iris Messenger</h1>
|
||||
<form id="login-form" autocomplete="off">
|
||||
<input autofocus autocomplete="off" autocorrect="off" autocapitalize="sentences" spellcheck="off" id="login-form-name" type="text" name="name" placeholder="What's your name?">
|
||||
<p><button type="submit">Go</button></p>
|
||||
</form>
|
||||
<section id="login" class="hidden">
|
||||
<div id="login-content">
|
||||
<div id="login-form" autocomplete="off">
|
||||
<div id="create-account">
|
||||
<img style="width: 86px" src="img/android-chrome-192x192.png" alt="Iris">
|
||||
<h1>Iris Messenger</h1>
|
||||
<input autofocus autocomplete="off" autocorrect="off" autocapitalize="sentences" spellcheck="off" id="login-form-name" type="text" name="name" placeholder="What's your name?">
|
||||
<p><button id="sign-up" type="input">Go</button></p>
|
||||
<br>
|
||||
<p><a id="show-existing-account-login">Already have an account?</a></p>
|
||||
</div>
|
||||
</div>
|
||||
<div id="existing-account-login" class="hidden">
|
||||
<p><a id="show-create-account">< Back</a></p>
|
||||
<input id="paste-privkey" placeholder="Paste a private key">
|
||||
<p>
|
||||
<button id="scan-privkey-btn">Scan private key QR code</button>
|
||||
</p>
|
||||
</p>
|
||||
<video id="privkey-qr-video" width="320" height="320" style="object-fit: cover;" class="hidden"></video>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="sidebar hidden-xs">
|
||||
@ -175,9 +191,6 @@
|
||||
<p>
|
||||
<button class="show-logout-confirmation">Log out</button>
|
||||
</p>
|
||||
<p>
|
||||
<button class="show-switch-account">Switch account</button>
|
||||
</p>
|
||||
<h4>Private key</h4>
|
||||
<p>
|
||||
<b>DANGER!</b> Private key is used to <b>log in to your account</b>. Don't give or show your private key to anyone else!
|
||||
@ -189,7 +202,8 @@
|
||||
<p>
|
||||
<button id="show-private-key-qr">Show private key QR code</button>
|
||||
</p>
|
||||
<h4>Peers</h4>
|
||||
<hr/>
|
||||
<h3>Peers</h3>
|
||||
<div id="peers" class="flex-table">
|
||||
<div class="flex-row" id="add-peer-row">
|
||||
<div class="flex-cell">
|
||||
@ -255,16 +269,6 @@
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<!-- Login view -->
|
||||
<div class="main-view" id="switch-account">
|
||||
<input id="paste-privkey" placeholder="Paste a private key">
|
||||
<p>
|
||||
<button id="startButton" onclick="startPrivKeyQRScanner()">Scan private key QR code</button>
|
||||
</p>
|
||||
</p>
|
||||
<video id="privkey-qr-video" width="320" height="320" style="object-fit: cover;"></video>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<!-- Profile view -->
|
||||
<div class="main-view" id="profile">
|
||||
|
@ -128,10 +128,9 @@ async function addPeer(peer) {
|
||||
}
|
||||
|
||||
function newUserLogin() {
|
||||
$('#login').css('display', 'flex');
|
||||
$('#login').show();
|
||||
$('#login-form-name').focus();
|
||||
$('#login-form').submit(e => {
|
||||
e.preventDefault();
|
||||
$('#sign-up').click(function() {
|
||||
var name = $('#login-form-name').val();
|
||||
if (name.length) {
|
||||
$('#login').hide();
|
||||
@ -148,6 +147,7 @@ function login(k) {
|
||||
chats = {};
|
||||
key = k;
|
||||
localStorage.setItem('chatKeyPair', JSON.stringify(k));
|
||||
$('#login').hide();
|
||||
iris.Chat.initUser(gun, key);
|
||||
$('#my-chat-links').empty();
|
||||
iris.Chat.getMyChatLinks(gun, key, undefined, chatLink => {
|
||||
@ -420,6 +420,17 @@ function getUserChatLink(pub) {
|
||||
return 'https://iris.to/?chatWith=' + pub;
|
||||
}
|
||||
|
||||
var scanPrivKeyBtn = $('#scan-privkey-btn');
|
||||
scanPrivKeyBtn.click(() => {
|
||||
if ($('#privkey-qr-video:visible').length) {
|
||||
$('#privkey-qr-video').hide();
|
||||
cleanupScanner();
|
||||
} else {
|
||||
$('#privkey-qr-video').show();
|
||||
startPrivKeyQRScanner();
|
||||
}
|
||||
});
|
||||
|
||||
$('#scan-chatlink-qr-btn').click(() => {
|
||||
if ($('#chatlink-qr-video:visible').length) {
|
||||
$('#chatlink-qr-video').hide();
|
||||
@ -503,14 +514,22 @@ function showLogoutConfirmation() {
|
||||
$('#logout-confirmation').show();
|
||||
}
|
||||
|
||||
$('.show-switch-account').click(showSwitchAccount);
|
||||
$('#show-existing-account-login').click(showSwitchAccount);
|
||||
function showSwitchAccount() {
|
||||
resetView();
|
||||
$('#header-content').text('Switch account');
|
||||
$('#switch-account').show();
|
||||
$('#create-account').hide();
|
||||
$('#existing-account-login').show();
|
||||
}
|
||||
|
||||
$('#switch-account input').on('input', (event) => {
|
||||
$('#show-create-account').click(showCreateAccount);
|
||||
function showCreateAccount() {
|
||||
$('#privkey-qr-video').hide();
|
||||
$('#create-account').show();
|
||||
$('#existing-account-login').hide();
|
||||
cleanupScanner();
|
||||
}
|
||||
|
||||
$('#existing-account-login input').on('input', (event) => {
|
||||
var val = $(event.target).val();
|
||||
if (!val.length) { return; }
|
||||
try {
|
||||
|
Loading…
Reference in New Issue
Block a user