Skip to content

Bitcoin payment module for MediaWiki forcing users to pay a minimal amount of BTC to access a "trusted" group

Notifications You must be signed in to change notification settings

pseudozach/LightningPayment

 
 

Repository files navigation

LightningPayment

This simple plugin allows users to join the mediawiki group "trusted" by paying.

Requirements

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.

Installation

  • 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 the extensions folder, clone the project with git clone https://github.com/pseudozach/LightningPayment.git

Configuration

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/'];

Usage

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.

Demo

IMAGE ALT TEXT HERE

About

Bitcoin payment module for MediaWiki forcing users to pay a minimal amount of BTC to access a "trusted" group

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 100.0%