Customizing the Web site with the path in mind

If you are experiencing problems with "Everything", post here for assistance.
Post Reply
rseiler
Posts: 41
Joined: Fri Aug 15, 2014 7:08 pm

Customizing the Web site with the path in mind

Post by rseiler »

Hello. Since the release of the new version, I've rediscovered Everything for the first time in many years and am loving it. I think it's an incredible achievement given its size. It seems impossibly fast, too.

My question centers on the Web server. I've seen the page about customization, including the server files, which I've implemented, but not being involved in Web design I'm wondering if the sort of customization I have in mind is even possible.

Let's say the location you're indexing is the G drive and you've added one top-level folder to Everything. For example:

g:\my dropbox

And there are scores of subfolders, of course.

When navigating or searching the site, you're going to see paths like:
g:\my dropbox\files\folder1\folder2

I'm trying to clean up the results so that the "g:\my dropbox" part of the path isn't displayed, preferably even when you click into a given path and it displays the entire thing in the address bar.

My only thought on this so far was instead of adding "g:\my dropbox" to Everything, add the series of folders directly beneath it, but results still show the entire path that way.

Thanks
void
Developer
Posts: 16750
Joined: Fri Oct 16, 2009 11:31 pm

Re: Customizing the Web site with the path in mind

Post by void »

You will need to use javascript to completely customize the Everything webserver.
Using subst might be the easiest way to do this without the need to customize the web server (see further below).

Sorry this is a bit basic, but a good start if you want to write your own javascript page for the Everything web server.
It will require some knowledge with javascript.

Please copy everything.htm to %APPDATA%\Everything\HTTP Server
you will be able to access this file from http://localhost/everything.htm

To specify the search use ?s=<search> for example:
http://localhost/everything.htm?s=hello

Source:

Code: Select all

<html>
<head>
<script language="javascript" >

function ProcessTheData(jsonTexto) {

	var i;
	
	document.write("<pre>");

	for(i=0;i<jsonTexto.results.length;i++)
	{
		document.write(jsonTexto.results[i].name+"\n");
	}

	document.write("</pre>");
}

var QueryString = function () {
	
	// This function is anonymous, is executed immediately and 
	// the return value is assigned to QueryString!
	var query_string = {};
	var query = window.location.search.substring(1);
	var vars = query.split("&");

	for (var i=0;i<vars.length;i++) {

		var pair = vars[i].split("=");

		// If first entry with this name
		if (typeof query_string[pair[0]] === "undefined") {

			query_string[pair[0]] = pair[1];

		// If second entry with this name
		} else if (typeof query_string[pair[0]] === "string") {

			var arr = [ query_string[pair[0]], pair[1] ];
			query_string[pair[0]] = arr;

		// If third or later entry with this name
		} else {
			query_string[pair[0]].push(pair[1]);
		}
	} 
	return query_string;
} ();

var xobj = new XMLHttpRequest();
xobj.overrideMimeType("application/json");
xobj.open('GET', '/?s=' + QueryString.s + '&j=1', true);
xobj.onreadystatechange = function () {

	if (xobj.readyState == 4) {

		var jsonTexto = eval("("+xobj.responseText+")");
        ProcessTheData(jsonTexto);
	}
}

xobj.send();

</script>

</head>
<body>
</body>
</html>
JSON object information here:
http://www.voidtools.com/forum/viewtopic.php?f=5&t=1782

Using subst
Using subst might be the easiest way to do this without the need to customize the web server.
With out using the horrible long path G:\my dropbox, we can substitute that with just Z:

Please try substituting Z: as G:\my dropbox:
  • From a command prompt, run:

    Code: Select all

    subst Z: "G:\my dropbox"
  • In Everything, from the Tools menu, click Options.
  • Click the NTFS tab.
  • Make sure only the Z: is included in the index.
  • Click OK.
Please also consider multiple instances. With multiple instances you can specify a custom index just for your HTTP server.
rseiler
Posts: 41
Joined: Fri Aug 15, 2014 7:08 pm

Re: Customizing the Web site with the path in mind

Post by rseiler »

Thanks. I will get on this and report back.
rseiler
Posts: 41
Joined: Fri Aug 15, 2014 7:08 pm

Re: Customizing the Web site with the path in mind

Post by rseiler »

I've been playing around with SUBST and NET USE (for shares) to map drives to particular directories. That would be a good solution but for some complications.

