Skip to content
Snippets Groups Projects
Verified Commit de2df567 authored by Andrej Ramašeuski's avatar Andrej Ramašeuski
Browse files

Logovani kliku

parent 6fb61d74
No related branches found
No related tags found
No related merge requests found
Pipeline #10822 passed
......@@ -28,6 +28,8 @@ RUN cpanm \
Mojo::Redis \
Mojo::JWT \
Mojolicious::Plugin::Authentication \
Mojolicious::Plugin::BrowserDetect \
Mojolicious::Plugin::ForwardedFor \
Mojolicious::Plugin::OpenAPI
ADD . /opt/PZ
......
- statistika
- editace/smazani
- loop detect
- 302 nebo informacni stranka
1.0.1
1.1.0
......@@ -20,6 +20,7 @@ sub startup {
# Delka session
$self->sessions->default_expiration($cfg->{session}{lifetime});
$self->plugin("ForwardedFor");
$self->plugin('PZ::Helpers::Core');
$self->plugin('PZ::Helpers::OIDC');
......
......@@ -16,6 +16,11 @@ sub redirect ($c) {
return;
}
$shortcut->add_to_log_items({
ip => ($c->forwarded_for || $c->tx->remote_address),
ua => $c->req->headers->user_agent,
});
$c->res->code($shortcut->code);
$c->redirect_to($shortcut->url);
}
......
......@@ -37,5 +37,9 @@ __PACKAGE__->add_unique_constraint(
'shortcut' => [qw(shortcut)]
);
__PACKAGE__->has_many(
log_items => 'PZ::Schema::Result::Log',
{ 'foreign.shortcut_id' => 'self.id', },
);
1;
......@@ -44,3 +44,6 @@ create table "log" (
alter table "shortcuts" alter column "code" set default 302;
alter table "shortcuts" drop constraint "shortcuts_shortcut_key";
create index "shortcuts_shortcut_idx" on "shortcuts" ("shortcut");
-- 3 up
alter table "log" add column "ua" text;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment