mirror of
https://github.com/rustdesk/hbb_common.git
synced 2026-02-16 02:20:43 +00:00
add options: disable-change-permanent-password, disable-change-id, disable-unlock-pin
Signed-off-by: 21pages <sunboeasy@gmail.com>
This commit is contained in:
@@ -1001,6 +1001,33 @@ impl Config {
|
||||
.unwrap_or(false)
|
||||
}
|
||||
|
||||
pub fn is_disable_change_permanent_password() -> bool {
|
||||
BUILTIN_SETTINGS
|
||||
.read()
|
||||
.unwrap()
|
||||
.get(keys::OPTION_DISABLE_CHANGE_PERMANENT_PASSWORD)
|
||||
.map(|v| v == "Y")
|
||||
.unwrap_or(false)
|
||||
}
|
||||
|
||||
pub fn is_disable_change_id() -> bool {
|
||||
BUILTIN_SETTINGS
|
||||
.read()
|
||||
.unwrap()
|
||||
.get(keys::OPTION_DISABLE_CHANGE_ID)
|
||||
.map(|v| v == "Y")
|
||||
.unwrap_or(false)
|
||||
}
|
||||
|
||||
pub fn is_disable_unlock_pin() -> bool {
|
||||
BUILTIN_SETTINGS
|
||||
.read()
|
||||
.unwrap()
|
||||
.get(keys::OPTION_DISABLE_UNLOCK_PIN)
|
||||
.map(|v| v == "Y")
|
||||
.unwrap_or(false)
|
||||
}
|
||||
|
||||
pub fn get_id() -> String {
|
||||
let mut id = CONFIG.read().unwrap().id.clone();
|
||||
if id.is_empty() {
|
||||
@@ -1087,6 +1114,9 @@ impl Config {
|
||||
}
|
||||
|
||||
pub fn set_permanent_password(password: &str) {
|
||||
if Self::is_disable_change_permanent_password() {
|
||||
return;
|
||||
}
|
||||
if HARD_SETTINGS
|
||||
.read()
|
||||
.unwrap()
|
||||
@@ -1235,10 +1265,16 @@ impl Config {
|
||||
}
|
||||
|
||||
pub fn get_unlock_pin() -> String {
|
||||
if Self::is_disable_unlock_pin() {
|
||||
return String::new();
|
||||
}
|
||||
CONFIG2.read().unwrap().unlock_pin.clone()
|
||||
}
|
||||
|
||||
pub fn set_unlock_pin(pin: &str) {
|
||||
if Self::is_disable_unlock_pin() {
|
||||
return;
|
||||
}
|
||||
let mut config = CONFIG2.write().unwrap();
|
||||
if pin == config.unlock_pin {
|
||||
return;
|
||||
@@ -2619,6 +2655,9 @@ pub mod keys {
|
||||
pub const OPTION_ALLOW_HOSTNAME_AS_ID: &str = "allow-hostname-as-id";
|
||||
pub const OPTION_HIDE_POWERED_BY_ME: &str = "hide-powered-by-me";
|
||||
pub const OPTION_MAIN_WINDOW_ALWAYS_ON_TOP: &str = "main-window-always-on-top";
|
||||
pub const OPTION_DISABLE_CHANGE_PERMANENT_PASSWORD: &str = "disable-change-permanent-password";
|
||||
pub const OPTION_DISABLE_CHANGE_ID: &str = "disable-change-id";
|
||||
pub const OPTION_DISABLE_UNLOCK_PIN: &str = "disable-unlock-pin";
|
||||
|
||||
// flutter local options
|
||||
pub const OPTION_FLUTTER_REMOTE_MENUBAR_STATE: &str = "remoteMenubarState";
|
||||
@@ -2810,6 +2849,9 @@ pub mod keys {
|
||||
OPTION_HIDE_POWERED_BY_ME,
|
||||
OPTION_MAIN_WINDOW_ALWAYS_ON_TOP,
|
||||
OPTION_FILE_TRANSFER_MAX_FILES,
|
||||
OPTION_DISABLE_CHANGE_PERMANENT_PASSWORD,
|
||||
OPTION_DISABLE_CHANGE_ID,
|
||||
OPTION_DISABLE_UNLOCK_PIN,
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user