V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
V2EX  ›  drymonfidelia  ›  全部回复第 82 页 / 共 88 页
回复总数  1742
1 ... 74  75  76  77  78  79  80  81  82  83 ... 88  
2024 年 2 月 3 日
回复了 drymonfidelia 创建的主题 程序员 tauri 真的太难用了,浪费了我整整一天
@NessajCN 编译好了,请求头还是没设置上 https://i.imgur.com/LdruUj9.png

```
use reqwest::header::HeaderValue;
use tauri::Manager; // Import the Manager trait
fn main() {
struct ReqClient {
client: reqwest::Client,
}
impl ReqClient {
fn new(client: reqwest::Client) -> Self {
Self { client }
}
}

tauri::Builder::default().setup(|app| {
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("app-name", reqwest::header::HeaderValue::from_static("my-app"));
headers.insert("app-ver", reqwest::header::HeaderValue::from_static("1.0-win"));
headers.insert("app-iver", reqwest::header::HeaderValue::from_static("20240202-01M"));

let client = reqwest::Client::builder()
.default_headers(headers)
.build()
.unwrap();
app.manage(ReqClient::new(client));
Ok(())
})
.run(tauri::generate_context!())
.expect("error while running tauri application");
}
```
2024 年 2 月 3 日
回复了 drymonfidelia 创建的主题 程序员 tauri 真的太难用了,浪费了我整整一天
@ie88 tauri 只是拿来当套壳浏览器,不能改动现有网页代码
2024 年 2 月 3 日
回复了 drymonfidelia 创建的主题 程序员 tauri 真的太难用了,浪费了我整整一天
@NessajCN 编译不了啊 failed to resolve: use of undeclared crate or module `reqwest` 全替换成 request 也不行
```
fn main() {
struct ReqClient {
client: request::Client

}
impl ReqClient {
fn new(client: request::Client) -> Self {
Self {client}
}
}
tauri::Builder::default()
.setup( |app| {
let mut headers = request::header::HeaderMap::new();
headers.insert("app-name", header::HeaderValue::from_static("my-app"));
headers.insert("app-ver", header::HeaderValue::from_static("1.0-win"));
headers.insert("app-iver", header::HeaderValue::from_static("20240202-01M"));

let client = request::Client::builder().default_headers(headers).build().unwrap();
app.manage(ReqClient::new(client));
})
}
```
```
error[E0433]: failed to resolve: use of undeclared crate or module `request`
--> src\main.rs:20:22
|
20 | let client = request::Client::builder().default_headers(headers).build().unwrap();
| ^^^^^^^ use of undeclared crate or module `request`

error[E0433]: failed to resolve: use of undeclared crate or module `request`
--> src\main.rs:15:27
|
15 | let mut headers = request::header::HeaderMap::new();
| ^^^^^^^ use of undeclared crate or module `request`
|
help: consider importing this struct
|
1 + use tauri::http::header::HeaderMap;
|
help: if you import `HeaderMap`, refer to it directly
|
15 - let mut headers = request::header::HeaderMap::new();
15 + let mut headers = HeaderMap::new();
|

error[E0433]: failed to resolve: use of undeclared crate or module `header`
--> src\main.rs:16:36
|
16 | headers.insert("app-name", header::HeaderValue::from_static("my-app"));
| ^^^^^^ use of undeclared crate or module `header`
|
help: consider importing this struct
|
1 + use tauri::http::header::HeaderValue;
|
help: if you import `HeaderValue`, refer to it directly
|
16 - headers.insert("app-name", header::HeaderValue::from_static("my-app"));
16 + headers.insert("app-name", HeaderValue::from_static("my-app"));
|

error[E0433]: failed to resolve: use of undeclared crate or module `header`
--> src\main.rs:17:35
|
17 | headers.insert("app-ver", header::HeaderValue::from_static("1.0-win"));
| ^^^^^^ use of undeclared crate or module `header`
|
help: consider importing this struct
|
1 + use tauri::http::header::HeaderValue;
|
help: if you import `HeaderValue`, refer to it directly
|
17 - headers.insert("app-ver", header::HeaderValue::from_static("1.0-win"));
17 + headers.insert("app-ver", HeaderValue::from_static("1.0-win"));
|

error[E0433]: failed to resolve: use of undeclared crate or module `header`
--> src\main.rs:18:36
|
18 | headers.insert("app-iver", header::HeaderValue::from_static("20240202-01M"));
| ^^^^^^ use of undeclared crate or module `header`
|
```
错误太多了贴不完
2024 年 2 月 3 日
回复了 drymonfidelia 创建的主题 程序员 tauri 真的太难用了,浪费了我整整一天
@roycestevie6761 但凡他的 star 数少一点,我早就放弃折腾了
2024 年 2 月 3 日
回复了 drymonfidelia 创建的主题 程序员 tauri 真的太难用了,浪费了我整整一天
@roycestevie6761 正常 v 友推荐的灵车我是不敢碰的,但是 tauri GitHub 上有 73.5k star 感觉很成熟了,试了下,没想到连改个默认请求头都做不到
@lauix 我说的是垃圾号码库 不是模型
@blackmirror 大概率是从熊猫里面逆向出来的 我认识一个同行这么搞
2024 年 1 月 31 日
回复了 drymonfidelia 创建的主题 程序员 怎么把一个 IP 路由指向本机?
查到了条命令,能生效,记录一下

sudo iptables -t nat -A OUTPUT -d 1.2.3.4 -p tcp --dport 20000:30000 -j DNAT --to-destination 10.8.8.8

但是怎么把他写到 ufw 的 before.rules 来持久化?直接写的话 ufw 就无法启动了
2024 年 1 月 31 日
回复了 drymonfidelia 创建的主题 程序员 怎么把一个 IP 路由指向本机?
@my3157 那应该在本机上怎么配置才能本机能访问 1.2.3.4 这个 IP ?只要能访问自己的端口就可以,openid 服务需要
2024 年 1 月 30 日
回复了 drymonfidelia 创建的主题 游戏 专门用来打游戏的电脑用什么操作系统最好?
Windows 10 还是 11 对游戏优化更好?用 LTSC 或者 IoT 版打游戏会不会更稳定?只打游戏,其它功能完全用不上
2024 年 1 月 30 日
回复了 drymonfidelia 创建的主题 游戏 专门用来打游戏的电脑用什么操作系统最好?
@ripperdev 已经有了
@123test1010 问题是把系统翻译排除掉代理就用不了系统翻译了,我家宽带访问 apple.com 会跳转反诈页面,还是 301
@YiPeng0505 因为我 mac 的最常见使用场景是连公司网络摸鱼,公司网络有域名审计,我干脆所有流量全走代理了,没有分流
@ratazzi 系统翻译小火箭代理模式选 None 就可以走代理,不走代理我家宽带连 apple.com 都会 301 到反诈页面,我试过关小火箭用不了翻译
2024 年 1 月 29 日
回复了 zyxcompany 创建的主题 分享创造 🧧红包封面,主打一个不送!
另外你的图这么明显的 AI 痕迹在这里可不好骗人
2024 年 1 月 29 日
回复了 zyxcompany 创建的主题 分享创造 🧧红包封面,主打一个不送!
字都看不见了 主打一个不买
1 ... 74  75  76  77  78  79  80  81  82  83 ... 88  
About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   934 Online   Highest 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 25ms · UTC 21:04 · PVG 05:04 · LAX 14:04 · JFK 17:04
♥ Do have faith in what you're doing.