Skip to content

Conversation

@tiirwaa
Copy link

@tiirwaa tiirwaa commented Sep 6, 2025

This PR adds initial support for SMB network drives. Users can now:

  • Discover SMB/Windows file-sharing devices on the local network using predefined SMB ports.
  • Connect to a host via SMB (with authentication or anonymously).
  • List available shares on the host.
  • Navigate inside shares and browse folders.
  • Create new folders and files within shares.
  • Reuse SMB sessions to improve performance and reduce connection overhead.

SMB Version Support:

  • Supported: SMB 1 (CIFS) through jcifs-ng
  • Supported: SMB 2.0, 2.1, 3.0, 3.02, 3.1.1 through SMBJ

Note: SMBJ and jcifs-ng automatically negotiates the highest supported SMB version between the client and server.

Additional Info:

The LAN discovery currently scans the network using known SMB ports (139, 445, 4450). This could be improved in future updates for more comprehensive network detection.

This is the foundation for full SMB integration; future updates will include file operations and improved error handling.

lan_discover.mp4

Andrey added 5 commits September 5, 2025 15:20
Added support to connect to an SMB host, list available shares,
and navigate through folders. Users can now browse network drives
directly from the app.
Added ProGuard rules to preserve SMBJ and DCERPC classes required for SMB
network drive support. This prevents missing class errors during release build
with R8 minification enabled.
@tiirwaa tiirwaa changed the title Implement basic SMB navigation: browse hosts, list shares, and navigate folders Implement basic SMB navigation: connect to hosts, list shares, and navigate folders Sep 6, 2025
@tiirwaa tiirwaa changed the title Implement basic SMB navigation: connect to hosts, list shares, and navigate folders Implement basic SMB Network navigation: connect to hosts, list shares, and navigate folders Sep 6, 2025
@tiirwaa
Copy link
Author

tiirwaa commented Sep 6, 2025

Related to #39

Andrey added 2 commits September 6, 2025 18:29
… reuse with SMBConnectionManager for improved efficiency
}

override fun open(context: Context, anonymous: Boolean, skipSupportedExtensions: Boolean, customMimeType: String?) {
if(isFolder)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Folders are checked and handled in the files list itself, this check is redundant. This function is only called if this holder is a file not a folder.

I know this isn't obvious, but I'm working on a proper documentation of functions.

Copy link
Author

@tiirwaa tiirwaa Sep 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed on c710c23

_dialogsState.update { it.copy(showImportPrefsDialog = file != null) }
}

fun toggleImportPrefsDialogSMB(file: SMBFileHolder?) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given the state of this PR (opening files is not implemented yet), this must be removed, otherwise it might cause problems.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed on 8583863

@Raival-e
Copy link
Owner

Raival-e commented Sep 7, 2025

This is looking so promising! I wanted to test the feature but I couldn't connect to a server, I'm not sure how the port is determined, because there is no input field for it in the dialog, this might be the reason why I couldn't connect.

Regarding the integration in the home screen, to make it easier to implement other types of cloud storages and servers, I would suggest the following:

1- In the home screen, there should be a '+' icon button in the same row of the "Storage" label, and when clicked, a drop-down menu (or a dialog) shows with all types of storages to add (for now it will just show SMB, but in the future, there will be FTP, Local Storage, etc). amd from there the dialog of adding new SMB will show.

2- The added storages should show under "Storage" section, so I'd suggest removing the separate section for the SMB from home screen to make it cleaner.

