Merge origin/main: Review-Branch mit v2.4.0-Features zusammenführen
Konfliktauflösung kombiniert beide Seiten: - Auth: Secure-Cookie-Flag + DB-Session-Handler (main) - UniFiController: createVouchers (n-Parameter, 1 API-Call) + QoS-Optionen (main) - index.php: IP-Rate-Limit/PRG/Sticky-Forms + CAPTCHA/SMS/QoS/Tageslimit (main) - users.php: 2FA-Reset (main) auf POST+PRG umgestellt wie übrige Aktionen - forgot_password: Session-Throttle (main) + IP-Throttle kombiniert - Eigene Migrationen wegen Nummernkollision auf 0005/0006 umbenannt https://claude.ai/code/session_01KKVpVPJjrTKGoRgpJcySD4
This commit is contained in:
commit
1a2f86ed3d
65 changed files with 3136 additions and 32 deletions
|
|
@ -161,8 +161,9 @@ class UniFiController {
|
|||
}
|
||||
|
||||
// Einzelnen Voucher erstellen
|
||||
public function createVoucher($voucherName, $maxUses, $expireMinutes = 480) {
|
||||
$vouchers = $this->createVouchers($voucherName, $maxUses, $expireMinutes, 1);
|
||||
// $options: optionale QoS-Limits ['down' => kbps, 'up' => kbps, 'quota_mb' => MB]
|
||||
public function createVoucher($voucherName, $maxUses, $expireMinutes = 480, $options = []) {
|
||||
$vouchers = $this->createVouchers($voucherName, $maxUses, $expireMinutes, 1, $options);
|
||||
return $vouchers[0];
|
||||
}
|
||||
|
||||
|
|
@ -175,9 +176,10 @@ class UniFiController {
|
|||
* identifiziert. Der fruehere Fallback "global neuester Voucher" konnte
|
||||
* bei parallelen Erstellungen fremde Codes liefern und wurde entfernt.
|
||||
*
|
||||
* @param array $options Optionale QoS-Limits ['down' => kbps, 'up' => kbps, 'quota_mb' => MB]
|
||||
* @return array Liste von ['code','formatted_code','unifi_id','create_time']
|
||||
*/
|
||||
public function createVouchers($voucherName, $maxUses, $expireMinutes = 480, $count = 1) {
|
||||
public function createVouchers($voucherName, $maxUses, $expireMinutes = 480, $count = 1, $options = []) {
|
||||
$count = max(1, (int)$count);
|
||||
$data = [
|
||||
'cmd' => 'create-voucher',
|
||||
|
|
@ -187,6 +189,17 @@ class UniFiController {
|
|||
'quota' => (int)$maxUses
|
||||
];
|
||||
|
||||
// Bandbreiten-/Datenlimits (UniFi QoS) optional setzen
|
||||
$down = isset($options['down']) ? (int)$options['down'] : 0;
|
||||
$up = isset($options['up']) ? (int)$options['up'] : 0;
|
||||
$bytes = isset($options['quota_mb']) ? (int)$options['quota_mb'] : 0;
|
||||
if ($down > 0 || $up > 0 || $bytes > 0) {
|
||||
$data['qos_overwrite'] = true;
|
||||
if ($down > 0) $data['down'] = $down; // kbit/s
|
||||
if ($up > 0) $data['up'] = $up; // kbit/s
|
||||
if ($bytes > 0) $data['bytes'] = $bytes; // Megabyte
|
||||
}
|
||||
|
||||
$response = $this->apiRequest("/proxy/network/api/s/{$this->siteId}/cmd/hotspot", $data);
|
||||
|
||||
if (!isset($response['data'][0]['create_time'])) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue