mirror of
https://github.com/Ernous/TorrServerJellyfin.git
synced 2025-12-19 13:36:09 +05:00
dlna icons: looks like order matters
and avoid useless localhost - use 1st IP instead
This commit is contained in:
@@ -40,13 +40,6 @@ func Start() {
|
|||||||
NoTranscode: true,
|
NoTranscode: true,
|
||||||
NoProbe: true,
|
NoProbe: true,
|
||||||
Icons: []dms.Icon{
|
Icons: []dms.Icon{
|
||||||
dms.Icon{
|
|
||||||
Width: 192,
|
|
||||||
Height: 192,
|
|
||||||
Depth: 32,
|
|
||||||
Mimetype: "image/png",
|
|
||||||
ReadSeeker: bytes.NewReader(template.Androidchrome192x192png),
|
|
||||||
},
|
|
||||||
dms.Icon{
|
dms.Icon{
|
||||||
Width: 32,
|
Width: 32,
|
||||||
Height: 32,
|
Height: 32,
|
||||||
@@ -54,6 +47,13 @@ func Start() {
|
|||||||
Mimetype: "image/png",
|
Mimetype: "image/png",
|
||||||
ReadSeeker: bytes.NewReader(template.Favicon32x32png),
|
ReadSeeker: bytes.NewReader(template.Favicon32x32png),
|
||||||
},
|
},
|
||||||
|
dms.Icon{
|
||||||
|
Width: 192,
|
||||||
|
Height: 192,
|
||||||
|
Depth: 32,
|
||||||
|
Mimetype: "image/png",
|
||||||
|
ReadSeeker: bytes.NewReader(template.Androidchrome192x192png),
|
||||||
|
},
|
||||||
},
|
},
|
||||||
NotifyInterval: 30 * time.Second,
|
NotifyInterval: 30 * time.Second,
|
||||||
AllowedIpNets: func() []*net.IPNet {
|
AllowedIpNets: func() []*net.IPNet {
|
||||||
@@ -129,5 +129,33 @@ func getDefaultFriendlyName() string {
|
|||||||
}
|
}
|
||||||
return ret + ": " + userName + " on " + host
|
return ret + ": " + userName + " on " + host
|
||||||
}
|
}
|
||||||
return ret + ": " + userName + host
|
|
||||||
|
if host == "localhost" { // useless host, use 1st IP
|
||||||
|
ifaces, err := net.Interfaces()
|
||||||
|
if err != nil {
|
||||||
|
return ret + ": " + userName + "@" + host
|
||||||
|
}
|
||||||
|
var list []string
|
||||||
|
for _, i := range ifaces {
|
||||||
|
addrs, _ := i.Addrs()
|
||||||
|
if i.Flags&net.FlagUp == net.FlagUp {
|
||||||
|
for _, addr := range addrs {
|
||||||
|
var ip net.IP
|
||||||
|
switch v := addr.(type) {
|
||||||
|
case *net.IPNet:
|
||||||
|
ip = v.IP
|
||||||
|
case *net.IPAddr:
|
||||||
|
ip = v.IP
|
||||||
|
}
|
||||||
|
if !ip.IsLoopback() {
|
||||||
|
list = append(list, ip.String())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if len(list) > 0 {
|
||||||
|
return ret + " • " + list[0]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ret + ": " + userName + "@" + host
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user