🚨 Lint

This commit is contained in:
Liyas Thomas
2019-11-26 20:01:48 +05:30
parent 1aa5ec6aa4
commit c4c320da83
7 changed files with 71 additions and 50 deletions

View File

@@ -157,9 +157,10 @@ _Collections are synced with local session storage_
**Features:** **Features:**
- Hide your IP address - Hide your IP address
- Fixes [CORS](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS) (Cross Origin Resource Sharing) issues - Fixes [CORS](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS) (Cross Origin Resource Sharing) issues
- Access APIs served in non-HTTPS (`http://`, `localhost`, etc.) - Access APIs served in non-HTTPS (`http://`)
- Use custom Proxy URL
_Proxy is hosted by ApolloTV - [Privacy policy](https://apollotv.xyz/legal)_ _Official Postwoman Proxy is hosted by ApolloTV - [Privacy policy](https://apollotv.xyz/legal)_
📜 **Pre-Request Scripts**: Snippets of code associated with a request that are executed before the request is sent. 📜 **Pre-Request Scripts**: Snippets of code associated with a request that are executed before the request is sent.

View File

@@ -45,7 +45,8 @@
folderIndex, folderIndex,
requestIndex: index requestIndex: index
}) })
"/> "
/>
</li> </li>
<li v-if="folder.requests.length === 0"> <li v-if="folder.requests.length === 0">
<label>Folder is empty</label> <label>Folder is empty</label>

View File

@@ -236,23 +236,23 @@
<div class="flex-wrap" v-else> <div class="flex-wrap" v-else>
<label for="clear-history-button">Are you sure?</label> <label for="clear-history-button">Are you sure?</label>
<div> <div>
<button <button
class="icon" class="icon"
id="confirm-clear-history-button" id="confirm-clear-history-button"
@click="clearHistory" @click="clearHistory"
v-tooltip="'Yes'" v-tooltip="'Yes'"
> >
<i class="material-icons">done</i> <i class="material-icons">done</i>
</button> </button>
<button <button
class="icon" class="icon"
id="reject-clear-history-button" id="reject-clear-history-button"
@click="disableHistoryClearing" @click="disableHistoryClearing"
v-tooltip="'No'" v-tooltip="'No'"
> >
<i class="material-icons">close</i> <i class="material-icons">close</i>
</button> </button>
</div> </div>
</div> </div>
</div> </div>
</pw-section> </pw-section>

View File

