using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Caching.Memory; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using Shared; using Shared.Engine; using Shared.Models.Events; using System; using System.Collections.Generic; using System.IO.Compression; using System.Linq; using System.Security.Cryptography; using System.Text; using System.Text.RegularExpressions; using System.Web; using IO = System.IO; namespace Lampac.Controllers { public class LampaWebController : BaseController { [HttpGet] [AllowAnonymous] [Route("/personal.lampa")] [Route("/lampa-main/personal.lampa")] [Route("/{myfolder}/personal.lampa")] public ActionResult PersonalLampa(string myfolder) => StatusCode(200); #region Index [HttpGet] [AllowAnonymous] [Route("/")] public ActionResult Index() { if (string.IsNullOrWhiteSpace(AppInit.conf.LampaWeb.index)) return Content("api work", contentType: "text/plain; charset=utf-8"); if (AppInit.conf.LampaWeb.basetag && Regex.IsMatch(AppInit.conf.LampaWeb.index, "/[^\\./]+\\.html$")) { if (!memoryCache.TryGetValue($"LampaWeb.index:{AppInit.conf.LampaWeb.index}", out string html)) { html = IO.File.ReadAllText($"wwwroot/{AppInit.conf.LampaWeb.index}"); html = html.Replace("", $""); memoryCache.Set($"LampaWeb.index:{AppInit.conf.LampaWeb.index}", html, DateTime.Now.AddMinutes(1)); } return Content(html, contentType: "text/html; charset=utf-8"); } return LocalRedirect($"/{AppInit.conf.LampaWeb.index}"); } #endregion #region Extensions [HttpGet] [AllowAnonymous] [Route("/extensions")] public ActionResult Extensions() { return ContentTo(FileCache.ReadAllText("plugins/extensions.json").Replace("{localhost}", host).Replace("\n", "").Replace("\r", "")); } #endregion #region testaccsdb [HttpGet] [HttpPost] [Route("/testaccsdb")] public ActionResult TestAccsdb(string account_email, string uid) { if (!string.IsNullOrEmpty(AppInit.conf.accsdb.shared_passwd) && uid == AppInit.conf.accsdb.shared_passwd) return ContentTo("{\"accsdb\": true, \"newuid\": true}"); if (!string.IsNullOrEmpty(uid) && !string.IsNullOrEmpty(account_email) && account_email == AppInit.conf.accsdb.shared_passwd) { try { string file = "users.json"; JArray arr = new JArray(); if (IO.File.Exists(file)) { var txt = IO.File.ReadAllText(file); if (!string.IsNullOrWhiteSpace(txt)) try { arr = JArray.Parse(txt); } catch { arr = new JArray(); } } bool exists = arr.Children().Any(o => (o.Value("id") != null && o.Value("id").Equals(uid, StringComparison.OrdinalIgnoreCase)) || (o["ids"] != null && o["ids"].Any(t => t.ToString().Equals(uid, StringComparison.OrdinalIgnoreCase))) ); if (exists) return ContentTo("{\"accsdb\": false}"); var obj = new JObject(); obj["id"] = uid; obj["expires"] = DateTime.Now.AddDays(Math.Max(1, AppInit.conf.accsdb.shared_daytime)); arr.Add(obj); IO.File.WriteAllText(file, arr.ToString(Formatting.Indented)); return ContentTo("{\"accsdb\": false, \"success\": true, \"uid\": \"" + uid + "\"}"); } catch { return ContentTo("{\"accsdb\": true}"); } } return ContentTo("{\"accsdb\": false, \"success\": true}"); } #endregion #region app.min.js [HttpGet] [AllowAnonymous] [Route("/app.min.js")] [Route("{type}/app.min.js")] public ContentResult LampaApp(string type) { if (string.IsNullOrEmpty(type)) { if (AppInit.conf.LampaWeb.path != null) { type = AppInit.conf.LampaWeb.path; } else { if (AppInit.conf.LampaWeb.index == null || !AppInit.conf.LampaWeb.index.Contains("/")) return Content(string.Empty, "application/javascript; charset=utf-8"); type = AppInit.conf.LampaWeb.index.Split("/")[0]; } } else { type = Regex.Replace(type, "[^a-z0-9\\-]", "", RegexOptions.IgnoreCase); } bool usecubproxy = AppInit.conf.cub.enabled(requestInfo.Country); var apr = AppInit.conf.LampaWeb.appReplace ?? InvkEvent.conf?.Controller?.AppReplace?.appjs?.regex; string memKey = $"ApiController:{type}:{host}:{usecubproxy}:{apr?.Count ?? 0}:app.min.js"; if (!memoryCache.TryGetValue(memKey, out string file)) { file = IO.File.ReadAllText($"wwwroot/{type}/app.min.js"); #region appReplace if (apr != null) { foreach (var r in apr) { string val = r.Value; if (val.StartsWith("file:")) val = IO.File.ReadAllText(val.Substring(5)); val = val.Replace("{localhost}", host).Replace("{host}", Regex.Replace(host, "^https?://", "")); file = Regex.Replace(file, r.Key, val, RegexOptions.IgnoreCase); } } if (InvkEvent.conf?.Controller?.AppReplace?.appjs?.list != null) { foreach (var r in InvkEvent.conf.Controller.AppReplace.appjs.list) { string val = r.Value; if (val.StartsWith("file:")) val = IO.File.ReadAllText(val.Substring(5)); val = val.Replace("{localhost}", host).Replace("{host}", Regex.Replace(host, "^https?://", "")); file = file.Replace(r.Key, val); } } #endregion string playerinner = FileCache.ReadAllText("plugins/player-inner.js", saveCache: false) .Replace("{useplayer}", (!string.IsNullOrEmpty(AppInit.conf.playerInner)).ToString().ToLower()) .Replace("{notUseTranscoding}", (AppInit.conf.transcoding.enable == false).ToString().ToLower()); var bulder = new StringBuilder(file); bulder = bulder.Replace("Player.play(element);", playerinner); if (usecubproxy) { bulder = bulder.Replace("protocol + mirror + '/api/checker'", $"'{host}/cub/api/checker'"); bulder = bulder.Replace("Utils$1.protocol() + 'tmdb.' + object$2.cub_domain + '/' + u,", $"'{host}/cub/tmdb./' + u,"); bulder = bulder.Replace("Utils$2.protocol() + 'tmdb.' + object$2.cub_domain + '/' + u,", $"'{host}/cub/tmdb./' + u,"); bulder = bulder.Replace("Utils$1.protocol() + object$2.cub_domain", $"'{host}/cub/red'"); bulder = bulder.Replace("Utils$2.protocol() + object$2.cub_domain", $"'{host}/cub/red'"); bulder = bulder.Replace("object$2.cub_domain", $"'{AppInit.conf.cub.mirror}'"); } bulder = bulder.Replace("http://lite.lampa.mx", $"{host}/{type}"); bulder = bulder.Replace("https://yumata.github.io/lampa-lite", $"{host}/{type}"); bulder = bulder.Replace("http://lampa.mx", $"{host}/{type}"); bulder = bulder.Replace("https://yumata.github.io/lampa", $"{host}/{type}"); bulder = bulder.Replace("window.lampa_settings.dcma = dcma;", "window.lampa_settings.fixdcma = true;"); bulder = bulder.Replace("Storage.get('vpn_checked_ready', 'false')", "true"); bulder = bulder.Replace("status$1 = false;", "status$1 = true;"); // local apk to personal.lampa bulder = bulder.Replace("return status$1;", "return true;"); // отключение рекламы bulder = bulder.Replace("if (!Storage.get('metric_uid', ''))", "return;"); // metric bulder = bulder.Replace("function log(data) {", "function log(data) { return;"); bulder = bulder.Replace("function stat$1(method, name) {", "function stat$1(method, name) { return;"); bulder = bulder.Replace("if (domain) {", "if (false) {"); bulder = bulder.Replace("{localhost}", host); file = bulder.ToString(); if (AppInit.conf.mikrotik == false) memoryCache.Set(memKey, file, DateTime.Now.AddMinutes(1)); } if (InvkEvent.conf?.Controller?.AppReplace?.appjs?.eval != null) file = InvkEvent.AppReplace("appjs", new EventAppReplace(file, null, type, host, requestInfo, HttpContext.Request, hybridCache)); return Content(file, "application/javascript; charset=utf-8"); } #endregion #region app.css [HttpGet] [AllowAnonymous] [Route("/css/app.css")] [Route("{type}/css/app.css")] public ContentResult LampaAppCss(string type) { if (string.IsNullOrEmpty(type)) { if (AppInit.conf.LampaWeb.path != null) { type = AppInit.conf.LampaWeb.path; } else { if (AppInit.conf.LampaWeb.index == null || !AppInit.conf.LampaWeb.index.Contains("/")) return Content(string.Empty, "application/javascript; charset=utf-8"); type = AppInit.conf.LampaWeb.index.Split("/")[0]; } } else { type = Regex.Replace(type, "[^a-z0-9\\-]", "", RegexOptions.IgnoreCase); } var apr = AppInit.conf.LampaWeb.cssReplace ?? InvkEvent.conf?.Controller?.AppReplace?.appcss?.regex; string memKey = $"ApiController:css/app.css:{type}:{host}:{apr?.Count ?? 0}"; if (!memoryCache.TryGetValue(memKey, out string css)) { css = IO.File.ReadAllText($"wwwroot/{type}/css/app.css"); #region appReplace if (apr != null) { foreach (var r in apr) { string val = r.Value; if (val.StartsWith("file:")) val = IO.File.ReadAllText(val.Substring(5)); val = val.Replace("{localhost}", host).Replace("{host}", Regex.Replace(host, "^https?://", "")); css = Regex.Replace(css, r.Key, val, RegexOptions.IgnoreCase); } } if (InvkEvent.conf?.Controller?.AppReplace?.appcss?.list != null) { foreach (var r in InvkEvent.conf.Controller.AppReplace.appcss.list) { string val = r.Value; if (val.StartsWith("file:")) val = IO.File.ReadAllText(val.Substring(5)); val = val.Replace("{localhost}", host).Replace("{host}", Regex.Replace(host, "^https?://", "")); css = css.Replace(r.Key, val); } } #endregion memoryCache.Set(memKey, css, DateTime.Now.AddMinutes(AppInit.conf.multiaccess ? 5 : 1)); } if (InvkEvent.conf?.Controller?.AppReplace?.appcss?.eval != null) css = InvkEvent.AppReplace("appcss", new EventAppReplace(css, null, type, host, requestInfo, HttpContext.Request, hybridCache)); return Content(css, "text/css; charset=utf-8"); } #endregion #region samsung.wgt [HttpGet] [AllowAnonymous] [Route("samsung.wgt")] public ActionResult SamsWgt(string overwritehost) { string folder = "data/widgets"; if (!IO.File.Exists($"{folder}/samsung/loader.js")) return Content(string.Empty); string wgt = $"{folder}/{CrypTo.md5(overwritehost ?? host + "v3")}.wgt"; if (IO.File.Exists(wgt)) return File(IO.File.OpenRead(wgt), "application/octet-stream"); string index = IO.File.ReadAllText($"{folder}/samsung/index.html"); IO.File.WriteAllText($"{folder}/samsung/publish/index.html", index.Replace("{localhost}", overwritehost ?? host)); string loader = IO.File.ReadAllText($"{folder}/samsung/loader.js"); IO.File.WriteAllText($"{folder}/samsung/publish/loader.js", loader.Replace("{localhost}", overwritehost ?? host)); string app = IO.File.ReadAllText($"{folder}/samsung/app.js"); IO.File.WriteAllText($"{folder}/samsung/publish/app.js", app.Replace("{localhost}", overwritehost ?? host)); IO.File.Copy($"{folder}/samsung/icon.png", $"{folder}/samsung/publish/icon.png", overwrite: true); IO.File.Copy($"{folder}/samsung/logo_appname_fg.png", $"{folder}/samsung/publish/logo_appname_fg.png", overwrite: true); IO.File.Copy($"{folder}/samsung/config.xml", $"{folder}/samsung/publish/config.xml", overwrite: true); string gethash(string file) { using (SHA512 sha = SHA512.Create()) { return Convert.ToBase64String(sha.ComputeHash(IO.File.ReadAllBytes(file))); //digestValue = hash.Remove(76) + "\n" + hash.Remove(0, 76); } } string indexhashsha512 = gethash($"{folder}/samsung/publish/index.html"); string loaderhashsha512 = gethash($"{folder}/samsung/publish/loader.js"); string apphashsha512 = gethash($"{folder}/samsung/publish/app.js"); string confighashsha512 = gethash($"{folder}/samsung/publish/config.xml"); string iconhashsha512 = gethash($"{folder}/samsung/publish/icon.png"); string logohashsha512 = gethash($"{folder}/samsung/publish/logo_appname_fg.png"); string author_sigxml = IO.File.ReadAllText($"{folder}/samsung/author-signature.xml"); author_sigxml = author_sigxml.Replace("loaderhashsha512", loaderhashsha512).Replace("apphashsha512", apphashsha512) .Replace("iconhashsha512", iconhashsha512).Replace("logohashsha512", logohashsha512) .Replace("confighashsha512", confighashsha512) .Replace("indexhashsha512", indexhashsha512); IO.File.WriteAllText($"{folder}/samsung/publish/author-signature.xml", author_sigxml); string authorsignaturehashsha512 = gethash($"{folder}/samsung/publish/author-signature.xml"); string sigxml1 = IO.File.ReadAllText($"{folder}/samsung/signature1.xml"); sigxml1 = sigxml1.Replace("loaderhashsha512", loaderhashsha512).Replace("apphashsha512", apphashsha512) .Replace("confighashsha512", confighashsha512).Replace("authorsignaturehashsha512", authorsignaturehashsha512) .Replace("iconhashsha512", iconhashsha512).Replace("logohashsha512", logohashsha512).Replace("indexhashsha512", indexhashsha512); IO.File.WriteAllText($"{folder}/samsung/publish/signature1.xml", sigxml1); ZipFile.CreateFromDirectory($"{folder}/samsung/publish/", wgt); return File(IO.File.OpenRead(wgt), "application/octet-stream"); } #endregion #region MSX [HttpGet] [AllowAnonymous] [Route("msx/start.json")] public ActionResult MSX() { return Content(FileCache.ReadAllText("msx.json").Replace("{localhost}", host), "application/json; charset=utf-8"); } #endregion #region startpage.js [HttpGet] [AllowAnonymous] [Route("startpage.js")] public ActionResult StartPage() { return Content(FileCache.ReadAllText("plugins/startpage.js").Replace("{localhost}", host), "application/javascript; charset=utf-8"); } #endregion #region lampainit.js [HttpGet] [AllowAnonymous] [Route("lampainit.js")] public ActionResult LamInit(bool lite) { string initiale = string.Empty; var sb = new StringBuilder(FileCache.ReadAllText($"plugins/{(lite ? "liteinit" : "lampainit")}.js")); if (AppInit.modules != null) { if (lite) { if (AppInit.conf.LampaWeb.initPlugins.online && AppInit.modules.FirstOrDefault(i => i.dll == "Online.dll" && i.enable) != null) initiale += "\"{localhost}/lite.js\","; if (AppInit.conf.LampaWeb.initPlugins.sisi && AppInit.modules.FirstOrDefault(i => i.dll == "SISI.dll" && i.enable) != null) initiale += "\"{localhost}/sisi.js?lite=true\","; if (AppInit.conf.LampaWeb.initPlugins.sync) initiale += "\"{localhost}/sync.js?lite=true\","; } else { if (AppInit.conf.LampaWeb.initPlugins.dlna && AppInit.modules.FirstOrDefault(i => i.dll == "DLNA.dll" && i.enable) != null) initiale += "{\"url\": \"{localhost}/dlna.js\",\"status\": 1,\"name\": \"DLNA\",\"author\": \"lampac\"},"; if (AppInit.modules.FirstOrDefault(i => i.dll == "Tracks.dll" && i.enable) != null) { if (AppInit.conf.LampaWeb.initPlugins.tracks) initiale += "{\"url\": \"{localhost}/tracks.js\",\"status\": 1,\"name\": \"Tracks.js\",\"author\": \"lampac\"},"; if (AppInit.conf.LampaWeb.initPlugins.transcoding && AppInit.conf.transcoding.enable) initiale += "{\"url\": \"{localhost}/transcoding.js\",\"status\": 1,\"name\": \"Transcoding video\",\"author\": \"lampac\"},"; } if (AppInit.conf.LampaWeb.initPlugins.tmdbProxy) initiale += "{\"url\": \"{localhost}/tmdbproxy.js\",\"status\": 1,\"name\": \"TMDB Proxy\",\"author\": \"lampac\"},"; if (AppInit.conf.LampaWeb.initPlugins.online && AppInit.modules.FirstOrDefault(i => i.dll == "Online.dll" && i.enable) != null) initiale += "{\"url\": \"{localhost}/online.js\",\"status\": 1,\"name\": \"Онлайн\",\"author\": \"lampac\"},"; if (AppInit.conf.LampaWeb.initPlugins.catalog && AppInit.modules.FirstOrDefault(i => i.dll == "Catalog.dll" && i.enable) != null) initiale += "{\"url\": \"{localhost}/catalog.js\",\"status\": 1,\"name\": \"Альтернативные источники каталога\",\"author\": \"lampac\"},"; if (AppInit.conf.LampaWeb.initPlugins.sisi && AppInit.modules.FirstOrDefault(i => i.dll == "SISI.dll" && i.enable) != null) { initiale += "{\"url\": \"{localhost}/sisi.js\",\"status\": 1,\"name\": \"Клубничка\",\"author\": \"lampac\"},"; initiale += "{\"url\": \"{localhost}/startpage.js\",\"status\": 1,\"name\": \"Стартовая страница\",\"author\": \"lampac\"},"; } if (AppInit.conf.LampaWeb.initPlugins.sync) initiale += "{\"url\": \"{localhost}/sync.js\",\"status\": 1,\"name\": \"Синхронизация\",\"author\": \"lampac\"},"; if (AppInit.conf.LampaWeb.initPlugins.timecode) initiale += "{\"url\": \"{localhost}/timecode.js\",\"status\": 1,\"name\": \"Синхронизация тайм-кодов\",\"author\": \"lampac\"},"; if (AppInit.conf.LampaWeb.initPlugins.bookmark) initiale += "{\"url\": \"{localhost}/bookmark.js\",\"status\": 1,\"name\": \"Синхронизация закладок\",\"author\": \"lampac\"},"; if (AppInit.conf.LampaWeb.initPlugins.torrserver && AppInit.modules.FirstOrDefault(i => i.dll == "TorrServer.dll" && i.enable) != null) initiale += "{\"url\": \"{localhost}/ts.js\",\"status\": 1,\"name\": \"TorrServer\",\"author\": \"lampac\"},"; if (AppInit.conf.LampaWeb.initPlugins.backup) initiale += "{\"url\": \"{localhost}/backup.js\",\"status\": 1,\"name\": \"Backup\",\"author\": \"lampac\"},"; if (AppInit.conf.pirate_store) sb = sb.Replace("{pirate_store}", FileCache.ReadAllText("plugins/pirate_store.js")); if (AppInit.conf.accsdb.enable || (!requestInfo.IsLocalIp && !AppInit.conf.WAF.allowExternalIpAccess)) sb = sb.Replace("{deny}", FileCache.ReadAllText("plugins/deny.js").Replace("{cubMesage}", AppInit.conf.accsdb.authMesage)); } } sb = sb.Replace("{lampainit-invc}", FileCache.ReadAllText("plugins/lampainit-invc.js")); sb = sb.Replace("{initiale}", Regex.Replace(initiale, ",$", "")); sb = sb.Replace("{country}", requestInfo.Country); sb = sb.Replace("{localhost}", host); sb = sb.Replace("{deny}", string.Empty); sb = sb.Replace("{pirate_store}", string.Empty); sb = sb.Replace("{ major: 0, minor: 0 }", $"{{major: {appversion}, minor: {minorversion}}}"); if (AppInit.modules != null && AppInit.modules.FirstOrDefault(i => i.dll == "JacRed.dll" && i.enable) != null) sb = sb.Replace("{jachost}", Regex.Replace(host, "^https?://", "")); else sb = sb.Replace("{jachost}", "redapi.apn.monster"); #region full_btn_priority_hash string online_version = Regex.Match(FileCache.ReadAllText("plugins/online.js"), "version: '([^']+)'").Groups[1].Value; string LampaUtilshash(string input) { if (!AppInit.conf.online.version) input = input.Replace($"v{online_version}", ""); string str = (input ?? string.Empty); int hash = 0; if (str.Length == 0) return hash.ToString(); for (int i = 0; i < str.Length; i++) { int _char = str[i]; hash = (hash << 5) - hash + _char; hash = hash & hash; // Преобразование в 32-битное целое число } return Math.Abs(hash).ToString(); } string full_btn_priority_hash = LampaUtilshash($"
\n \n \n \n \n \n \n\n Онлайн\n
"); sb = sb.Replace("{full_btn_priority_hash}", full_btn_priority_hash) .Replace("{btn_priority_forced}", AppInit.conf.online.btn_priority_forced.ToString().ToLower()); #endregion #region domain token if (!string.IsNullOrEmpty(AppInit.conf.accsdb.domainId_pattern)) { string token = Regex.Match(HttpContext.Request.Host.Host, AppInit.conf.accsdb.domainId_pattern).Groups[1].Value; sb = sb.Replace("{token}", token); } else { sb = sb.Replace("{token}", string.Empty); } #endregion return Content(sb.ToString(), "application/javascript; charset=utf-8"); } #endregion #region on.js [HttpGet] [AllowAnonymous] [Route("on.js")] [Route("on/js/{token}")] [Route("on/h/{token}")] [Route("on/{token}")] public ActionResult LamOnInit(string token, bool adult = true) { if (adult && HttpContext.Request.Path.Value.StartsWith("/on/h/")) adult = false; var plugins = new List(10); var sb = new StringBuilder(FileCache.ReadAllText("plugins/on.js")); if (AppInit.modules != null) { void send(string name, bool worktoken) { if (worktoken && !string.IsNullOrEmpty(token)) { plugins.Add($"\"{{localhost}}/{name}/js/{HttpUtility.UrlEncode(token)}\""); } else { plugins.Add($"\"{{localhost}}/{name}.js\""); } } if (AppInit.conf.LampaWeb.initPlugins.dlna && AppInit.modules.FirstOrDefault(i => i.dll == "DLNA.dll" && i.enable) != null) send("dlna", true); if (AppInit.modules.FirstOrDefault(i => i.dll == "Tracks.dll" && i.enable) != null) { if (AppInit.conf.LampaWeb.initPlugins.tracks) send("tracks", true); if (AppInit.conf.LampaWeb.initPlugins.transcoding && AppInit.conf.transcoding.enable) send("transcoding", true); } if (AppInit.conf.LampaWeb.initPlugins.tmdbProxy) send("tmdbproxy", true); if (AppInit.conf.LampaWeb.initPlugins.online && AppInit.modules.FirstOrDefault(i => i.dll == "Online.dll" && i.enable) != null) send("online", true); if (adult) { if (AppInit.conf.LampaWeb.initPlugins.sisi && AppInit.modules.FirstOrDefault(i => i.dll == "SISI.dll" && i.enable) != null) { send("sisi", true); send("startpage", false); } } if (AppInit.conf.LampaWeb.initPlugins.sync) send("sync", true); if (AppInit.conf.LampaWeb.initPlugins.timecode) send("timecode", true); if (AppInit.conf.LampaWeb.initPlugins.bookmark) send("bookmark", true); if (AppInit.conf.LampaWeb.initPlugins.torrserver && AppInit.modules.FirstOrDefault(i => i.dll == "TorrServer.dll" && i.enable) != null) send("ts", true); if (AppInit.conf.LampaWeb.initPlugins.backup) send("backup", true); } if (plugins.Count == 0) sb = sb.Replace("{plugins}", string.Empty); else { sb = sb.Replace("{plugins}", string.Join(",", plugins)); } sb = sb.Replace("{country}", requestInfo.Country) .Replace("{localhost}", host); return Content(sb.ToString(), "application/javascript; charset=utf-8"); } #endregion #region privateinit.js [HttpGet] [Route("privateinit.js")] public ActionResult PrivateInit() { var user = requestInfo.user; if (user == null || user.ban || DateTime.UtcNow > user.expires) return Content(string.Empty, "application/javascript; charset=utf-8"); var sb = new StringBuilder(FileCache.ReadAllText("plugins/privateinit.js")); sb = sb.Replace("{country}", requestInfo.Country) .Replace("{localhost}", host); if (AppInit.modules != null && AppInit.modules.FirstOrDefault(i => i.dll == "JacRed.dll" && i.enable) != null) sb = sb.Replace("{jachost}", Regex.Replace(host, "^https?://", "")); else sb = sb.Replace("{jachost}", "redapi.apn.monster"); return Content(sb.ToString(), "application/javascript; charset=utf-8"); } #endregion } }