Skip to content

Commit 3f73319

Browse files
authored
Updated feature for Related Website Sets and Apple app site association (#159)
* Updated feature for Related Website Sets and Apple app site association * correct and simplify the data collection for rws and apple reducing some keys * commit for test run * Updated feature for Related Website Sets and Apple app site association * correct and simplify the data collection for rws and apple reducing some keys * commit for test run * removing trailing space * enhance rws with get root domain function * update related-website-set logic * Back to commit d1f41d4
1 parent 49df8e7 commit 3f73319

File tree

1 file changed

+34
-3
lines changed

1 file changed

+34
-3
lines changed

dist/well-known.js

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,40 @@ return Promise.all([
9999
};
100100
});
101101
}),
102-
parseResponse('/.well-known/apple-app-site-association'),
103-
// privacy sandbox
104-
parseResponse('/.well-known/related-website-set.json'), //Related Website Set
102+
// Apple App Site Association
103+
parseResponse('/.well-known/apple-app-site-association', r => {
104+
return r.json().then(data => {
105+
let hasAppLinks = false;
106+
let hasWebCredentials = false;
107+
if (data.applinks) {
108+
hasAppLinks = true;
109+
}
110+
if (data.webcredentials) {
111+
hasWebCredentials = true;
112+
}
113+
return {
114+
app_links: hasAppLinks,
115+
web_credentials: hasWebCredentials
116+
};
117+
});
118+
}),
119+
// Privacy Sandbox
120+
parseResponse('/.well-known/related-website-set.json', r => {
121+
return r.text().then(text => {
122+
let result = {
123+
primary: null,
124+
associatedSites: null
125+
};
126+
try {
127+
let data = JSON.parse(text);
128+
result.primary = data.primary || null;
129+
result.associatedSites = data.associatedSites || null;
130+
} catch (e) {
131+
// Failed to parse JSON, result will contain default values.
132+
}
133+
return result;
134+
});
135+
}),
105136
parseResponse('/.well-known/privacy-sandbox-attestations.json'), //Attestation File
106137
// privacy
107138
parseResponse('/.well-known/gpc.json', r => {

0 commit comments

Comments
 (0)