@unavatar/core 3.36.0 → 3.37.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/index.js +2 -0
- package/src/providers/raycast.js +24 -0
package/README.md
CHANGED
|
@@ -55,6 +55,7 @@
|
|
|
55
55
|
- [Primal](#primal)
|
|
56
56
|
- [Product Hunt](#product-hunt)
|
|
57
57
|
- [PSN Profiles](#psn-profiles)
|
|
58
|
+
- [Raycast](#raycast)
|
|
58
59
|
- [Reddit](#reddit)
|
|
59
60
|
- [Snapchat](#snapchat)
|
|
60
61
|
- [SoundCloud](#soundcloud)
|
|
@@ -843,6 +844,12 @@ Get any PlayStation Network user's profile picture by their PSN username.
|
|
|
843
844
|
|
|
844
845
|
e.g., [unavatar.io/psnprofiles/Duff85](https://unavatar.io/psnprofiles/Duff85)
|
|
845
846
|
|
|
847
|
+
### Raycast
|
|
848
|
+
|
|
849
|
+
Get any Raycast user's profile picture by their username.
|
|
850
|
+
|
|
851
|
+
e.g., [unavatar.io/raycast/kikobeats](https://unavatar.io/raycast/kikobeats)
|
|
852
|
+
|
|
846
853
|
### Reddit
|
|
847
854
|
|
|
848
855
|
Get any Reddit user's avatar 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.37.0",
|
|
6
6
|
"main": "src/index.js",
|
|
7
7
|
"exports": {
|
|
8
8
|
".": "./src/index.js",
|
package/src/providers/index.js
CHANGED
|
@@ -36,6 +36,7 @@ const providersBy = {
|
|
|
36
36
|
'primal',
|
|
37
37
|
'producthunt',
|
|
38
38
|
'psnprofiles',
|
|
39
|
+
'raycast',
|
|
39
40
|
'reddit',
|
|
40
41
|
'snapchat',
|
|
41
42
|
'soundcloud',
|
|
@@ -97,6 +98,7 @@ module.exports = ctx => {
|
|
|
97
98
|
primal: require('./primal')(ctx),
|
|
98
99
|
producthunt: require('./producthunt')(ctx),
|
|
99
100
|
psnprofiles: require('./psnprofiles')(ctx),
|
|
101
|
+
raycast: require('./raycast')(ctx),
|
|
100
102
|
reddit: require('./reddit')(ctx),
|
|
101
103
|
snapchat: require('./snapchat')(ctx),
|
|
102
104
|
soundcloud: require('./soundcloud')(ctx),
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
const getAvatarUrl = input => {
|
|
4
|
+
const handle = input.startsWith('@') ? input.slice(1) : input
|
|
5
|
+
return `https://www.raycast.com/${handle}`
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
const getAvatar = $ => {
|
|
9
|
+
const src = $('img[alt="Avatar"]').attr('src')
|
|
10
|
+
if (!src) return
|
|
11
|
+
|
|
12
|
+
const url = new URL(src, 'https://www.raycast.com')
|
|
13
|
+
return url.searchParams.get('url') ?? src
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
module.exports = ({ createHtmlProvider }) =>
|
|
17
|
+
createHtmlProvider({
|
|
18
|
+
name: 'raycast',
|
|
19
|
+
url: getAvatarUrl,
|
|
20
|
+
getter: getAvatar
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
module.exports.getAvatarUrl = getAvatarUrl
|
|
24
|
+
module.exports.getAvatar = getAvatar
|