mirror of
https://github.com/Jackett/Jackett.git
synced 2025-09-17 17:34:09 +02:00
Logging and UI improvements
This commit is contained in:
@@ -51,10 +51,13 @@ namespace Jackett
|
|||||||
client = new HttpClient(handler);
|
client = new HttpClient(handler);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task<ConfigurationData> GetConfigurationForSetup()
|
public async Task<ConfigurationData> GetConfigurationForSetup()
|
||||||
{
|
{
|
||||||
|
var request = CreateHttpRequest(new Uri(LoginUrl));
|
||||||
|
var response = await client.SendAsync(request);
|
||||||
|
await response.Content.ReadAsStreamAsync();
|
||||||
var config = new ConfigurationDataBasicLogin();
|
var config = new ConfigurationDataBasicLogin();
|
||||||
return Task.FromResult<ConfigurationData>(config);
|
return config;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task ApplyConfiguration(JToken configJson)
|
public async Task ApplyConfiguration(JToken configJson)
|
||||||
@@ -72,6 +75,7 @@ namespace Jackett
|
|||||||
var message = CreateHttpRequest(new Uri(LoginPostUrl));
|
var message = CreateHttpRequest(new Uri(LoginPostUrl));
|
||||||
message.Method = HttpMethod.Post;
|
message.Method = HttpMethod.Post;
|
||||||
message.Content = content;
|
message.Content = content;
|
||||||
|
message.Headers.Referrer = new Uri(LoginUrl);
|
||||||
|
|
||||||
var response = await client.SendAsync(message);
|
var response = await client.SendAsync(message);
|
||||||
var responseContent = await response.Content.ReadAsStringAsync();
|
var responseContent = await response.Content.ReadAsStringAsync();
|
||||||
|
@@ -5,7 +5,7 @@
|
|||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
<ProjectGuid>{E636D5F8-68B4-4903-B4ED-CCFD9C9E899F}</ProjectGuid>
|
<ProjectGuid>{E636D5F8-68B4-4903-B4ED-CCFD9C9E899F}</ProjectGuid>
|
||||||
<OutputType>Exe</OutputType>
|
<OutputType>WinExe</OutputType>
|
||||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||||
<RootNamespace>Jackett</RootNamespace>
|
<RootNamespace>Jackett</RootNamespace>
|
||||||
<AssemblyName>Jackett</AssemblyName>
|
<AssemblyName>Jackett</AssemblyName>
|
||||||
@@ -47,6 +47,12 @@
|
|||||||
<ErrorReport>prompt</ErrorReport>
|
<ErrorReport>prompt</ErrorReport>
|
||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
<PropertyGroup>
|
||||||
|
<ApplicationIcon>jacket_large.ico</ApplicationIcon>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup>
|
||||||
|
<StartupObject>Jackett.Program</StartupObject>
|
||||||
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="CsQuery">
|
<Reference Include="CsQuery">
|
||||||
<HintPath>..\packages\CsQuery.1.3.4\lib\net40\CsQuery.dll</HintPath>
|
<HintPath>..\packages\CsQuery.1.3.4\lib\net40\CsQuery.dll</HintPath>
|
||||||
@@ -55,11 +61,16 @@
|
|||||||
<SpecificVersion>False</SpecificVersion>
|
<SpecificVersion>False</SpecificVersion>
|
||||||
<HintPath>..\packages\Newtonsoft.Json.6.0.8\lib\net45\Newtonsoft.Json.dll</HintPath>
|
<HintPath>..\packages\Newtonsoft.Json.6.0.8\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
|
<Reference Include="NLog">
|
||||||
|
<HintPath>..\packages\NLog.3.2.0.0\lib\net45\NLog.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
<Reference Include="System.Core" />
|
<Reference Include="System.Core" />
|
||||||
|
<Reference Include="System.Drawing" />
|
||||||
<Reference Include="System.Net.Http" />
|
<Reference Include="System.Net.Http" />
|
||||||
<Reference Include="System.Net.Http.WebRequest" />
|
<Reference Include="System.Net.Http.WebRequest" />
|
||||||
<Reference Include="System.Web" />
|
<Reference Include="System.Web" />
|
||||||
|
<Reference Include="System.Windows.Forms" />
|
||||||
<Reference Include="System.Xml.Linq" />
|
<Reference Include="System.Xml.Linq" />
|
||||||
<Reference Include="System.Data.DataSetExtensions" />
|
<Reference Include="System.Data.DataSetExtensions" />
|
||||||
<Reference Include="Microsoft.CSharp" />
|
<Reference Include="Microsoft.CSharp" />
|
||||||
@@ -81,6 +92,12 @@
|
|||||||
<Compile Include="Indexers\IPTorrents.cs" />
|
<Compile Include="Indexers\IPTorrents.cs" />
|
||||||
<Compile Include="Indexers\MoreThanTV.cs" />
|
<Compile Include="Indexers\MoreThanTV.cs" />
|
||||||
<Compile Include="Indexers\ThePirateBay.cs" />
|
<Compile Include="Indexers\ThePirateBay.cs" />
|
||||||
|
<Compile Include="Main.cs">
|
||||||
|
<SubType>Form</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="Main.Designer.cs">
|
||||||
|
<DependentUpon>Main.cs</DependentUpon>
|
||||||
|
</Compile>
|
||||||
<Compile Include="Program.cs" />
|
<Compile Include="Program.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
<Compile Include="Properties\Resources.Designer.cs">
|
<Compile Include="Properties\Resources.Designer.cs">
|
||||||
@@ -107,12 +124,16 @@
|
|||||||
<None Include="Resources\test.xml" />
|
<None Include="Resources\test.xml" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<EmbeddedResource Include="Main.resx">
|
||||||
|
<DependentUpon>Main.cs</DependentUpon>
|
||||||
|
</EmbeddedResource>
|
||||||
<EmbeddedResource Include="Properties\Resources.resx">
|
<EmbeddedResource Include="Properties\Resources.resx">
|
||||||
<Generator>ResXFileCodeGenerator</Generator>
|
<Generator>ResXFileCodeGenerator</Generator>
|
||||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||||
</EmbeddedResource>
|
</EmbeddedResource>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Content Include="jacket_large.ico" />
|
||||||
<Content Include="WebContent\animate.css">
|
<Content Include="WebContent\animate.css">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
@@ -131,6 +152,9 @@
|
|||||||
<Content Include="WebContent\handlebars-v3.0.1.js">
|
<Content Include="WebContent\handlebars-v3.0.1.js">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
|
<Content Include="WebContent\jacket_medium.png">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
<Content Include="WebContent\logos\bitmetv.png">
|
<Content Include="WebContent\logos\bitmetv.png">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
|
100
src/Jackett/Main.Designer.cs
generated
Normal file
100
src/Jackett/Main.Designer.cs
generated
Normal file
@@ -0,0 +1,100 @@
|
|||||||
|
namespace Jackett
|
||||||
|
{
|
||||||
|
partial class Main
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Required designer variable.
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clean up any resources being used.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Windows Form Designer generated code
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Required method for Designer support - do not modify
|
||||||
|
/// the contents of this method with the code editor.
|
||||||
|
/// </summary>
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
this.components = new System.ComponentModel.Container();
|
||||||
|
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Main));
|
||||||
|
this.notifyIcon1 = new System.Windows.Forms.NotifyIcon(this.components);
|
||||||
|
this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
|
||||||
|
this.toolStripMenuItemAutoStart = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
this.toolStripMenuItemWebUI = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
this.toolStripMenuItemShutdown = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
this.contextMenuStrip1.SuspendLayout();
|
||||||
|
this.SuspendLayout();
|
||||||
|
//
|
||||||
|
// notifyIcon1
|
||||||
|
//
|
||||||
|
this.notifyIcon1.ContextMenuStrip = this.contextMenuStrip1;
|
||||||
|
this.notifyIcon1.Icon = ((System.Drawing.Icon)(resources.GetObject("notifyIcon1.Icon")));
|
||||||
|
this.notifyIcon1.Text = "Jackett";
|
||||||
|
this.notifyIcon1.Visible = true;
|
||||||
|
//
|
||||||
|
// contextMenuStrip1
|
||||||
|
//
|
||||||
|
this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||||
|
this.toolStripMenuItemAutoStart,
|
||||||
|
this.toolStripMenuItemWebUI,
|
||||||
|
this.toolStripMenuItemShutdown});
|
||||||
|
this.contextMenuStrip1.Name = "contextMenuStrip1";
|
||||||
|
this.contextMenuStrip1.Size = new System.Drawing.Size(174, 92);
|
||||||
|
//
|
||||||
|
// toolStripMenuItemAutoStart
|
||||||
|
//
|
||||||
|
this.toolStripMenuItemAutoStart.CheckOnClick = true;
|
||||||
|
this.toolStripMenuItemAutoStart.Name = "toolStripMenuItemAutoStart";
|
||||||
|
this.toolStripMenuItemAutoStart.Size = new System.Drawing.Size(173, 22);
|
||||||
|
this.toolStripMenuItemAutoStart.Text = "Auto-start on boot";
|
||||||
|
//
|
||||||
|
// toolStripMenuItemWebUI
|
||||||
|
//
|
||||||
|
this.toolStripMenuItemWebUI.Name = "toolStripMenuItemWebUI";
|
||||||
|
this.toolStripMenuItemWebUI.Size = new System.Drawing.Size(173, 22);
|
||||||
|
this.toolStripMenuItemWebUI.Text = "Open Web UI";
|
||||||
|
//
|
||||||
|
// toolStripMenuItemShutdown
|
||||||
|
//
|
||||||
|
this.toolStripMenuItemShutdown.Name = "toolStripMenuItemShutdown";
|
||||||
|
this.toolStripMenuItemShutdown.Size = new System.Drawing.Size(173, 22);
|
||||||
|
this.toolStripMenuItemShutdown.Text = "Shutdown";
|
||||||
|
//
|
||||||
|
// Main
|
||||||
|
//
|
||||||
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||||
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
|
this.ClientSize = new System.Drawing.Size(326, 176);
|
||||||
|
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
||||||
|
this.Name = "Main";
|
||||||
|
this.ShowInTaskbar = false;
|
||||||
|
this.Text = "Jackett";
|
||||||
|
this.WindowState = System.Windows.Forms.FormWindowState.Minimized;
|
||||||
|
this.contextMenuStrip1.ResumeLayout(false);
|
||||||
|
this.ResumeLayout(false);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private System.Windows.Forms.NotifyIcon notifyIcon1;
|
||||||
|
private System.Windows.Forms.ContextMenuStrip contextMenuStrip1;
|
||||||
|
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItemAutoStart;
|
||||||
|
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItemWebUI;
|
||||||
|
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItemShutdown;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
70
src/Jackett/Main.cs
Normal file
70
src/Jackett/Main.cs
Normal file
@@ -0,0 +1,70 @@
|
|||||||
|
using Microsoft.Win32;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Data;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
namespace Jackett
|
||||||
|
{
|
||||||
|
public partial class Main : Form
|
||||||
|
{
|
||||||
|
public Main()
|
||||||
|
{
|
||||||
|
Hide();
|
||||||
|
InitializeComponent();
|
||||||
|
|
||||||
|
toolStripMenuItemAutoStart.Checked = AutoStart;
|
||||||
|
toolStripMenuItemAutoStart.CheckedChanged += toolStripMenuItemAutoStart_CheckedChanged;
|
||||||
|
|
||||||
|
toolStripMenuItemShutdown.Click += toolStripMenuItemShutdown_Click;
|
||||||
|
|
||||||
|
if (Program.IsFirstRun)
|
||||||
|
AutoStart = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void toolStripMenuItemShutdown_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
Application.Exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
void toolStripMenuItemAutoStart_CheckedChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
AutoStart = toolStripMenuItemAutoStart.Checked;
|
||||||
|
}
|
||||||
|
|
||||||
|
string ProgramTitle
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return Assembly.GetExecutingAssembly().GetName().Name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool AutoStart
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
RegistryKey rkApp = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true);
|
||||||
|
if (rkApp.GetValue(ProgramTitle) == null)
|
||||||
|
return false;
|
||||||
|
else
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
RegistryKey rkApp = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true);
|
||||||
|
if (value && !AutoStart)
|
||||||
|
rkApp.SetValue(ProgramTitle, Application.ExecutablePath.ToString());
|
||||||
|
else if (!value && AutoStart)
|
||||||
|
rkApp.DeleteValue(ProgramTitle, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
12471
src/Jackett/Main.resx
Normal file
12471
src/Jackett/Main.resx
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,7 @@
|
|||||||
using System;
|
using NLog;
|
||||||
|
using NLog.Config;
|
||||||
|
using NLog.Targets;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@@ -6,6 +9,7 @@ using System.Text;
|
|||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
namespace Jackett
|
namespace Jackett
|
||||||
{
|
{
|
||||||
@@ -13,27 +17,59 @@ namespace Jackett
|
|||||||
{
|
{
|
||||||
public static string AppConfigDirectory = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "Jackett");
|
public static string AppConfigDirectory = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "Jackett");
|
||||||
|
|
||||||
public static ManualResetEvent ExitEvent = new ManualResetEvent(false);
|
public static Server ServerInstance { get; private set; }
|
||||||
|
|
||||||
|
public static bool IsFirstRun { get; private set; }
|
||||||
|
|
||||||
|
public static Logger LoggerInstance { get; private set; }
|
||||||
|
|
||||||
static void Main(string[] args)
|
static void Main(string[] args)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (!Directory.Exists(AppConfigDirectory))
|
if (!Directory.Exists(AppConfigDirectory))
|
||||||
|
{
|
||||||
|
IsFirstRun = true;
|
||||||
Directory.CreateDirectory(AppConfigDirectory);
|
Directory.CreateDirectory(AppConfigDirectory);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Console.WriteLine(ex.Message);
|
MessageBox.Show("Could not create settings directory.");
|
||||||
Console.WriteLine("Could not create settings directory");
|
Application.Exit();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var logConfig = new LoggingConfiguration();
|
||||||
|
|
||||||
|
var logFile = new FileTarget();
|
||||||
|
logConfig.AddTarget("file", logFile);
|
||||||
|
logFile.FileName = Path.Combine(AppConfigDirectory, "log.txt");
|
||||||
|
logFile.Layout = "${longdate} ${level} ${message}";
|
||||||
|
var logFileRule = new LoggingRule("*", LogLevel.Debug, logFile);
|
||||||
|
|
||||||
|
var logAlert = new MessageBoxTarget();
|
||||||
|
logConfig.AddTarget("alert", logAlert);
|
||||||
|
logAlert.Layout = "${message}";
|
||||||
|
logAlert.Caption = "Alert";
|
||||||
|
var logAlertRule = new LoggingRule("*", LogLevel.Error, logAlert);
|
||||||
|
|
||||||
|
logConfig.LoggingRules.Add(logFileRule);
|
||||||
|
logConfig.LoggingRules.Add(logAlertRule);
|
||||||
|
LogManager.Configuration = logConfig;
|
||||||
|
LoggerInstance = LogManager.GetCurrentClassLogger();
|
||||||
|
|
||||||
Task.Run(() =>
|
Task.Run(() =>
|
||||||
{
|
{
|
||||||
var server = new Server();
|
ServerInstance = new Server();
|
||||||
server.Start();
|
ServerInstance.Start();
|
||||||
});
|
});
|
||||||
ExitEvent.WaitOne();
|
|
||||||
|
|
||||||
|
Application.EnableVisualStyles();
|
||||||
|
Application.SetCompatibleTextRenderingDefault(false);
|
||||||
|
Application.Run(new Main());
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -2,17 +2,21 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Collections.Specialized;
|
using System.Collections.Specialized;
|
||||||
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Web;
|
using System.Web;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
namespace Jackett
|
namespace Jackett
|
||||||
{
|
{
|
||||||
public class Server
|
public class Server
|
||||||
{
|
{
|
||||||
|
int Port = 9117;
|
||||||
|
|
||||||
HttpListener listener;
|
HttpListener listener;
|
||||||
IndexerManager indexerManager;
|
IndexerManager indexerManager;
|
||||||
WebApi webApi;
|
WebApi webApi;
|
||||||
@@ -44,23 +48,25 @@ namespace Jackett
|
|||||||
|
|
||||||
public async void Start()
|
public async void Start()
|
||||||
{
|
{
|
||||||
Console.WriteLine("Starting HTTP server...");
|
Program.LoggerInstance.Info("Starting HTTP server...");
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
listener.Start();
|
listener.Start();
|
||||||
|
Process.Start("http://127.0.0.1:" + Port);
|
||||||
}
|
}
|
||||||
catch (HttpListenerException ex)
|
catch (HttpListenerException ex)
|
||||||
{
|
{
|
||||||
Console.WriteLine(ex.Message);
|
Program.LoggerInstance.FatalException("App must be ran as Admin for permission to use port " + Port, ex);
|
||||||
Console.WriteLine("App must be ran as Admin for permission to use port");
|
Application.Exit();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Console.WriteLine("Error " + ex.ToString());
|
Program.LoggerInstance.ErrorException("Error: " + ex.Message, ex);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Console.WriteLine("Server started on port 9117");
|
Program.LoggerInstance.Info("Server started on port " + Port);
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
var context = await listener.GetContextAsync();
|
var context = await listener.GetContextAsync();
|
||||||
@@ -76,7 +82,7 @@ namespace Jackett
|
|||||||
|
|
||||||
async void ProcessHttpRequest(HttpListenerContext context)
|
async void ProcessHttpRequest(HttpListenerContext context)
|
||||||
{
|
{
|
||||||
Console.WriteLine("Received request: " + context.Request.Url.ToString());
|
Program.LoggerInstance.Trace("Received request: " + context.Request.Url.ToString());
|
||||||
Exception exception = null;
|
Exception exception = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -155,6 +161,8 @@ namespace Jackett
|
|||||||
// add Jackett proxy to download links...
|
// add Jackett proxy to download links...
|
||||||
foreach (var release in releases)
|
foreach (var release in releases)
|
||||||
{
|
{
|
||||||
|
if (release.Link == null || release.Link.Scheme == "magnet")
|
||||||
|
continue;
|
||||||
var originalLink = release.Link;
|
var originalLink = release.Link;
|
||||||
var encodedLink = HttpServerUtility.UrlTokenEncode(Encoding.UTF8.GetBytes(originalLink.ToString())) + "/download.torrent";
|
var encodedLink = HttpServerUtility.UrlTokenEncode(Encoding.UTF8.GetBytes(originalLink.ToString())) + "/download.torrent";
|
||||||
var proxyLink = string.Format("{0}api/{1}/download/{2}", severUrl, indexerId, encodedLink);
|
var proxyLink = string.Format("{0}api/{1}/download/{2}", severUrl, indexerId, encodedLink);
|
||||||
|
@@ -181,11 +181,22 @@
|
|||||||
#sonarr-warning {
|
#sonarr-warning {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#logo {
|
||||||
|
max-width: 50px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#header-title {
|
||||||
|
font-size: 34px;
|
||||||
|
vertical-align: middle;
|
||||||
|
padding-left: 15px;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="page">
|
<div id="page">
|
||||||
<h3><span>need a logo..</span></h3>
|
|
||||||
|
<img id="logo" src="jacket_medium.png" /><span id="header-title">Jackett</span>
|
||||||
|
|
||||||
<hr />
|
<hr />
|
||||||
|
|
||||||
@@ -233,6 +244,10 @@
|
|||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
<div id="unconfigured-indexers">
|
<div id="unconfigured-indexers">
|
||||||
</div>
|
</div>
|
||||||
|
<hr />
|
||||||
|
<p>
|
||||||
|
To add a Jackett indexer in Sonarr go to <b>Settings > Indexers > Add > Torznab > Custom</b>
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
|
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
|
||||||
@@ -509,6 +524,17 @@
|
|||||||
$("#select-indexer-modal").modal("hide");
|
$("#select-indexer-modal").modal("hide");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function populateConfigItems(configForm, config) {
|
||||||
|
var $formItemContainer = configForm.find(".config-setup-form");
|
||||||
|
$formItemContainer.empty();
|
||||||
|
var setupItemTemplate = Handlebars.compile($("#templates > .setup-item")[0].outerHTML);
|
||||||
|
for (var i = 0; i < config.length; i++) {
|
||||||
|
var item = config[i];
|
||||||
|
var setupValueTemplate = Handlebars.compile($("#templates > .setup-item-" + item.type)[0].outerHTML);
|
||||||
|
item.value_element = setupValueTemplate(item);
|
||||||
|
$formItemContainer.append(setupItemTemplate(item));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function newConfigModal(title, config) {
|
function newConfigModal(title, config) {
|
||||||
//config-setup-modal
|
//config-setup-modal
|
||||||
@@ -517,15 +543,7 @@
|
|||||||
|
|
||||||
$("#modals").append(configForm);
|
$("#modals").append(configForm);
|
||||||
|
|
||||||
var $formItemContainer = configForm.find(".config-setup-form");
|
populateConfigItems(configForm, config);
|
||||||
var setupItemTemplate = Handlebars.compile($("#templates > .setup-item")[0].outerHTML);
|
|
||||||
for (var i = 0; i < config.length; i++) {
|
|
||||||
var item = config[i];
|
|
||||||
var setupValueTemplate = Handlebars.compile($("#templates > .setup-item-" + item.type)[0].outerHTML);
|
|
||||||
item.value_element = setupValueTemplate(item);
|
|
||||||
$formItemContainer.append(setupItemTemplate(item));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
return configForm;
|
return configForm;
|
||||||
//modal.remove();
|
//modal.remove();
|
||||||
@@ -565,7 +583,7 @@
|
|||||||
var jqxhr = $.post("configure_indexer", JSON.stringify(data), function (data) {
|
var jqxhr = $.post("configure_indexer", JSON.stringify(data), function (data) {
|
||||||
if (data.result == "error") {
|
if (data.result == "error") {
|
||||||
if (data.config) {
|
if (data.config) {
|
||||||
populateSetupForm(data.indexer, data.name, data.config);
|
populateConfigItems(configForm, data.config);
|
||||||
}
|
}
|
||||||
doNotify("Configuration failed: " + data.error, "danger", "glyphicon glyphicon-alert");
|
doNotify("Configuration failed: " + data.error, "danger", "glyphicon glyphicon-alert");
|
||||||
}
|
}
|
||||||
|
BIN
src/Jackett/WebContent/jacket_medium.png
Normal file
BIN
src/Jackett/WebContent/jacket_medium.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 19 KiB |
BIN
src/Jackett/jacket_large.ico
Normal file
BIN
src/Jackett/jacket_large.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 361 KiB |
@@ -2,4 +2,5 @@
|
|||||||
<packages>
|
<packages>
|
||||||
<package id="CsQuery" version="1.3.4" targetFramework="net451" />
|
<package id="CsQuery" version="1.3.4" targetFramework="net451" />
|
||||||
<package id="Newtonsoft.Json" version="6.0.8" targetFramework="net451" />
|
<package id="Newtonsoft.Json" version="6.0.8" targetFramework="net451" />
|
||||||
|
<package id="NLog" version="3.2.0.0" targetFramework="net451" />
|
||||||
</packages>
|
</packages>
|
Reference in New Issue
Block a user