3- the storages that are added should be saved (so that we don't need to rewrite all the credentials every time the app is opened), you can make a data class for SMB storage with all the required credentials (and other information like name, type, etc), and saved it as a set to the datastore in PreferencesManager. Then those will be retrieved and displayed in storage section as discussed in second point.

4- The design of the "add new SMB dialog" must follow the style of the other dialogs in the app. See "Jump to path" dialog for reference.

Regarding the SMB implementation, I'm not familiar with the libraries used, so I need to test the app and see if any further improvements required.

Huge thanks for your contribution, and I'm looking forward to test the app after fixing the bug regarding connecting to a server.

Andrey added 3 commits September 7, 2025 06:06
Folders are already filtered in the files list, making this check unnecessary.
This function is only invoked for files, not folders.
Given the current state of this PR (opening files is not implemented yet),
keeping this function could cause issues. It has been removed to prevent
unintended behavior.
@tiirwaa
Copy link
Author

tiirwaa commented Sep 7, 2025

[f739cfc](/Raival-e/Prism-File-Explorer/pull/213/commits/f739cfcbcf6fe34e1cdfcf9aaa4078fa111f2cc8)

Fixed the design of the 'Add New SMB' dialog to match the style of other dialogs. f739cfc

@tiirwaa tiirwaa changed the title Implement basic SMB Network navigation: connect to hosts, list shares, and navigate folders Implement basic SMB Network navigation: connect to hosts, list shares, navigate folders, create folders and files Sep 7, 2025
@tiirwaa
Copy link
Author

tiirwaa commented Sep 7, 2025

Now when pressing "Show more", a field to enter the port is displayed.

sdsdfsdfsfsd

@Raival-e
Copy link
Owner

Raival-e commented Sep 7, 2025

I couldn't make it work, it keep showing this error message. What am I missing? I used Mixplorer to create the server, and I tested it using Amaze File Explorer.

Screenshot_20250907_195449_Prism File Explorer

@tiirwaa
Copy link
Author

tiirwaa commented Sep 7, 2025

I couldn't make it work, it keep showing this error message. What am I missing? I used Mixplorer to create the server, and I tested it using Amaze File Explorer.

Possible cause: SMB 1.0

Mixplorer likely uses SMB 1.0 (CIFS) for its server feature, which is not supported by SMBJ.
SMBJ supports only SMB 2.0, 2.1, 3.0, 3.02, and 3.1.1.

To properly test your setup, try sharing a folder using:

  • Samba on Linux (with SMB 2.0 or newer enabled), or

  • Windows file sharing, or

  • Any other server that supports SMB 2.0 or above.

@Raival-e
Copy link
Owner

Raival-e commented Sep 7, 2025

Mixplorer likely uses SMB 1.0

okay, that's probably why it didn't connect. I thought this is straightforward like FTP, I couldn't find an app that has SMB2 or higher. Anyways, I'll try from Windows.

@tiirwaa
Copy link
Author

tiirwaa commented Sep 7, 2025

Initial support for SMB 1.0 added on commit 79ed7e6 using jcifs-ng. Added a dropdown in the SMB connection dialog to select the SMB version.

asdasdasdascd

@tiirwaa tiirwaa changed the title Implement basic SMB Network navigation: connect to hosts, list shares, navigate folders, create folders and files Implement basic SMB 1.0, 2.0, 3.0+ Network navigation: connect to hosts, list shares, navigate folders, create folders and files Sep 7, 2025
@Raival-e
Copy link
Owner

Raival-e commented Sep 8, 2025

Thanks, it does connect now, however, using the same setup as before (using mixplorer to make the server), no files are shown, even though when opening the same server on MT Manager, for example, there are shared files.

Prism (no shared files shown):
https://github.com/user-attachments/assets/9408bd70-4f82-4d64-8fbc-c6bbab812b92

MT Manager:
https://github.com/user-attachments/assets/5f22790d-acf0-4a5c-b447-66eb0b85f77c

@tiirwaa
Copy link
Author

tiirwaa commented Sep 8, 2025

I tested it on my phone with MiXplorer, and it works. However, I noticed that if I enter the wrong port, username, or password, the same thing you showed in the video happens — it doesn’t detect the error, but this only happens with SMB1. I’m going to check that. Still, I can list the shares, view the contents, and create folders and files correctly, both in SMB1 using JCIFS and in SMB2 (Windows and Linux) using SMBJ.

@Raival-e
Copy link
Owner

Raival-e commented Sep 8, 2025

I know for a fact that the username, password and port are correct. In my tests, the username and password are both 123 for test purposes. The port is 4450 (the default value Mixplorer sets). What should I put in the domain?

… only if connection succeeds, preventing invalid credentials from being stored
@tiirwaa
Copy link
Author

tiirwaa commented Sep 8, 2025

I know for a fact that the username, password and port are correct. In my tests, the username and password are both 123 for test purposes. The port is 4450 (the default value Mixplorer sets). What should I put in the domain?

Please click on the "More" button and enter the port manually. The domain is optional. I have already fixed the issue that made SMB1 appear to authenticate correctly without listing the shares. I’ve tested it in Mixplorer and on Linux using SMB2. 539ede6

@Raival-e
Copy link
Owner

Raival-e commented Sep 9, 2025

I'm still getting the same error despite all credentials being correct (including the port). I'm busy rn, I will try to use Windows when I get a chance.

I also tested the anonymous connection, it did connect, but the one folder shown doesn't open (video below).

Screen_Recording_20250909_231349_Prism.File.Explorer.mp4

- Implements a function to scan the LAN for SMB/Windows file sharing devices.
- Displays devices in the format 'hostname (IP:port)'.
- Adds a dialog to show the scanned devices and allow selection.
- Currently, scanning is based on network and predefined known SMB ports; this could be improved in the future.
@tiirwaa
Copy link
Author

tiirwaa commented Sep 10, 2025

New LAN discovery feature! Scan your local network for SMB/Windows file-sharing devices and quickly connect to them. Currently, the scan uses predefined SMB ports, but this can be improved in the future.

lan_discover.mp4

@Raival-e
Copy link
Owner

Raival-e commented Sep 19, 2025

I'm really sorry for keeping this pull request hanging like this, but I couldn't make this SMB feature to work in my device, I'm not sure if it's my phone or the network, I need to investigate more. I've tested FTP in this app before and it was much straightforward than this.
I obviously can't merge this pull request without properly testing it. I guess I'll keep this until I got enough time to look into the connection issue, no changes (at least major ones) will be made to the app, so you won't have to resolve any major conflicts.

Thanks.

@tiirwaa
Copy link
Author

tiirwaa commented Sep 19, 2025

I’ve also been very busy with my work lately and didn’t have much time to work on the project these last few days. Please don’t make a pull request until the SMB feature is fully implemented (opening files, etc.).

I still have pending the following three things you requested in your previous comments:

  1. On the home screen, there should be a "+" icon button in the same row as the "Storage" label, and when clicked, a drop-down menu (or dialog) should show with all types of storages to add (for now it will just show SMB, but in the future there will be FTP, Local Storage, etc). From there, the dialog for adding a new SMB will show.
  1. The added storages should show under the "Storage" section, so I’d suggest removing the separate SMB section from the home screen to make it cleaner.
  1. The storages that are added should be saved (so that we don’t need to re-enter all the credentials every time the app is opened). You can create a data class for SMB storage with all the required credentials (and other information like name, type, etc.), and save it as a set to the datastore in PreferencesManager. Then those will be retrieved and displayed in the storage section as discussed in the second point.

Also, I still need to run more tests on my side to identify the issue that might be causing problems for you.

Thanks.

@HanzoDev1375
Copy link
Contributor

@Raival-e Hey buddy, don't be too hard on yourself.

@Jds548
Copy link

Jds548 commented Oct 4, 2025

@Raival-e Hey buddy, don't be too hard on yourself.

There are a lot of file managers. His accuracy makes this app to point out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants