docker desktop url protocl 技术以及使用

docker desktop 在登录的使用使用了自定义的url 协议,同时基于web 进行系统登录,认证完成之后会生成code,之后通过
url 协议进入

使用

  • docker
    协议定义
 
<array>
  <dict>
    <key>CFBundleTypeRole</key>
    <string>Editor</string>
    <key>CFBundleURLName</key>
    <string>docker-desktop</string>
    <key>CFBundleURLSchemes</key>
    <array>
      <string>docker-desktop</string>
    </array>
  </dict>
</array>

js 使用
https://d36jcksde1wxzq.cloudfront.net/9241.d6356172711deaa97954.js
处理

 
function v() {
        const {search: a} = (0,
        s.TH)()
          , e = p()
          , c = `docker-desktop://auth0/complete-login${a}`;
        return (0,
        l.useEffect)((()=>{
            window.Cypress || (window.location.href = c)
        }
        ), [c]),
        l.createElement(l.Fragment, null, l.createElement(h.ql, {
            title: "Redirecting..."
        }), l.createElement(t.Z, {
            maxWidth: "sm",
            className: e.root,
            "data-testid": "desktop-auth-page"
        }, l.createElement(m.Z, {
            className: e.logo
        }), l.createElement(n.Z, {
            className: e.paper
        }, l.createElement(r.Z, {
            variant: "h2",
            component: "h1",
            className: e.title
        }, "You're almost done!"), l.createElement(r.Z, {
            className: e.explanation
        }, "We're redirecting you to the desktop app. If you don't see a dialog, please click the button below."), l.createElement(o.Z, {
            href: c,
            variant: "contained",
            color: "primary"
        }, "Proceed to Docker Desktop"))))
    }
}

参考请求格式

docker-desktop://auth0/complete-login?code=<code>

说明

app protocl 在一些基于web 认证的桌面应用中使用比较多,比如electron 就支持app protocl 可以方便的做一些认证集成
语雀,飞书等应用都已经默认包含了自己的url protocl

参考资料

https://www.npmjs.com/package/protocol-registry
https://github.com/Shubham-Kumar-2000/protocol-registry
https://stackoverflow.com/questions/18534591/how-to-register-a-url-protocol-handler-in-node-js/67231906#67231906
http://www.electronjs.org/docs/latest/api/protocol

posted on   荣锋亮  阅读(122)  评论(0编辑  收藏  举报

相关博文:
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· 记一次.NET内存居高不下排查解决与启示
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· .NET10 - 预览版1新功能体验(一)
历史上的今天:
2020-10-14 apache ignite docker集群运行试用
2020-10-14 rr一款强大的应用请求录制以及回放框架
2020-10-14 追踪postgres 后端调用情况
2020-10-14 重置idea 配置的方法
2020-10-14 jdbc连接池工具与pg fdw连接的问题
2019-10-14 ent 基本使用八 索引
2019-10-14 ent 基本使用七 Config

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5
点击右上角即可分享
微信分享提示