portable-service: enable quick_support by rename as xxxqs.exe
Signed-off-by: 21pages <pages21@163.com>
This commit is contained in:
parent
f986236a61
commit
eb673c8c78
9
.github/workflows/flutter-nightly.yml
vendored
9
.github/workflows/flutter-nightly.yml
vendored
@ -15,7 +15,7 @@ env:
|
||||
|
||||
jobs:
|
||||
build-for-windows:
|
||||
name: ${{ matrix.job.target }} (${{ matrix.job.os }}) ${{ matrix.job.suffix }}
|
||||
name: ${{ matrix.job.target }} (${{ matrix.job.os }})
|
||||
runs-on: ${{ matrix.job.os }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
@ -23,8 +23,7 @@ jobs:
|
||||
job:
|
||||
# - { target: i686-pc-windows-msvc , os: windows-2019 }
|
||||
# - { target: x86_64-pc-windows-gnu , os: windows-2019 }
|
||||
- { target: x86_64-pc-windows-msvc , os: windows-2019, suffix: "" , extra-build-args: "" }
|
||||
- { target: x86_64-pc-windows-msvc , os: windows-2019, suffix: "-qs", extra-build-args: "--quick_start" }
|
||||
- { target: x86_64-pc-windows-msvc , os: windows-2019 }
|
||||
steps:
|
||||
- name: Checkout source code
|
||||
uses: actions/checkout@v3
|
||||
@ -84,13 +83,13 @@ jobs:
|
||||
shell: bash
|
||||
|
||||
- name: Build rustdesk
|
||||
run: python3 .\build.py --portable --hwcodec --flutter ${{ matrix.job.extra-build-args }}
|
||||
run: python3 .\build.py --portable --hwcodec --flutter
|
||||
|
||||
- name: Rename rustdesk
|
||||
shell: bash
|
||||
run: |
|
||||
for name in rustdesk*??-install.exe; do
|
||||
mv "$name" "${name%%-install.exe}-${{ matrix.job.target }}${{ matrix.job.suffix }}.exe"
|
||||
mv "$name" "${name%%-install.exe}-${{ matrix.job.target }}.exe"
|
||||
done
|
||||
|
||||
- name: Publish Release
|
||||
|
@ -29,7 +29,6 @@ flutter = ["flutter_rust_bridge"]
|
||||
default = ["use_dasp"]
|
||||
hwcodec = ["scrap/hwcodec"]
|
||||
mediacodec = ["scrap/mediacodec"]
|
||||
quick_start = []
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
|
7
build.py
7
build.py
@ -81,11 +81,6 @@ def make_parser():
|
||||
action='store_true',
|
||||
help='Build windows portable'
|
||||
)
|
||||
parser.add_argument(
|
||||
'--quick_start',
|
||||
action='store_true',
|
||||
help='Windows quick start portable'
|
||||
)
|
||||
parser.add_argument(
|
||||
'--flatpak',
|
||||
action='store_true',
|
||||
@ -194,8 +189,6 @@ def get_features(args):
|
||||
features = ['inline']
|
||||
if windows:
|
||||
features.extend(get_rc_features(args))
|
||||
if args.quick_start:
|
||||
features.append('quick_start')
|
||||
if args.hwcodec:
|
||||
features.append('hwcodec')
|
||||
if args.flutter:
|
||||
|
@ -90,12 +90,15 @@ class _ConnectionPageState extends State<ConnectionPage>
|
||||
Get.forceAppUpdate();
|
||||
}
|
||||
isWindowMinisized = false;
|
||||
} else if (eventName == 'close') {
|
||||
// called more then one time
|
||||
bind.mainOnMainWindowClose();
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void onWindowClose() {
|
||||
super.onWindowClose();
|
||||
bind.mainOnMainWindowClose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Column(
|
||||
|
@ -64,6 +64,7 @@ fn main() {
|
||||
i += 1;
|
||||
}
|
||||
let click_setup = args.is_empty() && arg_exe.to_lowercase().ends_with("install.exe");
|
||||
let quick_support = args.is_empty() && arg_exe.to_lowercase().ends_with("qs.exe");
|
||||
|
||||
let reader = BinaryReader::default();
|
||||
if let Some(exe) = setup(
|
||||
@ -72,7 +73,9 @@ fn main() {
|
||||
click_setup || args.contains(&"--silent-install".to_owned()),
|
||||
) {
|
||||
if click_setup {
|
||||
args = vec!["--install".to_owned()]
|
||||
args = vec!["--install".to_owned()];
|
||||
} else if quick_support {
|
||||
args = vec!["--quick_support".to_owned()];
|
||||
}
|
||||
execute(exe, args);
|
||||
}
|
||||
|
@ -14,6 +14,7 @@ pub fn core_main() -> Option<Vec<String>> {
|
||||
let mut i = 0;
|
||||
let mut _is_elevate = false;
|
||||
let mut _is_run_as_system = false;
|
||||
let mut _is_quick_support = false;
|
||||
let mut _is_flutter_connect = false;
|
||||
let mut arg_exe = Default::default();
|
||||
for arg in std::env::args() {
|
||||
@ -29,6 +30,8 @@ pub fn core_main() -> Option<Vec<String>> {
|
||||
_is_elevate = true;
|
||||
} else if arg == "--run-as-system" {
|
||||
_is_run_as_system = true;
|
||||
} else if arg == "--quick_support" {
|
||||
_is_quick_support = true;
|
||||
} else {
|
||||
args.push(arg);
|
||||
}
|
||||
@ -40,6 +43,11 @@ pub fn core_main() -> Option<Vec<String>> {
|
||||
return core_main_invoke_new_connection(std::env::args());
|
||||
}
|
||||
let click_setup = cfg!(windows) && args.is_empty() && crate::common::is_setup(&arg_exe);
|
||||
#[cfg(not(feature = "flutter"))]
|
||||
{
|
||||
_is_quick_support =
|
||||
cfg!(windows) && args.is_empty() && arg_exe.to_lowercase().ends_with("qs.exe");
|
||||
}
|
||||
if click_setup {
|
||||
args.push("--install".to_owned());
|
||||
flutter_args.push("--install".to_string());
|
||||
@ -81,8 +89,12 @@ pub fn core_main() -> Option<Vec<String>> {
|
||||
}
|
||||
}
|
||||
#[cfg(windows)]
|
||||
#[cfg(feature = "quick_start")]
|
||||
if !crate::platform::is_installed() && args.is_empty() && !_is_elevate && !_is_run_as_system {
|
||||
if !crate::platform::is_installed()
|
||||
&& args.is_empty()
|
||||
&& _is_quick_support
|
||||
&& !_is_elevate
|
||||
&& !_is_run_as_system
|
||||
{
|
||||
if let Err(e) = crate::portable_service::client::start_portable_service() {
|
||||
log::error!("Failed to start portable service:{:?}", e);
|
||||
}
|
||||
|
@ -1178,6 +1178,7 @@ pub fn main_account_auth_result() -> String {
|
||||
}
|
||||
|
||||
pub fn main_on_main_window_close() {
|
||||
// may called more than one times
|
||||
#[cfg(windows)]
|
||||
crate::portable_service::client::drop_portable_service_shared_memory();
|
||||
}
|
||||
|
@ -237,11 +237,10 @@ pub mod server {
|
||||
fn run_exit_check() {
|
||||
loop {
|
||||
if EXIT.lock().unwrap().clone() {
|
||||
std::thread::sleep(Duration::from_secs(1));
|
||||
log::info!("exit from seperate check thread");
|
||||
std::thread::sleep(Duration::from_millis(50));
|
||||
std::process::exit(0);
|
||||
}
|
||||
std::thread::sleep(Duration::from_secs(1));
|
||||
std::thread::sleep(Duration::from_millis(50));
|
||||
}
|
||||
}
|
||||
|
||||
@ -406,9 +405,8 @@ pub mod server {
|
||||
Pong => {
|
||||
nack = 0;
|
||||
}
|
||||
ConnCount(Some(_n)) => {
|
||||
#[cfg(not(feature = "quick_start"))]
|
||||
if _n == 0 {
|
||||
ConnCount(Some(n)) => {
|
||||
if n == 0 {
|
||||
log::info!("Connnection count equals 0, exit");
|
||||
stream.send(&Data::DataPortableService(WillClose)).await.ok();
|
||||
break;
|
||||
@ -436,7 +434,6 @@ pub mod server {
|
||||
break;
|
||||
}
|
||||
stream.send(&Data::DataPortableService(Ping)).await.ok();
|
||||
#[cfg(not(feature = "quick_start"))]
|
||||
stream.send(&Data::DataPortableService(ConnCount(None))).await.ok();
|
||||
}
|
||||
}
|
||||
@ -626,6 +623,17 @@ pub mod client {
|
||||
use DataPortableService::*;
|
||||
let rx = Arc::new(tokio::sync::Mutex::new(rx));
|
||||
let postfix = IPC_PROFIX;
|
||||
#[cfg(feature = "flutter")]
|
||||
let quick_support = {
|
||||
let args: Vec<_> = std::env::args().collect();
|
||||
args.contains(&"--quick_support".to_string())
|
||||
};
|
||||
#[cfg(not(feature = "flutter"))]
|
||||
let quick_support = std::env::current_exe()
|
||||
.unwrap_or("".into())
|
||||
.to_string_lossy()
|
||||
.to_lowercase()
|
||||
.ends_with("qs.exe");
|
||||
|
||||
match new_listener(postfix).await {
|
||||
Ok(mut incoming) => loop {
|
||||
@ -663,8 +671,10 @@ pub mod client {
|
||||
*PORTABLE_SERVICE_RUNNING.lock().unwrap() = true;
|
||||
},
|
||||
ConnCount(None) => {
|
||||
let cnt = crate::server::CONN_COUNT.lock().unwrap().clone();
|
||||
stream.send(&Data::DataPortableService(ConnCount(Some(cnt)))).await.ok();
|
||||
if !quick_support {
|
||||
let cnt = crate::server::CONN_COUNT.lock().unwrap().clone();
|
||||
stream.send(&Data::DataPortableService(ConnCount(Some(cnt)))).await.ok();
|
||||
}
|
||||
},
|
||||
WillClose => {
|
||||
log::info!("portable service will close");
|
||||
|
19
src/ui.rs
19
src/ui.rs
@ -15,7 +15,7 @@ use hbb_common::{
|
||||
protobuf::Message as _,
|
||||
rendezvous_proto::*,
|
||||
tcp::FramedStream,
|
||||
tokio::{self, sync::mpsc},
|
||||
tokio,
|
||||
};
|
||||
|
||||
use crate::common::get_app_name;
|
||||
@ -44,23 +44,6 @@ lazy_static::lazy_static! {
|
||||
|
||||
struct UIHostHandler;
|
||||
|
||||
// to-do: dead code?
|
||||
fn check_connect_status(
|
||||
reconnect: bool,
|
||||
) -> (
|
||||
Arc<Mutex<Status>>,
|
||||
Arc<Mutex<HashMap<String, String>>>,
|
||||
mpsc::UnboundedSender<ipc::Data>,
|
||||
Arc<Mutex<String>>,
|
||||
) {
|
||||
let status = Arc::new(Mutex::new((0, false, 0, "".to_owned())));
|
||||
let options = Arc::new(Mutex::new(Config::get_options()));
|
||||
let (tx, rx) = mpsc::unbounded_channel::<ipc::Data>();
|
||||
let password = Arc::new(Mutex::new(String::default()));
|
||||
std::thread::spawn(move || crate::ui_interface::check_connect_status_(reconnect, rx));
|
||||
(status, options, tx, password)
|
||||
}
|
||||
|
||||
pub fn start(args: &mut [String]) {
|
||||
#[cfg(target_os = "macos")]
|
||||
if args.len() == 1 && args[0] == "--server" {
|
||||
|
Loading…
Reference in New Issue
Block a user