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
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 全程不用写代码,我用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