@@ -86,7 +86,7 @@
@click="removeRequestHeader(index)" @click="removeRequestHeader(index)"
id="header" id="header"
> >
<i class="material-icons">delete</i> <i class="material-icons">delete</i>
</button> </button>
</li> </li>
</div> </div>
@@ -232,7 +232,7 @@
<script> <script>
import axios from "axios"; import axios from "axios";
import * as gql from "graphql"; import * as gql from "graphql";
import textareaAutoHeight from '../directives/textareaAutoHeight'; import textareaAutoHeight from "../directives/textareaAutoHeight";
import AceEditor from "../components/ace-editor"; import AceEditor from "../components/ace-editor";
export default { export default {
@@ -310,13 +310,12 @@ export default {
this.$nuxt.$loading.start(); this.$nuxt.$loading.start();
try { try {
const query = JSON.stringify({ const query = JSON.stringify({
query: gql.getIntrospectionQuery() query: gql.getIntrospectionQuery()
}); });
let headers = {}; let headers = {};
this.headers.forEach((header) => { this.headers.forEach(header => {
headers[header.key] = header.value; headers[header.key] = header.value;
}); });
@@ -328,19 +327,20 @@ export default {
"content-type": "application/json" "content-type": "application/json"
}, },
data: query data: query
} };
console.log(reqOptions); // console.log(reqOptions);
const reqConfig = this.$store.state.postwoman.settings.PROXY_ENABLED const reqConfig = this.$store.state.postwoman.settings.PROXY_ENABLED
? { ? {
method: "post", method: "post",
url: `https://postwoman.apollotv.xyz/`, url:
data: reqOptions this.$store.state.postwoman.settings.PROXY_URL ||
} `https://postwoman.apollotv.xyz/`,
data: reqOptions
}
: reqOptions; : reqOptions;
const res = await axios(reqConfig); const res = await axios(reqConfig);
const data = this.$store.state.postwoman.settings.PROXY_ENABLED const data = this.$store.state.postwoman.settings.PROXY_ENABLED
@@ -421,20 +421,19 @@ export default {
}, },
ToggleExpandResponse() { ToggleExpandResponse() {
this.expandResponse = !this.expandResponse; this.expandResponse = !this.expandResponse;
this.responseBodyMaxLines = (this.responseBodyMaxLines == Infinity) ? 16 : Infinity; this.responseBodyMaxLines =
this.responseBodyMaxLines == Infinity ? 16 : Infinity;
}, },
downloadResponse() { downloadResponse() {
const dataToWrite = JSON.stringify(this.schemaString, null, 2) const dataToWrite = JSON.stringify(this.schemaString, null, 2);
const file = new Blob([dataToWrite], { type: "application/json" }); const file = new Blob([dataToWrite], { type: "application/json" });
const a = document.createElement("a"), const a = document.createElement("a"),
url = URL.createObjectURL(file); url = URL.createObjectURL(file);
a.href = url; a.href = url;
a.download = ( a.download = (this.url + " on " + Date() + ".graphql").replace(
this.url + /\./g,
" on " + "[dot]"
Date() + );
".graphql"
).replace(/\./g, "[dot]");
document.body.appendChild(a); document.body.appendChild(a);
a.click(); a.click();
this.$refs.downloadResponse.innerHTML = this.doneButton; this.$refs.downloadResponse.innerHTML = this.doneButton;

View File

@@ -599,7 +599,9 @@
: 'Collapse response' : 'Collapse response'
}" }"
> >
<i class="material-icons" v-if="!expandResponse">unfold_more</i> <i class="material-icons" v-if="!expandResponse"
>unfold_more</i
>
<i class="material-icons" v-else>unfold_less</i> <i class="material-icons" v-else>unfold_less</i>
</button> </button>
<button <button
@@ -1231,7 +1233,7 @@ export default {
); );
} }
if (this.headers) { if (this.headers) {
this.headers.forEach((element) => { this.headers.forEach(element => {
requestString.push( requestString.push(
"xhr.setRequestHeader('" + "xhr.setRequestHeader('" +
element.key + element.key +
@@ -1288,7 +1290,7 @@ export default {
); );
} }
if (this.headers) { if (this.headers) {
this.headers.forEach((element) => { this.headers.forEach(element => {
headers.push( headers.push(
' "' + element.key + '": "' + element.value + '",\n' ' "' + element.key + '": "' + element.value + '",\n'
); );
@@ -1326,7 +1328,7 @@ export default {
); );
} }
if (this.headers) { if (this.headers) {
this.headers.forEach((element) => { this.headers.forEach(element => {
requestString.push( requestString.push(
" -H '" + element.key + ": " + element.value + "' \\\n" " -H '" + element.key + ": " + element.value + "' \\\n"
); );
@@ -1412,7 +1414,9 @@ export default {
const config = this.$store.state.postwoman.settings.PROXY_ENABLED const config = this.$store.state.postwoman.settings.PROXY_ENABLED
? { ? {
method: "POST", method: "POST",
url: this.$store.state.postwoman.settings.PROXY_URL || "https://postwoman.apollotv.xyz/", url:
this.$store.state.postwoman.settings.PROXY_URL ||
"https://postwoman.apollotv.xyz/",
data: requestOptions data: requestOptions
} }
: requestOptions; : requestOptions;
@@ -1702,7 +1706,8 @@ export default {
}, },
ToggleExpandResponse() { ToggleExpandResponse() {
this.expandResponse = !this.expandResponse; this.expandResponse = !this.expandResponse;
this.responseBodyMaxLines = (this.responseBodyMaxLines == Infinity) ? 16 : Infinity; this.responseBodyMaxLines =
this.responseBodyMaxLines == Infinity ? 16 : Infinity;
}, },
copyResponse() { copyResponse() {
this.$refs.copyResponse.innerHTML = this.doneButton; this.$refs.copyResponse.innerHTML = this.doneButton;

View File

@@ -52,7 +52,9 @@
v-for="(logEntry, index) in communication.log" v-for="(logEntry, index) in communication.log"
:style="{ color: logEntry.color }" :style="{ color: logEntry.color }"
:key="index" :key="index"
>@ {{ logEntry.ts }} {{ getSourcePrefix(logEntry.source) }} {{ logEntry.payload }}</span> >@ {{ logEntry.ts }}{{ getSourcePrefix(logEntry.source)
}}{{ logEntry.payload }}</span
>
</span> </span>
<span v-else>(waiting for connection)</span> <span v-else>(waiting for connection)</span>
</div> </div>
@@ -115,7 +117,9 @@
> >
{{ toggleSSEConnectionVerb }} {{ toggleSSEConnectionVerb }}
<span> <span>
<i class="material-icons" v-if="!connectionSSEState">sync</i> <i class="material-icons" v-if="!connectionSSEState"
>sync</i
>
<i class="material-icons" v-if="connectionSSEState" <i class="material-icons" v-if="connectionSSEState"
>sync_disabled</i >sync_disabled</i
> >
@@ -140,7 +144,9 @@
v-for="(logEntry, index) in events.log" v-for="(logEntry, index) in events.log"
:style="{ color: logEntry.color }" :style="{ color: logEntry.color }"
:key="index" :key="index"
>@ {{ logEntry.ts }} {{ getSourcePrefix(logEntry.source) }} {{ logEntry.payload }}</span> >@ {{ logEntry.ts }}{{ getSourcePrefix(logEntry.source)
}}{{ logEntry.payload }}</span
>
</span> </span>
<span v-else>(waiting for connection)</span> <span v-else>(waiting for connection)</span>
</div> </div>
@@ -355,7 +361,7 @@ export default {
color: "var(--ac-color)" color: "var(--ac-color)"
} }
]; ];
if(typeof(EventSource) !== "undefined") { if (typeof EventSource !== "undefined") {
try { try {
this.sse = new EventSource(this.server); this.sse = new EventSource(this.server);
this.sse.onopen = event => { this.sse.onopen = event => {

View File

@@ -82,7 +82,16 @@
</ul> </ul>
<ul> <ul>
<li> <li>
<label for="url">URL</label> <div class="flex-wrap">
<label for="url">URL</label>
<button
class="icon"
@click="settings.PROXY_URL = `https://postwoman.apollotv.xyz/`"
v-tooltip.bottom="'Reset to default'"
>
<i class="material-icons">clear_all</i>
</button>
</div>
<input id="url" type="url" v-model="settings.PROXY_URL" :disabled="!settings.PROXY_ENABLED"> <input id="url" type="url" v-model="settings.PROXY_URL" :disabled="!settings.PROXY_ENABLED">
</li> </li>
</ul> </ul>