Add footer with copyright and source link

This commit is contained in:
cel
2020-06-11 14:20:06 -04:00
parent 514c401ff1
commit aa1697181e
3 changed files with 32 additions and 3 deletions
+1 -1
View File
@@ -101,7 +101,7 @@ e.g. `--viewer.port 8807`.
## License ## License
Copyright (c) 2016-2017 Secure Scuttlebutt Consortium Copyright (c) 2016-2020 Secure Scuttlebutt Consortium
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as it under the terms of the GNU Affero General Public License as
+5
View File
@@ -4,6 +4,11 @@
"description": "serve ssb threads as (embeddable) web pages", "description": "serve ssb threads as (embeddable) web pages",
"main": "index.js", "main": "index.js",
"bin": "bin.js", "bin": "bin.js",
"homepage": "https://git.scuttlebot.io/%25MeCTQrz9uszf9EZoTnKCeFeIedhnKWuB3JHW2l1g9NA%3D.sha256",
"repository": {
"type": "git",
"url": "ssb://%MeCTQrz9uszf9EZoTnKCeFeIedhnKWuB3JHW2l1g9NA=.sha256"
},
"dependencies": { "dependencies": {
"asyncmemo": "^1.0.0", "asyncmemo": "^1.0.0",
"emoji-named-characters": "^1.0.2", "emoji-named-characters": "^1.0.2",
+26 -2
View File
@@ -1,4 +1,6 @@
var fs = require('fs')
var path = require('path') var path = require('path')
var proc = require('child_process')
var pull = require("pull-stream") var pull = require("pull-stream")
var marked = require("ssb-marked") var marked = require("ssb-marked")
var htime = require("human-time") var htime = require("human-time")
@@ -6,6 +8,7 @@ var emojis = require("emoji-named-characters")
var cat = require("pull-cat") var cat = require("pull-cat")
var h = require('hyperscript') var h = require('hyperscript')
var refs = require('ssb-ref') var refs = require('ssb-ref')
var pkg = require('./package')
var emojiDir = path.join(require.resolve("emoji-named-characters"), "../pngs") var emojiDir = path.join(require.resolve("emoji-named-characters"), "../pngs")
@@ -157,6 +160,21 @@ function renderRssItem(opts) {
) )
} }
const gitHead = proc.spawnSync('git', ['rev-parse', 'HEAD'], {
encoding: 'utf8',
cwd: __dirname
}).stdout.trim()
const gitHeadShort = gitHead && gitHead.substr(0, 7)
const commitUrl = pkg.homepage &&
pkg.homepage.replace(/\/+$/, '') + '/commit/' + gitHead
const gitLink = !gitHead ? '' :
!commitUrl ? `<code title="${gitHead}">${gitHeadShort}</code>` :
`<a href="${commitUrl}" title="${gitHead}"><code>${gitHeadShort}</code></a>`
const footer = `
<div class=footer>AGPLv3 &copy; <a href="${pkg.homepage}">${pkg.name}</a> ${gitLink}</div>
`
function wrapPage(id) { function wrapPage(id) {
return wrap( return wrap(
"<!doctype html><html><head>" + "<!doctype html><html><head>" +
@@ -167,7 +185,7 @@ function wrapPage(id) {
'<meta name=viewport content="width=device-width,initial-scale=1">' + '<meta name=viewport content="width=device-width,initial-scale=1">' +
styles + styles +
"</head><body>", "</head><body>",
"</body></html>" footer + "\n</body></html>"
) )
} }
@@ -289,7 +307,7 @@ var styles = `
text-align: center; text-align: center;
text-decoration: none; text-decoration: none;
margin-top: 20px; margin-top: 20px;
margin-bottom: 60px; margin-bottom: 30px;
background-color: #5c7cfa; background-color: #5c7cfa;
padding: 15px 0; padding: 15px 0;
color: #edf2ff; color: #edf2ff;
@@ -303,6 +321,12 @@ var styles = `
.attending { .attending {
text-align: center; text-align: center;
} }
.footer {
text-align: center;
margin-bottom: 10px;
font-size: 14px;
color: #868e96;
}
</style> </style>
` `