Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: parser refactor and updates #505

Open
wants to merge 41 commits into
base: feat/the-grid
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
41431f8
WIP parser refactor and updates
nastita Oct 18, 2024
bab74f0
Simplify parser result
nastita Oct 21, 2024
776467d
update yt parsing params
nastita Oct 21, 2024
c4793da
Update IG parsing parameters
nastita Oct 21, 2024
8d89fc5
Fix parsePlatformInput calls after updates
nastita Oct 21, 2024
34933f6
Update spotify test cases
nastita Oct 21, 2024
19529a6
Merge branch 'feat/the-grid' of https://github.com/lukso-network/univ…
nastita Oct 21, 2024
8267b28
Fix lint issues
nastita Oct 21, 2024
7d159a7
Merge branch 'feat/the-grid' of github.com:lukso-network/universalpro…
dzbo Oct 30, 2024
0d51b4a
Remove autoplay from iframes
dzbo Oct 30, 2024
5f72573
Add mode support in fetcher
dzbo Oct 31, 2024
a6d1570
Move parser to own folder
dzbo Oct 31, 2024
6834c38
WIP: Updating parser
nastita Nov 1, 2024
efcbbfc
Update iframe parsers
nastita Nov 3, 2024
1d50e06
small update on xparser
nastita Nov 3, 2024
8c82101
Update IG input parsing
nastita Nov 3, 2024
66be789
Merge branch 'feat/the-grid' of github.com:lukso-network/universalpro…
dzbo Nov 3, 2024
73eed1f
Lint fixes
dzbo Nov 3, 2024
c831971
Fix tests
dzbo Nov 3, 2024
771b7ba
Fix schema
dzbo Nov 3, 2024
d431ec7
Fix format
dzbo Nov 3, 2024
8eaa747
Remove imports
dzbo Nov 3, 2024
fb88e1e
Fix test
dzbo Nov 3, 2024
1406e69
Fix
dzbo Nov 4, 2024
21135e9
Rework for X
dzbo Nov 4, 2024
9475f45
Remove logs
dzbo Nov 4, 2024
177ea9b
Include type from parser
dzbo Nov 4, 2024
e44bdec
Refactor test
dzbo Nov 4, 2024
624c481
Rework X parser + add builder
dzbo Nov 4, 2024
ad7311b
Move schemas
dzbo Nov 4, 2024
2e458a1
Merge branch 'feat/the-grid' of github.com:lukso-network/universalpro…
dzbo Nov 4, 2024
58a39ce
Schema map
dzbo Nov 4, 2024
16a83b4
Fix X parser tests
dzbo Nov 4, 2024
9ddcc7a
Rename
dzbo Nov 4, 2024
73076f1
Text widget fixes
dzbo Nov 4, 2024
cd46b20
Update parsers and tests
nastita Nov 4, 2024
3461f05
Merge branch 'twitter-parser-updates' of https://github.com/lukso-net…
nastita Nov 4, 2024
2b67c1e
Add warpcast parser
nastita Nov 4, 2024
c51b04e
Fix images
dzbo Nov 5, 2024
98fe321
Instagram
dzbo Nov 5, 2024
96754af
Warpcast updates
dzbo Nov 5, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions domains/grid/components/AddWidget.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
<script setup lang="ts">
import type { GridWidgetType } from '@/types/grid'

type Props = {
id?: string
properties?: GridWidgetProperties
Expand Down
73 changes: 73 additions & 0 deletions domains/grid/shared/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,76 @@ export const DEFAULT_SMALL_COLUMN_NUMBER = 1
// minimum and maximum number of columns in the grid
export const GRID_COLUMNS_MIN = 2
export const GRID_COLUMNS_MAX = 4

// TODO instead of this huge object we should break down into individual parser files
export const PLATFORM_PARSING_PARAMETERS: Partial<
Record<GridWidgetType, PlatformParsingParameters | undefined>
> = {
[GRID_WIDGET_TYPE.enum.X]: {
type: GRID_WIDGET_TYPE.enum.X,
embedRegex:
/https?:\/\/twitter\.com\/(?<handle>[a-zA-Z0-9_]+)(?:\/status\/(?<id>\d+))?(?:\?[^"'\s]*)?/,
secondaryRegexesWithCallbacks: [
// Match a handle with @ symbol
{
regex: /@([a-zA-Z0-9_]{1,15})/,
callback: getXOEmbedFromHandle,
},
// Match a Twitter URL with or without https www and status
{
regex:
/(https?:\/\/)?(?:x\.com|twitter\.com)\/[a-zA-Z0-9_]+(?:\/status\/(\d+))?/,
callback: async url => sanitizeXEmbedUrl(url),
},
],
},
[GRID_WIDGET_TYPE.enum.INSTAGRAM]: {
type: GRID_WIDGET_TYPE.enum.INSTAGRAM,
embedRegex:
/https:\/\/www\.instagram\.com\/(?<type>p|reel|profile|tv)\/(?<id>[\w-]+)\/(?<params>\?[^"]*)?/,
},
[GRID_WIDGET_TYPE.enum.SPOTIFY]: {
type: GRID_WIDGET_TYPE.enum.IFRAME,
embedRegex:
/https?:\/\/(?:open\.)?spotify\.com\/embed\/?(?<type>track|playlist|artist)\/(?<id>[^?]+)(?:\?utm_source=(?:generator|oembed))?(?:&theme=(?<theme>\d))?/,
secondaryRegexesWithCallbacks: [
{
regex:
/https:\/\/open\.spotify\.com\/(?<type>track|playlist|artist)\/(?<id>[^?]+)/,
callback: getSpotifyOEmbed,
},
],
constantProperties: {
allow: 'clipboard-write; encrypted-media; fullscreen; picture-in-picture',
},
},
[GRID_WIDGET_TYPE.enum.SOUNDCLOUD]: {
type: GRID_WIDGET_TYPE.enum.IFRAME,
embedRegex:
/https?:\/\/w\.soundcloud\.com\/player\/\?(?:(?!url=https).)*url=https(?::|%3A)(?:\/|%2F){2}api\.soundcloud\.com(?:\/|%2F)(?<type>tracks|playlists|users)(?:\/|%2F)\d+(?:[^"]*)?/,
secondaryRegexesWithCallbacks: [
{
regex:
/https:\/\/soundcloud\.com\/([a-zA-Z0-9_-]+)(?:\/(sets\/[a-zA-Z0-9_-]+|[a-zA-Z0-9_-]+))?\/?/,
callback: getSoundCloudOEmbed,
},
],
constantProperties: {
allow: 'clipboard-write; encrypted-media; fullscreen; picture-in-picture',
},
},
[GRID_WIDGET_TYPE.enum.YOUTUBE]: {
type: GRID_WIDGET_TYPE.enum.YOUTUBE,
embedRegex: /(?:https?:\/\/)?(?:www\.)?youtube\.com\/embed\/([^?]+)/,
secondaryRegexesWithCallbacks: [
{
regex: /(?:https?:\/\/)?(?:www\.)?youtube\.com\/watch\?v=([^&]+)/,
callback: async url => sanitizeYoutubeEmbedUrl(url),
},
],
constantProperties: {
allow:
'accelerometer; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share',
},
},
}
Loading
Loading