Merge branch 'master' into athul-patch

This commit is contained in:
James George
2019-11-26 20:57:23 +05:30
committed by GitHub
7 changed files with 71 additions and 50 deletions

View File

@@ -157,9 +157,10 @@ _Collections are synced with local session storage_
**Features:**
- Hide your IP address
- 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.

View File

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

View File

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

View File

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

View File

@@ -599,7 +599,9 @@
: '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>
</button>
<button
@@ -1231,7 +1233,7 @@ export default {
);
}
if (this.headers) {
this.headers.forEach((element) => {
this.headers.forEach(element => {
requestString.push(
"xhr.setRequestHeader('" +
element.key +
@@ -1288,7 +1290,7 @@ export default {
);
}
if (this.headers) {
this.headers.forEach((element) => {
this.headers.forEach(element => {
headers.push(
' "' + element.key + '": "' + element.value + '",\n'
);
@@ -1326,7 +1328,7 @@ export default {
);
}
if (this.headers) {
this.headers.forEach((element) => {
this.headers.forEach(element => {
requestString.push(
" -H '" + element.key + ": " + element.value + "' \\\n"
);
@@ -1412,7 +1414,9 @@ export default {
const config = this.$store.state.postwoman.settings.PROXY_ENABLED
? {
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
}
: requestOptions;
@@ -1702,7 +1706,8 @@ export default {
},
ToggleExpandResponse() {
this.expandResponse = !this.expandResponse;
this.responseBodyMaxLines = (this.responseBodyMaxLines == Infinity) ? 16 : Infinity;
this.responseBodyMaxLines =
this.responseBodyMaxLines == Infinity ? 16 : Infinity;
},
copyResponse() {
this.$refs.copyResponse.innerHTML = this.doneButton;

View File

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

View File

@@ -82,7 +82,16 @@
</ul>
<ul>
<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">
</li>
</ul>