@zachleat/fetch-links 1.0.6 → 1.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/links.js +12 -4
- package/package.json +1 -1
package/links.js
CHANGED
|
@@ -188,15 +188,23 @@ export class Links {
|
|
|
188
188
|
return url;
|
|
189
189
|
}
|
|
190
190
|
|
|
191
|
+
static stripSearch(url) {
|
|
192
|
+
let u = new URL(url);
|
|
193
|
+
u.search = "";
|
|
194
|
+
return u.toString()
|
|
195
|
+
}
|
|
196
|
+
|
|
191
197
|
static onlyKeepExternal(entry, originalUrl) {
|
|
192
198
|
if(entry.type) { // keep feeds and other important types
|
|
193
199
|
return true;
|
|
194
200
|
}
|
|
195
201
|
|
|
196
|
-
let
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
202
|
+
let contextUrl = originalUrl || "https://example.com";
|
|
203
|
+
|
|
204
|
+
let entryUrl = new URL(entry.url, contextUrl);
|
|
205
|
+
let u = this.stripProtocol(entryUrl.toString());
|
|
206
|
+
|
|
207
|
+
return !u.startsWith(this.stripProtocol(this.stripSearch(contextUrl)));
|
|
200
208
|
}
|
|
201
209
|
|
|
202
210
|
static onlyKeepRelevant(entry) {
|