Skip to content

Commit

Permalink
fix: better beautify url (#111)
Browse files Browse the repository at this point in the history
- update dependencies
- v1.7.12
- improve beautifyUrl 
  - comments
  - remove some url params (utm & subscriber)
  - remove trailing ? in addition to /
  • Loading branch information
e-krebs authored Oct 24, 2022
1 parent 3af4782 commit d51331c
Show file tree
Hide file tree
Showing 4 changed files with 323 additions and 294 deletions.
38 changes: 19 additions & 19 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "pile",
"version": "1.7.11",
"version": "1.7.12",
"author": "Emmanuel Krebs <e-krebs@users.noreply.github.com>",
"license": "MIT",
"scripts": {
Expand All @@ -21,12 +21,12 @@
"webext-prod": {}
},
"dependencies": {
"@react-aria/checkbox": "^3.5.0",
"@react-aria/textfield": "^3.7.0",
"@react-aria/visually-hidden": "^3.4.0",
"@react-stately/toggle": "^3.4.0",
"classnames": "^2.3.1",
"date-fns": "^2.29.1",
"@react-aria/checkbox": "^3.6.0",
"@react-aria/textfield": "^3.7.2",
"@react-aria/visually-hidden": "^3.5.0",
"@react-stately/toggle": "^3.4.2",
"classnames": "^2.3.2",
"date-fns": "^2.29.3",
"lodash": "^4.17.21",
"node-vibrant": "^3.1.6",
"react": "^18.2.0",
Expand All @@ -41,28 +41,28 @@
"@parcel/core": "^2.7.0",
"@parcel/transformer-svg-react": "^2.7.0",
"@parcel/validator-typescript": "^2.7.0",
"@tailwindcss/typography": "^0.5.4",
"@types/chrome": "^0.0.193",
"@types/express": "^4.17.13",
"@types/node": "^18.7.4",
"@types/react": "^18.0.17",
"@tailwindcss/typography": "^0.5.7",
"@types/chrome": "^0.0.199",
"@types/express": "^4.17.14",
"@types/node": "^18.11.4",
"@types/react": "^18.0.21",
"@types/react-dom": "^18.0.6",
"@typescript-eslint/eslint-plugin": "^5.33.1",
"@typescript-eslint/parser": "^5.33.1",
"@typescript-eslint/eslint-plugin": "^5.40.1",
"@typescript-eslint/parser": "^5.40.1",
"bestzip": "^2.2.1",
"eslint": "^8.22.0",
"eslint-import-resolver-typescript": "^3.4.1",
"eslint": "^8.26.0",
"eslint-import-resolver-typescript": "^3.5.2",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-react": "^7.30.1",
"eslint-plugin-react": "^7.31.10",
"eslint-plugin-react-hooks": "^4.6.0",
"parcel": "^2.7.0",
"postcss": "^8.4.16",
"postcss": "^8.4.18",
"prettier": "^2.7.1",
"prettier-plugin-tailwindcss": "^0.1.13",
"querystring-es3": "^0.2.1",
"rimraf": "^3.0.2",
"tailwindcss": "^3.1.8",
"tailwindcss": "^3.2.1",
"typescript": "^4.7.4"
},
"alias": {
Expand Down
2 changes: 1 addition & 1 deletion src/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"manifest_version": 3,
"name": "pile",
"description": "pile",
"version": "1.7.11",
"version": "1.7.12",
"icons": {
"16": "./content/icons/icon-16.png",
"48": "./content/icons/icon-48.png",
Expand Down
6 changes: 5 additions & 1 deletion src/utils/url.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
export const beautifyUrl = (url: string): string =>
url.replace(/^http(?:s)?:\/\/(www.)?/, '').replace(/\/$/, '');
url
.replace(/^http(?:s)?:\/\/(www.)?/, '') // remove starting http(s) & www.
.replace(/(?<=&|\?)utm_.*?(&|$)/gim, '') // remove ?utm_... & &utm_...
.replace(/(?<=&|\?).*_subscriber_.*?(&|$)/gim, '') // remove ?..._subscriber_... & &..._subscriber_...
.replace(/(\?|\/)$/, ''); // remove trailing ? or /
Loading

0 comments on commit d51331c

Please sign in to comment.