@unavatar/core 3.59.0 → 3.60.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -0
- package/package.json +1 -1
- package/src/providers/bitbucket.js +27 -0
- package/src/providers/index.js +2 -0
package/README.md
CHANGED
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
- [Behance](#behance)
|
|
25
25
|
- [Bilibili](#bilibili)
|
|
26
26
|
- [BIMI](#bimi)
|
|
27
|
+
- [Bitbucket](#bitbucket)
|
|
27
28
|
- [Bluesky](#bluesky)
|
|
28
29
|
- [Buy Me a Coffee](#buy-me-a-coffee)
|
|
29
30
|
- [Cash App](#cash-app)
|
|
@@ -611,6 +612,12 @@ Available inputs:
|
|
|
611
612
|
- Domain, e.g., [unavatar.io/bimi/cnn.com](https://unavatar.io/bimi/cnn.com)
|
|
612
613
|
- Email address, e.g., [unavatar.io/bimi/support@ebay.com](https://unavatar.io/bimi/support@ebay.com)
|
|
613
614
|
|
|
615
|
+
### Bitbucket
|
|
616
|
+
|
|
617
|
+
Get any Bitbucket workspace's avatar by its workspace slug. Personal accounts are covered through their personal workspace, which shares the account's username.
|
|
618
|
+
|
|
619
|
+
e.g., [unavatar.io/bitbucket/atlassian](https://unavatar.io/bitbucket/atlassian)
|
|
620
|
+
|
|
614
621
|
### Bluesky
|
|
615
622
|
|
|
616
623
|
Get any Bluesky user's profile picture by their handle. Domain-style handles are supported.
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@unavatar/core",
|
|
3
3
|
"description": "Get unified user avatar from social networks, including Instagram, SoundCloud, Telegram, Twitter, YouTube & more.",
|
|
4
4
|
"homepage": "https://unavatar.io",
|
|
5
|
-
"version": "3.
|
|
5
|
+
"version": "3.60.0",
|
|
6
6
|
"main": "src/index.js",
|
|
7
7
|
"exports": {
|
|
8
8
|
".": "./src/index.js",
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
const WORKSPACES_URL = 'https://bitbucket.org/workspaces'
|
|
4
|
+
const DEFAULT_AVATAR_PATH = '/default_workspace_avatar/'
|
|
5
|
+
|
|
6
|
+
const getAvatarUrl = input =>
|
|
7
|
+
`${WORKSPACES_URL}/${encodeURIComponent(input)}/avatar/`
|
|
8
|
+
|
|
9
|
+
const getAvatar = location => {
|
|
10
|
+
if (!location) return
|
|
11
|
+
const url = new URL(location, WORKSPACES_URL)
|
|
12
|
+
return url.pathname.includes(DEFAULT_AVATAR_PATH) ? undefined : url.toString()
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
module.exports = ({ got }) =>
|
|
16
|
+
async function bitbucket (input) {
|
|
17
|
+
const { headers } = await got(getAvatarUrl(input), {
|
|
18
|
+
method: 'HEAD',
|
|
19
|
+
followRedirect: false,
|
|
20
|
+
throwHttpErrors: false
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
return getAvatar(headers.location)
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
module.exports.getAvatarUrl = getAvatarUrl
|
|
27
|
+
module.exports.getAvatar = getAvatar
|
package/src/providers/index.js
CHANGED
|
@@ -9,6 +9,7 @@ const providerTiers = {
|
|
|
9
9
|
'apple-store',
|
|
10
10
|
'behance',
|
|
11
11
|
'bilibili',
|
|
12
|
+
'bitbucket',
|
|
12
13
|
'bluesky',
|
|
13
14
|
'buymeacoffee',
|
|
14
15
|
'cashapp',
|
|
@@ -107,6 +108,7 @@ module.exports = ctx => {
|
|
|
107
108
|
behance: require('./behance')(ctx),
|
|
108
109
|
bilibili: require('./bilibili')(ctx),
|
|
109
110
|
bimi: require('./bimi')(ctx),
|
|
111
|
+
bitbucket: require('./bitbucket')(ctx),
|
|
110
112
|
bluesky: require('./bluesky')(ctx),
|
|
111
113
|
buymeacoffee: require('./buymeacoffee')(ctx),
|
|
112
114
|
cashapp: require('./cashapp')(ctx),
|