Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added web view #675

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.git
.github
build
node_modules
11 changes: 11 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM node:latest

WORKDIR /app

COPY package*.json /app

RUN npm i

COPY . /app

CMD [ "npm", "start" ]
22 changes: 22 additions & 0 deletions lightning-pub/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
version: "3.7"
services:
app_proxy:
environment:
APP_HOST: lightning-pub_server_1
APP_PORT: 8090

server:
image: bixie/lightning-pub:latest@sha256:9eac671645d31d1caa4c99b354d174b49d0c258486503994515aee35f481f847
volumes:
- "${APP_DATA_DIR}/data:/data"
- "${APP_LIGHTNING_NODE_DATA_DIR}:/lnd:ro"
environment:
LN_BACKEND_TYPE: "LND"
LND_ADDRESS: $APP_LIGHTNING_NODE_IP:$APP_LIGHTNING_NODE_GRPC_PORT
LND_CERT_PATH: "/lnd/tls.cert"
LND_MACAROON_PATH: "/lnd/data/chain/bitcoin/${APP_BITCOIN_NETWORK}/admin.macaroon"
DATABASE_FILE: "/data/db.sqlite"
METRICS_DATABASE_FILE: "/data/metrics.sqlite"
PORT: 8090
restart: on-failure
stop_grace_period: 1m
38 changes: 38 additions & 0 deletions lightning-pub/umbrel-app.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
manifestVersion: 1
id: lightning-pub
category: finance
name: Lightning Pub
version: "3.3.0"
tagline: Simple, database-free blockchain explorer
description: >-
BTC RPC Explorer is a full-featured, self-hosted explorer for the
Bitcoin blockchain. With this explorer, you can explore not just the
blockchain database, but also explore the functional capabilities of your
Umbrel.

It comes with a network summary dashboard, detailed view of blocks, transactions, addresses, along with analysis tools for viewing stats on miner activity, mempool summary, with fee, size, and age breakdowns. You can also search by transaction ID, block hash/height, and addresses.

It's time to appreciate the "fullness" of your node.
releaseNotes: >-
Dark mode is finally here! Easily switch between your preferred mode
in one click.

This version also includes lots of minor styling improvements, better
error handling, and several bugfixes.
developer: Dan Janosik
website: https://explorer.btc21.org
dependencies:
- bitcoin
- lightning
repo: https://github.com/janoside/btc-rpc-explorer
support: https://github.com/janoside/btc-rpc-explorer/discussions
port: 8090
gallery:
- 1.jpg
- 2.jpg
- 3.jpg
path: ""
defaultUsername: ""
defaultPassword: ""
submitter: Umbrel
submission: https://github.com/getumbrel/umbrel/pull/334
4 changes: 4 additions & 0 deletions src/auth.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
import express from 'express';
import path from 'path';
import { ServerOptions } from "../proto/autogenerated/ts/express_server";
import { AdminContext, MetricsContext } from "../proto/autogenerated/ts/types";
import Main from './services/main'
import { getLogger } from './services/helpers/logger.js'

