Commit 9e463648 authored by Daniel Edgecumbe's avatar Daniel Edgecumbe

Create basic about page using _git_status, AUTHORS.md

parent e0905249
Pipeline #284 failed with stages
in 16 seconds
......@@ -43,13 +43,6 @@ BCDARGS=
### end user configurable section ###
>&2 echo "Generating _git_status..."
echo "bitcoin-top" > nginx/_git_status
git rev-parse HEAD >> nginx/_git_status
git log -1 --oneline HEAD >> nginx/_git_status
git status --porcelain >> nginx/_git_status
function gen_password {
cat /dev/urandom | tr -dc "a-zA-Z0-9"| fold -w 24 | head -n 1
}
......
......@@ -5,3 +5,4 @@
frontend/chartist-plugin-tooltip
*.db
_git_status
AUTHORS.md
......@@ -22,3 +22,5 @@ COPY nginx-config/default /etc/nginx/conf.d/default.conf
COPY public_html /usr/share/nginx/html
COPY _git_status /usr/share/nginx/html/_git_status
COPY _git_status /usr/share/nginx/html/_git_status.txt
COPY AUTHORS.md /usr/share/nginx/html/AUTHORS.md
COPY AUTHORS.md /usr/share/nginx/html/AUTHORS.md.txt
......@@ -342,3 +342,14 @@ div#wallettable span.walubal {
div#wallettable span.walubal.new {
background-color: #ccccff;
}
div#authorsmd, div#gitstatus {
white-space: pre;
}
div#about {
display: grid;
grid-gap: 2rem;
grid-template-columns: 1fr 1fr;
margin: 2rem;
}
......@@ -361,6 +361,26 @@ along with bitcoin-top. If not, see <http://www.gnu.org/licenses/>.
</div>
<div id="tab-about" class="tab"
:class="tab === 'about' ? 'visible' : 'invisible'"
>
<div id="about">
<div>
<template v-if="git_status">
<h1>_git_status</h1>
<div id="gitstatus">{{ git_status }}</div>
</template>
</div>
<div>
<template v-if="authors_md">
<h1>AUTHORS.md</h1>
<div id="authorsmd">{{ authors_md }}</div>
</template>
</div>
</div>
</div>
</div> <!-- /rightcol -->
</div> <!-- /app -->
</body>
......@@ -16,6 +16,7 @@
// along with bitcoin-top. If not, see <http://www.gnu.org/licenses/>.
//
const THIS_URL = `${window.location.protocol}//${window.location.host}`;
const API_URL = `${window.location.protocol}//${window.location.host}/api`;
const ALL_BITCOINS = 21*(10**14);
const INITIAL_RANGE = 480;
......@@ -29,6 +30,7 @@ const TABS = [
["peers", "peers"],
["mempool-chart", "mempool chart"],
["network-chart", "network chart"],
["about", "about"],
];
const RANGES = [
......@@ -67,14 +69,23 @@ var getCurrentTimeUTC = function() {
return Math.floor((now.getTime() + now.getTimezoneOffset() * 60000)/1000);
};
var asyncRequest = function(request, callback) {
var rawAsyncRequest = function(request, callback) {
asyncRequest(request, callback, true);
}
var asyncRequest = function(request, callback, raw=false) {
var xhr = new XMLHttpRequest();
xhr.open("GET", `${API_URL}/${request}`, true);
let url = raw ? request : `${API_URL}/${request}`;
xhr.open("GET", url, true);
xhr.onload = function(e) {
if (xhr.readyState === 4) {
if (xhr.status === 200) {
let j = JSON.parse(xhr.responseText);
callback(request, j);
if (raw) {
callback(request, xhr.responseText);
} else {
let j = JSON.parse(xhr.responseText);
callback(request, j);
}
} else {
// console.error(xhr.statusText);
}
......@@ -106,13 +117,15 @@ onload = function() {
unused_address: null,
unused_address_qr: null,
transactions: null,
git_status: null,
authors_md: null,
bt_logscale: true,
peers: null,
data: 7,
datas: DATAS,
range: 0,
ranges: RANGES,
tab: "wallet",
tab: "about",
tabs: TABS,
blocks: {},
staging: window.location.host.includes("test"),
......@@ -361,6 +374,14 @@ onload = function() {
app.transactions = t;
}
let dealWithGitStatus = function(r, t) {
app.git_status = t;
}
let dealWithAuthorsMd = function(r, t) {
app.authors_md = t;
}
let dealWithPeerinfo = function(peerinfo) {
app.peers = peerinfo;
}
......@@ -739,4 +760,6 @@ onload = function() {
}
asyncRequest(`uptime`, processAsyncResponse);
rawAsyncRequest(`${THIS_URL}/_git_status`, dealWithGitStatus);
rawAsyncRequest(`${THIS_URL}/AUTHORS.md`, dealWithAuthorsMd);
}
......@@ -19,6 +19,15 @@
#
>&2 echo "Building..."
>&2 echo "Generating _git_status..."
echo "bitcoin-top" > nginx/_git_status
git rev-parse HEAD >> nginx/_git_status
git log -1 --oneline HEAD >> nginx/_git_status
git status --porcelain >> nginx/_git_status
cp AUTHORS.md nginx/AUTHORS.md
# If the build step fails, try uncommenting this:
NOCACHE=
#NOCACHE=--no-cache
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment