Pydeck_chart on Streamlit Questions

I tried to embed a map like the following URL in streamlit and publish it, but I couldn’t solve the problem, so I’d like to ask a question
I just started using streamlit, so please let me know if I’m saying something weird :grinning:

Reference Example_pydeck(terrain_layer)
https://deckgl.readthedocs.io/en/latest/gallery/terrain_layer.html

My streamlit code

import pydeck as pdk
import streamlit as st

TERRAIN_IMAGE = "https://s3.amazonaws.com/elevation-tiles-prod/terrarium/{z}/{x}/{y}.png"
SURFACE_IMAGE = f"https://api.mapbox.com/v4/mapbox.satellite/{{z}}/{{x}}/{{y}}@2x.png? access_token={MAPBOX_API_KEY}"
ELEVATION_DECODER = {"rScaler": 256, "gScaler": 1, "bScaler": 1 / 256, "offset": -32768}
terrain_layer = pdk.Layer("TerrainLayer", elevation_decoder=ELEVATION_DECODER, 
texture=SURFACE_IMAGE, elevation_data=TERRAIN_IMAGE)
r = pdk.Deck(layers=terrain_layer)
st.pydeck_chart(r)
st.components.v1.html(r.to_html(as_string=True),height=500)

1.The first map reloads the layers when you move it a bit.
I want it to work like the second map.

2.If I make it like the second map
I think it’s a bad implementation because it exposes the MAPBOX API KEY.(API KEY including html)

3.I want to prohibit the menu from appearing when right-clicking on the MAP.
For the second map, we could do something like this

r.to_html(as_string=True).replace("<body>","<body oncontextmenu='return false'>")

I think I can’t use this one because of the second thing.

My environment is Below

streamlit==0.82.0
pydeck==0.6.1

You can use streamlit secrets to hide your mapbox api key.

https://docs.streamlit.io/en/stable/deploy_streamlit_app.html#secrets-management

At the Time of executing ‘.to_html()’ function,
It’s seems be like API KEY is including .html files.

I’ve tried that(use secrets.toml) in my environment.
The result is the same.
.html including API KEY
It’s likes Below

 const jsonInput = {"initialViewState":...........https://api.mapbox.com/v4/mapbox.satellite/{z}/{x}/{y}@2x.png?access_token=pk.xxxxxxxxxxxxxxxxxxx

So I wondered if I shouldn’t use embedding with to_html() for pydeck.