shdown / luastatus

universal status bar content generator
GNU General Public License v3.0
295 stars 12 forks source link

Add weather widget examples #61

Closed Layerex closed 4 years ago

Layerex commented 4 years ago

Add a widget, which shows current state of weather in a specified location. That is my first pull request, I hope I did everything alright

shdown commented 4 years ago
  1. Thanks for the pull request! I would like to merge it after the following issues are addressed.

  2. I think it's better to use HTTPS, even if the particular content (weather data) is not security-sensitive — in order not to “set a bad example” for others. Also, you never know which content will turn out to be security-sensitive in the future.

  3. Both cURL and luacurl seem to be abandoned and unmaintained. Unfortunately, this situation is too common with Lua modules. I would rather use luasec and LuaSocket, which seem to be at least somewhat actively maintained. See the examples/*/btc-price.lua for how to perform an HTTPS request with it.

  4. URL encoding is no hard task; I think it’s better to implement it manually rather than introduce a dependency:

    function urlencode(s)
    return string.gsub(s, '[^-_.~a-zA-Z0-9]', function(c)
        return string.format('%%%02X', string.byte(c))
    end)
    end
shdown commented 4 years ago

Merged, thanks!

NigamanRPG commented 4 years ago

nice widget and contests interesting!