commit
						de6c0693cf
					
				@ -260,6 +260,7 @@ class _ConnectionPageState extends State<ConnectionPage>
 | 
			
		||||
                bool checked = await bind.mainCheckSuperUserPermission();
 | 
			
		||||
                if (checked) {
 | 
			
		||||
                  bind.mainSetOption(key: "stop-service", value: "");
 | 
			
		||||
                  bind.mainSetOption(key: "access-mode", value: "");
 | 
			
		||||
                }
 | 
			
		||||
              },
 | 
			
		||||
              child: Text(translate("Start Service"), style: textStyle))
 | 
			
		||||
 | 
			
		||||
@ -413,6 +413,13 @@ class _GeneralState extends State<_General> {
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
enum _AccessMode {
 | 
			
		||||
  custom,
 | 
			
		||||
  full,
 | 
			
		||||
  view,
 | 
			
		||||
  deny,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
class _Safety extends StatefulWidget {
 | 
			
		||||
  const _Safety({Key? key}) : super(key: key);
 | 
			
		||||
 | 
			
		||||
@ -459,26 +466,113 @@ class _SafetyState extends State<_Safety> with AutomaticKeepAliveClientMixin {
 | 
			
		||||
 | 
			
		||||
  Widget permissions(context) {
 | 
			
		||||
    bool enabled = !locked;
 | 
			
		||||
    return _Card(title: 'Permissions', children: [
 | 
			
		||||
      _OptionCheckBox(context, 'Enable Keyboard/Mouse', 'enable-keyboard',
 | 
			
		||||
          enabled: enabled),
 | 
			
		||||
      _OptionCheckBox(context, 'Enable Clipboard', 'enable-clipboard',
 | 
			
		||||
          enabled: enabled),
 | 
			
		||||
      _OptionCheckBox(context, 'Enable File Transfer', 'enable-file-transfer',
 | 
			
		||||
          enabled: enabled),
 | 
			
		||||
      _OptionCheckBox(context, 'Enable Audio', 'enable-audio',
 | 
			
		||||
          enabled: enabled),
 | 
			
		||||
      _OptionCheckBox(context, 'Enable TCP Tunneling', 'enable-tunnel',
 | 
			
		||||
          enabled: enabled),
 | 
			
		||||
      _OptionCheckBox(context, 'Enable Remote Restart', 'enable-remote-restart',
 | 
			
		||||
          enabled: enabled),
 | 
			
		||||
      _OptionCheckBox(
 | 
			
		||||
          context, 'Enable Recording Session', 'enable-record-session',
 | 
			
		||||
          enabled: enabled),
 | 
			
		||||
      _OptionCheckBox(context, 'Enable remote configuration modification',
 | 
			
		||||
          'allow-remote-config-modification',
 | 
			
		||||
          enabled: enabled),
 | 
			
		||||
    ]);
 | 
			
		||||
 | 
			
		||||
    return _futureBuilder(future: () async {
 | 
			
		||||
      bool stopService = option2bool(
 | 
			
		||||
          'stop-service', await bind.mainGetOption(key: 'stop-service'));
 | 
			
		||||
      final accessMode = await bind.mainGetOption(key: 'access-mode');
 | 
			
		||||
      return {'stopService': stopService, 'accessMode': accessMode};
 | 
			
		||||
    }(), hasData: (data) {
 | 
			
		||||
      var map = data! as Map<String, dynamic>;
 | 
			
		||||
      bool stopService = map['stopService'] as bool;
 | 
			
		||||
      String accessMode = map['accessMode'] as String;
 | 
			
		||||
      _AccessMode mode;
 | 
			
		||||
      if (stopService) {
 | 
			
		||||
        mode = _AccessMode.deny;
 | 
			
		||||
      } else {
 | 
			
		||||
        if (accessMode == 'full') {
 | 
			
		||||
          mode = _AccessMode.full;
 | 
			
		||||
        } else if (accessMode == 'view') {
 | 
			
		||||
          mode = _AccessMode.view;
 | 
			
		||||
        } else {
 | 
			
		||||
          mode = _AccessMode.custom;
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
      String initialKey;
 | 
			
		||||
      bool? fakeValue;
 | 
			
		||||
      switch (mode) {
 | 
			
		||||
        case _AccessMode.custom:
 | 
			
		||||
          initialKey = '';
 | 
			
		||||
          fakeValue = null;
 | 
			
		||||
          break;
 | 
			
		||||
        case _AccessMode.full:
 | 
			
		||||
          initialKey = 'full';
 | 
			
		||||
          fakeValue = true;
 | 
			
		||||
          break;
 | 
			
		||||
        case _AccessMode.view:
 | 
			
		||||
          initialKey = 'view';
 | 
			
		||||
          fakeValue = false;
 | 
			
		||||
          break;
 | 
			
		||||
        case _AccessMode.deny:
 | 
			
		||||
          initialKey = 'deny';
 | 
			
		||||
          fakeValue = false;
 | 
			
		||||
          break;
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      return _Card(title: 'Permissions', children: [
 | 
			
		||||
        _ComboBox(
 | 
			
		||||
            keys: [
 | 
			
		||||
              '',
 | 
			
		||||
              'full',
 | 
			
		||||
              'view',
 | 
			
		||||
              'deny'
 | 
			
		||||
            ],
 | 
			
		||||
            values: [
 | 
			
		||||
              translate('Custom'),
 | 
			
		||||
              translate('Full Access'),
 | 
			
		||||
              translate('Screen Share'),
 | 
			
		||||
              translate('Deny remote access'),
 | 
			
		||||
            ],
 | 
			
		||||
            initialKey: initialKey,
 | 
			
		||||
            onChanged: (mode) async {
 | 
			
		||||
              String modeValue;
 | 
			
		||||
              bool stopService;
 | 
			
		||||
              if (mode == 'deny') {
 | 
			
		||||
                modeValue = '';
 | 
			
		||||
                stopService = true;
 | 
			
		||||
              } else {
 | 
			
		||||
                modeValue = mode;
 | 
			
		||||
                stopService = false;
 | 
			
		||||
              }
 | 
			
		||||
              await bind.mainSetOption(key: 'access-mode', value: modeValue);
 | 
			
		||||
              await bind.mainSetOption(
 | 
			
		||||
                  key: 'stop-service',
 | 
			
		||||
                  value: bool2option('stop-service', stopService));
 | 
			
		||||
              setState(() {});
 | 
			
		||||
            }).marginOnly(left: _kContentHMargin),
 | 
			
		||||
        Offstage(
 | 
			
		||||
          offstage: mode == _AccessMode.deny,
 | 
			
		||||
          child: Column(
 | 
			
		||||
            children: [
 | 
			
		||||
              _OptionCheckBox(
 | 
			
		||||
                  context, 'Enable Keyboard/Mouse', 'enable-keyboard',
 | 
			
		||||
                  enabled: enabled, fakeValue: fakeValue),
 | 
			
		||||
              _OptionCheckBox(context, 'Enable Clipboard', 'enable-clipboard',
 | 
			
		||||
                  enabled: enabled, fakeValue: fakeValue),
 | 
			
		||||
              _OptionCheckBox(
 | 
			
		||||
                  context, 'Enable File Transfer', 'enable-file-transfer',
 | 
			
		||||
                  enabled: enabled, fakeValue: fakeValue),
 | 
			
		||||
              _OptionCheckBox(context, 'Enable Audio', 'enable-audio',
 | 
			
		||||
                  enabled: enabled, fakeValue: fakeValue),
 | 
			
		||||
              _OptionCheckBox(context, 'Enable TCP Tunneling', 'enable-tunnel',
 | 
			
		||||
                  enabled: enabled, fakeValue: fakeValue),
 | 
			
		||||
              _OptionCheckBox(
 | 
			
		||||
                  context, 'Enable Remote Restart', 'enable-remote-restart',
 | 
			
		||||
                  enabled: enabled, fakeValue: fakeValue),
 | 
			
		||||
              _OptionCheckBox(
 | 
			
		||||
                  context, 'Enable Recording Session', 'enable-record-session',
 | 
			
		||||
                  enabled: enabled, fakeValue: fakeValue),
 | 
			
		||||
              _OptionCheckBox(
 | 
			
		||||
                  context,
 | 
			
		||||
                  'Enable remote configuration modification',
 | 
			
		||||
                  'allow-remote-config-modification',
 | 
			
		||||
                  enabled: enabled,
 | 
			
		||||
                  fakeValue: fakeValue),
 | 
			
		||||
            ],
 | 
			
		||||
          ),
 | 
			
		||||
        )
 | 
			
		||||
      ]);
 | 
			
		||||
    });
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  Widget password(BuildContext context) {
 | 
			
		||||
@ -566,12 +660,6 @@ class _SafetyState extends State<_Safety> with AutomaticKeepAliveClientMixin {
 | 
			
		||||
  Widget more(BuildContext context) {
 | 
			
		||||
    bool enabled = !locked;
 | 
			
		||||
    return _Card(title: 'Security', children: [
 | 
			
		||||
      _OptionCheckBox(context, 'Deny remote access', 'stop-service',
 | 
			
		||||
          checkedIcon: const Icon(
 | 
			
		||||
            Icons.warning_amber_rounded,
 | 
			
		||||
            color: kColorWarn,
 | 
			
		||||
          ),
 | 
			
		||||
          enabled: enabled),
 | 
			
		||||
      Offstage(
 | 
			
		||||
        offstage: !Platform.isWindows,
 | 
			
		||||
        child: _OptionCheckBox(context, 'Enable RDP', 'enable-rdp',
 | 
			
		||||
@ -941,7 +1029,8 @@ Widget _OptionCheckBox(BuildContext context, String label, String key,
 | 
			
		||||
    {Function()? update,
 | 
			
		||||
    bool reverse = false,
 | 
			
		||||
    bool enabled = true,
 | 
			
		||||
    Icon? checkedIcon}) {
 | 
			
		||||
    Icon? checkedIcon,
 | 
			
		||||
    bool? fakeValue}) {
 | 
			
		||||
  return _futureBuilder(
 | 
			
		||||
      future: bind.mainGetOption(key: key),
 | 
			
		||||
      hasData: (data) {
 | 
			
		||||
@ -958,6 +1047,11 @@ Widget _OptionCheckBox(BuildContext context, String label, String key,
 | 
			
		||||
          }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (fakeValue != null) {
 | 
			
		||||
          ref.value = fakeValue;
 | 
			
		||||
          enabled = false;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return GestureDetector(
 | 
			
		||||
          child: Obx(
 | 
			
		||||
            () => Row(
 | 
			
		||||
 | 
			
		||||
@ -249,10 +249,12 @@ class DesktopTab extends StatelessWidget {
 | 
			
		||||
    var block = false.obs;
 | 
			
		||||
    return Obx(() => MouseRegion(
 | 
			
		||||
          onEnter: (_) async {
 | 
			
		||||
            if (!option2bool(
 | 
			
		||||
            var access_mode = await bind.mainGetOption(key: 'access-mode');
 | 
			
		||||
            var option = option2bool(
 | 
			
		||||
                'allow-remote-config-modification',
 | 
			
		||||
                await bind.mainGetOption(
 | 
			
		||||
                    key: 'allow-remote-config-modification'))) {
 | 
			
		||||
                    key: 'allow-remote-config-modification'));
 | 
			
		||||
            if (access_mode == 'view' || (access_mode.isEmpty && !option)) {
 | 
			
		||||
              var time0 = DateTime.now().millisecondsSinceEpoch;
 | 
			
		||||
              await bind.mainCheckMouseTime();
 | 
			
		||||
              Timer(const Duration(milliseconds: 120), () async {
 | 
			
		||||
 | 
			
		||||
@ -374,5 +374,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
 | 
			
		||||
        ("Other", "其他"),
 | 
			
		||||
        ("Confirm before closing multiple tabs", "关闭多个标签页时向您确认"),
 | 
			
		||||
        ("Keyboard Settings", "键盘设置"),
 | 
			
		||||
        ("Custom", "自定义"),
 | 
			
		||||
        ("Full Access", "完全访问"),
 | 
			
		||||
        ("Screen Share", "仅共享屏幕"),
 | 
			
		||||
    ].iter().cloned().collect();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -374,5 +374,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
 | 
			
		||||
        ("Other", ""),
 | 
			
		||||
        ("Confirm before closing multiple tabs", ""),
 | 
			
		||||
        ("Keyboard Settings", ""),
 | 
			
		||||
        ("Custom", ""),
 | 
			
		||||
        ("Full Access", ""),
 | 
			
		||||
        ("Screen Share", ""),
 | 
			
		||||
    ].iter().cloned().collect();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -374,5 +374,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
 | 
			
		||||
        ("Other", ""),
 | 
			
		||||
        ("Confirm before closing multiple tabs", ""),
 | 
			
		||||
        ("Keyboard Settings", ""),
 | 
			
		||||
        ("Custom", ""),
 | 
			
		||||
        ("Full Access", ""),
 | 
			
		||||
        ("Screen Share", ""),
 | 
			
		||||
    ].iter().cloned().collect();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -374,5 +374,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
 | 
			
		||||
        ("Other", ""),
 | 
			
		||||
        ("Confirm before closing multiple tabs", ""),
 | 
			
		||||
        ("Keyboard Settings", ""),
 | 
			
		||||
        ("Custom", ""),
 | 
			
		||||
        ("Full Access", ""),
 | 
			
		||||
        ("Screen Share", ""),
 | 
			
		||||
    ].iter().cloned().collect();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -374,5 +374,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
 | 
			
		||||
        ("Other", ""),
 | 
			
		||||
        ("Confirm before closing multiple tabs", ""),
 | 
			
		||||
        ("Keyboard Settings", ""),
 | 
			
		||||
        ("Custom", ""),
 | 
			
		||||
        ("Full Access", ""),
 | 
			
		||||
        ("Screen Share", ""),
 | 
			
		||||
    ].iter().cloned().collect();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -374,5 +374,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
 | 
			
		||||
        ("Other", ""),
 | 
			
		||||
        ("Confirm before closing multiple tabs", ""),
 | 
			
		||||
        ("Keyboard Settings", ""),
 | 
			
		||||
        ("Custom", ""),
 | 
			
		||||
        ("Full Access", ""),
 | 
			
		||||
        ("Screen Share", ""),
 | 
			
		||||
    ].iter().cloned().collect();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -374,5 +374,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
 | 
			
		||||
        ("Other", ""),
 | 
			
		||||
        ("Confirm before closing multiple tabs", ""),
 | 
			
		||||
        ("Keyboard Settings", ""),
 | 
			
		||||
        ("Custom", ""),
 | 
			
		||||
        ("Full Access", ""),
 | 
			
		||||
        ("Screen Share", ""),
 | 
			
		||||
    ].iter().cloned().collect();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -374,5 +374,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
 | 
			
		||||
        ("Other", ""),
 | 
			
		||||
        ("Confirm before closing multiple tabs", ""),
 | 
			
		||||
        ("Keyboard Settings", ""),
 | 
			
		||||
        ("Custom", ""),
 | 
			
		||||
        ("Full Access", ""),
 | 
			
		||||
        ("Screen Share", ""),
 | 
			
		||||
    ].iter().cloned().collect();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -374,5 +374,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
 | 
			
		||||
        ("Other", ""),
 | 
			
		||||
        ("Confirm before closing multiple tabs", ""),
 | 
			
		||||
        ("Keyboard Settings", ""),
 | 
			
		||||
        ("Custom", ""),
 | 
			
		||||
        ("Full Access", ""),
 | 
			
		||||
        ("Screen Share", ""),
 | 
			
		||||
    ].iter().cloned().collect();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -374,5 +374,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
 | 
			
		||||
        ("Other", ""),
 | 
			
		||||
        ("Confirm before closing multiple tabs", ""),
 | 
			
		||||
        ("Keyboard Settings", ""),
 | 
			
		||||
        ("Custom", ""),
 | 
			
		||||
        ("Full Access", ""),
 | 
			
		||||
        ("Screen Share", ""),
 | 
			
		||||
    ].iter().cloned().collect();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -374,5 +374,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
 | 
			
		||||
        ("Other", "他の"),
 | 
			
		||||
        ("Confirm before closing multiple tabs", "同時に複数のタブを閉じる前に確認する"),
 | 
			
		||||
        ("Keyboard Settings", ""),
 | 
			
		||||
        ("Custom", ""),
 | 
			
		||||
        ("Full Access", ""),
 | 
			
		||||
        ("Screen Share", ""),
 | 
			
		||||
    ].iter().cloned().collect();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -374,5 +374,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
 | 
			
		||||
        ("Other", ""),
 | 
			
		||||
        ("Confirm before closing multiple tabs", ""),
 | 
			
		||||
        ("Keyboard Settings", ""),
 | 
			
		||||
        ("Custom", ""),
 | 
			
		||||
        ("Full Access", ""),
 | 
			
		||||
        ("Screen Share", ""),
 | 
			
		||||
    ].iter().cloned().collect();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -374,5 +374,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
 | 
			
		||||
        ("Other", ""),
 | 
			
		||||
        ("Confirm before closing multiple tabs", ""),
 | 
			
		||||
        ("Keyboard Settings", ""),
 | 
			
		||||
        ("Custom", ""),
 | 
			
		||||
        ("Full Access", ""),
 | 
			
		||||
        ("Screen Share", ""),
 | 
			
		||||
    ].iter().cloned().collect();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -374,5 +374,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
 | 
			
		||||
        ("Other", ""),
 | 
			
		||||
        ("Confirm before closing multiple tabs", ""),
 | 
			
		||||
        ("Keyboard Settings", ""),
 | 
			
		||||
        ("Custom", ""),
 | 
			
		||||
        ("Full Access", ""),
 | 
			
		||||
        ("Screen Share", ""),
 | 
			
		||||
    ].iter().cloned().collect();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -374,5 +374,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
 | 
			
		||||
        ("Other", ""),
 | 
			
		||||
        ("Confirm before closing multiple tabs", ""),
 | 
			
		||||
        ("Keyboard Settings", ""),
 | 
			
		||||
        ("Custom", ""),
 | 
			
		||||
        ("Full Access", ""),
 | 
			
		||||
        ("Screen Share", ""),
 | 
			
		||||
    ].iter().cloned().collect();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -374,5 +374,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
 | 
			
		||||
        ("Other", ""),
 | 
			
		||||
        ("Confirm before closing multiple tabs", ""),
 | 
			
		||||
        ("Keyboard Settings", ""),
 | 
			
		||||
        ("Custom", ""),
 | 
			
		||||
        ("Full Access", ""),
 | 
			
		||||
        ("Screen Share", ""),
 | 
			
		||||
    ].iter().cloned().collect();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -374,5 +374,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
 | 
			
		||||
        ("Other", ""),
 | 
			
		||||
        ("Confirm before closing multiple tabs", ""),
 | 
			
		||||
        ("Keyboard Settings", ""),
 | 
			
		||||
        ("Custom", ""),
 | 
			
		||||
        ("Full Access", ""),
 | 
			
		||||
        ("Screen Share", ""),
 | 
			
		||||
    ].iter().cloned().collect();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -374,5 +374,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
 | 
			
		||||
        ("Other", ""),
 | 
			
		||||
        ("Confirm before closing multiple tabs", ""),
 | 
			
		||||
        ("Keyboard Settings", ""),
 | 
			
		||||
        ("Custom", ""),
 | 
			
		||||
        ("Full Access", ""),
 | 
			
		||||
        ("Screen Share", ""),
 | 
			
		||||
    ].iter().cloned().collect();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -374,5 +374,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
 | 
			
		||||
        ("Other", ""),
 | 
			
		||||
        ("Confirm before closing multiple tabs", ""),
 | 
			
		||||
        ("Keyboard Settings", ""),
 | 
			
		||||
        ("Custom", ""),
 | 
			
		||||
        ("Full Access", ""),
 | 
			
		||||
        ("Screen Share", ""),
 | 
			
		||||
    ].iter().cloned().collect();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -374,5 +374,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
 | 
			
		||||
        ("Other", ""),
 | 
			
		||||
        ("Confirm before closing multiple tabs", ""),
 | 
			
		||||
        ("Keyboard Settings", ""),
 | 
			
		||||
        ("Custom", ""),
 | 
			
		||||
        ("Full Access", ""),
 | 
			
		||||
        ("Screen Share", ""),
 | 
			
		||||
    ].iter().cloned().collect();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -374,5 +374,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
 | 
			
		||||
        ("Other", "其他"),
 | 
			
		||||
        ("Confirm before closing multiple tabs", "關閉多個分頁前跟我確認"),
 | 
			
		||||
        ("Keyboard Settings", "鍵盤設置"),
 | 
			
		||||
        ("Custom", "自定義"),
 | 
			
		||||
        ("Full Access", "完全訪問"),
 | 
			
		||||
        ("Screen Share", "僅共享屏幕"),
 | 
			
		||||
    ].iter().cloned().collect();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -374,5 +374,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
 | 
			
		||||
        ("Other", ""),
 | 
			
		||||
        ("Confirm before closing multiple tabs", ""),
 | 
			
		||||
        ("Keyboard Settings", ""),
 | 
			
		||||
        ("Custom", ""),
 | 
			
		||||
        ("Full Access", ""),
 | 
			
		||||
        ("Screen Share", ""),
 | 
			
		||||
    ].iter().cloned().collect();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -374,5 +374,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
 | 
			
		||||
        ("Other", ""),
 | 
			
		||||
        ("Confirm before closing multiple tabs", ""),
 | 
			
		||||
        ("Keyboard Settings", ""),
 | 
			
		||||
        ("Custom", ""),
 | 
			
		||||
        ("Full Access", ""),
 | 
			
		||||
        ("Screen Share", ""),
 | 
			
		||||
    ].iter().cloned().collect();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -167,12 +167,12 @@ impl Connection {
 | 
			
		||||
            port_forward_address: "".to_owned(),
 | 
			
		||||
            tx_to_cm,
 | 
			
		||||
            authorized: false,
 | 
			
		||||
            keyboard: Config::get_option("enable-keyboard").is_empty(),
 | 
			
		||||
            clipboard: Config::get_option("enable-clipboard").is_empty(),
 | 
			
		||||
            audio: Config::get_option("enable-audio").is_empty(),
 | 
			
		||||
            file: Config::get_option("enable-file-transfer").is_empty(),
 | 
			
		||||
            restart: Config::get_option("enable-remote-restart").is_empty(),
 | 
			
		||||
            recording: Config::get_option("enable-record-session").is_empty(),
 | 
			
		||||
            keyboard: Connection::permission("enable-keyboard"),
 | 
			
		||||
            clipboard: Connection::permission("enable-clipboard"),
 | 
			
		||||
            audio: Connection::permission("enable-audio"),
 | 
			
		||||
            file: Connection::permission("enable-file-transfer"),
 | 
			
		||||
            restart: Connection::permission("enable-remote-restart"),
 | 
			
		||||
            recording: Connection::permission("enable-record-session"),
 | 
			
		||||
            last_test_delay: 0,
 | 
			
		||||
            lock_after_session_end: false,
 | 
			
		||||
            show_remote_cursor: false,
 | 
			
		||||
@ -922,6 +922,20 @@ impl Connection {
 | 
			
		||||
        false
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    pub fn permission(enable_prefix_option: &str) -> bool {
 | 
			
		||||
        #[cfg(feature = "flutter")]
 | 
			
		||||
        #[cfg(not(any(target_os = "android", target_os = "ios")))]
 | 
			
		||||
        {
 | 
			
		||||
            let access_mode = Config::get_option("access-mode");
 | 
			
		||||
            if access_mode == "full" {
 | 
			
		||||
                return true;
 | 
			
		||||
            } else if access_mode == "view" {
 | 
			
		||||
                return false;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        return Config::get_option(enable_prefix_option).is_empty();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    async fn on_message(&mut self, msg: Message) -> bool {
 | 
			
		||||
        if let Some(message::Union::LoginRequest(lr)) = msg.union {
 | 
			
		||||
            self.lr = lr.clone();
 | 
			
		||||
@ -950,7 +964,7 @@ impl Connection {
 | 
			
		||||
            }
 | 
			
		||||
            match lr.union {
 | 
			
		||||
                Some(login_request::Union::FileTransfer(ft)) => {
 | 
			
		||||
                    if !Config::get_option("enable-file-transfer").is_empty() {
 | 
			
		||||
                    if !Connection::permission("enable-file-transfer") {
 | 
			
		||||
                        self.send_login_error("No permission of file transfer")
 | 
			
		||||
                            .await;
 | 
			
		||||
                        sleep(1.).await;
 | 
			
		||||
@ -965,8 +979,8 @@ impl Connection {
 | 
			
		||||
                        pf.port = 3389;
 | 
			
		||||
                        is_rdp = true;
 | 
			
		||||
                    }
 | 
			
		||||
                    if is_rdp && !Config::get_option("enable-rdp").is_empty()
 | 
			
		||||
                        || !is_rdp && !Config::get_option("enable-tunnel").is_empty()
 | 
			
		||||
                    if is_rdp && !Connection::permission("enable-rdp")
 | 
			
		||||
                        || !is_rdp && !Connection::permission("enable-tunnel")
 | 
			
		||||
                    {
 | 
			
		||||
                        if is_rdp {
 | 
			
		||||
                            self.send_login_error("No permission of RDP").await;
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user