File Manager

Discussions about the usage of KeyHelp.
Post Reply
User avatar
keyhelpuser
Posts: 28
Joined: Sat 13. Mar 2021, 21:56
Location: ...earth
Contact:

File Manager

Post 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
User avatar
Alexander
Keyweb AG
Posts: 4638
Joined: Wed 20. Jan 2016, 02:23

Re: File Manager

Post 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/.
Mit freundlichen Grüßen / Best regards
Alexander Mahr

**************************************************************
Keyweb AG - Die Hosting Marke
Neuwerkstr. 45/46, 99084 Erfurt / Germany
http://www.keyweb.de - http://www.keyhelp.de
**************************************************************
User avatar
keyhelpuser
Posts: 28
Joined: Sat 13. Mar 2021, 21:56
Location: ...earth
Contact:

Re: File Manager

Post 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?
User avatar
Alexander
Keyweb AG
Posts: 4638
Joined: Wed 20. Jan 2016, 02:23

Re: File Manager

Post 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);
	}
}
Mit freundlichen Grüßen / Best regards
Alexander Mahr

**************************************************************
Keyweb AG - Die Hosting Marke
Neuwerkstr. 45/46, 99084 Erfurt / Germany
http://www.keyweb.de - http://www.keyhelp.de
**************************************************************
User avatar
keyhelpuser
Posts: 28
Joined: Sat 13. Mar 2021, 21:56
Location: ...earth
Contact:

Re: File Manager

Post 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 :(
Post Reply