This commit is contained in:
Liyas Thomas
2020-06-19 12:26:04 +05:30
parent fcbc738088
commit 1587a44cd7
33 changed files with 63 additions and 77 deletions

View File

@@ -9,7 +9,7 @@
// Do not use font-display: swap for the icon font - it looks really bad when the page // Do not use font-display: swap for the icon font - it looks really bad when the page
// loads. // loads.
font-display: block; font-display: block;
src: url("~static/fonts/material-icons-v48.woff2") format("woff2"); src: url("~static/fonts/material-icons-v52.woff2") format("woff2");
} }
.material-icons { .material-icons {
@@ -40,9 +40,7 @@
font-display: swap; font-display: swap;
src: local("Poppins Medium"), local("Poppins-Medium"), src: local("Poppins Medium"), local("Poppins-Medium"),
url("~static/fonts/poppins-v9-latin-500.woff2") format("woff2"), url("~static/fonts/poppins-v9-latin-500.woff2") format("woff2"),
/* Chrome 26+, Opera 23+, Firefox 39+ */ url("~static/fonts/poppins-v9-latin-500.woff") format("woff");
url("~static/fonts/poppins-v9-latin-500.woff") format("woff");
/* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */
} }
/* poppins-700 - latin */ /* poppins-700 - latin */
@@ -53,9 +51,7 @@
font-display: swap; font-display: swap;
src: local("Poppins Bold"), local("Poppins-Bold"), src: local("Poppins Bold"), local("Poppins-Bold"),
url("~static/fonts/poppins-v9-latin-700.woff2") format("woff2"), url("~static/fonts/poppins-v9-latin-700.woff2") format("woff2"),
/* Chrome 26+, Opera 23+, Firefox 39+ */ url("~static/fonts/poppins-v9-latin-700.woff") format("woff");
url("~static/fonts/poppins-v9-latin-700.woff") format("woff");
/* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */
} }
/* roboto-mono-regular - latin */ /* roboto-mono-regular - latin */
@@ -66,7 +62,5 @@
font-display: swap; font-display: swap;
src: local("Roboto Mono"), local("RobotoMono-Regular"), src: local("Roboto Mono"), local("RobotoMono-Regular"),
url("~static/fonts/roboto-mono-v7-latin-regular.woff2") format("woff2"), url("~static/fonts/roboto-mono-v7-latin-regular.woff2") format("woff2"),
/* Chrome 26+, Opera 23+, Firefox 39+ */ url("~static/fonts/roboto-mono-v7-latin-regular.woff") format("woff");
url("~static/fonts/roboto-mono-v7-latin-regular.woff") format("woff");
/* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */
} }

View File

@@ -389,7 +389,7 @@ button {
// justify-content: center; // justify-content: center;
margin: 4px; margin: 4px;
padding: 6px 16px; padding: 6px 16px;
border-radius: 20px; border-radius: 8px;
background-color: var(--ac-color); background-color: var(--ac-color);
color: var(--act-color); color: var(--act-color);
font-size: 16px; font-size: 16px;
@@ -457,7 +457,7 @@ button {
fieldset { fieldset {
margin: 16px 0; margin: 16px 0;
border-radius: 16px; border-radius: 8px;
background-color: var(--bg-dark-color); background-color: var(--bg-dark-color);
transition: all 0.2s ease-in-out; transition: all 0.2s ease-in-out;
@@ -814,7 +814,7 @@ ol li {
section { section {
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
border-radius: 16px; border-radius: 8px;
} }
.toasted-container .toasted { .toasted-container .toasted {

View File

@@ -7,7 +7,7 @@ import * as querystring from "querystring"
* output this: 'msg1=value1&msg2=value2' * output this: 'msg1=value1&msg2=value2'
* @param dataArguments * @param dataArguments
*/ */
const joinDataArguments = dataArguments => { const joinDataArguments = (dataArguments) => {
let data = "" let data = ""
dataArguments.forEach((argument, i) => { dataArguments.forEach((argument, i) => {
if (i === 0) { if (i === 0) {
@@ -19,7 +19,7 @@ const joinDataArguments = dataArguments => {
return data return data
} }
const parseCurlCommand = curlCommand => { const parseCurlCommand = (curlCommand) => {
let newlineFound = /\r|\n/.exec(curlCommand) let newlineFound = /\r|\n/.exec(curlCommand)
if (newlineFound) { if (newlineFound) {
// remove newlines // remove newlines
@@ -47,7 +47,7 @@ const parseCurlCommand = curlCommand => {
} }
let headers let headers
const parseHeaders = headerFieldName => { const parseHeaders = (headerFieldName) => {
if (parsedArguments[headerFieldName]) { if (parsedArguments[headerFieldName]) {
if (!headers) { if (!headers) {
headers = {} headers = {}
@@ -55,7 +55,7 @@ const parseCurlCommand = curlCommand => {
if (!Array.isArray(parsedArguments[headerFieldName])) { if (!Array.isArray(parsedArguments[headerFieldName])) {
parsedArguments[headerFieldName] = [parsedArguments[headerFieldName]] parsedArguments[headerFieldName] = [parsedArguments[headerFieldName]]
} }
parsedArguments[headerFieldName].forEach(header => { parsedArguments[headerFieldName].forEach((header) => {
if (header.includes("Cookie")) { if (header.includes("Cookie")) {
// stupid javascript tricks: closure // stupid javascript tricks: closure
cookieString = header cookieString = header
@@ -95,7 +95,7 @@ const parseCurlCommand = curlCommand => {
if (!Array.isArray(parsedArguments.F)) { if (!Array.isArray(parsedArguments.F)) {
parsedArguments.F = [parsedArguments.F] parsedArguments.F = [parsedArguments.F]
} }
parsedArguments.F.forEach(multipartArgument => { parsedArguments.F.forEach((multipartArgument) => {
// input looks like key=value. value could be json or a file path prepended with an @ // input looks like key=value. value could be json or a file path prepended with an @
const [key, value] = multipartArgument.split("=", 2) const [key, value] = multipartArgument.split("=", 2)
multipartUploads[key] = value multipartUploads[key] = value
@@ -103,7 +103,7 @@ const parseCurlCommand = curlCommand => {
} }
if (cookieString) { if (cookieString) {
const cookieParseOptions = { const cookieParseOptions = {
decode: s => s, decode: (s) => s,
} }
// separate out cookie headers into separate data structure // separate out cookie headers into separate data structure
// note: cookie is case insensitive // note: cookie is case insensitive

View File

@@ -12,7 +12,7 @@ const redirectUri = `${window.location.origin}/`
const sendPostRequest = async (url, params) => { const sendPostRequest = async (url, params) => {
const body = Object.keys(params) const body = Object.keys(params)
.map(key => `${key}=${params[key]}`) .map((key) => `${key}=${params[key]}`)
.join("&") .join("&")
const options = { const options = {
method: "post", method: "post",
@@ -38,11 +38,11 @@ const sendPostRequest = async (url, params) => {
* @returns {Object} * @returns {Object}
*/ */
const parseQueryString = searchQuery => { const parseQueryString = (searchQuery) => {
if (searchQuery === "") { if (searchQuery === "") {
return {} return {}
} }
const segments = searchQuery.split("&").map(s => s.split("=")) const segments = searchQuery.split("&").map((s) => s.split("="))
const queryString = segments.reduce((obj, el) => ({ ...obj, [el[0]]: el[1] }), {}) const queryString = segments.reduce((obj, el) => ({ ...obj, [el[0]]: el[1] }), {})
return queryString return queryString
} }
@@ -53,7 +53,7 @@ const parseQueryString = searchQuery => {
* @returns {Object} * @returns {Object}
*/ */
const getTokenConfiguration = async endpoint => { const getTokenConfiguration = async (endpoint) => {
const options = { const options = {
method: "GET", method: "GET",
headers: { headers: {
@@ -81,7 +81,7 @@ const getTokenConfiguration = async endpoint => {
const generateRandomString = () => { const generateRandomString = () => {
const array = new Uint32Array(28) const array = new Uint32Array(28)
window.crypto.getRandomValues(array) window.crypto.getRandomValues(array)
return Array.from(array, dec => `0${dec.toString(16)}`.substr(-2)).join("") return Array.from(array, (dec) => `0${dec.toString(16)}`.substr(-2)).join("")
} }
/** /**
@@ -90,7 +90,7 @@ const generateRandomString = () => {
* @returns {Promise<ArrayBuffer>} * @returns {Promise<ArrayBuffer>}
*/ */
const sha256 = plain => { const sha256 = (plain) => {
const encoder = new TextEncoder() const encoder = new TextEncoder()
const data = encoder.encode(plain) const data = encoder.encode(plain)
return window.crypto.subtle.digest("SHA-256", data) return window.crypto.subtle.digest("SHA-256", data)
@@ -121,7 +121,7 @@ const base64urlencode = (
* @returns {String} * @returns {String}
*/ */
const pkceChallengeFromVerifier = async v => { const pkceChallengeFromVerifier = async (v) => {
const hashed = await sha256(v) const hashed = await sha256(v)
return base64urlencode(hashed) return base64urlencode(hashed)
} }

View File

@@ -18,7 +18,7 @@ export default () => {
//*** If the PWA has not been installed, show the install PWA prompt.. ***// //*** If the PWA has not been installed, show the install PWA prompt.. ***//
let deferredPrompt = null let deferredPrompt = null
window.addEventListener("beforeinstallprompt", event => { window.addEventListener("beforeinstallprompt", (event) => {
deferredPrompt = event deferredPrompt = event
// Show the install button if the prompt appeared. // Show the install button if the prompt appeared.
@@ -28,7 +28,7 @@ export default () => {
}) })
// When the app is installed, remove install prompts. // When the app is installed, remove install prompts.
window.addEventListener("appinstalled", event => { window.addEventListener("appinstalled", (event) => {
localStorage.setItem("pwaInstalled", "yes") localStorage.setItem("pwaInstalled", "yes")
pwaInstalled = true pwaInstalled = true
document.getElementById("installPWA").style.display = "none" document.getElementById("installPWA").style.display = "none"

View File

@@ -120,7 +120,7 @@ export default {
this.$store.commit("postwoman/removeCollection", { this.$store.commit("postwoman/removeCollection", {
collectionIndex: this.collectionIndex, collectionIndex: this.collectionIndex,
}) })
this.syncCollections(); this.syncCollections()
}, },
editFolder(collectionIndex, folder, folderIndex) { editFolder(collectionIndex, folder, folderIndex) {
this.$emit("edit-folder", { collectionIndex, folder, folderIndex }) this.$emit("edit-folder", { collectionIndex, folder, folderIndex })

View File

@@ -80,8 +80,8 @@ export default {
collection: collectionUpdated, collection: collectionUpdated,
collectionIndex: this.$props.editingCollectionIndex, collectionIndex: this.$props.editingCollectionIndex,
}) })
this.$emit("hide-modal"); this.$emit("hide-modal")
this.syncCollections(); this.syncCollections()
}, },
hideModal() { hideModal() {
this.$emit("hide-modal") this.$emit("hide-modal")

View File

@@ -71,7 +71,7 @@ export default {
folderIndex: this.$props.folderIndex, folderIndex: this.$props.folderIndex,
}) })
this.hideModal() this.hideModal()
this.syncCollections(); this.syncCollections()
}, },
hideModal() { hideModal() {
this.$emit("hide-modal") this.$emit("hide-modal")

View File

@@ -139,7 +139,7 @@ export default {
}) })
this.hideModal() this.hideModal()
this.syncCollections(); this.syncCollections()
}, },
hideModal() { hideModal() {
this.$emit("hide-modal") this.$emit("hide-modal")

View File

@@ -106,7 +106,7 @@ export default {
collectionIndex: this.collectionIndex, collectionIndex: this.collectionIndex,
folderIndex: this.folderIndex, folderIndex: this.folderIndex,
}) })
this.syncCollections(); this.syncCollections()
}, },
editFolder() { editFolder() {
this.$emit("edit-folder") this.$emit("edit-folder")

View File

@@ -135,7 +135,8 @@ export default {
computed: { computed: {
collections() { collections() {
return fb.currentUser !== null return fb.currentUser !== null
? fb.currentCollections : this.$store.state.postwoman.collections ? fb.currentCollections
: this.$store.state.postwoman.collections
}, },
}, },
async mounted() { async mounted() {

View File

@@ -69,7 +69,7 @@ export default {
folderIndex: this.folderIndex, folderIndex: this.folderIndex,
requestIndex: this.requestIndex, requestIndex: this.requestIndex,
}) })
this.syncCollections(); this.syncCollections()
}, },
}, },
} }

View File

@@ -83,7 +83,8 @@ export default {
computed: { computed: {
environments() { environments() {
return fb.currentUser !== null return fb.currentUser !== null
? fb.currentEnvironments : this.$store.state.postwoman.environments ? fb.currentEnvironments
: this.$store.state.postwoman.environments
}, },
}, },
async mounted() { async mounted() {

View File

@@ -24,7 +24,7 @@ export default {
firebase firebase
.auth() .auth()
.signOut() .signOut()
.catch(err => { .catch((err) => {
self.$toast.show(err.message || err, { self.$toast.show(err.message || err, {
icon: "error", icon: "error",
}) })

View File

@@ -38,7 +38,7 @@
display: inline-block; display: inline-block;
padding: 4px 8px; padding: 4px 8px;
margin: 4px 0; margin: 4px 0;
border-radius: 4px; border-radius: 8px;
font-size: 14px; font-size: 14px;
font-weight: 700; font-weight: 700;
} }

View File

@@ -113,14 +113,11 @@
</svg> </svg>
<span>{{ $t("tweet") }}</span> <span>{{ $t("tweet") }}</span>
</button> </button>
<button </div>
v-if="navigatorShare" <div v-if="navigatorShare">
class="icon" <button class="icon" @click="nativeShare" v-close-popover v-tooltip="$t('more')">
@click="nativeShare"
v-close-popover
v-tooltip="$t('more')"
>
<i class="material-icons">share</i> <i class="material-icons">share</i>
<span>Share</span>
</button> </button>
</div> </div>
</template> </template>

View File

@@ -5,7 +5,7 @@
x="0px" x="0px"
y="0px" y="0px"
viewBox="0 0 612.001 612.001" viewBox="0 0 612.001 612.001"
style="enable-background:new 0 0 612.001 612.001;" style="enable-background: new 0 0 612.001 612.001;"
xml:space="preserve" xml:space="preserve"
> >
<defs id="defs11" /> <defs id="defs11" />
@@ -13,7 +13,7 @@
<circle <circle
:fill="color" :fill="color"
transform="scale(1,-1)" transform="scale(1,-1)"
style="stroke-width:1.19531453" style="stroke-width: 1.19531453;"
r="178.70923" r="178.70923"
cy="-501.55591" cy="-501.55591"
cx="822.40845" cx="822.40845"

View File

@@ -47,8 +47,8 @@ export default {
methods: { methods: {
getSourcePrefix, getSourcePrefix,
}, },
updated: function() { updated: function () {
this.$nextTick(function() { this.$nextTick(function () {
if (this.$refs.log) { if (this.$refs.log) {
this.$refs.log.scrollBy(0, this.$refs.log.scrollHeight + 100) this.$refs.log.scrollBy(0, this.$refs.log.scrollHeight + 100)
} }

View File

@@ -77,7 +77,7 @@ export default {
"pw-section": () => import("../../components/layout/section"), "pw-section": () => import("../../components/layout/section"),
realtimeLog: () => import("./log"), realtimeLog: () => import("./log"),
}, },
data: function() { data: function () {
return { return {
url: "wss://test.mosquitto.org:8081", url: "wss://test.mosquitto.org:8081",
client: null, client: null,

View File

@@ -120,7 +120,7 @@ export default {
return this.$store.state.postwoman.settings.THEME_ACE_EDITOR || DEFAULT_THEME return this.$store.state.postwoman.settings.THEME_ACE_EDITOR || DEFAULT_THEME
}, },
provideLinting: debounce(function(code) { provideLinting: debounce(function (code) {
if (this.lang === "json") { if (this.lang === "json") {
try { try {
jsonParse(code) jsonParse(code)

View File

@@ -194,14 +194,14 @@ export default {
return ( return (
this.source this.source
.filter(entry => { .filter((entry) => {
return ( return (
entry.toLowerCase().startsWith(input.toLowerCase()) && entry.toLowerCase().startsWith(input.toLowerCase()) &&
input.toLowerCase() !== entry.toLowerCase() input.toLowerCase() !== entry.toLowerCase()
) )
}) })
// Cut off the part that's already been typed. // Cut off the part that's already been typed.
.map(entry => entry.substring(this.selectionStart)) .map((entry) => entry.substring(this.selectionStart))
// We only want the top 6 suggestions. // We only want the top 6 suggestions.
.slice(0, 6) .slice(0, 6)
) )

View File

@@ -50,7 +50,7 @@
padding: 16px; padding: 16px;
transition: all 0.2s ease; transition: all 0.2s ease;
background-color: var(--bg-color); background-color: var(--bg-color);
border-radius: 16px; border-radius: 8px;
box-shadow: 0px 16px 70px rgba(0, 0, 0, 0.5); box-shadow: 0px 16px 70px rgba(0, 0, 0, 0.5);
max-height: calc(100vh - 128px); max-height: calc(100vh - 128px);
max-width: 720px; max-width: 720px;

View File

@@ -2,7 +2,7 @@
<div class="tabs-wrapper"> <div class="tabs-wrapper">
<div class="tabs"> <div class="tabs">
<ul> <ul>
<li v-for="tab in tabs" :class="{ 'is-active': tab.isActive }"> <li v-for="(tab, index) in tabs" :class="{ 'is-active': tab.isActive }" :key="index">
<a :href="tab.href" @click="selectTab(tab)"> <a :href="tab.href" @click="selectTab(tab)">
<i v-if="tab.icon" class="material-icons"> <i v-if="tab.icon" class="material-icons">
{{ tab.icon }} {{ tab.icon }}
@@ -45,7 +45,7 @@
justify-content: center; justify-content: center;
padding: 8px 16px; padding: 8px 16px;
color: var(--fg-light-color); color: var(--fg-light-color);
border-radius: 4px; border-radius: 8px;
cursor: pointer; cursor: pointer;
.material-icons { .material-icons {
@@ -87,7 +87,7 @@ export default {
methods: { methods: {
selectTab({ id }) { selectTab({ id }) {
this.tabs.forEach(tab => { this.tabs.forEach((tab) => {
tab.isActive = tab.id == id tab.isActive = tab.id == id
}) })
}, },

View File

@@ -31,7 +31,7 @@ export default function runTestScriptWithVariables(script, variables) {
// run pre-request script within this function so that it has access to the pw object. // run pre-request script within this function so that it has access to the pw object.
new Function("pw", script)(pw) new Function("pw", script)(pw)
// //
const testReports = pw._testReports.map(item => { const testReports = pw._testReports.map((item) => {
if (item.result) { if (item.result) {
item.styles = styles[item.result] item.styles = styles[item.result]
} else { } else {
@@ -64,7 +64,7 @@ class Expectation {
this.expectValue = expectValue this.expectValue = expectValue
this.not = _not || new Expectation(this.expectValue, true, _testReports) this.not = _not || new Expectation(this.expectValue, true, _testReports)
this._testReports = _testReports // this values is used within Test.it, which wraps Expectation and passes _testReports value. this._testReports = _testReports // this values is used within Test.it, which wraps Expectation and passes _testReports value.
this._satisfies = function(expectValue, targetValue) { this._satisfies = function (expectValue, targetValue) {
// Used for testing if two values match the expectation, which could be === OR !==, depending on if not // Used for testing if two values match the expectation, which could be === OR !==, depending on if not
// was used. Expectation#_satisfies prevents the need to have an if(this.not) branch in every test method. // was used. Expectation#_satisfies prevents the need to have an if(this.not) branch in every test method.
// Signature is _satisfies([expectValue,] targetValue): if only one argument is given, it is assumed the targetValue, and expectValue is set to this.expectValue // Signature is _satisfies([expectValue,] targetValue): if only one argument is given, it is assumed the targetValue, and expectValue is set to this.expectValue

View File

@@ -4,7 +4,7 @@
// NOTE : Don't use lambda functions as this doesn't get bound properly in them, use the 'function (args) {}' format // NOTE : Don't use lambda functions as this doesn't get bound properly in them, use the 'function (args) {}' format
const debounce = (func, delay) => { const debounce = (func, delay) => {
let inDebounce let inDebounce
return function() { return function () {
const context = this const context = this
const args = arguments const args = arguments
clearTimeout(inDebounce) clearTimeout(inDebounce)

View File

@@ -1,4 +1,4 @@
export default function({ route, redirect }) { export default function ({ route, redirect }) {
if (route.fullPath !== "/") { if (route.fullPath !== "/") {
return redirect("/") return redirect("/")
} }

Binary file not shown.

View File

@@ -9,7 +9,7 @@ export default {
setCollapsedSection({ theme }, value) { setCollapsedSection({ theme }, value) {
theme.collapsedSections.includes(value) theme.collapsedSections.includes(value)
? (theme.collapsedSections = theme.collapsedSections.filter(section => section !== value)) ? (theme.collapsedSections = theme.collapsedSections.filter((section) => section !== value))
: theme.collapsedSections.push(value) : theme.collapsedSections.push(value)
}, },

View File

@@ -1,7 +1,5 @@
describe("Visit Home", () => { describe("Visit Home", () => {
it('Have a page title with "Postwoman"', () => { it('Have a page title with "Postwoman"', () => {
cy.visit("/", { retryOnStatusCodeFailure: true }) cy.visit("/", { retryOnStatusCodeFailure: true }).get("title").should("contain", "Postwoman")
.get("title")
.should("contain", "Postwoman")
}) })
}) })

View File

@@ -3,13 +3,13 @@ describe("Authentication", () => {
cy.visit(`?&auth=Basic Auth&httpUser=foo&httpPassword=bar`, { retryOnStatusCodeFailure: true }) cy.visit(`?&auth=Basic Auth&httpUser=foo&httpPassword=bar`, { retryOnStatusCodeFailure: true })
.get('input[name="http_basic_user"]', { timeout: 500 }) .get('input[name="http_basic_user"]', { timeout: 500 })
.invoke("val") .invoke("val")
.then(user => { .then((user) => {
expect(user === "foo").to.equal(true) expect(user === "foo").to.equal(true)
}) })
.get('input[name="http_basic_passwd"]') .get('input[name="http_basic_passwd"]')
.invoke("val") .invoke("val")
.then(pass => { .then((pass) => {
expect(pass === "bar").to.equal(true) expect(pass === "bar").to.equal(true)
}) })
}) })

View File

@@ -18,7 +18,7 @@ describe("Proxy enabled - external request", () => {
.click() .click()
.get("#response-details-wrapper", { timeout: 24000 }) .get("#response-details-wrapper", { timeout: 24000 })
.should("be.visible") .should("be.visible")
.should($wrapper => { .should(($wrapper) => {
expect($wrapper).to.contain("Hello World") expect($wrapper).to.contain("Hello World")
}) })
}) })

View File

@@ -6,14 +6,9 @@
* @param { String } method The fake request method * @param { String } method The fake request method
*/ */
Cypress.Commands.add("seedAndVisit", (seedData, path = "/", method = "GET") => { Cypress.Commands.add("seedAndVisit", (seedData, path = "/", method = "GET") => {
cy.server() cy.server().route(method, "https://api.thecatapi.com/", `fixture:${seedData}`).as("load")
.route(method, "https://api.thecatapi.com/", `fixture:${seedData}`)
.as("load")
cy.visit(path) cy.visit(path).get("#send").click().wait("@load")
.get("#send")
.click()
.wait("@load")
}) })
/** /**
@@ -21,7 +16,7 @@ Cypress.Commands.add("seedAndVisit", (seedData, path = "/", method = "GET") => {
* This function will enable the proxy and navigate back to a given path * This function will enable the proxy and navigate back to a given path
* @param { String } goBackPath The page go back * @param { String } goBackPath The page go back
*/ */
Cypress.Commands.add("enableProxy", goBackPath => { Cypress.Commands.add("enableProxy", (goBackPath) => {
cy.visit("/settings") cy.visit("/settings")
.get("#proxy") .get("#proxy")
.find(".toggle") .find(".toggle")