nwjs / nw.js

Call all Node.js modules directly from DOM/WebWorker and enable a new way of writing applications with all Web technologies.
https://nwjs.io
MIT License
40.38k stars 3.88k forks source link

Feature request: a manifest property to define directory indexes for the app:// protocol [$10] #2069

Open Mithgol opened 10 years ago

Mithgol commented 10 years ago

The app:// protocol (intoduced in v0.7.0) helps in repackaging web sites as node-webkit-based applications. “Absolute paths” starting from the “root directory” (i.e. /some/path; such paths are common in web-based applications) now start from the root directory of your node-webkit-based application (i.e. in the same directory where your package.json resides). For example, the following hyperlink would work:

<a href="/index.html">To the root index.html</a>

However, this won't work as expected:

<a href="/">To the root</a>

In node-webkit this would display a directory index of your application's root directory, such as the following:

(screenshot)

However, a web-based application would typically rely on a web server's configuration directive (such as Apache's DirectoryIndex) and expect an index file (such as index.html or index.htm) to be displayed instead.

For a further help in repackaging web sites as node-webkit-based applications, I have to request a new feature in a form of some additional property in the mainfest, such as the following:

"appDirectoryIndex": ["index.html", "index.htm"]

If a directory (instead of a file) is designated by an app:// URL, then node-webkit should search for directory index files (in order of appearance in the array given in the appDirectoryIndex property) and display the first of such files (if found any) instead of the “real” index (list of files) of that directory.

The problem is very real. Today it will become necessary for me (or some colleague) to replace all /pathnames/ with /pathnames/index.html in about ten HTML5 files on a small web site that is planned to become a node-webkit-based application. On a greater site there could be much more files and such replacement would require some scripting (involving a recursive walk though the directories and applying some cheerio to build a DOM and change only the hyperlinks).

Finally I have to admit that I also have some feeling of deja vu about this feature request, though I couldn't find any prevoius similar proposal in the issues.

There is a $10 open bounty on this issue. Add to the bounty at Bountysource.

nwjs-bot commented 8 years ago

This should be working with latest version now.

In 0.13 we changed to an optimized architecture so more features can be supported, see http://nwjs.io/blog/whats-new-in-0.13/ and it's good for keeping up with Chromium upstream -- we released with Node.js v6.0 and new Chromium versions within 1 day after upstream release.

The new version would fixed many issues reported here and we're scrubbing them. This issue is closed as we believe it should be fixed. Please leave a message if it isn't and we'll reopen it.

Mithgol commented 8 years ago

I believe that this issue is not fixed. Thus I am reopening it.

However, since chrome-extension:// protocol is used in newer verions of NW.js instead of the former app://, I am no longer sure that directory index files can be supported by NW.js without becoming less compatible with Chrome extensions.