fix some minors of custom client

This commit is contained in:
rustdesk 2024-03-15 00:26:53 +08:00
parent 228582296c
commit a9b0bc0409
8 changed files with 100 additions and 99 deletions

View File

@ -164,6 +164,7 @@ exclude = ["vdi/host", "examples/custom_plugin"]
[package.metadata.winres] [package.metadata.winres]
LegalCopyright = "Copyright © 2024 Purslane Ltd. All rights reserved." LegalCopyright = "Copyright © 2024 Purslane Ltd. All rights reserved."
ProductName = "RustDesk" ProductName = "RustDesk"
FileDescription = "RustDesk Remote Desktop"
OriginalFilename = "rustdesk.exe" OriginalFilename = "rustdesk.exe"
[target.'cfg(target_os="windows")'.build-dependencies] [target.'cfg(target_os="windows")'.build-dependencies]

View File

@ -3082,7 +3082,7 @@ Color? disabledTextColor(BuildContext context, bool enabled) {
: Theme.of(context).textTheme.titleLarge?.color?.withOpacity(0.6); : Theme.of(context).textTheme.titleLarge?.color?.withOpacity(0.6);
} }
// max 200 x 40 // max 300 x 60
Widget? loadLogo() { Widget? loadLogo() {
bool isFound = true; bool isFound = true;
final image = Image.asset( final image = Image.asset(
@ -3095,9 +3095,9 @@ Widget? loadLogo() {
); );
if (isFound) { if (isFound) {
return Container( return Container(
constraints: BoxConstraints(maxWidth: 200, maxHeight: 40), constraints: BoxConstraints(maxWidth: 300, maxHeight: 60),
child: image, child: image,
).marginOnly(bottom: 10); ).marginOnly(bottom: 16);
} else { } else {
return null; return null;
} }

View File

@ -64,6 +64,7 @@ class _OnlineStatusWidgetState extends State<OnlineStatusWidget> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final isIncomingOnly = bind.isIncomingOnly();
return Container( return Container(
height: height, height: height,
child: Obx(() => Row( child: Obx(() => Row(
@ -83,7 +84,7 @@ class _OnlineStatusWidgetState extends State<OnlineStatusWidget> {
), ),
).marginSymmetric(horizontal: em), ).marginSymmetric(horizontal: em),
Container( Container(
width: bind.isIncomingOnly() ? 240 : null, width: isIncomingOnly ? 226 : null,
child: _buildConnStatusMsg(), child: _buildConnStatusMsg(),
), ),
// stop // stop
@ -101,39 +102,40 @@ class _OnlineStatusWidgetState extends State<OnlineStatusWidget> {
), ),
// ready && public // ready && public
// No need to show the guide if is custom client. // No need to show the guide if is custom client.
if (!bind.isIncomingOnly()) Flexible( if (!isIncomingOnly)
child: Offstage( Flexible(
offstage: !(!_svcStopped.value && child: Offstage(
stateGlobal.svcStatus.value == SvcStatus.ready && offstage: !(!_svcStopped.value &&
_svcIsUsingPublicServer.value), stateGlobal.svcStatus.value == SvcStatus.ready &&
child: Row( _svcIsUsingPublicServer.value),
crossAxisAlignment: CrossAxisAlignment.center, child: Row(
children: [ crossAxisAlignment: CrossAxisAlignment.center,
Text(', ', style: TextStyle(fontSize: em)), children: [
Flexible( Text(', ', style: TextStyle(fontSize: em)),
child: InkWell( Flexible(
onTap: onUsePublicServerGuide, child: InkWell(
child: Row( onTap: onUsePublicServerGuide,
children: [ child: Row(
Flexible( children: [
child: Text( Flexible(
translate('setup_server_tip'), child: Text(
style: TextStyle( translate('setup_server_tip'),
decoration: TextDecoration.underline, style: TextStyle(
fontSize: em), decoration: TextDecoration.underline,
fontSize: em),
),
), ),
), ],
], ),
), ),
), )
) ],
], ),
), ),
), )
)
], ],
)), )),
).paddingOnly(right: bind.isIncomingOnly() ? 8 : 0); ).paddingOnly(right: isIncomingOnly ? 8 : 0);
} }
_buildConnStatusMsg() { _buildConnStatusMsg() {
@ -258,6 +260,7 @@ class _ConnectionPageState extends State<ConnectionPage>
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final isOutgoingOnly = bind.isOutgoingOnly();
return Column( return Column(
children: [ children: [
Expanded( Expanded(
@ -273,8 +276,8 @@ class _ConnectionPageState extends State<ConnectionPage>
Expanded(child: PeerTabPage()), Expanded(child: PeerTabPage()),
], ],
).paddingOnly(left: 12.0)), ).paddingOnly(left: 12.0)),
if (!bind.isOutgoingOnly()) const Divider(height: 1), if (!isOutgoingOnly) const Divider(height: 1),
if (!bind.isOutgoingOnly()) OnlineStatusWidget() if (!isOutgoingOnly) OnlineStatusWidget()
], ],
); );
} }

