nav tabs on admin dashboard

This commit is contained in:
2019-03-07 00:20:34 -06:00
parent f73d6ae228
commit e4f473f376
11661 changed files with 216240 additions and 1544253 deletions
-31
View File
@@ -1,31 +0,0 @@
#!/usr/bin/env node
/* eslint-disable no-nested-ternary */
'use strict';
var meow = require('meow');
var internalIp = require('./');
var cli = meow({
help: [
'Usage',
' $ internal-ip',
'',
'Options',
' -4, --ipv4 Return the IPv4 address (default)',
' -6, --ipv6 Return the IPv6 address',
'',
'Examples',
' $ internal-ip',
' 192.168.0.123',
' $ internal-ip --ipv6',
' fe80::200:f8ff:fe21:67cf'
]
}, {
alias: {
4: 'ipv4',
6: 'ipv6'
}
});
var fn = cli.flags.ipv4 ? 'v4' : cli.flags.ipv6 ? 'v6' : 'v4';
console.log(internalIp[fn]());
+36 -27
View File
@@ -1,41 +1,50 @@
'use strict';
var os = require('os');
const os = require('os');
const defaultGateway = require('default-gateway');
const ipaddr = require('ipaddr.js');
var type = {
v4: {
def: '127.0.0.1',
family: 'IPv4'
},
v6: {
def: '::1',
family: 'IPv6'
}
};
function findIp(gateway) {
const interfaces = os.networkInterfaces();
const gatewayIp = ipaddr.parse(gateway);
let ip;
function internalIp(version) {
var options = type[version];
var ret = options.def;
var interfaces = os.networkInterfaces();
// Look for the matching interface in all local interfaces
Object.keys(interfaces).some(name => {
return interfaces[name].some(addr => {
const prefix = ipaddr.parse(addr.netmask).prefixLengthFromSubnetMask();
const net = ipaddr.parseCIDR(`${addr.address}/${prefix}`);
Object.keys(interfaces).forEach(function (el) {
interfaces[el].forEach(function (el2) {
if (!el2.internal && el2.family === options.family) {
ret = el2.address;
if (net[0] && net[0].kind() === gatewayIp.kind() && gatewayIp.match(net)) {
ip = net[0].toString();
}
return Boolean(ip);
});
});
return ret;
return ip;
}
function v4() {
return internalIp('v4');
function promise(family) {
return defaultGateway[family]().then(result => {
return findIp(result.gateway) || null;
}).catch(() => null);
}
function v6() {
return internalIp('v6');
function sync(family) {
try {
const result = defaultGateway[family].sync();
return findIp(result.gateway) || null;
} catch (error) {
return null;
}
}
module.exports = v4;
module.exports.v4 = v4;
module.exports.v6 = v6;
const internalIp = {};
internalIp.v6 = () => promise('v6');
internalIp.v4 = () => promise('v4');
internalIp.v6.sync = () => sync('v6');
internalIp.v4.sync = () => sync('v4');
module.exports = internalIp;
module.exports.default = internalIp;
+4 -16
View File
@@ -1,21 +1,9 @@
The MIT License (MIT)
MIT License
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+25 -27
View File
@@ -1,68 +1,66 @@
{
"_from": "internal-ip@1.2.0",
"_id": "internal-ip@1.2.0",
"_from": "internal-ip@^4.2.0",
"_id": "internal-ip@4.2.0",
"_inBundle": false,
"_integrity": "sha1-rp+/k7mEh4eF1QqN4bNWlWBYz1w=",
"_integrity": "sha512-ZY8Rk+hlvFeuMmG5uH1MXhhdeMntmIaxaInvAmzMq/SHV8rv4Kh+6GiQNNDQd0wZFrcO+FiTBo8lui/osKOyJw==",
"_location": "/internal-ip",
"_phantomChildren": {},
"_requested": {
"type": "version",
"type": "range",
"registry": true,
"raw": "internal-ip@1.2.0",
"raw": "internal-ip@^4.2.0",
"name": "internal-ip",
"escapedName": "internal-ip",
"rawSpec": "1.2.0",
"rawSpec": "^4.2.0",
"saveSpec": null,
"fetchSpec": "1.2.0"
"fetchSpec": "^4.2.0"
},
"_requiredBy": [
"/webpack-dev-server"
],
"_resolved": "https://registry.npmjs.org/internal-ip/-/internal-ip-1.2.0.tgz",
"_shasum": "ae9fbf93b984878785d50a8de1b356956058cf5c",
"_spec": "internal-ip@1.2.0",
"_resolved": "https://registry.npmjs.org/internal-ip/-/internal-ip-4.2.0.tgz",
"_shasum": "46e81b638d84c338e5c67e42b1a17db67d0814fa",
"_spec": "internal-ip@^4.2.0",
"_where": "C:\\xampp\\htdocs\\w4rpservices\\node_modules\\webpack-dev-server",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"bin": {
"internal-ip": "cli.js"
},
"bugs": {
"url": "https://github.com/sindresorhus/internal-ip/issues"
},
"bundleDependencies": false,
"dependencies": {
"meow": "^3.3.0"
"default-gateway": "^4.0.1",
"ipaddr.js": "^1.9.0"
},
"deprecated": false,
"description": "Get your internal IPv4 or IPv6 address",
"description": "Get your internal IP address",
"devDependencies": {
"ava": "*",
"is-ip": "^1.0.0",
"xo": "*"
"ava": "^1.2.1",
"tsd-check": "^0.3.0",
"xo": "^0.24.0"
},
"engines": {
"node": ">=0.10.0"
"node": ">=6"
},
"files": [
"index.js",
"cli.js"
"index.d.ts"
],
"homepage": "https://github.com/sindresorhus/internal-ip#readme",
"keywords": [
"cli-app",
"cli",
"bin",
"ip",
"ipv4",
"ipv6",
"ipv4",
"address",
"internal",
"local",
"machine"
"machine",
"system",
"net",
"gateway"
],
"license": "MIT",
"name": "internal-ip",
@@ -71,7 +69,7 @@
"url": "git+https://github.com/sindresorhus/internal-ip.git"
},
"scripts": {
"test": "xo && ava"
"test": "xo && ava && tsd-check"
},
"version": "1.2.0"
"version": "4.2.0"
}
+25 -32
View File
@@ -1,54 +1,47 @@
# internal-ip [![Build Status](https://travis-ci.org/sindresorhus/internal-ip.svg?branch=master)](https://travis-ci.org/sindresorhus/internal-ip)
> Get your internal IPv4 or IPv6 address
> Get your internal IP address
## CLI
## Install
```
$ npm install --global internal-ip
```
```
$ internal-ip --help
Usage
$ internal-ip
Options
-4, --ipv4 Return the IPv4 address (default)
-6, --ipv6 Return the IPv6 address
Example
$ internal-ip
192.168.0.123
$ internal-ip -6
fe80::200:f8ff:fe21:67cf
$ npm install internal-ip
```
## API
```
$ npm install --save internal-ip
```
## Usage
```js
var internalIp = require('internal-ip');
const internalIp = require('internal-ip');
internalIp.v4();
//=> '192.168.0.123'
(async () => {
console.log(await internalIp.v6());
//=> 'fe80::1'
internalIp.v6();
//=> 'fe80::200:f8ff:fe21:67cf'
console.log(await internalIp.v4());
//=> '10.0.0.79'
})();
console.log(internalIp.v6.sync())
//=> 'fe80::1'
console.log(internalIp.v4.sync())
//=> '10.0.0.79'
```
The module returns the address of the internet-facing interface, as determined from the default gateway. When the address cannot be determined for any reason, `null` will be returned.
The module relies on operating systems tools. On Linux and Android, the `ip` command must be available, which depending on distribution might not be installed by default. It is usually provided by the `iproute2` package.
## Related
See [public-ip](https://github.com/sindresorhus/public-ip) or [ipify](https://github.com/sindresorhus/ipify) to get your external IP address.
- [internal-ip-cli](https://github.com/sindresorhus/internal-ip-cli) - CLI for this module
- [public-ip](https://github.com/sindresorhus/public-ip) - Get your public IP address
- [default-gateway](https://github.com/silverwind/default-gateway) - Get your default gateway address
## License
MIT © [Sindre Sorhus](http://sindresorhus.com)
MIT © [Sindre Sorhus](https://sindresorhus.com)