diff --git a/PlaylistShared.PWA2123/App.razor b/PlaylistShared.PWA2123/App.razor deleted file mode 100644 index 34eb91e..0000000 --- a/PlaylistShared.PWA2123/App.razor +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - @if (context.User.Identity?.IsAuthenticated != true) - { - - } - else - { -

You are not authorized to access this resource.

- } -
-
- -
-
-
diff --git a/PlaylistShared.PWA2123/Layout/LoginDisplay.razor b/PlaylistShared.PWA2123/Layout/LoginDisplay.razor deleted file mode 100644 index 21b0d19..0000000 --- a/PlaylistShared.PWA2123/Layout/LoginDisplay.razor +++ /dev/null @@ -1,19 +0,0 @@ -@using Microsoft.AspNetCore.Components.WebAssembly.Authentication -@inject NavigationManager Navigation - - - - Hello, @context.User.Identity?.Name! - Log out - - - Log in - - - -@code{ - public void BeginLogOut() - { - Navigation.NavigateToLogout("authentication/logout"); - } -} diff --git a/PlaylistShared.PWA2123/Layout/MainLayout.razor b/PlaylistShared.PWA2123/Layout/MainLayout.razor deleted file mode 100644 index 3cd4ef5..0000000 --- a/PlaylistShared.PWA2123/Layout/MainLayout.razor +++ /dev/null @@ -1,100 +0,0 @@ -@inherits LayoutComponentBase - - - - - - - - - - Application - - - - - About - - - - - - - - - @Body - - - -@code { - private bool _drawerOpen = true; - private bool _isDarkMode = true; - private MudTheme? _theme; - - protected override void OnInitialized() - { - base.OnInitialized(); - - _theme = new() - { - PaletteLight = _lightPalette, - PaletteDark = _darkPalette, - LayoutProperties = new LayoutProperties() - }; - } - - private void DrawerToggle() - { - _drawerOpen = !_drawerOpen; - } - - private void DarkModeToggle() - { - _isDarkMode = !_isDarkMode; - } - - private readonly PaletteLight _lightPalette = new() - { - Black = "#110e2d", - AppbarText = "#424242", - AppbarBackground = "rgba(255,255,255,0.8)", - DrawerBackground = "#ffffff", - GrayLight = "#e8e8e8", - GrayLighter = "#f9f9f9", - }; - - private readonly PaletteDark _darkPalette = new() - { - Primary = "#7e6fff", - Surface = "#1e1e2d", - Background = "#1a1a27", - BackgroundGray = "#151521", - AppbarText = "#92929f", - AppbarBackground = "rgba(26,26,39,0.8)", - DrawerBackground = "#1a1a27", - ActionDefault = "#74718e", - ActionDisabled = "#9999994d", - ActionDisabledBackground = "#605f6d4d", - TextPrimary = "#b2b0bf", - TextSecondary = "#92929f", - TextDisabled = "#ffffff33", - DrawerIcon = "#92929f", - DrawerText = "#92929f", - GrayLight = "#2a2833", - GrayLighter = "#1e1e2d", - Info = "#4a86ff", - Success = "#3dcb6c", - Warning = "#ffb545", - Error = "#ff3f5f", - LinesDefault = "#33323e", - TableLines = "#33323e", - Divider = "#292838", - OverlayLight = "#1e1e2d80", - }; - - public string DarkLightModeButtonIcon => _isDarkMode switch - { - true => Icons.Material.Rounded.AutoMode, - false => Icons.Material.Outlined.DarkMode, - }; -} diff --git a/PlaylistShared.PWA2123/Layout/MainLayout.razor.css b/PlaylistShared.PWA2123/Layout/MainLayout.razor.css deleted file mode 100644 index ecf25e5..0000000 --- a/PlaylistShared.PWA2123/Layout/MainLayout.razor.css +++ /dev/null @@ -1,77 +0,0 @@ -.page { - position: relative; - display: flex; - flex-direction: column; -} - -main { - flex: 1; -} - -.sidebar { - background-image: linear-gradient(180deg, rgb(5, 39, 103) 0%, #3a0647 70%); -} - -.top-row { - background-color: #f7f7f7; - border-bottom: 1px solid #d6d5d5; - justify-content: flex-end; - height: 3.5rem; - display: flex; - align-items: center; -} - - .top-row ::deep a, .top-row ::deep .btn-link { - white-space: nowrap; - margin-left: 1.5rem; - text-decoration: none; - } - - .top-row ::deep a:hover, .top-row ::deep .btn-link:hover { - text-decoration: underline; - } - - .top-row ::deep a:first-child { - overflow: hidden; - text-overflow: ellipsis; - } - -@media (max-width: 640.98px) { - .top-row { - justify-content: space-between; - } - - .top-row ::deep a, .top-row ::deep .btn-link { - margin-left: 0; - } -} - -@media (min-width: 641px) { - .page { - flex-direction: row; - } - - .sidebar { - width: 250px; - height: 100vh; - position: sticky; - top: 0; - } - - .top-row { - position: sticky; - top: 0; - z-index: 1; - } - - .top-row.auth ::deep a:first-child { - flex: 1; - text-align: right; - width: 0; - } - - .top-row, article { - padding-left: 2rem !important; - padding-right: 1.5rem !important; - } -} diff --git a/PlaylistShared.PWA2123/Layout/NavMenu.razor b/PlaylistShared.PWA2123/Layout/NavMenu.razor deleted file mode 100644 index fba6968..0000000 --- a/PlaylistShared.PWA2123/Layout/NavMenu.razor +++ /dev/null @@ -1,9 +0,0 @@ - - Home - - - Создать плейлист - Мои ссылки - - - \ No newline at end of file diff --git a/PlaylistShared.PWA2123/Layout/RedirectToLogin.razor b/PlaylistShared.PWA2123/Layout/RedirectToLogin.razor deleted file mode 100644 index a1cf400..0000000 --- a/PlaylistShared.PWA2123/Layout/RedirectToLogin.razor +++ /dev/null @@ -1,9 +0,0 @@ -@using Microsoft.AspNetCore.Components.WebAssembly.Authentication -@inject NavigationManager Navigation - -@code { - protected override void OnInitialized() - { - Navigation.NavigateToLogin("authentication/login"); - } -} diff --git a/PlaylistShared.PWA2123/Pages/AuthCallback.razor b/PlaylistShared.PWA2123/Pages/AuthCallback.razor deleted file mode 100644 index a0493a3..0000000 --- a/PlaylistShared.PWA2123/Pages/AuthCallback.razor +++ /dev/null @@ -1,24 +0,0 @@ -@page "/auth-callback" -@using PlaylistShared.PWA.Services -@inject NavigationManager Navigation -@inject AuthStateProvider AuthProvider -@inject ISnackbar Snackbar - -@code { - [Parameter] public string? Token { get; set; } - [Parameter] public string? RefreshToken { get; set; } - - protected override async Task OnInitializedAsync() - { - if (!string.IsNullOrEmpty(Token) && !string.IsNullOrEmpty(RefreshToken)) - { - await AuthProvider.MarkUserAsAuthenticated(Token, RefreshToken); - Navigation.NavigateTo("/"); - } - else - { - Snackbar.Add("Ошибка аутентификации через Яндекс", Severity.Error); - Navigation.NavigateTo("/login"); - } - } -} \ No newline at end of file diff --git a/PlaylistShared.PWA2123/Pages/Authentication.razor b/PlaylistShared.PWA2123/Pages/Authentication.razor deleted file mode 100644 index 6c74356..0000000 --- a/PlaylistShared.PWA2123/Pages/Authentication.razor +++ /dev/null @@ -1,7 +0,0 @@ -@page "/authentication/{action}" -@using Microsoft.AspNetCore.Components.WebAssembly.Authentication - - -@code{ - [Parameter] public string? Action { get; set; } -} diff --git a/PlaylistShared.PWA2123/Pages/Counter.razor b/PlaylistShared.PWA2123/Pages/Counter.razor deleted file mode 100644 index b7be219..0000000 --- a/PlaylistShared.PWA2123/Pages/Counter.razor +++ /dev/null @@ -1,18 +0,0 @@ -@page "/counter" - -Counter - -Counter - -Current count: @currentCount - -Click me - -@code { - private int currentCount = 0; - - private void IncrementCount() - { - currentCount++; - } -} diff --git a/PlaylistShared.PWA2123/Pages/Home.razor b/PlaylistShared.PWA2123/Pages/Home.razor deleted file mode 100644 index 7721bf2..0000000 --- a/PlaylistShared.PWA2123/Pages/Home.razor +++ /dev/null @@ -1,18 +0,0 @@ -@page "/" - -Home - -Hello, world! -Welcome to your new app, powered by MudBlazor and the .NET 10 Template! - - - Before authentication will function correctly, you must configure your provider details in Program.cs. - - - - - You can find documentation and examples on our website here: - - www.mudblazor.com - - diff --git a/PlaylistShared.PWA2123/Pages/Login.razor b/PlaylistShared.PWA2123/Pages/Login.razor deleted file mode 100644 index a7f8e97..0000000 --- a/PlaylistShared.PWA2123/Pages/Login.razor +++ /dev/null @@ -1,52 +0,0 @@ -@page "/login" -@using PlaylistShared.PWA.Services -@inject NavigationManager Navigation -@inject AuthStateProvider AuthProvider -@inject ApiClient ApiClient -@inject ISnackbar Snackbar - - - - - Вход в PlaylistShared - - - Войти через Яндекс - - - или - - - - Войти по паролю - - - Нет аккаунта? Зарегистрироваться - - - - - -@code { - private string _username = ""; - private string _password = ""; - - private void LoginWithYandex() - { - Navigation.NavigateTo("https://localhost:5001/api/externalauth/login-yandex", true); - } - - private async Task LoginWithPassword() - { - var result = await ApiClient.LoginAsync(_username, _password); - if (result != null) - { - await AuthProvider.MarkUserAsAuthenticated(result.Token, result.RefreshToken); - Navigation.NavigateTo("/"); - } - else - { - Snackbar.Add("Неверный логин или пароль", Severity.Error); - } - } -} \ No newline at end of file diff --git a/PlaylistShared.PWA2123/Pages/LoginDisplay.razor b/PlaylistShared.PWA2123/Pages/LoginDisplay.razor deleted file mode 100644 index 608f18d..0000000 --- a/PlaylistShared.PWA2123/Pages/LoginDisplay.razor +++ /dev/null @@ -1,11 +0,0 @@ -@inject NavigationManager Navigation - - - - Hello, @context.User.Identity?.Name! - Log out - - - Log in - - \ No newline at end of file diff --git a/PlaylistShared.PWA2123/Pages/Logout.razor b/PlaylistShared.PWA2123/Pages/Logout.razor deleted file mode 100644 index da74e30..0000000 --- a/PlaylistShared.PWA2123/Pages/Logout.razor +++ /dev/null @@ -1,12 +0,0 @@ -@page "/logout" -@using PlaylistShared.PWA.Services -@inject AuthStateProvider AuthProvider -@inject NavigationManager Navigation - -@code { - protected override async Task OnInitializedAsync() - { - await AuthProvider.MarkUserAsLoggedOut(); - Navigation.NavigateTo("/"); - } -} \ No newline at end of file diff --git a/PlaylistShared.PWA2123/Pages/NotFound.razor b/PlaylistShared.PWA2123/Pages/NotFound.razor deleted file mode 100644 index 56c8cc4..0000000 --- a/PlaylistShared.PWA2123/Pages/NotFound.razor +++ /dev/null @@ -1,9 +0,0 @@ -@page "/not-found" -@layout MainLayout - -Not Found - -404 - Page Not Found -Sorry, the content you are looking for does not exist. - -Go to Home diff --git a/PlaylistShared.PWA2123/Pages/Weather.razor b/PlaylistShared.PWA2123/Pages/Weather.razor deleted file mode 100644 index 242bcf3..0000000 --- a/PlaylistShared.PWA2123/Pages/Weather.razor +++ /dev/null @@ -1,52 +0,0 @@ -@page "/weather" -@inject HttpClient Http - -Weather - -Weather forecast -This component demonstrates fetching data from the server. - -@if (forecasts == null) -{ - -} -else -{ - - - Date - Temp. (C) - Temp. (F) - Summary - - - @context.Date - @context.TemperatureC - @context.TemperatureF - @context.Summary - - - - - -} - -@code { - private WeatherForecast[]? forecasts; - - protected override async Task OnInitializedAsync() - { - forecasts = await Http.GetFromJsonAsync("sample-data/weather.json"); - } - - public class WeatherForecast - { - public DateOnly Date { get; set; } - - public int TemperatureC { get; set; } - - public string? Summary { get; set; } - - public int TemperatureF => 32 + (int)(TemperatureC / 0.5556); - } -} diff --git a/PlaylistShared.PWA2123/PlaylistShared.PWA.csproj b/PlaylistShared.PWA2123/PlaylistShared.PWA.csproj deleted file mode 100644 index 3f89db1..0000000 --- a/PlaylistShared.PWA2123/PlaylistShared.PWA.csproj +++ /dev/null @@ -1,25 +0,0 @@ - - - - net10.0 - enable - enable - true - service-worker-assets.js - - - - - - - - - - - - - - - - - diff --git a/PlaylistShared.PWA2123/Program.cs b/PlaylistShared.PWA2123/Program.cs deleted file mode 100644 index 60c51ca..0000000 --- a/PlaylistShared.PWA2123/Program.cs +++ /dev/null @@ -1,36 +0,0 @@ -using Microsoft.AspNetCore.Components.Web; -using Microsoft.AspNetCore.Components.WebAssembly.Hosting; -using MudBlazor.Services; -using PlaylistShared.PWA; -using PlaylistShared.PWA.Services; - -internal class Program -{ - private static async global::System.Threading.Tasks.Task Main(string[] args) - { - var builder = WebAssemblyHostBuilder.CreateDefault(args); - builder.RootComponents.Add("#app"); - builder.RootComponents.Add("head::after"); - - builder.Services.AddMudServices(); - builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) }); - - builder.Services.AddScoped(); - builder.Services.AddScoped(); - builder.Services.AddScoped(); - - builder.Services.AddAuthorizationCore(); - builder.Services.AddCascadingAuthenticationState(); - - /* - builder.Services.AddOidcAuthentication(options => - { - // Configure your authentication provider options here. - // For more information, see https://aka.ms/blazor-standalone-auth - builder.Configuration.Bind("Local", options.ProviderOptions); - }); - */ - - await builder.Build().RunAsync(); - } -} \ No newline at end of file diff --git a/PlaylistShared.PWA2123/Properties/launchSettings.json b/PlaylistShared.PWA2123/Properties/launchSettings.json deleted file mode 100644 index 4adf325..0000000 --- a/PlaylistShared.PWA2123/Properties/launchSettings.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "$schema": "https://json.schemastore.org/launchsettings.json", - "profiles": { - "https": { - "commandName": "Project", - "dotnetRunMessages": true, - "launchBrowser": true, - "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}", - "applicationUrl": "https://localhost:7244;http://localhost:5143", - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - } - } - } -} diff --git a/PlaylistShared.PWA2123/Services/ApiClient.cs b/PlaylistShared.PWA2123/Services/ApiClient.cs deleted file mode 100644 index c0afbbb..0000000 --- a/PlaylistShared.PWA2123/Services/ApiClient.cs +++ /dev/null @@ -1,77 +0,0 @@ -using PlaylistShared.Shared.DTO; -using PlaylistShared.Shared.Models; -using System.Net.Http.Json; - -namespace PlaylistShared.PWA.Services; - -public class ApiClient -{ - private readonly HttpClient _http; - private readonly TokenStorage _tokenStorage; - - public ApiClient(HttpClient http, TokenStorage tokenStorage) - { - _http = http; - _tokenStorage = tokenStorage; - } - - public async Task RefreshTokenAsync(string? refreshToken) - { - var response = await _http.PostAsJsonAsync("/api/account/refresh-token", new RefreshTokenRequest { RefreshToken = refreshToken }); - if (!response.IsSuccessStatusCode) return null; - var apiResponse = await response.Content.ReadFromJsonAsync>(); - return apiResponse?.Data; - } - - public async Task LoginAsync(string username, string password) - { - var response = await _http.PostAsJsonAsync("/api/account/login", new LoginRequest { Username = username, Password = password }); - if (!response.IsSuccessStatusCode) return null; - var apiResponse = await response.Content.ReadFromJsonAsync>(); - return apiResponse?.Data; - } - - public async Task RegisterAsync(string username, string email, string password) - { - var response = await _http.PostAsJsonAsync("/api/account/register", new RegisterRequest { Username = username, Email = email, Password = password }); - if (!response.IsSuccessStatusCode) return null; - var apiResponse = await response.Content.ReadFromJsonAsync>(); - return apiResponse?.Data; - } - - public async Task CreateSharedPlaylistAsync(SharePlaylistDto dto) - { - var response = await _http.PostAsJsonAsync("/api/sharedplaylist", dto); - if (!response.IsSuccessStatusCode) return null; - var apiResponse = await response.Content.ReadFromJsonAsync>(); - return apiResponse?.Data; - } - - public async Task GetSharedPlaylistAsync(string token) - { - var response = await _http.GetAsync($"/api/sharedplaylist/{token}"); - if (!response.IsSuccessStatusCode) return null; - var apiResponse = await response.Content.ReadFromJsonAsync>(); - return apiResponse?.Data; - } - - public async Task AddTracksAsync(string sharedPlaylistToken, List trackIds) - { - var response = await _http.PostAsJsonAsync("/api/playlist/add-tracks", new AddTrackRequest - { - SharedPlaylistToken = sharedPlaylistToken, - TrackIds = trackIds - }); - return response.IsSuccessStatusCode; - } - - public async Task RemoveTracksAsync(string sharedPlaylistToken, List trackIds) - { - var response = await _http.PostAsJsonAsync("/api/playlist/remove-tracks", new AddTrackRequest - { - SharedPlaylistToken = sharedPlaylistToken, - TrackIds = trackIds - }); - return response.IsSuccessStatusCode; - } -} \ No newline at end of file diff --git a/PlaylistShared.PWA2123/Services/AuthStateProvider.cs b/PlaylistShared.PWA2123/Services/AuthStateProvider.cs deleted file mode 100644 index 538d115..0000000 --- a/PlaylistShared.PWA2123/Services/AuthStateProvider.cs +++ /dev/null @@ -1,99 +0,0 @@ -using System.Net.Http.Headers; -using System.Security.Claims; - -namespace PlaylistShared.PWA.Services; - -public class AuthStateProvider : AuthenticationStateProvider, IDisposable -{ - private readonly TokenStorage _tokenStorage; - private readonly ApiClient _apiClient; - private readonly HttpClient _http; - private Timer? _refreshTimer; - private ClaimsPrincipal _currentUser = new(new ClaimsIdentity()); - - public AuthStateProvider(TokenStorage tokenStorage, ApiClient apiClient, HttpClient http) - { - _tokenStorage = tokenStorage; - _apiClient = apiClient; - _http = http; - } - - public override async Task GetAuthenticationStateAsync() - { - var (token, refreshToken) = await _tokenStorage.GetTokensAsync(); - if (string.IsNullOrEmpty(token)) - return new AuthenticationState(_currentUser); - - var principal = ParseToken(token); - if (principal == null) - return new AuthenticationState(_currentUser); - - _currentUser = principal; - _http.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token); - ScheduleTokenRefresh(token, refreshToken); - return new AuthenticationState(principal); - } - - public async Task MarkUserAsAuthenticated(string token, string refreshToken) - { - await _tokenStorage.SetTokensAsync(token, refreshToken); - var principal = ParseToken(token); - _currentUser = principal ?? new ClaimsPrincipal(new ClaimsIdentity()); - _http.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token); - NotifyAuthenticationStateChanged(GetAuthenticationStateAsync()); - } - - public async Task MarkUserAsLoggedOut() - { - await _tokenStorage.ClearTokensAsync(); - _currentUser = new ClaimsPrincipal(new ClaimsIdentity()); - _http.DefaultRequestHeaders.Authorization = null; - NotifyAuthenticationStateChanged(GetAuthenticationStateAsync()); - } - - private ClaimsPrincipal? ParseToken(string token) - { - try - { - var handler = new JwtSecurityTokenHandler(); - var jwt = handler.ReadJwtToken(token); - var identity = new ClaimsIdentity(jwt.Claims, "jwt"); - return new ClaimsPrincipal(identity); - } - catch - { - return null; - } - } - - private void ScheduleTokenRefresh(string token, string? refreshToken) - { - var handler = new JwtSecurityTokenHandler(); - var jwt = handler.ReadJwtToken(token); - var expiresAt = jwt.ValidTo; - var timeToExpiry = expiresAt - DateTime.UtcNow; - var refreshTime = timeToExpiry - TimeSpan.FromMinutes(5); - - if (refreshTime > TimeSpan.Zero && !string.IsNullOrEmpty(refreshToken)) - { - _refreshTimer?.Dispose(); - _refreshTimer = new Timer(async _ => - { - try - { - var newToken = await _apiClient.RefreshTokenAsync(refreshToken); - if (newToken != null) - await MarkUserAsAuthenticated(newToken.Token, newToken.RefreshToken); - else - await MarkUserAsLoggedOut(); - } - catch - { - await MarkUserAsLoggedOut(); - } - }, null, (int)refreshTime.TotalMilliseconds, Timeout.Infinite); - } - } - - public void Dispose() => _refreshTimer?.Dispose(); -} \ No newline at end of file diff --git a/PlaylistShared.PWA2123/Services/TokenStorage.cs b/PlaylistShared.PWA2123/Services/TokenStorage.cs deleted file mode 100644 index bcc7277..0000000 --- a/PlaylistShared.PWA2123/Services/TokenStorage.cs +++ /dev/null @@ -1,31 +0,0 @@ -using Microsoft.JSInterop; - -namespace PlaylistShared.PWA.Services; - -public class TokenStorage -{ - private readonly IJSRuntime _js; - private const string TokenKey = "jwt_token"; - private const string RefreshTokenKey = "refresh_token"; - - public TokenStorage(IJSRuntime js) => _js = js; - - public async Task SetTokensAsync(string token, string refreshToken) - { - await _js.InvokeVoidAsync("localStorage.setItem", TokenKey, token); - await _js.InvokeVoidAsync("localStorage.setItem", RefreshTokenKey, refreshToken); - } - - public async Task<(string? token, string? refreshToken)> GetTokensAsync() - { - var token = await _js.InvokeAsync("localStorage.getItem", TokenKey); - var refreshToken = await _js.InvokeAsync("localStorage.getItem", RefreshTokenKey); - return (token, refreshToken); - } - - public async Task ClearTokensAsync() - { - await _js.InvokeVoidAsync("localStorage.removeItem", TokenKey); - await _js.InvokeVoidAsync("localStorage.removeItem", RefreshTokenKey); - } -} \ No newline at end of file diff --git a/PlaylistShared.PWA2123/_Imports.razor b/PlaylistShared.PWA2123/_Imports.razor deleted file mode 100644 index 4278aa7..0000000 --- a/PlaylistShared.PWA2123/_Imports.razor +++ /dev/null @@ -1,13 +0,0 @@ -@using System.Net.Http -@using System.Net.Http.Json -@using Microsoft.AspNetCore.Components.Authorization -@using Microsoft.AspNetCore.Components.Forms -@using Microsoft.AspNetCore.Components.Routing -@using Microsoft.AspNetCore.Components.Web -@using Microsoft.AspNetCore.Components.Web.Virtualization -@using Microsoft.AspNetCore.Components.WebAssembly.Http -@using Microsoft.JSInterop -@using PlaylistShared.PWA -@using PlaylistShared.PWA.Layout -@using PlaylistShared.PWA.Services -@using MudBlazor diff --git a/PlaylistShared.PWA2123/wwwroot/appsettings.Development.json b/PlaylistShared.PWA2123/wwwroot/appsettings.Development.json deleted file mode 100644 index fdae94a..0000000 --- a/PlaylistShared.PWA2123/wwwroot/appsettings.Development.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "Local": { - "Authority": "https://login.microsoftonline.com/", - "ClientId": "33333333-3333-3333-33333333333333333" - } -} diff --git a/PlaylistShared.PWA2123/wwwroot/appsettings.json b/PlaylistShared.PWA2123/wwwroot/appsettings.json deleted file mode 100644 index fdae94a..0000000 --- a/PlaylistShared.PWA2123/wwwroot/appsettings.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "Local": { - "Authority": "https://login.microsoftonline.com/", - "ClientId": "33333333-3333-3333-33333333333333333" - } -} diff --git a/PlaylistShared.PWA2123/wwwroot/css/app.css b/PlaylistShared.PWA2123/wwwroot/css/app.css deleted file mode 100644 index e24afa9..0000000 --- a/PlaylistShared.PWA2123/wwwroot/css/app.css +++ /dev/null @@ -1,110 +0,0 @@ -html, body { - font-family: 'Roboto', Helvetica, Arial, sans-serif; -} - -#blazor-error-ui { - color-scheme: light; - background: rgba(30, 30, 45, 0.95); - color: #f5f5f7; - border: 1px solid rgba(255, 255, 255, 0.08); - border-radius: 12px; - box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35); - backdrop-filter: blur(6px); - box-sizing: border-box; - display: none; - left: 50%; - right: auto; - bottom: 1rem; - width: min(52rem, calc(100vw - 2rem)); - transform: translateX(-50%); - padding: 0.85rem 4rem 0.85rem 1rem; - position: fixed; - z-index: 2000; -} - - #blazor-error-ui .reload { - color: #594AE2; - font-weight: 600; - margin-left: 0.5rem; - text-decoration: none; - } - - #blazor-error-ui .reload:hover { - text-decoration: underline; - } - - #blazor-error-ui .dismiss { - cursor: pointer; - position: absolute; - right: 1rem; - top: 0.55rem; - width: 1.75rem; - height: 1.75rem; - line-height: 1.65rem; - text-align: center; - border-radius: 999px; - color: #d7d7df; - background: rgba(255, 255, 255, 0.06); - border: 1px solid rgba(255, 255, 255, 0.08); - } - - #blazor-error-ui .dismiss:hover { - background: rgba(255, 255, 255, 0.12); - } - -.blazor-error-boundary { - background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121; - padding: 1rem 1rem 1rem 3.7rem; - color: white; -} - - .blazor-error-boundary::after { - content: "An error has occurred." - } - -.loading-progress { - position: absolute; - display: block; - width: 8rem; - height: 8rem; - inset: 20vh 0 auto 0; - margin: 0 auto 0 auto; -} - - .loading-progress circle { - fill: none; - stroke: #e0e0e0; - stroke-width: 0.6rem; - transform-origin: 50% 50%; - transform: rotate(-90deg); - } - - .loading-progress circle:last-child { - stroke: #594AE2; - stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%; - transition: stroke-dasharray 0.05s ease-in-out; - } - -.loading-progress-text { - position: absolute; - text-align: center; - font-weight: bold; - inset: calc(20vh + 3.25rem) 0 auto 0.2rem; -} - - .loading-progress-text:after { - content: var(--blazor-load-percentage-text, "Loading"); - } - -code { - color: #c02d76; -} - -.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder { - color: var(--bs-secondary-color); - text-align: end; -} - -.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder { - text-align: start; -} diff --git a/PlaylistShared.PWA2123/wwwroot/favicon.png b/PlaylistShared.PWA2123/wwwroot/favicon.png deleted file mode 100644 index 8a4358c..0000000 Binary files a/PlaylistShared.PWA2123/wwwroot/favicon.png and /dev/null differ diff --git a/PlaylistShared.PWA2123/wwwroot/icon-192.png b/PlaylistShared.PWA2123/wwwroot/icon-192.png deleted file mode 100644 index f275437..0000000 Binary files a/PlaylistShared.PWA2123/wwwroot/icon-192.png and /dev/null differ diff --git a/PlaylistShared.PWA2123/wwwroot/icon-512.png b/PlaylistShared.PWA2123/wwwroot/icon-512.png deleted file mode 100644 index 2326ede..0000000 Binary files a/PlaylistShared.PWA2123/wwwroot/icon-512.png and /dev/null differ diff --git a/PlaylistShared.PWA2123/wwwroot/index.html b/PlaylistShared.PWA2123/wwwroot/index.html deleted file mode 100644 index ab8ad1a..0000000 --- a/PlaylistShared.PWA2123/wwwroot/index.html +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - PlaylistShared.PWA - - - - - - - - - - - - - - -
- - - - -
-
- -
- An unhandled error has occurred. - Reload - 🗙 -
- - - - - - - diff --git a/PlaylistShared.PWA2123/wwwroot/manifest.webmanifest b/PlaylistShared.PWA2123/wwwroot/manifest.webmanifest deleted file mode 100644 index 5496339..0000000 --- a/PlaylistShared.PWA2123/wwwroot/manifest.webmanifest +++ /dev/null @@ -1,22 +0,0 @@ -{ - "name": "PlaylistShared.PWA", - "short_name": "PlaylistShared.PWA", - "id": "./", - "start_url": "./", - "display": "standalone", - "background_color": "#ffffff", - "theme_color": "#03173d", - "prefer_related_applications": false, - "icons": [ - { - "src": "icon-512.png", - "type": "image/png", - "sizes": "512x512" - }, - { - "src": "icon-192.png", - "type": "image/png", - "sizes": "192x192" - } - ] -} diff --git a/PlaylistShared.PWA2123/wwwroot/sample-data/weather.json b/PlaylistShared.PWA2123/wwwroot/sample-data/weather.json deleted file mode 100644 index b745973..0000000 --- a/PlaylistShared.PWA2123/wwwroot/sample-data/weather.json +++ /dev/null @@ -1,27 +0,0 @@ -[ - { - "date": "2022-01-06", - "temperatureC": 1, - "summary": "Freezing" - }, - { - "date": "2022-01-07", - "temperatureC": 14, - "summary": "Bracing" - }, - { - "date": "2022-01-08", - "temperatureC": -13, - "summary": "Freezing" - }, - { - "date": "2022-01-09", - "temperatureC": -16, - "summary": "Balmy" - }, - { - "date": "2022-01-10", - "temperatureC": -2, - "summary": "Chilly" - } -] diff --git a/PlaylistShared.PWA2123/wwwroot/service-worker.js b/PlaylistShared.PWA2123/wwwroot/service-worker.js deleted file mode 100644 index fe614da..0000000 --- a/PlaylistShared.PWA2123/wwwroot/service-worker.js +++ /dev/null @@ -1,4 +0,0 @@ -// In development, always fetch from the network and do not enable offline support. -// This is because caching would make development more difficult (changes would not -// be reflected on the first load after each change). -self.addEventListener('fetch', () => { }); diff --git a/PlaylistShared.PWA2123/wwwroot/service-worker.published.js b/PlaylistShared.PWA2123/wwwroot/service-worker.published.js deleted file mode 100644 index 51a0e5c..0000000 --- a/PlaylistShared.PWA2123/wwwroot/service-worker.published.js +++ /dev/null @@ -1,55 +0,0 @@ -// Caution! Be sure you understand the caveats before publishing an application with -// offline support. See https://aka.ms/blazor-offline-considerations - -self.importScripts('./service-worker-assets.js'); -self.addEventListener('install', event => event.waitUntil(onInstall(event))); -self.addEventListener('activate', event => event.waitUntil(onActivate(event))); -self.addEventListener('fetch', event => event.respondWith(onFetch(event))); - -const cacheNamePrefix = 'offline-cache-'; -const cacheName = `${cacheNamePrefix}${self.assetsManifest.version}`; -const offlineAssetsInclude = [ /\.dll$/, /\.pdb$/, /\.wasm/, /\.html/, /\.js$/, /\.json$/, /\.css$/, /\.woff$/, /\.png$/, /\.jpe?g$/, /\.gif$/, /\.ico$/, /\.blat$/, /\.dat$/, /\.webmanifest$/ ]; -const offlineAssetsExclude = [ /^service-worker\.js$/ ]; - -// Replace with your base path if you are hosting on a subfolder. Ensure there is a trailing '/'. -const base = "/"; -const baseUrl = new URL(base, self.origin); -const manifestUrlList = self.assetsManifest.assets.map(asset => new URL(asset.url, baseUrl).href); - -async function onInstall(event) { - console.info('Service worker: Install'); - - // Fetch and cache all matching items from the assets manifest - const assetsRequests = self.assetsManifest.assets - .filter(asset => offlineAssetsInclude.some(pattern => pattern.test(asset.url))) - .filter(asset => !offlineAssetsExclude.some(pattern => pattern.test(asset.url))) - .map(asset => new Request(asset.url, { integrity: asset.hash, cache: 'no-cache' })); - await caches.open(cacheName).then(cache => cache.addAll(assetsRequests)); -} - -async function onActivate(event) { - console.info('Service worker: Activate'); - - // Delete unused caches - const cacheKeys = await caches.keys(); - await Promise.all(cacheKeys - .filter(key => key.startsWith(cacheNamePrefix) && key !== cacheName) - .map(key => caches.delete(key))); -} - -async function onFetch(event) { - let cachedResponse = null; - if (event.request.method === 'GET') { - // For all navigation requests, try to serve index.html from cache, - // unless that request is for an offline resource. - // If you need some URLs to be server-rendered, edit the following check to exclude those URLs - const shouldServeIndexHtml = event.request.mode === 'navigate' - && !manifestUrlList.some(url => url === event.request.url); - - const request = shouldServeIndexHtml ? 'index.html' : event.request; - const cache = await caches.open(cacheName); - cachedResponse = await cache.match(request); - } - - return cachedResponse || fetch(event.request); -}