update mac files
This commit is contained in:
parent
f5b9882d1c
commit
8de74d2d37
|
@ -1,3 +1,8 @@
|
|||
using MediaBrowser.Controller;
|
||||
using MediaBrowser.Controller.Configuration;
|
||||
using MediaBrowser.Controller.Localization;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using MediaBrowser.Server.Startup.Common.Browser;
|
||||
using System;
|
||||
using MonoMac.Foundation;
|
||||
using MonoMac.AppKit;
|
||||
|
@ -7,6 +12,14 @@ namespace MediaBrowser.Server.Mac
|
|||
[Register("AppController")]
|
||||
public partial class AppController : NSObject
|
||||
{
|
||||
private NSMenuItem browseMenuItem;
|
||||
private NSMenuItem configureMenuItem;
|
||||
private NSMenuItem developerMenuItem;
|
||||
private NSMenuItem quitMenuItem;
|
||||
private NSMenuItem githubMenuItem;
|
||||
private NSMenuItem apiMenuItem;
|
||||
private NSMenuItem communityMenuItem;
|
||||
|
||||
public AppController()
|
||||
{
|
||||
|
||||
|
@ -18,36 +31,78 @@ namespace MediaBrowser.Server.Mac
|
|||
statusItem.Menu = statusMenu;
|
||||
statusItem.Image = NSImage.ImageNamed("touchicon");
|
||||
statusItem.HighlightMode = true;
|
||||
|
||||
statusItem.Menu.RemoveAllItems ();
|
||||
|
||||
browseMenuItem = new NSMenuItem ("Browse Media Library", "b", delegate {
|
||||
Browse (this);
|
||||
});
|
||||
statusItem.Menu.AddItem (browseMenuItem);
|
||||
|
||||
configureMenuItem = new NSMenuItem ("Configure Media Browser", "c", delegate {
|
||||
Configure (this);
|
||||
});
|
||||
statusItem.Menu.AddItem (configureMenuItem);
|
||||
|
||||
developerMenuItem = new NSMenuItem ("Developer Resources");
|
||||
statusItem.Menu.AddItem (developerMenuItem);
|
||||
|
||||
var developerMenu = new NSMenu ();
|
||||
developerMenuItem.Submenu = developerMenu;
|
||||
|
||||
apiMenuItem = new NSMenuItem ("Api Documentation", "a", delegate {
|
||||
ApiDocs (this);
|
||||
});
|
||||
developerMenu.AddItem (apiMenuItem);
|
||||
|
||||
githubMenuItem = new NSMenuItem ("Github", "g", delegate {
|
||||
Github (this);
|
||||
});
|
||||
developerMenu.AddItem (githubMenuItem);
|
||||
|
||||
communityMenuItem = new NSMenuItem ("Visit Community", "v", delegate {
|
||||
Community (this);
|
||||
});
|
||||
statusItem.Menu.AddItem (communityMenuItem);
|
||||
|
||||
quitMenuItem = new NSMenuItem ("Quit", "q", delegate {
|
||||
Quit (this);
|
||||
});
|
||||
statusItem.Menu.AddItem (quitMenuItem);
|
||||
}
|
||||
|
||||
partial void HelloWorld(NSObject sender)
|
||||
{
|
||||
private IServerApplicationHost AppHost{ get; set;}
|
||||
private ILogger Logger{ get; set;}
|
||||
|
||||
private void Quit(NSObject sender)
|
||||
{
|
||||
NSApplication.SharedApplication.Terminate(this);
|
||||
//AppHost.Shutdown();
|
||||
}
|
||||
|
||||
partial void Quit(NSObject sender)
|
||||
private void Community(NSObject sender)
|
||||
{
|
||||
|
||||
BrowserLauncher.OpenCommunity(Logger);
|
||||
}
|
||||
|
||||
partial void Configure(NSObject sender)
|
||||
private void Configure(NSObject sender)
|
||||
{
|
||||
|
||||
BrowserLauncher.OpenDashboard(AppHost, Logger);
|
||||
}
|
||||
|
||||
partial void Browse(NSObject sender)
|
||||
private void Browse(NSObject sender)
|
||||
{
|
||||
|
||||
BrowserLauncher.OpenWebClient(AppHost, Logger);
|
||||
}
|
||||
|
||||
partial void Github(NSObject sender)
|
||||
private void Github(NSObject sender)
|
||||
{
|
||||
|
||||
BrowserLauncher.OpenGithub(Logger);
|
||||
}
|
||||
|
||||
partial void ApiDocs(NSObject sender)
|
||||
private void ApiDocs(NSObject sender)
|
||||
{
|
||||
|
||||
BrowserLauncher.OpenSwagger(AppHost, Logger);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@ namespace MediaBrowser.Server.Mac
|
|||
{
|
||||
public AppDelegate ()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void FinishedLaunching (NSObject notification)
|
||||
|
|
|
@ -44,27 +44,19 @@
|
|||
<object class="NSMenu" id="761139089">
|
||||
<string key="NSTitle"/>
|
||||
<array class="NSMutableArray" key="NSMenuItems">
|
||||
<object class="NSMenuItem" id="92911173">
|
||||
<reference key="NSMenu" ref="761139089"/>
|
||||
<string key="NSTitle">Hello World</string>
|
||||
<string key="NSKeyEquiv"/>
|
||||
<int key="NSMnemonicLoc">2147483647</int>
|
||||
<object class="NSCustomResource" key="NSOnImage" id="793232119">
|
||||
<string key="NSClassName">NSImage</string>
|
||||
<string key="NSResourceName">NSMenuCheckmark</string>
|
||||
</object>
|
||||
<object class="NSCustomResource" key="NSMixedImage" id="438564198">
|
||||
<string key="NSClassName">NSImage</string>
|
||||
<string key="NSResourceName">NSMenuMixedState</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="NSMenuItem" id="523607499">
|
||||
<reference key="NSMenu" ref="761139089"/>
|
||||
<string key="NSTitle">Quit</string>
|
||||
<string key="NSKeyEquiv"/>
|
||||
<int key="NSMnemonicLoc">2147483647</int>
|
||||
<reference key="NSOnImage" ref="793232119"/>
|
||||
<reference key="NSMixedImage" ref="438564198"/>
|
||||
<object class="NSCustomResource" key="NSOnImage">
|
||||
<string key="NSClassName">NSImage</string>
|
||||
<string key="NSResourceName">NSMenuCheckmark</string>
|
||||
</object>
|
||||
<object class="NSCustomResource" key="NSMixedImage">
|
||||
<string key="NSClassName">NSImage</string>
|
||||
<string key="NSResourceName">NSMenuMixedState</string>
|
||||
</object>
|
||||
</object>
|
||||
</array>
|
||||
</object>
|
||||
|
@ -87,14 +79,6 @@
|
|||
</object>
|
||||
<int key="connectionID">540</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBActionConnection" key="connection">
|
||||
<string key="label">HelloWorld:</string>
|
||||
<reference key="source" ref="67438171"/>
|
||||
<reference key="destination" ref="92911173"/>
|
||||
</object>
|
||||
<int key="connectionID">542</int>
|
||||
</object>
|
||||
</array>
|
||||
<object class="IBMutableOrderedSet" key="objectRecords">
|
||||
<array key="orderedObjects">
|
||||
|
@ -141,17 +125,11 @@
|
|||
<int key="objectID">536</int>
|
||||
<reference key="object" ref="761139089"/>
|
||||
<array class="NSMutableArray" key="children">
|
||||
<reference ref="92911173"/>
|
||||
<reference ref="523607499"/>
|
||||
</array>
|
||||
<reference key="parent" ref="0"/>
|
||||
<string key="objectName">MediaBrowser.Server.Mac</string>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">537</int>
|
||||
<reference key="object" ref="92911173"/>
|
||||
<reference key="parent" ref="761139089"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">538</int>
|
||||
<reference key="object" ref="523607499"/>
|
||||
|
@ -167,7 +145,6 @@
|
|||
<string key="533.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string key="535.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string key="536.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string key="537.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string key="538.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
</dictionary>
|
||||
<dictionary class="NSMutableDictionary" key="unlocalizedProperties"/>
|
||||
|
|
|
@ -29,7 +29,7 @@ namespace MediaBrowser.Server.Mono.Native
|
|||
/// </summary>
|
||||
public void Restart()
|
||||
{
|
||||
MainClass.Restart();
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -43,12 +43,6 @@ namespace MediaBrowser.Server.Mono
|
|||
|
||||
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
|
||||
|
||||
if (PerformUpdateIfNeeded(appPaths, logger))
|
||||
{
|
||||
logger.Info("Exiting to perform application update.");
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
RunApplication(appPaths, logManager, options);
|
||||
|
@ -71,8 +65,6 @@ namespace MediaBrowser.Server.Mono
|
|||
return new ServerApplicationPaths(programDataPath, applicationPath);
|
||||
}
|
||||
|
||||
private static readonly RemoteCertificateValidationCallback IgnoreCertificates = new RemoteCertificateValidationCallback(delegate { return true; });
|
||||
|
||||
private static readonly TaskCompletionSource<bool> ApplicationTaskCompletionSource = new TaskCompletionSource<bool>();
|
||||
|
||||
private static void RunApplication(ServerApplicationPaths appPaths, ILogManager logManager, StartupOptions options)
|
||||
|
@ -80,7 +72,7 @@ namespace MediaBrowser.Server.Mono
|
|||
SystemEvents.SessionEnding += SystemEvents_SessionEnding;
|
||||
|
||||
// Allow all https requests
|
||||
ServicePointManager.ServerCertificateValidationCallback = IgnoreCertificates;
|
||||
ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(delegate { return true; });
|
||||
|
||||
var fileSystem = new CommonFileSystem(logManager.GetLogger("FileSystem"), false, true);
|
||||
|
||||
|
@ -156,30 +148,10 @@ namespace MediaBrowser.Server.Mono
|
|||
File.WriteAllText(path, builder.ToString());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Performs the update if needed.
|
||||
/// </summary>
|
||||
/// <param name="appPaths">The app paths.</param>
|
||||
/// <param name="logger">The logger.</param>
|
||||
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise</returns>
|
||||
private static bool PerformUpdateIfNeeded(ServerApplicationPaths appPaths, ILogger logger)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void Shutdown()
|
||||
{
|
||||
ApplicationTaskCompletionSource.SetResult (true);
|
||||
}
|
||||
|
||||
public static void Restart()
|
||||
{
|
||||
// Second instance will start first, so dispose so that the http ports will be available to the new instance
|
||||
_appHost.Dispose();
|
||||
|
||||
// Right now this method will just shutdown, but not restart
|
||||
Shutdown ();
|
||||
}
|
||||
}
|
||||
|
||||
class NoCheckCertificatePolicy : ICertificatePolicy
|
||||
|
|
Loading…
Reference in New Issue
Block a user