Inform users that Mono is no longer needed

Note: Not enabled currently, will enable at a later date
This commit is contained in:
flightlevel
2019-04-27 20:59:33 +10:00
parent fad453cf0e
commit 0d4c8ba860
6 changed files with 59 additions and 3 deletions

View File

@@ -94,6 +94,10 @@ function loadJackettSettings() {
$("#logoutBtn").show(); $("#logoutBtn").show();
} }
if (data.can_run_netcore != null && data.can_run_netcore === true) {
$("#can-upgrade-from-mono").show();
}
$.each(data.notices, function (index, value) { $.each(data.notices, function (index, value) {
console.log(value); console.log(value);
doNotify(value, "danger", "glyphicon glyphicon-alert", false); doNotify(value, "danger", "glyphicon glyphicon-alert", false);

View File

@@ -51,6 +51,14 @@
<input id="api-key-input" class="form-control input-right" type="text" value="" placeholder="API Key" readonly=""> <input id="api-key-input" class="form-control input-right" type="text" value="" placeholder="API Key" readonly="">
</div> </div>
<hr /> <hr />
<div id="can-upgrade-from-mono" hidden class="alert alert-info" role="alert">
<strong>Standalone version of Jackett is now available - Mono not required</strong> <br>
To upgrade to the standalone version of Jackett, <a href="#" class="alert-link">click here</a> for install instructions.
Upgrading is straight forward, your indexers and configuration will carry over.
Benefits include: increased performance, improved stability and no dependency on Mono.
</div>
<div class="pull-right"> <div class="pull-right">
<button id="jackett-add-indexer" class="btn btn-success btn-sm"> <button id="jackett-add-indexer" class="btn btn-success btn-sm">
<span class="glyphicon glyphicon-plus" aria-hidden="true"></span> Add indexer <span class="glyphicon glyphicon-plus" aria-hidden="true"></span> Add indexer
@@ -671,6 +679,6 @@
</script> </script>
<script type="text/javascript" src="../libs/api.js?changed=2017083001"></script> <script type="text/javascript" src="../libs/api.js?changed=2017083001"></script>
<script type="text/javascript" src="../custom.js?changed=20190421"></script> <script type="text/javascript" src="../custom.js?changed=20190427"></script>
</body> </body>
</html> </html>

View File

@@ -33,6 +33,8 @@ namespace Jackett.Common.Models.DTO
public string omdburl { get; set; } public string omdburl { get; set; }
[DataMember] [DataMember]
public string app_version { get; set; } public string app_version { get; set; }
[DataMember]
public bool can_run_netcore { get; set; }
[DataMember] [DataMember]
public ProxyType proxy_type { get; set; } public ProxyType proxy_type { get; set; }
@@ -50,7 +52,7 @@ namespace Jackett.Common.Models.DTO
notices = new string[0]; notices = new string[0];
} }
public ServerConfig(IEnumerable<string> notices, Models.Config.ServerConfig config, string version) public ServerConfig(IEnumerable<string> notices, Models.Config.ServerConfig config, string version, bool canRunNetCore)
{ {
this.notices = notices; this.notices = notices;
port = config.Port; port = config.Port;
@@ -65,6 +67,7 @@ namespace Jackett.Common.Models.DTO
omdbkey = config.OmdbApiKey; omdbkey = config.OmdbApiKey;
omdburl = config.OmdbApiUrl; omdburl = config.OmdbApiUrl;
app_version = version; app_version = version;
can_run_netcore = canRunNetCore;
proxy_type = config.ProxyType; proxy_type = config.ProxyType;
proxy_url = config.ProxyUrl; proxy_url = config.ProxyUrl;

View File

@@ -16,5 +16,6 @@ namespace Jackett.Common.Services.Interfaces
List<string> notices { get; } List<string> notices { get; }
string GetBlackholeDirectory(); string GetBlackholeDirectory();
string GetApiKey(); string GetApiKey();
bool MonoUserCanRunNetCore();
} }
} }

View File

@@ -64,7 +64,7 @@ namespace Jackett.Server.Controllers
[HttpGet] [HttpGet]
public Common.Models.DTO.ServerConfig Config() public Common.Models.DTO.ServerConfig Config()
{ {
var dto = new Common.Models.DTO.ServerConfig(serverService.notices, serverConfig, configService.GetVersion()); var dto = new Common.Models.DTO.ServerConfig(serverService.notices, serverConfig, configService.GetVersion(), serverService.MonoUserCanRunNetCore());
return dto; return dto;
} }

View File

@@ -7,6 +7,7 @@ using NLog;
using System; using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization; using System.Globalization;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
@@ -31,6 +32,7 @@ namespace Jackett.Server.Services
private List<string> _notices = new List<string>(); private List<string> _notices = new List<string>();
private ServerConfig config; private ServerConfig config;
private IProtectionService _protectionService; private IProtectionService _protectionService;
private bool isDotNetCoreCapable;
public ServerService(IIndexerManagerService i, IProcessService p, ISerializeService s, IConfigurationService c, Logger l, Common.Utils.Clients.WebClient w, IUpdateService u, IProtectionService protectionService, ServerConfig serverConfig) public ServerService(IIndexerManagerService i, IProcessService p, ISerializeService s, IConfigurationService c, Logger l, Common.Utils.Clients.WebClient w, IUpdateService u, IProtectionService protectionService, ServerConfig serverConfig)
{ {
@@ -279,6 +281,36 @@ namespace Jackett.Server.Services
logger.Error(e, "Error while checking build date of Jackett.Common"); logger.Error(e, "Error while checking build date of Jackett.Common");
} }
//Alert user that they no longer need to use Mono
try
{
Variants variants = new Variants();
Variants.JackettVariant variant = variants.GetVariant();
if (variant == Variants.JackettVariant.Mono)
{
Process process = new Process();
process.StartInfo.FileName = "uname";
process.StartInfo.Arguments = "-m";
process.StartInfo.UseShellExecute = false;
process.StartInfo.RedirectStandardOutput = true;
process.Start();
string output = process.StandardOutput.ReadToEnd();
process.WaitForExit();
logger.Debug($"uname output was: {output}");
output = output.ToLower();
if (output.Contains("armv7") || output.Contains("armv8") || output.Contains("x86_64"))
{
isDotNetCoreCapable = true;
}
}
}
catch (Exception e)
{
logger.Debug(e, "Unable to get architecture");
}
CultureInfo.DefaultThreadCurrentCulture = new CultureInfo("en-US"); CultureInfo.DefaultThreadCurrentCulture = new CultureInfo("en-US");
// Load indexers // Load indexers
indexerService.InitIndexers(configService.GetCardigannDefinitionsFolders()); indexerService.InitIndexers(configService.GetCardigannDefinitionsFolders());
@@ -354,5 +386,13 @@ namespace Jackett.Server.Services
{ {
return config.APIKey; return config.APIKey;
} }
public bool MonoUserCanRunNetCore()
{
//return isDotNetCoreCapable;
//Releasing in dark mode, will activate at a later date
return false;
}
} }
} }