Skip to content

Commit

Permalink
mediaTweaks: fix patches
Browse files Browse the repository at this point in the history
  • Loading branch information
Cynosphere committed Jan 5, 2025
1 parent 22bb7cd commit ab1d007
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
10 changes: 6 additions & 4 deletions src/mediaTweaks/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,14 @@ export const patches: Patch[] = [
{
find: 'location:"MessageAccessories"',
replace: {
match: /=(\(0,.\..{1,2}\))\((.),({shouldRedactExplicitContent:.,shouldHideMediaOptions:.}),(.)\),/,
match: /=(\(0,.\..{1,2}\))\((.),({shouldRedactExplicitContent:.,shouldHideMediaOptions:.}),("Media Mosaic")\),/,
replacement: (_, createCarousel, attachments, props, analytics) =>
`=${createCarousel}((moonlight.getConfigOption("mediaTweaks","inlineMosaicPlayback")??true)?${attachments}.filter(x=>x.type!="VIDEO"):${attachments},${props},${analytics}),`
}
},

// Enlarge Video Button
// This is technically a Discord feature now but it doesn't support videos (yet?)
// TODO: Move this patch to a library
{
find: ".spoilerRemoveMosaicItemButton:",
Expand All @@ -53,9 +54,10 @@ export const patches: Patch[] = [

// Add button
{
match: /(?<=isVisualMediaType:.,channelId:.+?}=(.);.+?(\(0,.\.jsx\)).+?\.forceShowHover]:.}\),children:\[)/,
replacement: (_, props, createElement) =>
`${createElement}(require("mediaTweaks_enlargeVideoButton").default,${props}),`
match:
/(?<=isVisualMediaType:.,channelId:.+?}=(.);.+?"MosaicItemHoverButtons"\);)(?=.&&null!=.&&(.)\.push\((\(0,.\.jsx\)))/,
replacement: (_, props, buttons, createElement) =>
`${buttons}.push(${createElement}(require("mediaTweaks_enlargeVideoButton").default,${props},"mediaTweaks_enlargeVideoButton"));`
}
]
},
Expand Down
2 changes: 1 addition & 1 deletion src/mediaTweaks/manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$schema": "https://moonlight-mod.github.io/manifest.schema.json",
"id": "mediaTweaks",
"version": "1.0.5",
"version": "1.0.6",
"meta": {
"name": "Media Tweaks",
"tagline": "Various tweaks to images and videos. Every feature togglable.",
Expand Down

0 comments on commit ab1d007

Please sign in to comment.