mirror of
https://github.com/rustdesk/rustdesk.git
synced 2026-11-03 16:32:22 +00:00
feat(address-book): add a toolbar button to open the web console (#16680)
The web console is only reachable from the "More on web console" item in the menu beside the Tags heading, which is easy to miss and hidden when the tags panel is turned off. Add a button to the Address Book toolbar that opens the same URL and reuses the same tooltip text. It shows under the same conditions as the menu item: logged in, not in legacy address book mode, and write access to the current book. Signed-off-by: Cody Swartz <ctsstc@gmail.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
4d37f00af9
commit
ed6a1acce8
1 file changed
+28
@@ -21,6 +21,7 @@ import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:pull_down_button/pull_down_button.dart';
|
||||
import 'package:url_launcher/url_launcher_string.dart';
|
||||
|
||||
import '../../common.dart';
|
||||
import '../../models/platform_model.dart';
|
||||
@@ -549,6 +550,28 @@ class _PeerTabPageState extends State<PeerTabPage>
|
||||
});
|
||||
}
|
||||
|
||||
Widget _openWebConsole() {
|
||||
return _hoverAction(
|
||||
context: context,
|
||||
toolTip: translate('ab_web_console_tip'),
|
||||
child: Icon(
|
||||
Icons.open_in_new,
|
||||
size: 18,
|
||||
),
|
||||
onTap: () async {
|
||||
final url = await bind.mainGetApiServer();
|
||||
if (await canLaunchUrlString(url)) {
|
||||
launchUrlString(url);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
bool _showWebConsole(PeerTabModel model) =>
|
||||
model.currentTab == PeerTabIndex.ab.index &&
|
||||
gFFI.userModel.isLogin &&
|
||||
!gFFI.abModel.legacyMode.value &&
|
||||
gFFI.abModel.current.canWrite();
|
||||
|
||||
List<Widget> _landscapeRightActions(BuildContext context) {
|
||||
final model = Provider.of<PeerTabModel>(context);
|
||||
return [
|
||||
@@ -566,6 +589,10 @@ class _PeerTabPageState extends State<PeerTabPage>
|
||||
offstage: model.currentTab == PeerTabIndex.recent.index,
|
||||
child: PeerSortDropdown(),
|
||||
),
|
||||
Offstage(
|
||||
offstage: !_showWebConsole(model),
|
||||
child: _openWebConsole(),
|
||||
),
|
||||
Offstage(
|
||||
offstage: model.currentTab != PeerTabIndex.ab.index,
|
||||
child: _toggleTags(),
|
||||
@@ -630,6 +657,7 @@ class _PeerTabPageState extends State<PeerTabPage>
|
||||
final List<Widget> dynamicActions = [
|
||||
if (model.currentTabCachedPeers.isNotEmpty) _createMultiSelection(),
|
||||
if (model.currentTab != PeerTabIndex.recent.index) PeerSortDropdown(),
|
||||
if (_showWebConsole(model)) _openWebConsole(),
|
||||
if (model.currentTab == PeerTabIndex.ab.index) _toggleTags()
|
||||
];
|
||||
final rightWidth = availableWidth -
|
||||
|
||||
Reference in new issue
Block a user