Skip to content

Commit

Permalink
better reconnect
Browse files Browse the repository at this point in the history
  • Loading branch information
Evanfeenstra committed Apr 2, 2021
1 parent 3602211 commit 044a7db
Show file tree
Hide file tree
Showing 4 changed files with 83 additions and 56 deletions.
104 changes: 56 additions & 48 deletions dist/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,13 @@

<img src="/static/sphinx-logo.png" alt="logo" />

<ul>
<!-- <ul>
<li>
<input id="chan" type="checkbox" />
<span id="chan-text"></span>
</li>
<li>
<input id="fees" type="checkbox" />
<span id="fees-text"></span>
Expand All @@ -110,22 +110,30 @@
<span id="bal-text"></span>
</li>
</ul>
</ul> -->

<br />
<a href="https://github.com/stakwork/sphinx-relay/wiki" target="_blank">
Read more here
</a>
<!-- <br /> -->
<p>
Sphinx will not work unless you follow
<a href="https://github.com/stakwork/sphinx-relay/wiki/Home-node-FAQ" target="_blank">
these specific channel instructions
</a> !!
</p>

<div id="qr-wrap" style="display: none;">
<div id="qr-wrap">
<canvas id="qr"></canvas>
</div>

<p id="qr-text" style="display: none;">
Scan the QR or copy the connection string into your Sphinx app
<p id="qr-text">
Scan the QR or copy the connection string into your Sphinx app.
</p>

<p>
This is a 1 time use token to pair the app with your node.
To pair other devices, tap "export keys" on your profile page in the Sphinx app.
</p>

<pre id="connection-string" style="display: none;">
<pre id="connection-string">
CONNECTION_STRING
</pre>

Expand All @@ -140,51 +148,51 @@
})();
</script>
<script>
function get(id){ return document.getElementById(id) }

const chan = get('chan')
const chanText = get('chan-text')

if(window.channelIsOpen) {
chan.checked = true
chanText.innerHTML = 'You have an open channel'
} else {
chanText.innerHTML = 'You need to open a channel'
}

const fees = get('fees')
const feesText = get('fees-text')

if(window.channelFeesBaseZero) {
fees.checked = true
feesText.innerHTML = 'You have set your fee base to 0'
} else {
feesText.innerHTML = 'You need to set your fee base to 0'
}

const bal = get('bal')
const balText = get('bal-text')

if(window.hasRemoteBalance) {
bal.checked = true
balText.innerHTML = 'You have remote balance'
} else {
balText.innerHTML = 'You need remote balance (2% of channel size recommended)'
}
// function get(id){ return document.getElementById(id) }

// const chan = get('chan')
// const chanText = get('chan-text')

// if(window.channelIsOpen) {
// chan.checked = true
// chanText.innerHTML = 'You have an open channel'
// } else {
// chanText.innerHTML = 'You need to open a channel'
// }

// const fees = get('fees')
// const feesText = get('fees-text')

// if(window.channelFeesBaseZero) {
// fees.checked = true
// feesText.innerHTML = 'You have set your fee base to 0'
// } else {
// feesText.innerHTML = 'You need to set your fee base to 0'
// }

// const bal = get('bal')
// const balText = get('bal-text')

// if(window.hasRemoteBalance) {
// bal.checked = true
// balText.innerHTML = 'You have remote balance'
// } else {
// balText.innerHTML = 'You need remote balance (2% of channel size recommended)'
// }

const qrWrap = get('qr-wrap')
const connString = get('connection-string')
const qrText = get('qr-text')

const readyToGo = window.hasRemoteBalance && window.channelFeesBaseZero && window.channelIsOpen
// const readyToGo = window.hasRemoteBalance && window.channelFeesBaseZero && window.channelIsOpen

if(window.isSignedUp) {
qrText.innerHTML = "You have connected your app!"
} else if(readyToGo) {
// if(window.isSignedUp) {
// qrText.innerHTML = "You have connected your app!"
// } else if(readyToGo) {
qrWrap.style.display = 'flex'
qrText.style.display = 'block'
connString.style.display = 'block'
}
// }

</script>
</body>
Expand Down
17 changes: 13 additions & 4 deletions dist/src/utils/tribes.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 044a7db

Please sign in to comment.