Giter VIP home page Giter VIP logo

Comments (12)

orionna319 avatar orionna319 commented on June 6, 2024 1

如果读取不到尽量给一个默认值,向前兼容。

from running_page.

changchiyou avatar changchiyou commented on June 6, 2024 1
  1. 參考

    1. https://docs.mapbox.com/help/getting-started/access-tokens/#url-restrictions

      image
    2. https://docs.mapbox.com/accounts/guides/tokens/#url-restrictions

      image

    Account | Mapbox - Tokens 新增一個 token:

    image
  2. 並參考

    image

    中的Origin: https://changchiyou.github.io設置URLs

    image image
  3. push commit 更新 Mapbox token changchiyou@c33d7f5

  4. 手動執行 Run Data Sync Github Action:
    image

  5. (✅ 成功)shift+command+R 重整頁面 https://changchiyou.github.io/running_page/

  6. (✅ 成功: 理應失敗,因為沒有從指定的 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
    
    image

from running_page.

yihong0618 avatar yihong0618 commented on June 6, 2024

嗯,对

from running_page.

changchiyou avatar changchiyou commented on June 6, 2024

@yihong0618 我隨意問了下 ChatGPT https://chat.openai.com/share/1db41f61-a363-44fb-a63a-a5701e922bf4 ,請問這是可行的嗎?

如果並非架構問題 / 以前有踩過無法處理的坑,那我會想試試看發 PR 來處理這個問題。

from running_page.

yihong0618 avatar yihong0618 commented on June 6, 2024

@yihong0618 我隨意問了下 ChatGPT https://chat.openai.com/share/1db41f61-a363-44fb-a63a-a5701e922bf4 ,請問這是可行的嗎?

如果並非架構問題 / 以前有踩過無法處理的坑,那我會想試試看發 PR 來處理這個問題。

抱歉哈我忘了,这个 mapbox 怎么处理的了(这块两年没改了),理论上不需要改,我晚上研究研究。

PR welcome

from running_page.

orionna319 avatar orionna319 commented on June 6, 2024

如果觉得有安全问题的话,可以放在settings/secrets/actions。然后在const.ts文件中读取secrets,欢迎PR。

from running_page.

changchiyou avatar changchiyou commented on June 6, 2024

@yihong0618 @orionna319 感謝回復,我晚點處理看看

from running_page.

changchiyou avatar changchiyou commented on June 6, 2024
  • 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 a gh-pages branch. While that's an option, that's not necessarily the right thing to do.

  • https://stackoverflow.com/a/61857467

    image image

如果想藉由改動專案結構來處理這問題,好像不管如何都避不開

from running_page.

changchiyou avatar changchiyou commented on June 6, 2024

@yihong0618 @orionna319 看起來確實如 #643 (comment) 所說不用重構專案,但需要根據 #643 (comment) 更新README.md / 於src/utils/const.ts對應位置上新添加提示 command

from running_page.

orionna319 avatar orionna319 commented on June 6, 2024

好像是的,就算存储在settings/secrets中,在web端也会显示调用MAPBOX_TOKEN

如果想藉由改動專案結構來處理這問題,好像不管如何都避不開

from running_page.

orionna319 avatar orionna319 commented on June 6, 2024

当然比较好的处理方式是,MAPBOX_TOKEN放在settings/secrets下,然后再设置Mapbox-URLs

from running_page.

changchiyou avatar changchiyou commented on June 6, 2024

当然比较好的处理方式是,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 中(滿足包含我在內一部分對資安比較敏感開發者的強迫症 🤣)。

from running_page.

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.