Example #1
0
        protected void SiteRepeater_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            StreamingLiveLib.Site s          = (StreamingLiveLib.Site)e.Item.DataItem;
            LinkButton            AccessLink = (LinkButton)e.Item.FindControl("AccessLink");

            AccessLink.CommandArgument = s.Id.ToString();
        }
Example #2
0
        public void OnGetSelect()
        {
            int     id = Convert.ToInt32(Request.Query["id"]);
            AppUser au = AppUser.Current;

            StreamingLiveLib.Site site = au.Sites.GetById(id);
            AppUser.CurrentSite = site;
            //AppUser.Current= au;
        }
Example #3
0
        public IActionResult OnGetAccess()
        {
            int     id = Convert.ToInt32(Request.Query["id"]);
            AppUser au = AppUser.Current;

            StreamingLiveLib.Site site = StreamingLiveLib.Site.Load(id);
            au.Sites.Add(site);
            AppUser.CurrentSite = site;
            au.Role             = new StreamingLiveLib.Role()
            {
                Name = "admin", SiteId = id, UserId = AppUser.Current.UserData.Id
            };
            AppUser.Current = au;
            return(Redirect("/cp/"));
        }
        public IActionResult OnPostRegister()
        {
            if (ModelState.IsValid)
            {
                string[] errors = Validate();
                if (errors.Length == 0)
                {
                    string webRoot = CachedData.Environment.WebRootPath;

                    StreamingLiveLib.Site s = new StreamingLiveLib.Site()
                    {
                        KeyName = KeyName.ToLower().Trim(), PrimaryColor = "#24b9ff", ContrastColor = "#ffffff", HeaderColor = "#24b9ff", HomePageUrl = "/", LogoUrl = "/data/master/logo.png", RegistrationDate = DateTime.UtcNow
                    };
                    s.Save();

                    StreamingLiveLib.User u = new StreamingLiveLib.User()
                    {
                        Email = Email.ToLower().Trim(), Password = StreamingLiveLib.User.HashPassword(Password.Trim()), DisplayName = "Admin"
                    };
                    u.ResetGuid = Guid.NewGuid().ToString();
                    u.Save();

                    StreamingLiveLib.Role r = new StreamingLiveLib.Role()
                    {
                        Name = "admin", SiteId = s.Id, UserId = u.Id
                    };
                    r.Save();


                    new StreamingLiveLib.Button()
                    {
                        SiteId = s.Id, Sort = 1, Text = "Resources", Url = "about:blank"
                    }.Save();
                    new StreamingLiveLib.Button()
                    {
                        SiteId = s.Id, Sort = 2, Text = "Give", Url = "about:blank"
                    }.Save();

                    new StreamingLiveLib.Tab()
                    {
                        SiteId = s.Id, Sort = 1, TabType = "chat", TabData = "", Icon = "far fa-comment", Text = "Chat", Url = ""
                    }.Save();
                    new StreamingLiveLib.Tab()
                    {
                        SiteId = s.Id, Sort = 2, TabType = "url", TabData = "", Icon = "fas fa-bible", Text = "Bible", Url = "https://www.bible.com/en-GB/bible/111/GEN.1.NIV"
                    }.Save();
                    new StreamingLiveLib.Tab()
                    {
                        SiteId = s.Id, Sort = 3, TabType = "prayer", TabData = "", Icon = "fas fa-praying-hands", Text = "Prayer", Url = ""
                    }.Save();

                    DateTime serviceTime = new DateTime(DateTime.Today.Year, DateTime.Today.Month, DateTime.Today.Day, 9 + 5, 0, 0).AddDays(1);
                    while (serviceTime.DayOfWeek != DayOfWeek.Sunday)
                    {
                        serviceTime = serviceTime.AddDays(1);
                    }
                    new StreamingLiveLib.Service()
                    {
                        SiteId = s.Id, ChatAfter = 15 * 60, ChatBefore = 15 * 60, Duration = 60 * 60, EarlyStart = 5 * 60, Provider = "youtube_watchparty", ProviderKey = "zFOfmAHFKNw", VideoUrl = "https://www.youtube.com/embed/zFOfmAHFKNw?autoplay=1&controls=0&showinfo=0&rel=0&modestbranding=1&disablekb=1", ServiceTime = serviceTime, TimezoneOffset = 300, Recurring = false
                    }.Save();


                    Utils.CopyS3(S3Client, "data/master/data.json", $"data/{s.KeyName}/data.json");
                    Utils.CopyS3(S3Client, "data/master/data.css", $"data/{s.KeyName}/data.css");

                    try
                    {
                        string body = "<a href=\"https://" + s.KeyName + ".streaminglive.church/\">https://" + s.KeyName + ".streaminglive.church/</a> - " + u.Email;
                        //StreamingLiveLib.Aws.EmailHelper.SendEmail(CachedData.SupportEmail, CachedData.SupportEmail, "New StreamingLive.church Registration", body);
                    }
                    catch { }



                    AppUser.Login(u);

                    var claims   = new[] { new Claim(ClaimTypes.Name, u.ResetGuid), new Claim(ClaimTypes.Role, "User") };
                    var identity = new ClaimsIdentity(claims, CookieAuthenticationDefaults.AuthenticationScheme);
                    HttpContext.SignInAsync(CookieAuthenticationDefaults.AuthenticationScheme, new ClaimsPrincipal(identity));
                    return(Redirect("/cp/"));
                }
                else
                {
                    OutputMessage = Utils.FormatMessage("<b>Error:</b><ul><li>" + String.Join("</li><li>", errors) + "</li></ul>", true);
                    return(Page());
                }
            }
            else
            {
                return(Page());
            }
        }
 public void OnGet()
 {
     StreamingLiveLib.Site site = StreamingLiveLib.Site.LoadByKeyName(Request.Query["key"]);
     Output = site.LoadJson();
     Response.ContentType = "application/json";
 }
 public void OnGet()
 {
     StreamingLiveLib.Site site = StreamingLiveLib.Site.LoadByKeyName(Request.Query["key"]);
     Output = site.GetCss();
     Response.ContentType = "text/css";
 }
