Skip to content

Commit

Permalink
29 removing shell dependencies. Simplyfiying ip parsing method
Browse files Browse the repository at this point in the history
  • Loading branch information
shailee-m authored and brylie committed Mar 15, 2021
1 parent 459ac54 commit acf6f0d
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 50 deletions.
1 change: 0 additions & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
"moment-timezone": "0.5.32",
"plotly.js": "^1.55.2",
"quasar": "^1.0.0",
"shelljs": "0.8.4",
"vue-i18n": "^8.20.0",
"webpack": "^5.23.0",
"xlsx": "0.16.7"
Expand Down
20 changes: 9 additions & 11 deletions frontend/src/boot/axios.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,18 @@ const axiosInstance = axios.create({
baseURL: process.env.BASE_URL
});
const _appendSubdomain = (domain, subdomain) => {
const ip = domain.split("://")[1]
? domain.split("://")[1].split(":")
? domain.split("://")[1].split(":")[0]
: null
: null;
// Get the hostname (including port)
const hostname = domain.split("://")[1];

//skip adding sub-domain to ip
if (
/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/.test(
ip
)
) {
// a domain name contains at least one letter
const hostnameIsDomain = hostname.match(/[a-z]/i);

// skip adding sub-domain to IP
if (!hostnameIsDomain) {
return domain;
}

// If localhost is in domain
if (domain.indexOf("localhost") > -1) {
return domain;
}
Expand Down
10 changes: 8 additions & 2 deletions frontend/src/boot/env-parser.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
const DotEnv = require("dotenv");
var shell = require("shelljs");
var is3000On = shell.exec("lsof -t -i :3000 -s TCP:LISTEN").stdout;
const execSync = require("child_process").execSync;
let is3000On = false;

try {
is3000On = execSync("lsof -t -i :3000 -s TCP:LISTEN").toString();
} catch (e) {
// not running throws error
}

module.exports = function() {
if (!!is3000On) {
Expand Down
36 changes: 0 additions & 36 deletions frontend/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7399,11 +7399,6 @@ internal-ip@^4.3.0:
default-gateway "^4.2.0"
ipaddr.js "^1.9.0"

interpret@^1.0.0:
version "1.4.0"
resolved "https://registry.yarnpkg.com/interpret/-/interpret-1.4.0.tgz#665ab8bc4da27a774a40584e812e3e0fa45b1a1e"
integrity sha512-agE4QfB2Lkp9uICn7BAqoscw4SZP9kTE2hxiFI3jBPmXJfdqiahTbUuKGsMoN2GtqL9AxhYioAcVvgsb1HvRbA==

interval-tree-1d@^1.0.1:
version "1.0.3"
resolved "https://registry.yarnpkg.com/interval-tree-1d/-/interval-tree-1d-1.0.3.tgz#8fdbde02b6b2c7dbdead636bcbed8e08710d85c1"
Expand Down Expand Up @@ -7558,13 +7553,6 @@ is-color-stop@^1.0.0:
rgb-regex "^1.0.1"
rgba-regex "^1.0.0"

is-core-module@^2.2.0:
version "2.2.0"
resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.2.0.tgz#97037ef3d52224d85163f5597b2b63d9afed981a"
integrity sha512-XRAfAdyyY5F5cOXn7hYQDqh2Xmii+DEfIcQGxK/uNwMHhIkPWO0g8msXcbzLe+MpGoR951MlqM/2iIlU4vKDdQ==
dependencies:
has "^1.0.3"

is-data-descriptor@^0.1.4:
version "0.1.4"
resolved "https://registry.yarnpkg.com/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz#0b5ee648388e2c860282e793f1856fec3f301b56"
Expand Down Expand Up @@ -10795,13 +10783,6 @@ readdirp@~3.4.0:
dependencies:
picomatch "^2.2.1"

rechoir@^0.6.2:
version "0.6.2"
resolved "https://registry.yarnpkg.com/rechoir/-/rechoir-0.6.2.tgz#85204b54dba82d5742e28c96756ef43af50e3384"
integrity sha1-hSBLVNuoLVdC4oyWdW70OvUOM4Q=
dependencies:
resolve "^1.1.6"

recursive-readdir@^2.1.0:
version "2.2.2"
resolved "https://registry.yarnpkg.com/recursive-readdir/-/recursive-readdir-2.2.2.tgz#9946fb3274e1628de6e36b2f6714953b4845094f"
Expand Down Expand Up @@ -11115,14 +11096,6 @@ resolve@^1.0.0, resolve@^1.1.5, resolve@^1.10.0, resolve@^1.12.0, resolve@^1.13.
dependencies:
path-parse "^1.0.6"

resolve@^1.1.6:
version "1.20.0"
resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.20.0.tgz#629a013fb3f70755d6f0b7935cc1c2c5378b1975"
integrity sha512-wENBPt4ySzg4ybFQW2TT1zMQucPK95HSh/nq2CFTZVOGut2+pQvSsgtda4d26YrYcr067wjbmzOG8byDPBX63A==
dependencies:
is-core-module "^2.2.0"
path-parse "^1.0.6"

[email protected], responselike@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/responselike/-/responselike-1.0.2.tgz#918720ef3b631c5642be068f15ade5a46f4ba1e7"
Expand Down Expand Up @@ -11664,15 +11637,6 @@ shell-quote@^1.6.1:
resolved "https://registry.yarnpkg.com/shell-quote/-/shell-quote-1.7.2.tgz#67a7d02c76c9da24f99d20808fcaded0e0e04be2"
integrity sha512-mRz/m/JVscCrkMyPqHc/bczi3OQHkLTqXHEFu0zDhK/qfv3UcOA4SVmRCLmos4bhjr9ekVQubj/R7waKapmiQg==

[email protected]:
version "0.8.4"
resolved "https://registry.yarnpkg.com/shelljs/-/shelljs-0.8.4.tgz#de7684feeb767f8716b326078a8a00875890e3c2"
integrity sha512-7gk3UZ9kOfPLIAbslLzyWeGiEqx9e3rxwZM0KE6EL8GlGwjym9Mrlx5/p33bWTu9YG6vcS4MBxYZDHYr5lr8BQ==
dependencies:
glob "^7.0.0"
interpret "^1.0.0"
rechoir "^0.6.2"

signal-exit@^3.0.0, signal-exit@^3.0.2:
version "3.0.3"
resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.3.tgz#a1410c2edd8f077b08b4e253c8eacfcaf057461c"
Expand Down

0 comments on commit acf6f0d

Please sign in to comment.