-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Feat/#7 parse mobile links
- Loading branch information
Showing
13 changed files
with
600 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,8 @@ | ||
export const SPOTIFY_LINK_REGEX = | ||
/^https:\/\/open\.spotify\.com\/(track|album|playlist|artist|episode|show)\/.*$/; | ||
/^https:\/\/(open\.spotify\.com\/(track|album|playlist|artist|episode|show)|spotify\.link)\/[^?#]+/; | ||
|
||
export const SPOTIFY_LINK_MOBILE_REGEX = /^https:\/\/spotify\.link\/.*$/; | ||
export const SPOTIFY_LINK_DESKTOP_REGEX = /https:\/\/open\.spotify\.com\/[^?]+/; | ||
|
||
export const SPOTIFY_ID_REGEX = | ||
/(?<=\/(track|album|playlist|artist|episode|show)\/)[^/?]+/; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,14 @@ | ||
import { t } from 'elysia'; | ||
|
||
import { SPOTIFY_ID_REGEX } from '~/config/constants'; | ||
import { SPOTIFY_LINK_REGEX } from '~/config/constants'; | ||
|
||
export const searchPayloadValidator = t.Object({ | ||
spotifyLink: t.RegExp(SPOTIFY_ID_REGEX, { error: 'Invalid spotify link' }), | ||
spotifyLink: t.RegExp(SPOTIFY_LINK_REGEX, { error: 'Invalid spotify link' }), | ||
}); | ||
|
||
export const apiVersionValidator = t.Object({ | ||
v: t.String({ | ||
pattern: '1.3', | ||
error: 'Unsupported API version', | ||
}), | ||
}); |
Oops, something went wrong.