mirror of
https://github.com/jakejarvis/jarv.is.git
synced 2025-10-29 03:15:49 -04:00
url-parse -> new URL()
This commit is contained in:
@@ -1,6 +1,5 @@
|
|||||||
import fetch from "cross-fetch";
|
import fetch from "cross-fetch";
|
||||||
import canonicalUrl from "get-canonical-url";
|
import canonicalUrl from "get-canonical-url";
|
||||||
import urlParse from "url-parse";
|
|
||||||
|
|
||||||
// API endpoint
|
// API endpoint
|
||||||
const HITS_ENDPOINT = "/api/hits/";
|
const HITS_ENDPOINT = "/api/hits/";
|
||||||
@@ -24,7 +23,7 @@ if (wrapper) {
|
|||||||
wrapper.style.display = "inline-flex";
|
wrapper.style.display = "inline-flex";
|
||||||
|
|
||||||
// get path and strip beginning and ending forward slash
|
// get path and strip beginning and ending forward slash
|
||||||
const slug = urlParse(canonical).pathname.replace(/^\/|\/$/g, "");
|
const slug = new URL(canonical).pathname.replace(/^\/|\/$/g, "");
|
||||||
|
|
||||||
fetch(`${HITS_ENDPOINT}?slug=${encodeURIComponent(slug)}`)
|
fetch(`${HITS_ENDPOINT}?slug=${encodeURIComponent(slug)}`)
|
||||||
.then((response) => response.json())
|
.then((response) => response.json())
|
||||||
|
|||||||
@@ -49,7 +49,6 @@
|
|||||||
"trim-newlines": "^4.0.2",
|
"trim-newlines": "^4.0.2",
|
||||||
"twemoji": "^13.1.0",
|
"twemoji": "^13.1.0",
|
||||||
"twemoji-emojis": "^14.1.0",
|
"twemoji-emojis": "^14.1.0",
|
||||||
"url-parse": "^1.5.3",
|
|
||||||
"vanilla-hcaptcha": "^1.0.0-alpha"
|
"vanilla-hcaptcha": "^1.0.0-alpha"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|||||||
13
yarn.lock
13
yarn.lock
@@ -7917,11 +7917,6 @@ querystring@0.2.0:
|
|||||||
resolved "https://registry.yarnpkg.com/querystring/-/querystring-0.2.0.tgz#b209849203bb25df820da756e747005878521620"
|
resolved "https://registry.yarnpkg.com/querystring/-/querystring-0.2.0.tgz#b209849203bb25df820da756e747005878521620"
|
||||||
integrity sha1-sgmEkgO7Jd+CDadW50cAWHhSFiA=
|
integrity sha1-sgmEkgO7Jd+CDadW50cAWHhSFiA=
|
||||||
|
|
||||||
querystringify@^2.1.1:
|
|
||||||
version "2.2.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/querystringify/-/querystringify-2.2.0.tgz#3345941b4153cb9d082d8eee4cda2016a9aef7f6"
|
|
||||||
integrity sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ==
|
|
||||||
|
|
||||||
queue-microtask@^1.2.2:
|
queue-microtask@^1.2.2:
|
||||||
version "1.2.3"
|
version "1.2.3"
|
||||||
resolved "https://registry.yarnpkg.com/queue-microtask/-/queue-microtask-1.2.3.tgz#4929228bbc724dfac43e0efb058caf7b6cfb6243"
|
resolved "https://registry.yarnpkg.com/queue-microtask/-/queue-microtask-1.2.3.tgz#4929228bbc724dfac43e0efb058caf7b6cfb6243"
|
||||||
@@ -9830,14 +9825,6 @@ url-parse-lax@^3.0.0:
|
|||||||
dependencies:
|
dependencies:
|
||||||
prepend-http "^2.0.0"
|
prepend-http "^2.0.0"
|
||||||
|
|
||||||
url-parse@^1.5.3:
|
|
||||||
version "1.5.3"
|
|
||||||
resolved "https://registry.yarnpkg.com/url-parse/-/url-parse-1.5.3.tgz#71c1303d38fb6639ade183c2992c8cc0686df862"
|
|
||||||
integrity sha512-IIORyIQD9rvj0A4CLWsHkBBJuNqWpFQe224b6j9t/ABmquIS0qDU2pY6kl6AuOrL5OkCXHMCFNe1jBcuAggjvQ==
|
|
||||||
dependencies:
|
|
||||||
querystringify "^2.1.1"
|
|
||||||
requires-port "^1.0.0"
|
|
||||||
|
|
||||||
url-to-options@^1.0.1:
|
url-to-options@^1.0.1:
|
||||||
version "1.0.1"
|
version "1.0.1"
|
||||||
resolved "https://registry.yarnpkg.com/url-to-options/-/url-to-options-1.0.1.tgz#1505a03a289a48cbd7a434efbaeec5055f5633a9"
|
resolved "https://registry.yarnpkg.com/url-to-options/-/url-to-options-1.0.1.tgz#1505a03a289a48cbd7a434efbaeec5055f5633a9"
|
||||||
|
|||||||
Reference in New Issue
Block a user