Git Product home page Git Product logo

Comments (13)

penguin-teal avatar penguin-teal commented on September 18, 2024

Hi, does your API key follow the regex ^[a-z0-9]{31,}$? If you don't know what that means, in other words:

  • Does it contain upper-case letters?
  • Does it contain symbols?
  • Is it shorter than 31 characters?

from gnome-openweather.

penguin-teal avatar penguin-teal commented on September 18, 2024

Also for now you can use:

gsettings --schemadir ~/.local/share/gnome-shell/extensions/[email protected]/schemas set org.gnome.shell.extensions.openweatherrefined custom-keys "['', '<KEY>', '', '']"

as pointed out in #57.

from gnome-openweather.

robatino avatar robatino commented on September 18, 2024

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?)

from gnome-openweather.

penguin-teal avatar penguin-teal commented on September 18, 2024

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.

from gnome-openweather.

robatino avatar robatino commented on September 18, 2024

Also for now you can use:

gsettings --schemadir ~/.local/share/gnome-shell/extensions/[email protected]/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/[email protected]/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.

from gnome-openweather.

robatino avatar robatino commented on September 18, 2024

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.

from gnome-openweather.

penguin-teal avatar penguin-teal commented on September 18, 2024

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?

from gnome-openweather.

robatino avatar robatino commented on September 18, 2024

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.

from gnome-openweather.

robatino avatar robatino commented on September 18, 2024

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.

from gnome-openweather.

penguin-teal avatar penguin-teal commented on September 18, 2024

@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.

from gnome-openweather.

ferdnyc avatar ferdnyc commented on September 18, 2024

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/[email protected]/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.

from gnome-openweather.

ferdnyc avatar ferdnyc commented on September 18, 2024

If I manually run this:

$ gsettings --schemadir \
  ~/.local/share/gnome-shell/extensions/[email protected]/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.

from gnome-openweather.

ferdnyc avatar ferdnyc commented on September 18, 2024

(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.)

from gnome-openweather.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.