Reorganize project structure and migrate CI to Forgejo
Some checks are pending
Deploy / deploy (push) Waiting to run
Some checks are pending
Deploy / deploy (push) Waiting to run
Move all files from deploy/ to project root, replace .gitlab-ci.yml with .forgejo/workflows/deploy.yml using Gitea Actions format. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
baa36144a8
commit
b130f5c9d8
13 changed files with 71 additions and 66 deletions
|
|
@ -1,38 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Web2Print\Middleware;
|
||||
|
||||
class AuthMiddleware
|
||||
{
|
||||
private array $config;
|
||||
|
||||
public function __construct(array $config)
|
||||
{
|
||||
$this->config = $config;
|
||||
}
|
||||
|
||||
public function authenticate(): bool
|
||||
{
|
||||
$apiKey = $_SERVER['HTTP_X_API_KEY'] ?? '';
|
||||
|
||||
if (empty($apiKey)) {
|
||||
$this->sendError(401, 'API key missing');
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!in_array($apiKey, $this->config['api_keys'], true)) {
|
||||
$this->sendError(403, 'Invalid API key');
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private function sendError(int $code, string $message): void
|
||||
{
|
||||
http_response_code($code);
|
||||
header('Content-Type: application/json');
|
||||
echo json_encode(['error' => $message]);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue