2022-07-03 23:44:11 +00:00
|
|
|
<?php
|
2023-10-06 21:11:28 +00:00
|
|
|
namespace Seria;
|
|
|
|
|
2024-11-19 21:21:36 +00:00
|
|
|
use Flashii\{FlashiiClient,FlashiiUrls};
|
|
|
|
use Flashii\Credentials\MisuzuCredentials;
|
2023-10-06 21:11:28 +00:00
|
|
|
use Seria\Users\UserInfo;
|
|
|
|
|
2022-07-03 23:44:11 +00:00
|
|
|
require_once __DIR__ . '/../seria.php';
|
|
|
|
|
2023-10-06 21:11:28 +00:00
|
|
|
$authToken = (string)filter_input(INPUT_COOKIE, 'msz_auth');
|
2024-11-19 21:21:36 +00:00
|
|
|
$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();
|
2023-10-06 21:11:28 +00:00
|
|
|
|
2024-11-19 21:21:36 +00:00
|
|
|
if($authInfo !== null) {
|
2023-10-06 21:11:28 +00:00
|
|
|
$users = $seria->getUsersContext()->getUsers();
|
2024-11-19 21:21:36 +00:00
|
|
|
$users->syncApiUser($authInfo);
|
|
|
|
$sUserInfo = $users->getUser($authInfo->getId(), 'id');
|
2023-10-06 21:11:28 +00:00
|
|
|
$seria->getAuthInfo()->setInfo($sUserInfo);
|
|
|
|
} else $sUserInfo = null;
|
2022-07-03 23:44:11 +00:00
|
|
|
|
2023-10-06 21:11:28 +00:00
|
|
|
$seria->startCSRFP(
|
2023-12-15 02:04:53 +00:00
|
|
|
$cfg->getString('csrfp:secret', 'mewow'),
|
2024-11-19 21:21:36 +00:00
|
|
|
$authInfo === null ? (string)filter_input(INPUT_SERVER, 'REMOTE_ADDR') : $authToken
|
2023-10-06 21:11:28 +00:00
|
|
|
);
|
2022-07-03 23:44:11 +00:00
|
|
|
|
2023-10-06 21:11:28 +00:00
|
|
|
$seria->startTemplating();
|
|
|
|
$seria->createRouting()->dispatch();
|