Commit code with double quotes instead of single quotes

This commit is contained in:
Dmitry Yankowski
2020-02-24 21:06:23 -05:00
parent 3bd7c00038
commit 48100ead55
74 changed files with 3184 additions and 3184 deletions

View File

@@ -1,11 +1,11 @@
const mimeToMode = {
'text/plain': 'plain_text',
'text/html': 'html',
'application/xml': 'xml',
'application/hal+json': 'json',
'application/json': 'json',
"text/plain": "plain_text",
"text/html": "html",
"application/xml": "xml",
"application/hal+json": "json",
"application/json": "json",
}
export function getEditorLangForMimeType(mimeType) {
return mimeToMode[mimeType] || 'plain_text'
return mimeToMode[mimeType] || "plain_text"
}

View File

@@ -1,22 +1,22 @@
import firebase from 'firebase/app'
import 'firebase/firestore'
import 'firebase/auth'
import firebase from "firebase/app"
import "firebase/firestore"
import "firebase/auth"
// Initialize Firebase, copied from cloud console
const firebaseConfig = {
apiKey: 'AIzaSyCMsFreESs58-hRxTtiqQrIcimh4i1wbsM',
authDomain: 'postwoman-api.firebaseapp.com',
databaseURL: 'https://postwoman-api.firebaseio.com',
projectId: 'postwoman-api',
storageBucket: 'postwoman-api.appspot.com',
messagingSenderId: '421993993223',
appId: '1:421993993223:web:ec0baa8ee8c02ffa1fc6a2',
measurementId: 'G-ERJ6025CEB',
apiKey: "AIzaSyCMsFreESs58-hRxTtiqQrIcimh4i1wbsM",
authDomain: "postwoman-api.firebaseapp.com",
databaseURL: "https://postwoman-api.firebaseio.com",
projectId: "postwoman-api",
storageBucket: "postwoman-api.appspot.com",
messagingSenderId: "421993993223",
appId: "1:421993993223:web:ec0baa8ee8c02ffa1fc6a2",
measurementId: "G-ERJ6025CEB",
}
firebase.initializeApp(firebaseConfig)
// a reference to the users collection
const usersCollection = firebase.firestore().collection('users')
const usersCollection = firebase.firestore().collection("users")
// the shared state object that any vue component
// can get access to
@@ -38,17 +38,17 @@ export const fb = {
}
usersCollection
.doc(fb.currentUser.uid)
.collection('feeds')
.collection("feeds")
.add(dt)
.catch(e => console.error('error inserting', dt, e))
.catch(e => console.error("error inserting", dt, e))
},
deleteFeed: id => {
usersCollection
.doc(fb.currentUser.uid)
.collection('feeds')
.collection("feeds")
.doc(id)
.delete()
.catch(e => console.error('error deleting', id, e))
.catch(e => console.error("error deleting", id, e))
},
writeSettings: async (setting, value) => {
const st = {
@@ -61,31 +61,31 @@ export const fb = {
}
usersCollection
.doc(fb.currentUser.uid)
.collection('settings')
.collection("settings")
.doc(setting)
.set(st)
.catch(e => console.error('error updating', st, e))
.catch(e => console.error("error updating", st, e))
},
writeHistory: async entry => {
const hs = entry
usersCollection
.doc(fb.currentUser.uid)
.collection('history')
.collection("history")
.add(hs)
.catch(e => console.error('error inserting', hs, e))
.catch(e => console.error("error inserting", hs, e))
},
deleteHistory: entry => {
usersCollection
.doc(fb.currentUser.uid)
.collection('history')
.collection("history")
.doc(entry.id)
.delete()
.catch(e => console.error('error deleting', entry, e))
.catch(e => console.error("error deleting", entry, e))
},
clearHistory: () => {
usersCollection
.doc(fb.currentUser.uid)
.collection('history')
.collection("history")
.get()
.then(({ docs }) => {
docs.forEach(e => fb.deleteHistory(e))
@@ -94,10 +94,10 @@ export const fb = {
toggleStar: (entry, value) => {
usersCollection
.doc(fb.currentUser.uid)
.collection('history')
.collection("history")
.doc(entry.id)
.update({ star: value })
.catch(e => console.error('error deleting', entry, e))
.catch(e => console.error("error deleting", entry, e))
},
writeCollections: async collection => {
const cl = {
@@ -109,10 +109,10 @@ export const fb = {
}
usersCollection
.doc(fb.currentUser.uid)
.collection('collections')
.doc('sync')
.collection("collections")
.doc("sync")
.set(cl)
.catch(e => console.error('error updating', cl, e))
.catch(e => console.error("error updating", cl, e))
},
writeEnvironments: async environment => {
const ev = {
@@ -124,10 +124,10 @@ export const fb = {
}
usersCollection
.doc(fb.currentUser.uid)
.collection('environments')
.doc('sync')
.collection("environments")
.doc("sync")
.set(ev)
.catch(e => console.error('error updating', ev, e))
.catch(e => console.error("error updating", ev, e))
},
}
@@ -147,13 +147,13 @@ firebase.auth().onAuthStateChanged(user => {
usersCollection
.doc(fb.currentUser.uid)
.set(us)
.catch(e => console.error('error updating', us, e))
.catch(e => console.error("error updating", us, e))
})
usersCollection
.doc(fb.currentUser.uid)
.collection('feeds')
.orderBy('createdOn', 'desc')
.collection("feeds")
.orderBy("createdOn", "desc")
.onSnapshot(feedsRef => {
const feeds = []
feedsRef.forEach(doc => {
@@ -166,7 +166,7 @@ firebase.auth().onAuthStateChanged(user => {
usersCollection
.doc(fb.currentUser.uid)
.collection('settings')
.collection("settings")
.onSnapshot(settingsRef => {
const settings = []
settingsRef.forEach(doc => {
@@ -179,7 +179,7 @@ firebase.auth().onAuthStateChanged(user => {
usersCollection
.doc(fb.currentUser.uid)
.collection('history')
.collection("history")
.onSnapshot(historyRef => {
const history = []
historyRef.forEach(doc => {
@@ -192,7 +192,7 @@ firebase.auth().onAuthStateChanged(user => {
usersCollection
.doc(fb.currentUser.uid)
.collection('collections')
.collection("collections")
.onSnapshot(collectionsRef => {
const collections = []
collectionsRef.forEach(doc => {
@@ -205,7 +205,7 @@ firebase.auth().onAuthStateChanged(user => {
usersCollection
.doc(fb.currentUser.uid)
.collection('environments')
.collection("environments")
.onSnapshot(environmentsRef => {
const environments = []
environmentsRef.forEach(doc => {

View File

@@ -1,124 +1,124 @@
export const commonHeaders = [
'WWW-Authenticate',
'Authorization',
'Proxy-Authenticate',
'Proxy-Authorization',
'Age',
'Cache-Control',
'Clear-Site-Data',
'Expires',
'Pragma',
'Warning',
'Accept-CH',
'Accept-CH-Lifetime',
'Early-Data',
'Content-DPR',
'DPR',
'Device-Memory',
'Save-Data',
'Viewport-Width',
'Width',
'Last-Modified',
'ETag',
'If-Match',
'If-None-Match',
'If-Modified-Since',
'If-Unmodified-Since',
'Vary',
'Connection',
'Keep-Alive',
'Accept',
'Accept-Charset',
'Accept-Encoding',
'Accept-Language',
'Expect',
'Max-Forwards',
'Cookie',
'Set-Cookie',
'Cookie2',
'Set-Cookie2',
'Access-Control-Allow-Origin',
'Access-Control-Allow-Credentials',
'Access-Control-Allow-Headers',
'Access-Control-Allow-Methods',
'Access-Control-Expose-Headers',
'Access-Control-Max-Age',
'Access-Control-Request-Headers',
'Access-Control-Request-Method',
'Origin',
'Service-Worker-Allowed',
'Timing-Allow-Origin',
'X-Permitted-Cross-Domain-Policies',
'DNT',
'Tk',
'Content-Disposition',
'Content-Length',
'Content-Type',
'Content-Encoding',
'Content-Language',
'Content-Location',
'Forwarded',
'X-Forwarded-For',
'X-Forwarded-Host',
'X-Forwarded-Proto',
'Via',
'Location',
'From',
'Host',
'Referer',
'Referrer-Policy',
'User-Agent',
'Allow',
'Server',
'Accept-Ranges',
'Range',
'If-Range',
'Content-Range',
'Cross-Origin-Opener-Policy',
'Cross-Origin-Resource-Policy',
'Content-Security-Policy',
'Content-Security-Policy-Report-Only',
'Expect-CT',
'Feature-Policy',
'Public-Key-Pins',
'Public-Key-Pins-Report-Only',
'Strict-Transport-Security',
'Upgrade-Insecure-Requests',
'X-Content-Type-Options',
'X-Download-Options',
'X-Frame-Options',
'X-Powered-By',
'X-XSS-Protection',
'Last-Event-ID',
'NEL',
'Ping-From',
'Ping-To',
'Report-To',
'Transfer-Encoding',
'TE',
'Trailer',
'Sec-WebSocket-Key',
'Sec-WebSocket-Extensions',
'Sec-WebSocket-Accept',
'Sec-WebSocket-Protocol',
'Sec-WebSocket-Version',
'Accept-Push-Policy',
'Accept-Signature',
'Alt-Svc',
'Date',
'Large-Allocation',
'Link',
'Push-Policy',
'Retry-After',
'Signature',
'Signed-Headers',
'Server-Timing',
'SourceMap',
'Upgrade',
'X-DNS-Prefetch-Control',
'X-Firefox-Spdy',
'X-Pingback',
'X-Requested-With',
'X-Robots-Tag',
'X-UA-Compatible',
"WWW-Authenticate",
"Authorization",
"Proxy-Authenticate",
"Proxy-Authorization",
"Age",
"Cache-Control",
"Clear-Site-Data",
"Expires",
"Pragma",
"Warning",
"Accept-CH",
"Accept-CH-Lifetime",
"Early-Data",
"Content-DPR",
"DPR",
"Device-Memory",
"Save-Data",
"Viewport-Width",
"Width",
"Last-Modified",
"ETag",
"If-Match",
"If-None-Match",
"If-Modified-Since",
"If-Unmodified-Since",
"Vary",
"Connection",
"Keep-Alive",
"Accept",
"Accept-Charset",
"Accept-Encoding",
"Accept-Language",
"Expect",
"Max-Forwards",
"Cookie",
"Set-Cookie",
"Cookie2",
"Set-Cookie2",
"Access-Control-Allow-Origin",
"Access-Control-Allow-Credentials",
"Access-Control-Allow-Headers",
"Access-Control-Allow-Methods",
"Access-Control-Expose-Headers",
"Access-Control-Max-Age",
"Access-Control-Request-Headers",
"Access-Control-Request-Method",
"Origin",
"Service-Worker-Allowed",
"Timing-Allow-Origin",
"X-Permitted-Cross-Domain-Policies",
"DNT",
"Tk",
"Content-Disposition",
"Content-Length",
"Content-Type",
"Content-Encoding",
"Content-Language",
"Content-Location",
"Forwarded",
"X-Forwarded-For",
"X-Forwarded-Host",
"X-Forwarded-Proto",
"Via",
"Location",
"From",
"Host",
"Referer",
"Referrer-Policy",
"User-Agent",
"Allow",
"Server",
"Accept-Ranges",
"Range",
"If-Range",
"Content-Range",
"Cross-Origin-Opener-Policy",
"Cross-Origin-Resource-Policy",
"Content-Security-Policy",
"Content-Security-Policy-Report-Only",
"Expect-CT",
"Feature-Policy",
"Public-Key-Pins",
"Public-Key-Pins-Report-Only",
"Strict-Transport-Security",
"Upgrade-Insecure-Requests",
"X-Content-Type-Options",
"X-Download-Options",
"X-Frame-Options",
"X-Powered-By",
"X-XSS-Protection",
"Last-Event-ID",
"NEL",
"Ping-From",
"Ping-To",
"Report-To",
"Transfer-Encoding",
"TE",
"Trailer",
"Sec-WebSocket-Key",
"Sec-WebSocket-Extensions",
"Sec-WebSocket-Accept",
"Sec-WebSocket-Protocol",
"Sec-WebSocket-Version",
"Accept-Push-Policy",
"Accept-Signature",
"Alt-Svc",
"Date",
"Large-Allocation",
"Link",
"Push-Policy",
"Retry-After",
"Signature",
"Signed-Headers",
"Server-Timing",
"SourceMap",
"Upgrade",
"X-DNS-Prefetch-Control",
"X-Firefox-Spdy",
"X-Pingback",
"X-Requested-With",
"X-Robots-Tag",
"X-UA-Compatible",
]

View File

@@ -1,10 +1,10 @@
import AxiosStrategy from './strategies/AxiosStrategy'
import ExtensionStrategy, { hasExtensionInstalled } from './strategies/ExtensionStrategy'
import FirefoxStrategy from './strategies/FirefoxStrategy'
import ChromeStrategy, { hasChromeExtensionInstalled } from './strategies/ChromeStrategy'
import AxiosStrategy from "./strategies/AxiosStrategy"
import ExtensionStrategy, { hasExtensionInstalled } from "./strategies/ExtensionStrategy"
import FirefoxStrategy from "./strategies/FirefoxStrategy"
import ChromeStrategy, { hasChromeExtensionInstalled } from "./strategies/ChromeStrategy"
const isExtensionsAllowed = ({ state }) =>
typeof state.postwoman.settings.EXTENSIONS_ENABLED === 'undefined' ||
typeof state.postwoman.settings.EXTENSIONS_ENABLED === "undefined" ||
state.postwoman.settings.EXTENSIONS_ENABLED
const runAppropriateStrategy = (req, store) => {

View File

@@ -1,12 +1,12 @@
const PASS = 'PASS'
const FAIL = 'FAIL'
const ERROR = 'ERROR'
const PASS = "PASS"
const FAIL = "FAIL"
const ERROR = "ERROR"
const styles = {
[PASS]: { icon: 'check', class: 'success-response' },
[FAIL]: { icon: 'close', class: 'cl-error-response' },
[ERROR]: { icon: 'close', class: 'cl-error-response' },
none: { icon: '', class: '' },
[PASS]: { icon: "check", class: "success-response" },
[FAIL]: { icon: "close", class: "cl-error-response" },
[ERROR]: { icon: "close", class: "cl-error-response" },
none: { icon: "", class: "" },
}
// TODO: probably have to use a more global state for `test`
@@ -15,7 +15,7 @@ export default function runTestScriptWithVariables(script, variables) {
let pw = {
_errors: [],
_testReports: [],
_report: '',
_report: "",
expect(value) {
try {
return expect(value, this._testReports)
@@ -29,7 +29,7 @@ export default function runTestScriptWithVariables(script, variables) {
Object.assign(pw, variables)
// 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 => {
if (item.result) {
@@ -83,9 +83,9 @@ class Expectation {
_fmtNot(message) {
// given a string with "(not)" in it, replaces with "not" or "", depending if the expectation is expecting the positive or inverse (this._not)
if (this.not === true) {
return message.replace('(not)', 'not ')
return message.replace("(not)", "not ")
} else {
return message.replace('(not)', '')
return message.replace("(not)", "")
}
}
_fail(message) {

View File

@@ -14,7 +14,7 @@ export default function getEnvironmentVariablesFromScript(script) {
}
// 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)
return _variables
}

View File

@@ -1,8 +1,8 @@
import axios from 'axios'
import axios from "axios"
const axiosWithProxy = async (req, { state }) => {
const { data } = await axios.post(
state.postwoman.settings.PROXY_URL || 'https://postwoman.apollotv.xyz/',
state.postwoman.settings.PROXY_URL || "https://postwoman.apollotv.xyz/",
req
)
return data

View File

@@ -1,17 +1,17 @@
const EXTENSION_ID = 'amknoiejhlmhancpahfcfcfhllgkpbld'
const EXTENSION_ID = "amknoiejhlmhancpahfcfcfhllgkpbld"
// Check if the Chrome Extension is present
// The Chrome extension injects an empty span to help detection.
// Also check for the presence of window.chrome object to confirm smooth operations
export const hasChromeExtensionInstalled = () =>
document.getElementById('chromePWExtensionDetect') !== null
document.getElementById("chromePWExtensionDetect") !== null
const chromeWithoutProxy = (req, _store) =>
new Promise((resolve, reject) => {
chrome.runtime.sendMessage(
EXTENSION_ID,
{
messageType: 'send-req',
messageType: "send-req",
data: {
config: req,
},
@@ -31,11 +31,11 @@ const chromeWithProxy = (req, { state }) =>
chrome.runtime.sendMessage(
EXTENSION_ID,
{
messageType: 'send-req',
messageType: "send-req",
data: {
config: {
method: 'post',
url: state.postwoman.settings.PROXY_URL || 'https://postwoman.apollotv.xyz/',
method: "post",
url: state.postwoman.settings.PROXY_URL || "https://postwoman.apollotv.xyz/",
data: req,
},
},

View File

@@ -1,10 +1,10 @@
export const hasExtensionInstalled = () =>
typeof window.__POSTWOMAN_EXTENSION_HOOK__ !== 'undefined'
typeof window.__POSTWOMAN_EXTENSION_HOOK__ !== "undefined"
const extensionWithProxy = async (req, { state }) => {
const { data } = await window.__POSTWOMAN_EXTENSION_HOOK__.sendRequest({
method: 'post',
url: state.postwoman.settings.PROXY_URL || 'https://postwoman.apollotv.xyz/',
method: "post",
url: state.postwoman.settings.PROXY_URL || "https://postwoman.apollotv.xyz/",
data: req,
})
return data

View File

@@ -1,7 +1,7 @@
const firefoxWithProxy = (req, { state }) =>
new Promise((resolve, reject) => {
const eventListener = event => {
window.removeEventListener('firefoxExtSendRequestComplete', event)
window.removeEventListener("firefoxExtSendRequestComplete", event)
if (event.detail.error) {
reject(JSON.parse(event.detail.error))
@@ -10,11 +10,11 @@ const firefoxWithProxy = (req, { state }) =>
}
}
window.addEventListener('firefoxExtSendRequestComplete', eventListener)
window.addEventListener("firefoxExtSendRequestComplete", eventListener)
window.firefoxExtSendRequest({
method: 'post',
url: state.postwoman.settings.PROXY_URL || 'https://postwoman.apollotv.xyz/',
method: "post",
url: state.postwoman.settings.PROXY_URL || "https://postwoman.apollotv.xyz/",
data: req,
})
})
@@ -22,7 +22,7 @@ const firefoxWithProxy = (req, { state }) =>
const firefoxWithoutProxy = (req, _store) =>
new Promise((resolve, reject) => {
const eventListener = ({ detail }) => {
window.removeEventListener('firefoxExtSendRequestComplete', eventListener)
window.removeEventListener("firefoxExtSendRequestComplete", eventListener)
if (detail.error) {
reject(JSON.parse(detail.error))
@@ -31,7 +31,7 @@ const firefoxWithoutProxy = (req, _store) =>
}
}
window.addEventListener('firefoxExtSendRequestComplete', eventListener)
window.addEventListener("firefoxExtSendRequestComplete", eventListener)
window.firefoxExtSendRequest(req)
})

View File

@@ -3,5 +3,5 @@ export default function parseTemplateString(string, variables) {
return string
}
const searchTerm = /<<([^>]*)>>/g // "<<myVariable>>"
return string.replace(searchTerm, (match, p1) => variables[p1] || '')
return string.replace(searchTerm, (match, p1) => variables[p1] || "")
}