fixed #1989 - installation on SQLite failing due to DropColumn, fixed #1986 - IClientStartup not getting called for External Modules, added ability to correlate new visitors by IP address

This commit is contained in:
Shaun Walker
2022-02-10 08:05:55 -05:00
parent ede6a45f15
commit 5aed64f614
14 changed files with 78 additions and 9 deletions

View File

@ -253,6 +253,35 @@ namespace Oqtane.Pages
var VisitorCookie = "APP_VISITOR_" + SiteId.ToString();
if (!int.TryParse(Request.Cookies[VisitorCookie], out VisitorId))
{
VisitorId = -1;
bool correlate = true;
setting = _settings.GetSetting(EntityNames.Site, SiteId, "VisitorCorrelation");
if (setting != null)
{
correlate = bool.Parse(setting.SettingValue);
}
if (correlate)
{
var visitor = _visitors.GetVisitor(SiteId, RemoteIPAddress);
if (visitor != null)
{
VisitorId = visitor.VisitorId;
Response.Cookies.Append(
VisitorCookie,
VisitorId.ToString(),
new CookieOptions()
{
Expires = DateTimeOffset.UtcNow.AddYears(1),
IsEssential = true
}
);
}
}
}
if (VisitorId == -1)
{
var visitor = new Visitor();
visitor.SiteId = SiteId;