@@ -239,12 +239,25 @@ class Repository
|
||||
}
|
||||
|
||||
public function setAllowedUserTokens(array $tokens): void
|
||||
{
|
||||
$this->setConfig('allowed_user_tokens', json_encode(array_values($tokens)));
|
||||
}
|
||||
|
||||
public function getConfig(string $key, mixed $default = null): mixed
|
||||
{
|
||||
$stmt = $this->db->pdo()->prepare("SELECT value FROM config WHERE key = ?");
|
||||
$stmt->execute([$key]);
|
||||
$row = $stmt->fetch();
|
||||
return $row ? $row['value'] : $default;
|
||||
}
|
||||
|
||||
public function setConfig(string $key, string $value): void
|
||||
{
|
||||
$stmt = $this->db->pdo()->prepare(
|
||||
"INSERT INTO config (key, value) VALUES (?, ?)
|
||||
ON CONFLICT(key) DO UPDATE SET value = excluded.value"
|
||||
);
|
||||
$stmt->execute(['allowed_user_tokens', json_encode(array_values($tokens))]);
|
||||
$stmt->execute([$key, $value]);
|
||||
}
|
||||
|
||||
// --- Rate Limiting ---
|
||||
|
||||
Reference in New Issue
Block a user