installed windows client save incoming recording to a specific directory (#7974)

Signed-off-by: 21pages <pages21@163.com>
This commit is contained in:
21pages
2024-05-08 17:04:53 +08:00
committed by GitHub
parent 35832f8f7f
commit 09f3850250
51 changed files with 173 additions and 45 deletions

View File

@@ -1112,7 +1112,7 @@ impl VideoHandler {
self.recorder = Recorder::new(RecorderContext {
server: false,
id,
default_dir: crate::ui_interface::default_video_save_directory(),
dir: crate::ui_interface::video_save_directory(false),
filename: "".to_owned(),
width: w as _,
height: h as _,

View File

@@ -1145,8 +1145,8 @@ pub fn main_change_language(lang: String) {
send_to_cm(&crate::ipc::Data::Language(lang));
}
pub fn main_default_video_save_directory() -> String {
default_video_save_directory()
pub fn main_video_save_directory(root: bool) -> String {
video_save_directory(root)
}
pub fn main_set_user_default_option(key: String, value: String) {

View File

@@ -607,5 +607,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Follow remote window focus", ""),
("default_proxy_tip", ""),
("no_audio_input_device_tip", ""),
("Incoming", ""),
("Outgoing", ""),
].iter().cloned().collect();
}

View File

@@ -607,5 +607,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Follow remote window focus", ""),
("default_proxy_tip", ""),
("no_audio_input_device_tip", ""),
("Incoming", ""),
("Outgoing", ""),
].iter().cloned().collect();
}

View File

@@ -607,5 +607,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Follow remote window focus", ""),
("default_proxy_tip", ""),
("no_audio_input_device_tip", ""),
("Incoming", ""),
("Outgoing", ""),
].iter().cloned().collect();
}

View File

@@ -607,5 +607,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Follow remote window focus", "跟随远程窗口焦点"),
("default_proxy_tip", "默认代理协议及端口为 Socks5 和 1080"),
("no_audio_input_device_tip", "未找到音频输入设备"),
("Incoming", "被控"),
("Outgoing", "主控"),
].iter().cloned().collect();
}

View File

@@ -607,5 +607,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Follow remote window focus", "Sledovat zaměření vzdáleného okna"),
("default_proxy_tip", "Výchozí protokol a port jsou Socks5 a 1080"),
("no_audio_input_device_tip", "Nebylo nalezeno žádné vstupní zvukové zařízení."),
("Incoming", ""),
("Outgoing", ""),
].iter().cloned().collect();
}

View File

@@ -607,5 +607,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Follow remote window focus", ""),
("default_proxy_tip", ""),
("no_audio_input_device_tip", ""),
("Incoming", ""),
("Outgoing", ""),
].iter().cloned().collect();
}

View File

@@ -607,5 +607,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Follow remote window focus", "Dem Fokus des entfernten Fensters folgen"),
("default_proxy_tip", ""),
("no_audio_input_device_tip", ""),
("Incoming", ""),
("Outgoing", ""),
].iter().cloned().collect();
}

View File

@@ -607,5 +607,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Follow remote window focus", ""),
("default_proxy_tip", ""),
("no_audio_input_device_tip", ""),
("Incoming", ""),
("Outgoing", ""),
].iter().cloned().collect();
}

View File

@@ -607,5 +607,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Follow remote window focus", ""),
("default_proxy_tip", ""),
("no_audio_input_device_tip", ""),
("Incoming", ""),
("Outgoing", ""),
].iter().cloned().collect();
}

View File

@@ -607,5 +607,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Follow remote window focus", "Seguir ventana remota activa"),
("default_proxy_tip", ""),
("no_audio_input_device_tip", ""),
("Incoming", ""),
("Outgoing", ""),
].iter().cloned().collect();
}

View File

@@ -607,5 +607,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Follow remote window focus", ""),
("default_proxy_tip", ""),
("no_audio_input_device_tip", ""),
("Incoming", ""),
("Outgoing", ""),
].iter().cloned().collect();
}

View File

@@ -607,5 +607,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Follow remote window focus", ""),
("default_proxy_tip", ""),
("no_audio_input_device_tip", ""),
("Incoming", ""),
("Outgoing", ""),
].iter().cloned().collect();
}

View File

@@ -607,5 +607,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Follow remote window focus", ""),
("default_proxy_tip", ""),
("no_audio_input_device_tip", ""),
("Incoming", ""),
("Outgoing", ""),
].iter().cloned().collect();
}

View File

@@ -607,5 +607,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Follow remote window focus", ""),
("default_proxy_tip", ""),
("no_audio_input_device_tip", ""),
("Incoming", ""),
("Outgoing", ""),
].iter().cloned().collect();
}

View File

@@ -607,5 +607,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Follow remote window focus", ""),
("default_proxy_tip", ""),
("no_audio_input_device_tip", ""),
("Incoming", ""),
("Outgoing", ""),
].iter().cloned().collect();
}

View File

@@ -607,5 +607,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Follow remote window focus", ""),
("default_proxy_tip", ""),
("no_audio_input_device_tip", ""),
("Incoming", ""),
("Outgoing", ""),
].iter().cloned().collect();
}

View File

@@ -607,5 +607,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Follow remote window focus", ""),
("default_proxy_tip", ""),
("no_audio_input_device_tip", ""),
("Incoming", ""),
("Outgoing", ""),
].iter().cloned().collect();
}

View File

@@ -607,5 +607,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Follow remote window focus", "Segui focus finestra remota"),
("default_proxy_tip", "Protocollo e porta predefiniti sono Socks5 e 1080"),
("no_audio_input_device_tip", "Nessun dispositivo input audio trovato."),
("Incoming", ""),
("Outgoing", ""),
].iter().cloned().collect();
}

View File

@@ -607,5 +607,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Follow remote window focus", ""),
("default_proxy_tip", ""),
("no_audio_input_device_tip", ""),
("Incoming", ""),
("Outgoing", ""),
].iter().cloned().collect();
}

View File

@@ -607,5 +607,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Follow remote window focus", ""),
("default_proxy_tip", ""),
("no_audio_input_device_tip", ""),
("Incoming", ""),
("Outgoing", ""),
].iter().cloned().collect();
}

View File

@@ -607,5 +607,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Follow remote window focus", ""),
("default_proxy_tip", ""),
("no_audio_input_device_tip", ""),
("Incoming", ""),
("Outgoing", ""),
].iter().cloned().collect();
}

View File

@@ -607,5 +607,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Follow remote window focus", ""),
("default_proxy_tip", ""),
("no_audio_input_device_tip", ""),
("Incoming", ""),
("Outgoing", ""),
].iter().cloned().collect();
}

View File

@@ -607,5 +607,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Follow remote window focus", "Sekot attālā loga fokusam"),
("default_proxy_tip", ""),
("no_audio_input_device_tip", ""),
("Incoming", ""),
("Outgoing", ""),
].iter().cloned().collect();
}

View File

@@ -607,5 +607,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Follow remote window focus", ""),
("default_proxy_tip", ""),
("no_audio_input_device_tip", ""),
("Incoming", ""),
("Outgoing", ""),
].iter().cloned().collect();
}

View File

@@ -607,5 +607,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Follow remote window focus", "Volg de focus van het venster op afstand"),
("default_proxy_tip", ""),
("no_audio_input_device_tip", ""),
("Incoming", ""),
("Outgoing", ""),
].iter().cloned().collect();
}

View File

@@ -607,5 +607,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Follow remote window focus", "Podążaj za aktywnością zdalnych okien"),
("default_proxy_tip", ""),
("no_audio_input_device_tip", ""),
("Incoming", ""),
("Outgoing", ""),
].iter().cloned().collect();
}

View File

@@ -607,5 +607,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Follow remote window focus", ""),
("default_proxy_tip", ""),
("no_audio_input_device_tip", ""),
("Incoming", ""),
("Outgoing", ""),
].iter().cloned().collect();
}

View File

@@ -607,5 +607,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Follow remote window focus", ""),
("default_proxy_tip", ""),
("no_audio_input_device_tip", ""),
("Incoming", ""),
("Outgoing", ""),
].iter().cloned().collect();
}

View File

@@ -607,5 +607,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Follow remote window focus", ""),
("default_proxy_tip", ""),
("no_audio_input_device_tip", ""),
("Incoming", ""),
("Outgoing", ""),
].iter().cloned().collect();
}

View File

@@ -607,5 +607,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Follow remote window focus", "Следовать за фокусом удалённого окна"),
("default_proxy_tip", ""),
("no_audio_input_device_tip", ""),
("Incoming", ""),
("Outgoing", ""),
].iter().cloned().collect();
}

View File

@@ -607,5 +607,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Follow remote window focus", "Nasledovať vzdialené zameranie okna"),
("default_proxy_tip", "Predvolený protokol a port sú Socks5 a 1080"),
("no_audio_input_device_tip", "Nenašlo sa žiadne vstupné zvukové zariadenie."),
("Incoming", ""),
("Outgoing", ""),
].iter().cloned().collect();
}

View File

@@ -607,5 +607,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Follow remote window focus", ""),
("default_proxy_tip", ""),
("no_audio_input_device_tip", ""),
("Incoming", ""),
("Outgoing", ""),
].iter().cloned().collect();
}

View File

@@ -607,5 +607,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Follow remote window focus", ""),
("default_proxy_tip", ""),
("no_audio_input_device_tip", ""),
("Incoming", ""),
("Outgoing", ""),
].iter().cloned().collect();
}

View File

@@ -607,5 +607,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Follow remote window focus", ""),
("default_proxy_tip", ""),
("no_audio_input_device_tip", ""),
("Incoming", ""),
("Outgoing", ""),
].iter().cloned().collect();
}

View File

@@ -607,5 +607,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Follow remote window focus", ""),
("default_proxy_tip", ""),
("no_audio_input_device_tip", ""),
("Incoming", ""),
("Outgoing", ""),
].iter().cloned().collect();
}

View File

@@ -607,5 +607,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Follow remote window focus", ""),
("default_proxy_tip", ""),
("no_audio_input_device_tip", ""),
("Incoming", ""),
("Outgoing", ""),
].iter().cloned().collect();
}

View File

@@ -607,5 +607,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Follow remote window focus", ""),
("default_proxy_tip", ""),
("no_audio_input_device_tip", ""),
("Incoming", ""),
("Outgoing", ""),
].iter().cloned().collect();
}

View File

@@ -607,5 +607,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Follow remote window focus", ""),
("default_proxy_tip", ""),
("no_audio_input_device_tip", ""),
("Incoming", ""),
("Outgoing", ""),
].iter().cloned().collect();
}

View File

@@ -607,5 +607,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Follow remote window focus", "跟隨遠端視窗焦點"),
("default_proxy_tip", ""),
("no_audio_input_device_tip", ""),
("Incoming", ""),
("Outgoing", ""),
].iter().cloned().collect();
}

View File

@@ -607,5 +607,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Follow remote window focus", ""),
("default_proxy_tip", ""),
("no_audio_input_device_tip", ""),
("Incoming", ""),
("Outgoing", ""),
].iter().cloned().collect();
}

View File

@@ -607,5 +607,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Follow remote window focus", ""),
("default_proxy_tip", ""),
("no_audio_input_device_tip", ""),
("Incoming", ""),
("Outgoing", ""),
].iter().cloned().collect();
}

View File

