mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-09-05 05:15:12 +00:00
payserver: do not allow create_invoice by default
This commit is contained in:
parent
11aaa0b66f
commit
87facaa781
1 changed files with 6 additions and 4 deletions
|
@ -200,11 +200,12 @@ class PayServer(Logger):
|
||||||
async def run(self):
|
async def run(self):
|
||||||
root = self.config.get('payserver_root', '/r')
|
root = self.config.get('payserver_root', '/r')
|
||||||
app = web.Application()
|
app = web.Application()
|
||||||
app.add_routes([web.post('/api/create_invoice', self.create_request)])
|
|
||||||
app.add_routes([web.get('/api/get_invoice', self.get_request)])
|
app.add_routes([web.get('/api/get_invoice', self.get_request)])
|
||||||
app.add_routes([web.get('/api/get_status', self.get_status)])
|
app.add_routes([web.get('/api/get_status', self.get_status)])
|
||||||
app.add_routes([web.get('/bip70/{key}.bip70', self.get_bip70_request)])
|
app.add_routes([web.get('/bip70/{key}.bip70', self.get_bip70_request)])
|
||||||
app.add_routes([web.static(root, os.path.join(os.path.dirname(__file__), 'www'))])
|
app.add_routes([web.static(root, os.path.join(os.path.dirname(__file__), 'www'))])
|
||||||
|
if self.config.get('payserver_allow_create_invoice'):
|
||||||
|
app.add_routes([web.post('/api/create_invoice', self.create_request)])
|
||||||
runner = web.AppRunner(app)
|
runner = web.AppRunner(app)
|
||||||
await runner.setup()
|
await runner.setup()
|
||||||
site = web.TCPSite(runner, host=str(self.addr.host), port=self.addr.port, ssl_context=self.config.get_ssl_context())
|
site = web.TCPSite(runner, host=str(self.addr.host), port=self.addr.port, ssl_context=self.config.get_ssl_context())
|
||||||
|
@ -217,9 +218,10 @@ class PayServer(Logger):
|
||||||
raise web.HTTPUnsupportedMediaType()
|
raise web.HTTPUnsupportedMediaType()
|
||||||
amount = int(params['amount_sat'])
|
amount = int(params['amount_sat'])
|
||||||
message = params['message'] or "donation"
|
message = params['message'] or "donation"
|
||||||
payment_hash = wallet.lnworker.add_request(amount_sat=amount,
|
payment_hash = wallet.lnworker.add_request(
|
||||||
message=message,
|
amount_sat=amount,
|
||||||
expiry=3600)
|
message=message,
|
||||||
|
expiry=3600)
|
||||||
key = payment_hash.hex()
|
key = payment_hash.hex()
|
||||||
raise web.HTTPFound(self.root + '/pay?id=' + key)
|
raise web.HTTPFound(self.root + '/pay?id=' + key)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue