@unavatar/core 3.14.1 → 3.15.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
@@ -1,49 +1,5 @@
1
1
  ![logo](https://unavatar.io/api/og ':id=banner')
2
2
 
3
- - [Table of Contents](#table-of-contents)
4
- - [Introduction](#introduction)
5
- - [Quick start](#quick-start)
6
- - [Authentication](#authentication)
7
- - [Pricing](#pricing)
8
- - [Cache](#cache)
9
- - [Query parameters](#query-parameters)
10
- - [TTL](#ttl)
11
- - [Fallback](#fallback)
12
- - [JSON](#json)
13
- - [Providers](#providers)
14
- - [Apple Music](#apple-music)
15
- - [Bluesky](#bluesky)
16
- - [DeviantArt](#deviantart)
17
- - [Dribbble](#dribbble)
18
- - [DuckDuckGo](#duckduckgo)
19
- - [GitHub](#github)
20
- - [GitLab](#gitlab)
21
- - [LinkedIn](#linkedin)
22
- - [Google](#google)
23
- - [Instagram](#instagram)
24
- - [Ko-fi](#ko-fi)
25
- - [Medium](#medium)
26
- - [Microlink](#microlink)
27
- - [Mastodon](#mastodon)
28
- - [OnlyFans](#onlyfans)
29
- - [OpenStreetMap](#openstreetmap)
30
- - [Patreon](#patreon)
31
- - [Printables](#printables)
32
- - [Reddit](#reddit)
33
- - [SoundCloud](#soundcloud)
34
- - [Spotify](#spotify)
35
- - [Substack](#substack)
36
- - [Telegram](#telegram)
37
- - [TikTok](#tiktok)
38
- - [Twitch](#twitch)
39
- - [Vimeo](#vimeo)
40
- - [WhatsApp](#whatsapp)
41
- - [YouTube](#youtube)
42
- - [Response Format](#response-format)
43
- - [Response Headers](#response-headers)
44
-
45
- ---
46
-
47
3
  ## Table of Contents
48
4
 
49
5
  - [Introduction](#introduction)
@@ -77,6 +33,7 @@
77
33
  - [Reddit](#reddit)
78
34
  - [SoundCloud](#soundcloud)
79
35
  - [Spotify](#spotify)
36
+ - [Steam](#steam)
80
37
  - [Substack](#substack)
81
38
  - [Telegram](#telegram)
82
39
  - [TikTok](#tiktok)
@@ -531,6 +488,22 @@ Available URI format inputs:
531
488
  - `track`: [unavatar.io/spotify/track:4OROzZUy6gOWN4UGQVaZMF](https://unavatar.io/spotify/track:4OROzZUy6gOWN4UGQVaZMF)
532
489
  - `user` (default): [unavatar.io/spotify/user:kikobeats](https://unavatar.io/spotify/user:kikobeats)
533
490
 
491
+ ### Steam
492
+
493
+ Get any Steam Community avatar by vanity ID, numeric profile ID, or group slug.
494
+
495
+ e.g., [unavatar.io/steam/Kikobeats](https://unavatar.io/steam/Kikobeats)
496
+
497
+ The input supports a URI format `type:id`.
498
+
499
+ When no type is provided, it defaults to `id` (vanity profile URL).
500
+
501
+ Available URI format inputs:
502
+
503
+ - `id` (default): [unavatar.io/steam/Kikobeats](https://unavatar.io/steam/Kikobeats)
504
+ - `profiles`: [unavatar.io/steam/profiles:76561197976050016](https://unavatar.io/steam/profiles:76561197976050016)
505
+ - `groups`: [unavatar.io/steam/groups:microlink](https://unavatar.io/steam/groups:microlink)
506
+
534
507
  ### Substack
535
508
 
536
509
  Get any Substack author's profile picture by their publication username.
@@ -687,4 +660,4 @@ Expected errors are known operational cases returned with stable codes.
687
660
 
688
661
  ## Contact
689
662
 
690
- If you have any suggestion or bug to report, please contact to ust mailing to [hello@unavatar.io](mailto:hello@unavatar.io).
663
+ 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.14.1",
5
+ "version": "3.15.0",
6
6
  "main": "src/index.js",
7
7
  "exports": {
8
8
  ".": "./src/index.js",
@@ -25,6 +25,7 @@ const providersBy = {
25
25
  'snapchat',
26
26
  'soundcloud',
27
27
  'spotify',
28
+ 'steam',
28
29
  'substack',
29
30
  'telegram',
30
31
  'threads',
@@ -65,6 +66,7 @@ module.exports = ctx => {
65
66
  snapchat: require('./snapchat')(ctx),
66
67
  soundcloud: require('./soundcloud')(ctx),
67
68
  spotify: require('./spotify')(ctx),
69
+ steam: require('./steam')(ctx),
68
70
  substack: require('./substack')(ctx),
69
71
  telegram: require('./telegram')(ctx),
70
72
  threads: require('./threads')(ctx),
@@ -0,0 +1,29 @@
1
+ 'use strict'
2
+
3
+ const getAvatarUrl = input => {
4
+ const [first, second] = input.split(':')
5
+ const type = second ? first : 'id'
6
+ const id = encodeURIComponent(second ?? first)
7
+
8
+ switch (type) {
9
+ case 'id':
10
+ return `https://steamcommunity.com/id/${id}`
11
+ case 'profile':
12
+ case 'profiles':
13
+ return `https://steamcommunity.com/profiles/${id}`
14
+ case 'group':
15
+ case 'groups':
16
+ return `https://steamcommunity.com/groups/${id}`
17
+ default:
18
+ throw new Error(`Unsupported Steam type: ${type}`)
19
+ }
20
+ }
21
+
22
+ module.exports = ({ createHtmlProvider, getOgImage }) =>
23
+ createHtmlProvider({
24
+ name: 'steam',
25
+ url: getAvatarUrl,
26
+ getter: getOgImage
27
+ })
28
+
29
+ module.exports.getAvatarUrl = getAvatarUrl