Skip to content

Commit c20758f

Browse files
committed
correct and simplify the data collection for rws and apple reducing some keys
1 parent e462243 commit c20758f

File tree

1 file changed

+14
-24
lines changed

1 file changed

+14
-24
lines changed

dist/well-known.js

Lines changed: 14 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -101,43 +101,33 @@ return Promise.all([
101101
}),
102102
// Apple App Site Association
103103
parseResponse('/.well-known/apple-app-site-association', r => {
104-
return r.text().then(text => {
105-
let result = {
106-
applinks: null,
107-
webcredentials: null,
108-
appclips: null
109-
};
110-
111-
try {
112-
let data = JSON.parse(text);
113-
result.applinks = data.applinks || null;
114-
result.webcredentials = data.webcredentials || null;
115-
result.appclips = data.appclips || null;
116-
} catch (e) {
117-
// Failed to parse JSON, result will contain default values.
104+
return r.json().then(data => {
105+
let hasAppLinks = false;
106+
let hasWebCredentials = false;
107+
if (data.applinks) {
108+
hasAppLinks = true;
118109
}
119-
120-
return result;
110+
if (data.webcredentials) {
111+
hasWebCredentials = true;
112+
}
113+
return {
114+
app_links: hasAppLinks,
115+
web_credentials: hasWebCredentials
116+
};
121117
});
122118
}),
123119
// privacy sandbox
124-
parseResponse('/.well-known/related-website-set.json', r => { //Related Website Set
120+
parseResponse('/.well-known/related-website-set.json', r => {
125121
return r.text().then(text => {
126122
let result = {
127123
primary: null,
128-
associatedSites: null,
129-
serviceSites: null,
130-
ccTLDs: null,
131-
rationaleBySite: null
124+
associatedSites: null
132125
};
133126

134127
try {
135128
let data = JSON.parse(text);
136129
result.primary = data.primary || null;
137130
result.associatedSites = data.associatedSites || null;
138-
result.serviceSites = data.serviceSites || null;
139-
result.ccTLDs = data.ccTLDs || null;
140-
result.rationaleBySite = data.rationaleBySite || null;
141131
} catch (e) {
142132
// Failed to parse JSON, result will contain default values.
143133
}

0 commit comments

Comments
 (0)