调整
This commit is contained in:
@@ -53,11 +53,9 @@ pub mod events {
|
||||
// 截图
|
||||
pub const SCREENSHOT_SHORTCUT: &str = "screenshot-shortcut";
|
||||
pub const SCREENSHOT_PIN_SHORTCUT: &str = "screenshot-pin-shortcut";
|
||||
/// 截图结果导出(含覆盖层/编辑器/滚动截图会话)
|
||||
pub const SCREENSHOT_EXPORTED: &str = "screenshot-exported";
|
||||
/// 滚动截图会话:实时进度 { width, height, auto }
|
||||
pub const SCROLL_PROGRESS: &str = "screenshot-scroll-progress";
|
||||
/// 滚动截图会话:完成并导出(负载与 SCREENSHOT_EXPORTED 相同)
|
||||
/// 滚动截图会话:完成并导出
|
||||
pub const SCROLL_COMPLETE: &str = "screenshot-scroll-complete";
|
||||
/// 滚动截图会话:已取消(无负载)
|
||||
pub const SCROLL_CANCELLED: &str = "screenshot-scroll-cancelled";
|
||||
|
||||
@@ -3,10 +3,9 @@
|
||||
//! fnId → 网关 `https://5ddd.com/api/v1/fn/con`(authx md5 签名)→ 内网/公网/中继候选 →
|
||||
//! 探测可达性 → 得到可用的 base_url(含 mode=relay 的中继地址)。
|
||||
|
||||
use md5::Md5;
|
||||
use md5::{Digest, Md5};
|
||||
use rand::RngCore;
|
||||
use serde_json::{json, Value};
|
||||
use sha2::{Digest, Sha256};
|
||||
|
||||
/// 网关地址与签名常量(对齐 feiniu-car-music)。
|
||||
const FN_CONNECT_URL: &str = "https://5ddd.com/api/v1/fn/con";
|
||||
@@ -19,12 +18,6 @@ fn md5_hex(input: &str) -> String {
|
||||
format!("{:x}", h.finalize())
|
||||
}
|
||||
|
||||
fn sha256_hex(input: &str) -> String {
|
||||
let mut h = Sha256::new();
|
||||
h.update(input.as_bytes());
|
||||
format!("{:x}", h.finalize())
|
||||
}
|
||||
|
||||
/// 从输入识别 fnId:`fnos.net/<id>`、`<id>.5ddd.com`、或裸 fnId。
|
||||
pub fn extract_fn_id(input: &str) -> Option<String> {
|
||||
let s = input.trim();
|
||||
@@ -159,8 +152,3 @@ pub async fn resolve_base_url(fn_id: &str) -> Result<(String, bool), String> {
|
||||
}
|
||||
Err(format!("FnConnect 候选均不可达({} 个)", candidates.len()))
|
||||
}
|
||||
|
||||
/// sha256 hex(登录用)。
|
||||
pub fn sha256_hex_pub(input: &str) -> String {
|
||||
sha256_hex(input)
|
||||
}
|
||||
|
||||
@@ -202,16 +202,4 @@ pub fn mime_of(name: &str) -> &'static str {
|
||||
}
|
||||
}
|
||||
|
||||
/// 保留给调用方校验配置完整性。
|
||||
pub fn validate(cfg: &WebDavConfig, dir: &str) -> Result<(), String> {
|
||||
if cfg.url.trim().is_empty() {
|
||||
return Err("请先填写 WebDAV 服务地址(如 http://192.168.110.100:5005)".into());
|
||||
}
|
||||
if cfg.username.trim().is_empty() {
|
||||
return Err("请先填写 WebDAV 账号".into());
|
||||
}
|
||||
if dir.trim().is_empty() {
|
||||
return Err("请先填写 WebDAV 曲库目标目录".into());
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user