Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 13 additions & 23 deletions src/components/MarketplaceList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
</v-list-item-avatar>
<v-row align="center" justify="end" class="justify-content-end">
<div class="d-flex align-items-start">
<v-checkbox v-model="eachOrg.selected"
<v-checkbox :input-value="eachOrg.selected"
@change="onIssuerToggle(eachOrg)"></v-checkbox>
</div>
</v-row>
Expand Down Expand Up @@ -113,21 +113,24 @@ export default {
computed: {
...mapGetters('mainStore', ['getMarketPlaceApps']),
services() {
return this.getMarketPlaceApps
return this.getMarketPlaceApps.filter(app => !!app.issuerDid)
}
},
beforeMount() {

},
methods: {
...mapMutations("mainStore", ["updateAnMarketPlaceApp", 'insertMarketplaceApps']),
...mapMutations("mainStore", ['insertMarketplaceApps']),
onIssuerToggle(eachOrg) {
// Toggle selected state and commit to the store
const updated = this.getMarketPlaceApps.map(x =>
x.appId === eachOrg.appId ? { ...x, selected: !x.selected } : x
)
this.insertMarketplaceApps(updated)
const updatedOrg = updated.find(x => x.appId === eachOrg.appId)
this.$emit('selectedServiceEvent', {
issuerDid: eachOrg.issuerDid,
selected: eachOrg.selected,
appId: eachOrg.appId
issuerDid: updatedOrg.issuerDid,
selected: updatedOrg.selected,
appId: updatedOrg.appId
})
},
},
formattedAppName(appName) {
if (appName == "" || appName == undefined) appName = "No app name";
return this.truncate(appName, 25);
Expand All @@ -140,19 +143,6 @@ export default {
return domain
}
},
serviceSelected(eachOrg) {
if (eachOrg) {
const t = this.getMarketPlaceApps.map((x) => {
if (x.appId === eachOrg.appId) {
x['selected'] = x['selected'] && x['selected'] == true ? false : true;
}
return x
})
this.insertMarketplaceApps(t)
this.$emit('selectedServiceEvent', eachOrg);
}

}
},
mixins: [UtilsMixin],

Expand Down
18 changes: 14 additions & 4 deletions src/components/settings/OnlySSIApps.vue
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,13 @@
<option value="prod">Production</option>
</select>
</div>

