seria/public/index.php

26 lines
711 B
PHP
Raw Normal View History

2022-07-03 23:44:11 +00:00
<?php
namespace Seria;
use Seria\Auth\ChatAuth;
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');
$authInfo = ChatAuth::attempt(SERIA_CAUTH_ENDPOINT, SERIA_MSZ_SECRET, $authToken);
if($authInfo->success) {
$users = $seria->getUsersContext()->getUsers();
$users->syncChatUser($authInfo);
$sUserInfo = $users->getUser($authInfo->user_id, 'id');
$seria->getAuthInfo()->setInfo($sUserInfo);
} else $sUserInfo = null;
2022-07-03 23:44:11 +00:00
$seria->startCSRFP(
SERIA_CSRFP_SECRET,
$authInfo->success ? $authToken : (string)filter_input(INPUT_SERVER, 'REMOTE_ADDR')
);
2022-07-03 23:44:11 +00:00
$seria->startTemplating();
$seria->createRouting()->dispatch();