Skip to content

Commit

Permalink
Merge pull request #77 from gnattu/qol-improvements
Browse files Browse the repository at this point in the history
Use server config to open URL and use new logos
  • Loading branch information
anthonylavado authored Oct 22, 2024
2 parents 1e7fbe7 + d6025c5 commit 15b6b23
Show file tree
Hide file tree
Showing 28 changed files with 81 additions and 36 deletions.
3 changes: 2 additions & 1 deletion Jellyfin Server/ActionManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
66 changes: 33 additions & 33 deletions Jellyfin Server/Assets.xcassets/AppIcon.appiconset/Contents.json
Original file line number Diff line number Diff line change
@@ -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" : "[email protected]",
"idiom" : "mac",
"filename" : "[email protected]",
"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" : "[email protected]",
"idiom" : "mac",
"filename" : "[email protected]",
"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" : "[email protected]",
"idiom" : "mac",
"filename" : "[email protected]",
"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" : "[email protected]",
"idiom" : "mac",
"filename" : "[email protected]",
"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" : "[email protected]",
"idiom" : "mac",
"filename" : "[email protected]",
"scale" : "2x"
"scale" : "2x",
"size" : "512x512"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
"author" : "xcode",
"version" : 1
}
}
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"value" : "light"
}
],
"filename" : "jellyfin-banner-light.png",
"filename" : "logo-light.png",
"idiom" : "universal",
"scale" : "1x"
},
Expand All @@ -22,7 +22,7 @@
"value" : "dark"
}
],
"filename" : "jellyfin-banner-dark.png",
"filename" : "logo-dark.png",
"idiom" : "universal",
"scale" : "1x"
},
Expand Down
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
44 changes: 44 additions & 0 deletions Jellyfin Server/Helpers.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}

0 comments on commit 15b6b23

Please sign in to comment.