예제 #1
0
        public async Task <IActionResult> UpdateIntegration(int id, [FromBody] Integration integration)
        {
            if (integration.IsEnabled)
            {
                switch (integration.Name)
                {
                case "Youtube":
                    if (!youtubeService.IsConfigured())
                    {
                        return(UnprocessableEntity($"Please configure Youtube integration first."));
                    }

                    break;

                case "Twitch":
                    if (!twitchService.IsConfigured())
                    {
                        return(UnprocessableEntity($"Please configure Twitch integration first."));
                    }

                    break;
                }
            }

            await integrationService.UpdateIntegration(id, integration);

            return(NoContent());
        }
예제 #2
0
        public IActionResult Index()
        {
            if ((youtubeService.IsEnabled().Result&& !youtubeService.IsConfigured()) ||
                (twitchService.IsEnabled().Result&& !twitchService.IsConfigured()))
            {
                return(RedirectToAction("Index", "Configuration"));
            }

            return(RedirectToAction("Dashboard"));
        }
예제 #3
0
        public async Task <IActionResult> Index()
        {
            if ((youtubeService.IsEnabled().Result&& !youtubeService.IsConfigured()) ||
                (twitchService.IsEnabled().Result&& !twitchService.IsConfigured()))
            {
                return(RedirectToAction("Index", "Configuration"));
            }

            await youtubeService.PurgeData();

            return(RedirectToAction("Dashboard"));
        }
예제 #4
0
        public async Task <IActionResult> Authorize()
        {
            if (!youtubeService.IsConfigured())
            {
                return(RedirectToAction("Youtube", "Configuration"));
            }

            var clientId = await configurationService.GetValue("Authentication:Google:ClientId");

            var redirectUrl  = WebUtility.UrlEncode(Url.Action("Callback", "Youtube", null, Request.Scheme, null));
            var oauthRequest =
                $"https://accounts.google.com/o/oauth2/auth?client_id={clientId}&redirect_uri={redirectUrl}&scope=https://www.googleapis.com/auth/youtube&response_type=code&access_type=offline&prompt=consent";

            return(Redirect(oauthRequest));
        }