diff --git a/Jellyfin Server/ActionManager.swift b/Jellyfin Server/ActionManager.swift index cbf40c5..7001b9a 100644 --- a/Jellyfin Server/ActionManager.swift +++ b/Jellyfin Server/ActionManager.swift @@ -11,7 +11,8 @@ import Foundation enum ActionManager { static func launchWebUI() { - NSWorkspace.shared.open(.init(string: "http://localhost:8096")!) + let (port, proto, subPath) = getJellyfinNetworkConfig() + NSWorkspace.shared.open(.init(string: "\(proto)://localhost:\(port)\(subPath)")!) } static func showLogs() { diff --git a/Jellyfin Server/Assets.xcassets/AppIcon.appiconset/AppIcon128x128.png b/Jellyfin Server/Assets.xcassets/AppIcon.appiconset/AppIcon128x128.png new file mode 100644 index 0000000..9804917 Binary files /dev/null and b/Jellyfin Server/Assets.xcassets/AppIcon.appiconset/AppIcon128x128.png differ diff --git a/Jellyfin Server/Assets.xcassets/AppIcon.appiconset/AppIcon128x128@2x.png b/Jellyfin Server/Assets.xcassets/AppIcon.appiconset/AppIcon128x128@2x.png new file mode 100644 index 0000000..3215275 Binary files /dev/null and b/Jellyfin Server/Assets.xcassets/AppIcon.appiconset/AppIcon128x128@2x.png differ diff --git a/Jellyfin Server/Assets.xcassets/AppIcon.appiconset/AppIcon16x16.png b/Jellyfin Server/Assets.xcassets/AppIcon.appiconset/AppIcon16x16.png new file mode 100644 index 0000000..3a66e28 Binary files /dev/null and b/Jellyfin Server/Assets.xcassets/AppIcon.appiconset/AppIcon16x16.png differ diff --git a/Jellyfin Server/Assets.xcassets/AppIcon.appiconset/AppIcon16x16@2x.png b/Jellyfin Server/Assets.xcassets/AppIcon.appiconset/AppIcon16x16@2x.png new file mode 100644 index 0000000..f6d239b Binary files /dev/null and b/Jellyfin Server/Assets.xcassets/AppIcon.appiconset/AppIcon16x16@2x.png differ diff --git a/Jellyfin Server/Assets.xcassets/AppIcon.appiconset/AppIcon256x256.png b/Jellyfin Server/Assets.xcassets/AppIcon.appiconset/AppIcon256x256.png new file mode 100644 index 0000000..3215275 Binary files /dev/null and b/Jellyfin Server/Assets.xcassets/AppIcon.appiconset/AppIcon256x256.png differ diff --git a/Jellyfin Server/Assets.xcassets/AppIcon.appiconset/AppIcon256x256@2x.png b/Jellyfin Server/Assets.xcassets/AppIcon.appiconset/AppIcon256x256@2x.png new file mode 100644 index 0000000..17c7122 Binary files /dev/null and b/Jellyfin Server/Assets.xcassets/AppIcon.appiconset/AppIcon256x256@2x.png differ diff --git a/Jellyfin Server/Assets.xcassets/AppIcon.appiconset/AppIcon32x32.png b/Jellyfin Server/Assets.xcassets/AppIcon.appiconset/AppIcon32x32.png new file mode 100644 index 0000000..f6d239b Binary files /dev/null and b/Jellyfin Server/Assets.xcassets/AppIcon.appiconset/AppIcon32x32.png differ diff --git a/Jellyfin Server/Assets.xcassets/AppIcon.appiconset/AppIcon32x32@2x.png b/Jellyfin Server/Assets.xcassets/AppIcon.appiconset/AppIcon32x32@2x.png new file mode 100644 index 0000000..e7ab94a Binary files /dev/null and b/Jellyfin Server/Assets.xcassets/AppIcon.appiconset/AppIcon32x32@2x.png differ diff --git a/Jellyfin Server/Assets.xcassets/AppIcon.appiconset/AppIcon512x512.png b/Jellyfin Server/Assets.xcassets/AppIcon.appiconset/AppIcon512x512.png new file mode 100644 index 0000000..17c7122 Binary files /dev/null and b/Jellyfin Server/Assets.xcassets/AppIcon.appiconset/AppIcon512x512.png differ diff --git a/Jellyfin Server/Assets.xcassets/AppIcon.appiconset/AppIcon512x512@2x.png b/Jellyfin Server/Assets.xcassets/AppIcon.appiconset/AppIcon512x512@2x.png new file mode 100644 index 0000000..5e1d31b Binary files /dev/null and b/Jellyfin Server/Assets.xcassets/AppIcon.appiconset/AppIcon512x512@2x.png differ diff --git a/Jellyfin Server/Assets.xcassets/AppIcon.appiconset/Contents.json b/Jellyfin Server/Assets.xcassets/AppIcon.appiconset/Contents.json index 86774f6..8b9179b 100755 --- a/Jellyfin Server/Assets.xcassets/AppIcon.appiconset/Contents.json +++ b/Jellyfin Server/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -1,68 +1,68 @@ { "images" : [ { - "size" : "16x16", + "filename" : "AppIcon16x16.png", "idiom" : "mac", - "filename" : "icon_16x16.png", - "scale" : "1x" + "scale" : "1x", + "size" : "16x16" }, { - "size" : "16x16", + "filename" : "AppIcon16x16@2x.png", "idiom" : "mac", - "filename" : "icon_16x16@2x.png", - "scale" : "2x" + "scale" : "2x", + "size" : "16x16" }, { - "size" : "32x32", + "filename" : "AppIcon32x32.png", "idiom" : "mac", - "filename" : "icon_32x32.png", - "scale" : "1x" + "scale" : "1x", + "size" : "32x32" }, { - "size" : "32x32", + "filename" : "AppIcon32x32@2x.png", "idiom" : "mac", - "filename" : "icon_32x32@2x.png", - "scale" : "2x" + "scale" : "2x", + "size" : "32x32" }, { - "size" : "128x128", + "filename" : "AppIcon128x128.png", "idiom" : "mac", - "filename" : "icon_128x128.png", - "scale" : "1x" + "scale" : "1x", + "size" : "128x128" }, { - "size" : "128x128", + "filename" : "AppIcon128x128@2x.png", "idiom" : "mac", - "filename" : "icon_128x128@2x.png", - "scale" : "2x" + "scale" : "2x", + "size" : "128x128" }, { - "size" : "256x256", + "filename" : "AppIcon256x256.png", "idiom" : "mac", - "filename" : "icon_256x256.png", - "scale" : "1x" + "scale" : "1x", + "size" : "256x256" }, { - "size" : "256x256", + "filename" : "AppIcon256x256@2x.png", "idiom" : "mac", - "filename" : "icon_256x256@2x.png", - "scale" : "2x" + "scale" : "2x", + "size" : "256x256" }, { - "size" : "512x512", + "filename" : "AppIcon512x512.png", "idiom" : "mac", - "filename" : "icon_512x512.png", - "scale" : "1x" + "scale" : "1x", + "size" : "512x512" }, { - "size" : "512x512", + "filename" : "AppIcon512x512@2x.png", "idiom" : "mac", - "filename" : "appicon@2x.png", - "scale" : "2x" + "scale" : "2x", + "size" : "512x512" } ], "info" : { - "version" : 1, - "author" : "xcode" + "author" : "xcode", + "version" : 1 } -} \ No newline at end of file +} diff --git a/Jellyfin Server/Assets.xcassets/AppIcon.appiconset/appicon@2x.png b/Jellyfin Server/Assets.xcassets/AppIcon.appiconset/appicon@2x.png deleted file mode 100755 index e8a423b..0000000 Binary files a/Jellyfin Server/Assets.xcassets/AppIcon.appiconset/appicon@2x.png and /dev/null differ diff --git a/Jellyfin Server/Assets.xcassets/AppIcon.appiconset/icon_128x128.png b/Jellyfin Server/Assets.xcassets/AppIcon.appiconset/icon_128x128.png deleted file mode 100755 index 6004c08..0000000 Binary files a/Jellyfin Server/Assets.xcassets/AppIcon.appiconset/icon_128x128.png and /dev/null differ diff --git a/Jellyfin Server/Assets.xcassets/AppIcon.appiconset/icon_128x128@2x.png b/Jellyfin Server/Assets.xcassets/AppIcon.appiconset/icon_128x128@2x.png deleted file mode 100755 index 9016f08..0000000 Binary files a/Jellyfin Server/Assets.xcassets/AppIcon.appiconset/icon_128x128@2x.png and /dev/null differ diff --git a/Jellyfin Server/Assets.xcassets/AppIcon.appiconset/icon_16x16.png b/Jellyfin Server/Assets.xcassets/AppIcon.appiconset/icon_16x16.png deleted file mode 100755 index cd95736..0000000 Binary files a/Jellyfin Server/Assets.xcassets/AppIcon.appiconset/icon_16x16.png and /dev/null differ diff --git a/Jellyfin Server/Assets.xcassets/AppIcon.appiconset/icon_16x16@2x.png b/Jellyfin Server/Assets.xcassets/AppIcon.appiconset/icon_16x16@2x.png deleted file mode 100755 index 8dddfe0..0000000 Binary files a/Jellyfin Server/Assets.xcassets/AppIcon.appiconset/icon_16x16@2x.png and /dev/null differ diff --git a/Jellyfin Server/Assets.xcassets/AppIcon.appiconset/icon_256x256.png b/Jellyfin Server/Assets.xcassets/AppIcon.appiconset/icon_256x256.png deleted file mode 100755 index 9016f08..0000000 Binary files a/Jellyfin Server/Assets.xcassets/AppIcon.appiconset/icon_256x256.png and /dev/null differ diff --git a/Jellyfin Server/Assets.xcassets/AppIcon.appiconset/icon_256x256@2x.png b/Jellyfin Server/Assets.xcassets/AppIcon.appiconset/icon_256x256@2x.png deleted file mode 100755 index 40c7a34..0000000 Binary files a/Jellyfin Server/Assets.xcassets/AppIcon.appiconset/icon_256x256@2x.png and /dev/null differ diff --git a/Jellyfin Server/Assets.xcassets/AppIcon.appiconset/icon_32x32.png b/Jellyfin Server/Assets.xcassets/AppIcon.appiconset/icon_32x32.png deleted file mode 100755 index 8dddfe0..0000000 Binary files a/Jellyfin Server/Assets.xcassets/AppIcon.appiconset/icon_32x32.png and /dev/null differ diff --git a/Jellyfin Server/Assets.xcassets/AppIcon.appiconset/icon_32x32@2x.png b/Jellyfin Server/Assets.xcassets/AppIcon.appiconset/icon_32x32@2x.png deleted file mode 100755 index 857da72..0000000 Binary files a/Jellyfin Server/Assets.xcassets/AppIcon.appiconset/icon_32x32@2x.png and /dev/null differ diff --git a/Jellyfin Server/Assets.xcassets/AppIcon.appiconset/icon_512x512.png b/Jellyfin Server/Assets.xcassets/AppIcon.appiconset/icon_512x512.png deleted file mode 100755 index 40c7a34..0000000 Binary files a/Jellyfin Server/Assets.xcassets/AppIcon.appiconset/icon_512x512.png and /dev/null differ diff --git a/Jellyfin Server/Assets.xcassets/jellyfin-banner.imageset/Contents.json b/Jellyfin Server/Assets.xcassets/jellyfin-banner.imageset/Contents.json index 9647117..23ddbfb 100644 --- a/Jellyfin Server/Assets.xcassets/jellyfin-banner.imageset/Contents.json +++ b/Jellyfin Server/Assets.xcassets/jellyfin-banner.imageset/Contents.json @@ -11,7 +11,7 @@ "value" : "light" } ], - "filename" : "jellyfin-banner-light.png", + "filename" : "logo-light.png", "idiom" : "universal", "scale" : "1x" }, @@ -22,7 +22,7 @@ "value" : "dark" } ], - "filename" : "jellyfin-banner-dark.png", + "filename" : "logo-dark.png", "idiom" : "universal", "scale" : "1x" }, diff --git a/Jellyfin Server/Assets.xcassets/jellyfin-banner.imageset/jellyfin-banner-dark.png b/Jellyfin Server/Assets.xcassets/jellyfin-banner.imageset/jellyfin-banner-dark.png deleted file mode 100644 index ce447b6..0000000 Binary files a/Jellyfin Server/Assets.xcassets/jellyfin-banner.imageset/jellyfin-banner-dark.png and /dev/null differ diff --git a/Jellyfin Server/Assets.xcassets/jellyfin-banner.imageset/jellyfin-banner-light.png b/Jellyfin Server/Assets.xcassets/jellyfin-banner.imageset/jellyfin-banner-light.png deleted file mode 100644 index 2a92b22..0000000 Binary files a/Jellyfin Server/Assets.xcassets/jellyfin-banner.imageset/jellyfin-banner-light.png and /dev/null differ diff --git a/Jellyfin Server/Assets.xcassets/jellyfin-banner.imageset/logo-dark.png b/Jellyfin Server/Assets.xcassets/jellyfin-banner.imageset/logo-dark.png new file mode 100644 index 0000000..7698011 Binary files /dev/null and b/Jellyfin Server/Assets.xcassets/jellyfin-banner.imageset/logo-dark.png differ diff --git a/Jellyfin Server/Assets.xcassets/jellyfin-banner.imageset/logo-light.png b/Jellyfin Server/Assets.xcassets/jellyfin-banner.imageset/logo-light.png new file mode 100644 index 0000000..7189aac Binary files /dev/null and b/Jellyfin Server/Assets.xcassets/jellyfin-banner.imageset/logo-light.png differ diff --git a/Jellyfin Server/Helpers.swift b/Jellyfin Server/Helpers.swift index 57f86ab..7e075b5 100644 --- a/Jellyfin Server/Helpers.swift +++ b/Jellyfin Server/Helpers.swift @@ -18,3 +18,47 @@ func directoryExists(path: String) -> Bool { var isDirectory: ObjCBool = false return FileManager.default.fileExists(atPath: path, isDirectory: &isDirectory) } + +func getJellyfinNetworkConfig() -> (port: String, proto: String, subPath:String) { + let configFile: URL = directoryExists(path: localShareJellyfinFolder.path) + ? localShareJellyfinFolder.appendingPathComponent("config/network.xml") + : applicationSupportJellyfinFolder.appendingPathComponent("config/network.xml") + var httpPort = "8096" + var httpsPort = "8920" + var requireHttps = false + var enableHttps = false + var subPath = "" + do { + let config = try XMLDocument(contentsOf: configFile) + try config.validate() + if let rootElement = config.rootElement() { + if let internalHttpPort = rootElement.elements(forName: "InternalHttpPort").first?.stringValue { + httpPort = internalHttpPort + } + + if let internalHttpsPort = rootElement.elements(forName: "InternalHttpsPort").first?.stringValue { + httpsPort = internalHttpsPort + } + + if let enableHttpsString = rootElement.elements(forName: "EnableHttps").first?.stringValue { + enableHttps = (enableHttpsString as NSString).boolValue + } + + if let requireHttpsString = rootElement.elements(forName: "RequireHttps").first?.stringValue { + requireHttps = (requireHttpsString as NSString).boolValue + } + + if let baseUrl = rootElement.elements(forName: "BaseUrl").first?.stringValue, !baseUrl.isEmpty { + subPath = baseUrl + } + } + } catch { + print("Jellyfin Server config is invalid, using default values.") + } + + if requireHttps && enableHttps { + return (httpsPort, "https", subPath) + } else { + return (httpPort, "http", subPath) + } +}