This commit is contained in:
Liyas Thomas
2020-05-15 21:36:02 +05:30
4 changed files with 21 additions and 31 deletions

View File

@@ -116,7 +116,7 @@ export default {
this.$data.editingEnvironment = environment
this.$data.editingEnvironmentIndex = environmentIndex
this.displayModalEdit(true)
this.syncEnvironments
this.syncEnvironments()
},
resetSelectedData() {
this.$data.editingEnvironment = undefined

View File

@@ -1,11 +1,10 @@
function generateIPRE(protocol) {
const wsRegex = generateREForProtocol("^(wss?:\\/\\/)?")
const sseRegex = generateREForProtocol("^(https?:\\/\\/)?")
const socketioRegex = generateREForProtocol("^((wss?:\\/\\/)|(https?:\\/\\/))?")
function generateREForProtocol(protocol) {
return new RegExp(
`${protocol}(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]).){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$`
)
}
function generateHostnameRE(protocol) {
return new RegExp(
`${protocol}(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9-]*[a-zA-Z0-9]).)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9-]*[A-Za-z0-9/])$`
`${protocol}[-a-zA-Z0-9@:%._\\+~#=]{1,256}\\.[a-zA-Z0-9()]{1,6}\\b([-a-zA-Z0-9()@:%_\\+.~#?&\\/\\/=]*)`
)
}
@@ -13,28 +12,19 @@ function generateHostnameRE(protocol) {
* valid url for ws/wss
*/
export function wsValid(url) {
const protocol = "^(wss?:\\/\\/)?"
const validIP = generateIPRE(protocol)
const validHostname = generateHostnameRE(protocol)
return validIP.test(url) || validHostname.test(url)
return wsRegex.test(url)
}
/**
* valid url for http/https
*/
export function sseValid(url) {
const protocol = "^(https?:\\/\\/)?"
const validIP = generateIPRE(protocol)
const validHostname = generateHostnameRE(protocol)
return validIP.test(url) || validHostname.test(url)
return sseRegex.test(url)
}
/**
* valid url for ws/wss/http/https
*/
export function socketioValid(url) {
const protocol = "^((wss?:\\/\\/)|(https?:\\/\\/))?"
const validIP = generateIPRE(protocol)
const validHostname = generateHostnameRE(protocol)
return validIP.test(url) || validHostname.test(url)
return socketioRegex.test(url)
}

20
package-lock.json generated
View File

@@ -1338,9 +1338,9 @@
}
},
"@firebase/firestore": {
"version": "1.14.3",
"resolved": "https://registry.npmjs.org/@firebase/firestore/-/firestore-1.14.3.tgz",
"integrity": "sha512-vmkXa5Msumutf0ZQjF8AQQwXr4mXI7D8TBbI44w+CMQEnKcD5MW7Dr1SmCTWy8+kNAAFwdA6lCiUtDY5Gx/Hlw==",
"version": "1.14.4",
"resolved": "https://registry.npmjs.org/@firebase/firestore/-/firestore-1.14.4.tgz",
"integrity": "sha512-TQUNXOy5WZKNp/o7mRijo5+AbR5Q0s5GTeKjRXBDtYYbDYPTJ/jktvCDI4N39hACl5829819kqhCZ510F3B5nw==",
"requires": {
"@firebase/component": "0.1.11",
"@firebase/firestore-types": "1.10.1",
@@ -6305,16 +6305,16 @@
}
},
"firebase": {
"version": "7.14.3",
"resolved": "https://registry.npmjs.org/firebase/-/firebase-7.14.3.tgz",
"integrity": "sha512-qExwE/vhf/l6Mf8ES3IFX1SB6/DysKPtvrIWnIuswmRMeSA9eERwrqp4Pom4NHhzjBP1jOmlIPKeOplsNwMlOQ==",
"version": "7.14.4",
"resolved": "https://registry.npmjs.org/firebase/-/firebase-7.14.4.tgz",
"integrity": "sha512-BeI+Jfyg1QyNPY8tD+P0LeVbSqivQm3fEVPCoqVC/oYVusNplZD1LmMI5Swk3Wvh0G0BrSM1nhtv0/nF98fSUg==",
"requires": {
"@firebase/analytics": "0.3.4",
"@firebase/app": "0.6.3",
"@firebase/app-types": "0.6.0",
"@firebase/auth": "0.14.5",
"@firebase/database": "0.6.2",
"@firebase/firestore": "1.14.3",
"@firebase/firestore": "1.14.4",
"@firebase/functions": "0.4.43",
"@firebase/installations": "0.4.9",
"@firebase/messaging": "0.6.15",
@@ -11401,9 +11401,9 @@
},
"dependencies": {
"@types/node": {
"version": "13.13.5",
"resolved": "https://registry.npmjs.org/@types/node/-/node-13.13.5.tgz",
"integrity": "sha512-3ySmiBYJPqgjiHA7oEaIo2Rzz0HrOZ7yrNO5HWyaE5q0lQ3BppDZ3N53Miz8bw2I7gh1/zir2MGVZBvpb1zq9g=="
"version": "13.13.6",
"resolved": "https://registry.npmjs.org/@types/node/-/node-13.13.6.tgz",
"integrity": "sha512-zqRj8ugfROCjXCNbmPBe2mmQ0fJWP9lQaN519hwunOgpHgVykme4G6FW95++dyNFDvJUk4rtExkVkL0eciu5NA=="
}
}
},

View File

@@ -36,7 +36,7 @@
"@nuxtjs/sitemap": "^2.3.0",
"@nuxtjs/toast": "^3.3.0",
"ace-builds": "^1.4.11",
"firebase": "^7.14.3",
"firebase": "^7.14.4",
"graphql": "^14.6.0",
"graphql-language-service-interface": "^2.3.3",
"nuxt": "^2.12.2",