diff --git a/src/Jackett/Content/custom.js b/src/Jackett/Content/custom.js index eff65bf43..f9caa22c2 100644 --- a/src/Jackett/Content/custom.js +++ b/src/Jackett/Content/custom.js @@ -63,6 +63,11 @@ function loadJackettSettings() { $("#logoutBtn").show(); } + $.each(data.config.notices, function (index, value) { + console.log(value); + doNotify(value, "danger", "glyphicon glyphicon-alert", false); + }) + reloadIndexers(); }); } @@ -570,12 +575,21 @@ function resolveUrl(url) { return url; } -function doNotify(message, type, icon) { +function doNotify(message, type, icon, autoHide) { + if (typeof autoHide === "undefined" || autoHide === null) + autoHide = true; + + var delay = 5000; + if (!autoHide) + delay = -1; + $.notify({ message: message, icon: icon }, { element: 'body', + autoHide: autoHide, + delay: delay, type: type, allow_dismiss: true, z_index: 9000, diff --git a/src/Jackett/Controllers/AdminController.cs b/src/Jackett/Controllers/AdminController.cs index 20b45a13a..020b8cfb0 100644 --- a/src/Jackett/Controllers/AdminController.cs +++ b/src/Jackett/Controllers/AdminController.cs @@ -319,6 +319,7 @@ namespace Jackett.Controllers try { var cfg = new JObject(); + cfg["notices"] = JToken.FromObject(serverService.notices); cfg["port"] = serverService.Config.Port; cfg["external"] = serverService.Config.AllowExternal; cfg["api_key"] = serverService.Config.APIKey; diff --git a/src/Jackett/Services/ServerService.cs b/src/Jackett/Services/ServerService.cs index 4a4f7b97f..c8ee97203 100644 --- a/src/Jackett/Services/ServerService.cs +++ b/src/Jackett/Services/ServerService.cs @@ -39,6 +39,7 @@ namespace Jackett.Services void SaveConfig(); Uri ConvertToProxyLink(Uri link, string serverUrl, string indexerId, string action = "dl", string file = "t.torrent"); string BasePath(); + List notices { get; } } public class ServerService : IServerService @@ -54,6 +55,7 @@ namespace Jackett.Services private Logger logger; private IWebClient client; private IUpdateService updater; + private List _notices = new List(); public ServerService(IIndexerManagerService i, IProcessService p, ISerializeService s, IConfigurationService c, Logger l, IWebClient w, IUpdateService u) { @@ -71,8 +73,16 @@ namespace Jackett.Services public ServerConfig Config { get { return config; } - } - + } + + public List notices + { + get + { + return _notices; + } + } + public Uri ConvertToProxyLink(Uri link, string serverUrl, string indexerId, string action = "dl", string file = "t.torrent") { if (link == null || (link.IsAbsoluteUri && link.Scheme == "magnet")) @@ -207,7 +217,9 @@ namespace Jackett.Services } else if (monoVersionO.Major == 4 && monoVersionO.Minor == 2) { - logger.Error("mono version 4.2.* is known to cause problems with Jackett. If you experience any problems please try updating to the latest mono version from http://www.mono-project.com/download/ first."); + var notice = "mono version 4.2.* is known to cause problems with Jackett. If you experience any problems please try updating to the latest mono version from http://www.mono-project.com/download/ first."; + _notices.Add(notice); + logger.Error(notice); } try @@ -217,7 +229,9 @@ namespace Jackett.Services var mono_devel_file = Path.Combine(runtimedir, "mono-api-info.exe"); if (!File.Exists(mono_devel_file)) { - logger.Error("It looks like the mono-devel package is not installed, please make sure it's installed to avoid crashes."); + var notice = "It looks like the mono-devel package is not installed, please make sure it's installed to avoid crashes."; + _notices.Add(notice); + logger.Error(notice); } } catch (Exception e) @@ -233,7 +247,9 @@ namespace Jackett.Services { if (monoVersionO.Major >= 4 && monoVersionO.Minor >= 8) { - logger.Error("The ca-certificates-mono package is not installed, HTTPS trackers won't work. Please install it."); + var notice = "The ca-certificates-mono package is not installed, HTTPS trackers won't work. Please install it."; + _notices.Add(notice); + logger.Error(notice); } else { @@ -263,6 +279,10 @@ namespace Jackett.Services { logger.Error("Error while getting environment details: " + e); } + var notice1 = "The ca-certificates-mono package is not installed, HTTPS trackers won't work. Please install it."; + _notices.Add(notice1); + var notice2 = "The ca-certificates-mono package is not installed, HTTPS trackers won't work. Please install it2."; + _notices.Add(notice2); CultureInfo.DefaultThreadCurrentCulture = new CultureInfo("en-US"); // Load indexers