Re-order sections and add toggle for including authentication in URL
This commit is contained in:
@@ -33,6 +33,7 @@
|
|||||||
</nav>
|
</nav>
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
|
<br>
|
||||||
<nuxt id="main" />
|
<nuxt id="main" />
|
||||||
<footer>
|
<footer>
|
||||||
<!-- Top section of footer: GitHub/install links -->
|
<!-- Top section of footer: GitHub/install links -->
|
||||||
|
|||||||
167
pages/index.vue
167
pages/index.vue
@@ -38,6 +38,7 @@
|
|||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</pw-modal>
|
</pw-modal>
|
||||||
|
|
||||||
<pw-section class="blue" icon="cloud_upload" label="Request" ref="request">
|
<pw-section class="blue" icon="cloud_upload" label="Request" ref="request">
|
||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
@@ -206,9 +207,9 @@
|
|||||||
id="copyRequest"
|
id="copyRequest"
|
||||||
ref="copyRequest"
|
ref="copyRequest"
|
||||||
:disabled="!isValidURL"
|
:disabled="!isValidURL"
|
||||||
v-tooltip.bottom="'Sharable request URL'"
|
v-tooltip.bottom="'Copy Request URL'"
|
||||||
>
|
>
|
||||||
<i class="material-icons">share</i>
|
<i class="material-icons">file_copy</i>
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
class="icon"
|
class="icon"
|
||||||
@@ -220,7 +221,7 @@
|
|||||||
>
|
>
|
||||||
<i class="material-icons">save</i>
|
<i class="material-icons">save</i>
|
||||||
</button>
|
</button>
|
||||||
<button class="icon" @click="clearContent" v-tooltip.bottom="'Clear all'">
|
<button class="icon" @click="clearContent" v-tooltip.bottom="'Clear All'">
|
||||||
<i class="material-icons">clear_all</i>
|
<i class="material-icons">clear_all</i>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
@@ -263,62 +264,7 @@
|
|||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</pw-section>
|
</pw-section>
|
||||||
<pw-section class="purple" icon="cloud_download" id="response" label="Response" ref="response">
|
|
||||||
<ul>
|
|
||||||
<li>
|
|
||||||
<label for="status">status</label>
|
|
||||||
<input
|
|
||||||
:class="statusCategory ? statusCategory.className : ''"
|
|
||||||
:value="response.status || '(waiting to send request)'"
|
|
||||||
ref="status"
|
|
||||||
id="status"
|
|
||||||
name="status"
|
|
||||||
readonly
|
|
||||||
type="text"
|
|
||||||
/>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
<ul v-for="(value, key) in response.headers" :key="key">
|
|
||||||
<li>
|
|
||||||
<label :for="key">{{key}}</label>
|
|
||||||
<input :id="key" :value="value" :name="key" readonly />
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
<ul v-if="response.body">
|
|
||||||
<li>
|
|
||||||
<div class="flex-wrap">
|
|
||||||
<label for="body">response</label>
|
|
||||||
<div>
|
|
||||||
<button class="icon" @click="copyResponse" ref="copyResponse" v-if="response.body">
|
|
||||||
<i class="material-icons">file_copy</i>
|
|
||||||
<span>Copy</span>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div id="response-details-wrapper">
|
|
||||||
<pre><code
|
|
||||||
ref="responseBody"
|
|
||||||
id="body"
|
|
||||||
rows="16"
|
|
||||||
placeholder="(waiting to send request)"
|
|
||||||
>{{response.body}}</code></pre>
|
|
||||||
<iframe
|
|
||||||
:class="{hidden: !previewEnabled}"
|
|
||||||
class="covers-response"
|
|
||||||
ref="previewFrame"
|
|
||||||
src="about:blank"
|
|
||||||
></iframe>
|
|
||||||
</div>
|
|
||||||
<div class="align-right" v-if="response.body && responseType === 'text/html'">
|
|
||||||
<button class="icon" @click.prevent="togglePreview">
|
|
||||||
<i class="material-icons" v-if="!previewEnabled">visibility</i>
|
|
||||||
<i class="material-icons" v-if="previewEnabled">visibility_off</i>
|
|
||||||
<span>{{ previewEnabled ? 'Hide Preview' : 'Preview HTML' }}</span>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</pw-section>
|
|
||||||
<section>
|
<section>
|
||||||
<input id="tab-one" type="radio" name="grp" checked="checked" />
|
<input id="tab-one" type="radio" name="grp" checked="checked" />
|
||||||
<label for="tab-one">Authentication</label>
|
<label for="tab-one">Authentication</label>
|
||||||
@@ -373,6 +319,9 @@
|
|||||||
<input placeholder="Token" name="bearer_token" v-model="bearerToken" />
|
<input placeholder="Token" name="bearer_token" v-model="bearerToken" />
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
<p class="align-right"><pw-toggle
|
||||||
|
:on="!urlExcludes.auth"
|
||||||
|
@change="setExclude('auth', !$event)">Include Authentication in URL</pw-toggle></p>
|
||||||
</pw-section>
|
</pw-section>
|
||||||
</div>
|
</div>
|
||||||
<input id="tab-two" type="radio" name="grp" />
|
<input id="tab-two" type="radio" name="grp" />
|
||||||
@@ -492,10 +441,75 @@
|
|||||||
</pw-section>
|
</pw-section>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
<history @useHistory="handleUseHistory" ref="historyComponent"></history>
|
|
||||||
<pw-section class="yellow" icon="folder_special" label="Collections" ref="Collections">
|
<br>
|
||||||
<collections></collections>
|
|
||||||
|
<pw-section class="purple" icon="cloud_download" id="response" label="Response" ref="response">
|
||||||
|
<ul>
|
||||||
|
<li>
|
||||||
|
<label for="status">status</label>
|
||||||
|
<input
|
||||||
|
:class="statusCategory ? statusCategory.className : ''"
|
||||||
|
:value="response.status || '(waiting to send request)'"
|
||||||
|
ref="status"
|
||||||
|
id="status"
|
||||||
|
name="status"
|
||||||
|
readonly
|
||||||
|
type="text"
|
||||||
|
/>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<ul v-for="(value, key) in response.headers" :key="key">
|
||||||
|
<li>
|
||||||
|
<label :for="key">{{key}}</label>
|
||||||
|
<input :id="key" :value="value" :name="key" readonly />
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<ul v-if="response.body">
|
||||||
|
<li>
|
||||||
|
<div class="flex-wrap">
|
||||||
|
<label for="body">response</label>
|
||||||
|
<div>
|
||||||
|
<button class="icon" @click="copyResponse" ref="copyResponse" v-if="response.body">
|
||||||
|
<i class="material-icons">file_copy</i>
|
||||||
|
<span>Copy</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div id="response-details-wrapper">
|
||||||
|
<pre><code
|
||||||
|
ref="responseBody"
|
||||||
|
id="body"
|
||||||
|
rows="16"
|
||||||
|
placeholder="(waiting to send request)"
|
||||||
|
>{{response.body}}</code></pre>
|
||||||
|
<iframe
|
||||||
|
:class="{hidden: !previewEnabled}"
|
||||||
|
class="covers-response"
|
||||||
|
ref="previewFrame"
|
||||||
|
src="about:blank"
|
||||||
|
></iframe>
|
||||||
|
</div>
|
||||||
|
<div class="align-right" v-if="response.body && responseType === 'text/html'">
|
||||||
|
<button class="icon" @click.prevent="togglePreview">
|
||||||
|
<i class="material-icons" v-if="!previewEnabled">visibility</i>
|
||||||
|
<i class="material-icons" v-if="previewEnabled">visibility_off</i>
|
||||||
|
<span>{{ previewEnabled ? 'Hide Preview' : 'Preview HTML' }}</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
</pw-section>
|
</pw-section>
|
||||||
|
|
||||||
|
<br>
|
||||||
|
|
||||||
|
<pw-section class="yellow" icon="folder_special" label="Collections" ref="Collections">
|
||||||
|
<collections />
|
||||||
|
</pw-section>
|
||||||
|
|
||||||
|
<br>
|
||||||
|
|
||||||
|
<history @useHistory="handleUseHistory" ref="historyComponent"></history>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
@@ -577,7 +591,7 @@ export default {
|
|||||||
collections,
|
collections,
|
||||||
saveRequestAs
|
saveRequestAs
|
||||||
},
|
},
|
||||||
data() {
|
data () {
|
||||||
return {
|
return {
|
||||||
label: "",
|
label: "",
|
||||||
showModal: false,
|
showModal: false,
|
||||||
@@ -628,10 +642,18 @@ export default {
|
|||||||
"text/plain"
|
"text/plain"
|
||||||
],
|
],
|
||||||
showRequestModal: false,
|
showRequestModal: false,
|
||||||
editRequest: {}
|
editRequest: {},
|
||||||
|
|
||||||
|
urlExcludes: {}
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
|
urlExcludes: {
|
||||||
|
deep: true,
|
||||||
|
handler () {
|
||||||
|
this.$store.commit("postwoman/applySetting", ['URL_EXCLUDES', Object.assign({}, this.urlExcludes)]);
|
||||||
|
}
|
||||||
|
},
|
||||||
contentType(val) {
|
contentType(val) {
|
||||||
this.rawInput = !this.knownContentTypes.includes(val);
|
this.rawInput = !this.knownContentTypes.includes(val);
|
||||||
},
|
},
|
||||||
@@ -1218,13 +1240,13 @@ export default {
|
|||||||
document.execCommand("copy");
|
document.execCommand("copy");
|
||||||
document.body.removeChild(dummy);
|
document.body.removeChild(dummy);
|
||||||
this.$refs.copyRequest.innerHTML = this.copiedButton;
|
this.$refs.copyRequest.innerHTML = this.copiedButton;
|
||||||
this.$toast.success("Copied to clipboard", {
|
this.$toast.info("Copied to clipboard", {
|
||||||
icon: "done"
|
icon: "done"
|
||||||
});
|
});
|
||||||
setTimeout(
|
setTimeout(
|
||||||
() =>
|
() =>
|
||||||
(this.$refs.copyRequest.innerHTML =
|
(this.$refs.copyRequest.innerHTML =
|
||||||
'<i class="material-icons">share</i>'),
|
'<i class="material-icons">file_copy</i>'),
|
||||||
1000
|
1000
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -1311,12 +1333,12 @@ export default {
|
|||||||
"method",
|
"method",
|
||||||
"url",
|
"url",
|
||||||
"path",
|
"path",
|
||||||
"auth",
|
!this.urlExcludes.auth ? "auth" : null,
|
||||||
"httpUser",
|
"httpUser",
|
||||||
"httpPassword",
|
"httpPassword",
|
||||||
"bearerToken",
|
"bearerToken",
|
||||||
"contentType"
|
"contentType"
|
||||||
].map(item => flat(item));
|
].filter((item) => item !== null).map(item => flat(item));
|
||||||
let deeps = ["headers", "params"].map(item => deep(item));
|
let deeps = ["headers", "params"].map(item => deep(item));
|
||||||
let bodyParams = this.rawInput
|
let bodyParams = this.rawInput
|
||||||
? [flat("rawParams")]
|
? [flat("rawParams")]
|
||||||
@@ -1463,12 +1485,21 @@ export default {
|
|||||||
hideRequestModal() {
|
hideRequestModal() {
|
||||||
this.showRequestModal = false;
|
this.showRequestModal = false;
|
||||||
this.editRequest = {};
|
this.editRequest = {};
|
||||||
|
},
|
||||||
|
setExclude (excludedField, excluded) {
|
||||||
|
this.urlExcludes[excludedField] = excluded;
|
||||||
|
this.setRouteQueryState();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.observeRequestButton();
|
this.observeRequestButton();
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
|
this.urlExcludes = this.$store.state.postwoman.settings.URL_EXCLUDES || {
|
||||||
|
// Exclude authentication by default for security reasons.
|
||||||
|
auth: true
|
||||||
|
};
|
||||||
|
|
||||||
if (Object.keys(this.$route.query).length)
|
if (Object.keys(this.$route.query).length)
|
||||||
this.setRouteQueries(this.$route.query);
|
this.setRouteQueries(this.$route.query);
|
||||||
this.$watch(
|
this.$watch(
|
||||||
|
|||||||
@@ -40,7 +40,13 @@ export const SETTINGS_KEYS = [
|
|||||||
/**
|
/**
|
||||||
* The security key of the proxy.
|
* The security key of the proxy.
|
||||||
*/
|
*/
|
||||||
"PROXY_KEY"
|
"PROXY_KEY",
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An array of properties to exclude from the URL.
|
||||||
|
* e.g. 'auth'
|
||||||
|
*/
|
||||||
|
"URL_EXCLUDES"
|
||||||
];
|
];
|
||||||
|
|
||||||
export const state = () => ({
|
export const state = () => ({
|
||||||
|
|||||||
Reference in New Issue
Block a user