Skip to content

Commit

Permalink
Added Priviblur #867
Browse files Browse the repository at this point in the history
  • Loading branch information
ManeraKai committed Dec 10, 2023
1 parent 0babf97 commit 2e5b23c
Show file tree
Hide file tree
Showing 3 changed files with 94 additions and 0 deletions.
52 changes: 52 additions & 0 deletions src/assets/images/tumblr-icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 16 additions & 0 deletions src/assets/javascripts/services.js
Original file line number Diff line number Diff line change
Expand Up @@ -571,6 +571,21 @@ function redirect(url, type, initiator, forceRedirection, incognito) {
if (url.pathname == '/') return randomInstance
return `${randomInstance}?url=${encodeURIComponent(url.href)}`
}
case "priviblur": {
if (url.hostname.startsWith("blog"))

This comment has been minimized.

Copy link
@syeopite

syeopite Dec 10, 2023

Contributor

If I'm not mistaken, doesn't this only handle blog.tumblr.com instead of any arbitrarily blog name? IE staff.tumblr.com?

This comment has been minimized.

Copy link
@ManeraKai

ManeraKai Dec 10, 2023

Author Member

Hmm. So, you want the first subdomain and the sesond to be arbitrary.

return `${randomInstance}/blog${url.pathname}${url.search}`

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

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

const reg = /^([0-9]+)\.media\.tumblr\.com/.exec(url.hostname)
if (reg)
return `${randomInstance}/media/${reg[1]}${url.pathname}${url.search}`
return `${randomInstance}${url.pathname}${url.search}`
}
default: {
return `${randomInstance}${url.pathname}${url.search}`
}
Expand Down Expand Up @@ -742,6 +757,7 @@ const defaultInstances = {
'tuboSoundcloud': ['https://tubo.migalmoreno.com'],
'tekstoLibre': ['https://davilarek.github.io/TekstoLibre'],
'skyview': ['https://skyview.social'],
'priviblur': ['https://pb.bloat.cat'],
}

function initDefaults() {
Expand Down
26 changes: 26 additions & 0 deletions src/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -994,6 +994,32 @@
},
"imageType": "svg",
"url": "https://bsky.app/"
},
"tumblr": {
"frontends": {
"priviblur": {
"name": "Priviblur",
"embeddable": true,
"instanceList": true,
"url": "https://github.com/syeopite/priviblur",
"localhost": true
}
},
"targets": [
"^https?:\\/{2}(media\\.|blog\\.|assets\\.|static\\.)?tumblr\\.com\\/",
"^https?:\\/{2}[0-9]+\\.media\\.tumblr\\.com\\/"
],
"name": "Tumblr",
"options": {
"enabled": false,
"redirectType": "main_frame",
"unsupportedUrls": "bypass",
"frontend": "priviblur",
"instance": "public"
},
"imageType": "svg",
"embeddable": true,
"url": "https://tumblr.com"
}
}
}

0 comments on commit 2e5b23c

Please sign in to comment.