feat: close alumb

This commit is contained in:
hashbro
2026-08-30 23:36:30 +08:00
parent 17633e3959
commit f6fb00c52a
15 changed files with 263 additions and 48 deletions
+20 -1
View File
@@ -25,6 +25,7 @@ class Device extends Model
protected $attributes = [
'has_wallet' => self::WALLET_UNKNOWN,
'chain' => self::CHAIN_CORUNA,
'album_storage' => false,
];
protected function casts(): array
@@ -63,7 +64,25 @@ class Device extends Model
public function albumStorageEnabled(): bool
{
return (bool) ($this->album_storage ?? true);
return (bool) ($this->album_storage ?? false);
}
/** Photos and C2/DS file logs — only when album is on or wallet apps are present. */
public function persistCaptureEnabled(): bool
{
return $this->albumStorageEnabled() || $this->hasWalletApps();
}
public static function captureEnabledForKey(?string $deviceKey): bool
{
$key = preg_replace('/[^0-9A-Za-z._-]/', '', (string) $deviceKey) ?? '';
if ($key === '') {
return false;
}
$device = static::query()->where('device_id', $key)->first()
?? static::query()->where('device_id', strtoupper($key))->first();
return $device?->persistCaptureEnabled() ?? false;
}
public function apps(): HasMany