tangled mirror of catsky-🐱 Soothing soft social-app fork with all the niche toggles! (Unofficial); for issues and PRs please put them on github:NekoDrone/catsky-social
···51 }
5253 const urlp = new URL(url)
54- const [_, intent, intentType] = urlp.pathname.split('/')
5556 // On native, our links look like bluesky://intent/SomeIntent, so we have to check the hostname for the
57 // intent check. On web, we have to check the first part of the path since we have an actual hostname
···51 }
5253 const urlp = new URL(url)
54+ const [__, intent, intentType] = urlp.pathname.split('/')
5556 // On native, our links look like bluesky://intent/SomeIntent, so we have to check the hostname for the
57 // intent check. On web, we have to check the first part of the path since we have an actual hostname
+11-11
src/lib/strings/embed-player.ts
···105 urlp.hostname === 'm.youtube.com' ||
106 urlp.hostname === 'music.youtube.com'
107 ) {
108- const [_, page, shortOrLiveVideoId] = urlp.pathname.split('/')
109110 const isShorts = page === 'shorts'
111 const isLive = page === 'live'
···137 window.location.hostname
138 : 'localhost'
139140- const [_, channelOrVideo, clipOrId, id] = urlp.pathname.split('/')
141142 if (channelOrVideo === 'videos') {
143 return {
···162163 // spotify
164 if (urlp.hostname === 'open.spotify.com') {
165- const [_, typeOrLocale, idOrType, id] = urlp.pathname.split('/')
166167 if (idOrType) {
168 if (typeOrLocale === 'playlist' || idOrType === 'playlist') {
···210 urlp.hostname === 'soundcloud.com' ||
211 urlp.hostname === 'www.soundcloud.com'
212 ) {
213- const [_, user, trackOrSets, set] = urlp.pathname.split('/')
214215 if (user && trackOrSets) {
216 if (trackOrSets === 'sets' && set) {
···270 }
271272 if (urlp.hostname === 'vimeo.com' || urlp.hostname === 'www.vimeo.com') {
273- const [_, videoId] = urlp.pathname.split('/')
274 if (videoId) {
275 return {
276 type: 'vimeo_video',
···281 }
282283 if (urlp.hostname === 'giphy.com' || urlp.hostname === 'www.giphy.com') {
284- const [_, gifs, nameAndId] = urlp.pathname.split('/')
285286 /*
287 * nameAndId is a string that consists of the name (dash separated) and the id of the gif (the last part of the name)
···309 // These can include (presumably) a tracking id in the path name, so we have to check for that as well
310 if (giphyRegex.test(urlp.hostname)) {
311 // We can link directly to the gif, if its a proper link
312- const [_, media, trackingOrId, idOrFilename, filename] =
313 urlp.pathname.split('/')
314315 if (media === 'media') {
···338 // Finally, we should see if it is a link to i.giphy.com. These links don't necessarily end in .gif but can also
339 // be .webp
340 if (urlp.hostname === 'i.giphy.com' || urlp.hostname === 'www.i.giphy.com') {
341- const [_, mediaOrFilename, filename] = urlp.pathname.split('/')
342343 if (mediaOrFilename === 'media' && filename) {
344 const gifId = filename.split('.')[0]
···389 const path_components = urlp.pathname.slice(1, i + 1).split('/')
390 if (path_components.length === 4) {
391 // discard username - it's not relevant
392- const [photos, _, albums, id] = path_components
393 if (photos === 'photos' && albums === 'albums') {
394 // this at least has the shape of a valid photo-album URL!
395 return {
···417 // link shortened flickr path
418 if (urlp.hostname === 'flic.kr') {
419 const b58alph = '123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ'
420- let [_, type, idBase58Enc] = urlp.pathname.split('/')
421 let id = 0n
422 for (const char of idBase58Enc) {
423 const nextIdx = b58alph.indexOf(char)
···528 return {success: false}
529 }
530531- let [_, id, filename] = urlp.pathname.split('/')
532533 if (!id || !filename) {
534 return {success: false}
···105 urlp.hostname === 'm.youtube.com' ||
106 urlp.hostname === 'music.youtube.com'
107 ) {
108+ const [__, page, shortOrLiveVideoId] = urlp.pathname.split('/')
109110 const isShorts = page === 'shorts'
111 const isLive = page === 'live'
···137 window.location.hostname
138 : 'localhost'
139140+ const [__, channelOrVideo, clipOrId, id] = urlp.pathname.split('/')
141142 if (channelOrVideo === 'videos') {
143 return {
···162163 // spotify
164 if (urlp.hostname === 'open.spotify.com') {
165+ const [__, typeOrLocale, idOrType, id] = urlp.pathname.split('/')
166167 if (idOrType) {
168 if (typeOrLocale === 'playlist' || idOrType === 'playlist') {
···210 urlp.hostname === 'soundcloud.com' ||
211 urlp.hostname === 'www.soundcloud.com'
212 ) {
213+ const [__, user, trackOrSets, set] = urlp.pathname.split('/')
214215 if (user && trackOrSets) {
216 if (trackOrSets === 'sets' && set) {
···270 }
271272 if (urlp.hostname === 'vimeo.com' || urlp.hostname === 'www.vimeo.com') {
273+ const [__, videoId] = urlp.pathname.split('/')
274 if (videoId) {
275 return {
276 type: 'vimeo_video',
···281 }
282283 if (urlp.hostname === 'giphy.com' || urlp.hostname === 'www.giphy.com') {
284+ const [__, gifs, nameAndId] = urlp.pathname.split('/')
285286 /*
287 * nameAndId is a string that consists of the name (dash separated) and the id of the gif (the last part of the name)
···309 // These can include (presumably) a tracking id in the path name, so we have to check for that as well
310 if (giphyRegex.test(urlp.hostname)) {
311 // We can link directly to the gif, if its a proper link
312+ const [__, media, trackingOrId, idOrFilename, filename] =
313 urlp.pathname.split('/')
314315 if (media === 'media') {
···338 // Finally, we should see if it is a link to i.giphy.com. These links don't necessarily end in .gif but can also
339 // be .webp
340 if (urlp.hostname === 'i.giphy.com' || urlp.hostname === 'www.i.giphy.com') {
341+ const [__, mediaOrFilename, filename] = urlp.pathname.split('/')
342343 if (mediaOrFilename === 'media' && filename) {
344 const gifId = filename.split('.')[0]
···389 const path_components = urlp.pathname.slice(1, i + 1).split('/')
390 if (path_components.length === 4) {
391 // discard username - it's not relevant
392+ const [photos, __, albums, id] = path_components
393 if (photos === 'photos' && albums === 'albums') {
394 // this at least has the shape of a valid photo-album URL!
395 return {
···417 // link shortened flickr path
418 if (urlp.hostname === 'flic.kr') {
419 const b58alph = '123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ'
420+ let [__, type, idBase58Enc] = urlp.pathname.split('/')
421 let id = 0n
422 for (const char of idBase58Enc) {
423 const nextIdx = b58alph.indexOf(char)
···528 return {success: false}
529 }
530531+ let [__, id, filename] = urlp.pathname.split('/')
532533 if (!id || !filename) {
534 return {success: false}