Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show tailscale devices and their status #5

Closed
wants to merge 0 commits into from

Conversation

gustakasn0v
Copy link
Contributor

@gustakasn0v gustakasn0v commented Oct 7, 2023

Context

I was debugging my Steam Deck not establishing a direct connection with my home router. It's rather cumbersome to switch to desktop mode to run tailscale status on a terminal, especially if you don't have mouse and keyboard. So this PR allows users to see the status of their tailscale network directly from the Decky Loader.

Changes

  • Shows a very rudimentary text output from tailscale status if the tailscale network is up
  • Refreshes it every 5s

I appreciate the UI is most likely not ready for publishing to the Decky store; I mostly did this to help myself while debugging my network, but happy to take feedback and polish this until it's ready for publishing (if we agree this is a worthwhile feature)

Screenshot

imgonline-com-ua-dexifbMMU1LBmqHDo

main.py Outdated
@@ -21,3 +21,7 @@ async def down(self):
async def get_tailscale_state(self):
result = not subprocess.call(["tailscale", "status"], timeout=10)
return result

async def get_tailscale_devices(self):
result = subprocess.getoutput("tailscale status | awk -v name=2 -v status=5 -v status2=6 -v status3=7 '{print $name,$status,$status2,$status3}'")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple ideas to make this more structured, and so easier to interpret by the UI:

  1. Use tailscale status --json, parse it on Python: This would allow us to use an intermediary data structure to store devices data
  2. Use https://github.com/pulumi/pulumi-tailscale: You get much richer interaction with Tailscale which opens the door for many more features, but adds a new dependency (and the issues that come along: updating, testing, etc) and complicates setup (we'll need to come up with a way for users to provide their Tailscale API key)

src/index.tsx Outdated
</PanelSectionRow>
<PanelSectionRow>
<div>Tailscale Devices</div>
{tailscaleDevices}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Happy to take others' guidance here, didn't find much in https://github.com/SteamDeckHomebrew/decky-plugin-database/tree/main/plugins that showcases complex text layouts (eg. a table?) to better show this data

@saumya-banthia
Copy link
Owner

saumya-banthia commented Oct 7, 2023

Context

I was debugging my Steam Deck not establishing a direct connection with my home router. It's rather cumbersome to switch to desktop mode to run tailscale status on a terminal, especially if you don't have mouse and keyboard. So this PR allows users to see the status of their tailscale network directly from the Decky Loader.

Changes

  • Shows a very rudimentary text output from tailscale status if the tailscale network is up
  • Refreshes it every 5s

I appreciate the UI is most likely not ready for publishing to the Decky store; I mostly did this to help myself while debugging my network, but happy to take feedback and polish this until it's ready for publishing (if we agree this is a worthwhile feature)

Screenshot

imgonline-com-ua-dexifbMMU1LBmqHDo

Will take a look, at a cursory glance it seems like a good feature addon, might take me a few weeks to get to this since I work on this as a hobby.

EDIT: The screenshot wasn't visible until I dropped this comment, and you are right the UI for the status would definitely require polish

@saumya-banthia
Copy link
Owner

@gustakasn0v I will be closing this PR soon, but will be mentioning this as the reason for this feature addon. I've pushed a version which has the capability to view device names and their status, I am thinking of using Modals and lists to replace the current version, but for now, HTML tables would have to do. I'll wait a few days for your response in case you have something to add, else I will raise a PR to plugin DB and close this one.

@gustakasn0v
Copy link
Contributor Author

Sounds good, thanks for building the feature! I didn't have time to fully implement the UI myself, and this quick-and-dirty PR helped me get my setup working anyway, so looking forward to the new version of the plugin!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants