From d35d3061e52550a8ec9917396f0b4e9b2bee439e Mon Sep 17 00:00:00 2001 From: Andrew Bastin Date: Mon, 27 Jan 2020 18:42:38 -0500 Subject: [PATCH 01/97] Added variable editor and removed the old variable system --- pages/graphql.vue | 90 ++++++++++------------------------------------- 1 file changed, 18 insertions(+), 72 deletions(-) diff --git a/pages/graphql.vue b/pages/graphql.vue index 606796472..360bc0183 100644 --- a/pages/graphql.vue +++ b/pages/graphql.vue @@ -187,67 +187,21 @@ useWorker: false }" /> -
- -
- -
-
- - + + + + @@ -410,6 +364,7 @@ export default { data() { return { schemaString: "", + variableString: "{}", commonHeaders: [ "WWW-Authenticate", "Authorization", @@ -666,19 +621,10 @@ export default { this.headers.forEach(header => { headers[header.key] = header.value; }); + + let variables = JSON.parse(this.variableString); - let variables = {}; const gqlQueryString = this.gqlQueryString; - this.variables.forEach(variable => { - // todo: better variable type validation - if (gqlQueryString.indexOf(`\$${variable.key}: Int`) > -1) { - variables[variable.key] = parseInt(variable.value); - } else if (gqlQueryString.indexOf(`\$${variable.key}: Float`) > -1) { - variables[variable.key] = parseFloat(variable.value); - } else { - variables[variable.key] = variable.value; - } - }); const reqOptions = { method: "post", From cf9fe0c02c9d05c8b0e8b6b9ded1fc314f09f996 Mon Sep 17 00:00:00 2001 From: Andrew Bastin Date: Wed, 29 Jan 2020 20:05:59 -0500 Subject: [PATCH 02/97] Removed old variable store mechanisms --- pages/graphql.vue | 32 -------------------------------- 1 file changed, 32 deletions(-) diff --git a/pages/graphql.vue b/pages/graphql.vue index 360bc0183..ab04eb41b 100644 --- a/pages/graphql.vue +++ b/pages/graphql.vue @@ -519,14 +519,6 @@ export default { this.$store.commit("setGQLState", { value, attribute: "headers" }); } }, - variables: { - get() { - return this.$store.state.gql.variables; - }, - set(value) { - this.$store.commit("setGQLState", { value, attribute: "variables" }); - } - }, gqlQueryString: { get() { return this.$store.state.gql.query; @@ -827,30 +819,6 @@ export default { }); // console.log(oldHeaders); }, - addQueryVariable(index) { - this.$store.commit("addGQLVariable", { - key: "", - value: "" - }); - return false; - }, - removeQueryVariable(index) { - const oldVariables = this.variables.slice(); - - this.$store.commit("removeGQLVariable", index); - this.$toast.error(this.$t("deleted"), { - icon: "delete", - action: { - text: this.$t("undo"), - duration: 4000, - onClick: (e, toastObject) => { - this.variables = oldVariables; - toastObject.remove(); - } - } - }); - // console.log(oldVariables); - }, scrollInto(view) { this.$refs[view].$el.scrollIntoView({ behavior: "smooth" From 5d2ba22988208926b9b11d7f7a71ac8c1ddbf07e Mon Sep 17 00:00:00 2001 From: Andrew Bastin Date: Wed, 29 Jan 2020 20:21:23 -0500 Subject: [PATCH 03/97] Removed mutations for GraphQL variables --- store/mutations.js | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/store/mutations.js b/store/mutations.js index 64d178f57..acc84471a 100644 --- a/store/mutations.js +++ b/store/mutations.js @@ -23,22 +23,6 @@ export default { gql.headers[index].value = value; }, - addGQLVariable({ gql }, object) { - gql.variables.push(object); - }, - - removeGQLVariable({ gql }, index) { - gql.variables.splice(index, 1); - }, - - setGQLVariableKey({ gql }, { index, value }) { - gql.variables[index].key = value; - }, - - setGQLVariableValue({ gql }, { index, value }) { - gql.variables[index].value = value; - }, - addHeaders({ request }, value) { request.headers.push(value); }, From 94c24408329c949b07e6a3bcd734246d59a8ae84 Mon Sep 17 00:00:00 2001 From: Andrew Bastin Date: Wed, 29 Jan 2020 20:35:54 -0500 Subject: [PATCH 04/97] Hooked the new variable editor to the persistent store --- pages/graphql.vue | 9 ++++++++- store/state.js | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/pages/graphql.vue b/pages/graphql.vue index ab04eb41b..0dfdae88e 100644 --- a/pages/graphql.vue +++ b/pages/graphql.vue @@ -364,7 +364,6 @@ export default { data() { return { schemaString: "", - variableString: "{}", commonHeaders: [ "WWW-Authenticate", "Authorization", @@ -527,6 +526,14 @@ export default { this.$store.commit("setGQLState", { value, attribute: "query" }); } }, + variableString: { + get() { + return this.$store.state.gql.variablesJSONString; + }, + set(value) { + this.$store.commit("setGQLState", { value, attribute: "variablesJSONString" }); + } + }, headerString() { const result = this.headers .filter(({ key }) => !!key) diff --git a/store/state.js b/store/state.js index e6ab3b51d..7667b1d0a 100644 --- a/store/state.js +++ b/store/state.js @@ -20,7 +20,7 @@ export default () => ({ gql: { url: "https://rickandmortyapi.com/graphql", headers: [], - variables: [], + variablesJSONString: "", query: "" }, oauth2: { From 6c7643a4c34e3cde3834b04030ccd19d0feed216 Mon Sep 17 00:00:00 2001 From: Liyas Thomas Date: Thu, 30 Jan 2020 20:35:22 +0530 Subject: [PATCH 05/97] :sparkles: Press Escape to close modal, Enter to return. Fixes #539 --- components/collections/addCollection.vue | 1 + components/collections/addFolder.vue | 1 + components/collections/index.vue | 12 ++++++++++++ layouts/default.vue | 12 ++++++++++++ pages/index.vue | 4 ++++ 5 files changed, 30 insertions(+) diff --git a/components/collections/addCollection.vue b/components/collections/addCollection.vue index 39b7a7675..0fa8bad33 100644 --- a/components/collections/addCollection.vue +++ b/components/collections/addCollection.vue @@ -21,6 +21,7 @@ type="text" v-model="name" :placeholder="$t('my_new_collection')" + @keyup.enter="addNewCollection" /> diff --git a/components/collections/addFolder.vue b/components/collections/addFolder.vue index 1188ad495..e4b9a853c 100644 --- a/components/collections/addFolder.vue +++ b/components/collections/addFolder.vue @@ -21,6 +21,7 @@ type="text" v-model="name" :placeholder="$t('my_new_folder')" + @keyup.enter="addNewFolder" /> diff --git a/components/collections/index.vue b/components/collections/index.vue index e3ec32698..4d7b51072 100644 --- a/components/collections/index.vue +++ b/components/collections/index.vue @@ -142,6 +142,15 @@ export default { return this.$store.state.postwoman.collections; } }, + async mounted() { + this._keyListener = function(e) { + if (e.key === "Escape") { + e.preventDefault(); + this.showModalAdd = this.showModalEdit = this.showModalImportExport = this.showModalAddFolder = this.showModalEditFolder = this.showModalEditRequest = false; + } + }; + document.addEventListener("keydown", this._keyListener.bind(this)); + }, methods: { displayModalAdd(shouldDisplay) { this.showModalAdd = shouldDisplay; @@ -216,6 +225,9 @@ export default { } } } + }, + beforeDestroy() { + document.removeEventListener("keydown", this._keyListener); } }; diff --git a/layouts/default.vue b/layouts/default.vue index fe51cccd1..0e44bca59 100644 --- a/layouts/default.vue +++ b/layouts/default.vue @@ -801,6 +801,14 @@ export default { }); }, 15000); } + + this._keyListener = function(e) { + if (e.key === "Escape") { + e.preventDefault(); + this.showExtensions = this.showShortcuts = this.showSupport = false; + } + }; + document.addEventListener("keydown", this._keyListener.bind(this)); })(); window.addEventListener("scroll", event => { @@ -841,6 +849,10 @@ export default { availableLocales() { return this.$i18n.locales.filter(i => i.code !== this.$i18n.locale); } + }, + + beforeDestroy() { + document.removeEventListener("keydown", this._keyListener); } }; diff --git a/pages/index.vue b/pages/index.vue index d0095e695..f3a5e56ae 100644 --- a/pages/index.vue +++ b/pages/index.vue @@ -2856,6 +2856,10 @@ export default { } else if (e.key === "j" && (e.ctrlKey || e.metaKey)) { e.preventDefault(); this.$refs.clearAll.click(); + } else if (e.key === "Escape") { + e.preventDefault(); + this.showModal = this.showTokenList = this.showTokenRequestList = this.showRequestModal = false; + this.isHidden = true; } }; document.addEventListener("keydown", this._keyListener.bind(this)); From f80c5d6a463d5dfcde6a50ae8784162744c3c479 Mon Sep 17 00:00:00 2001 From: Liyas Thomas Date: Thu, 30 Jan 2020 23:45:38 +0530 Subject: [PATCH 06/97] :recycle: Refactor --- pages/index.vue | 154 ++++++++++++++++++------------------------------ 1 file changed, 57 insertions(+), 97 deletions(-) diff --git a/pages/index.vue b/pages/index.vue index f3a5e56ae..f439c03d1 100644 --- a/pages/index.vue +++ b/pages/index.vue @@ -1822,12 +1822,10 @@ export default { } const protocol = "^(https?:\\/\\/)?"; const validIP = 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])$" + `${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])$` ); const validHostname = 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]|[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/])$` ); return validIP.test(this.url) || validHostname.test(this.url); }, @@ -1885,39 +1883,20 @@ export default { if (this.requestType === "JavaScript XHR") { const requestString = []; requestString.push("const xhr = new XMLHttpRequest()"); - const user = - this.auth === "Basic Auth" ? "'" + this.httpUser + "'" : null; + const user = this.auth === "Basic Auth" ? `'${this.httpUser}'` : null; const pswd = - this.auth === "Basic Auth" ? "'" + this.httpPassword + "'" : null; + this.auth === "Basic Auth" ? `'${this.httpPassword}'` : null; requestString.push( - "xhr.open('" + - this.method + - "', '" + - this.url + - this.pathName + - this.queryString + - "', true, " + - user + - ", " + - pswd + - ")" + `xhr.open('${this.method}', '${this.url}${this.pathName}${this.queryString}', true, ${user}, ${pswd})` ); if (this.auth === "Bearer Token" || this.auth === "OAuth 2.0") { requestString.push( - "xhr.setRequestHeader('Authorization', 'Bearer " + - this.bearerToken + - "')" + `xhr.setRequestHeader('Authorization', 'Bearer ${this.bearerToken}')` ); } if (this.headers) { - this.headers.forEach(element => { - requestString.push( - "xhr.setRequestHeader('" + - element.key + - "', '" + - element.value + - "')" - ); + this.headers.forEach(({ key, value }) => { + requestString.push(`xhr.setRequestHeader('${key}', '${value}')`); }); } if (["POST", "PUT", "PATCH"].includes(this.method)) { @@ -1925,14 +1904,12 @@ export default { ? this.rawParams : this.rawRequestBody; requestString.push( - "xhr.setRequestHeader('Content-Length', " + requestBody.length + ")" + `xhr.setRequestHeader('Content-Length', ${requestBody.length})` ); requestString.push( - "xhr.setRequestHeader('Content-Type', '" + - this.contentType + - "; charset=utf-8')" + `xhr.setRequestHeader('Content-Type', '${this.contentType}; charset=utf-8')` ); - requestString.push("xhr.send(" + requestBody + ")"); + requestString.push(`xhr.send(${requestBody})`); } else { requestString.push("xhr.send()"); } @@ -1941,40 +1918,36 @@ export default { const requestString = []; let headers = []; requestString.push( - 'fetch("' + this.url + this.pathName + this.queryString + '", {\n' + `fetch("${this.url}${this.pathName}${this.queryString}", {\n` ); - requestString.push(' method: "' + this.method + '",\n'); + requestString.push(` method: "${this.method}",\n`); if (this.auth === "Basic Auth") { - const basic = this.httpUser + ":" + this.httpPassword; + const basic = `${this.httpUser}:${this.httpPassword}`; headers.push( - ' "Authorization": "Basic ' + - window.btoa(unescape(encodeURIComponent(basic))) + - '",\n' + ` "Authorization": "Basic ${window.btoa( + unescape(encodeURIComponent(basic)) + )}",\n` ); } else if (this.auth === "Bearer Token" || this.auth === "OAuth 2.0") { - headers.push( - ' "Authorization": "Bearer ' + this.bearerToken + '",\n' - ); + headers.push(` "Authorization": "Bearer ${this.bearerToken}",\n`); } if (["POST", "PUT", "PATCH"].includes(this.method)) { const requestBody = this.rawInput ? this.rawParams : this.rawRequestBody; - requestString.push(" body: " + requestBody + ",\n"); - headers.push(' "Content-Length": ' + requestBody.length + ",\n"); + requestString.push(` body: ${requestBody},\n`); + headers.push(` "Content-Length": ${requestBody.length},\n`); headers.push( - ' "Content-Type": "' + this.contentType + '; charset=utf-8",\n' + ` "Content-Type": "${this.contentType}; charset=utf-8",\n` ); } if (this.headers) { - this.headers.forEach(element => { - headers.push( - ' "' + element.key + '": "' + element.value + '",\n' - ); + this.headers.forEach(({ key, value }) => { + headers.push(` "${key}": "${value}",\n`); }); } headers = headers.join("").slice(0, -2); - requestString.push(" headers: {\n" + headers + "\n },\n"); + requestString.push(` headers: {\n${headers}\n },\n`); requestString.push(' credentials: "same-origin"\n'); requestString.push("}).then(function(response) {\n"); requestString.push(" response.status\n"); @@ -1988,40 +1961,36 @@ export default { return requestString.join(""); } else if (this.requestType === "cURL") { const requestString = []; - requestString.push("curl -X " + this.method + " \n"); + requestString.push(`curl -X ${this.method} \n`); requestString.push( - " '" + this.url + this.pathName + this.queryString + "' \n" + ` '${this.url}${this.pathName}${this.queryString}' \n` ); if (this.auth === "Basic Auth") { - const basic = this.httpUser + ":" + this.httpPassword; + const basic = `${this.httpUser}:${this.httpPassword}`; requestString.push( - " -H 'Authorization: Basic " + - window.btoa(unescape(encodeURIComponent(basic))) + - "' \n" + ` -H 'Authorization: Basic ${window.btoa( + unescape(encodeURIComponent(basic)) + )}' \n` ); } else if (this.auth === "Bearer Token" || this.auth === "OAuth 2.0") { requestString.push( - " -H 'Authorization: Bearer " + this.bearerToken + "' \n" + ` -H 'Authorization: Bearer ${this.bearerToken}' \n` ); } if (this.headers) { - this.headers.forEach(element => { - requestString.push( - " -H '" + element.key + ": " + element.value + "' \n" - ); + this.headers.forEach(({ key, value }) => { + requestString.push(` -H '${key}: ${value}' \n`); }); } if (["POST", "PUT", "PATCH"].includes(this.method)) { const requestBody = this.rawInput ? this.rawParams : this.rawRequestBody; + requestString.push(` -H 'Content-Length: ${requestBody.length}' \n`); requestString.push( - " -H 'Content-Length: " + requestBody.length + "' \n" + ` -H 'Content-Type: ${this.contentType}; charset=utf-8' \n` ); - requestString.push( - " -H 'Content-Type: " + this.contentType + "; charset=utf-8' \n" - ); - requestString.push(" -d '" + requestBody + "' \n"); + requestString.push(` -d '${requestBody}' \n`); } return requestString.join("").slice(0, -2); } @@ -2283,8 +2252,8 @@ export default { } }, getQueryStringFromPath() { - let queryString, - pathParsed = url.parse(this.path); + let queryString; + let pathParsed = url.parse(this.path); return (queryString = pathParsed.query ? pathParsed.query : ""); }, queryStringToArray(queryString) { @@ -2295,9 +2264,8 @@ export default { })); }, pathInputHandler() { - let queryString = this.getQueryStringFromPath(), - params = this.queryStringToArray(queryString); - + let queryString = this.getQueryStringFromPath(); + let params = this.queryStringToArray(queryString); this.paramsWatchEnabled = false; this.params = params; }, @@ -2418,7 +2386,7 @@ export default { const aux = document.createElement("textarea"); const copy = this.responseType === "application/json" - ? JSON.stringify(this.response.body) + ? JSON.stringify(this.response.body, null, 2) : this.response.body; aux.innerText = copy; document.body.appendChild(aux); @@ -2433,17 +2401,12 @@ export default { downloadResponse() { const dataToWrite = JSON.stringify(this.response.body, null, 2); const file = new Blob([dataToWrite], { type: this.responseType }); - const a = document.createElement("a"), - url = URL.createObjectURL(file); + const a = document.createElement("a"); + const url = URL.createObjectURL(file); a.href = url; - a.download = ( - this.url + - this.path + - " [" + - this.method + - "] on " + - Date() - ).replace(/\./g, "[dot]"); + a.download = `${this.url + this.path} [${ + this.method + }] on ${Date()}`.replace(/\./g, "[dot]"); document.body.appendChild(a); a.click(); this.$refs.downloadResponse.innerHTML = this.doneButton; @@ -2511,13 +2474,12 @@ export default { history.replaceState( window.location.href, "", - "/?" + - encodeURI( - flats - .concat(deeps, bodyParams) - .join("") - .slice(0, -1) - ) + `/?${encodeURI( + flats + .concat(deeps, bodyParams) + .join("") + .slice(0, -1) + )}` ); }, setRouteQueries(queries) { @@ -2714,8 +2676,8 @@ export default { let file = this.$refs.payload.files[0]; if (file !== undefined && file !== null) { let reader = new FileReader(); - reader.onload = e => { - this.rawParams = e.target.result; + reader.onload = ({ target }) => { + this.rawParams = target.result; }; reader.readAsText(file); this.$toast.info(this.$t("file_imported"), { @@ -2807,7 +2769,7 @@ export default { removeOAuthTokenReq(index) { const oldTokenReqs = this.tokenReqs.slice(); let targetReqIndex = this.tokenReqs.findIndex( - tokenReq => tokenReq.name === this.tokenReqName + ({ name }) => name === this.tokenReqName ); if (targetReqIndex < 0) return; this.$store.commit("removeOAuthTokenReq", targetReqIndex); @@ -2822,10 +2784,8 @@ export default { } }); }, - tokenReqChange(event) { - let targetReq = this.tokenReqs.find( - tokenReq => tokenReq.name === event.target.value - ); + tokenReqChange({ target }) { + let targetReq = this.tokenReqs.find(({ name }) => name === target.value); let { oidcDiscoveryUrl, authUrl, From 1d6d8af748466b674928f2daedabf2e5f8289cae Mon Sep 17 00:00:00 2001 From: Liyas Thomas Date: Fri, 31 Jan 2020 00:18:20 +0530 Subject: [PATCH 07/97] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20Refactor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/ace-editor.vue | 15 ++++++--------- pages/doc.vue | 4 ++-- pages/graphql.vue | 16 ++++++++-------- pages/realtime.vue | 12 ++++-------- pages/settings.vue | 18 +++++++++--------- 5 files changed, 29 insertions(+), 36 deletions(-) diff --git a/components/ace-editor.vue b/components/ace-editor.vue index 3f2745147..5065b7994 100644 --- a/components/ace-editor.vue +++ b/components/ace-editor.vue @@ -55,8 +55,8 @@ export default { mounted() { const editor = ace.edit(this.$refs.editor, { - theme: "ace/theme/" + this.defineTheme(), - mode: "ace/mode/" + this.lang, + theme: `ace/theme/${this.defineTheme()}`, + mode: `ace/mode/${this.lang}`, ...this.options }); @@ -74,13 +74,10 @@ export default { methods: { defineTheme() { - if (this.theme) { - return this.theme; - } else { - return ( - this.$store.state.postwoman.settings.THEME_ACE_EDITOR || DEFAULT_THEME - ); - } + if (this.theme) return this.theme; + return ( + this.$store.state.postwoman.settings.THEME_ACE_EDITOR || DEFAULT_THEME + ); } }, diff --git a/pages/doc.vue b/pages/doc.vue index 963687d4d..07dabf4de 100644 --- a/pages/doc.vue +++ b/pages/doc.vue @@ -363,8 +363,8 @@ export default { let file = this.$refs.collectionUpload.files[0]; if (file !== undefined && file !== null) { let reader = new FileReader(); - reader.onload = e => { - this.collectionJSON = e.target.result; + reader.onload = ({ target }) => { + this.collectionJSON = target.result; }; reader.readAsText(file); this.$toast.info(this.$t("file_imported"), { diff --git a/pages/graphql.vue b/pages/graphql.vue index 127f74428..f81d37145 100644 --- a/pages/graphql.vue +++ b/pages/graphql.vue @@ -531,7 +531,10 @@ export default { return this.$store.state.gql.variablesJSONString; }, set(value) { - this.$store.commit("setGQLState", { value, attribute: "variablesJSONString" }); + this.$store.commit("setGQLState", { + value, + attribute: "variablesJSONString" + }); } }, headerString() { @@ -620,7 +623,7 @@ export default { this.headers.forEach(header => { headers[header.key] = header.value; }); - + let variables = JSON.parse(this.variableString); const gqlQueryString = this.gqlQueryString; @@ -780,13 +783,10 @@ export default { downloadResponse() { const dataToWrite = JSON.stringify(this.schemaString, null, 2); const file = new Blob([dataToWrite], { type: "application/json" }); - const a = document.createElement("a"), - url = URL.createObjectURL(file); + const a = document.createElement("a"); + const url = URL.createObjectURL(file); a.href = url; - a.download = (this.url + " on " + Date() + ".graphql").replace( - /\./g, - "[dot]" - ); + a.download = `${this.url} on ${Date()}.graphql`.replace(/\./g, "[dot]"); document.body.appendChild(a); a.click(); this.$refs.downloadResponse.innerHTML = this.doneButton; diff --git a/pages/realtime.vue b/pages/realtime.vue index 1ef1a49b6..9e97c4d06 100644 --- a/pages/realtime.vue +++ b/pages/realtime.vue @@ -211,24 +211,20 @@ export default { urlValid() { const protocol = "^(wss?:\\/\\/)?"; const validIP = 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])$" + `${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])$` ); const validHostname = 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]|[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/])$` ); return validIP.test(this.url) || validHostname.test(this.url); }, serverValid() { const protocol = "^(https?:\\/\\/)?"; const validIP = 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])$" + `${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])$` ); const validHostname = 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]|[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/])$` ); return validIP.test(this.server) || validHostname.test(this.server); } diff --git a/pages/settings.vue b/pages/settings.vue index 5b4e13bf2..f09131f8a 100644 --- a/pages/settings.vue +++ b/pages/settings.vue @@ -398,9 +398,9 @@ export default { firebase .auth() .signInWithPopup(provider) - .then(res => { - if (res.additionalUserInfo.isNewUser) { - this.$toast.info(this.$t("turn_on") + " " + this.$t("sync"), { + .then(({ additionalUserInfo }) => { + if (additionalUserInfo.isNewUser) { + this.$toast.info(`${this.$t("turn_on")} ${this.$t("sync")}`, { icon: "sync", duration: null, closeOnSwipe: false, @@ -427,9 +427,9 @@ export default { firebase .auth() .signInWithPopup(provider) - .then(res => { - if (res.additionalUserInfo.isNewUser) { - this.$toast.info(this.$t("turn_on") + " " + this.$t("sync"), { + .then(({ additionalUserInfo }) => { + if (additionalUserInfo.isNewUser) { + this.$toast.info(`${this.$t("turn_on")} ${this.$t("sync")}`, { icon: "sync", duration: null, closeOnSwipe: false, @@ -458,14 +458,14 @@ export default { fb.writeSettings("syncHistory", true); fb.writeSettings("syncCollections", false); }, - resetProxy(e) { + resetProxy({ target }) { this.settings.PROXY_URL = `https://postwoman.apollotv.xyz/`; - e.target.innerHTML = this.doneButton; + target.innerHTML = this.doneButton; this.$toast.info(this.$t("cleared"), { icon: "clear_all" }); setTimeout( - () => (e.target.innerHTML = 'clear_all'), + () => (target.innerHTML = 'clear_all'), 1000 ); } From 1ed28a717c522025c5a21a6212f4807c5b829dac Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Fri, 31 Jan 2020 00:50:57 +0000 Subject: [PATCH 08/97] chore(deps): bump firebase from 7.7.0 to 7.8.0 Bumps [firebase](https://github.com/firebase/firebase-js-sdk) from 7.7.0 to 7.8.0. - [Release notes](https://github.com/firebase/firebase-js-sdk/releases) - [Commits](https://github.com/firebase/firebase-js-sdk/compare/firebase@7.7.0...firebase@7.8.0) Signed-off-by: dependabot-preview[bot] --- package-lock.json | 160 +++++++++++++++++++++++----------------------- package.json | 2 +- 2 files changed, 81 insertions(+), 81 deletions(-) diff --git a/package-lock.json b/package-lock.json index 6f8a63f52..8a30c84ac 100644 --- a/package-lock.json +++ b/package-lock.json @@ -906,14 +906,14 @@ } }, "@firebase/analytics": { - "version": "0.2.11", - "resolved": "https://registry.npmjs.org/@firebase/analytics/-/analytics-0.2.11.tgz", - "integrity": "sha512-2+Z3CBRAExe1Auf9tApnuz6akAdi9DzPUSx/ssKChWbSzInCeaYGN40pKIameux7BAVecZHxZNh5tJmW27lgtw==", + "version": "0.2.12", + "resolved": "https://registry.npmjs.org/@firebase/analytics/-/analytics-0.2.12.tgz", + "integrity": "sha512-y/WwSNUOPJnAdYOxD+NCMwVbhfP/yrQrnGTn1zAAM1R8bBBmWay8HpHki7g5N3qQ+AQ+uMF6tKbp/JnJkini7A==", "requires": { "@firebase/analytics-types": "0.2.5", - "@firebase/component": "0.1.3", - "@firebase/installations": "0.4.0", - "@firebase/util": "0.2.38", + "@firebase/component": "0.1.4", + "@firebase/installations": "0.4.1", + "@firebase/util": "0.2.39", "tslib": "1.10.0" } }, @@ -923,14 +923,14 @@ "integrity": "sha512-aa746gTiILMn9TPBJXaYhYqnCL4CQwd4aYTAZseI9RZ/hf117xJTNy9/ZTmG5gl2AqxV0LgtdHYqKAjRlNqPIQ==" }, "@firebase/app": { - "version": "0.5.2", - "resolved": "https://registry.npmjs.org/@firebase/app/-/app-0.5.2.tgz", - "integrity": "sha512-QOhSO414Yfc7BAH62QdsFiI/5bNaFrjDMLfRNAqnzGwLkiqIK+QH1Hma7dAF4ff1UjzEpbXQn3rXv7gtAXy6Lw==", + "version": "0.5.3", + "resolved": "https://registry.npmjs.org/@firebase/app/-/app-0.5.3.tgz", + "integrity": "sha512-cQn8eQSJRMpyIRfBi2roIiw0weAorpdJ2Ssn7yDlkMo0ZSE56MgMSlX1mcDupXgNZtG+k3E+IEr+FfzD9SQBGg==", "requires": { "@firebase/app-types": "0.5.0", - "@firebase/component": "0.1.3", + "@firebase/component": "0.1.4", "@firebase/logger": "0.1.34", - "@firebase/util": "0.2.38", + "@firebase/util": "0.2.39", "dom-storage": "2.1.0", "tslib": "1.10.0", "xmlhttprequest": "1.8.0" @@ -960,24 +960,24 @@ "integrity": "sha512-06ZrpYz1GaUfIJs7C3Yf4lARH8+2kzgKfgG/9B3FaGHFYLa5U7rLBGGaca4oiVI12jmhe9CV3+M8e3U2CRCr2w==" }, "@firebase/component": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/@firebase/component/-/component-0.1.3.tgz", - "integrity": "sha512-PvWS/2TVC5rBKvzxdv91FBPbZxuN2WiwDyO2xaHdtsUkZ+P/E825PIh9en9kR+FSQkTCFRDmboLzispN1Tonrg==", + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/@firebase/component/-/component-0.1.4.tgz", + "integrity": "sha512-k3JZFUyHnSWC/7v+x+pIHLDNJPYA6xd7nqrQASOXH5TXhCR9meg0VsnJb+knD18491iRMKJnQWNSHdqPK9AX5w==", "requires": { - "@firebase/util": "0.2.38", + "@firebase/util": "0.2.39", "tslib": "1.10.0" } }, "@firebase/database": { - "version": "0.5.19", - "resolved": "https://registry.npmjs.org/@firebase/database/-/database-0.5.19.tgz", - "integrity": "sha512-UVd0XTBbA/7mcwGeNwhMFHyrz3uJUyLAUeaROuppfo4bBK0jUhdkwqmeNC+q/Q9vU4GUV0UkMm7XgWlsfI+j8Q==", + "version": "0.5.20", + "resolved": "https://registry.npmjs.org/@firebase/database/-/database-0.5.20.tgz", + "integrity": "sha512-31dNLqMW4nGrGzIDS5hh+1LFzkr/m1Kb+EcftQGC3NaGC3zHwGyG7ijn+Xo7gIWtXukvJvm1cFC7R+eOCPEejw==", "requires": { "@firebase/auth-interop-types": "0.1.1", - "@firebase/component": "0.1.3", + "@firebase/component": "0.1.4", "@firebase/database-types": "0.4.10", "@firebase/logger": "0.1.34", - "@firebase/util": "0.2.38", + "@firebase/util": "0.2.39", "faye-websocket": "0.11.3", "tslib": "1.10.0" } @@ -991,14 +991,14 @@ } }, "@firebase/firestore": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/@firebase/firestore/-/firestore-1.9.3.tgz", - "integrity": "sha512-FGHZ5Dj+6PTqTDr1eEdEPA3fbzQy5v0i21k2DA1d4bdD20bVWWdOAyoOuku4BawfK7ZzgVJipd2+EH8pWIlwIQ==", + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/@firebase/firestore/-/firestore-1.10.0.tgz", + "integrity": "sha512-m7RjiEmACg7BHZdAgWKEE5NGbXrc56cQeVqh1ptRNTjPZG0W0Ygtp4hmU5k9FuN9JogIZqBqcXRmRQcq9qOkNw==", "requires": { - "@firebase/component": "0.1.3", + "@firebase/component": "0.1.4", "@firebase/firestore-types": "1.9.0", "@firebase/logger": "0.1.34", - "@firebase/util": "0.2.38", + "@firebase/util": "0.2.39", "@firebase/webchannel-wrapper": "0.2.35", "@grpc/proto-loader": "^0.5.0", "grpc": "1.24.2", @@ -1011,11 +1011,11 @@ "integrity": "sha512-UOtneGMUTLr58P56Y0GT/c4ZyC39vOoRAzgwad4PIsyc7HlKShbHKJpyys/LdlUYIsQdy/2El3Qy1veiBQ+ZJg==" }, "@firebase/functions": { - "version": "0.4.30", - "resolved": "https://registry.npmjs.org/@firebase/functions/-/functions-0.4.30.tgz", - "integrity": "sha512-gIcmtwn+HF5YnnJmyiK3iRKSLE+Ro92ngmwJEyhupk6PBpuqVF1r22kUlrjFsFlPXEx7TrkWvfZkYbTtLpkRHw==", + "version": "0.4.31", + "resolved": "https://registry.npmjs.org/@firebase/functions/-/functions-0.4.31.tgz", + "integrity": "sha512-6AiAoABRaFb0M0MMIHDXfbvNVduKNdLAGG+6FtMNuUzFbWiLLKsPgFy0jMkF874z7eIDT4XhZLNAasFVor/alw==", "requires": { - "@firebase/component": "0.1.3", + "@firebase/component": "0.1.4", "@firebase/functions-types": "0.3.13", "@firebase/messaging-types": "0.4.1", "isomorphic-fetch": "2.2.1", @@ -1028,13 +1028,13 @@ "integrity": "sha512-wD075tCmZo+t/GHs5xMhi3irwjbc6SWnjXAIHjuNhVDKic5gQNkHH5QnxX930WPrPhD0RV9wuSP15fy9T1mvjw==" }, "@firebase/installations": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/@firebase/installations/-/installations-0.4.0.tgz", - "integrity": "sha512-eAUrLjDnaKJ0oV4ApKlrS5TQeUv42hA39UZkZXDiMLnH94uPD5YaoGI2aR4H+PlxnGrhCqdh07BIPJY+vcmZgw==", + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/@firebase/installations/-/installations-0.4.1.tgz", + "integrity": "sha512-rZj3dce54YkKHLJpSvxtf+OWF1/yaQe3jRWt5Fy70XTTYv60RM5DkjbbjL7ItflBMzXZCVUTiBUogFWN4Y1LVg==", "requires": { - "@firebase/component": "0.1.3", + "@firebase/component": "0.1.4", "@firebase/installations-types": "0.3.0", - "@firebase/util": "0.2.38", + "@firebase/util": "0.2.39", "idb": "3.0.2", "tslib": "1.10.0" } @@ -1050,14 +1050,14 @@ "integrity": "sha512-J2h6ylpd1IcuonRM3HBdXThitds6aQSIeoPYRPvApSFy82NhFPKRzJlflAhlQWjJOh59/jyQBGWJNxCL6fp4hw==" }, "@firebase/messaging": { - "version": "0.6.2", - "resolved": "https://registry.npmjs.org/@firebase/messaging/-/messaging-0.6.2.tgz", - "integrity": "sha512-sjdFF3v8Wc0K6r06UvskL/9zHFDbX0ospp1XSdl3OdYdq8mC/z8Fkw8oKN9+0StPWAQx8MdpmxDU/7Ixucf1fg==", + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/@firebase/messaging/-/messaging-0.6.3.tgz", + "integrity": "sha512-PgkKsJwErLDsCqrcFSaLgFH/oXzMcwBbNN7HyAXTsWxUwhBbG7c5xtGRGd21F82EEmXcFl3VU/Y/kyYuXskrbQ==", "requires": { - "@firebase/component": "0.1.3", - "@firebase/installations": "0.4.0", + "@firebase/component": "0.1.4", + "@firebase/installations": "0.4.1", "@firebase/messaging-types": "0.4.1", - "@firebase/util": "0.2.38", + "@firebase/util": "0.2.39", "idb": "3.0.2", "tslib": "1.10.0" } @@ -1068,15 +1068,15 @@ "integrity": "sha512-z2ki1nIE8TYH9LiXdozEzrPi9Cfckh9/x7HbDfj5KoVFYYvwLndUczstpKm2hvAUD3GuJF0JRUuxMHpJ6pwqzQ==" }, "@firebase/performance": { - "version": "0.2.30", - "resolved": "https://registry.npmjs.org/@firebase/performance/-/performance-0.2.30.tgz", - "integrity": "sha512-XxkiJIiEPnJUOrtv0h0AvDmcTyiYbhGfH12WksN9d53O61aTRUsjngHN6lEtlMud+0yEi6Q09pi4U+KBGm8yZQ==", + "version": "0.2.31", + "resolved": "https://registry.npmjs.org/@firebase/performance/-/performance-0.2.31.tgz", + "integrity": "sha512-vg60k0wnMeTRhW8myOiJPn8vuVHlusnhg2YlN0PlH2epvzUPUv9bAeYVC6/XESORxmBmqUzfMsAaD3oCAQ8boQ==", "requires": { - "@firebase/component": "0.1.3", - "@firebase/installations": "0.4.0", + "@firebase/component": "0.1.4", + "@firebase/installations": "0.4.1", "@firebase/logger": "0.1.34", "@firebase/performance-types": "0.0.8", - "@firebase/util": "0.2.38", + "@firebase/util": "0.2.39", "tslib": "1.10.0" } }, @@ -1108,15 +1108,15 @@ } }, "@firebase/remote-config": { - "version": "0.1.11", - "resolved": "https://registry.npmjs.org/@firebase/remote-config/-/remote-config-0.1.11.tgz", - "integrity": "sha512-AsrwmtYVkU1ZqUujV1i2wt0XK2Zph6gBeOIPEo+xD4uyzXoqTHUaW5ZPTBzjYCw1KDKTL6ciXXxk5c+cfNzjyg==", + "version": "0.1.12", + "resolved": "https://registry.npmjs.org/@firebase/remote-config/-/remote-config-0.1.12.tgz", + "integrity": "sha512-L8Qr2waj5NjgWYsjjhvMmSnUaav4LPdrshdz/l/QPBCkNpF5+hIxbeG2f8609D5brcQVnG7uR4lcWfkzl+zsfQ==", "requires": { - "@firebase/component": "0.1.3", - "@firebase/installations": "0.4.0", + "@firebase/component": "0.1.4", + "@firebase/installations": "0.4.1", "@firebase/logger": "0.1.34", "@firebase/remote-config-types": "0.1.5", - "@firebase/util": "0.2.38", + "@firebase/util": "0.2.39", "tslib": "1.10.0" } }, @@ -1126,13 +1126,13 @@ "integrity": "sha512-1JR0XGVN0dNKJlu5sMYh0qL0jC85xNgXfUquUGNHhy9lH3++t1gD91MeiDBgxI73oFQR7PEPeu+CTeDS0g8lWQ==" }, "@firebase/storage": { - "version": "0.3.24", - "resolved": "https://registry.npmjs.org/@firebase/storage/-/storage-0.3.24.tgz", - "integrity": "sha512-hwk5ObwtqcfMFOnd4BcCpCPlr13L686iRAaa7qlOEimx0CizWD1QRmduDuxjuxHsqNnSr3QIUleG48Z8gKOg6A==", + "version": "0.3.25", + "resolved": "https://registry.npmjs.org/@firebase/storage/-/storage-0.3.25.tgz", + "integrity": "sha512-0dgfrbPuwFDMOsC3VeENSt4L5bTsLq/5spdDn/Cjj57T0lVRaXipmgD09y8CJ0/SYPfiRoxmMWKCMnVNeSDL/g==", "requires": { - "@firebase/component": "0.1.3", + "@firebase/component": "0.1.4", "@firebase/storage-types": "0.3.8", - "@firebase/util": "0.2.38", + "@firebase/util": "0.2.39", "tslib": "1.10.0" } }, @@ -1142,9 +1142,9 @@ "integrity": "sha512-F0ED2WZaGjhjEdOk85c/1ikDQdWM1NiATFuTmRsaGYZyoERiwh/Mr6FnjqnLIeiJZqa6v2hk/aUgKosXjMWH/Q==" }, "@firebase/util": { - "version": "0.2.38", - "resolved": "https://registry.npmjs.org/@firebase/util/-/util-0.2.38.tgz", - "integrity": "sha512-EcTQWuWrUG7wgU8IGx50Zd/xE1DdwmYpMAIElsu5G5RPAJJ9VoAOAnxyRBPrrHmFeSLJpGtKPxc/rJXnEaGrXw==", + "version": "0.2.39", + "resolved": "https://registry.npmjs.org/@firebase/util/-/util-0.2.39.tgz", + "integrity": "sha512-hxbQJ9TkFzd6g8/ZcWBjdrxjxS0jYnR1EN3i1ah7i3KtvuxAtwNJ04YRf0QhKhCoitTkJ1Yn3cGb0kFnGtJVRA==", "requires": { "tslib": "1.10.0" } @@ -1840,9 +1840,9 @@ "integrity": "sha512-rr+OQyAjxze7GgWrSaJwydHStIhHq2lvY3BOC2Mj7KnzI7XK0Uw1TOOdI9lDoajEbSWLiYgoo4f1R51erQfhPQ==" }, "@types/long": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/@types/long/-/long-4.0.0.tgz", - "integrity": "sha512-1w52Nyx4Gq47uuu0EVcsHBxZFJgurQ+rTKS3qMHxR1GY2T8c2AJYd6vZoZ9q1rupaDjU0yT+Jc2XTyXkjeMA+Q==" + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/@types/long/-/long-4.0.1.tgz", + "integrity": "sha512-5tXH6Bx/kNGd3MgffdmP4dy2Z+G4eaXw0SE81Tq3BNadtnMR5/ySMzX4SLEzHJzSmPNn4HIdpQsBvXMUykr58w==" }, "@types/node": { "version": "12.12.17", @@ -5129,24 +5129,24 @@ } }, "firebase": { - "version": "7.7.0", - "resolved": "https://registry.npmjs.org/firebase/-/firebase-7.7.0.tgz", - "integrity": "sha512-rAjobH47rAYMyS4jiJqBATa5fNTqUTHNHvLzoMGzWNbmYqBzKyCk7EySRJek/+ZhfgJRYDfJxIActCTZ1jyN1Q==", + "version": "7.8.0", + "resolved": "https://registry.npmjs.org/firebase/-/firebase-7.8.0.tgz", + "integrity": "sha512-oOXb8asc9mF+xN3nHUnt8cFDo4sDkSuTSLRmPM3Jpz6yriBHJYuO1k7G6sbJOtCVl+nkj0maIyByNVQxt2eBlA==", "requires": { - "@firebase/analytics": "0.2.11", - "@firebase/app": "0.5.2", + "@firebase/analytics": "0.2.12", + "@firebase/app": "0.5.3", "@firebase/app-types": "0.5.0", "@firebase/auth": "0.13.4", - "@firebase/database": "0.5.19", - "@firebase/firestore": "1.9.3", - "@firebase/functions": "0.4.30", - "@firebase/installations": "0.4.0", - "@firebase/messaging": "0.6.2", - "@firebase/performance": "0.2.30", + "@firebase/database": "0.5.20", + "@firebase/firestore": "1.10.0", + "@firebase/functions": "0.4.31", + "@firebase/installations": "0.4.1", + "@firebase/messaging": "0.6.3", + "@firebase/performance": "0.2.31", "@firebase/polyfill": "0.3.31", - "@firebase/remote-config": "0.1.11", - "@firebase/storage": "0.3.24", - "@firebase/util": "0.2.38" + "@firebase/remote-config": "0.1.12", + "@firebase/storage": "0.3.25", + "@firebase/util": "0.2.39" } }, "flatted": { @@ -9660,9 +9660,9 @@ }, "dependencies": { "@types/node": { - "version": "10.17.13", - "resolved": "https://registry.npmjs.org/@types/node/-/node-10.17.13.tgz", - "integrity": "sha512-pMCcqU2zT4TjqYFrWtYHKal7Sl30Ims6ulZ4UFXxI4xbtQqK/qqKwkDoBFCfooRqqmRu9vY3xaJRwxSh673aYg==" + "version": "10.17.14", + "resolved": "https://registry.npmjs.org/@types/node/-/node-10.17.14.tgz", + "integrity": "sha512-G0UmX5uKEmW+ZAhmZ6PLTQ5eu/VPaT+d/tdLd5IFsKRPcbe6lPxocBtcYBFSaLaCW8O60AX90e91Nsp8lVHCNw==" } } }, diff --git a/package.json b/package.json index bf05f59ac..928d01341 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,7 @@ "@nuxtjs/sitemap": "^2.0.1", "@nuxtjs/toast": "^3.3.0", "ace-builds": "^1.4.8", - "firebase": "^7.7.0", + "firebase": "^7.8.0", "graphql": "^14.5.8", "nuxt": "^2.11.0", "nuxt-i18n": "^6.5.0", From b40d5a75f2d3752e65fd8836a881607036c56de2 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Fri, 31 Jan 2020 01:07:32 +0000 Subject: [PATCH 09/97] chore(deps): bump graphql from 14.5.8 to 14.6.0 Bumps [graphql](https://github.com/graphql/graphql-js) from 14.5.8 to 14.6.0. - [Release notes](https://github.com/graphql/graphql-js/releases) - [Commits](https://github.com/graphql/graphql-js/compare/v14.5.8...v14.6.0) Signed-off-by: dependabot-preview[bot] --- package-lock.json | 12 ++++++------ package.json | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/package-lock.json b/package-lock.json index 8a30c84ac..ef38acd74 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5517,9 +5517,9 @@ "integrity": "sha512-a30VEBm4PEdx1dRB7MFK7BejejvCvBronbLjht+sHuGYj8PHs7M/5Z+rt5lw551vZ7yfTCj4Vuyy3mSJytDWRQ==" }, "graphql": { - "version": "14.5.8", - "resolved": "https://registry.npmjs.org/graphql/-/graphql-14.5.8.tgz", - "integrity": "sha512-MMwmi0zlVLQKLdGiMfWkgQD7dY/TUKt4L+zgJ/aR0Howebod3aNgP5JkgvAULiR2HPVZaP2VEElqtdidHweLkg==", + "version": "14.6.0", + "resolved": "https://registry.npmjs.org/graphql/-/graphql-14.6.0.tgz", + "integrity": "sha512-VKzfvHEKybTKjQVpTFrA5yUq2S9ihcZvfJAtsDBBCuV6wauPu1xl/f9ehgVf0FcEJJs4vz6ysb/ZMkGigQZseg==", "requires": { "iterall": "^1.2.2" } @@ -6803,9 +6803,9 @@ "dev": true }, "iterall": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/iterall/-/iterall-1.2.2.tgz", - "integrity": "sha512-yynBb1g+RFUPY64fTrFv7nsjRrENBQJaX2UL+2Szc9REFrSNm1rpSXHGzhmAy7a9uv3vlvgBlXnf9RqmPH1/DA==" + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/iterall/-/iterall-1.3.0.tgz", + "integrity": "sha512-QZ9qOMdF+QLHxy1QIpUHUU1D5pS2CG2P69LF6L6CPjPYA/XMOmKV3PZpawHoAjHNyB0swdVTRxdYT4tbBbxqwg==" }, "jest-worker": { "version": "24.9.0", diff --git a/package.json b/package.json index 928d01341..1975b4be5 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,7 @@ "@nuxtjs/toast": "^3.3.0", "ace-builds": "^1.4.8", "firebase": "^7.8.0", - "graphql": "^14.5.8", + "graphql": "^14.6.0", "nuxt": "^2.11.0", "nuxt-i18n": "^6.5.0", "v-tooltip": "^2.0.3", From 9a2fa9e2c736be01b7c25c10b17ea4430ae09d82 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Fri, 31 Jan 2020 01:25:41 +0000 Subject: [PATCH 10/97] chore(deps): bump @nuxtjs/axios from 5.9.3 to 5.9.4 Bumps [@nuxtjs/axios](https://github.com/nuxt-community/axios-module) from 5.9.3 to 5.9.4. - [Release notes](https://github.com/nuxt-community/axios-module/releases) - [Changelog](https://github.com/nuxt-community/axios-module/blob/dev/CHANGELOG.md) - [Commits](https://github.com/nuxt-community/axios-module/compare/v5.9.3...v5.9.4) Signed-off-by: dependabot-preview[bot] --- package-lock.json | 20 ++++++++++---------- package.json | 2 +- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/package-lock.json b/package-lock.json index ef38acd74..78109f2d4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1671,12 +1671,12 @@ } }, "@nuxtjs/axios": { - "version": "5.9.3", - "resolved": "https://registry.npmjs.org/@nuxtjs/axios/-/axios-5.9.3.tgz", - "integrity": "sha512-+P1BK7MxMRL4q1WeYM9vyfocJrRoskbuD2TztKU8ryunK8JgpkIvqCzQxTI2BLUbOPd7qvjPLwzA0QBdzqYlaA==", + "version": "5.9.4", + "resolved": "https://registry.npmjs.org/@nuxtjs/axios/-/axios-5.9.4.tgz", + "integrity": "sha512-lwugsdVU4BEyY7rnYSsipGh4qlqEJOyForxF9C9wttVVT5IBvLlHiPE6Ownxl7gbqXKa819UKOqIPmb94DVV9A==", "requires": { "@nuxtjs/proxy": "^1.3.3", - "axios": "^0.19.1", + "axios": "^0.19.2", "axios-retry": "^3.1.2", "consola": "^2.11.3", "defu": "^0.0.4" @@ -2506,9 +2506,9 @@ "dev": true }, "axios": { - "version": "0.19.1", - "resolved": "https://registry.npmjs.org/axios/-/axios-0.19.1.tgz", - "integrity": "sha512-Yl+7nfreYKaLRvAvjNPkvfjnQHJM1yLBY3zhqAwcJSwR/6ETkanUgylgtIvkvz0xJ+p/vZuNw8X7Hnb7Whsbpw==", + "version": "0.19.2", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.19.2.tgz", + "integrity": "sha512-fjgm5MvRHLhx+osE2xoekY70AhARk3a6hkN+3Io1jc00jtquGvxYlKlsFUhmUET0V5te6CcZI7lcv2Ym61mjHA==", "requires": { "follow-redirects": "1.5.10" }, @@ -5193,9 +5193,9 @@ } }, "follow-redirects": { - "version": "1.9.0", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.9.0.tgz", - "integrity": "sha512-CRcPzsSIbXyVDl0QI01muNDu69S8trU4jArW9LpOt2WtC6LyUJetcIrmfHsRBx7/Jb6GHJUiuqyYxPooFfNt6A==", + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.10.0.tgz", + "integrity": "sha512-4eyLK6s6lH32nOvLLwlIOnr9zrL8Sm+OvW4pVTJNoXeGzYIkHVf+pADQi+OJ0E67hiuSLezPVPyBcIZO50TmmQ==", "requires": { "debug": "^3.0.0" } diff --git a/package.json b/package.json index 1975b4be5..bdc5fbebe 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,7 @@ "test": "start-server-and-test dev http://localhost:3000 e2e" }, "dependencies": { - "@nuxtjs/axios": "^5.9.3", + "@nuxtjs/axios": "^5.9.4", "@nuxtjs/google-analytics": "^2.2.3", "@nuxtjs/google-tag-manager": "^2.3.1", "@nuxtjs/pwa": "^3.0.0-beta.19", From c32c6e0363db228044bb7169ac849c32f83583f1 Mon Sep 17 00:00:00 2001 From: Liyas Thomas Date: Fri, 31 Jan 2020 18:25:55 +0530 Subject: [PATCH 11/97] :recycle: Refactor --- components/ace-editor.vue | 4 +++- pages/index.vue | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/components/ace-editor.vue b/components/ace-editor.vue index 5065b7994..d6f14389a 100644 --- a/components/ace-editor.vue +++ b/components/ace-editor.vue @@ -74,7 +74,9 @@ export default { methods: { defineTheme() { - if (this.theme) return this.theme; + if (this.theme) { + return this.theme; + } return ( this.$store.state.postwoman.settings.THEME_ACE_EDITOR || DEFAULT_THEME ); diff --git a/pages/index.vue b/pages/index.vue index f439c03d1..a91a37949 100644 --- a/pages/index.vue +++ b/pages/index.vue @@ -1884,10 +1884,10 @@ export default { const requestString = []; requestString.push("const xhr = new XMLHttpRequest()"); const user = this.auth === "Basic Auth" ? `'${this.httpUser}'` : null; - const pswd = + const password = this.auth === "Basic Auth" ? `'${this.httpPassword}'` : null; requestString.push( - `xhr.open('${this.method}', '${this.url}${this.pathName}${this.queryString}', true, ${user}, ${pswd})` + `xhr.open('${this.method}', '${this.url}${this.pathName}${this.queryString}', true, ${user}, ${password})` ); if (this.auth === "Bearer Token" || this.auth === "OAuth 2.0") { requestString.push( From a9564086b0aae8efd0b5248c941dfc0fa80ee5e1 Mon Sep 17 00:00:00 2001 From: jamesgeorge007 Date: Fri, 31 Jan 2020 19:44:49 +0530 Subject: [PATCH 12/97] refactor: destructuring assignment and other tweaks --- pages/index.vue | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/pages/index.vue b/pages/index.vue index a91a37949..69d1fcb3d 100644 --- a/pages/index.vue +++ b/pages/index.vue @@ -2515,13 +2515,12 @@ export default { observer.observe(requestElement); }, handleImport() { - let textarea = document.getElementById("import-text"); - let text = textarea.value; + const { value: text } = document.getElementById("import-text"); try { - let parsedCurl = parseCurlCommand(text); - let url = new URL(parsedCurl.url.replace(/"/g, "").replace(/'/g, "")); - this.url = url.origin; - this.path = url.pathname; + const parsedCurl = parseCurlCommand(text); + const { origin, pathname } = new URL(parsedCurl.url.replace(/"/g, "").replace(/'/g, "")); + this.url = origin; + this.path = pathname; this.headers = []; if (parsedCurl.headers) { for (const key of Object.keys(parsedCurl.headers)) { From b05cd2e6e4c427d3ccc6d5ba872ee5349685a4a3 Mon Sep 17 00:00:00 2001 From: jamesgeorge007 Date: Fri, 31 Jan 2020 19:45:52 +0530 Subject: [PATCH 13/97] refactor: stick with Es6 semantics --- pages/index.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pages/index.vue b/pages/index.vue index 69d1fcb3d..34a843faf 100644 --- a/pages/index.vue +++ b/pages/index.vue @@ -2525,7 +2525,7 @@ export default { if (parsedCurl.headers) { for (const key of Object.keys(parsedCurl.headers)) { this.$store.commit("addHeaders", { - key: key, + key, value: parsedCurl.headers[key] }); } From 5429e493ea43309050704c52d86c83b26d928d56 Mon Sep 17 00:00:00 2001 From: jamesgeorge007 Date: Fri, 31 Jan 2020 19:47:19 +0530 Subject: [PATCH 14/97] refactor: stylistic update --- pages/index.vue | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pages/index.vue b/pages/index.vue index 34a843faf..b020ecdb8 100644 --- a/pages/index.vue +++ b/pages/index.vue @@ -2491,7 +2491,9 @@ export default { if (key === "rawParams") { this.rawInput = true; this.rawParams = queries["rawParams"]; - } else if (typeof this[key] === "string") this[key] = queries[key]; + } else if (typeof this[key] === "string") { + this[key] = queries[key]; + } } }, observeRequestButton() { From d77e3745bb2c0a7d4e5d49d3608cc9a9eca2ab4c Mon Sep 17 00:00:00 2001 From: jamesgeorge007 Date: Fri, 31 Jan 2020 19:50:24 +0530 Subject: [PATCH 15/97] refactor: stylistic update --- pages/index.vue | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/pages/index.vue b/pages/index.vue index b020ecdb8..49412e20d 100644 --- a/pages/index.vue +++ b/pages/index.vue @@ -2259,7 +2259,7 @@ export default { queryStringToArray(queryString) { let queryParsed = querystring.parse(queryString); return Object.keys(queryParsed).map(key => ({ - key: key, + key, value: queryParsed[key] })); }, @@ -2334,8 +2334,8 @@ export default { }, copyRequest() { if (navigator.share) { - let time = new Date().toLocaleTimeString(); - let date = new Date().toLocaleDateString(); + const time = new Date().toLocaleTimeString(); + const date = new Date().toLocaleDateString(); navigator .share({ title: `Postwoman`, @@ -2452,7 +2452,8 @@ export default { const haveItems = [...this[key]].length; if (haveItems && this[key]["value"] !== "") { return `${key}=${JSON.stringify(this[key])}&`; - } else return ""; + } + return ""; }; let flats = [ "method", @@ -2466,8 +2467,8 @@ export default { ] .filter(item => item !== null) .map(item => flat(item)); - let deeps = ["headers", "params"].map(item => deep(item)); - let bodyParams = this.rawInput + const deeps = ["headers", "params"].map(item => deep(item)); + const bodyParams = this.rawInput ? [flat("rawParams")] : [deep("bodyParams")]; From 2b165a065c08e26e3991d759f93dbb536fac8563 Mon Sep 17 00:00:00 2001 From: jamesgeorge007 Date: Sat, 1 Feb 2020 22:26:31 +0530 Subject: [PATCH 16/97] refactor: stick with the enforced style --- pages/index.vue | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pages/index.vue b/pages/index.vue index 49412e20d..943780b49 100644 --- a/pages/index.vue +++ b/pages/index.vue @@ -1504,8 +1504,11 @@ export default { this.rawInput = !this.knownContentTypes.includes(val); }, rawInput(status) { - if (status && this.rawParams === "") this.rawParams = "{}"; - else this.setRouteQueryState(); + if (status && this.rawParams === "") { + this.rawParams = "{}"; + } else { + this.setRouteQueryState(); + } }, "response.body": function(val) { if ( From ef434ca8040a97cc98d2b61498c5902162a75f8c Mon Sep 17 00:00:00 2001 From: jamesgeorge007 Date: Sat, 1 Feb 2020 22:30:35 +0530 Subject: [PATCH 17/97] refactor: destructuring assignment --- pages/index.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pages/index.vue b/pages/index.vue index 943780b49..c1168c9c5 100644 --- a/pages/index.vue +++ b/pages/index.vue @@ -1839,8 +1839,8 @@ export default { return this.path.match(/^([^?]*)\??/)[1]; }, rawRequestBody() { - const { bodyParams } = this; - if (this.contentType === "application/json") { + const { bodyParams, contentType } = this; + if (contentType === "application/json") { try { const obj = JSON.parse( `{${bodyParams From fa15457ce4c766eaeda3767ff1bd5ffeb6262e0f Mon Sep 17 00:00:00 2001 From: jamesgeorge007 Date: Sat, 1 Feb 2020 22:44:24 +0530 Subject: [PATCH 18/97] refactor: let to const --- pages/index.vue | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pages/index.vue b/pages/index.vue index c1168c9c5..46ce61a08 100644 --- a/pages/index.vue +++ b/pages/index.vue @@ -2256,19 +2256,19 @@ export default { }, getQueryStringFromPath() { let queryString; - let pathParsed = url.parse(this.path); + const pathParsed = url.parse(this.path); return (queryString = pathParsed.query ? pathParsed.query : ""); }, queryStringToArray(queryString) { - let queryParsed = querystring.parse(queryString); + const queryParsed = querystring.parse(queryString); return Object.keys(queryParsed).map(key => ({ key, value: queryParsed[key] })); }, pathInputHandler() { - let queryString = this.getQueryStringFromPath(); - let params = this.queryStringToArray(queryString); + const queryString = this.getQueryStringFromPath(); + const params = this.queryStringToArray(queryString); this.paramsWatchEnabled = false; this.params = params; }, From 3bd22f6b78ed34cf0354899cac000b7299992eb0 Mon Sep 17 00:00:00 2001 From: jamesgeorge007 Date: Sat, 1 Feb 2020 22:48:06 +0530 Subject: [PATCH 19/97] refactor: let to const --- pages/index.vue | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pages/index.vue b/pages/index.vue index 46ce61a08..da0fb1b5a 100644 --- a/pages/index.vue +++ b/pages/index.vue @@ -2678,9 +2678,9 @@ export default { }, uploadPayload() { this.rawInput = true; - let file = this.$refs.payload.files[0]; + const file = this.$refs.payload.files[0]; if (file !== undefined && file !== null) { - let reader = new FileReader(); + const reader = new FileReader(); reader.onload = ({ target }) => { this.rawParams = target.result; }; @@ -2721,7 +2721,7 @@ export default { } }, async oauthRedirectReq() { - let tokenInfo = await oauthRedirect(); + const tokenInfo = await oauthRedirect(); if (tokenInfo.hasOwnProperty("access_token")) { this.bearerToken = tokenInfo.access_token; this.addOAuthToken({ @@ -2773,7 +2773,7 @@ export default { }, removeOAuthTokenReq(index) { const oldTokenReqs = this.tokenReqs.slice(); - let targetReqIndex = this.tokenReqs.findIndex( + const targetReqIndex = this.tokenReqs.findIndex( ({ name }) => name === this.tokenReqName ); if (targetReqIndex < 0) return; @@ -2790,7 +2790,7 @@ export default { }); }, tokenReqChange({ target }) { - let targetReq = this.tokenReqs.find(({ name }) => name === target.value); + const targetReq = this.tokenReqs.find(({ name }) => name === target.value); let { oidcDiscoveryUrl, authUrl, From ad041a5cf1ec5c9c7d79fe1768cdaee62d40150b Mon Sep 17 00:00:00 2001 From: jamesgeorge007 Date: Sat, 1 Feb 2020 22:49:09 +0530 Subject: [PATCH 20/97] refactor: tweaks --- pages/index.vue | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pages/index.vue b/pages/index.vue index da0fb1b5a..77c39403e 100644 --- a/pages/index.vue +++ b/pages/index.vue @@ -2790,15 +2790,15 @@ export default { }); }, tokenReqChange({ target }) { - const targetReq = this.tokenReqs.find(({ name }) => name === target.value); - let { + const { details, name } = this.tokenReqs.find(({ name }) => name === target.value); + const { oidcDiscoveryUrl, authUrl, accessTokenUrl, clientId, scope - } = targetReq.details; - this.tokenReqName = targetReq.name; + } = details; + this.tokenReqName = name; this.oidcDiscoveryUrl = oidcDiscoveryUrl; this.authUrl = authUrl; this.accessTokenUrl = accessTokenUrl; From 0f55b8ee8a3939618f8ceb56521eb61a2e1792c1 Mon Sep 17 00:00:00 2001 From: jamesgeorge007 Date: Sat, 1 Feb 2020 22:56:25 +0530 Subject: [PATCH 21/97] refactor: minor tweak --- pages/index.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pages/index.vue b/pages/index.vue index 77c39403e..956c0395f 100644 --- a/pages/index.vue +++ b/pages/index.vue @@ -1852,7 +1852,7 @@ export default { ) .join()}}` ); - return JSON.stringify(obj); + return JSON.stringify(obj, null, 2); } catch (ex) { return "invalid"; } From 7cf5345c5aff7c025d8dd690cb8a52eee6afcf1e Mon Sep 17 00:00:00 2001 From: Liyas Thomas Date: Sun, 2 Feb 2020 08:31:06 +0530 Subject: [PATCH 22/97] =?UTF-8?q?=E2=9A=A1=EF=B8=8F=20Sync=20Collection=20?= =?UTF-8?q?->=20Notes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/firebase/feeds.vue | 48 ++++++++++++++++--------------- components/firebase/inputform.vue | 9 ++++-- components/history.vue | 5 ---- lang/en-US.js | 5 ++-- pages/index.vue | 18 +++++++----- 5 files changed, 46 insertions(+), 39 deletions(-) diff --git a/components/firebase/feeds.vue b/components/firebase/feeds.vue index 076dcdf97..1d51a98dd 100644 --- a/components/firebase/feeds.vue +++ b/components/firebase/feeds.vue @@ -3,10 +3,10 @@ v-if="fb.currentFeeds.length !== 0" class="virtual-list" :class="{ filled: fb.currentFeeds.length }" - :size="56" - :remain="Math.min(8, fb.currentFeeds.length)" + :size="90" + :remain="Math.min(5, fb.currentFeeds.length)" > -
    +
    • -
      +
      +
    • + +
    • +
      @@ -38,6 +40,23 @@ .virtual-list { max-height: calc(100vh - 288px); } + +ul, +ol { + flex-direction: column; +} + +.entry { + border-bottom: 1px dashed var(--brd-color); + padding: 0 0 8px; +} + +.clamb-3 { + display: -webkit-box; + -webkit-line-clamp: 3; + -webkit-box-orient: vertical; + overflow: hidden; +} diff --git a/components/environments/editEnvironment.vue b/components/environments/editEnvironment.vue new file mode 100644 index 000000000..adb3dc920 --- /dev/null +++ b/components/environments/editEnvironment.vue @@ -0,0 +1,206 @@ + + + diff --git a/components/environments/environment.vue b/components/environments/environment.vue new file mode 100644 index 000000000..8fda53198 --- /dev/null +++ b/components/environments/environment.vue @@ -0,0 +1,65 @@ + + + + + diff --git a/components/environments/importExportEnvironment.vue b/components/environments/importExportEnvironment.vue new file mode 100644 index 000000000..3072f6ad4 --- /dev/null +++ b/components/environments/importExportEnvironment.vue @@ -0,0 +1,170 @@ + + + diff --git a/components/environments/index.vue b/components/environments/index.vue new file mode 100644 index 000000000..c66e2fd0f --- /dev/null +++ b/components/environments/index.vue @@ -0,0 +1,133 @@ + + + + + diff --git a/lang/en-US.js b/lang/en-US.js index 9191cec5f..eba422b4b 100644 --- a/lang/en-US.js +++ b/lang/en-US.js @@ -45,6 +45,14 @@ export default { preview_html: "Preview HTML", history: "History", collections: "Collections", + environment: "Environment", + new_environment: "New Environment", + my_new_environment: "My New Environment", + edit_environment: "Edit Environment", + env_variable_list: "Variable List", + invalid_environment_name: "Please provide a valid name for the environment", + use_environment: "Use environment", + add_one_variable: "(add at least one variable)", import_curl: "Import cURL", import: "Import", generate_code: "Generate code", diff --git a/pages/index.vue b/pages/index.vue index e74fd46ea..7096306ad 100644 --- a/pages/index.vue +++ b/pages/index.vue @@ -1075,6 +1075,11 @@
      + + +
      + +
      @@ -1451,7 +1456,8 @@ export default { saveRequestAs: () => import("../components/collections/saveRequestAs"), Editor: AceEditor, inputform: () => import("../components/firebase/inputform"), - ballsfeed: () => import("../components/firebase/feeds") + ballsfeed: () => import("../components/firebase/feeds"), + environments: () => import("../components/environments") }, data() { return { @@ -2039,6 +2045,14 @@ export default { } }, methods: { + useSelectedEnvironment(environment) { + let preRequestScriptString = '' + for (let variable of environment.variables) { + preRequestScriptString = preRequestScriptString + `pw.env.set('${variable.key}', '${variable.value}');\n` + } + this.preRequestScript = preRequestScriptString + this.showPreRequestScript = true + }, checkCollections() { const checkCollectionAvailability = this.$store.state.postwoman.collections && diff --git a/store/postwoman.js b/store/postwoman.js index ab79729ef..945932e33 100644 --- a/store/postwoman.js +++ b/store/postwoman.js @@ -74,6 +74,13 @@ export const state = () => ({ requests: [] } ], + environments: [ + { + name: "My Env Variables", + variables: [] + } + ], + editingEnvironment: {}, selectedRequest: {}, editingRequest: {} }); @@ -102,6 +109,61 @@ export const mutations = { settings[key] = value; }, + removeVariables({ editingEnvironment }, value) { + editingEnvironment.variables = value + }, + + setEditingEnvironment(state, value ) { + state.editingEnvironment = {...value} + }, + + setVariableKey({ editingEnvironment }, { index, value }) { + editingEnvironment.variables[index].key = value; + }, + + setVariableValue({ editingEnvironment }, { index, value }) { + editingEnvironment.variables[index].value = value; + }, + + removeVariable({ editingEnvironment }, variables) { + editingEnvironment.variables = variables; + }, + + addVariable({ editingEnvironment }, value) { + editingEnvironment.variables.push(value); + }, + + replaceEnvironments(state, environments) { + state.environments = environments; + }, + + importAddEnvironments(state, environments) { + state.environments = [...state.environments, ...environments]; + + let index = 0; + for (let environment of state.environments) { + environment.environmentIndex = index; + index += 1; + } + }, + + removeEnvironment({ environments }, environmentIndex) { + environments.splice(environmentIndex, 1); + }, + + saveEnvironment({ environments }, payload) { + const { environment, environmentIndex } = payload; + const { name } = environment; + const duplicateEnvironment = environments.some(item => { + return item.environmentIndex !== environmentIndex && item.name.toLowerCase() === name.toLowerCase() + }); + if (duplicateEnvironment) { + this.$toast.info("Duplicate environment"); + return; + } + environments[environmentIndex] = environment; + }, + replaceCollections(state, collections) { state.collections = collections; }, @@ -323,3 +385,9 @@ export const mutations = { state.selectedRequest = Object.assign({}, request); } }; + +// export const getters = { +// getEditingEnvironment: state => { +// return state.editingEnvironment +// } +// } From 010be95ed5ffb4bbbbaa11eba614f45b6cdc3419 Mon Sep 17 00:00:00 2001 From: Liyas Thomas Date: Sun, 23 Feb 2020 22:43:12 +0530 Subject: [PATCH 83/97] Lint + few best practices --- components/environments/addEnvironment.vue | 11 ++-- components/environments/editEnvironment.vue | 50 +++++++++++-------- .../environments/importExportEnvironment.vue | 6 +-- components/environments/index.vue | 23 ++++++--- store/postwoman.js | 19 ++++--- 5 files changed, 63 insertions(+), 46 deletions(-) diff --git a/components/environments/addEnvironment.vue b/components/environments/addEnvironment.vue index b68768213..23c53d1ac 100644 --- a/components/environments/addEnvironment.vue +++ b/components/environments/addEnvironment.vue @@ -43,7 +43,6 @@ diff --git a/store/postwoman.js b/store/postwoman.js index 951cf4027..afffa7528 100644 --- a/store/postwoman.js +++ b/store/postwoman.js @@ -110,11 +110,11 @@ export const mutations = { }, removeVariables({ editingEnvironment }, value) { - editingEnvironment.variables = value + editingEnvironment.variables = value; }, - setEditingEnvironment(state, value ) { - state.editingEnvironment = {...value} + setEditingEnvironment(state, value) { + state.editingEnvironment = { ...value }; }, setVariableKey({ editingEnvironment }, { index, value }) { @@ -154,9 +154,11 @@ export const mutations = { saveEnvironment({ environments }, payload) { const { environment, environmentIndex } = payload; const { name } = environment; - const duplicateEnvironment = environments.some(item => { - return item.environmentIndex !== environmentIndex && item.name.toLowerCase() === name.toLowerCase() - }); + const duplicateEnvironment = environments.some( + item => + item.environmentIndex !== environmentIndex && + item.name.toLowerCase() === name.toLowerCase() + ); if (duplicateEnvironment) { this.$toast.info("Duplicate environment"); return; @@ -201,7 +203,10 @@ export const mutations = { }, editCollection({ collections }, payload) { - const { collection: { name }, collectionIndex } = payload; + const { + collection: { name }, + collectionIndex + } = payload; const duplicateCollection = collections.some( item => item.name.toLowerCase() === name.toLowerCase() ); From d24c572d7f383847dfeeb3f6dc4e2e5e5083c634 Mon Sep 17 00:00:00 2001 From: Liyas Thomas Date: Mon, 24 Feb 2020 00:30:22 +0530 Subject: [PATCH 84/97] Firebase sync --- .../collections/importExportCollections.vue | 133 +++++++++++------- components/environments/addEnvironment.vue | 12 ++ .../environments/importExportEnvironment.vue | 16 ++- components/environments/index.vue | 17 ++- functions/fb.js | 29 ++++ lang/en-US.js | 4 +- pages/index.vue | 18 +-- pages/settings.vue | 11 +- 8 files changed, 164 insertions(+), 76 deletions(-) diff --git a/components/collections/importExportCollections.vue b/components/collections/importExportCollections.vue index 6d79fb21e..44ebe6c13 100644 --- a/components/collections/importExportCollections.vue +++ b/components/collections/importExportCollections.vue @@ -121,12 +121,19 @@ export default { let content = event.target.result; let collections = JSON.parse(content); if (collections[0]) { - let [ name, folders, requests ] = Object.keys(collections[0]) - if (name === 'name' && folders === 'folders' && requests === 'requests') { + let [name, folders, requests] = Object.keys(collections[0]); + if ( + name === "name" && + folders === "folders" && + requests === "requests" + ) { // Do nothing } - } else if (collections.info && collections.info.schema.includes('v2.1.0')) { - collections = this.parsePostmanCollection(collections) + } else if ( + collections.info && + collections.info.schema.includes("v2.1.0") + ) { + collections = this.parsePostmanCollection(collections); } else { return this.failedImport(); } @@ -141,11 +148,18 @@ export default { let content = event.target.result; let collections = JSON.parse(content); if (collections[0]) { - let [ name, folders, requests ] = Object.keys(collections[0]) - if (name === 'name' && folders === 'folders' && requests === 'requests') { + let [name, folders, requests] = Object.keys(collections[0]); + if ( + name === "name" && + folders === "folders" && + requests === "requests" + ) { // Do nothing } - } else if (collections.info && collections.info.schema.includes('v2.1.0')) { + } else if ( + collections.info && + collections.info.schema.includes("v2.1.0") + ) { collections = this.parsePostmanCollection(collections); } else { return this.failedImport(); @@ -188,28 +202,38 @@ export default { }); }, parsePostmanCollection(collection, folders = true) { - let postwomanCollection = folders ? [{ - "name": "", - "folders": [], - "requests": [] - }] + let postwomanCollection = folders + ? [ + { + name: "", + folders: [], + requests: [] + } + ] : { - "name": "", - "requests": [] - }; - for(let collectionItem of collection.item) { + name: "", + requests: [] + }; + for (let collectionItem of collection.item) { if (collectionItem.request) { if (postwomanCollection[0]) { - postwomanCollection[0].name = collection.info ? collection.info.name : ""; - postwomanCollection[0].requests.push(this.parsePostmanRequest(collectionItem)); + postwomanCollection[0].name = collection.info + ? collection.info.name + : ""; + postwomanCollection[0].requests.push( + this.parsePostmanRequest(collectionItem) + ); } else { - postwomanCollection.name = collection.name ? collection.name - : ""; - postwomanCollection.requests.push(this.parsePostmanRequest(collectionItem)); + postwomanCollection.name = collection.name ? collection.name : ""; + postwomanCollection.requests.push( + this.parsePostmanRequest(collectionItem) + ); } } else if (collectionItem.item) { if (collectionItem.item[0]) { - postwomanCollection[0].folders.push(this.parsePostmanCollection(collectionItem, false)); + postwomanCollection[0].folders.push( + this.parsePostmanCollection(collectionItem, false) + ); } } } @@ -217,46 +241,51 @@ export default { }, parsePostmanRequest(requestObject) { let pwRequest = { - "url": "", - "path": "", - "method": "", - "auth": "", - "httpUser": "", - "httpPassword": "", - "passwordFieldType": "password", - "bearerToken": "", - "headers": [], - "params": [], - "bodyParams": [], - "rawParams": "", - "rawInput": false, - "contentType": "", - "requestType": "", - "name": "", + url: "", + path: "", + method: "", + auth: "", + httpUser: "", + httpPassword: "", + passwordFieldType: "password", + bearerToken: "", + headers: [], + params: [], + bodyParams: [], + rawParams: "", + rawInput: false, + contentType: "", + requestType: "", + name: "" }; pwRequest.name = requestObject.name; - let requestObjectUrl = requestObject.request.url.raw.match(/^(.+:\/\/[^\/]+|{[^\/]+})(\/[^\?]+|).*$/); + let requestObjectUrl = requestObject.request.url.raw.match( + /^(.+:\/\/[^\/]+|{[^\/]+})(\/[^\?]+|).*$/ + ); pwRequest.url = requestObjectUrl[1]; pwRequest.path = requestObjectUrl[2] ? requestObjectUrl[2] : ""; pwRequest.method = requestObject.request.method; - let itemAuth = requestObject.request.auth ? requestObject.request.auth - : ""; - let authType = itemAuth ? itemAuth.type + let itemAuth = requestObject.request.auth + ? requestObject.request.auth : ""; + let authType = itemAuth ? itemAuth.type : ""; if (authType === "basic") { pwRequest.auth = "Basic Auth"; - pwRequest.httpUser = itemAuth.basic[0].key === "username" - ? itemAuth.basic[0].value - : itemAuth.basic[1].value; - pwRequest.httpPassword = itemAuth.basic[0].key === "password" - ? itemAuth.basic[0].value - : itemAuth.basic[1].value; + pwRequest.httpUser = + itemAuth.basic[0].key === "username" + ? itemAuth.basic[0].value + : itemAuth.basic[1].value; + pwRequest.httpPassword = + itemAuth.basic[0].key === "password" + ? itemAuth.basic[0].value + : itemAuth.basic[1].value; } else if (authType === "oauth2") { pwRequest.auth = "OAuth 2.0"; - pwRequest.bearerToken = itemAuth.oauth2[0].key === "accessToken" - ? itemAuth.oauth2[0].value - : itemAuth.oauth2[1].value; + pwRequest.bearerToken = + itemAuth.oauth2[0].key === "accessToken" + ? itemAuth.oauth2[0].value + : itemAuth.oauth2[1].value; } else if (authType === "bearer") { pwRequest.auth = "Bearer Token"; pwRequest.bearerToken = itemAuth.bearer[0].value; @@ -280,7 +309,7 @@ export default { if (requestObject.request.body.mode === "urlencoded") { let params = requestObject.request.body.urlencoded; pwRequest.bodyParams = params ? params : []; - for(let param of pwRequest.bodyParams) { + for (let param of pwRequest.bodyParams) { delete param.type; } } else if (requestObject.request.body.mode === "raw") { diff --git a/components/environments/addEnvironment.vue b/components/environments/addEnvironment.vue index 23c53d1ac..a87873e18 100644 --- a/components/environments/addEnvironment.vue +++ b/components/environments/addEnvironment.vue @@ -43,6 +43,8 @@ diff --git a/functions/fb.js b/functions/fb.js index c73a655fc..32076b51d 100644 --- a/functions/fb.js +++ b/functions/fb.js @@ -26,6 +26,7 @@ export const fb = { currentSettings: [], currentHistory: [], currentCollections: [], + currentEnvironments: [], writeFeeds: async (message, label) => { const dt = { createdOn: new Date(), @@ -112,6 +113,21 @@ export const fb = { .doc("sync") .set(cl) .catch(e => console.error("error updating", cl, e)); + }, + writeEnvironments: async environment => { + const ev = { + updatedOn: new Date(), + author: fb.currentUser.uid, + author_name: fb.currentUser.displayName, + author_image: fb.currentUser.photoURL, + environment: environment + }; + usersCollection + .doc(fb.currentUser.uid) + .collection("environments") + .doc("sync") + .set(ev) + .catch(e => console.error("error updating", ev, e)); } }; @@ -186,6 +202,19 @@ firebase.auth().onAuthStateChanged(user => { }); fb.currentCollections = collections[0].collection; }); + + usersCollection + .doc(fb.currentUser.uid) + .collection("environments") + .onSnapshot(environmentsRef => { + const environments = []; + environmentsRef.forEach(doc => { + const environment = doc.data(); + environment.id = doc.id; + environments.push(environment); + }); + fb.currentEnvironments = environments[0].environment; + }); } else { fb.currentUser = null; } diff --git a/lang/en-US.js b/lang/en-US.js index 6986063e3..e541cdf08 100644 --- a/lang/en-US.js +++ b/lang/en-US.js @@ -256,7 +256,8 @@ export default { enter_curl: "Enter cURL", empty: "Empty", extensions: "Extensions", - extensions_use_toggle: "Use the browser extension to send requests (if present)", + extensions_use_toggle: + "Use the browser extension to send requests (if present)", extensions_info1: "Browser extension that simplifies access to Postwoman", extensions_info2: "Get Postwoman browser extension!", installed: "Installed", @@ -267,6 +268,7 @@ export default { sync: "Sync", syncHistory: "History", syncCollections: "Collections", + syncEnvironments: "Environments", turn_on: "Turn on", login_first: "Login first", paste_a_note: "Paste a note", diff --git a/pages/index.vue b/pages/index.vue index 95bc8fe09..85fd5938f 100644 --- a/pages/index.vue +++ b/pages/index.vue @@ -1086,7 +1086,7 @@
      - +
        @@ -1456,7 +1456,7 @@ export default { saveRequestAs: () => import("../components/collections/saveRequestAs"), Editor: AceEditor, inputform: () => import("../components/firebase/inputform"), - ballsfeed: () => import("../components/firebase/feeds"), + notes: () => import("../components/firebase/feeds"), environments: () => import("../components/environments") }, data() { @@ -2047,12 +2047,14 @@ export default { }, methods: { useSelectedEnvironment(environment) { - let preRequestScriptString = '' + let preRequestScriptString = ""; for (let variable of environment.variables) { - preRequestScriptString = preRequestScriptString + `pw.env.set('${variable.key}', '${variable.value}');\n` + preRequestScriptString = + preRequestScriptString + + `pw.env.set('${variable.key}', '${variable.value}');\n`; } - this.preRequestScript = preRequestScriptString - this.showPreRequestScript = true + this.preRequestScript = preRequestScriptString; + this.showPreRequestScript = true; }, checkCollections() { const checkCollectionAvailability = @@ -2247,7 +2249,7 @@ export default { }; this.$refs.historyComponent.addEntry(entry); if (fb.currentUser !== null) { - if (fb.currentSettings[1].value) { + if (fb.currentSettings[2].value) { fb.writeHistory(entry); } } @@ -2284,7 +2286,7 @@ export default { }; this.$refs.historyComponent.addEntry(entry); if (fb.currentUser !== null) { - if (fb.currentSettings[1].value) { + if (fb.currentSettings[2].value) { fb.writeHistory(entry); } } diff --git a/pages/settings.vue b/pages/settings.vue index 345ceea73..bd8ba090a 100644 --- a/pages/settings.vue +++ b/pages/settings.vue @@ -38,7 +38,7 @@ {{ setting.value ? $t("enabled") : $t("disabled") }}

        -

        +

      +
        +
      • + + + {{ $t("scrollInto_use_toggle") }} + {{ + settings.SCROLL_INTO_ENABLED ? $t("enabled") : $t("disabled") + }} + + +
      @@ -331,7 +346,8 @@ export default { ], settings: { - THEME_CLASS: this.$store.state.postwoman.settings.THEME_CLASS || "", + SCROLL_INTO_ENABLED: + this.$store.state.postwoman.settings.SCROLL_INTO_ENABLED || false, THEME_COLOR: "", THEME_TAB_COLOR: "", THEME_COLOR_VIBRANT: true, diff --git a/store/postwoman.js b/store/postwoman.js index c7cae06eb..ad7b13f63 100644 --- a/store/postwoman.js +++ b/store/postwoman.js @@ -1,6 +1,12 @@ import Vue from "vue"; export const SETTINGS_KEYS = [ + /** + * Whether or not to enable scrolling to a specified element, when certain + * actions are triggered. + */ + "SCROLL_INTO_ENABLED", + /** * The CSS class that should be applied to the root element. * Essentially, the name of the background theme. From 64e20a135028ce551e333f1439fbec027a4150fa Mon Sep 17 00:00:00 2001 From: jamesgeorge007 Date: Mon, 24 Feb 2020 22:26:13 +0530 Subject: [PATCH 93/97] fix: enable auto scroll by default --- pages/settings.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pages/settings.vue b/pages/settings.vue index c793e84b4..35aa29b49 100644 --- a/pages/settings.vue +++ b/pages/settings.vue @@ -347,7 +347,7 @@ export default { settings: { SCROLL_INTO_ENABLED: - this.$store.state.postwoman.settings.SCROLL_INTO_ENABLED || false, + this.$store.state.postwoman.settings.SCROLL_INTO_ENABLED || true, THEME_COLOR: "", THEME_TAB_COLOR: "", THEME_COLOR_VIBRANT: true, From f8d032d9fcd2d390805e2409a5de77c564c18b82 Mon Sep 17 00:00:00 2001 From: jamesgeorge007 Date: Mon, 24 Feb 2020 22:57:35 +0530 Subject: [PATCH 94/97] fix: regression --- pages/settings.vue | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pages/settings.vue b/pages/settings.vue index 35aa29b49..eeb09d8a6 100644 --- a/pages/settings.vue +++ b/pages/settings.vue @@ -347,7 +347,11 @@ export default { settings: { SCROLL_INTO_ENABLED: - this.$store.state.postwoman.settings.SCROLL_INTO_ENABLED || true, + typeof this.$store.state.postwoman.settings.SCROLL_INTO_ENABLED !== + "undefined" + ? this.$store.state.postwoman.settings.SCROLL_INTO_ENABLED + : true, + THEME_COLOR: "", THEME_TAB_COLOR: "", THEME_COLOR_VIBRANT: true, @@ -360,6 +364,7 @@ export default { this.$store.state.postwoman.settings.PROXY_URL || "https://postwoman.apollotv.xyz/", PROXY_KEY: this.$store.state.postwoman.settings.PROXY_KEY || "", + EXTENSIONS_ENABLED: typeof this.$store.state.postwoman.settings.EXTENSIONS_ENABLED !== "undefined" From 939ffcd42aaf3ffee053ac3205cddb79083d0ddd Mon Sep 17 00:00:00 2001 From: Liyas Thomas Date: Tue, 25 Feb 2020 05:06:40 +0530 Subject: [PATCH 95/97] :white_check_mark: Updating tests --- tests/e2e/integration/proxy.spec.js | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/e2e/integration/proxy.spec.js b/tests/e2e/integration/proxy.spec.js index 63ef53ff5..7aef9db13 100644 --- a/tests/e2e/integration/proxy.spec.js +++ b/tests/e2e/integration/proxy.spec.js @@ -13,6 +13,7 @@ describe('Proxy enabled - external request', () => { it('Enable the proxy and make a request to the real cat api', () => { cy.enableProxy('/?url=https://api.thecatapi.com&path=') .get('#send').click() + .wait(500) .get('#response-details-wrapper').should($wrapper => { expect($wrapper).to.contain('Cat API') }) From 4758acc4137d158e71e04e742bf00400022ce573 Mon Sep 17 00:00:00 2001 From: NBTX Date: Tue, 25 Feb 2020 00:09:56 +0000 Subject: [PATCH 96/97] Improve page load/unload experience (remove FOUCs) --- assets/css/fonts.scss | 4 +++- assets/css/styles.scss | 1 + components/ace-editor.vue | 37 ++++++++++++++++++++++++++---- components/graphql/queryeditor.vue | 35 ++++++++++++++++++++++++---- layouts/default.vue | 4 ++-- 5 files changed, 69 insertions(+), 12 deletions(-) diff --git a/assets/css/fonts.scss b/assets/css/fonts.scss index 0c714f199..ecb70d187 100644 --- a/assets/css/fonts.scss +++ b/assets/css/fonts.scss @@ -6,7 +6,9 @@ font-family: "Material Icons"; font-style: normal; font-weight: 400; - font-display: swap; + // Do not use font-display: swap for the icon font - it looks really bad when the page + // loads. + font-display: block; src: url("~static/fonts/material-icons-v48.woff2") format("woff2"); } diff --git a/assets/css/styles.scss b/assets/css/styles.scss index ef24d4e81..1325f1a5f 100644 --- a/assets/css/styles.scss +++ b/assets/css/styles.scss @@ -190,6 +190,7 @@ nav.primary-nav { color: var(--fg-light-color); fill: var(--fg-light-color); margin: 8px 0; + height: 52px; &:hover { color: var(--fg-color); diff --git a/components/ace-editor.vue b/components/ace-editor.vue index d6f14389a..be1917c08 100644 --- a/components/ace-editor.vue +++ b/components/ace-editor.vue @@ -1,7 +1,23 @@ + + diff --git a/components/graphql/queryeditor.vue b/components/graphql/queryeditor.vue index 56fe6bc35..459b2deee 100644 --- a/components/graphql/queryeditor.vue +++ b/components/graphql/queryeditor.vue @@ -1,7 +1,23 @@ + + diff --git a/layouts/default.vue b/layouts/default.vue index ed40616ed..2ea94e7de 100644 --- a/layouts/default.vue +++ b/layouts/default.vue @@ -298,8 +298,8 @@ > offline_bolt - - + +

      @@ -99,7 +99,7 @@ :color="theme.color" :name="theme.name" class="bg" - > + />
      @@ -110,7 +110,7 @@
      -
    -
      +
    +