const serverOptions = (mainHandler: Main): ServerOptions => {
const log = getLogger({})
return {
logger: { log, error: err => log("ERROR", err) },
staticFiles: path.resolve('static'),
AdminAuthGuard: adminAuth,
MetricsAuthGuard: metricsAuth,
AppAuthGuard: async (authHeader) => { return { app_id: mainHandler.applicationManager.DecodeAppToken(stripBearer(authHeader)) } },
Expand Down
Binary file added static/LightningPub.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
47 changes: 47 additions & 0 deletions static/connect.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Montserrat">
<link rel="stylesheet" href="styles.css">
<!-- HTML Meta Tags -->
<title>Lightning.Pub</title>
<meta name="description" content="Lightning for Everyone">
</head>
<body>
<header>
<img src="pub_logo.png" width="38px" height="auto" alt="Lightning Pub logo">
<img src="LightningPub.png" height="33px" alt="Lightning Pub logo">
</header>

<main>
<section class="setup-header">
<h2>Connect</h2>
<a href=""><p>To access the dashboard, use <span class="linked">ShockWallet</span> and tap the logo 3 times.</p></a>
<a href=""><p>Scan the QR with <span class="linked">ShockWallet</span> to insert the connection details.</p></a>
</section>

<div class="line"></div>

<section class="setup-content">
<div id="qrcode"></div>
<p class="text-gray">strfry.shock.network <br>npub123abcdefghhhhhhhhhhhhhhh</p><br>
<p class="text-gray">Note: Code contains a one-time pairing secret.</p>
</section>

<div class="line"></div>

<section class="setup-footer">
<p class="marked">Need Help?</p><br>
</section>
</main>

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="https://cdn.rawgit.com/davidshimjs/qrcodejs/gh-pages/qrcode.min.js"></script>

<script src="script.js"></script>
</body>
</html>
49 changes: 49 additions & 0 deletions static/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Montserrat">
<link rel="stylesheet" href="styles.css">
<!-- HTML Meta Tags -->
<title>Lightning.Pub</title>
<meta name="description" content="Lightning for Everyone">
</head>
<body>
<header>
<img src="pub_logo.png" width="38px" height="auto" alt="Lightning Pub logo">
<img src="LightningPub.png" height="33px" alt="Lightning Pub logo">
</header>

<main>
<section class="setup-header">
<h2>Setup</h2>
<p>To manage your Pub, you will connect a via remote dashboard.</p>
<p>Confirm a few things to generate a connection string:</p>
</section>

<div class="line"></div>

<section class="setup-content">
<p class="text-gray">Use default managed relay, <br>1000 sats per month paid automatically after grace period.</p>
<div class="checkbox">
<input type="checkbox" id="customCheckbox">
<label for="customCheckbox"></label>
</div>
<p>Or, enter a custom relay:</p>
<input type="text" placeholder="strfry.shock.network" value="" /><br><br><br>
<button onclick="window.location.href='/connect.html'">Generate</button>
<p class="marked">Need Help?</p>
</section>

<div class="line"></div>

<section class="setup-footer">
<p class="text-gray">npub of this instance:</p>
<p>npub123abcdesdfsdfsdfsdfsfsd456abc123</p>
</section>
</main>
</body>
</html>
Binary file added static/pub_logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions static/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
$(document).ready(function() {
var qrcode = new QRCode(document.getElementById("qrcode"), {
text: "strfry.shock.network npub123abcdefghhhhhhhhhhhhhhh",
width: 157,
height: 157,
colorDark : "#ffffff",
colorLight : "#000000",
correctLevel : QRCode.CorrectLevel.H
});
});
168 changes: 168 additions & 0 deletions static/styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,168 @@
:root {
--background-color: #16191c;
--color: #ffffff;
--color-marked: #ff7700;
--color-linked: #2aabe9;
--gradient: linear-gradient(60deg, #ff7700 0%, #c740c7 100%);
--font-size-h2: 36px;
--font-size-p: 16px;
}

body {
margin-block-start: 15px;
font-family: Montserrat;
background-color: var(--background-color);
color: var(--color);
text-align: center;
overflow: scroll;
}

header {
background-color: var(--background-color);
padding-inline: 2%;
display: flex;
flex-direction: row;
align-items: center;
gap: 1rem;
}

main {
max-width: 700px;
width: 100%;
margin-inline: auto;
}

@media (min-width: 768px) {
body {
zoom: 1.4;
}

}

@media (min-width: 2000px) {
body {
zoom: 1.6;
}

}

@media screen and (max-width: 425px) {
header>img:nth-child(1){
width: 30px;
height: auto;
}

header>img:nth-child(2){
width: auto;
height: 26px;
}
}

input[type="text"] {
background-color: transparent;
padding: 7px 10px;
border: 1px solid #c740c7;
border-radius: 5px;
font-size: 14px;
color: #999999;
text-align: center;
box-shadow: 0px 0px 2px rgba(0,0,0,1);
}

button {
background-color: transparent;
padding: 10px 55px;
font-size: 20px;
color: var(--color);
text-align: center;
box-shadow: 0px 0px 2px rgba(0,0,0,1);
background: linear-gradient(var(--background-color), var(--background-color)) padding-box, var(--gradient) border-box;
border-radius: 5px;
border: 1px solid transparent;
}


h2 {
font-size: var(--font-size-h2);
font-weight: 400;
}

p {
font-size: var(--font-size-p);
}

a {
color: var(--color);
text-decoration: none;
}

.text-gray {
color: #a3a3a3;
margin-block-end: 5px;
}

/* Hide the default checkbox */
.checkbox input[type="checkbox"] {
display: none;
}

/* Create a new box */
.checkbox label {
position: relative;
}

.checkbox label::before {
content: "";
display: inline-block;
width: 20px;
height: 20px;
margin-right: 10px;
background-color: transparent;
border: 1px solid #a3a3a3;
border-radius: 5px;
}

/* Display a checkmark when the checkbox is checked */
.checkbox input[type="checkbox"]:checked + label::after {
content: "✔";
color: #a012c7;
font-size: 20px;
position: absolute;
left: 1px;
top: -11px;
width: 20px;
height: 20px;
text-align: center;
}

.line {
margin-block: 30px;
background: var(--gradient);
width: 347px;
height: 2px;
margin-inline: auto;
}

.marked {
color: var(--color-marked);
}

.linked {
color: var(--color-linked);
}

.setup-footer>p {
line-height: 4px;
}

.setup-header>h2 {
margin-block-start: 20px;
}

#qrcode {
display: flex;
margin: auto;
justify-content: center;
margin-block-start: 40px;
margin-block-end: 15px;
}
Loading