Merge branch 'upstream/master' into feat/graphql_highlight

This commit is contained in:
Andrew Bastin
2020-01-09 13:33:33 -05:00
4 changed files with 101 additions and 53 deletions

View File

@@ -89,8 +89,7 @@ _Customized themes are synced with local session storage_
🔌 **WebSocket**: Establish full-duplex communication channels over a single TCP connection. 🔌 **WebSocket**: Establish full-duplex communication channels over a single TCP connection.
- Send and receive data - Send and receive data
- Basic authentication using username and password - Basic and Bearer Token authentication
- Token based authentication
📡 **Server Sent Events**: Receive a stream of updates from a server over a HTTP connection without resorting to polling. 📡 **Server Sent Events**: Receive a stream of updates from a server over a HTTP connection without resorting to polling.
@@ -106,8 +105,10 @@ _Customized themes are synced with local session storage_
**Types:** **Types:**
- None - None
- Basic authentication using username and password - Basic
- Token based authentication - Bearer Token
- OAuth 2.0
- OIDC Access Token/PKCE (Proof Key for Code Exchange)
📢 **Headers**: Describes the format the body of your request is being sent as. 📢 **Headers**: Describes the format the body of your request is being sent as.

View File

@@ -44,12 +44,17 @@
display: flex; display: flex;
flex-grow: 1; flex-grow: 1;
flex-direction: column; flex-direction: column;
margin: 8px; margin: 16px;
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: 16px;
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 - 32px);
}
.modal-body {
overflow: auto;
} }
/* /*

View File

@@ -418,27 +418,22 @@
</ul> </ul>
</div> </div>
<div slot="body"> <div slot="body">
<br />
<div> <div>
<label>{{ $t("send_request") }}</label> <label>{{ $t("send_request") }}</label>
<kbd> G</kbd> <kbd> G</kbd>
</div> </div>
<br />
<div> <div>
<label>{{ $t("save_to_collections") }}</label> <label>{{ $t("save_to_collections") }}</label>
<kbd> S</kbd> <kbd> S</kbd>
</div> </div>
<br />
<div> <div>
<label>{{ $t("copy_request_link") }}</label> <label>{{ $t("copy_request_link") }}</label>
<kbd> K</kbd> <kbd> K</kbd>
</div> </div>
<br />
<div> <div>
<label>{{ $t("reset_request") }}</label> <label>{{ $t("reset_request") }}</label>
<kbd> L</kbd> <kbd> L</kbd>
</div> </div>
<br />
</div> </div>
<div slot="footer"></div> <div slot="footer"></div>
</modal> </modal>
@@ -458,11 +453,19 @@
</ul> </ul>
</div> </div>
<div slot="body"> <div slot="body">
<p class="info">
If you have enjoyed the productivity of using Postwoman, consider
donating as a sign of appreciation.
</p>
<p class="info">
You can support Postwoman development via the following methods:
</p>
<div> <div>
<a <a
href="https://opencollective.com/postwoman" href="https://opencollective.com/postwoman"
target="_blank" target="_blank"
rel="noopener" rel="noopener"
v-tooltip.right="'One-time or recurring'"
> >
<button class="icon"> <button class="icon">
<i class="material-icons">donut_large</i> <i class="material-icons">donut_large</i>
@@ -475,6 +478,7 @@
href="https://www.paypal.me/liyascthomas" href="https://www.paypal.me/liyascthomas"
target="_blank" target="_blank"
rel="noopener" rel="noopener"
v-tooltip.right="'One-time'"
> >
<button class="icon"> <button class="icon">
<i class="material-icons">payment</i> <i class="material-icons">payment</i>
@@ -487,6 +491,7 @@
href="https://www.patreon.com/liyasthomas" href="https://www.patreon.com/liyasthomas"
target="_blank" target="_blank"
rel="noopener" rel="noopener"
v-tooltip.right="'Recurring'"
> >
<button class="icon"> <button class="icon">
<i class="material-icons">local_parking</i> <i class="material-icons">local_parking</i>
@@ -607,8 +612,14 @@ export default {
}); });
}); });
console.log("%cWe ❤︎ open source!", "background-color:white;padding:8px 16px;border-radius:8px;font-size:32px;color:red;") console.log(
console.log("%cContribute: https://github.com/liyasthomas/postwoman", "background-color:black;padding:4px 8px;border-radius:8px;font-size:16px;color:white;") "%cWe ❤︎ open source!",
"background-color:white;padding:8px 16px;border-radius:8px;font-size:32px;color:red;"
);
console.log(
"%cContribute: https://github.com/liyasthomas/postwoman",
"background-color:black;padding:4px 8px;border-radius:8px;font-size:16px;color:white;"
);
}, },
watch: { watch: {

View File

@@ -458,7 +458,7 @@
</div> </div>
<input <input
id="token-name" id="token-name"
placeholder="Enter a token name..." placeholder="(optional)"
name="token_name" name="token_name"
v-model="accessTokenName" v-model="accessTokenName"
type="text" type="text"
@@ -467,9 +467,13 @@
</ul> </ul>
<ul> <ul>
<li> <li>
<label for="oidc-discovery-url">{{ $t("oidc_discovery_url") }}</label> <label for="oidc-discovery-url">
{{ $t("oidc_discovery_url") }}
</label>
<input <input
:disabled="this.authUrl !== '' || this.accessTokenUrl !== ''" :disabled="
this.authUrl !== '' || this.accessTokenUrl !== ''
"
id="oidc-discovery-url" id="oidc-discovery-url"
name="oidc_discovery_url" name="oidc_discovery_url"
type="url" type="url"
@@ -493,7 +497,9 @@
</ul> </ul>
<ul> <ul>
<li> <li>
<label for="access-token-url">{{ $t("access_token_url") }}</label> <label for="access-token-url">
{{ $t("access_token_url") }}
</label>
<input <input
:disabled="this.oidcDiscoveryUrl !== ''" :disabled="this.oidcDiscoveryUrl !== ''"
id="access-token-url" id="access-token-url"
@@ -808,9 +814,11 @@
<i class="material-icons"> <i class="material-icons">
{{ !previewEnabled ? "visibility" : "visibility_off" }} {{ !previewEnabled ? "visibility" : "visibility_off" }}
</i> </i>
<span>{{ <span>
previewEnabled ? $t("hide_preview") : $t("preview_html") {{
}}</span> previewEnabled ? $t("hide_preview") : $t("preview_html")
}}
</span>
</button> </button>
</div> </div>
</li> </li>
@@ -959,7 +967,7 @@
<li> <li>
<div class="flex-wrap"> <div class="flex-wrap">
<label for="token-list">{{ $t("token_list") }}</label> <label for="token-list">{{ $t("token_list") }}</label>
<div> <div v-if="tokens.length != 0">
<button <button
class="icon" class="icon"
@click="clearContent('tokens', $event)" @click="clearContent('tokens', $event)"
@@ -985,7 +993,7 @@
/> />
</li> </li>
<li> <li>
<input :value="token.value" readonly> <input :value="token.value" readonly />
</li> </li>
<div class="flex-wrap"> <div class="flex-wrap">
<li> <li>
@@ -1008,11 +1016,17 @@
</li> </li>
</div> </div>
</ul> </ul>
<p v-if="tokens.length === 0" class="info">
Empty
</p>
</div> </div>
<div slot="footer"></div> <div slot="footer"></div>
</pw-modal> </pw-modal>
<pw-modal v-if="showTokenRequestList" @close="showTokenRequestList = false"> <pw-modal
v-if="showTokenRequestList"
@close="showTokenRequestList = false"
>
<div slot="header"> <div slot="header">
<ul> <ul>
<li> <li>
@@ -1045,6 +1059,7 @@
:disabled="this.tokenReqs.length === 0" :disabled="this.tokenReqs.length === 0"
class="icon" class="icon"
@click="removeOAuthTokenReq" @click="removeOAuthTokenReq"
v-tooltip.bottom="'Delete'"
> >
<i class="material-icons">delete</i> <i class="material-icons">delete</i>
</button> </button>
@@ -1055,13 +1070,15 @@
id="token-req-list" id="token-req-list"
v-model="tokenReqSelect" v-model="tokenReqSelect"
:disabled="this.tokenReqs.length === 0" :disabled="this.tokenReqs.length === 0"
@change="tokenReqChange($event)"> @change="tokenReqChange($event)"
>
<option <option
v-for="(req, index) in tokenReqs" v-for="(req, index) in tokenReqs"
:key="index" :key="index"
:value="req.name"> :value="req.name"
>
{{ req.name }} {{ req.name }}
</option> </option>
</select> </select>
</span> </span>
</li> </li>
@@ -1069,12 +1086,14 @@
<ul> <ul>
<li> <li>
<label for="token-req-name">{{ $t("token_req_name") }}</label> <label for="token-req-name">{{ $t("token_req_name") }}</label>
<input v-model="tokenReqName"> <input v-model="tokenReqName" />
</li> </li>
</ul> </ul>
<ul> <ul>
<li> <li>
<label for="token-req-details">{{ $t("token_req_details") }}</label> <label for="token-req-details">
{{ $t("token_req_details") }}
</label>
<textarea <textarea
id="token-req-details" id="token-req-details"
readonly readonly
@@ -1095,7 +1114,6 @@
</div> </div>
</div> </div>
</pw-modal> </pw-modal>
</div> </div>
</div> </div>
</template> </template>
@@ -1540,7 +1558,10 @@ export default {
return this.$store.state.oauth2.accessTokenName; return this.$store.state.oauth2.accessTokenName;
}, },
set(value) { set(value) {
this.$store.commit("setOAuth2", { value, attribute: "accessTokenName" }); this.$store.commit("setOAuth2", {
value,
attribute: "accessTokenName"
});
} }
}, },
oidcDiscoveryUrl: { oidcDiscoveryUrl: {
@@ -1548,7 +1569,10 @@ export default {
return this.$store.state.oauth2.oidcDiscoveryUrl; return this.$store.state.oauth2.oidcDiscoveryUrl;
}, },
set(value) { set(value) {
this.$store.commit("setOAuth2", { value, attribute: "oidcDiscoveryUrl" }); this.$store.commit("setOAuth2", {
value,
attribute: "oidcDiscoveryUrl"
});
} }
}, },
authUrl: { authUrl: {
@@ -2572,7 +2596,10 @@ export default {
} }
}, },
async handleAccessTokenRequest() { async handleAccessTokenRequest() {
if (this.oidcDiscoveryUrl === "" && (this.authUrl === "" || this.accessTokenUrl === "")) { if (
this.oidcDiscoveryUrl === "" &&
(this.authUrl === "" || this.accessTokenUrl === "")
) {
this.$toast.error("Please complete configuration urls.", { this.$toast.error("Please complete configuration urls.", {
icon: "error" icon: "error"
}); });
@@ -2596,7 +2623,7 @@ export default {
}, },
async oauthRedirectReq() { async oauthRedirectReq() {
let tokenInfo = await oauthRedirect(); let tokenInfo = await oauthRedirect();
if(tokenInfo.hasOwnProperty('access_token')) { if (tokenInfo.hasOwnProperty("access_token")) {
this.bearerToken = tokenInfo.access_token; this.bearerToken = tokenInfo.access_token;
this.addOAuthToken({ this.addOAuthToken({
name: this.accessTokenName, name: this.accessTokenName,
@@ -2604,7 +2631,7 @@ export default {
}); });
} }
}, },
addOAuthToken({name, value}) { addOAuthToken({ name, value }) {
this.$store.commit("addOAuthToken", { this.$store.commit("addOAuthToken", {
name, name,
value value
@@ -2647,7 +2674,9 @@ export default {
}, },
removeOAuthTokenReq(index) { removeOAuthTokenReq(index) {
const oldTokenReqs = this.tokenReqs.slice(); const oldTokenReqs = this.tokenReqs.slice();
let targetReqIndex = this.tokenReqs.findIndex(tokenReq => tokenReq.name === this.tokenReqName); let targetReqIndex = this.tokenReqs.findIndex(
tokenReq => tokenReq.name === this.tokenReqName
);
if (targetReqIndex < 0) return; if (targetReqIndex < 0) return;
this.$store.commit("removeOAuthTokenReq", targetReqIndex); this.$store.commit("removeOAuthTokenReq", targetReqIndex);
this.$toast.error("Deleted", { this.$toast.error("Deleted", {
@@ -2662,7 +2691,9 @@ export default {
}); });
}, },
tokenReqChange(event) { tokenReqChange(event) {
let targetReq = this.tokenReqs.find(tokenReq => tokenReq.name === event.target.value); let targetReq = this.tokenReqs.find(
tokenReq => tokenReq.name === event.target.value
);
let { let {
oidcDiscoveryUrl, oidcDiscoveryUrl,
authUrl, authUrl,