Closed robatino closed 5 months ago
Hi, does your API key follow the regex ^[a-z0-9]{31,}$
? If you don't know what that means, in other words:
Also for now you can use:
gsettings --schemadir ~/.local/share/gnome-shell/extensions/openweather-extension@penguin-teal.github.io/schemas set org.gnome.shell.extensions.openweatherrefined custom-keys "['', '<KEY>', '', '']"
as pointed out in #57.
My WeatherAPI.com key is 30 character hexadecimal, just digits plus the lower case letters a-f. BTW, my Visual Crossing API key is 25 characters, alphanumeric, with upper case letters, and that saves fine. So does my OpenWeatherMap key which is 32 chars, hexadecimal, lower case a-f. (When I say they save fine, I mean that there's a square with a check mark next to each of those. What does that mean - as opposed to the warning sign from WeatherAPI.com?)
Somehow your key was shorter than mine so I've reduced the requirement to 5 or more characters now, before it was 31 or more which is why it was detecting your key as invalid.
Also for now you can use:
gsettings --schemadir ~/.local/share/gnome-shell/extensions/openweather-extension@penguin-teal.github.io/schemas set org.gnome.shell.extensions.openweatherrefined custom-keys "['', '<KEY>', '', '']"
as pointed out in #57.
Thanks for pointing that out. When I ran the command gsettings --schemadir ~/.local/share/gnome-shell/extensions/openweather-extension@penguin-teal.github.io/schemas get org.gnome.shell.extensions.openweatherrefined custom-keys
to see what my existing settings were, it was ['openweathermapkey', '', 'visualcrossingkey']
. I ran the set command to include the WeatherAPI.com key, and also added a fourth blank entry, so now it's ['openweathermapkey', 'weatherapikey', 'visualcrossingkey', '']
. The WeatherAPI.com API key shows up in the UI now (though I'm not sure if it's permanent yet) but it still has the warning sign next to it.
I just ran the get command again, and the output is now ['openweathermapkey', '', 'visualcrossingkey', '']
. So it apparently removes a key automatically if it's detected as invalid.
The fourth key entry is fine, but it shouldn't be deleting any keys even if they're invalid. Were you toggling "Use Custom Key" on/off?
I may have toggled it, but I'm not sure. Experimenting with the gsettings commands, it appears that toggling it off causes the corresponding key to be deleted, for any of the providers, whether the key is considered valid or not. Personally, I don't like that behavior, I'd prefer to be able to enter the key once and then be able to toggle "Use Custom Key" to control whether it's used, without having to re-enter it each time I toggle it back on.
Edit: Also, if turning "Use Custom API Key" off and then back on causes the key to be automatically deleted, then it's not really a toggle, since one ends up in a different state than originally. If I wanted to change or erase the key, I'd expect to be able to turn "Use Custom API Key" on, and then manually change or erase the key value in the box.
I sent an email to WeatherAPI.com asking them about the length and format of their API keys and got the response "Our API key is max 31 characters and is comprised of alphabets and numbers." Not too detailed but it seems that 31 chars is the maximum, not minimum.
@robatino thanks for the UI advice, I'll take it into consideration in the re-work I'm doing.
Thanks for emailing them, that's interesting.
I'm still having this issue with version 138, please reopen. If I enable "Use custom API key" and paste in my WeatherAPI key, then close settings and reopen, the key is gone.
Right now the extension built-in key is returning "too many users" errors, which may be part of the issue. But it's definitely blanking my key.
Also, if I paste my key into the settings (with "Use custom API key" switched on), this is what I get in the terminal (either with the Settings window still open, or after closing it):
$ gsettings --schemadir \
~/.local/share/gnome-shell/extensions/openweather-extension@penguin-teal.github.io/schemas \
get org.gnome.shell.extensions.openweatherrefined custom-keys
['', '', '']
Notice that the array only has three items, when apparently it should have four? Sounds like the code might not be properly accounting for older settings with different numbers of custom keys.
If I manually run this:
$ gsettings --schemadir \
~/.local/share/gnome-shell/extensions/openweather-extension@penguin-teal.github.io/schemas \
set org.gnome.shell.extensions.openweatherrefined custom-keys \
['', '<KEY>', '', '']
...Then the key sticks around, shows up in the Settings window, and works. But setting it via the UI doesn't work, if the gsettings
value starts as ['', '', '']
due to older preferences.
(Sorry, I guess this is more a manifestation of #57 than #58. But that report is definitely not 'invalid'. This is an issue with v138, which appears to be caused by the change in preferences format from older versions of the extension.)
Description
Starting with version 137 (I think) I've been unable to permanently save my personal API for WeatherAPI.com. After toggling "Use Custom API Key" to On, I can enter it, but there is always a warning symbol (triangle with exclamation point) to the left of it (as opposed to a square with a check mark next to my personal API keys for the other two providers). Even if it initially appears to be saved, it eventually disappears. I asked in the other ticket what that warning symbol meant, but never got a response. With version 138, I now get a weather forecast if I choose any of the 3 providers (or Adaptive), but the personal key for WeatherAPI.com still isn't saved properly, and the warning symbol is always to the left of it. I'm hoping that maybe I just need to delete/reset something and that the bug isn't in the extension anymore.
System
Fedora 40
Settings
{"app-version":"138","git-version":"138.r0.g6367a11","gnome-version":"46.2","user-locale":"en","unit":"'fahrenheit'","custom-keys":["","",""],"appid":"","actual-city":"0","weather-provider":"'default'","has-run":"true","days-forecast":"5","decimal-places":"1","locs":[{}],"show-sunsetrise-in-panel":"false","last-init-error":"'(2024/05/11) TypeError: settings.set_value is not a function'","weatherapidotcom-key":"","simplify-degrees":"false","use-system-icons":"false","geolocation-appid-mapquest":"","clock-format":"'24h'","menu-alignment":"62.5","position-in-panel":"'center'","wind-speed-unit":"'mph'","show-comment-in-panel":"true"}