Skip to content

Commit

Permalink
Merge pull request #163 from stakwork/logg
Browse files Browse the repository at this point in the history
Logg
  • Loading branch information
Evanfeenstra authored Mar 24, 2021
2 parents 288ca9c + 8ec938f commit 7af8361
Show file tree
Hide file tree
Showing 61 changed files with 1,189 additions and 611 deletions.
6 changes: 4 additions & 2 deletions app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import * as bodyParser from 'body-parser'
import * as helmet from 'helmet'
import * as cookieParser from 'cookie-parser'
import * as cors from 'cors'
import logger from './src/utils/logger'
import logger, {logging} from './src/utils/logger'
import { pingHubInterval, checkInvitesHubInterval } from './src/hub'
import { genUsersInterval } from './src/utils/proxy'
import { setupDatabase, setupDone, setupOwnerContact } from './src/utils/setup'
Expand Down Expand Up @@ -66,7 +66,9 @@ function setupApp() {
app.use(helmet());
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true }));
app.use(logger)
if (logging.Express) {
app.use(logger)
}
app.use(cors({
allowedHeaders: ['X-Requested-With', 'Content-Type', 'Accept', 'x-user-token']
}))
Expand Down
4 changes: 3 additions & 1 deletion dist/app.js

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

2 changes: 1 addition & 1 deletion dist/app.js.map

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

97 changes: 34 additions & 63 deletions dist/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,20 @@
input[type="checkbox"] {
pointer-events: none;
}

a{
color:#628aff;
font-weight: bold;
}
a:visited{
color:#628aff;
font-weight: bold;
}
#stuff{
display: flex;
align-items: center;
flex-direction: column;
}
</style>
<script>var hi='hello';</script>
</head>
Expand All @@ -79,33 +93,6 @@

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

<ul>

<li>
<input id="chan" type="checkbox" />
<span id="chan-text"></span>
<pre id="chan-pre" style="display:none;">
lncli connect SPHINX_HUB_PUBKEY@54.159.193.149:9735

lncli openchannel SPHINX_HUB_PUBKEY --local_amt=*** --push_amt=*** --sat_per_byte=***
</pre>
</li>

<li>
<input id="fees" type="checkbox" />
<span id="fees-text"></span>
<pre id="fees-pre" style="display:none;">
lncli updatechanpolicy --base_fee_msat=0 --fee_rate=0.000001 --time_lock_delta=40 --chan_point=***
</pre>
</li>

<li>
<input id="bal" type="checkbox" />
<span id="bal-text"></span>
</li>

</ul>

<div id="qr-wrap" style="display: none;">
<canvas id="qr"></canvas>
</div>
Expand All @@ -118,6 +105,16 @@
CONNECTION_STRING
</pre>

<div id="stuff">
<p>
You need to open a channel with our routing hub in order to connect to other Sphinx users.
</p>

<a href="https://github.com/stakwork/sphinx-relay/wiki" target="_blank">
Read more here
</a>
</div>

<script src="/static/js/qrious.js"></script>
<script>
(function () {
Expand All @@ -131,52 +128,26 @@
<script>
function get(id){ return document.getElementById(id) }

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

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

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

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'
feesPre.style.display = 'block'
}

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

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

const readyToGo = window.hasRemoteBalance && window.channelFeesBaseZero && window.channelIsOpen
const stuff = get('stuff')
if(readyToGo) {
stuff.style.display='none'
}

function genChannel() {

}
</script>
</body>

Expand Down
183 changes: 183 additions & 0 deletions dist/public/index2.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,183 @@
<!DOCTYPE html>
<html>

<head>
<title>Sphinx Relay</title>
<link rel="icon" href="/static/sphinx-logo.png">
<style>
html {
font-family: Arial, Helvetica, sans-serif;
color: white;
}

body {
background: #292a2d;
display: flex;
flex-direction: column;
align-items: center;
}

#qr-wrap {
background: white;
width: 300px;
height: 300px;
border-radius: 5px;
display: flex;
align-items: center;
justify-content: center;
margin-top: 20px;
}

canvas {
height: 280px;
width: 280px;
}

pre {
margin-top: 8px;
border-radius: 10px;
max-width: 250px;
padding: 18px 25px 0px 25px;
border: 1px solid tan;
background: white;
overflow: hidden;
overflow-wrap: break-word;
display: block;
white-space: pre-wrap;
color:darkslategray;
}

img {
height: 100px;
width: 100px;
margin-top: 20px;
}

p {
margin-top: 30px;
max-width: 300px;
text-align: center;
}

ul {
list-style: none;
max-width:333px;
}

li {
margin-top: 8px;
}

input[type="checkbox"] {
pointer-events: none;
}
</style>
<script>var hi='hello';</script>
</head>

<body>

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

<ul>

<li>
<input id="chan" type="checkbox" />
<span id="chan-text"></span>
<pre id="chan-pre" style="display:none;">
lncli connect SPHINX_HUB_PUBKEY@54.159.193.149:9735

lncli openchannel SPHINX_HUB_PUBKEY --local_amt=*** --push_amt=*** --sat_per_byte=***
</pre>
</li>

<li>
<input id="fees" type="checkbox" />
<span id="fees-text"></span>
<pre id="fees-pre" style="display:none;">
lncli updatechanpolicy --base_fee_msat=0 --fee_rate=0.000001 --time_lock_delta=40 --chan_point=***
</pre>
</li>

<li>
<input id="bal" type="checkbox" />
<span id="bal-text"></span>
</li>

</ul>

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

<p id="qr-text">
Scan the QR or copy the connection string into your Sphinx app
</p>

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

<script src="/static/js/qrious.js"></script>
<script>
(function () {
var qr = new QRious({
element: document.getElementById('qr'),
value: 'CONNECTION_STRING',
size: 300
});
})();
</script>
<script>
function get(id){ return document.getElementById(id) }

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

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

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

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'
feesPre.style.display = 'block'
}

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

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

</html>
1 change: 0 additions & 1 deletion dist/src/builtin/mother.js

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

Loading

0 comments on commit 7af8361

Please sign in to comment.