@unavatar/core 3.33.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 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.33.0",
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
@@ -0,0 +1,12 @@
1
+ 'use strict'
2
+
3
+ const getAvatarUrl = input => `https://hevy.com/user/${input}`
4
+
5
+ module.exports = ({ createHtmlProvider, getOgImage }) =>
6
+ createHtmlProvider({
7
+ name: 'hevy',
8
+ url: getAvatarUrl,
9
+ getter: getOgImage
10
+ })
11
+
12
+ module.exports.getAvatarUrl = getAvatarUrl
@@ -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',
@@ -20,6 +21,7 @@ const providersBy = {
20
21
  'gitlab',
21
22
  'google-play',
22
23
  'huggingface',
24
+ 'hevy',
23
25
  'instagram',
24
26
  'ko-fi',
25
27
  'linkedin',
@@ -64,6 +66,7 @@ module.exports = ctx => {
64
66
  buymeacoffee: require('./buymeacoffee')(ctx),
65
67
  codepen: require('./codepen')(ctx),
66
68
  cults3d: require('./cults3d')(ctx),
69
+ cursor: require('./cursor')(ctx),
67
70
  deviantart: require('./deviantart')(ctx),
68
71
  discord: require('./discord')(ctx),
69
72
  dockerhub: require('./dockerhub')(ctx),
@@ -77,6 +80,7 @@ module.exports = ctx => {
77
80
  'google-play': require('./google-play')(ctx),
78
81
  gravatar: require('./gravatar')(ctx),
79
82
  huggingface: require('./huggingface')(ctx),
83
+ hevy: require('./hevy')(ctx),
80
84
  instagram: require('./instagram')(ctx),
81
85
  'ko-fi': require('./ko-fi')(ctx),
82
86
  linkedin: require('./linkedin')(ctx),