Skip to content

Commit c971865

Browse files
committed
updated /.well-known/assetlinks.json parsing
1 parent 420b19b commit c971865

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

.github/workflows/wpt-test.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,13 @@ jobs:
3535
WPT_API_KEY: ${{ secrets.HA_API_KEY }}
3636
PR_BODY: ${{ github.event.pull_request.body }}
3737

38+
- name: Run WebPageTest for on.com
39+
run: node tests/wpt.js
40+
env:
41+
WPT_SERVER: "on.com"
42+
WPT_API_KEY: ${{ secrets.HA_API_KEY }}
43+
PR_BODY: ${{ github.event.pull_request.body }}
44+
3845
- name: Add comment to PR
3946
uses: mshick/add-pr-comment@v2
4047
if: always()

dist/well-known.js

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,23 @@ function parseResponseWithRedirects(url, parser) {
8181

8282
return Promise.all([
8383
// ecommerce
84-
parseResponse('/.well-known/assetlinks.json'),
84+
parseResponse('/.well-known/assetlinks.json', r => {
85+
return r.json().then(data => {
86+
let hasDeepLinking = false;
87+
let hasCredentialSharing = false;
88+
data.forEach(statement => {
89+
if (statement.relation === 'delegate_permission/common.handle_all_urls') {
90+
hasDeepLinking = true;
91+
} else if (statement.relation === 'delegate_permission/common.get_login_creds') {
92+
hasCredentialSharing = true;
93+
}
94+
});
95+
return {
96+
deep_linking: hasDeepLinking,
97+
credential_sharing: hasCredentialSharing
98+
};
99+
});
100+
}),
85101
parseResponse('/.well-known/apple-app-site-association'),
86102
// privacy sandbox
87103
parseResponse('/.well-known/related-website-set.json'), //Related Website Set

0 commit comments

Comments
 (0)