From 825a887603ce20c057053c3a02e3b173c2f330e6 Mon Sep 17 00:00:00 2001 From: Lilian Date: Tue, 10 Sep 2024 23:27:49 +0200 Subject: [PATCH] [frontend/pages] Add authorize attribute to pages that require auth (ISH-481) --- Iceshrimp.Frontend/Layout/SettingsLayout.razor | 1 + Iceshrimp.Frontend/Pages/FollowRequestsPage.razor | 2 ++ Iceshrimp.Frontend/Pages/NotificationPage.razor | 2 ++ Iceshrimp.Frontend/Pages/ProfileView.razor | 3 +++ Iceshrimp.Frontend/Pages/SearchPage.razor | 2 ++ Iceshrimp.Frontend/Pages/Settings/About.razor | 2 ++ Iceshrimp.Frontend/Pages/Settings/Filters.razor | 2 ++ Iceshrimp.Frontend/Pages/Settings/Profile.razor | 2 ++ Iceshrimp.Frontend/Pages/Settings/Settings.razor | 2 ++ Iceshrimp.Frontend/Pages/SingleNote.razor | 2 ++ Iceshrimp.Frontend/Pages/TimelinePage.razor | 2 ++ 11 files changed, 22 insertions(+) diff --git a/Iceshrimp.Frontend/Layout/SettingsLayout.razor b/Iceshrimp.Frontend/Layout/SettingsLayout.razor index 9925c257..96251d30 100644 --- a/Iceshrimp.Frontend/Layout/SettingsLayout.razor +++ b/Iceshrimp.Frontend/Layout/SettingsLayout.razor @@ -2,6 +2,7 @@ @using Microsoft.AspNetCore.Components.Sections @using Iceshrimp.Assets.PhosphorIcons @using Iceshrimp.Frontend.Localization +@using Microsoft.AspNetCore.Authorization @using Microsoft.Extensions.Localization @inherits LayoutComponentBase @layout MainLayout diff --git a/Iceshrimp.Frontend/Pages/FollowRequestsPage.razor b/Iceshrimp.Frontend/Pages/FollowRequestsPage.razor index 88110d65..49db8b0f 100644 --- a/Iceshrimp.Frontend/Pages/FollowRequestsPage.razor +++ b/Iceshrimp.Frontend/Pages/FollowRequestsPage.razor @@ -1,9 +1,11 @@ @page "/follow-requests" +@attribute [Authorize] @using Iceshrimp.Frontend.Components @using Iceshrimp.Frontend.Localization @using Microsoft.Extensions.Localization @using Microsoft.AspNetCore.Components.Sections @using Iceshrimp.Assets.PhosphorIcons +@using Microsoft.AspNetCore.Authorization @inject IStringLocalizer Loc; diff --git a/Iceshrimp.Frontend/Pages/NotificationPage.razor b/Iceshrimp.Frontend/Pages/NotificationPage.razor index fd836815..f2026431 100644 --- a/Iceshrimp.Frontend/Pages/NotificationPage.razor +++ b/Iceshrimp.Frontend/Pages/NotificationPage.razor @@ -1,9 +1,11 @@ @page "/notifications" +@attribute [Authorize] @using Iceshrimp.Frontend.Components @using Iceshrimp.Frontend.Localization @using Microsoft.Extensions.Localization @using Microsoft.AspNetCore.Components.Sections @using Iceshrimp.Assets.PhosphorIcons +@using Microsoft.AspNetCore.Authorization @inject IStringLocalizer Loc; diff --git a/Iceshrimp.Frontend/Pages/ProfileView.razor b/Iceshrimp.Frontend/Pages/ProfileView.razor index 0d8f5c64..eca91ff7 100644 --- a/Iceshrimp.Frontend/Pages/ProfileView.razor +++ b/Iceshrimp.Frontend/Pages/ProfileView.razor @@ -1,10 +1,13 @@ @page "/{User}" +@attribute [Authorize] + @using System.Text.RegularExpressions @using Iceshrimp.Frontend.Components @using Iceshrimp.Frontend.Components.Note @using Iceshrimp.Frontend.Core.Miscellaneous @using Iceshrimp.Frontend.Core.Services @using Iceshrimp.Shared.Schemas.Web +@using Microsoft.AspNetCore.Authorization @inject ApiService Api @if (_init) diff --git a/Iceshrimp.Frontend/Pages/SearchPage.razor b/Iceshrimp.Frontend/Pages/SearchPage.razor index c50b7f1c..83f0bc88 100644 --- a/Iceshrimp.Frontend/Pages/SearchPage.razor +++ b/Iceshrimp.Frontend/Pages/SearchPage.razor @@ -1,9 +1,11 @@ @page "/search" +@attribute [Authorize] @using Iceshrimp.Frontend.Components @using Iceshrimp.Frontend.Localization @using Microsoft.Extensions.Localization @using Microsoft.AspNetCore.Components.Sections @using Iceshrimp.Assets.PhosphorIcons +@using Microsoft.AspNetCore.Authorization @inject IStringLocalizer Loc; diff --git a/Iceshrimp.Frontend/Pages/Settings/About.razor b/Iceshrimp.Frontend/Pages/Settings/About.razor index ce1ffafc..11619203 100644 --- a/Iceshrimp.Frontend/Pages/Settings/About.razor +++ b/Iceshrimp.Frontend/Pages/Settings/About.razor @@ -1,8 +1,10 @@ @page "/settings/about" +@attribute [Authorize] @using System.Text @using Iceshrimp.Frontend.Core.InMemoryLogger @using Iceshrimp.Frontend.Core.Services; @using Iceshrimp.Frontend.Localization; +@using Microsoft.AspNetCore.Authorization @using Microsoft.Extensions.Localization; @layout SettingsLayout; @inject VersionService Version; diff --git a/Iceshrimp.Frontend/Pages/Settings/Filters.razor b/Iceshrimp.Frontend/Pages/Settings/Filters.razor index 0575035c..7e2133e7 100644 --- a/Iceshrimp.Frontend/Pages/Settings/Filters.razor +++ b/Iceshrimp.Frontend/Pages/Settings/Filters.razor @@ -1,4 +1,5 @@ @page "/settings/filters" +@attribute [Authorize] @using Iceshrimp.Frontend.Core.Miscellaneous @using Iceshrimp.Frontend.Components @using Iceshrimp.Frontend.Core.Services @@ -6,6 +7,7 @@ @using Iceshrimp.Shared.Schemas.Web @using Microsoft.Extensions.Localization @using Iceshrimp.Assets.PhosphorIcons +@using Microsoft.AspNetCore.Authorization @using Microsoft.AspNetCore.Components.Sections @layout SettingsLayout @inject ApiService Api; diff --git a/Iceshrimp.Frontend/Pages/Settings/Profile.razor b/Iceshrimp.Frontend/Pages/Settings/Profile.razor index c6aabf11..39141c0f 100644 --- a/Iceshrimp.Frontend/Pages/Settings/Profile.razor +++ b/Iceshrimp.Frontend/Pages/Settings/Profile.razor @@ -1,4 +1,5 @@ @page "/settings/profile" +@attribute [Authorize] @using Iceshrimp.Frontend.Core.Miscellaneous @using Iceshrimp.Frontend.Core.Services @using Iceshrimp.Frontend.Localization @@ -6,6 +7,7 @@ @using Microsoft.Extensions.Localization @using Iceshrimp.Assets.PhosphorIcons @using Iceshrimp.Frontend.Components +@using Microsoft.AspNetCore.Authorization @using Microsoft.Extensions.Logging @layout SettingsLayout @inject ApiService Api; diff --git a/Iceshrimp.Frontend/Pages/Settings/Settings.razor b/Iceshrimp.Frontend/Pages/Settings/Settings.razor index abb5e9d4..bf137db8 100644 --- a/Iceshrimp.Frontend/Pages/Settings/Settings.razor +++ b/Iceshrimp.Frontend/Pages/Settings/Settings.razor @@ -1,8 +1,10 @@ @page "/Settings" +@attribute [Authorize] @using Iceshrimp.Frontend.Components @using Microsoft.AspNetCore.Components.Sections @using Iceshrimp.Assets.PhosphorIcons @using Iceshrimp.Frontend.Localization +@using Microsoft.AspNetCore.Authorization @using Microsoft.Extensions.Localization @* @inject NavigationManager Nav; *@ @inject IStringLocalizer Loc; diff --git a/Iceshrimp.Frontend/Pages/SingleNote.razor b/Iceshrimp.Frontend/Pages/SingleNote.razor index 320d6ecc..042ea752 100644 --- a/Iceshrimp.Frontend/Pages/SingleNote.razor +++ b/Iceshrimp.Frontend/Pages/SingleNote.razor @@ -1,4 +1,5 @@ @page "/notes/{NoteId}" +@attribute [Authorize] @using Iceshrimp.Frontend.Components @using Iceshrimp.Frontend.Components.Note @using Iceshrimp.Frontend.Core.Miscellaneous @@ -9,6 +10,7 @@ @using Microsoft.Extensions.Localization @using Microsoft.AspNetCore.Components.Sections @using Iceshrimp.Assets.PhosphorIcons +@using Microsoft.AspNetCore.Authorization @inject ApiService ApiService @inject IJSRuntime Js @inject MessageService MessageService diff --git a/Iceshrimp.Frontend/Pages/TimelinePage.razor b/Iceshrimp.Frontend/Pages/TimelinePage.razor index 4307f74e..2e873efb 100644 --- a/Iceshrimp.Frontend/Pages/TimelinePage.razor +++ b/Iceshrimp.Frontend/Pages/TimelinePage.razor @@ -1,8 +1,10 @@ @page "/" +@attribute [Authorize] @using Iceshrimp.Frontend.Components @using Microsoft.AspNetCore.Components.Sections @using Iceshrimp.Assets.PhosphorIcons @using Iceshrimp.Frontend.Localization +@using Microsoft.AspNetCore.Authorization @using Microsoft.Extensions.Localization @inject IStringLocalizer Loc;