public async Task <IActionResult> Index(long repositoryId, CancellationToken cancellationToken) { try { var loadRepoTask = gitHubManager.LoadInstallation(repositoryId, cancellationToken); var authedTask = gitHubManager.CheckAuthorization(repositoryId, Request.Cookies, cancellationToken); await loadRepoTask.ConfigureAwait(false); ViewBag.ConfiguredDme = await databaseContext.InstallationRepositories.Where(x => x.Id == repositoryId).Select(x => x.TargetDme).ToAsyncEnumerable().First(cancellationToken).ConfigureAwait(false); var authLevel = await authedTask.ConfigureAwait(false); ViewBag.SignIn = stringLocalizer[authLevel == AuthenticationLevel.LoggedOut ? "Sign-In with GitHub" : "Log Out"]; if (authLevel == AuthenticationLevel.LoggedOut) { ViewBag.SignInHref = gitHubManager.GetAuthorizationURL(new Uri(String.Concat(generalConfiguration.ApplicationPrefix, '/', Route, '/', nameof(Authorize))), repositoryId.ToString(CultureInfo.InvariantCulture)); } else { ViewBag.SignInHref = Url.Action(nameof(SignOut), new { repositoryId }); } ViewBag.AuthLevel = authLevel; ViewBag.Title = stringLocalizer["DME Configuration"]; ViewBag.HideLogin = false; ViewBag.EditHeader = stringLocalizer["Set the path to the .dme MapDiffBot should use for rendering"]; ViewBag.AutoDme = stringLocalizer["Auto-Detect"]; ViewBag.Submit = stringLocalizer["Submit"]; ViewBag.OnlyMemes = stringLocalizer["Only maintainers can perform this action!"]; return(View()); } catch { return(NotFound()); } }