Taildrop to Downloads, exit nodes past captive portals, stay awake

Ports the rest of CoreDesktop's 9dc5eb1 that applies to Pop!_OS.

- configure tailscale turns on federated-connector-taildrop.service,
  which saves files sent here with Taildrop to Downloads and says so in
  a notification. COSMIC Files has no Scripts menu, so CoreDesktop's
  "Send with Tailscale" isn't ported; send with tailscale file cp.
  Leaving the network turns it off.
- It also installs a NetworkManager dispatcher script that stops using a
  Tailscale exit node while you sign in to a captive portal, and uses it
  again once online. Pop!_OS checks connectivity (20-connectivity-pop),
  so NetworkManager sees the portal.
- A computer joined before this shows Tailscale as to do, and configure
  tailscale adds both without signing in again. update restarts the
  Taildrop service on the new version, as it does the email watcher.
- install.sh keeps the computer from sleeping until an install or update
  finishes.

The pacman guard, unowned files and hardware.sh are Arch only.

Smoketest: 75-taildrop-portal.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-28 19:06:31 -07:00
co-authored by Claude Opus 5.5
parent 7185d6cb3e
commit 0eff0c70d3
10 changed files with 265 additions and 19 deletions
+48 -2
View File
@@ -10,6 +10,11 @@ CORE_CONF="$CONF_DIR/core.conf"
TAILSCALE_CONF="$CONF_DIR/tailscale.conf"
[ -f "$CORE_CONF" ] && source "$CORE_CONF"
[ -f "$TAILSCALE_CONF" ] && source "$TAILSCALE_CONF"
UNITS="$HOME/.config/systemd/user"
TAILDROP_UNIT="federated-connector-taildrop.service"
# NetworkManager runs only dispatcher scripts that root owns and only root can
# change. For the tests: DISPATCHER_DIR.
CAPTIVE_PORTAL="${DISPATCHER_DIR:-/etc/NetworkManager/dispatcher.d}/90-federated-connector-captive-portal"
# Tailscale's own installer adds its apt repository (pkgs.tailscale.com), so
# Pop!_OS' updates keep it up to date. It's downloaded, then run, rather than
@@ -37,9 +42,42 @@ joined() {
&& tailscale status --json 2> /dev/null | jq -e '.BackendState == "Running"' > /dev/null
}
# Done when on the main Core's network
# What goes with being on the network: the service that saves files sent here
# with Taildrop to Downloads (system/taildrop), and the NetworkManager script
# that stops using an exit node while you sign in to a captive portal
# (system/captive-portal). True when both are installed and up to date.
extras_ok() {
cmp -s "$CONNECTOR/system/systemd/$TAILDROP_UNIT" "$UNITS/$TAILDROP_UNIT" \
&& systemctl --user is-enabled -q "$TAILDROP_UNIT" 2> /dev/null \
&& cmp -s "$CONNECTOR/system/captive-portal" "$CAPTIVE_PORTAL"
}
install_extras() {
mkdir -p "$UNITS" && cp "$CONNECTOR/system/systemd/$TAILDROP_UNIT" "$UNITS/" || return 1
systemctl --user daemon-reload
systemctl --user enable "$TAILDROP_UNIT" 2> /dev/null || return 1
systemctl --user restart "$TAILDROP_UNIT" 2> /dev/null
if ! cmp -s "$CONNECTOR/system/captive-portal" "$CAPTIVE_PORTAL"; then
sudo install -D -m 755 -o root -g root "$CONNECTOR/system/captive-portal" "$CAPTIVE_PORTAL" || return 1
fi
echo "Files sent to this computer with Taildrop are saved to Downloads. To send files to"
echo "your other computers on the network: tailscale file cp <file>... <computer>:"
}
remove_extras() {
systemctl --user disable --now "$TAILDROP_UNIT" 2> /dev/null
rm -f "$UNITS/$TAILDROP_UNIT"
systemctl --user daemon-reload
# The captive portal script stays: without an exit node it does nothing
}
# Done when on the main Core's network, with what goes with it
is_configured() {
[ -n "$CORE_DOMAIN" ] && [ "$TAILSCALE_DOMAIN" = "$CORE_DOMAIN" ] && joined
[ -n "$CORE_DOMAIN" ] && [ "$TAILSCALE_DOMAIN" = "$CORE_DOMAIN" ] && joined && extras_ok
}
is_configured_but_extras() {
[ -n "$CORE_DOMAIN" ] && [ "$TAILSCALE_DOMAIN" = "$CORE_DOMAIN" ] && joined &> /dev/null && ! extras_ok
}
# Log out rather than only go down, so this computer's key is expired on
@@ -47,11 +85,18 @@ is_configured() {
leave_network() {
sudo tailscale logout || return 1
rm -f "$TAILSCALE_CONF"
remove_extras
echo "This computer has left your Core's Tailscale network. To join again: configure tailscale"
}
run_configure() {
local choice
# On the network, from before Taildrop and the captive portal script: add
# them without signing in again
if is_configured_but_extras; then
install_extras
return
fi
if joined &> /dev/null; then
echo "This computer is on $TAILSCALE_DOMAIN's Tailscale network (headscale.$TAILSCALE_DOMAIN)."
echo
@@ -90,4 +135,5 @@ run_configure() {
mkdir -p "$(dirname "$TAILSCALE_CONF")"
printf 'TAILSCALE_DOMAIN=%q\n' "$CORE_DOMAIN" > "$TAILSCALE_CONF"
echo "This computer is on your Core's Tailscale network."
install_extras
}