mirror of
https://github.com/Llewellynvdm/nativefier.git
synced 2024-09-22 01:29:02 +00:00
Merge branch 'master' of github.com:jiahaog/nativefier
This commit is contained in:
commit
14a4846c1a
@ -23,7 +23,7 @@ $ npm install nativefier -g
|
|||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
Creating an native desktop app for [medium.com](medium.com):
|
Creating a native desktop app for [medium.com](medium.com):
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ nativefier "http://medium.com"
|
$ nativefier "http://medium.com"
|
||||||
@ -161,7 +161,7 @@ A template app with the appropriate event listeners and callbacks set up is incl
|
|||||||
Tested mostly on OSX, but should work for windows and linux.
|
Tested mostly on OSX, but should work for windows and linux.
|
||||||
|
|
||||||
### Back Button
|
### Back Button
|
||||||
A back button is intentionally not provided because the tool is designed for single page apps. However, if desired, an executable can built for any url, and simply pressing the `backspace` key will take the user back to the previous page.
|
A back button is intentionally not provided because the tool is designed for single page apps. However, if desired, an executable can be built for any url, and simply pressing the `backspace` key will take the user back to the previous page.
|
||||||
|
|
||||||
## Issues
|
## Issues
|
||||||
|
|
||||||
|
@ -103,7 +103,7 @@ function getTitle(url, callback) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const $ = cheerio.load(body);
|
const $ = cheerio.load(body);
|
||||||
const pageTitle = $("title").text();
|
const pageTitle = $("title").text().replace(/\//g, "");
|
||||||
callback(null, pageTitle);
|
callback(null, pageTitle);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -115,7 +115,7 @@ function normalizeUrl(testUrl) {
|
|||||||
if (!parsed.protocol) {
|
if (!parsed.protocol) {
|
||||||
normalized = 'http://' + normalized;
|
normalized = 'http://' + normalized;
|
||||||
}
|
}
|
||||||
if (!validator.isURL(normalized, {require_protocol: true})) {
|
if (!validator.isURL(normalized, {require_protocol: true, require_tld: false})) {
|
||||||
throw `Your Url: "${normalized}" is invalid!`;
|
throw `Your Url: "${normalized}" is invalid!`;
|
||||||
}
|
}
|
||||||
return normalized;
|
return normalized;
|
||||||
|
Loading…
Reference in New Issue
Block a user