Description
When using neu appify <url> without the --title flag, the plugin fetches the page to extract its <title>. The getTitle() function only uses https.get(), so:
- HTTP URLs (e.g.
http://localhost:8080, http://localhost:3333, or any http:// site) fail when auto-fetching the title.
- Users see:
TypeError [ERR_INVALID_PROTOCOL]: Protocol "http:" not supported. Expected "https:"
- Users are forced to pass
--title for any HTTP URL.
Expected behavior
Title fetching should work for both http:// and https:// URLs so that neu appify http://localhost:3333 works without --title.
Steps to reproduce
- Install neu and add the appify plugin:
neu plugins --add @neutralinojs/appify
- Serve a local site over HTTP, e.g.
npx serve . -p 3333 in a folder with an index.html
- Run:
neu appify http://localhost:3333 (without --title)
- Observe:
ERR_INVALID_PROTOCOL instead of the app being created
Proposed fix
Parse the URL and use require('http') or https based on the URL protocol (e.g. via new URL(url).protocol or url.parse(url).protocol), so both http: and https: are supported in getTitle().
Description
When using
neu appify <url>without the--titleflag, the plugin fetches the page to extract its<title>. ThegetTitle()function only useshttps.get(), so:http://localhost:8080,http://localhost:3333, or anyhttp://site) fail when auto-fetching the title.TypeError [ERR_INVALID_PROTOCOL]: Protocol "http:" not supported. Expected "https:"--titlefor any HTTP URL.Expected behavior
Title fetching should work for both
http://andhttps://URLs so thatneu appify http://localhost:3333works without--title.Steps to reproduce
neu plugins --add @neutralinojs/appifynpx serve . -p 3333in a folder with anindex.htmlneu appify http://localhost:3333(without--title)ERR_INVALID_PROTOCOLinstead of the app being createdProposed fix
Parse the URL and use
require('http')orhttpsbased on the URL protocol (e.g. vianew URL(url).protocolorurl.parse(url).protocol), so bothhttp:andhttps:are supported ingetTitle().