@unavatar/core 3.34.0 → 3.35.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/cursor.js +28 -0
- package/src/providers/index.js +2 -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)
|
|
@@ -585,6 +586,12 @@ Get any Cults3D creator's profile picture by username.
|
|
|
585
586
|
|
|
586
587
|
e.g., [unavatar.io/cults3d/RaBros](https://unavatar.io/cults3d/RaBros)
|
|
587
588
|
|
|
589
|
+
### Cursor
|
|
590
|
+
|
|
591
|
+
Get any Cursor user's profile picture by their username.
|
|
592
|
+
|
|
593
|
+
e.g., [unavatar.io/cursor/eric](https://unavatar.io/cursor/eric)
|
|
594
|
+
|
|
588
595
|
### DeviantArt
|
|
589
596
|
|
|
590
597
|
Get any DeviantArt user's profile picture by their 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.35.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',
|
|
@@ -65,6 +66,7 @@ module.exports = ctx => {
|
|
|
65
66
|
buymeacoffee: require('./buymeacoffee')(ctx),
|
|
66
67
|
codepen: require('./codepen')(ctx),
|
|
67
68
|
cults3d: require('./cults3d')(ctx),
|
|
69
|
+
cursor: require('./cursor')(ctx),
|
|
68
70
|
deviantart: require('./deviantart')(ctx),
|
|
69
71
|
discord: require('./discord')(ctx),
|
|
70
72
|
dockerhub: require('./dockerhub')(ctx),
|