Page 1 of 1

File Manager

Posted: Thu 13. Nov 2025, 22:23
by keyhelpuser
Hi, how can I hide the folders and files listed below:
.cache ,
.config ,
.local ,
.ssh ,
files ,
logs ,
tmp ,
.bashrc ,
.bash_history ,
.bash_logout ,
.profile ,

I would like to only for user access to the www folder by File Manager. Is there such an option to configure?
Regards

Re: File Manager

Posted: Fri 14. Nov 2025, 09:41
by Alexander
Hello,

you can use the white-label feature for that purpose. Just use some JavaScript code to hide the table rows you don't want to see.

Please note, that your users might like to still have access to at least the directories files/, logs/, tmp/.

Re: File Manager

Posted: Sat 15. Nov 2025, 15:40
by keyhelpuser
Alexander wrote: Fri 14. Nov 2025, 09:41 Hello,

you can use the white-label feature for that purpose. Just use some JavaScript code to hide the table rows you don't want to see.

Please note, that your users might like to still have access to at least the directories files/, logs/, tmp/.
can you help me with this?

Re: File Manager

Posted: Mon 17. Nov 2025, 15:44
by Alexander
keyhelpuser wrote: Sat 15. Nov 2025, 15:40 can you help me with this?

Okay, the following code should work.
It hides all the items in the hidePaths array and updates the total number in the table foot accordingly.

Code: Select all

let url = new URL(window.location.href);
let page = url.searchParams.get("page");
let path = url.searchParams.get("path");

if (page === "client_file_manager" && path === "/") {
  	// Hide paths
	let hidePaths = [
    		".cache",
        	".config",
        	".local",
        	".ssh",
		".bash_history",
		".bash_logout",
		".bashrc",
      		".profile",
      		"bin",
      		"dev",
      		"etc",
      		"lib",
      		"lib64",
      		"usr",
        	// ... add paths as you like
    	];

	let rows = document.querySelectorAll('#form-file-manager table tbody tr');

	rows.forEach(row => {
		let path = row.querySelector('input[name="config_id"]');
        	if (!path) return;
        	if (hidePaths.includes(path.value)) {
            		row.style.display = "none";
        	}
   	 });
  
  	// Update total number 
	let totalCell = document.querySelector(
		'#form-file-manager table tfoot td'
	);

	if (totalCell) {
      		let visibleRows = Array.from(rows).filter(r => r.style.display !== "none").length;
      		totalCell.textContent = totalCell.textContent.replace(/^\s*\d+/, visibleRows);
	}
}

Re: File Manager

Posted: Tue 18. Nov 2025, 00:01
by keyhelpuser
Alexander wrote: Mon 17. Nov 2025, 15:44
keyhelpuser wrote: Sat 15. Nov 2025, 15:40 can you help me with this?

Okay, the following code should work.
It hides all the items in the hidePaths array and updates the total number in the table foot accordingly.

Code: Select all

let url = new URL(window.location.href);
let page = url.searchParams.get("page");
let path = url.searchParams.get("path");

if (page === "client_file_manager" && path === "/") {
  	// Hide paths
	let hidePaths = [
    		".cache",
        	".config",
        	".local",
        	".ssh",
		".bash_history",
		".bash_logout",
		".bashrc",
      		".profile",
      		"bin",
      		"dev",
      		"etc",
      		"lib",
      		"lib64",
      		"usr",
        	// ... add paths as you like
    	];

	let rows = document.querySelectorAll('#form-file-manager table tbody tr');

	rows.forEach(row => {
		let path = row.querySelector('input[name="config_id"]');
        	if (!path) return;
        	if (hidePaths.includes(path.value)) {
            		row.style.display = "none";
        	}
   	 });
  
  	// Update total number 
	let totalCell = document.querySelector(
		'#form-file-manager table tfoot td'
	);

	if (totalCell) {
      		let visibleRows = Array.from(rows).filter(r => r.style.display !== "none").length;
      		totalCell.textContent = totalCell.textContent.replace(/^\s*\d+/, visibleRows);
	}
}
unfortunately it doesn't work :(

Re: File Manager

Posted: Tue 18. Nov 2025, 09:38
by Alexander
unfortunately it doesn't work :(
It works fine on multiple servers on my end.
Without showing a potential error message from your browsers console there is now way someone could tell what went wrong on your side.


I see in your signature, you may use a custom theme, this might be the reason for this.

Re: File Manager

Posted: Tue 18. Nov 2025, 11:29
by keyhelpuser
original theme and firefox

Re: File Manager

Posted: Tue 18. Nov 2025, 12:01
by Alexander
It also works fine in firefox for me.

Have you copied the code into the right input field?
What does the browser console say when accessing the page?

Re: File Manager

Posted: Tue 18. Nov 2025, 19:49
by keyhelpuser
I have no errors on both macOS and Ubuntu?!
console-keyhelp-firefox.png

Re: File Manager

Posted: Wed 19. Nov 2025, 13:40
by Alexander
You can send me the KeyHelp admin login credentials and i will have a look.