@@ -53,7 +53,7 @@ use scrap::{
codec::{Encoder, EncoderCfg, Quality},
record::{Recorder, RecorderContext},
vpxcodec::{VpxEncoderConfig, VpxVideoCodecId},
CodecFormat, CodecName, Display, Frame, TraitCapturer,
CodecFormat, Display, Frame, TraitCapturer,
};
#[cfg(windows)]
use std::sync::Once;
@@ -752,6 +752,10 @@ fn get_recorder(
codec_format: &CodecFormat,
record_incoming: bool,
) -> Arc<Mutex<Option<Recorder>>> {
#[cfg(windows)]
let root = crate::platform::is_root();
#[cfg(not(windows))]
let root = false;
let recorder = if record_incoming {
use crate::hbbs_http::record_upload;
@@ -765,7 +769,7 @@ fn get_recorder(
Recorder::new(RecorderContext {
server: true,
id: Config::get_id(),
default_dir: crate::ui_interface::default_video_save_directory(),
dir: crate::ui_interface::video_save_directory(root),
filename: "".to_owned(),
width,
height,

View File

@@ -600,8 +600,8 @@ impl UI {
get_langs()
}
fn default_video_save_directory(&self) -> String {
default_video_save_directory()
fn video_save_directory(&self, root: bool) -> String {
video_save_directory(root)
}
fn handle_relay_id(&self, id: String) -> String {
@@ -723,7 +723,7 @@ impl sciter::EventHandler for UI {
fn has_hwcodec();
fn has_vram();
fn get_langs();
fn default_video_save_directory();
fn video_save_directory(bool);
fn handle_relay_id(String);
fn get_login_device_info();
fn support_remove_wallpaper();

View File

@@ -248,8 +248,9 @@ class Enhancements: Reactor.Component {
} else if (v.indexOf("allow-") == 0) {
handler.set_option(v, handler.get_option(v) == 'Y' ? '' : 'Y');
} else if (v == 'screen-recording') {
var dir = handler.get_option("video-save-directory");
if (!dir) dir = handler.default_video_save_directory();
var show_root_dir = is_win && handler.is_installed();
var user_dir = handler.video_save_directory(false);
var root_dir = show_root_dir ? handler.video_save_directory(true) : "";
var ts0 = handler.get_option("enable-record-session") == '' ? { checked: true } : {};
var ts1 = handler.get_option("allow-auto-record-incoming") == 'Y' ? { checked: true } : {};
msgbox("custom-recording", translate('Recording'),
@@ -257,7 +258,8 @@ class Enhancements: Reactor.Component {
<div><button|checkbox(enable_record_session) {ts0}>{translate('Enable recording session')}</button></div>
<div><button|checkbox(auto_record_incoming) {ts1}>{translate('Automatically record incoming sessions')}</button></div>
<div>
<div style="word-wrap:break-word"><span>{translate("Directory")}:&nbsp;&nbsp;</span><span #folderPath>{dir}</span></div>
{show_root_dir ? <div style="word-wrap:break-word"><span>{translate("Incoming")}:&nbsp;&nbsp;</span><span>{root_dir}</span></div> : ""}
<div style="word-wrap:break-word"><span>{translate(show_root_dir ? "Outgoing" : "Directory")}:&nbsp;&nbsp;</span><span #folderPath>{user_dir}</span></div>
<div> <button #select_directory .link>{translate('Change')}</button> </div>
</div>
</div>

View File

@@ -778,7 +778,7 @@ pub fn get_langs() -> String {
}
#[inline]
pub fn default_video_save_directory() -> String {
pub fn video_save_directory(root: bool) -> String {
let appname = crate::get_app_name();
// ui process can show it correctly Once vidoe process created it.
let try_create = |path: &std::path::Path| {
@@ -792,6 +792,20 @@ pub fn default_video_save_directory() -> String {
}
};
if root {
// Currently, only installed windows run as root
#[cfg(windows)]
{
let drive = std::env::var("SystemDrive").unwrap_or("C:".to_owned());
let dir =
std::path::PathBuf::from(format!("{drive}\\ProgramData\\RustDesk\\recording",));
return dir.to_string_lossy().to_string();
}
}
let dir = Config::get_option("video-save-directory");
if !dir.is_empty() {
return dir;
}
#[cfg(any(target_os = "android", target_os = "ios"))]
if let Ok(home) = config::APP_HOME_DIR.read() {
let mut path = home.to_owned();
@@ -858,7 +872,7 @@ pub fn default_video_save_directory() -> String {
return parent.to_string_lossy().to_string();
}
}
"".to_owned()
Default::default()
}
#[inline]