First, I should mention that such drives do not show up in the NTFS section, but that's not really the problem since they can be added via Folders (at least on Server 2003).

The main problem though is that unless you have Everything running in an active session, the date and size of the folders/files as viewed on the Web server for drives created this way do not show up, just the folder/file names (regular drives are fine). So, if Everything is running via the Everything Client service or via Scheduled Task (unattended), that happens.

That's as tested on Server 2003 (very likely the same with XP).

On Win 8.1 (very likely the same for Win7) it's worse, since you can't actually add such drives when clicking Add in Folders (they're not listed). So in this case you have to add them via the .INI manually, and when you do only the drive letters for these drives appear on the Web server--not even filenames this time. They don't even appear in the program itself when searching. And here it doesn't matter how the program is running, manually or otherwise. It's not an index problem, since rebuilding it doesn't help, and normal drives continue to show up fine.

So, would you know of a workaround? I actually intend to use this on Server 2003, so really just some way of getting the Web server to always show the full details for these types of drives regardless of how the program is running (it's not practical to have a session open just for Everything). Having "Run as Administrator" checked makes no difference, at least.
void
Developer
Posts: 16750
Joined: Fri Oct 16, 2009 11:31 pm

Re: Customizing the Web site with the path in mind

Post by void »

I am looking into the issue. For now it looks like an issue with SHGetFileInfo and running the Everything client as Local Service.
rseiler
Posts: 41
Joined: Fri Aug 15, 2014 7:08 pm

Re: Customizing the Web site with the path in mind

Post by rseiler »

Thanks

I can add a few points of clarification/correction to my last post.

First, SUBST drives do show up in NTFS if you have "Auto include new fixed volumes" checked. It doesn't make a difference for this issue though.

Next, SUBST not showing up via Add in Folders in Win7/8 has nothing to do with Everything but rather this:
http://answers.microsoft.com/en-us/wind ... 5926e01aaa

So, creating the SUBST from an elevated prompt does make it visible to Everything. Same for NET USE. Though it doesn't have a bearing on the overall issue.

Given that, as far as this issue is concerned, I don't think there are any notable differences from XP all the way to Win8.

I should mention one interesting thing I stumbled upon on XP/2003 (won't work in Win7+) with the Everything client service: if you check "allow service to interact with desktop" on the service's Log On tab, when Everything is running as a service you actually have access to its icon (UI)!

And this part is expected and consistent: when you look into the UI then when running that way, you'll note that SUBST drives no longer appear in NTFS and are not visible browsing with Add in Folders. Further, if you rebuild the index then, there are no traces of them in the results. So, this is just to confirm that it's closer to home than the Web server, that Everything itself loses some access when run as a service.
void
Developer
Posts: 16750
Joined: Fri Oct 16, 2009 11:31 pm

Re: Customizing the Web site with the path in mind

Post by void »

Thanks for the link, the local service account is causing these limitations.

I wonder if its possible to run with another account.
I haven't had much luck getting Everything to work with a different account on Windows Server 2012 when run as a client service..
rseiler
Posts: 41
Joined: Fri Aug 15, 2014 7:08 pm

Re: Customizing the Web site with the path in mind

Post by rseiler »

I had tried that in XP/2003 earlier, since I recall long ago it making a difference with some other program, but it didn't affect the problem. What I mean specifically is taking the service off the "system" account and giving it admin credentials.

I hadn't tried it in Win 8.1 though, so I changed it off "system" there and started the service. Like in XP, the Web server is accessible but with the same issue, so no luck with that.

It's odd that it doesn't work in Server 2012, since it and Win8 (or 8.1 if you're on R2) are very close cousins.
rseiler
Posts: 41
Joined: Fri Aug 15, 2014 7:08 pm

Re: Customizing the Web site with the path in mind

Post by rseiler »

rseiler wrote:The main problem though is that unless you have Everything running in an active session, the date and size of the folders/files as viewed on the Web server for drives created this way do not show up, just the folder/file names (regular drives are fine). So, if Everything is running via the Everything Client service or via Scheduled Task (unattended), that happens.
void wrote:I am looking into the issue. For now it looks like an issue with SHGetFileInfo and running the Everything client as Local Service.
This may or may not be in the release notes, but with the 1.4 beta the Web server now shows file dates/times/sizes when Everything is running as a service!
Post Reply