@unavatar/core 3.34.0 → 3.36.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 +14 -0
- package/package.json +1 -1
- package/src/providers/cursor.js +28 -0
- package/src/providers/index.js +4 -0
- package/src/providers/strava.js +12 -0
package/README.md
CHANGED
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
- [Buy Me a Coffee](#buy-me-a-coffee)
|
|
25
25
|
- [CodePen](#codepen)
|
|
26
26
|
- [Cults3D](#cults3d)
|
|
27
|
+
- [Cursor](#cursor)
|
|
27
28
|
- [DeviantArt](#deviantart)
|
|
28
29
|
- [Discord](#discord)
|
|
29
30
|
- [Docker Hub](#docker-hub)
|
|
@@ -60,6 +61,7 @@
|
|
|
60
61
|
- [Spotify](#spotify)
|
|
61
62
|
- [Stack Overflow](#stack-overflow)
|
|
62
63
|
- [Steam](#steam)
|
|
64
|
+
- [Strava](#strava)
|
|
63
65
|
- [Substack](#substack)
|
|
64
66
|
- [Telegram](#telegram)
|
|
65
67
|
- [Thingiverse](#thingiverse)
|
|
@@ -585,6 +587,12 @@ Get any Cults3D creator's profile picture by username.
|
|
|
585
587
|
|
|
586
588
|
e.g., [unavatar.io/cults3d/RaBros](https://unavatar.io/cults3d/RaBros)
|
|
587
589
|
|
|
590
|
+
### Cursor
|
|
591
|
+
|
|
592
|
+
Get any Cursor user's profile picture by their username.
|
|
593
|
+
|
|
594
|
+
e.g., [unavatar.io/cursor/eric](https://unavatar.io/cursor/eric)
|
|
595
|
+
|
|
588
596
|
### DeviantArt
|
|
589
597
|
|
|
590
598
|
Get any DeviantArt user's profile picture by their username.
|
|
@@ -894,6 +902,12 @@ Available inputs:
|
|
|
894
902
|
- `profile`: [unavatar.io/steam/profile:76561198044605749](https://unavatar.io/steam/profile:76561198044605749)
|
|
895
903
|
- `group`: [unavatar.io/steam/group:murcia-gaming](https://unavatar.io/steam/group:murcia-gaming)
|
|
896
904
|
|
|
905
|
+
### Strava
|
|
906
|
+
|
|
907
|
+
Get any Strava athlete's profile picture by their username or athlete ID.
|
|
908
|
+
|
|
909
|
+
e.g., [unavatar.io/strava/kikobeats](https://unavatar.io/strava/kikobeats)
|
|
910
|
+
|
|
897
911
|
### Substack
|
|
898
912
|
|
|
899
913
|
Get any Substack author's profile picture by their publication username.
|
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.36.0",
|
|
6
6
|
"main": "src/index.js",
|
|
7
7
|
"exports": {
|
|
8
8
|
".": "./src/index.js",
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
const getAvatarUrl = input =>
|
|
4
|
+
`https://cursor.com/${input.startsWith('@') ? input : `@${input}`}`
|
|
5
|
+
|
|
6
|
+
const getAvatar = $ => {
|
|
7
|
+
const displayName = $('h1').first().text().trim()
|
|
8
|
+
if (!displayName) return
|
|
9
|
+
|
|
10
|
+
const src = $('img')
|
|
11
|
+
.filter((_, el) => $(el).attr('alt') === displayName)
|
|
12
|
+
.first()
|
|
13
|
+
.attr('src')
|
|
14
|
+
if (!src) return
|
|
15
|
+
|
|
16
|
+
const url = new URL(src, 'https://cursor.com')
|
|
17
|
+
return url.searchParams.get('url') ?? src
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
module.exports = ({ createHtmlProvider }) =>
|
|
21
|
+
createHtmlProvider({
|
|
22
|
+
name: 'cursor',
|
|
23
|
+
url: getAvatarUrl,
|
|
24
|
+
getter: getAvatar
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
module.exports.getAvatarUrl = getAvatarUrl
|
|
28
|
+
module.exports.getAvatar = getAvatar
|
package/src/providers/index.js
CHANGED
|
@@ -10,6 +10,7 @@ const providersBy = {
|
|
|
10
10
|
'buymeacoffee',
|
|
11
11
|
'codepen',
|
|
12
12
|
'cults3d',
|
|
13
|
+
'cursor',
|
|
13
14
|
'deviantart',
|
|
14
15
|
'discord',
|
|
15
16
|
'dockerhub',
|
|
@@ -41,6 +42,7 @@ const providersBy = {
|
|
|
41
42
|
'spotify',
|
|
42
43
|
'stackoverflow',
|
|
43
44
|
'steam',
|
|
45
|
+
'strava',
|
|
44
46
|
'substack',
|
|
45
47
|
'telegram',
|
|
46
48
|
'thingiverse',
|
|
@@ -65,6 +67,7 @@ module.exports = ctx => {
|
|
|
65
67
|
buymeacoffee: require('./buymeacoffee')(ctx),
|
|
66
68
|
codepen: require('./codepen')(ctx),
|
|
67
69
|
cults3d: require('./cults3d')(ctx),
|
|
70
|
+
cursor: require('./cursor')(ctx),
|
|
68
71
|
deviantart: require('./deviantart')(ctx),
|
|
69
72
|
discord: require('./discord')(ctx),
|
|
70
73
|
dockerhub: require('./dockerhub')(ctx),
|
|
@@ -100,6 +103,7 @@ module.exports = ctx => {
|
|
|
100
103
|
spotify: require('./spotify')(ctx),
|
|
101
104
|
stackoverflow: require('./stackoverflow')(ctx),
|
|
102
105
|
steam: require('./steam')(ctx),
|
|
106
|
+
strava: require('./strava')(ctx),
|
|
103
107
|
substack: require('./substack')(ctx),
|
|
104
108
|
telegram: require('./telegram')(ctx),
|
|
105
109
|
thingiverse: require('./thingiverse')(ctx),
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
const getAvatarUrl = input => `https://www.strava.com/athletes/${input}`
|
|
4
|
+
|
|
5
|
+
module.exports = ({ createHtmlProvider, getOgImage }) =>
|
|
6
|
+
createHtmlProvider({
|
|
7
|
+
name: 'strava',
|
|
8
|
+
url: getAvatarUrl,
|
|
9
|
+
getter: getOgImage
|
|
10
|
+
})
|
|
11
|
+
|
|
12
|
+
module.exports.getAvatarUrl = getAvatarUrl
|