mirror of
https://github.com/responsively-org/responsively-app
synced 2024-11-15 00:47:17 +00:00
Merge pull request #392 from jzabala/feat/add-file-schema
feat(desktop-app): add file schema on address bar for filesystem paths
This commit is contained in:
commit
2c4a3a4cc7
1 changed files with 4 additions and 1 deletions
|
@ -5,6 +5,7 @@ import FavIconOff from '@material-ui/icons/StarBorder';
|
||||||
import FavIconOn from '@material-ui/icons/Star';
|
import FavIconOn from '@material-ui/icons/Star';
|
||||||
import {Tooltip} from '@material-ui/core';
|
import {Tooltip} from '@material-ui/core';
|
||||||
import {Icon} from 'flwww';
|
import {Icon} from 'flwww';
|
||||||
|
import fs from 'fs';
|
||||||
import HomePlusIcon from '../icons/HomePlus';
|
import HomePlusIcon from '../icons/HomePlus';
|
||||||
import DeleteCookieIcon from '../icons/DeleteCookie';
|
import DeleteCookieIcon from '../icons/DeleteCookie';
|
||||||
import DeleteStorageIcon from '../icons/DeleteStorage';
|
import DeleteStorageIcon from '../icons/DeleteStorage';
|
||||||
|
@ -252,11 +253,13 @@ class AddressBar extends React.Component<Props> {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
_normalize = address => {
|
_normalize = (address: string) => {
|
||||||
if (address.indexOf('://') === -1) {
|
if (address.indexOf('://') === -1) {
|
||||||
let protocol = 'https://';
|
let protocol = 'https://';
|
||||||
if (address.startsWith('localhost') || address.startsWith('127.0.0.1')) {
|
if (address.startsWith('localhost') || address.startsWith('127.0.0.1')) {
|
||||||
protocol = 'http://';
|
protocol = 'http://';
|
||||||
|
} else if (fs.existsSync(address)) {
|
||||||
|
protocol = 'file://';
|
||||||
}
|
}
|
||||||
address = `${protocol}${address}`;
|
address = `${protocol}${address}`;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue