s/Lightning Kite/Lightning Charge/g
This commit is contained in:
parent
668659b233
commit
d5e243f13b
|
@ -10,7 +10,7 @@ Sell digital files with Lightning!
|
|||
|
||||
## Quickstart
|
||||
|
||||
Setup [Lightning Kite](https://github.com/ElementsProject/lightning-strike), then:
|
||||
Setup [Lightning Charge](https://github.com/ElementsProject/lightning-charge), then:
|
||||
|
||||
```bash
|
||||
# Install dependencies for EXIF extraction and preview generation
|
||||
|
@ -48,10 +48,10 @@ host: 127.0.0.1
|
|||
env: production
|
||||
url: http://my-public-url.com/
|
||||
|
||||
### Lightning Kite
|
||||
### Lightning Charge
|
||||
|
||||
kite_url: http://localhost:9112
|
||||
kite_token: API_TOKEN_CONFIGURED_IN_KITE
|
||||
charge_url: http://localhost:9112
|
||||
charge_token: API_TOKEN_CONFIGURED_IN_CHARGE
|
||||
|
||||
### FileBazaar settings
|
||||
|
||||
|
|
|
@ -8,10 +8,10 @@ env: production
|
|||
#host: 127.0.0.1
|
||||
#url: http://my-public-url.com/
|
||||
|
||||
### Lightning Kite
|
||||
### Lightning Charge
|
||||
|
||||
#kite_url: http://localhost:9112
|
||||
#kite_token: TOKEN_GOES_HERE
|
||||
#charge_url: http://localhost:9112
|
||||
#charge_token: TOKEN_GOES_HERE
|
||||
|
||||
### FileBazaar settings
|
||||
|
||||
|
|
10
app.js
10
app.js
|
@ -3,7 +3,7 @@ import { pwrap, pick, fcurrency, fmsat, pngPixel } from './lib/util'
|
|||
// Setup
|
||||
const app = require('express')()
|
||||
, conf = require('./lib/config')(process.argv[2] || process.cwd())
|
||||
, kite = require('lightning-strike-client')(conf.kite_url, conf.kite_token)
|
||||
, charge = require('lightning-charge-client')(conf.charge_url, conf.charge_token)
|
||||
, files = require('./lib/files')(conf.directory, conf.default_price, conf.invoice_ttl, conf.files)
|
||||
, tokenr = require('./lib/token')(conf.token_secret)
|
||||
, preview = require('./lib/preview')(files, conf.cache_path)
|
||||
|
@ -46,7 +46,7 @@ app.post('/_invoice', pwrap(async (req, res) => {
|
|||
const file = await files.load(req.body.file)
|
||||
if (file.type !== 'file') return res.sendStatus(405)
|
||||
|
||||
const invoice = await kite.invoice(files.invoice(file))
|
||||
const invoice = await charge.invoice(files.invoice(file))
|
||||
res.status(201).format({
|
||||
html: _ => res.redirect(file.urlpath + '?invoice=' + invoice.id)
|
||||
, json: _ => res.send(pick(invoice, 'id', 'msatoshi', 'quoted_currency', 'quoted_amount', 'payreq'))
|
||||
|
@ -55,10 +55,10 @@ app.post('/_invoice', pwrap(async (req, res) => {
|
|||
|
||||
// Payment updates long-polling via <img> hack
|
||||
app.get('/_invoice/:invoice/longpoll.png', pwrap(async (req, res) => {
|
||||
const paid = await kite.wait(req.params.invoice, 100)
|
||||
const paid = await charge.wait(req.params.invoice, 100)
|
||||
if (paid) res.set('Content-Type', 'image/png').send(pngPixel)
|
||||
else res.sendStatus(402)
|
||||
// @TODO close kite request on client disconnect
|
||||
// @TODO close charge request on client disconnect
|
||||
}))
|
||||
|
||||
// File browser
|
||||
|
@ -66,7 +66,7 @@ app.get('/:rpath(*)', pwrap(async (req, res) => {
|
|||
const file = await files.load(req.params.rpath)
|
||||
if (file.type == 'dir') return res.render('dir', file)
|
||||
|
||||
const invoice = req.query.invoice && await kite.fetch(req.query.invoice)
|
||||
const invoice = req.query.invoice && await charge.fetch(req.query.invoice)
|
||||
, access = req.query.token && tokenr.parse(file.path, req.query.token)
|
||||
|
||||
if (access) {
|
||||
|
|
|
@ -19,8 +19,8 @@ module.exports = basePath => {
|
|||
config.token_secret = config.token_secret || process.env.TOKEN_SECRET || assert(false, 'token_secret is required')
|
||||
config.cache_path = config.cache_path || process.env.CACHE_PATH || path.join(config.directory, '_filebazaar_cache')
|
||||
|
||||
config.kite_url = config.kite_url || process.env.KITE_URL || 'http://localhost:9112'
|
||||
config.kite_token = config.kite_token || process.env.KITE_TOKEN
|
||||
config.charge_url = config.charge_url || process.env.CHARGE_URL || 'http://localhost:9112'
|
||||
config.charge_token = config.charge_token || process.env.CHARGE_TOKEN
|
||||
|
||||
config.invoice_ttl = config.invoice_ttl || +process.env.INVOICE_TTL || 3600 // 1 hour
|
||||
config.download_ttl = config.download_ttl || +process.env.DOWNLOAD_TTL || 172800 // 2 days
|
||||
|
|
|
@ -1793,8 +1793,8 @@
|
|||
"resolved": "https://registry.npmjs.org/lazy-cache/-/lazy-cache-1.0.4.tgz",
|
||||
"integrity": "sha1-odePw6UEdMuAhF07O24dpJpEbo4="
|
||||
},
|
||||
"lightning-strike-client": {
|
||||
"version": "github:ElementsProject/lightning-strike-client-js#318722d5ef1b7c096bac31d30026eb90595c870a",
|
||||
"lightning-charge-client": {
|
||||
"version": "github:ElementsProject/lightning-charge-client-js#e864f5986fdc692a144bb903c16d47c794208ae6",
|
||||
"requires": {
|
||||
"superagent": "3.8.2",
|
||||
"superagent-baseuri": "0.1.1"
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
"gm": "^1.23.0",
|
||||
"js-yaml": "^3.10.0",
|
||||
"jstransformer-markdown-it": "^2.0.0",
|
||||
"lightning-strike-client": "github:ElementsProject/lightning-strike-client-js",
|
||||
"lightning-charge-client": "github:ElementsProject/lightning-charge-client-js",
|
||||
"lru-memoize": "github:neilk/lru-memoize",
|
||||
"markdown-it": "^8.4.0",
|
||||
"mime-types": "^2.1.17",
|
||||
|
|
Loading…
Reference in New Issue