Skip to content

Commit

Permalink
Merge branch 'syeopite-master'
Browse files Browse the repository at this point in the history
  • Loading branch information
ManeraKai committed Dec 10, 2023
2 parents 7951a08 + fa9f559 commit 473e196
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 9 deletions.
25 changes: 18 additions & 7 deletions src/assets/javascripts/services.js
Original file line number Diff line number Diff line change
Expand Up @@ -569,19 +569,30 @@ function redirect(url, type, initiator, forceRedirection, incognito) {
return `${randomInstance}?url=${encodeURIComponent(url.href)}`
}
case "priviblur": {
if (url.hostname.startsWith("blog"))
return `${randomInstance}/blog${url.pathname}${url.search}`
if (url.hostname == "www.tumblr.com")
return `${randomInstance}${url.pathname}${url.search}`

if (url.hostname.startsWith("assets"))
return `${randomInstance}/assets${url.pathname}${url.search}`
return `${randomInstance}/tblr/assets${url.pathname}${url.search}`

if (url.hostname.startsWith("static"))
return `${randomInstance}/static${url.pathname}${url.search}`
return `${randomInstance}/tblr/static${url.pathname}${url.search}`

const reg = /^([0-9]+)\.media\.tumblr\.com/.exec(url.hostname)
const reg = /^([0-9]+)\.media\.tumblr\.com/.exec(url.hostname) // *.media.tumblr.com
if (reg)
return `${randomInstance}/media/${reg[1]}${url.pathname}${url.search}`
return `${randomInstance}${url.pathname}${url.search}`
return `${randomInstance}/tblr/media/${reg[1]}${url.pathname}${url.search}`

const blogregex = /^(?:www\.)?([a-z\d]+)\.tumblr\.com/.exec(url.hostname) // <blog>.tumblr.com
if (blogregex) {
const blog_name = blogregex[1];
// Under the <blog>.tumblr.com domain posts are under a /post path
if (url.pathname.startsWith("/post")) {
return `${randomInstance}/${blog_name}${url.pathname.slice(5)}${url.search}`
} else {
return `${randomInstance}/${blog_name}${url.pathname}${url.search}`;
}
}
return `${randomInstance}${url.pathname}${url.search}`;
}
default: {
return `${randomInstance}${url.pathname}${url.search}`
Expand Down
5 changes: 3 additions & 2 deletions src/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -1006,8 +1006,9 @@
}
},
"targets": [
"^https?:\\/{2}(media\\.|blog\\.|assets\\.|static\\.)?tumblr\\.com\\/",
"^https?:\\/{2}[0-9]+\\.media\\.tumblr\\.com\\/"
"^https?:\\/{2}(media\\.|assets\\.|static\\.)?tumblr\\.com\\/",
"^https?:\\/{2}[0-9]+\\.media\\.tumblr\\.com\\/",
"^https?:\\/{2}(www\\.)?(.*)\\.tumblr.com\\/"
],
"name": "Tumblr",
"options": {
Expand Down

0 comments on commit 473e196

Please sign in to comment.