30 lines
953 B
PHP
30 lines
953 B
PHP
<?php
|
|
namespace Seria;
|
|
|
|
use Flashii\{FlashiiClient,FlashiiUrls};
|
|
use Flashii\Credentials\MisuzuCredentials;
|
|
use Seria\Users\UserInfo;
|
|
|
|
require_once __DIR__ . '/../seria.php';
|
|
|
|
$authToken = (string)filter_input(INPUT_COOKIE, 'msz_auth');
|
|
$flashii = new FlashiiClient('Seria', new MisuzuCredentials($authToken), new FlashiiUrls(
|
|
$cfg->getString('apii:api', FlashiiUrls::PROD_API_URL),
|
|
$cfg->getString('apii:id', FlashiiUrls::PROD_ID_URL)
|
|
));
|
|
$authInfo = $flashii->v1()->me();
|
|
|
|
if($authInfo !== null) {
|
|
$users = $seria->getUsersContext()->getUsers();
|
|
$users->syncApiUser($authInfo);
|
|
$sUserInfo = $users->getUser($authInfo->getId(), 'id');
|
|
$seria->getAuthInfo()->setInfo($sUserInfo);
|
|
} else $sUserInfo = null;
|
|
|
|
$seria->startCSRFP(
|
|
$cfg->getString('csrfp:secret', 'mewow'),
|
|
$authInfo === null ? (string)filter_input(INPUT_SERVER, 'REMOTE_ADDR') : $authToken
|
|
);
|
|
|
|
$seria->startTemplating();
|
|
$seria->createRouting()->dispatch();
|