+ $this->app->getView()->registerFunction("check", [$github, "checkRepoHook"]);
+
+ if (($header = $this->app->getRequest()->getHeader("Cache-Control", Header::class))) {
+ $params = $header->getParams();
+ if (!empty($params["no-cache"])) {
+ $this->github->setMaxAge(0);
+ } elseif (!empty($params["max-age"])) {
+ $this->github->setMaxAge($params["max-age"]["value"]);
+ }
+ }
+ }
+
+ protected function login(Account $account, Token $token, Owner $owner) {
+ $auth = new Cookie;
+ $auth->setCookie("account", $account->account->get());
+ $auth->setFlags(Cookie::SECURE | Cookie::HTTPONLY);
+ $auth->setPath($this->app->getBaseUrl()->path);
+ $auth->setMaxAge(60*60*24);
+ $this->app->getResponse()->setCookie($auth);
+
+ $this->github->setToken($token->token->get());
+ $this->session->account = $account->account->get();
+ $this->session->github = (object) $owner->export();