From 4e2158aea44bc2899fcf0b4c59f403d9108c7795 Mon Sep 17 00:00:00 2001 From: BOT Alex <44818698+MagicBOTAlex@users.noreply.github.com> Date: Mon, 29 May 2023 01:47:43 +0200 Subject: [PATCH] Added cookies pop-up that you have to accept --- Otakians/MainLayout.razor | 35 ++++++++++++--- Otakians/Otakians.csproj | 1 + Otakians/Pages/Chatting.razor | 4 +- Otakians/Pages/Cookies.razor | 39 +++++++++++++++++ Otakians/Pages/Index.razor | 6 ++- Otakians/Program.cs | 3 ++ Otakians/Services/DataCollectorService.cs | 51 ++++++++++++++++++++-- Otakians/wwwroot/images/CookiesImage.jpg | Bin 0 -> 11147 bytes Otakians/wwwroot/index.html | 12 +++++ Otakians/wwwroot/jsFunctions.js | 18 +++++++- 10 files changed, 156 insertions(+), 13 deletions(-) create mode 100644 Otakians/Pages/Cookies.razor create mode 100644 Otakians/wwwroot/images/CookiesImage.jpg diff --git a/Otakians/MainLayout.razor b/Otakians/MainLayout.razor index 2e6c7fd..4f59613 100644 --- a/Otakians/MainLayout.razor +++ b/Otakians/MainLayout.razor @@ -5,7 +5,6 @@ @inject Blazored.LocalStorage.ILocalStorageService localStorage @inject NavigationManager NavManager @inject ISnackbar Snackbar -@inject DataCollectorService DCollector @@ -125,8 +124,7 @@ protected async Task DebugButton() { - ipAddress = (await DCollector.GetBrowserInfo()).ToString(); - Console.WriteLine(ipAddress); + } #region Drawers and overlays @@ -206,6 +204,7 @@ async void Logout() { await localStorage.RemoveItemAsync("User"); + await localStorage.RemoveItemAsync("AcceptedCookies"); RefreshPage(); } @@ -253,10 +252,36 @@ protected override async Task OnInitializedAsync() { - StateHasChanged(); + NavManager.LocationChanged += OnNavigated; + await CheckCookiesCheck(); + CheckLoggedin(); } + async void OnNavigated(object sender, LocationChangedEventArgs e) + { + await CheckCookiesCheck(); + } + + async Task CheckCookiesCheck() + { + string relativeUri = NavManager.ToBaseRelativePath(NavManager.Uri); + relativeUri = (relativeUri == "") ? "Bypassss" : relativeUri; + if (!(new string[] { "Privacy", "Cookies", "TOS" }.Any(relativeUri.Contains))) + { + bool? haveAcceptedCookies = await localStorage.GetItemAsync("AcceptedCookies"); + if (haveAcceptedCookies == null || !(bool)haveAcceptedCookies) + { + NavManager.LocationChanged -= OnNavigated; + NavManager.NavigateTo("/Cookies"); + NavManager.LocationChanged += OnNavigated; + await Task.Delay(500); + if (relativeUri != "Bypassss") + Snackbar.Add("Cookies not accepted, detected!", Severity.Warning); + } + } + } + async void CheckLoggedin() { string? name = await localStorage.GetItemAsStringAsync("User"); @@ -275,7 +300,7 @@ private void RefreshPage() { - NavManager.NavigateTo(NavManager.Uri, forceLoad: true); + NavManager.NavigateTo("/", forceLoad: true); } public class User diff --git a/Otakians/Otakians.csproj b/Otakians/Otakians.csproj index c979e28..b44ada4 100644 --- a/Otakians/Otakians.csproj +++ b/Otakians/Otakians.csproj @@ -7,6 +7,7 @@ + diff --git a/Otakians/Pages/Chatting.razor b/Otakians/Pages/Chatting.razor index d904d0e..50da096 100644 --- a/Otakians/Pages/Chatting.razor +++ b/Otakians/Pages/Chatting.razor @@ -128,7 +128,7 @@ } bool isLooping = false; - private async Task StartLoop() + private async void StartLoop() { if (isLooping) return; @@ -140,7 +140,7 @@ messages = await messageService.GetMessages(); Console.WriteLine("Chat updated!"); - await Task.Delay(10000); + await Task.Delay(20000); } } diff --git a/Otakians/Pages/Cookies.razor b/Otakians/Pages/Cookies.razor new file mode 100644 index 0000000..6361778 --- /dev/null +++ b/Otakians/Pages/Cookies.razor @@ -0,0 +1,39 @@ +@page "/Cookies" +@inject NavigationManager NavManager +@inject Blazored.LocalStorage.ILocalStorageService localStorage + + + + + + Cookies, local storage, and Privacy policy + This site does not use cookies! + This uses local storage, instead. +
+ Do you agree to our privacy policy and accept the use of local storage? +
+ + Privacy policy + + Accept + Decline + +
+
+ +@code{ + protected override async Task OnInitializedAsync() + { + bool? haveAcceptedCookies = await localStorage.GetItemAsync("AcceptedCookies"); + if (haveAcceptedCookies == null) return; + if (!(bool)haveAcceptedCookies) return; + + NavManager.NavigateTo("/"); + } + + async void AcceptedCookies() + { + await localStorage.SetItemAsync("AcceptedCookies", true); + NavManager.NavigateTo("/Posts"); + } +} \ No newline at end of file diff --git a/Otakians/Pages/Index.razor b/Otakians/Pages/Index.razor index 0c70bdd..bf1f11b 100644 --- a/Otakians/Pages/Index.razor +++ b/Otakians/Pages/Index.razor @@ -1,11 +1,13 @@ @page "/" @inject NavigationManager NavManager +@inject DataCollectorService DCollector +

