@unavatar/core 3.25.0 → 3.25.2
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 +4 -32
- package/package.json +1 -1
- package/src/providers/stackoverflow.js +6 -8
package/README.md
CHANGED
|
@@ -52,7 +52,6 @@
|
|
|
52
52
|
- [X/Twitter](#xtwitter)
|
|
53
53
|
- [Xbox Gamertag](#xbox-gamertag)
|
|
54
54
|
- [YouTube](#youtube)
|
|
55
|
-
- [Privacy](#privacy)
|
|
56
55
|
- [Response Format](#response-format)
|
|
57
56
|
- [Response Headers](#response-headers)
|
|
58
57
|
- [Response Errors](#response-errors)
|
|
@@ -69,15 +68,13 @@ It's proudly powered by [microlink.io](https://microlink.io/), the headless brow
|
|
|
69
68
|
|
|
70
69
|
The service is exposed in **unavatar.io** via provider endpoints:
|
|
71
70
|
|
|
72
|
-
- an **email**: [unavatar.io/
|
|
73
|
-
- an **email hash** (auto-detected as hashed email): [unavatar.io/email/295dee0d3dbb93aac67e72ae4af40f728f050e5fd18417ad60d1ed19186ae03b](https://unavatar.io/email/295dee0d3dbb93aac67e72ae4af40f728f050e5fd18417ad60d1ed19186ae03b)
|
|
74
|
-
- a **domain**: [unavatar.io/domain/reddit.com](https://unavatar.io/domain/reddit.com)
|
|
71
|
+
- an **email (auto-detect)**: [unavatar.io/hello@microlink.io](https://unavatar.io/hello@microlink.io) — tries Gravatar, then GitHub
|
|
75
72
|
- an **email** via Gravatar: [unavatar.io/gravatar/hello@microlink.io](https://unavatar.io/gravatar/hello@microlink.io)
|
|
76
73
|
- an **email** via GitHub: [unavatar.io/github/sindresorhus@gmail.com](https://unavatar.io/github/sindresorhus@gmail.com)
|
|
77
74
|
- an **username**: [unavatar.io/github/kikobeats](https://unavatar.io/github/kikobeats)
|
|
78
75
|
- a **domain**: [unavatar.io/google/reddit.com](https://unavatar.io/google/reddit.com)
|
|
79
76
|
|
|
80
|
-
Use
|
|
77
|
+
Use `/:provider/:key` for provider-specific lookups, or pass an email as the only path segment for automatic resolution. You can read more in [Email avatars](https://unavatar.io/email) and [providers](https://unavatar.io/docs#providers).
|
|
81
78
|
|
|
82
79
|
## Authentication
|
|
83
80
|
|
|
@@ -413,10 +410,6 @@ Get any user's avatar by their email address via Gravatar. The most widely used
|
|
|
413
410
|
Available inputs:
|
|
414
411
|
|
|
415
412
|
- Email address, e.g., [unavatar.io/gravatar/hello@microlink.io](https://unavatar.io/gravatar/hello@microlink.io)
|
|
416
|
-
- SHA256 hash, e.g., [unavatar.io/gravatar/295dee0d3dbb93aac67e72ae4af40f728f050e5fd18417ad60d1ed19186ae03b](https://unavatar.io/gravatar/295dee0d3dbb93aac67e72ae4af40f728f050e5fd18417ad60d1ed19186ae03b)
|
|
417
|
-
- MD5 hash (legacy), e.g., [unavatar.io/gravatar/0bc83cb571cd1c50ba6f3e8a78ef1346](https://unavatar.io/gravatar/0bc83cb571cd1c50ba6f3e8a78ef1346)
|
|
418
|
-
|
|
419
|
-
Passing a pre-computed hash instead of the raw email avoids exposing the email address in the URL. See [Privacy](#privacy) for details.
|
|
420
413
|
|
|
421
414
|
### Instagram
|
|
422
415
|
|
|
@@ -658,7 +651,7 @@ Available inputs:
|
|
|
658
651
|
|
|
659
652
|
### YouTube
|
|
660
653
|
|
|
661
|
-
Get any YouTube channel's thumbnail by their handle, username, or channel ID.
|
|
654
|
+
Get any YouTube channel's thumbnail by their handle, legacy username, or channel ID.
|
|
662
655
|
|
|
663
656
|
e.g., [unavatar.io/youtube/casey](https://unavatar.io/youtube/casey)
|
|
664
657
|
|
|
@@ -671,27 +664,6 @@ Available inputs:
|
|
|
671
664
|
- `username`: [unavatar.io/youtube/casey](https://unavatar.io/youtube/casey)
|
|
672
665
|
- `channel`: [unavatar.io/youtube/UC_x5XG1OV2P6uZZ5FSM9Ttw](https://unavatar.io/youtube/UC_x5XG1OV2P6uZZ5FSM9Ttw)
|
|
673
666
|
|
|
674
|
-
## Privacy
|
|
675
|
-
|
|
676
|
-
When you pass an email address directly in the URL, it is visible in plain text — both in server logs and to any intermediary that inspects the request.
|
|
677
|
-
|
|
678
|
-
To avoid this, pass a pre-computed **MD5** or **SHA256** hash of the email instead. Unavatar detects the hash automatically and routes it to Gravatar, which natively supports both hash formats.
|
|
679
|
-
|
|
680
|
-
```bash
|
|
681
|
-
# Instead of exposing the raw email:
|
|
682
|
-
https://unavatar.io/hello@example.com
|
|
683
|
-
|
|
684
|
-
# Pass the SHA256 hash:
|
|
685
|
-
https://unavatar.io/295dee0d3dbb93aac67e72ae4af40f728f050e5fd18417ad60d1ed19186ae03b
|
|
686
|
-
|
|
687
|
-
# Or the MD5 hash (legacy, still supported by Gravatar):
|
|
688
|
-
https://unavatar.io/0bc83cb571cd1c50ba6f3e8a78ef1346
|
|
689
|
-
```
|
|
690
|
-
|
|
691
|
-
The hash must be exactly 32 hex characters (MD5) or 64 hex characters (SHA256), lowercase or uppercase — unavatar normalises it automatically.
|
|
692
|
-
|
|
693
|
-
Note: hash-based lookup is only supported for Gravatar. Other providers such as GitHub require the raw email address and cannot reverse a hash.
|
|
694
|
-
|
|
695
667
|
## Response Format
|
|
696
668
|
|
|
697
669
|
A response is returning the user avatar by default.
|
|
@@ -773,4 +745,4 @@ Expected errors are known operational cases returned with stable codes.
|
|
|
773
745
|
|
|
774
746
|
## Contact
|
|
775
747
|
|
|
776
|
-
If you have any suggestion or bug to report, please contact to ust mailing to [hello@unavatar.io](mailto:hello@unavatar.io).
|
|
748
|
+
If you have any suggestion or bug to report, please contact to ust mailing to [hello@unavatar.io](mailto:hello@unavatar.io).
|
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.25.
|
|
5
|
+
"version": "3.25.2",
|
|
6
6
|
"main": "src/index.js",
|
|
7
7
|
"exports": {
|
|
8
8
|
".": "./src/index.js",
|
|
@@ -2,16 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
const AVATAR_SELECTOR = '.js-usermini-avatar-container img'
|
|
4
4
|
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
return normalizedInput
|
|
11
|
-
}
|
|
5
|
+
const normalizeUserId = input =>
|
|
6
|
+
input
|
|
7
|
+
.replace(/^\/+/, '')
|
|
8
|
+
.replace(/^users\//, '')
|
|
9
|
+
.split('/')[0]
|
|
12
10
|
|
|
13
11
|
const getProfileUrl = input =>
|
|
14
|
-
`https://stackoverflow.com/users/${
|
|
12
|
+
`https://stackoverflow.com/users/${normalizeUserId(input)}`
|
|
15
13
|
|
|
16
14
|
const getAvatarUrl = $ =>
|
|
17
15
|
$(`${AVATAR_SELECTOR}[width="128"]`).attr('src') ||
|