Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/shroomok/mediawiki-discordauth

This MediaWiki extension allows users from specified Discord server access to your wiki
https://github.com/shroomok/mediawiki-discordauth

discord mediawiki php

Last synced: 25 days ago
JSON representation

This MediaWiki extension allows users from specified Discord server access to your wiki

Awesome Lists containing this project

README

        

# mediawiki-DiscordAuth
This MediaWiki extension allows users with predefined roles from specified Discord server access to your wiki.

Purpose: give access to some users of [Shroomok Discord Community](https://discord.com/invite/ngKhQDmymD) to publish articles on https://shroomok.com

## Dependencies

* [mediawiki-extensions-PluggableAuth](https://github.com/wikimedia/mediawiki-extensions-PluggableAuth)
* [mediawiki-extensions-WSOAuth](https://github.com/wikimedia/mediawiki-extensions-WSOAuth)
* [Discord Provider for OAuth 2.0 Client](https://github.com/wohali/oauth2-discord-new)
* [RestCord - Discord API](https://github.com/restcord/restcord)

## Create composer.local.json before installation
This extension has a dependency on particular version of one package which can be installed only from github.

Thats why you need to edit (or create) a composer.local.json at the root of your wiki folder

### Composer.local.json
```json
{
"extra": {
"merge-plugin": {
"include": [
"extensions/DiscordAuth/composer.json"
]
}
}
}
```

## Installation
```
cd /extensions
git clone [email protected]:wikimedia/mediawiki-extensions-PluggableAuth.git PluggableAuth
git clone [email protected]:wikimedia/mediawiki-extensions-WSOAuth.git WSOAuth
git clone [email protected]:shroomok/mediawiki-DiscordAuth.git DiscordAuth
cd
composer update
php maintenance/update.php
```

### LocalSettings.php minimal setup
```php

wfLoadExtension( 'PluggableAuth' );
wfLoadExtension( 'WSOAuth' );
wfLoadExtension( 'DiscordAuth' );

$wgOAuthCustomAuthProviders = ['discord' => \DiscordAuth\AuthenticationProvider\DiscordAuth::class];
$wgPluggableAuth_EnableLocalLogin = true;
$wgPluggableAuth_Config['discordauth'] = [
'plugin' => 'WSOAuth',
'data' => [
'type' => 'discord',
'uri' => 'https://discord.com/oauth2/authorize',
'clientId' => '',
'clientSecret' => '',
'redirectUri' => 'https:///index.php?title=Special:PluggableAuthLogin'
],
'buttonLabelMessage' => 'discordauth-login-button-label'
];

$wgDiscordAuthBotToken = '';
$wgDiscordGuildId = ; // you can copy this within Discord app interface
$wgDiscordApprovedRoles = ['']; // users only with the specified roles will be able to login

```

### LocalSettings.php If you want to have a custom NS for Discord users and change Main Page layout to simplify ux

```php
$wgDiscordNS = ['id' => , 'alias' => ''];
$wgDiscordToRegisterNS = true;
$wgDiscordShowUserContributionsOnMainPage = true;
```

### [Discord Documentation](https://discord.com/developers/docs/intro)