Merge pull request #77 from gnattu/qol-improvements

Use server config to open URL and use new logos
This commit is contained in:
Anthony Lavado 2024-10-22 09:04:46 -04:00 committed by GitHub
commit 15b6b23a5c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
28 changed files with 81 additions and 36 deletions

View File

@ -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() {

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 169 KiB

View File

@ -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
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 95 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 91 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 91 KiB

View File

@ -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"
},

Binary file not shown.

Before

Width:  |  Height:  |  Size: 153 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 151 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 82 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 85 KiB

View File

@ -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)
}
}