<div class="form-group">
<tool-tip
infoMessage="Listed origins allowed to make CORS requests. Enter comman seperated URLs to whitelist"></tool-tip>
<label for="orgName"><strong>Allowed Origins (CORS):</strong></label>
<textarea class="form-control" v-model="appModel.whitelistedCors" rows="3"
placeholder="http://your-domain.com,http://test.com"></textarea>
</div>
<div class="form-group" v-if="edit">
<hf-buttons name="Update" class="btn btn-primary"
@executeAction="updateAnAppAPIServer()"></hf-buttons>
Expand Down Expand Up @@ -814,8 +820,7 @@ export default {
const appModel = this.getAppByAppId(appId);

//// commeting it for time being
// appModel.whitelistedCors = appModel.whitelistedCors.toString();
appModel.whitelistedCors = '*';
appModel.whitelistedCors = appModel.whitelistedCors.toString();

Object.assign(this.appModel, { ...appModel });
this.selectedAssociatedSSIAppId = appModel.dependentServices[0];
Expand Down Expand Up @@ -874,7 +879,11 @@ export default {
m.push(messages.APPLICATION.ENTER_DOMAIN_ORGIN);
} else {
try {
const t = new URL(this.appModel.domain);
let domain = this.appModel.domain?.trim();
if (domain && !domain.startsWith("http://") && !domain.startsWith("https://")) {
domain = `https://${domain}`;
}
const t = new URL(domain);
if (!t.origin || t.host == "") {
throw new Error();
}
Expand Down Expand Up @@ -1235,6 +1244,7 @@ export default {
domain: "",
hasDomainVerified: false,
domainLinkageCredentialString: "",
whitelistedCors: "*"
};
this.selectedAssociatedSSIAppId = "";
this.domain = "";
Expand Down
2 changes: 1 addition & 1 deletion src/mixins/fieldValidation.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import validURL from 'valid-url'

export function isValidURL(str) {
return validURL.isUri(str);
return validURL.isUri(str.trim());
}
// export function isDomain(str)
// {
Expand Down
2 changes: 0 additions & 2 deletions src/store/mainStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -1310,7 +1310,6 @@ const mainStore = {
const authToken = getters.getSelectedService.access_token
const headers = UtilsMixin.methods.getKycServiceHeader(authToken);
const data = getters.getWidgetnConfig;
data['issuerVerificationMethodId'] = getters.getWidgetnConfig.issuerDID + '#key-1';
fetch(url, {
method: 'POST',
headers,
Expand Down Expand Up @@ -1367,7 +1366,6 @@ const mainStore = {
const authToken = getters.getSelectedService.access_token
const headers = UtilsMixin.methods.getKycServiceHeader(authToken);
const data = getters.getWidgetnConfig;
data['issuerVerificationMethodId'] = getters.getWidgetnConfig.issuerDID + '#key-1';
fetch(url, {
method: 'PATCH',
headers,
Expand Down
40 changes: 22 additions & 18 deletions src/views/Apps.vue
Original file line number Diff line number Diff line change
Expand Up @@ -373,13 +373,13 @@
</select>
</div>

<!-- <div class="form-group">
<div class="form-group">
<tool-tip
infoMessage="Listed origins allowed to make CORS requests. Enter comman seperated URLs to whitelist"></tool-tip>
<label for="orgName"><strong>Allowed Origins (CORS):</strong></label>
<textarea class="form-control" v-model="appModel.whitelistedCors" rows="3"
placeholder="*,http://your-domain.com,http://test.com"></textarea>
</div> -->
placeholder="http://your-domain.com,http://test.com"></textarea>
</div>

<div class="form-group" v-if="edit">
<hf-buttons name="Update" class="btn btn-primary" @executeAction="updateAnAppAPIServer()"></hf-buttons>
Expand Down Expand Up @@ -934,6 +934,7 @@ import { sanitizeUrl } from "../utils/common";
// import DeployOnChainKYC from "../components/deploy-onchain-kyc-popup/deploy.vue";
import DomainLinkage from "@hypersign-protocol/domain-linkage-verifier";
import config from "../config";
import {isValidOrigin} from '../mixins/fieldValidation.js';
export default {
name: "AppList",
computed: {
Expand Down Expand Up @@ -1290,8 +1291,10 @@ export default {
const appModel = this.getAppByAppId(appId);

//// commeting it for time being
// appModel.whitelistedCors = appModel.whitelistedCors.toString();
appModel.whitelistedCors = '*';
if (appModel.services && appModel.services.length > 0) {
this.selectedServiceId = appModel.services[0].id;
}
appModel.whitelistedCors = appModel.whitelistedCors.toString();

Object.assign(this.appModel, { ...appModel });
this.selectedAssociatedSSIAppId = appModel.dependentServices[0];
Expand Down Expand Up @@ -1334,23 +1337,24 @@ export default {
}
}

// console.log('----------------------------------------------------------------')
// console.log(this.appModel.whitelistedCors)
// if (!Array.isArray(this.appModel.whitelistedCors)) {
// const newArray = this.appModel.whitelistedCors?.split(",").filter((x) => x != " ").map((x) => x.trim());
// for (let i = 0; i < newArray.length; i++) {
// if (!isValidOrigin(newArray[i])) {
// m.push(messages.APPLICATION.INVALID_CORS);
// break;
// }
// }
// }

if (!Array.isArray(this.appModel.whitelistedCors)) {
const newArray = this.appModel.whitelistedCors?.split(",").map((x) => x.trim()).filter((x) => x.length > 0);
for (let i = 0; i < newArray.length; i++) {
if (!isValidOrigin(newArray[i])) {
m.push(messages.APPLICATION.INVALID_CORS);
break;
}
}
}
if (!this.appModel.domain) {
m.push(messages.APPLICATION.ENTER_DOMAIN_ORGIN);
} else {
try {
const t = new URL(this.appModel.domain);
let domain = this.appModel.domain?.trim();
if (domain && !domain.startsWith("http://") && !domain.startsWith("https://")) {
domain = `https://${domain}`;
}
const t = new URL(domain);
if (!t.origin || t.host == "") {
throw new Error();
}
Expand Down
Loading