mirror of
https://github.com/veeso/termscp.git
synced 2025-12-07 09:36:00 -08:00
fix: cfg unix forbidden in rust .82
This commit is contained in:
@@ -280,12 +280,12 @@ impl AuthActivity {
|
||||
|
||||
fn load_bookmark_smb_into_gui(&mut self, form_tab: FormTab, params: SmbParams) {
|
||||
self.mount_address(form_tab, params.address.as_str());
|
||||
#[cfg(unix)]
|
||||
#[cfg(posix)]
|
||||
self.mount_port(form_tab, params.port);
|
||||
self.mount_username(form_tab, params.username.as_deref().unwrap_or(""));
|
||||
self.mount_password(form_tab, params.password.as_deref().unwrap_or(""));
|
||||
self.mount_smb_share(form_tab, ¶ms.share);
|
||||
#[cfg(unix)]
|
||||
#[cfg(posix)]
|
||||
self.mount_smb_workgroup(form_tab, params.workgroup.as_deref().unwrap_or(""));
|
||||
}
|
||||
|
||||
|
||||
@@ -952,14 +952,14 @@ impl Component<Msg, NoUserEvent> for InputSmbShare {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(unix)]
|
||||
#[cfg(posix)]
|
||||
#[derive(MockComponent)]
|
||||
pub struct InputSmbWorkgroup {
|
||||
component: Input,
|
||||
form_tab: FormTab,
|
||||
}
|
||||
|
||||
#[cfg(unix)]
|
||||
#[cfg(posix)]
|
||||
impl InputSmbWorkgroup {
|
||||
pub fn new(host: &str, form_tab: FormTab, color: Color) -> Self {
|
||||
Self {
|
||||
@@ -978,7 +978,7 @@ impl InputSmbWorkgroup {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(unix)]
|
||||
#[cfg(posix)]
|
||||
impl Component<Msg, NoUserEvent> for InputSmbWorkgroup {
|
||||
fn on(&mut self, ev: Event<NoUserEvent>) -> Option<Msg> {
|
||||
let on_key_down = match self.form_tab {
|
||||
|
||||
@@ -13,7 +13,7 @@ pub use bookmarks::{
|
||||
BookmarkName, BookmarkSavePassword, BookmarksList, DeleteBookmarkPopup, DeleteRecentPopup,
|
||||
RecentsList,
|
||||
};
|
||||
#[cfg(unix)]
|
||||
#[cfg(posix)]
|
||||
pub use form::InputSmbWorkgroup;
|
||||
pub use form::{
|
||||
HostBridgeProtocolRadio, InputAddress, InputKubeClientCert, InputKubeClientKey,
|
||||
|
||||
@@ -151,7 +151,7 @@ impl AuthActivity {
|
||||
if params.address.is_empty() {
|
||||
return Err("Invalid address");
|
||||
}
|
||||
#[cfg(unix)]
|
||||
#[cfg(posix)]
|
||||
if params.port == 0 {
|
||||
return Err("Invalid port");
|
||||
}
|
||||
|
||||
@@ -93,7 +93,7 @@ pub enum AuthFormId {
|
||||
S3SecurityToken,
|
||||
S3SessionToken,
|
||||
SmbShare,
|
||||
#[cfg(unix)]
|
||||
#[cfg(posix)]
|
||||
SmbWorkgroup,
|
||||
Username,
|
||||
WebDAVUri,
|
||||
@@ -193,9 +193,9 @@ pub enum UiAuthFormMsg {
|
||||
S3SessionTokenBlurUp,
|
||||
SmbShareBlurDown,
|
||||
SmbShareBlurUp,
|
||||
#[cfg(unix)]
|
||||
#[cfg(posix)]
|
||||
SmbWorkgroupDown,
|
||||
#[cfg(unix)]
|
||||
#[cfg(posix)]
|
||||
SmbWorkgroupUp,
|
||||
UsernameBlurDown,
|
||||
UsernameBlurUp,
|
||||
|
||||
@@ -269,7 +269,7 @@ impl AuthActivity {
|
||||
.active(match self.host_bridge_input_mask() {
|
||||
InputMask::Localhost => unreachable!(),
|
||||
InputMask::Generic => &Id::HostBridge(AuthFormId::RemoteDirectory),
|
||||
#[cfg(unix)]
|
||||
#[cfg(posix)]
|
||||
InputMask::Smb => &Id::HostBridge(AuthFormId::SmbWorkgroup),
|
||||
#[cfg(windows)]
|
||||
InputMask::Smb => &Id::HostBridge(AuthFormId::RemoteDirectory),
|
||||
@@ -285,7 +285,7 @@ impl AuthActivity {
|
||||
.active(match self.remote_input_mask() {
|
||||
InputMask::Localhost => unreachable!(),
|
||||
InputMask::Generic => &Id::Remote(AuthFormId::RemoteDirectory),
|
||||
#[cfg(unix)]
|
||||
#[cfg(posix)]
|
||||
InputMask::Smb => &Id::Remote(AuthFormId::SmbWorkgroup),
|
||||
#[cfg(windows)]
|
||||
InputMask::Smb => &Id::Remote(AuthFormId::RemoteDirectory),
|
||||
@@ -400,7 +400,7 @@ impl AuthActivity {
|
||||
.active(match self.host_bridge_input_mask() {
|
||||
InputMask::Localhost => unreachable!(),
|
||||
InputMask::Generic => &Id::HostBridge(AuthFormId::Password),
|
||||
#[cfg(unix)]
|
||||
#[cfg(posix)]
|
||||
InputMask::Smb => &Id::HostBridge(AuthFormId::SmbWorkgroup),
|
||||
#[cfg(windows)]
|
||||
InputMask::Smb => &Id::HostBridge(AuthFormId::Password),
|
||||
@@ -416,7 +416,7 @@ impl AuthActivity {
|
||||
.active(match self.remote_input_mask() {
|
||||
InputMask::Localhost => unreachable!(),
|
||||
InputMask::Generic => &Id::Remote(AuthFormId::Password),
|
||||
#[cfg(unix)]
|
||||
#[cfg(posix)]
|
||||
InputMask::Smb => &Id::Remote(AuthFormId::SmbWorkgroup),
|
||||
#[cfg(windows)]
|
||||
InputMask::Smb => &Id::Remote(AuthFormId::Password),
|
||||
@@ -760,28 +760,28 @@ impl AuthActivity {
|
||||
};
|
||||
assert!(self.app.active(id).is_ok());
|
||||
}
|
||||
#[cfg(unix)]
|
||||
#[cfg(posix)]
|
||||
UiMsg::HostBridge(UiAuthFormMsg::SmbWorkgroupDown) => {
|
||||
assert!(self
|
||||
.app
|
||||
.active(&Id::HostBridge(AuthFormId::RemoteDirectory))
|
||||
.is_ok());
|
||||
}
|
||||
#[cfg(unix)]
|
||||
#[cfg(posix)]
|
||||
UiMsg::Remote(UiAuthFormMsg::SmbWorkgroupDown) => {
|
||||
assert!(self
|
||||
.app
|
||||
.active(&Id::Remote(AuthFormId::RemoteDirectory))
|
||||
.is_ok());
|
||||
}
|
||||
#[cfg(unix)]
|
||||
#[cfg(posix)]
|
||||
UiMsg::HostBridge(UiAuthFormMsg::SmbWorkgroupUp) => {
|
||||
assert!(self
|
||||
.app
|
||||
.active(&Id::HostBridge(AuthFormId::Password))
|
||||
.is_ok());
|
||||
}
|
||||
#[cfg(unix)]
|
||||
#[cfg(posix)]
|
||||
UiMsg::Remote(UiAuthFormMsg::SmbWorkgroupUp) => {
|
||||
assert!(self.app.active(&Id::Remote(AuthFormId::Password)).is_ok());
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ impl AuthActivity {
|
||||
self.mount_kube_namespace(FormTab::HostBridge, "");
|
||||
self.mount_kube_username(FormTab::HostBridge, "");
|
||||
self.mount_smb_share(FormTab::HostBridge, "");
|
||||
#[cfg(unix)]
|
||||
#[cfg(posix)]
|
||||
self.mount_smb_workgroup(FormTab::HostBridge, "");
|
||||
self.mount_webdav_uri(FormTab::HostBridge, "");
|
||||
|
||||
@@ -102,7 +102,7 @@ impl AuthActivity {
|
||||
self.mount_kube_namespace(FormTab::Remote, "");
|
||||
self.mount_kube_username(FormTab::Remote, "");
|
||||
self.mount_smb_share(FormTab::Remote, "");
|
||||
#[cfg(unix)]
|
||||
#[cfg(posix)]
|
||||
self.mount_smb_workgroup(FormTab::Remote, "");
|
||||
self.mount_webdav_uri(FormTab::Remote, "");
|
||||
|
||||
@@ -1042,7 +1042,7 @@ impl AuthActivity {
|
||||
.is_ok());
|
||||
}
|
||||
|
||||
#[cfg(unix)]
|
||||
#[cfg(posix)]
|
||||
pub(super) fn mount_smb_workgroup(&mut self, form_tab: FormTab, workgroup: &str) {
|
||||
let color = self.theme().auth_address;
|
||||
let id = Self::form_tab_id(form_tab, AuthFormId::SmbWorkgroup);
|
||||
@@ -1130,7 +1130,7 @@ impl AuthActivity {
|
||||
}
|
||||
|
||||
/// Collect s3 input values from view
|
||||
#[cfg(unix)]
|
||||
#[cfg(posix)]
|
||||
pub(super) fn get_smb_params_input(&self, form_tab: FormTab) -> SmbParams {
|
||||
let share: String = self.get_input_smb_share(form_tab);
|
||||
let workgroup: Option<String> = self.get_input_smb_workgroup(form_tab);
|
||||
@@ -1394,7 +1394,7 @@ impl AuthActivity {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(unix)]
|
||||
#[cfg(posix)]
|
||||
pub(super) fn get_input_smb_workgroup(&self, form_tab: FormTab) -> Option<String> {
|
||||
match self
|
||||
.app
|
||||
@@ -1494,7 +1494,7 @@ impl AuthActivity {
|
||||
.unwrap_or_default()
|
||||
)
|
||||
}
|
||||
#[cfg(unix)]
|
||||
#[cfg(posix)]
|
||||
ProtocolParams::Smb(params) => {
|
||||
let username: String = match params.username {
|
||||
None => String::default(),
|
||||
@@ -1749,7 +1749,7 @@ impl AuthActivity {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(unix)]
|
||||
#[cfg(posix)]
|
||||
fn get_host_bridge_smb_view(&self) -> [Id; 4] {
|
||||
match self.app.focus() {
|
||||
Some(
|
||||
@@ -1796,7 +1796,7 @@ impl AuthActivity {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(unix)]
|
||||
#[cfg(posix)]
|
||||
fn get_remote_smb_view(&self) -> [Id; 4] {
|
||||
match self.app.focus() {
|
||||
Some(
|
||||
|
||||
@@ -16,7 +16,7 @@ use tuirealm::props::{
|
||||
Alignment, BorderSides, BorderType, Borders, Color, InputType, Style, TableBuilder, TextSpan,
|
||||
};
|
||||
use tuirealm::{Component, Event, MockComponent, NoUserEvent, State, StateValue};
|
||||
#[cfg(unix)]
|
||||
#[cfg(posix)]
|
||||
use uzers::{get_group_by_gid, get_user_by_uid};
|
||||
|
||||
pub use self::chmod::ChmodPopup;
|
||||
@@ -533,7 +533,7 @@ impl FileInfoPopup {
|
||||
.add_col(TextSpan::from("Last access time: "))
|
||||
.add_col(TextSpan::new(atime.as_str()).fg(Color::LightRed));
|
||||
// User
|
||||
#[cfg(unix)]
|
||||
#[cfg(posix)]
|
||||
let username: String = match file.metadata().uid {
|
||||
Some(uid) => match get_user_by_uid(uid) {
|
||||
Some(user) => user.name().to_string_lossy().to_string(),
|
||||
@@ -544,7 +544,7 @@ impl FileInfoPopup {
|
||||
#[cfg(windows)]
|
||||
let username: String = format!("{}", file.metadata().uid.unwrap_or(0));
|
||||
// Group
|
||||
#[cfg(unix)]
|
||||
#[cfg(posix)]
|
||||
let group: String = match file.metadata().gid {
|
||||
Some(gid) => match get_group_by_gid(gid) {
|
||||
Some(group) => group.name().to_string_lossy().to_string(),
|
||||
|
||||
@@ -365,7 +365,7 @@ mod test {
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(unix)]
|
||||
#[cfg(posix)]
|
||||
fn test_should_suggest_absolute_path() {
|
||||
let mut states = OwnStates {
|
||||
files: vec![
|
||||
|
||||
@@ -494,9 +494,9 @@ impl FileTransferActivity {
|
||||
}
|
||||
UiMsg::ShowChmodPopup => {
|
||||
let selected_file = match self.browser.tab() {
|
||||
#[cfg(unix)]
|
||||
#[cfg(posix)]
|
||||
FileExplorerTab::HostBridge => self.get_local_selected_entries(),
|
||||
#[cfg(unix)]
|
||||
#[cfg(posix)]
|
||||
FileExplorerTab::FindHostBridge => self.get_found_selected_entries(),
|
||||
FileExplorerTab::Remote => self.get_remote_selected_entries(),
|
||||
FileExplorerTab::FindRemote => self.get_found_selected_entries(),
|
||||
|
||||
Reference in New Issue
Block a user