Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
realodix committed Nov 14, 2023
1 parent 69de070 commit 97b15c0
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
10 changes: 7 additions & 3 deletions app/Models/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,15 @@ public function totalGuestUsers(): int
public function signature(): string
{
if (auth()->check() === false) {
$ua = \hexydec\agentzero\agentzero::parse(request()->userAgent());

return hash('sha3-256', implode([
'ip' => request()->ip(),
'browser' => \Browser::browserFamily(),
'os' => \Browser::platformFamily(),
'device' => \Browser::deviceFamily().\Browser::deviceModel(),
'type' => $ua->type,
'browser' => $ua->browser,
'os' => $ua->platform.$ua->platformversion,
'device' => $ua->category.$ua->vendor.$ua->device,
'lang' => request()->getPreferredLanguage(),
]));
}

Expand Down
5 changes: 4 additions & 1 deletion app/Services/VisitorService.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ public function __construct(
public function create(Url $url)
{
$logBotVisit = config('urlhub.track_bot_visits');
if ($logBotVisit === false && \Browser::isBot() === true) {
$dd = new \DeviceDetector\DeviceDetector(request()->userAgent());
$dd->parse();

if ($logBotVisit === false && $dd->isBot() === true) {
return;
}

Expand Down
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,13 @@
"embed/embed": "^4.4",
"endroid/qr-code": "^4.8",
"guzzlehttp/guzzle": "^7.8",
"hisorange/browser-detect": "^5.0",
"hexydec/agentzero": "^0.4.0",
"laravel/fortify": "^1.18",
"laravel/framework": "^10.29",
"laravel/sanctum": "^3.3",
"laravel/tinker": "^2.8",
"livewire/livewire": "^3.0",
"matomo/device-detector": "^6.1",
"paragonie/random-lib": "^2.0",
"paragonie/random_compat": "^2.0",
"power-components/livewire-powergrid": "^5.1",
Expand Down

0 comments on commit 97b15c0

Please sign in to comment.