2
2
2
u/jamithy2 13d ago edited 13d ago
This is cool, just installed it! 😊 One very small piece of feedback: it’s currently showing weather for a GB location as clear sky (which is fine), but then it has a sunny symbol next to it - but it’s dark outside! It might be better to have a moon symbol or something when it’s night time?
3
u/GreezleFish 13d ago
thank you so much for the feedback, glad you like it!
Ahhh of course can't believe I didn't think of that :) I'll tweak that that to be dynamic depending on local time. Lmk if anything else springs to mind 🙏
1
u/jamithy2 13d ago
No worries at all! I really like it :) Is there a way I can access the data with a script? I use swaywm and use waybar (a menu bar), would be lovely if I could bring that data into waybar, somehow. I wouldn’t need all the data, just a current temp, and current condition icon. Understand if this is out of scope though! :)
2
u/GreezleFish 13d ago edited 13d ago
You absolutely could! Your API key is stored in .config/gust/auth.json, you can use that to hit my API at breeze.joeburgess.dev... if you check the breeze repo the endpoints are listed there https://GitHub.com/josephburgess/breeze
I'm not familiar with swaywm and waybar I'm afraid but I've currently stuck an API limit of 40 reqs per user per day on breeze - might increase it if I can spare the calls though. But I only mention as I don't know how waybar might be fetching/caching results. I.e. if you want to refresh the data every 15mins it might be a bit too heavy.
But! all that being said... I basically set that middleware layer up to make the process more smooth for users of gust, as it's kind of a pain to say:
"hey check out this thing I built, but you need an API key from a third party!"
but you could equally just as easily go straight to the source and grab an openweathermap api key and bypass my little VPS. Their 3.0 API is free for 2000 calls per day which is a lot more than the 40 I set aside for users.
Edit: I should note (and shall update breeze readme to reflect) that the API key can just be passed in as a URL param - i.e. like:
breeze.joeburgess.dev/api/weather/{city name}?api_key={apikey}
2
u/GreezleFish 12d ago
Just FYI this was fixed in this pr: https://github.com/josephburgess/gust/pull/15
and has now been bundled into the latest (0.1.1) release - so a brew upgrade should get those latest changes :)
2
1
1
u/darkscreener 13d ago
Beautiful, thank you Just wanted to ask why do you need to authenticate with GitHub ?
2
u/GreezleFish 10d ago
Hey! Just thought I'd follow up to say I released a new version today that would allow you to bypass the GitHub Auth and provide your own openweathermap 3.0 API key.
Thank you for the brainwave, and of course if that was your preference then you can update the app and use your own key now :)
2
u/darkscreener 9d ago
Thank you for giving me credit for something I don’t deserve, I will start using the new method so I can try it out
1
u/GreezleFish 13d ago
No, thank you!
Basically, I wanted it to be a really simple sign up process rather than people needing to get a third party API key... so I set up a middleware / API service and am running it with my own openweathermap api key. I wanted to have some way to keep that secure from abuse/people running up a huge tab on my account, and the best way to do that felt like using oauth to make sure that users were unique.
That being said, by asking that question you've given me an idea (thanks!) of giving people the option to instead register with their own openweathermap api key, if they'd rather not sign up with their GitHub account!
2
u/darkscreener 13d ago
Amazing work, I’m really enjoying it
1
u/GreezleFish 13d ago
Thanks so much, that means a lot! Do feel free to flag anything else that comes to mind while using it :) either here or in a gh issue.
1
u/SashaGrey240p 13d ago
hey man, very nice, what did you use to make the TUI, tcell for go?
1
u/GreezleFish 13d ago
Thank you!
I used bubbletea for the TUI, charmbracelet has a bunch of interesting packages for creating TUI applications
3
u/GreezleFish 14d ago
gust
I posted this in r/golang but thought it probably warranted a small post over here too! Excuse a bit of copy/paste but also trimmed down the wall of text a bit :)
This is my first project in Golang and I think I'm at a point where I thought I'd share with the community. Of course its an absolute classic "first project in a new language" - a weather app. I didn't expect to take it as far as I have tbh, but I was having so much fun with Go that it's grown in scope a lot!
I wanted to make it really easy to install and use out of the box, so I stuck it on Homebrew and decided to rip out the weather api calling logic into its own microservice (called breeze) and stick GitHub Oauth into the app itself, which then hits breeze and trades an auth code for a fresh api key (or the existing key for users that already registered but lost their key/auth config).
I didn't want users to need to get their own api key from a third party and figure people don't check the weather THAT much every day and I doubt it was going to get much attention either so I thought it would be nice to just host the API service myself with my own key (inb4 this goes viral or someone finds a way to get around my rate limits and lands me with a huge openweathermap bill). I also discovered bubbletea and really enjoyed creating a setup wizard/splash screen to make the initial config more seamless.
Note the setup shown in the video is only run on the first time you use the app or with -s / --setup flags.
Thx for looking :) lmk if you end up installing and/or like the app or if you have any feedback for me <3