seria/public/index.php

31 lines
953 B
PHP
Raw Normal View History

2022-07-03 23:44:11 +00:00
<?php
namespace Seria;
use Flashii\{FlashiiClient,FlashiiUrls};
use Flashii\Credentials\MisuzuCredentials;
use Seria\Users\UserInfo;
2022-07-03 23:44:11 +00:00
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;
2022-07-03 23:44:11 +00:00
$seria->startCSRFP(
$cfg->getString('csrfp:secret', 'mewow'),
$authInfo === null ? (string)filter_input(INPUT_SERVER, 'REMOTE_ADDR') : $authToken
);
2022-07-03 23:44:11 +00:00
$seria->startTemplating();
$seria->createRouting()->dispatch();