This simple plugin allows users to join the mediawiki group "trusted" by paying.
The system requires either:
-
A c-lightning node with lightning-charge configured and installed or
-
an lnbits.com account.
-
This extension requires ParserFunctions extension, so if you don't already have it:
- Download it from here
- Place it to your
extensions/
folder on the mediawiki server/docker.
- Copy the files from this repository to the
extensions/LightningPayment
folder on the mediawiki server/docker (e.g.docker cp LightningPayment <containerid>:/var/www/html/extensions/
) or, while your working directory is theextensions
folder, clone the project withgit clone https://github.com/pseudozach/LightningPayment.git
Add these settings to the bottom of the LocalSettings.php file.
-
You need to set the LightningBackend you are using and configure it: lightningcharge or lnbits.
-
For lightning-charge
- Set $wgLightningPaymentNodeUrl to lightning-charge api endpoint where mediawiki server can access it.
- Set $wgLightningPaymentApiToken to your lightning-charge api token.
-
For lnbits.com
- Set $wgLNBitsApiKey to "Invoice/read key" from your lnbits wallet dashboard.
wfLoadExtension( 'ParserFunctions' );
include("extensions/LightningPayment/LightningPayment.php");
$wgGroupPermissions['*']['edit'] = false;
$wgGroupPermissions['user']['edit'] = false;
$wgGroupPermissions['trusted']['edit'] = true;
$wgGroupPermissions['*']['createpage'] = false;
$wgGroupPermissions['user']['createpage'] = false;
$wgGroupPermissions['trusted']['createpage'] = true;
#choose one backend implementation: lightningcharge OR lnbits
$wgLightningBackend = 'lnbits';
//$wgLightningBackend = 'lightningcharge';
#c-lightning & lightning-charge
$wgLightningPaymentApiToken = 'mySecretToken';
$wgLightningPaymentNodeUrl = 'http://host.docker.internal:9112';
#lnbits
$wgLNBitsUrl = 'https://lnbits.com';
$wgLNBitsApiKey = 'lnbitsapikey';
#$wgShowExceptionDetails = true;
$wgUrlProtocols[] = 'lightning:';
$wgAllowImageTag = true;
$wgAllowExternalImagesFrom = ['https://chart.googleapis.com/'];
You should be able to access the payment page here:
http://localhost:8080/index.php/Special:LightningPayment
It should display a lightning invoice and QR code image.
Newly created accounts won't be able to edit until they have paid.
Refresh the page after payment and user will have edit rights.