2nd loading... Please wait

@code { - protected override void OnInitialized() + protected override async Task OnInitializedAsync() { - NavManager.NavigateTo("/Posts"); + //await DCollector.PushDataToAnalytics(); } } \ No newline at end of file diff --git a/Otakians/Program.cs b/Otakians/Program.cs index 614c2b0..7a5f769 100644 --- a/Otakians/Program.cs +++ b/Otakians/Program.cs @@ -8,6 +8,7 @@ using System.Security.Cryptography; using System.Text; using MudBlazor; using Otakians.Services; +using Blazor.Analytics; internal class Program { @@ -25,6 +26,8 @@ internal class Program builder.Services.AddBlazoredLocalStorage(config => config.JsonSerializerOptions.WriteIndented = true); // local storage + builder.Services.AddGoogleAnalytics("GT-TB78HCS"); + builder.Services.AddScoped(); builder.Services.AddScoped(); diff --git a/Otakians/Services/DataCollectorService.cs b/Otakians/Services/DataCollectorService.cs index ce4120b..14e6c04 100644 --- a/Otakians/Services/DataCollectorService.cs +++ b/Otakians/Services/DataCollectorService.cs @@ -1,8 +1,11 @@ -using DataStructs; +using Otakians.DataStructs; using Microsoft.AspNetCore.Components; using Microsoft.JSInterop; using System.Threading.Tasks; using System; +using System.Drawing; +using System.Text.Json; +using System.Text; namespace Otakians.Services { @@ -10,11 +13,13 @@ namespace Otakians.Services { private readonly IJSRuntime jsRuntime; private readonly NavigationManager navigationManager; + private readonly HttpClient httpClient; - public DataCollectorService(IJSRuntime jsRuntime, NavigationManager navigation) + public DataCollectorService(IJSRuntime jsRuntime, NavigationManager navigation, HttpClient httpClient) { this.jsRuntime = jsRuntime; this.navigationManager = navigation; + this.httpClient = httpClient; } public async Task GetIPAddress() @@ -27,10 +32,43 @@ namespace Otakians.Services var browserInfo = await jsRuntime.InvokeAsync("getBrowserInfo"); return browserInfo; } + + private async Task GetGeolocation() + { + var position = await jsRuntime.InvokeAsync("getCurrentPosition"); + return position; + } + + public async Task PushDataToAnalytics() + { + if (string.IsNullOrEmpty(Program.LoggedInName)) + { + await Console.Out.WriteLineAsync("User not logged in. Canceling data push"); + return; + } + + var currentTime = DateTimeOffset.UtcNow.ToUnixTimeSeconds(); + var analyticsUrl = "https://globalchat-4a89f-default-rtdb.europe-west1.firebasedatabase.app/Database/Analytics.json"; + + var dataObject = new + { + Username = Program.LoggedInName, + Time = currentTime, + Data = new + { + ipAddress = await GetIPAddress(), + browserInfo = await GetBrowserInfo() + } + }; + + var jsonContent = new StringContent(JsonSerializer.Serialize(dataObject), Encoding.UTF8, "application/json"); + + var response = await httpClient.PostAsync(analyticsUrl, jsonContent); + } } } -namespace DataStructs +namespace Otakians.DataStructs { public class BrowserInfo { @@ -56,4 +94,11 @@ namespace DataStructs } } + public class Geolocation + { + public double? latitude { get; set; } + public double? longitude { get; set; } + } + + } diff --git a/Otakians/wwwroot/images/CookiesImage.jpg b/Otakians/wwwroot/images/CookiesImage.jpg new file mode 100644 index 0000000000000000000000000000000000000000..90b164b3112c6830fc4f6693754bc49b7898d62c GIT binary patch literal 11147 zcmb_?WmKC@*KTkrEf!kb-HN-@00~8c6QIQz2z=4GL!?{M7*eGz?5EY#dxXd;-FI=m8BR089)lEKF=H92{(H^k_eHKLDE)hm1*3 z5tkflfye9y6bg*b!)H;d?V`|`_{l14=^jKt`0x=W6*U_>2PYS|h^Uyjgrt=66Of9k z8W^Ihr*B|rWDK*iwz0LdcYu3%dU^Z2eB~SbE+jN8JOYuBn1oDDNli;fFUl+gs-06jZ z*7INOZ^izbUZiNfFtM?*u<`En!oc)F3l=Fh4wE1*nIaU=!i}6+C=eg06rWeyMZhAg z^OM5TeS+{ItH^h@qdV39((HexSkV8IX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s(THs(w?s$B;zy(6a+*?T?QNV zPC0n`w--}U!#sf&e-vQp%Z2NT$&5 zYwe4GKRIwk)pHgO%2@`r$J1h}))rrvX(<{kP<%KJhF+)3EB~H#PI|61W6WQulCDb0 z5v$lE$7Ac3*jcWQ?Kq+MXF5wtUxk2B*U8DP!irFy+KZ3P7;_S;u0Z5PR6t$Ys%8}8 zt$Z`kW0ns%16(^mxS}CFkL$;70kQ@1KUuWYcT-0VY~>F<47@phJvuHpp1O?ut@oNU zWuFRb=Mlf65NV7AWeL3l<<+F%pY)De`R0#E{vKIikgNuytRA_*TgkRjArV4rTRCH5j8}^k|0#0G((a)!n%$;0UR8M+R%50ysO` zgLB6wQG#-AH8=XjAb#kHu$;6p<*`_-u37j}2%-=F-$Rn)?pSGeG%f+czYDl`RK0%-<{gN+tGWVpCe$o-CP09{ z8G0(5Jpy+@91c1bXGF6>xT5}{=iSl9{-W?91kt=dG@XpTUMKx;uE;-YQuvE9c1Iig zkKE05$LqV3JNDu~)W3i62s!^QETgg69X|VS!gZIzzFXs83jc4{d|*As?ZSTnrMhIA literal 0 HcmV?d00001 diff --git a/Otakians/wwwroot/index.html b/Otakians/wwwroot/index.html index 52e5cce..042f8ab 100644 --- a/Otakians/wwwroot/index.html +++ b/Otakians/wwwroot/index.html @@ -30,6 +30,18 @@ + + + + + + diff --git a/Otakians/wwwroot/jsFunctions.js b/Otakians/wwwroot/jsFunctions.js index fe7465b..0dbd3a8 100644 --- a/Otakians/wwwroot/jsFunctions.js +++ b/Otakians/wwwroot/jsFunctions.js @@ -18,4 +18,20 @@ function getBrowserInfo() { timezone: Intl.DateTimeFormat().resolvedOptions().timeZone, userAgent: navigator.userAgent }; -} \ No newline at end of file +} + +window.getCurrentPosition = () => { + return new Promise((resolve, reject) => { + navigator.geolocation.getCurrentPosition( + position => { + resolve({ + latitude: position.coords.latitude, + longitude: position.coords.longitude + }); + }, + error => { + reject(error); + } + ); + }); +};