EasyIME / forum

8 stars 1 forks source link

[討論] 新的 web-based 設定工具 #12

Open PCMan opened 8 years ago

PCMan commented 8 years ago

目前想到了可以安全可靠的在 local 跑只能讓目前使用者登入的 web service 的方式

  1. 用 python 啟動 backend daemon,random 選可用 port
  2. 在 backend daemon 內產生一個亂數 (uuid) 作為 access token
  3. 在目前 user 的家目錄下,產生如下的 html 檔案
<html><body>
    <form id="redirect" method="POST" action="http://localhost:<PORT NUMBER>/">
        <input name="token" value="<RANDOM>" type="hidden" />
    </form>
    <script type="text/javascript">
        document.getElementById("redirect").submit();
    </script>
</body></html>
  1. 用瀏覽器開啟此 html 檔案,接著就會以 http post 輸入 token redirect 到 local server (而且只有目前使用者可以訪問)
  2. 結束後刪除此暫存 html 檔,下次啟動設定工具時重新產生一個

優點:

  1. 即使是在 localhost 同時登入 Windows 的其他使用者,也可以確保無法取得 token,不會連上目前使用者的 server 亂搞
  2. 不再需要用 hta,可以以一般瀏覽器打開網址 (google chrome, firefox, ...)

@jessy1092 @KenLuoTW 覺得這樣的設計合理嗎?

sangjeedondrub commented 7 years ago

electron 套个壳呢?