View File

@ -64,26 +64,49 @@ class _DesktopHomePageState extends State<DesktopHomePage>
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
super.build(context); super.build(context);
final isIncomingOnly = bind.isIncomingOnly();
return Row( return Row(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
buildLeftPane(context), buildLeftPane(context),
if (!bind.isIncomingOnly()) const VerticalDivider(width: 1), if (!isIncomingOnly) const VerticalDivider(width: 1),
if (!bind.isIncomingOnly()) Expanded(child: buildRightPane(context)), if (!isIncomingOnly) Expanded(child: buildRightPane(context)),
], ],
); );
} }
Widget buildLeftPane(BuildContext context) { Widget buildLeftPane(BuildContext context) {
final isIncomingOnly = bind.isIncomingOnly();
final isOutgoingOnly = bind.isOutgoingOnly();
final children = <Widget>[ final children = <Widget>[
if (bind.isCustomClient())
Align(
alignment: Alignment.center,
child: MouseRegion(
cursor: SystemMouseCursors.click,
child: GestureDetector(
onTap: () {
launchUrl(Uri.parse('https://rustdesk.com'));
},
child: Opacity(
opacity: 0.5,
child: Text(
translate("powered_by_me"),
overflow: TextOverflow.clip,
style: Theme.of(context).textTheme.bodySmall?.copyWith(
fontSize: 9, decoration: TextDecoration.underline),
)),
),
).marginOnly(top: 6),
),
buildTip(context), buildTip(context),
if (!bind.isOutgoingOnly()) buildIDBoard(context), if (!isOutgoingOnly) buildIDBoard(context),
if (!bind.isOutgoingOnly()) buildPasswordBoard(context), if (!isOutgoingOnly) buildPasswordBoard(context),
FutureBuilder<Widget>( FutureBuilder<Widget>(
future: buildHelpCards(), future: buildHelpCards(),
builder: (_, data) { builder: (_, data) {
if (data.hasData) { if (data.hasData) {
if (bind.isIncomingOnly()) { if (isIncomingOnly) {
if (_isInHomePage()) { if (_isInHomePage()) {
Future.delayed(Duration(milliseconds: 300), () { Future.delayed(Duration(milliseconds: 300), () {
_updateWindowSize(); _updateWindowSize();
@ -98,7 +121,7 @@ class _DesktopHomePageState extends State<DesktopHomePage>
), ),
buildPluginEntry(), buildPluginEntry(),
]; ];
if (bind.isIncomingOnly()) { if (isIncomingOnly) {
children.addAll([ children.addAll([
Divider(), Divider(),
Container( Container(
@ -119,7 +142,7 @@ class _DesktopHomePageState extends State<DesktopHomePage>
return ChangeNotifierProvider.value( return ChangeNotifierProvider.value(
value: gFFI.serverModel, value: gFFI.serverModel,
child: Container( child: Container(
width: bind.isIncomingOnly() ? 280.0 : 200.0, width: isIncomingOnly ? 280.0 : 200.0,
color: Theme.of(context).colorScheme.background, color: Theme.of(context).colorScheme.background,
child: DesktopScrollWrapper( child: DesktopScrollWrapper(
scrollController: _leftPaneScrollController, scrollController: _leftPaneScrollController,
@ -133,14 +156,7 @@ class _DesktopHomePageState extends State<DesktopHomePage>
children: children, children: children,
), ),
), ),
if (bind.isOutgoingOnly() && !bind.isDisableSettings()) if (isOutgoingOnly)
Positioned(
child: Divider(),
bottom: 26,
left: 0,
right: 0,
),
if (bind.isOutgoingOnly() && !bind.isDisableSettings())
Positioned( Positioned(
bottom: 6, bottom: 6,
left: 12, left: 12,
@ -156,7 +172,7 @@ class _DesktopHomePageState extends State<DesktopHomePage>
size: 22, size: 22,
), ),
), ),
onTap: () => DesktopSettingPage.switch2page(1), onTap: () => DesktopSettingPage.switch2page(0),
onHover: (value) => _editHover.value = value, onHover: (value) => _editHover.value = value,
), ),
), ),
@ -244,10 +260,6 @@ class _DesktopHomePageState extends State<DesktopHomePage>
} }
Widget buildPopupMenu(BuildContext context) { Widget buildPopupMenu(BuildContext context) {
if (bind.isDisableSettings()) {
return Offstage();
}
final textColor = Theme.of(context).textTheme.titleLarge?.color; final textColor = Theme.of(context).textTheme.titleLarge?.color;
RxBool hover = false.obs; RxBool hover = false.obs;
return InkWell( return InkWell(
@ -351,7 +363,7 @@ class _DesktopHomePageState extends State<DesktopHomePage>
size: 22, size: 22,
)).marginOnly(right: 8, top: 4), )).marginOnly(right: 8, top: 4),
), ),
onTap: () => DesktopSettingPage.switch2page(1), onTap: () => DesktopSettingPage.switch2page(0),
onHover: (value) => editHover.value = value, onHover: (value) => editHover.value = value,
), ),
], ],
@ -366,6 +378,7 @@ class _DesktopHomePageState extends State<DesktopHomePage>
} }
buildTip(BuildContext context) { buildTip(BuildContext context) {
final isOutgoingOnly = bind.isOutgoingOnly();
final logo = loadLogo(); final logo = loadLogo();
return Padding( return Padding(
padding: padding:
@ -380,35 +393,12 @@ class _DesktopHomePageState extends State<DesktopHomePage>
), ),
Column( Column(
children: [ children: [
Align( if (!isOutgoingOnly)
alignment: Alignment.centerLeft,
child: Text(
translate("Your Desktop"),
style: Theme.of(context).textTheme.titleLarge,
// style: TextStyle(
// // color: MyTheme.color(context).text,
// fontWeight: FontWeight.normal,
// fontSize: 19),
),
),
if (bind.isCustomClient())
Align( Align(
alignment: Alignment.centerRight, alignment: Alignment.centerLeft,
child: MouseRegion( child: Text(
cursor: SystemMouseCursors.click, translate("Your Desktop"),
child: GestureDetector( style: Theme.of(context).textTheme.titleLarge,
onTap: () {
launchUrl(Uri.parse('https://rustdesk.com'));
},
child: Text(
translate("powered_by_me"),
overflow: TextOverflow.clip,
style: Theme.of(context)
.textTheme
.bodySmall
?.copyWith(color: Colors.grey.withOpacity(0.7)),
),
),
), ),
), ),
], ],
@ -416,13 +406,13 @@ class _DesktopHomePageState extends State<DesktopHomePage>
SizedBox( SizedBox(
height: 10.0, height: 10.0,
), ),
if (!bind.isOutgoingOnly()) if (!isOutgoingOnly)
Text( Text(
translate("desk_tip"), translate("desk_tip"),
overflow: TextOverflow.clip, overflow: TextOverflow.clip,
style: Theme.of(context).textTheme.bodySmall, style: Theme.of(context).textTheme.bodySmall,
), ),
if (bind.isOutgoingOnly()) if (isOutgoingOnly)
Text( Text(
translate("outgoing_only_desk_tip"), translate("outgoing_only_desk_tip"),
overflow: TextOverflow.clip, overflow: TextOverflow.clip,
@ -449,9 +439,12 @@ class _DesktopHomePageState extends State<DesktopHomePage>
if (systemError.isNotEmpty) { if (systemError.isNotEmpty) {
return buildInstallCard("", systemError, "", () {}); return buildInstallCard("", systemError, "", () {});
} }
if (Platform.isWindows && !bind.isDisableInstallation()) { if (Platform.isWindows && !bind.isDisableInstallation()) {
if (!bind.mainIsInstalled()) { if (!bind.mainIsInstalled()) {
return buildInstallCard("", "install_tip", "Install", () async { return buildInstallCard(
"", bind.isOutgoingOnly() ? "" : "install_tip", "Install",
() async {
await rustDeskWinManager.closeAllSubWindows(); await rustDeskWinManager.closeAllSubWindows();
bind.mainGotoInstall(); bind.mainGotoInstall();
}); });
@ -598,14 +591,15 @@ class _DesktopHomePageState extends State<DesktopHomePage>
] ]
: <Widget>[]) + : <Widget>[]) +
<Widget>[ <Widget>[
Text( if (content.isNotEmpty)
translate(content), Text(
style: TextStyle( translate(content),
height: 1.5, style: TextStyle(
color: Colors.white, height: 1.5,
fontWeight: FontWeight.normal, color: Colors.white,
fontSize: 13), fontWeight: FontWeight.normal,
).marginOnly(bottom: 20) fontSize: 13),
).marginOnly(bottom: 20)
] + ] +
(btnText.isNotEmpty (btnText.isNotEmpty
? <Widget>[ ? <Widget>[

View File

@ -106,10 +106,11 @@ class _DesktopSettingPageState extends State<DesktopSettingPage>
List<_TabInfo> _settingTabs() { List<_TabInfo> _settingTabs() {
final List<_TabInfo> settingTabs = <_TabInfo>[ final List<_TabInfo> settingTabs = <_TabInfo>[
_TabInfo('General', Icons.settings_outlined, Icons.settings), _TabInfo('General', Icons.settings_outlined, Icons.settings),
if (!bind.isOutgoingOnly()) if (!bind.isOutgoingOnly() && !bind.isDisableSettings())
_TabInfo('Security', Icons.enhanced_encryption_outlined, _TabInfo('Security', Icons.enhanced_encryption_outlined,
Icons.enhanced_encryption), Icons.enhanced_encryption),
_TabInfo('Network', Icons.link_outlined, Icons.link), if (!bind.isDisableSettings())
_TabInfo('Network', Icons.link_outlined, Icons.link),
if (!bind.isIncomingOnly()) if (!bind.isIncomingOnly())
_TabInfo( _TabInfo(
'Display', Icons.desktop_windows_outlined, Icons.desktop_windows), 'Display', Icons.desktop_windows_outlined, Icons.desktop_windows),
@ -125,8 +126,8 @@ class _DesktopSettingPageState extends State<DesktopSettingPage>
List<Widget> _children() { List<Widget> _children() {
final children = [ final children = [
_General(), _General(),
if (!bind.isOutgoingOnly()) _Safety(), if (!bind.isOutgoingOnly() && !bind.isDisableSettings()) _Safety(),
_Network(), if (!bind.isDisableSettings()) _Network(),
if (!bind.isIncomingOnly()) _Display(), if (!bind.isIncomingOnly()) _Display(),
if (!bind.isIncomingOnly() && bind.pluginFeatureIsEnabled()) _Plugin(), if (!bind.isIncomingOnly() && bind.pluginFeatureIsEnabled()) _Plugin(),
if (!bind.isDisableAccount()) _Account(), if (!bind.isDisableAccount()) _Account(),

View File

@ -18,6 +18,7 @@ winapi = { version = "0.3", features = ["winbase"] }
LegalCopyright = "Copyright © 2024 Purslane Ltd. All rights reserved." LegalCopyright = "Copyright © 2024 Purslane Ltd. All rights reserved."
ProductName = "RustDesk" ProductName = "RustDesk"
OriginalFilename = "rustdesk.exe" OriginalFilename = "rustdesk.exe"
FileDescription = "RustDesk Remote Desktop"
#ProductVersion = "" #ProductVersion = ""
[target.'cfg(target_os="windows")'.build-dependencies] [target.'cfg(target_os="windows")'.build-dependencies]

View File

@ -214,5 +214,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("enable-2fa-desc", "Please set up your authenticator now. You can use an authenticator app such as Authy, Microsoft or Google Authenticator on your phone or desktop.\n\nScan the QR code with your app and enter the code that your app shows to enable two-factor authentication."), ("enable-2fa-desc", "Please set up your authenticator now. You can use an authenticator app such as Authy, Microsoft or Google Authenticator on your phone or desktop.\n\nScan the QR code with your app and enter the code that your app shows to enable two-factor authentication."),
("wrong-2fa-code", "Can't verify the code. Check that code and local time settings are correct"), ("wrong-2fa-code", "Can't verify the code. Check that code and local time settings are correct"),
("enter-2fa-title", "Two-factor authentication"), ("enter-2fa-title", "Two-factor authentication"),
("powered_by_me", "Powered by RustDesk"),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -207,7 +207,7 @@ async fn start_query_session_count(sender: std::sync::mpsc::Sender<Data>) {
fn load_icon_from_asset() -> Option<image::DynamicImage> { fn load_icon_from_asset() -> Option<image::DynamicImage> {
#[cfg(windows)] #[cfg(windows)]
if let Ok(cmd) = std::env::current_exe() { if let Ok(cmd) = std::env::current_exe() {
let path = r".\data\flutter_assets\assets\icon.ico"; let path = r".\data\flutter_assets\assets\icon.png";
if let Some(path) = cmd.parent().map(|x| x.join(path)) { if let Some(path) = cmd.parent().map(|x| x.join(path)) {
if path.exists() { if path.exists() {
if let Ok(image) = image::open(path) { if let Ok(image) = image::open(path) {