Example #7
0
 protected void Page_Load(object sender, EventArgs e)
 {
     StreamingLiveLib.Site site = StreamingLiveLib.Site.LoadByKeyName(Request["key"]);
     OutputLit.Text       = site.LoadJson();
     Response.ContentType = "application/json";
 }
Example #8
0
 protected void Page_Load(object sender, EventArgs e)
 {
     StreamingLiveLib.Site site = StreamingLiveLib.Site.LoadByKeyName(Request["key"]);
     OutputLit.Text       = site.GetCss();
     Response.ContentType = "text/css";
 }
Example #9
0
        private void MigrateSite(StreamingLiveLib.Site site)
        {
            if (site.KeyName == "localhost3")
            {
                return;
            }
            string  jsonData = StreamingLiveLib.Utils.GetJson(CachedData.BaseUrl + "/data/" + site.KeyName + "/preview.json");
            JObject data     = JObject.Parse(jsonData);

            JObject colors = (JObject)data["colors"];

            site.ContrastColor = colors["contrast"].ToString();
            site.PrimaryColor  = colors["primary"].ToString();
            site.HeaderColor   = colors["header"].ToString();

            JObject logo = (JObject)data["logo"];

            site.HomePageUrl = logo["url"].ToString();
            site.LogoUrl     = logo["image"].ToString();

            site.Save();

            int    i       = 1;
            JArray buttons = (JArray)data["buttons"];

            foreach (JObject b in buttons)
            {
                new StreamingLiveLib.Button()
                {
                    SiteId = site.Id, Sort = i, Text = b["text"].ToString(), Url = b["url"].ToString()
                }.Save();
                i++;
            }

            i = 1;
            JArray tabs = (JArray)data["tabs"];

            foreach (JObject t in tabs)
            {
                new StreamingLiveLib.Tab()
                {
                    SiteId = site.Id, Sort = i, Icon = Convert.ToString(t["icon"]), TabData = Convert.ToString(t["data"]), TabType = Convert.ToString(t["type"]), Text = Convert.ToString(t["text"]), Url = Convert.ToString(t["text"])
                }.Save();
                i++;
            }

            i = 1;
            JArray services = (JArray)data["services"];

            foreach (JObject s in services)
            {
                DateTime serviceTime = DateTime.MinValue;
                DateTime.TryParse(Convert.ToString(s["serviceTime"]), out serviceTime);

                StreamingLiveLib.Service service = new StreamingLiveLib.Service()
                {
                    SiteId      = site.Id,
                    ChatAfter   = StreamingLiveLib.Utils.GetTotalSeconds(Convert.ToString(s["chatAfter"])),
                    ChatBefore  = StreamingLiveLib.Utils.GetTotalSeconds(Convert.ToString(s["chatBefore"])),
                    Duration    = StreamingLiveLib.Utils.GetTotalSeconds(Convert.ToString(s["duration"])),
                    EarlyStart  = StreamingLiveLib.Utils.GetTotalSeconds(Convert.ToString(s["earlyStart"])),
                    Provider    = Convert.ToString(s["provider"]),
                    ProviderKey = Convert.ToString(s["providerKey"]),
                    VideoUrl    = Convert.ToString(s["videoUrl"]),
                    ServiceTime = serviceTime
                };

                if (service.ServiceTime > DateTime.Today)
                {
                    service.Save();
                }
                i++;
            }
        }