brookhong / Surfingkeys

Map your keys for web surfing, expand your browser with javascript and keyboard.
https://chrome.google.com/webstore/detail/surfingkeys/gfbliohnnapiefjpjlpjnehglfpaknnc
MIT License
5.39k stars 478 forks source link

Environment variables #1308

Closed sigfriedCub1990 closed 4 years ago

sigfriedCub1990 commented 4 years ago

Prelude

Error details

SurfingKeys: 0.9.66

Browser: Firefox Nightly OS: Mac

Context

First of I want to congrats the creator because this is an awesome extension and it has become an integral part of my workflow, hence I can't even imagine working without it.

Recently I developed an extension for the registerInlineQuery to consult the Merrian-Webster dictionary, the access to the API is restricted by a token. Hence in order to query the API you must include the token in some way.

I would love to have the ability to store some sensible values and when the extension is loaded that those values get substituted "automagically".

brookhong commented 4 years ago

You can create some variable under runtime.conf and use it later in your snippets, such as

runtime.conf.myApiToken = "test_token";
mapkey('<Alt-f>', 'show my api token', function() {
    Front.showBanner(runtime.conf.myApiToken);
});