惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Google DeepMind News
Google DeepMind News
人人都是产品经理
人人都是产品经理
H
Hacker News: Front Page
Stack Overflow Blog
Stack Overflow Blog
B
Blog
I
InfoQ
GbyAI
GbyAI
T
The Blog of Author Tim Ferriss
F
Fortinet All Blogs
Y
Y Combinator Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
月光博客
月光博客
Hugging Face - Blog
Hugging Face - Blog
爱范儿
爱范儿
F
Full Disclosure
Hacker News - Newest:
Hacker News - Newest: "LLM"
Recent Announcements
Recent Announcements
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Jina AI
Jina AI
T
Tailwind CSS Blog
S
Secure Thoughts
P
Privacy International News Feed
美团技术团队
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
L
LINUX DO - 最新话题
H
Hackread – Cybersecurity News, Data Breaches, AI and More
C
Cybersecurity and Infrastructure Security Agency CISA
Last Week in AI
Last Week in AI
W
WeLiveSecurity
Google Online Security Blog
Google Online Security Blog
P
Privacy & Cybersecurity Law Blog
D
DataBreaches.Net
Engineering at Meta
Engineering at Meta
Know Your Adversary
Know Your Adversary
P
Palo Alto Networks Blog
I
Intezer
Application and Cybersecurity Blog
Application and Cybersecurity Blog
Project Zero
Project Zero
V2EX - 技术
V2EX - 技术
H
Heimdal Security Blog
博客园 - Franky
阮一峰的网络日志
阮一峰的网络日志
D
Darknet – Hacking Tools, Hacker News & Cyber Security
T
Troy Hunt's Blog
V
Vulnerabilities – Threatpost
H
Help Net Security
Martin Fowler
Martin Fowler
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
G
GRAHAM CLULEY
博客园 - 【当耐特】

Feed of "schmarty/gem-diamond"

issue when using indieauth[dot]com? gem-diamond gem-diamond gem-diamond gem-diamond gem-diamond gem-diamond proxy for profile images gem-diamond gem-diamond gem-diamond gem-diamond gem-diamond gem-diamond gem-diamond gem-diamond gem-diamond gem-diamond gem-diamond gem-diamond gem-diamond gem-diamond gem-diamond gem-diamond gem-diamond gem-diamond gem-diamond gem-diamond
gem-diamond
schmarty · 2024-07-29 · via Feed of "schmarty/gem-diamond"

共有 3 个文件被更改,包括 41 次插入7 次删除

@ -6,20 +6,19 @@ use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Schmarty\Micropubkit\Controllers\Common\{ResponseAware,ResponseAwareTrait};
use Schmarty\Micropubkit\Controllers\Common\{TemplatesAware,TemplatesAwareTrait};
class Controller implements ResponseAware {
class Controller implements ResponseAware, TemplatesAware {
use ResponseAwareTrait;
use TemplatesAwareTrait;
private \League\Plates\Engine $templates;
private \App\Model\Site $site;
private \App\Model\SiteCheck $siteCheck;
public function __construct(\League\Plates\Engine $templates, \App\Model\Site $site, \App\Model\SiteCheck $siteCheck) {
$this->templates = $templates;
public function __construct(\App\Model\Site $site, \App\Model\SiteCheck $siteCheck) {
$this->site = $site;
$this->siteCheck = $siteCheck;
$this->templates->addData(['hostname' => $_SERVER['SERVER_NAME']]);
}
public function index(ServerRequestInterface $request): ResponseInterface {

@ -0,0 +1,31 @@
<?php declare(strict_types=1);
namespace App;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Server\RequestHandlerInterface;
use Psr\Http\Server\MiddlewareInterface;
use Schmarty\Micropubkit\Controllers\Common\{TemplatesAware,TemplatesAwareTrait};
class TemplatesCommonMiddleware implements MiddlewareInterface, TemplatesAware
{
use TemplatesAwareTrait;
/**
* {@inheritdoc}
*/
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
{
// add common bits that our temlpates need to know
$this->templates->addData([
'hostname' => $_SERVER['SERVER_NAME']
]);
// and pass along
return $handler->handle($request);
}
}
@ -24,12 +24,16 @@ $app->container->addShared(App\Model\SiteCheck::class)->addArgument(App\DB::clas
// set up controller for welcome and forms
$app->container->addShared(App\Controller::class)
->addArgument(League\Plates\Engine::class)
->addArgument(App\Model\Site::class)
->addArgument(App\Model\SiteCheck::class);
// set up middleware
$app->container->add(App\TemplatesCommonMiddleware::class);
// allow login everywhere but be chill about it
$app->route->middleware($app->optionalAuthMiddleware);
$app->route
->middleware($app->optionalAuthMiddleware)
->middleware($app->container->get(App\TemplatesCommonMiddleware::class));
// set up app-specific routes
$app->route->get('/', 'App\\Controller::index')->setName('loginForm');