move option video-save-directory
and allow-auto-record-outgoing
to local (#9715)
Signed-off-by: 21pages <sunboeasy@gmail.com>
This commit is contained in:
parent
6088920f8d
commit
6159449eba
@ -580,7 +580,8 @@ class _GeneralState extends State<_General> {
|
|||||||
kOptionAllowAutoRecordIncoming),
|
kOptionAllowAutoRecordIncoming),
|
||||||
if (!bind.isIncomingOnly())
|
if (!bind.isIncomingOnly())
|
||||||
_OptionCheckBox(context, 'Automatically record outgoing sessions',
|
_OptionCheckBox(context, 'Automatically record outgoing sessions',
|
||||||
kOptionAllowAutoRecordOutgoing),
|
kOptionAllowAutoRecordOutgoing,
|
||||||
|
isServer: false),
|
||||||
if (showRootDir && !bind.isOutgoingOnly())
|
if (showRootDir && !bind.isOutgoingOnly())
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
@ -635,7 +636,7 @@ class _GeneralState extends State<_General> {
|
|||||||
await FilePicker.platform.getDirectoryPath(
|
await FilePicker.platform.getDirectoryPath(
|
||||||
initialDirectory: initialDirectory);
|
initialDirectory: initialDirectory);
|
||||||
if (selectedDirectory != null) {
|
if (selectedDirectory != null) {
|
||||||
await bind.mainSetOption(
|
await bind.mainSetLocalOption(
|
||||||
key: kOptionVideoSaveDirectory,
|
key: kOptionVideoSaveDirectory,
|
||||||
value: selectedDirectory);
|
value: selectedDirectory);
|
||||||
setState(() {});
|
setState(() {});
|
||||||
|
@ -106,7 +106,7 @@ class _SettingsState extends State<SettingsPage> with WidgetsBindingObserver {
|
|||||||
_autoRecordIncomingSession = option2bool(kOptionAllowAutoRecordIncoming,
|
_autoRecordIncomingSession = option2bool(kOptionAllowAutoRecordIncoming,
|
||||||
bind.mainGetOptionSync(key: kOptionAllowAutoRecordIncoming));
|
bind.mainGetOptionSync(key: kOptionAllowAutoRecordIncoming));
|
||||||
_autoRecordOutgoingSession = option2bool(kOptionAllowAutoRecordOutgoing,
|
_autoRecordOutgoingSession = option2bool(kOptionAllowAutoRecordOutgoing,
|
||||||
bind.mainGetOptionSync(key: kOptionAllowAutoRecordOutgoing));
|
bind.mainGetLocalOption(key: kOptionAllowAutoRecordOutgoing));
|
||||||
_localIP = bind.mainGetOptionSync(key: 'local-ip-addr');
|
_localIP = bind.mainGetOptionSync(key: 'local-ip-addr');
|
||||||
_directAccessPort = bind.mainGetOptionSync(key: kOptionDirectAccessPort);
|
_directAccessPort = bind.mainGetOptionSync(key: kOptionDirectAccessPort);
|
||||||
_allowAutoDisconnect = option2bool(kOptionAllowAutoDisconnect,
|
_allowAutoDisconnect = option2bool(kOptionAllowAutoDisconnect,
|
||||||
@ -711,13 +711,13 @@ class _SettingsState extends State<SettingsPage> with WidgetsBindingObserver {
|
|||||||
onToggle: isOptionFixed(kOptionAllowAutoRecordOutgoing)
|
onToggle: isOptionFixed(kOptionAllowAutoRecordOutgoing)
|
||||||
? null
|
? null
|
||||||
: (v) async {
|
: (v) async {
|
||||||
await bind.mainSetOption(
|
await bind.mainSetLocalOption(
|
||||||
key: kOptionAllowAutoRecordOutgoing,
|
key: kOptionAllowAutoRecordOutgoing,
|
||||||
value: bool2option(
|
value: bool2option(
|
||||||
kOptionAllowAutoRecordOutgoing, v));
|
kOptionAllowAutoRecordOutgoing, v));
|
||||||
final newValue = option2bool(
|
final newValue = option2bool(
|
||||||
kOptionAllowAutoRecordOutgoing,
|
kOptionAllowAutoRecordOutgoing,
|
||||||
await bind.mainGetOption(
|
bind.mainGetLocalOption(
|
||||||
key: kOptionAllowAutoRecordOutgoing));
|
key: kOptionAllowAutoRecordOutgoing));
|
||||||
setState(() {
|
setState(() {
|
||||||
_autoRecordOutgoingSession = newValue;
|
_autoRecordOutgoingSession = newValue;
|
||||||
|
@ -1562,6 +1562,21 @@ impl LocalConfig {
|
|||||||
.unwrap_or_default()
|
.unwrap_or_default()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Usually get_option should be used.
|
||||||
|
pub fn get_option_from_file(k: &str) -> String {
|
||||||
|
get_or(
|
||||||
|
&OVERWRITE_LOCAL_SETTINGS,
|
||||||
|
&Self::load().options,
|
||||||
|
&DEFAULT_LOCAL_SETTINGS,
|
||||||
|
k,
|
||||||
|
)
|
||||||
|
.unwrap_or_default()
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn get_bool_option(k: &str) -> bool {
|
||||||
|
option2bool(k, &Self::get_option(k))
|
||||||
|
}
|
||||||
|
|
||||||
pub fn set_option(k: String, v: String) {
|
pub fn set_option(k: String, v: String) {
|
||||||
if !is_option_can_save(&OVERWRITE_LOCAL_SETTINGS, &k, &DEFAULT_LOCAL_SETTINGS, &v) {
|
if !is_option_can_save(&OVERWRITE_LOCAL_SETTINGS, &k, &DEFAULT_LOCAL_SETTINGS, &v) {
|
||||||
return;
|
return;
|
||||||
@ -2326,6 +2341,8 @@ pub mod keys {
|
|||||||
OPTION_DISABLE_GROUP_PANEL,
|
OPTION_DISABLE_GROUP_PANEL,
|
||||||
OPTION_PRE_ELEVATE_SERVICE,
|
OPTION_PRE_ELEVATE_SERVICE,
|
||||||
OPTION_ALLOW_REMOTE_CM_MODIFICATION,
|
OPTION_ALLOW_REMOTE_CM_MODIFICATION,
|
||||||
|
OPTION_ALLOW_AUTO_RECORD_OUTGOING,
|
||||||
|
OPTION_VIDEO_SAVE_DIRECTORY,
|
||||||
];
|
];
|
||||||
// DEFAULT_SETTINGS, OVERWRITE_SETTINGS
|
// DEFAULT_SETTINGS, OVERWRITE_SETTINGS
|
||||||
pub const KEYS_SETTINGS: &[&str] = &[
|
pub const KEYS_SETTINGS: &[&str] = &[
|
||||||
@ -2347,8 +2364,6 @@ pub mod keys {
|
|||||||
OPTION_AUTO_DISCONNECT_TIMEOUT,
|
OPTION_AUTO_DISCONNECT_TIMEOUT,
|
||||||
OPTION_ALLOW_ONLY_CONN_WINDOW_OPEN,
|
OPTION_ALLOW_ONLY_CONN_WINDOW_OPEN,
|
||||||
OPTION_ALLOW_AUTO_RECORD_INCOMING,
|
OPTION_ALLOW_AUTO_RECORD_INCOMING,
|
||||||
OPTION_ALLOW_AUTO_RECORD_OUTGOING,
|
|
||||||
OPTION_VIDEO_SAVE_DIRECTORY,
|
|
||||||
OPTION_ENABLE_ABR,
|
OPTION_ENABLE_ABR,
|
||||||
OPTION_ALLOW_REMOVE_WALLPAPER,
|
OPTION_ALLOW_REMOVE_WALLPAPER,
|
||||||
OPTION_ALLOW_ALWAYS_SOFTWARE_RENDER,
|
OPTION_ALLOW_ALWAYS_SOFTWARE_RENDER,
|
||||||
|
@ -1442,7 +1442,7 @@ impl LoginConfigHandler {
|
|||||||
self.adapter_luid = adapter_luid;
|
self.adapter_luid = adapter_luid;
|
||||||
self.selected_windows_session_id = None;
|
self.selected_windows_session_id = None;
|
||||||
self.shared_password = shared_password;
|
self.shared_password = shared_password;
|
||||||
self.record = Config::get_bool_option(OPTION_ALLOW_AUTO_RECORD_OUTGOING);
|
self.record = LocalConfig::get_bool_option(OPTION_ALLOW_AUTO_RECORD_OUTGOING);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Check if the client should auto login.
|
/// Check if the client should auto login.
|
||||||
|
@ -890,7 +890,7 @@ pub async fn set_data(data: &Data) -> ResultType<()> {
|
|||||||
set_data_async(data).await
|
set_data_async(data).await
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn set_data_async(data: &Data) -> ResultType<()> {
|
async fn set_data_async(data: &Data) -> ResultType<()> {
|
||||||
let mut c = connect(1000, "").await?;
|
let mut c = connect(1000, "").await?;
|
||||||
c.send(data).await?;
|
c.send(data).await?;
|
||||||
Ok(())
|
Ok(())
|
||||||
|
@ -253,7 +253,7 @@ class Enhancements: Reactor.Component {
|
|||||||
var root_dir = show_root_dir ? handler.video_save_directory(true) : "";
|
var root_dir = show_root_dir ? handler.video_save_directory(true) : "";
|
||||||
var ts0 = handler.get_option("enable-record-session") == '' ? { checked: true } : {};
|
var ts0 = handler.get_option("enable-record-session") == '' ? { checked: true } : {};
|
||||||
var ts1 = handler.get_option("allow-auto-record-incoming") == 'Y' ? { checked: true } : {};
|
var ts1 = handler.get_option("allow-auto-record-incoming") == 'Y' ? { checked: true } : {};
|
||||||
var ts2 = handler.get_option("allow-auto-record-outgoing") == 'Y' ? { checked: true } : {};
|
var ts2 = handler.get_local_option("allow-auto-record-outgoing") == 'Y' ? { checked: true } : {};
|
||||||
msgbox("custom-recording", translate('Recording'),
|
msgbox("custom-recording", translate('Recording'),
|
||||||
<div .form>
|
<div .form>
|
||||||
<div><button|checkbox(enable_record_session) {ts0}>{translate('Enable recording session')}</button></div>
|
<div><button|checkbox(enable_record_session) {ts0}>{translate('Enable recording session')}</button></div>
|
||||||
@ -269,8 +269,8 @@ class Enhancements: Reactor.Component {
|
|||||||
if (!res) return;
|
if (!res) return;
|
||||||
handler.set_option("enable-record-session", res.enable_record_session ? '' : 'N');
|
handler.set_option("enable-record-session", res.enable_record_session ? '' : 'N');
|
||||||
handler.set_option("allow-auto-record-incoming", res.auto_record_incoming ? 'Y' : '');
|
handler.set_option("allow-auto-record-incoming", res.auto_record_incoming ? 'Y' : '');
|
||||||
handler.set_option("allow-auto-record-outgoing", res.auto_record_outgoing ? 'Y' : '');
|
handler.set_local_option("allow-auto-record-outgoing", res.auto_record_outgoing ? 'Y' : '');
|
||||||
handler.set_option("video-save-directory", $(#folderPath).text);
|
handler.set_local_option("video-save-directory", $(#folderPath).text);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
this.toggleMenuState();
|
this.toggleMenuState();
|
||||||
|
@ -212,7 +212,7 @@ pub fn get_builtin_option(key: &str) -> String {
|
|||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn set_local_option(key: String, value: String) {
|
pub fn set_local_option(key: String, value: String) {
|
||||||
LocalConfig::set_option(key, value);
|
LocalConfig::set_option(key.clone(), value.clone());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(any(target_os = "android", target_os = "ios", feature = "flutter"))]
|
#[cfg(any(target_os = "android", target_os = "ios", feature = "flutter"))]
|
||||||
@ -844,7 +844,11 @@ pub fn video_save_directory(root: bool) -> String {
|
|||||||
return dir.to_string_lossy().to_string();
|
return dir.to_string_lossy().to_string();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let dir = Config::get_option("video-save-directory");
|
// Get directory from config file otherwise --server will use the old value from global var.
|
||||||
|
#[cfg(any(target_os = "linux", target_os = "macos"))]
|
||||||
|
let dir = LocalConfig::get_option_from_file(OPTION_VIDEO_SAVE_DIRECTORY);
|
||||||
|
#[cfg(not(any(target_os = "linux", target_os = "macos")))]
|
||||||
|
let dir = LocalConfig::get_option(OPTION_VIDEO_SAVE_DIRECTORY);
|
||||||
if !dir.is_empty() {
|
if !dir.is_empty() {
|
||||||
return dir;
|
return dir;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user