mirror of
https://github.com/shlinkio/shlink.git
synced 2025-03-30 13:31:59 +03:00
Expose visitedUrl when serializing any kind of visit, not only orphan visits
This commit is contained in:
parent
d948543d5c
commit
6fe269193a
10 changed files with 40 additions and 25 deletions
|
@ -232,6 +232,11 @@
|
||||||
"potentialBot": {
|
"potentialBot": {
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"description": "Tells if Shlink thinks this visit comes potentially from a bot or crawler"
|
"description": "Tells if Shlink thinks this visit comes potentially from a bot or crawler"
|
||||||
|
},
|
||||||
|
"visitedUrl": {
|
||||||
|
"type": "string",
|
||||||
|
"nullable": true,
|
||||||
|
"description": "The originally visited URL that triggered the tracking of this visit"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"example": {
|
"example": {
|
||||||
|
@ -247,7 +252,8 @@
|
||||||
"regionName": "California",
|
"regionName": "California",
|
||||||
"timezone": "America/Los_Angeles"
|
"timezone": "America/Los_Angeles"
|
||||||
},
|
},
|
||||||
"potentialBot": false
|
"potentialBot": false,
|
||||||
|
"visitedUrl": "https://s.test"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"OrphanVisit": {
|
"OrphanVisit": {
|
||||||
|
@ -256,11 +262,6 @@
|
||||||
{
|
{
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
"visitedUrl": {
|
|
||||||
"type": "string",
|
|
||||||
"nullable": true,
|
|
||||||
"description": "The originally visited URL that triggered the tracking of this visit"
|
|
||||||
},
|
|
||||||
"type": {
|
"type": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"enum": [
|
"enum": [
|
||||||
|
|
|
@ -1,14 +1,10 @@
|
||||||
{
|
{
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"required": ["visitedUrl", "type"],
|
"required": ["type"],
|
||||||
"allOf": [{
|
"allOf": [{
|
||||||
"$ref": "./Visit.json"
|
"$ref": "./Visit.json"
|
||||||
}],
|
}],
|
||||||
"properties": {
|
"properties": {
|
||||||
"visitedUrl": {
|
|
||||||
"type": ["string", "null"],
|
|
||||||
"description": "The originally visited URL that triggered the tracking of this visit"
|
|
||||||
},
|
|
||||||
"type": {
|
"type": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"enum": [
|
"enum": [
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"required": ["referer", "date", "userAgent", "visitLocation"],
|
"required": ["referer", "date", "userAgent", "visitLocation", "potentialBot", "visitedUrl"],
|
||||||
"properties": {
|
"properties": {
|
||||||
"referer": {
|
"referer": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
|
@ -21,6 +21,10 @@
|
||||||
"potentialBot": {
|
"potentialBot": {
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"description": "Tells if Shlink thinks this visit comes potentially from a bot or crawler"
|
"description": "Tells if Shlink thinks this visit comes potentially from a bot or crawler"
|
||||||
|
},
|
||||||
|
"visitedUrl": {
|
||||||
|
"type": ["string", "null"],
|
||||||
|
"description": "The originally visited URL that triggered the tracking of this visit"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -100,7 +100,8 @@
|
||||||
"date": "2015-08-20T05:05:03+04:00",
|
"date": "2015-08-20T05:05:03+04:00",
|
||||||
"userAgent": "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:47.0) Gecko/20100101 Firefox/47.0 Mozilla/5.0 (Macintosh; Intel Mac OS X x.y; rv:42.0) Gecko/20100101 Firefox/42.0",
|
"userAgent": "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:47.0) Gecko/20100101 Firefox/47.0 Mozilla/5.0 (Macintosh; Intel Mac OS X x.y; rv:42.0) Gecko/20100101 Firefox/42.0",
|
||||||
"visitLocation": null,
|
"visitLocation": null,
|
||||||
"potentialBot": false
|
"potentialBot": false,
|
||||||
|
"visitedUrl": "https://s.test"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"referer": "https://t.co",
|
"referer": "https://t.co",
|
||||||
|
@ -115,14 +116,16 @@
|
||||||
"regionName": "California",
|
"regionName": "California",
|
||||||
"timezone": "America/Los_Angeles"
|
"timezone": "America/Los_Angeles"
|
||||||
},
|
},
|
||||||
"potentialBot": false
|
"potentialBot": false,
|
||||||
|
"visitedUrl": "https://s.test"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"referer": null,
|
"referer": null,
|
||||||
"date": "2015-08-20T05:05:03+04:00",
|
"date": "2015-08-20T05:05:03+04:00",
|
||||||
"userAgent": "some_web_crawler/1.4",
|
"userAgent": "some_web_crawler/1.4",
|
||||||
"visitLocation": null,
|
"visitLocation": null,
|
||||||
"potentialBot": true
|
"potentialBot": true,
|
||||||
|
"visitedUrl": "https://s.test"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"pagination": {
|
"pagination": {
|
||||||
|
|
|
@ -103,7 +103,8 @@
|
||||||
"date": "2015-08-20T05:05:03+04:00",
|
"date": "2015-08-20T05:05:03+04:00",
|
||||||
"userAgent": "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:47.0) Gecko/20100101 Firefox/47.0 Mozilla/5.0 (Macintosh; Intel Mac OS X x.y; rv:42.0) Gecko/20100101 Firefox/42.0",
|
"userAgent": "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:47.0) Gecko/20100101 Firefox/47.0 Mozilla/5.0 (Macintosh; Intel Mac OS X x.y; rv:42.0) Gecko/20100101 Firefox/42.0",
|
||||||
"visitLocation": null,
|
"visitLocation": null,
|
||||||
"potentialBot": false
|
"potentialBot": false,
|
||||||
|
"visitedUrl": "https://s.test"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"referer": "https://t.co",
|
"referer": "https://t.co",
|
||||||
|
@ -118,14 +119,16 @@
|
||||||
"regionName": "California",
|
"regionName": "California",
|
||||||
"timezone": "America/Los_Angeles"
|
"timezone": "America/Los_Angeles"
|
||||||
},
|
},
|
||||||
"potentialBot": false
|
"potentialBot": false,
|
||||||
|
"visitedUrl": "https://s.test"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"referer": null,
|
"referer": null,
|
||||||
"date": "2015-08-20T05:05:03+04:00",
|
"date": "2015-08-20T05:05:03+04:00",
|
||||||
"userAgent": "some_web_crawler/1.4",
|
"userAgent": "some_web_crawler/1.4",
|
||||||
"visitLocation": null,
|
"visitLocation": null,
|
||||||
"potentialBot": true
|
"potentialBot": true,
|
||||||
|
"visitedUrl": "https://s.test"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"pagination": {
|
"pagination": {
|
||||||
|
|
|
@ -103,7 +103,8 @@
|
||||||
"date": "2015-08-20T05:05:03+04:00",
|
"date": "2015-08-20T05:05:03+04:00",
|
||||||
"userAgent": "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:47.0) Gecko/20100101 Firefox/47.0 Mozilla/5.0 (Macintosh; Intel Mac OS X x.y; rv:42.0) Gecko/20100101 Firefox/42.0",
|
"userAgent": "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:47.0) Gecko/20100101 Firefox/47.0 Mozilla/5.0 (Macintosh; Intel Mac OS X x.y; rv:42.0) Gecko/20100101 Firefox/42.0",
|
||||||
"visitLocation": null,
|
"visitLocation": null,
|
||||||
"potentialBot": false
|
"potentialBot": false,
|
||||||
|
"visitedUrl": "https://s.test"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"referer": "https://t.co",
|
"referer": "https://t.co",
|
||||||
|
@ -118,14 +119,16 @@
|
||||||
"regionName": "California",
|
"regionName": "California",
|
||||||
"timezone": "America/Los_Angeles"
|
"timezone": "America/Los_Angeles"
|
||||||
},
|
},
|
||||||
"potentialBot": false
|
"potentialBot": false,
|
||||||
|
"visitedUrl": "https://s.test"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"referer": null,
|
"referer": null,
|
||||||
"date": "2015-08-20T05:05:03+04:00",
|
"date": "2015-08-20T05:05:03+04:00",
|
||||||
"userAgent": "some_web_crawler/1.4",
|
"userAgent": "some_web_crawler/1.4",
|
||||||
"visitLocation": null,
|
"visitLocation": null,
|
||||||
"potentialBot": true
|
"potentialBot": true,
|
||||||
|
"visitedUrl": "https://s.test"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"pagination": {
|
"pagination": {
|
||||||
|
|
|
@ -94,7 +94,8 @@
|
||||||
"date": "2015-08-20T05:05:03+04:00",
|
"date": "2015-08-20T05:05:03+04:00",
|
||||||
"userAgent": "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:47.0) Gecko/20100101 Firefox/47.0 Mozilla/5.0 (Macintosh; Intel Mac OS X x.y; rv:42.0) Gecko/20100101 Firefox/42.0",
|
"userAgent": "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:47.0) Gecko/20100101 Firefox/47.0 Mozilla/5.0 (Macintosh; Intel Mac OS X x.y; rv:42.0) Gecko/20100101 Firefox/42.0",
|
||||||
"visitLocation": null,
|
"visitLocation": null,
|
||||||
"potentialBot": false
|
"potentialBot": false,
|
||||||
|
"visitedUrl": "https://s.test"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"referer": "https://t.co",
|
"referer": "https://t.co",
|
||||||
|
@ -109,14 +110,16 @@
|
||||||
"regionName": "California",
|
"regionName": "California",
|
||||||
"timezone": "America/Los_Angeles"
|
"timezone": "America/Los_Angeles"
|
||||||
},
|
},
|
||||||
"potentialBot": false
|
"potentialBot": false,
|
||||||
|
"visitedUrl": "https://s.test"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"referer": null,
|
"referer": null,
|
||||||
"date": "2015-08-20T05:05:03+04:00",
|
"date": "2015-08-20T05:05:03+04:00",
|
||||||
"userAgent": "some_web_crawler/1.4",
|
"userAgent": "some_web_crawler/1.4",
|
||||||
"visitLocation": null,
|
"visitLocation": null,
|
||||||
"potentialBot": true
|
"potentialBot": true,
|
||||||
|
"visitedUrl": "https://s.test"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"pagination": {
|
"pagination": {
|
||||||
|
|
|
@ -163,6 +163,7 @@ class Visit extends AbstractEntity implements JsonSerializable
|
||||||
'userAgent' => $this->userAgent,
|
'userAgent' => $this->userAgent,
|
||||||
'visitLocation' => $this->visitLocation,
|
'visitLocation' => $this->visitLocation,
|
||||||
'potentialBot' => $this->potentialBot,
|
'potentialBot' => $this->potentialBot,
|
||||||
|
'visitedUrl' => $this->visitedUrl,
|
||||||
];
|
];
|
||||||
if (! $this->isOrphan()) {
|
if (! $this->isOrphan()) {
|
||||||
return $base;
|
return $base;
|
||||||
|
@ -170,7 +171,6 @@ class Visit extends AbstractEntity implements JsonSerializable
|
||||||
|
|
||||||
return [
|
return [
|
||||||
...$base,
|
...$base,
|
||||||
'visitedUrl' => $this->visitedUrl,
|
|
||||||
'type' => $this->type->value,
|
'type' => $this->type->value,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,6 +68,7 @@ class PublishingUpdatesGeneratorTest extends TestCase
|
||||||
'visitLocation' => null,
|
'visitLocation' => null,
|
||||||
'date' => $visit->getDate()->toAtomString(),
|
'date' => $visit->getDate()->toAtomString(),
|
||||||
'potentialBot' => false,
|
'potentialBot' => false,
|
||||||
|
'visitedUrl' => '',
|
||||||
],
|
],
|
||||||
], $update->payload);
|
], $update->payload);
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,6 +30,7 @@ class VisitTest extends TestCase
|
||||||
'userAgent' => $userAgent,
|
'userAgent' => $userAgent,
|
||||||
'visitLocation' => null,
|
'visitLocation' => null,
|
||||||
'potentialBot' => $expectedToBePotentialBot,
|
'potentialBot' => $expectedToBePotentialBot,
|
||||||
|
'visitedUrl' => $visit->visitedUrl,
|
||||||
], $visit->jsonSerialize());
|
], $visit->jsonSerialize());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue