Skip to content

Commit f0fc904

Browse files
authored
Merge pull request #649 from noamsto/fix/tailscale-taildrop-hostname
fix(tailscale): use Tailscale DNS name for taildrop send
2 parents cbd8892 + 2b2fcef commit f0fc904

2 files changed

Lines changed: 31 additions & 7 deletions

File tree

tailscale/Main.qml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,13 @@ Item {
127127
return label || hostName;
128128
}
129129

130+
// Extract the Tailscale short name from DNSName (e.g. "tp-g6.tail68e513.ts.net." → "tp-g6").
131+
// This is what `tailscale file cp` and other commands expect as a target.
132+
function tailscaleName(dnsName) {
133+
if (!dnsName) return ""
134+
return dnsName.split(".")[0] || ""
135+
}
136+
130137
Process {
131138
id: whichProcess
132139
stdout: StdioCollector {}

tailscale/Panel.qml

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@ Item {
3333
initialPath: Quickshell.env("HOME") ?? ""
3434
onAccepted: function(paths) {
3535
if (!mainInstance || !root.sendTargetPeer || paths.length === 0) return
36-
var target = root.sendTargetPeer.HostName + ":"
36+
// Use Tailscale DNS name (not system HostName) to avoid LAN DNS resolution
37+
var tsName = mainInstance.tailscaleName(root.sendTargetPeer.DNSName)
38+
var target = (tsName || root.sendTargetPeer.TailscaleIPs[0]) + ":"
3739
mainInstance.sendFilesViaTaildrop(paths, target)
3840
}
3941
}
@@ -510,7 +512,7 @@ Item {
510512
Layout.fillWidth: true
511513
Layout.preferredWidth: peerFlickable.width
512514
implicitWidth: peerFlickable.width
513-
height: 48
515+
implicitHeight: contentItem.implicitHeight + topPadding + bottomPadding
514516
topPadding: Style.marginS
515517
bottomPadding: Style.marginS
516518
leftPadding: Style.marginL
@@ -519,6 +521,7 @@ Item {
519521
readonly property var peerData: modelData
520522
readonly property string peerIp: filterIPv4(peerData.TailscaleIPs)[0] || ""
521523
readonly property string peerHostname: peerData.HostName || normalizeFqdn(peerData.DNSName) || "Unknown"
524+
readonly property string peerTsName: mainInstance ? mainInstance.tailscaleName(peerData.DNSName) : ""
522525
readonly property bool peerOnline: peerData.Online || false
523526

524527
background: Rectangle {
@@ -538,12 +541,26 @@ Item {
538541
color: peerDelegate.peerOnline ? Color.mPrimary : Color.mOnSurfaceVariant
539542
}
540543

541-
NText {
542-
text: peerDelegate.peerHostname
543-
color: Color.mOnSurface
544-
font.weight: Style.fontWeightMedium
545-
elide: Text.ElideRight
544+
ColumnLayout {
545+
spacing: 0
546546
Layout.fillWidth: true
547+
548+
NText {
549+
text: peerDelegate.peerHostname
550+
color: Color.mOnSurface
551+
font.weight: Style.fontWeightMedium
552+
elide: Text.ElideRight
553+
Layout.fillWidth: true
554+
}
555+
556+
NText {
557+
text: peerDelegate.peerTsName
558+
pointSize: Style.fontSizeXS
559+
color: Color.mOnSurfaceVariant
560+
elide: Text.ElideRight
561+
Layout.fillWidth: true
562+
visible: peerDelegate.peerTsName !== "" && peerDelegate.peerTsName !== peerDelegate.peerHostname
563+
}
547564
}
548565

549566
NIcon {

0 commit comments

Comments
 (0)