CodeSkool

localStorage
WARNING: Anyone who has access to your browser can look into the security keys and steal the API keys. We highly recommend avoid doing that, as it can cause severe legal issues and financial risks.

Sometimes for testing, or rapid prototyping, or when you are showcasing your project to someone, you don’t want to show or enter the API keys in front of others, and wish the keys would be read automatically from somewhere else. Now you have a way, to store the keys in the browser localStorage.

When you press F12 on a website, and goes into the Application tab, in the Storage section, you can view all the keys and its values stored under localStorage. Note, when you enter the keys in the Scratch blocks, it won’t be automatically saved to localStorage. But if you manually save the keys in the localStorage, then when you load the extension, it will automatically read those keys and initialize the corresponding objects. IP addresses are automatically saved to localStorage for easy connection, but the API keys are not saving automatically, and you need to manually create or delete them as and when required.

Here are the list of keys and their description, that can you manually create in the browser localStorage.

Key NameKey Description
HF_ACCESS_TOKENHugging Face API token
OPEN_WEATHER_MAP_API_KEYOpen Weather API Key
Ollama_IPAddressIP address and port of the Ollama server, like: http://127.0.0.1:11434, if not localhost in a school environment
TTS_VOICE_NAMEDefault TTS voice name to use
CodeCraftGamePadIPCode Craft gamepad IP address
mobileGamePadIPAddressAndroid Gamepad App IP address
MQTT_SERVER_URLMQTT Server URL to be used
esp32OctoStudioIPOcto Studio App mobile IP address
editorFontSizeCode editor default font size on load, last font size manually changed is saved automatically

Leave a Reply