diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/HomePage.razor b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/HomePage.razor index 045087437e..0a97a3b750 100644 --- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/HomePage.razor +++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/HomePage.razor @@ -25,30 +25,6 @@ - - - - @if (isGitHubLoading) - { - - } - else - { -
@gitHubStatsString
- } -
- - @if (isNugetLoading) - { - - } - else - { -
@nugetStatsString
- } -
-
-

diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/HomePage.razor.GitHubStats.cs b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/HomePage.razor.GitHubStats.cs deleted file mode 100644 index db5cfb989c..0000000000 --- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/HomePage.razor.GitHubStats.cs +++ /dev/null @@ -1,147 +0,0 @@ -namespace Boilerplate.Client.Core.Components.Pages; - - -public record GitHubStats( - [property: JsonPropertyName("id")] int Id, - [property: JsonPropertyName("node_id")] string NodeId, - [property: JsonPropertyName("name")] string Name, - [property: JsonPropertyName("full_name")] string FullName, - [property: JsonPropertyName("private")] bool Private, - [property: JsonPropertyName("owner")] Owner Owner, - [property: JsonPropertyName("html_url")] string HtmlUrl, - [property: JsonPropertyName("description")] string Description, - [property: JsonPropertyName("fork")] bool Fork, - [property: JsonPropertyName("url")] string Url, - [property: JsonPropertyName("forks_url")] string ForksUrl, - [property: JsonPropertyName("keys_url")] string KeysUrl, - [property: JsonPropertyName("collaborators_url")] string CollaboratorsUrl, - [property: JsonPropertyName("teams_url")] string TeamsUrl, - [property: JsonPropertyName("hooks_url")] string HooksUrl, - [property: JsonPropertyName("issue_events_url")] string IssueEventsUrl, - [property: JsonPropertyName("events_url")] string EventsUrl, - [property: JsonPropertyName("assignees_url")] string AssigneesUrl, - [property: JsonPropertyName("branches_url")] string BranchesUrl, - [property: JsonPropertyName("tags_url")] string TagsUrl, - [property: JsonPropertyName("blobs_url")] string BlobsUrl, - [property: JsonPropertyName("git_tags_url")] string GitTagsUrl, - [property: JsonPropertyName("git_refs_url")] string GitRefsUrl, - [property: JsonPropertyName("trees_url")] string TreesUrl, - [property: JsonPropertyName("statuses_url")] string StatusesUrl, - [property: JsonPropertyName("languages_url")] string LanguagesUrl, - [property: JsonPropertyName("stargazers_url")] string StargazersUrl, - [property: JsonPropertyName("contributors_url")] string ContributorsUrl, - [property: JsonPropertyName("subscribers_url")] string SubscribersUrl, - [property: JsonPropertyName("subscription_url")] string SubscriptionUrl, - [property: JsonPropertyName("commits_url")] string CommitsUrl, - [property: JsonPropertyName("git_commits_url")] string GitCommitsUrl, - [property: JsonPropertyName("comments_url")] string CommentsUrl, - [property: JsonPropertyName("issue_comment_url")] string IssueCommentUrl, - [property: JsonPropertyName("contents_url")] string ContentsUrl, - [property: JsonPropertyName("compare_url")] string CompareUrl, - [property: JsonPropertyName("merges_url")] string MergesUrl, - [property: JsonPropertyName("archive_url")] string ArchiveUrl, - [property: JsonPropertyName("downloads_url")] string DownloadsUrl, - [property: JsonPropertyName("issues_url")] string IssuesUrl, - [property: JsonPropertyName("pulls_url")] string PullsUrl, - [property: JsonPropertyName("milestones_url")] string MilestonesUrl, - [property: JsonPropertyName("notifications_url")] string NotificationsUrl, - [property: JsonPropertyName("labels_url")] string LabelsUrl, - [property: JsonPropertyName("releases_url")] string ReleasesUrl, - [property: JsonPropertyName("deployments_url")] string DeploymentsUrl, - [property: JsonPropertyName("created_at")] DateTime CreatedAt, - [property: JsonPropertyName("updated_at")] DateTime UpdatedAt, - [property: JsonPropertyName("pushed_at")] DateTime PushedAt, - [property: JsonPropertyName("git_url")] string GitUrl, - [property: JsonPropertyName("ssh_url")] string SshUrl, - [property: JsonPropertyName("clone_url")] string CloneUrl, - [property: JsonPropertyName("svn_url")] string SvnUrl, - [property: JsonPropertyName("homepage")] string Homepage, - [property: JsonPropertyName("size")] int Size, - [property: JsonPropertyName("stargazers_count")] int StargazersCount, - [property: JsonPropertyName("watchers_count")] int WatchersCount, - [property: JsonPropertyName("language")] string Language, - [property: JsonPropertyName("has_issues")] bool HasIssues, - [property: JsonPropertyName("has_projects")] bool HasProjects, - [property: JsonPropertyName("has_downloads")] bool HasDownloads, - [property: JsonPropertyName("has_wiki")] bool HasWiki, - [property: JsonPropertyName("has_pages")] bool HasPages, - [property: JsonPropertyName("has_discussions")] bool HasDiscussions, - [property: JsonPropertyName("forks_count")] int ForksCount, - [property: JsonPropertyName("mirror_url")] object MirrorUrl, - [property: JsonPropertyName("archived")] bool Archived, - [property: JsonPropertyName("disabled")] bool Disabled, - [property: JsonPropertyName("open_issues_count")] int OpenIssuesCount, - [property: JsonPropertyName("license")] License License, - [property: JsonPropertyName("allow_forking")] bool AllowForking, - [property: JsonPropertyName("is_template")] bool IsTemplate, - [property: JsonPropertyName("web_commit_signoff_required")] bool WebCommitSignoffRequired, - [property: JsonPropertyName("topics")] IReadOnlyList Topics, - [property: JsonPropertyName("visibility")] string Visibility, - [property: JsonPropertyName("forks")] int Forks, - [property: JsonPropertyName("open_issues")] int OpenIssues, - [property: JsonPropertyName("watchers")] int Watchers, - [property: JsonPropertyName("default_branch")] string DefaultBranch, - [property: JsonPropertyName("temp_clone_token")] object TempCloneToken, - [property: JsonPropertyName("custom_properties")] CustomProperties CustomProperties, - [property: JsonPropertyName("organization")] Organization Organization, - [property: JsonPropertyName("network_count")] int NetworkCount, - [property: JsonPropertyName("subscribers_count")] int SubscribersCount -); - -public record CustomProperties( - -); - -public record License( - [property: JsonPropertyName("key")] string Key, - [property: JsonPropertyName("name")] string Name, - [property: JsonPropertyName("spdx_id")] string SpdxId, - [property: JsonPropertyName("url")] string Url, - [property: JsonPropertyName("node_id")] string NodeId -); - -public record Organization( - [property: JsonPropertyName("login")] string Login, - [property: JsonPropertyName("id")] int Id, - [property: JsonPropertyName("node_id")] string NodeId, - [property: JsonPropertyName("avatar_url")] string AvatarUrl, - [property: JsonPropertyName("gravatar_id")] string GravatarId, - [property: JsonPropertyName("url")] string Url, - [property: JsonPropertyName("html_url")] string HtmlUrl, - [property: JsonPropertyName("followers_url")] string FollowersUrl, - [property: JsonPropertyName("following_url")] string FollowingUrl, - [property: JsonPropertyName("gists_url")] string GistsUrl, - [property: JsonPropertyName("starred_url")] string StarredUrl, - [property: JsonPropertyName("subscriptions_url")] string SubscriptionsUrl, - [property: JsonPropertyName("organizations_url")] string OrganizationsUrl, - [property: JsonPropertyName("repos_url")] string ReposUrl, - [property: JsonPropertyName("events_url")] string EventsUrl, - [property: JsonPropertyName("received_events_url")] string ReceivedEventsUrl, - [property: JsonPropertyName("type")] string Type, - [property: JsonPropertyName("user_view_type")] string UserViewType, - [property: JsonPropertyName("site_admin")] bool SiteAdmin -); - -public record Owner( - [property: JsonPropertyName("login")] string Login, - [property: JsonPropertyName("id")] int Id, - [property: JsonPropertyName("node_id")] string NodeId, - [property: JsonPropertyName("avatar_url")] string AvatarUrl, - [property: JsonPropertyName("gravatar_id")] string GravatarId, - [property: JsonPropertyName("url")] string Url, - [property: JsonPropertyName("html_url")] string HtmlUrl, - [property: JsonPropertyName("followers_url")] string FollowersUrl, - [property: JsonPropertyName("following_url")] string FollowingUrl, - [property: JsonPropertyName("gists_url")] string GistsUrl, - [property: JsonPropertyName("starred_url")] string StarredUrl, - [property: JsonPropertyName("subscriptions_url")] string SubscriptionsUrl, - [property: JsonPropertyName("organizations_url")] string OrganizationsUrl, - [property: JsonPropertyName("repos_url")] string ReposUrl, - [property: JsonPropertyName("events_url")] string EventsUrl, - [property: JsonPropertyName("received_events_url")] string ReceivedEventsUrl, - [property: JsonPropertyName("type")] string Type, - [property: JsonPropertyName("user_view_type")] string UserViewType, - [property: JsonPropertyName("site_admin")] bool SiteAdmin -); - - diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/HomePage.razor.cs b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/HomePage.razor.cs index fbe423517f..e63f90986a 100644 --- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/HomePage.razor.cs +++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/HomePage.razor.cs @@ -1,61 +1,9 @@ -using Boilerplate.Shared.Controllers.Home; -using Boilerplate.Shared.Dtos.Home; - -namespace Boilerplate.Client.Core.Components.Pages; +namespace Boilerplate.Client.Core.Components.Pages; public partial class HomePage { protected override string? Title => Localizer[nameof(AppStrings.Home)]; protected override string? Subtitle => string.Empty; - [CascadingParameter] private BitDir? currentDir { get; set; } - - - [AutoInject] private IHomeController homeController = default!; - - - private bool isNugetLoading; - private bool isGitHubLoading; - private NugetStatsDto? nugetStats; - private GitHubStats? gitHubStats; - private string? nugetStatsString; - private string? gitHubStatsString; - - protected override async Task OnInitAsync() - { - await base.OnInitAsync(); - - await LoadGitHubStats(); - await LoadNugetStats("Bit.BlazorUI"); - } - - - private async Task LoadGitHubStats() - { - try - { - isGitHubLoading = true; - gitHubStats = await HttpClient.GetFromJsonAsync("https://api.github.com/repos/bitfoundation/bitplatform"); - gitHubStatsString = JsonSerializer.Serialize(gitHubStats, new JsonSerializerOptions { WriteIndented = true }); - } - finally - { - isGitHubLoading = false; - } - } - - private async Task LoadNugetStats(string packageId) - { - try - { - isNugetLoading = true; - nugetStats = await homeController.GetNugetStats(packageId, CurrentCancellationToken); - nugetStatsString = JsonSerializer.Serialize(nugetStats, new JsonSerializerOptions { WriteIndented = true }); - } - finally - { - isNugetLoading = false; - } - } } diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Services/HttpMessageHandlers/AuthDelegatingHandler.cs b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Services/HttpMessageHandlers/AuthDelegatingHandler.cs index 618aea572c..d0b61ba21c 100644 --- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Services/HttpMessageHandlers/AuthDelegatingHandler.cs +++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Services/HttpMessageHandlers/AuthDelegatingHandler.cs @@ -14,13 +14,11 @@ public partial class AuthDelegatingHandler(IJSRuntime jsRuntime, protected override async Task SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) { - var serverAddress = configuration.GetServerAddress(); var isRefreshTokenRequest = request.RequestUri?.LocalPath?.Contains(IIdentityController.RefreshUri, StringComparison.InvariantCultureIgnoreCase) is true; try { - if (request.RequestUri?.AbsoluteUri.Contains(serverAddress) is true && - request.Headers.Authorization is null && + if (request.Headers.Authorization is null && isRefreshTokenRequest is false) { var access_token = await tokenProvider.GetAccessToken(); diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.Api/Controllers/Home/HomeController.cs b/src/Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.Api/Controllers/Home/HomeController.cs deleted file mode 100644 index 3d74303a9d..0000000000 --- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.Api/Controllers/Home/HomeController.cs +++ /dev/null @@ -1,18 +0,0 @@ -using Boilerplate.Shared.Controllers.Home; -using Boilerplate.Shared.Dtos.Home; - -namespace Boilerplate.Server.Api.Controllers; - -[ApiController, Route("api/[controller]/[action]")] -public partial class HomeController : AppControllerBase, IHomeController -{ - [AutoInject] private HttpClient httpClient = default!; - - [HttpGet("{packageId}")] - public async Task GetNugetStats(string packageId, CancellationToken cancellationToken) - { - var stats = await httpClient.GetFromJsonAsync($"https://api-v2v3search-0.nuget.org/query?q=packageid:{packageId}", cancellationToken) - ?? throw new ResourceNotFoundException(packageId); - return stats; - } -} diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Shared/Controllers/Home/IHomeController.cs b/src/Templates/Boilerplate/Bit.Boilerplate/src/Shared/Controllers/Home/IHomeController.cs deleted file mode 100644 index b957224227..0000000000 --- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Shared/Controllers/Home/IHomeController.cs +++ /dev/null @@ -1,10 +0,0 @@ -using Boilerplate.Shared.Dtos.Home; - -namespace Boilerplate.Shared.Controllers.Home; - -[Route("api/[controller]/[action]/")] -public interface IHomeController : IAppController -{ - [HttpGet("{packageId}")] - Task GetNugetStats(string packageId, CancellationToken cancellationToken); -} diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Shared/Dtos/AppJsonContext.cs b/src/Templates/Boilerplate/Bit.Boilerplate/src/Shared/Dtos/AppJsonContext.cs index a794b2647a..6ab5f7d91c 100644 --- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Shared/Dtos/AppJsonContext.cs +++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Shared/Dtos/AppJsonContext.cs @@ -8,7 +8,6 @@ //#endif //#if (notification == true) using Boilerplate.Shared.Dtos.PushNotification; -using Boilerplate.Shared.Dtos.Home; //#endif namespace Boilerplate.Shared.Dtos; @@ -20,7 +19,6 @@ namespace Boilerplate.Shared.Dtos; [JsonSerializable(typeof(Dictionary))] [JsonSerializable(typeof(string[]))] [JsonSerializable(typeof(RestErrorInfo))] -[JsonSerializable(typeof(NugetStatsDto))] //#if (notification == true) [JsonSerializable(typeof(DeviceInstallationDto))] //#endif diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Shared/Dtos/Home/NugetStatsDto.cs b/src/Templates/Boilerplate/Bit.Boilerplate/src/Shared/Dtos/Home/NugetStatsDto.cs deleted file mode 100644 index c231eaad17..0000000000 --- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Shared/Dtos/Home/NugetStatsDto.cs +++ /dev/null @@ -1,46 +0,0 @@ -namespace Boilerplate.Shared.Dtos.Home; - -public record NugetStatsDto( - [property: JsonPropertyName("@context")] Context Context, - [property: JsonPropertyName("totalHits")] int TotalHits, - [property: JsonPropertyName("data")] IReadOnlyList Data -); - -public record Context( - [property: JsonPropertyName("@vocab")] string Vocab, - [property: JsonPropertyName("@base")] string Base -); - -public record Datum( - [property: JsonPropertyName("@id")] string _Id, - [property: JsonPropertyName("@type")] string Type, - [property: JsonPropertyName("registration")] string Registration, - [property: JsonPropertyName("id")] string Id, - [property: JsonPropertyName("version")] string Version, - [property: JsonPropertyName("description")] string Description, - [property: JsonPropertyName("summary")] string Summary, - [property: JsonPropertyName("title")] string Title, - [property: JsonPropertyName("iconUrl")] string IconUrl, - [property: JsonPropertyName("licenseUrl")] string LicenseUrl, - [property: JsonPropertyName("projectUrl")] string ProjectUrl, - [property: JsonPropertyName("tags")] IReadOnlyList Tags, - [property: JsonPropertyName("authors")] IReadOnlyList Authors, - [property: JsonPropertyName("owners")] IReadOnlyList Owners, - [property: JsonPropertyName("totalDownloads")] int TotalDownloads, - [property: JsonPropertyName("verified")] bool Verified, - [property: JsonPropertyName("packageTypes")] IReadOnlyList PackageTypes, - [property: JsonPropertyName("versions")] IReadOnlyList Versions, - [property: JsonPropertyName("vulnerabilities")] IReadOnlyList Vulnerabilities -); - -public record PackageType( - [property: JsonPropertyName("name")] string Name -); - -public record VersionRecord( - [property: JsonPropertyName("version")] string Version, - [property: JsonPropertyName("downloads")] int Downloads, - [property: JsonPropertyName("@id")] string Id -); - -