2016-09-21 13:43:43 +05:30
|
|
|
<?php
|
2019-02-21 01:28:52 +05:30
|
|
|
declare(strict_types=1);
|
|
|
|
|
2016-09-21 13:43:43 +05:30
|
|
|
namespace api\modules\mojang;
|
|
|
|
|
2019-02-21 01:28:52 +05:30
|
|
|
use yii\base\BootstrapInterface;
|
|
|
|
|
|
|
|
class Module extends \yii\base\Module implements BootstrapInterface {
|
2016-09-21 13:43:43 +05:30
|
|
|
|
|
|
|
public $id = 'mojang';
|
|
|
|
|
|
|
|
public $defaultRoute = 'api';
|
|
|
|
|
2019-02-21 01:28:52 +05:30
|
|
|
/**
|
|
|
|
* @param \yii\base\Application $app
|
|
|
|
*/
|
|
|
|
public function bootstrap($app): void {
|
|
|
|
$legacyHost = $app->params['authserverHost'];
|
|
|
|
$app->getUrlManager()->addRules([
|
|
|
|
"//{$legacyHost}/mojang/api/users/profiles/minecraft/<username>" => "{$this->id}/api/uuid-by-username",
|
|
|
|
"//{$legacyHost}/mojang/api/user/profiles/<uuid>/names" => "{$this->id}/api/usernames-by-uuid",
|
|
|
|
"POST //{$legacyHost}/mojang/api/profiles/minecraft" => "{$this->id}/api/uuids-by-usernames",
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
|
2016-09-21 13:43:43 +05:30
|
|
|
}
|