Closed changchiyou closed 2 months ago
嗯,对
@yihong0618 我隨意問了下 ChatGPT https://chat.openai.com/share/1db41f61-a363-44fb-a63a-a5701e922bf4 ,請問這是可行的嗎?
如果並非架構問題 / 以前有踩過無法處理的坑,那我會想試試看發 PR 來處理這個問題。
@yihong0618 我隨意問了下 ChatGPT https://chat.openai.com/share/1db41f61-a363-44fb-a63a-a5701e922bf4 ,請問這是可行的嗎?
如果並非架構問題 / 以前有踩過無法處理的坑,那我會想試試看發 PR 來處理這個問題。
抱歉哈我忘了,这个 mapbox 怎么处理的了(这块两年没改了),理论上不需要改,我晚上研究研究。
PR welcome
如果觉得有安全问题的话,可以放在settings/secrets/actions。然后在const.ts
文件中读取secrets
,欢迎PR。
如果读取不到尽量给一个默认值,向前兼容。
@yihong0618 @orionna319 感謝回復,我晚點處理看看
https://stackoverflow.com/a/21941683
In short, no. If your GitHub repo is public, all its assets are public. You can make the repo private and it will still publish on GitHub Pages if named with the
username.github.io
convention or if it has agh-pages
branch. While that's an option, that's not necessarily the right thing to do.
https://stackoverflow.com/a/61857467
如果想藉由改動專案結構來處理這問題,好像不管如何都避不開
參考
https://docs.mapbox.com/help/getting-started/access-tokens/#url-restrictions
https://docs.mapbox.com/accounts/guides/tokens/#url-restrictions
到 Account | Mapbox - Tokens 新增一個 token:
並參考
中的Origin: https://changchiyou.github.io
設置URLs
push commit 更新 Mapbox token https://github.com/changchiyou/running_page/commit/c33d7f56641f4fe77cfa585183ce79bf3a67acb8
手動執行 Run Data Sync Github Action:
(✅ 成功)shift+command+R 重整頁面 https://changchiyou.github.io/running_page/
(✅ 成功: 理應失敗,因為沒有從指定的 origin URL 發 request)curl 2.
中的 request:
curl https://api.mapbox.com/v4/mapbox.mapbox-streets-v8,mapbox.mapbox-terrain-v2.json\?secure\&access_token\=pk.eyJ1IjoiY2hhbmdjaGl5b3UiLCJhIjoiY2x1cXd2MWRxMDExZzJqcXJyNTVjbnVwOSJ9.hOsDM-tbwwCAAsDHWHYkFQ
@yihong0618 @orionna319 看起來確實如 https://github.com/yihong0618/running_page/issues/643#issuecomment-2041976662 所說不用重構專案,但需要根據 https://github.com/yihong0618/running_page/issues/643#issuecomment-2042668580 更新README.md
/ 於src/utils/const.ts
對應位置上新添加提示 command
好像是的,就算存储在settings/secrets
中,在web端也会显示调用MAPBOX_TOKEN
如果想藉由改動專案結構來處理這問題,好像不管如何都避不開
当然比较好的处理方式是,MAPBOX_TOKEN
放在settings/secrets
下,然后再设置Mapbox-URLs
。
当然比较好的处理方式是,
MAPBOX_TOKEN
放在settings/secrets
下,然后再设置Mapbox-URLs
。
@orionna319 如果你上面那段(關於Mapbox-URLs
這看不大懂)指的是 https://stackoverflow.com/questions/21939713/hide-api-key-for-a-github-page/61857467#61857467 :
確實,資安不求完美但也不嫌多,這樣的做法雖說不能避免 Client 端從瀏覽器開發者工具看到 Mapbox token,但確實能避免明碼將 token 寫在 repo 中(滿足包含我在內一部分對資安比較敏感開發者的強迫症 🤣)。
https://github.com/yihong0618/running_page/blob/e05b665865af61071eab78d042cf9257b38fef9f/src/utils/const.ts#L3