remove hide_cm
Signed-off-by: 21pages <pages21@163.com>
This commit is contained in:
parent
0ee2b02700
commit
76a18f5ed3
@ -707,8 +707,8 @@ class _SafetyState extends State<_Safety> with AutomaticKeepAliveClientMixin {
|
|||||||
if (usePassword)
|
if (usePassword)
|
||||||
_SubButton('Set permanent password', setPasswordDialog,
|
_SubButton('Set permanent password', setPasswordDialog,
|
||||||
permEnabled && !locked),
|
permEnabled && !locked),
|
||||||
if (usePassword)
|
// if (usePassword)
|
||||||
hide_cm(!locked).marginOnly(left: _kContentHSubMargin - 6),
|
// hide_cm(!locked).marginOnly(left: _kContentHSubMargin - 6),
|
||||||
if (usePassword) radios[2],
|
if (usePassword) radios[2],
|
||||||
]);
|
]);
|
||||||
})));
|
})));
|
||||||
|
@ -223,6 +223,7 @@ void runConnectionManagerScreen(bool hide) async {
|
|||||||
const DesktopServerPage(),
|
const DesktopServerPage(),
|
||||||
MyTheme.currentThemeMode(),
|
MyTheme.currentThemeMode(),
|
||||||
);
|
);
|
||||||
|
gFFI.serverModel.hideCm = hide;
|
||||||
if (hide) {
|
if (hide) {
|
||||||
await hideCmWindow(isStartup: true);
|
await hideCmWindow(isStartup: true);
|
||||||
} else {
|
} else {
|
||||||
|
@ -31,7 +31,7 @@ class ServerModel with ChangeNotifier {
|
|||||||
bool _audioOk = false;
|
bool _audioOk = false;
|
||||||
bool _fileOk = false;
|
bool _fileOk = false;
|
||||||
bool _showElevation = false;
|
bool _showElevation = false;
|
||||||
bool _hideCm = false;
|
bool hideCm = false;
|
||||||
int _connectStatus = 0; // Rendezvous Server status
|
int _connectStatus = 0; // Rendezvous Server status
|
||||||
String _verificationMethod = "";
|
String _verificationMethod = "";
|
||||||
String _temporaryPasswordLength = "";
|
String _temporaryPasswordLength = "";
|
||||||
@ -61,8 +61,6 @@ class ServerModel with ChangeNotifier {
|
|||||||
|
|
||||||
bool get showElevation => _showElevation;
|
bool get showElevation => _showElevation;
|
||||||
|
|
||||||
bool get hideCm => _hideCm;
|
|
||||||
|
|
||||||
int get connectStatus => _connectStatus;
|
int get connectStatus => _connectStatus;
|
||||||
|
|
||||||
String get verificationMethod {
|
String get verificationMethod {
|
||||||
@ -121,6 +119,7 @@ class ServerModel with ChangeNotifier {
|
|||||||
_emptyIdShow = translate("Generating ...");
|
_emptyIdShow = translate("Generating ...");
|
||||||
_serverId = IDTextEditingController(text: _emptyIdShow);
|
_serverId = IDTextEditingController(text: _emptyIdShow);
|
||||||
|
|
||||||
|
/*
|
||||||
// initital _hideCm at startup
|
// initital _hideCm at startup
|
||||||
final verificationMethod =
|
final verificationMethod =
|
||||||
bind.mainGetOptionSync(key: "verification-method");
|
bind.mainGetOptionSync(key: "verification-method");
|
||||||
@ -131,6 +130,7 @@ class ServerModel with ChangeNotifier {
|
|||||||
verificationMethod == kUsePermanentPassword)) {
|
verificationMethod == kUsePermanentPassword)) {
|
||||||
_hideCm = false;
|
_hideCm = false;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
timerCallback() async {
|
timerCallback() async {
|
||||||
final connectionStatus =
|
final connectionStatus =
|
||||||
@ -155,7 +155,7 @@ class ServerModel with ChangeNotifier {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
_zeroClientLengthCounter = 0;
|
_zeroClientLengthCounter = 0;
|
||||||
if (!_hideCm) showCmWindow();
|
if (!hideCm) showCmWindow();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -210,12 +210,14 @@ class ServerModel with ChangeNotifier {
|
|||||||
final temporaryPasswordLength =
|
final temporaryPasswordLength =
|
||||||
await bind.mainGetOption(key: "temporary-password-length");
|
await bind.mainGetOption(key: "temporary-password-length");
|
||||||
final approveMode = await bind.mainGetOption(key: 'approve-mode');
|
final approveMode = await bind.mainGetOption(key: 'approve-mode');
|
||||||
|
/*
|
||||||
var hideCm = option2bool(
|
var hideCm = option2bool(
|
||||||
'allow-hide-cm', await bind.mainGetOption(key: 'allow-hide-cm'));
|
'allow-hide-cm', await bind.mainGetOption(key: 'allow-hide-cm'));
|
||||||
if (!(approveMode == 'password' &&
|
if (!(approveMode == 'password' &&
|
||||||
verificationMethod == kUsePermanentPassword)) {
|
verificationMethod == kUsePermanentPassword)) {
|
||||||
hideCm = false;
|
hideCm = false;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
if (_approveMode != approveMode) {
|
if (_approveMode != approveMode) {
|
||||||
_approveMode = approveMode;
|
_approveMode = approveMode;
|
||||||
update = true;
|
update = true;
|
||||||
@ -247,6 +249,7 @@ class ServerModel with ChangeNotifier {
|
|||||||
_temporaryPasswordLength = temporaryPasswordLength;
|
_temporaryPasswordLength = temporaryPasswordLength;
|
||||||
update = true;
|
update = true;
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
if (_hideCm != hideCm) {
|
if (_hideCm != hideCm) {
|
||||||
_hideCm = hideCm;
|
_hideCm = hideCm;
|
||||||
if (desktopType == DesktopType.cm) {
|
if (desktopType == DesktopType.cm) {
|
||||||
@ -258,6 +261,7 @@ class ServerModel with ChangeNotifier {
|
|||||||
}
|
}
|
||||||
update = true;
|
update = true;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
if (update) {
|
if (update) {
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
}
|
}
|
||||||
@ -461,7 +465,7 @@ class ServerModel with ChangeNotifier {
|
|||||||
if (desktopType == DesktopType.cm) {
|
if (desktopType == DesktopType.cm) {
|
||||||
if (_clients.isEmpty) {
|
if (_clients.isEmpty) {
|
||||||
hideCmWindow();
|
hideCmWindow();
|
||||||
} else if (!_hideCm) {
|
} else if (!hideCm) {
|
||||||
showCmWindow();
|
showCmWindow();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -495,7 +499,7 @@ class ServerModel with ChangeNotifier {
|
|||||||
_clients.removeAt(index_disconnected);
|
_clients.removeAt(index_disconnected);
|
||||||
tabController.remove(index_disconnected);
|
tabController.remove(index_disconnected);
|
||||||
}
|
}
|
||||||
if (desktopType == DesktopType.cm && !_hideCm) {
|
if (desktopType == DesktopType.cm && !hideCm) {
|
||||||
showCmWindow();
|
showCmWindow();
|
||||||
}
|
}
|
||||||
scrollToBottom();
|
scrollToBottom();
|
||||||
|
@ -1,4 +1,8 @@
|
|||||||
use std::{collections::HashMap, sync::Mutex, time::Duration};
|
use std::{
|
||||||
|
collections::HashMap,
|
||||||
|
sync::{Arc, Mutex},
|
||||||
|
time::Duration,
|
||||||
|
};
|
||||||
|
|
||||||
#[cfg(not(any(target_os = "ios")))]
|
#[cfg(not(any(target_os = "ios")))]
|
||||||
use crate::Connection;
|
use crate::Connection;
|
||||||
@ -16,6 +20,7 @@ const TIME_CONN: Duration = Duration::from_secs(3);
|
|||||||
#[cfg(not(any(target_os = "ios")))]
|
#[cfg(not(any(target_os = "ios")))]
|
||||||
lazy_static::lazy_static! {
|
lazy_static::lazy_static! {
|
||||||
static ref SENDER : Mutex<broadcast::Sender<Vec<i32>>> = Mutex::new(start_hbbs_sync());
|
static ref SENDER : Mutex<broadcast::Sender<Vec<i32>>> = Mutex::new(start_hbbs_sync());
|
||||||
|
static ref PRO: Arc<Mutex<bool>> = Default::default();
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(any(target_os = "ios")))]
|
#[cfg(not(any(target_os = "ios")))]
|
||||||
@ -54,6 +59,7 @@ async fn start_hbbs_sync_async() {
|
|||||||
_ = interval.tick() => {
|
_ = interval.tick() => {
|
||||||
let url = heartbeat_url();
|
let url = heartbeat_url();
|
||||||
if url.is_empty() {
|
if url.is_empty() {
|
||||||
|
*PRO.lock().unwrap() = false;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if !Config::get_option("stop-service").is_empty() {
|
if !Config::get_option("stop-service").is_empty() {
|
||||||
@ -62,6 +68,7 @@ async fn start_hbbs_sync_async() {
|
|||||||
let conns = Connection::alive_conns();
|
let conns = Connection::alive_conns();
|
||||||
if info_uploaded.0 && url != info_uploaded.1 {
|
if info_uploaded.0 && url != info_uploaded.1 {
|
||||||
info_uploaded.0 = false;
|
info_uploaded.0 = false;
|
||||||
|
*PRO.lock().unwrap() = false;
|
||||||
}
|
}
|
||||||
if !info_uploaded.0 && info_uploaded.2.map(|x| x.elapsed() >= UPLOAD_SYSINFO_TIMEOUT).unwrap_or(true){
|
if !info_uploaded.0 && info_uploaded.2.map(|x| x.elapsed() >= UPLOAD_SYSINFO_TIMEOUT).unwrap_or(true){
|
||||||
let mut v = crate::get_sysinfo();
|
let mut v = crate::get_sysinfo();
|
||||||
@ -73,6 +80,7 @@ async fn start_hbbs_sync_async() {
|
|||||||
if x == "SYSINFO_UPDATED" {
|
if x == "SYSINFO_UPDATED" {
|
||||||
info_uploaded = (true, url.clone(), None);
|
info_uploaded = (true, url.clone(), None);
|
||||||
hbb_common::log::info!("sysinfo updated");
|
hbb_common::log::info!("sysinfo updated");
|
||||||
|
*PRO.lock().unwrap() = true;
|
||||||
} else if x == "ID_NOT_FOUND" {
|
} else if x == "ID_NOT_FOUND" {
|
||||||
info_uploaded.2 = None; // next heartbeat will upload sysinfo again
|
info_uploaded.2 = None; // next heartbeat will upload sysinfo again
|
||||||
} else {
|
} else {
|
||||||
@ -148,3 +156,7 @@ fn handle_config_options(config_options: HashMap<String, String>) {
|
|||||||
.count();
|
.count();
|
||||||
Config::set_options(options);
|
Config::set_options(options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn is_pro() -> bool {
|
||||||
|
PRO.lock().unwrap().clone()
|
||||||
|
}
|
||||||
|
@ -2393,10 +2393,9 @@ async fn start_ipc(
|
|||||||
stream = Some(s);
|
stream = Some(s);
|
||||||
} else {
|
} else {
|
||||||
let mut args = vec!["--cm"];
|
let mut args = vec!["--cm"];
|
||||||
if password::hide_cm() {
|
if crate::hbbs_http::sync::is_pro() && password::hide_cm() {
|
||||||
args.push("--hide");
|
args.push("--hide");
|
||||||
};
|
}
|
||||||
|
|
||||||
#[allow(unused_mut)]
|
#[allow(unused_mut)]
|
||||||
#[cfg(target_os = "linux")]
|
#[cfg(target_os = "linux")]
|
||||||
let mut user = None;
|
let mut user = None;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user