桥接
易用性 | |
拓展性 | |
性能 | |
安全性 |
优点:
- 高度可配置
- 不需要 Rust 技能
- 一些 WebAPI 不可用
- 实现有挑战
#
说明桥接方法是一种安全模式,消息通过使用 API 的隐式桥接,在 brokers 之间传递。它将功能隔离在作用域之外,并传递消息而不是功能。
#
示意图graph TD
H==>F
subgraph WEBVIEW
F-.-E
end
D-->E
E-->D
B-->D
D-->B
subgraph RUST
A==>H
A-->B
B-.-C
B-.-G
end
A[Binary]
B{Rust Broker}
C[Subprocess 2]
G[Subprocess 1]
D(( API BRIDGE ))
E{JS Broker}
F[Window]
H{Bootstrap}
style D fill:#ccc,stroke:#333,stroke-width:4px,color:white
style RUST fill:#fad3a9,stroke:#F28918,stroke-width:4px
style WEBVIEW fill:#abd0f9,stroke:#1D81EE,stroke-width:4px
#
配置这是你需要在你的 tauri.conf.json 中添加的配置:
"tauri": {
"allowlist": { // all API values are default false
"all": false, // use this flag to enable all API features
"shell": {
"execute": false, // enable application execution
"open": false, // open link/path in the default app
},
"fs": {
"listFiles": false, // list files in a directory
"readBinaryFile": false, // read binary file from local filesystem
"readTextFile": false, // read text file from local filesystem
"setTitle": false, // set the window title
"writeFile": false // write file to local filesystem
}
}
}