Skip to content

Commit dd6413e

Browse files
committed
Pinterest: redirect subdomains, fix shortlinks, add reverse
1 parent 4c222bb commit dd6413e

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/assets/javascripts/services.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,8 @@ function rewrite(url, originUrl, frontend, randomInstance, type) {
373373
return `${randomInstance}${url.pathname}${url.search}`
374374
case "painterest":
375375
if (url.hostname == "i.pinimg.com") return `${randomInstance}/_/proxy?url=${encodeURIComponent(url.href)}`
376+
const regex = /^\/pin\/[^\/]+/.exec(url.pathname)
377+
if (regex) return `${randomInstance}${regex[0]}`
376378
return `${randomInstance}${url.pathname}${url.search}`
377379
case "laboratory": {
378380
let path = url.pathname
@@ -797,6 +799,7 @@ async function reverse(url) {
797799
case "quora":
798800
case "twitter":
799801
case "medium":
802+
case "pinterest":
800803
return `${config.services[service].url}${url.pathname}${url.search}`
801804
case "fandom": {
802805
let regex = url.pathname.match(/^\/([a-zA-Z0-9-]+)\/wiki\/(.*)/)

src/config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -562,7 +562,7 @@
562562
},
563563
"targets": [
564564
"^https?:\\/{2}i\\.pinimg\\.com",
565-
"^https?:\\/{2}(www\\.)?pinterest\\.com"
565+
"^https?:\\/{2}((?!api\\.)[a-zA-Z]+\\.)?pinterest\\.com"
566566
],
567567
"options": {
568568
"enabled": false,

0 commit comments

Comments
 (0)