diff --git a/README.md b/README.md index 79e9487..2fa43fc 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/_filebazaar.yaml.example b/_filebazaar.yaml.example index 1b9f0b4..995314f 100644 --- a/_filebazaar.yaml.example +++ b/_filebazaar.yaml.example @@ -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 diff --git a/app.js b/app.js index 19953d3..0b33426 100644 --- a/app.js +++ b/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 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) { diff --git a/lib/config.js b/lib/config.js index 409e68f..a4c1ed9 100644 --- a/lib/config.js +++ b/lib/config.js @@ -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 diff --git a/package-lock.json b/package-lock.json index 023fb9f..5babecf 100644 --- a/package-lock.json +++ b/package-lock.json @@ -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" diff --git a/package.json b/package.json index e2b26c8..ece02e8 100644 --- a/package.json +++ b/package.json @@ -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",