Skip to content

Commit

Permalink
Add Media Tweaks in a basic form as work check-in
Browse files Browse the repository at this point in the history
Only has Image URLs and No GIF Autosend implemented currently, but
options for Video Filenames and Inline Mosaic Playback.
  • Loading branch information
Cynosphere committed Oct 9, 2024
1 parent e24ff51 commit 1bef541
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 0 deletions.
25 changes: 25 additions & 0 deletions src/mediaTweaks/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { Patch } from "@moonlight-mod/types";

export const patches: Patch[] = [
// Image URLs
{
find: "allowLinks:!!",
replace: {
match: /,(\(null!=.\?.:.\)\.embeds\)\),)/,
replacement: (_, orig) =>
`,moonlight.getConfigOption("mediaTweaks","imageUrls")??true?{}:${orig}`
}
},

// No GIF Autosend
{
find: ".TOGGLE_GIF_PICKER,handler:",
replace: {
match: /.{1,2}===.\..\.CREATE_FORUM_POST/,
replacement: (orig: string) =>
`(moonlight.getConfigOption("mediaTweaks","noGifAutosend")??true?true:${orig})`
}
}
];

//export const webpackModules: Record<string, ExtensionWebpackModule> = {};
41 changes: 41 additions & 0 deletions src/mediaTweaks/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"id": "mediaTweaks",
"version": "1.0.0",
"meta": {
"name": "Media Tweaks",
"tagline": "Various tweaks to images and videos. Every feature togglable.",
"authors": [
"Cynosphere"
],
"tags": [
"qol",
"chat"
],
"source": "https://github.com/Cynosphere/moonlight-extensions"
},
"settings": {
"imageUrls": {
"displayName": "Image URLs",
"type": "boolean",
"default": true
},
"noGifAutosend": {
"displayName": "No GIF Autosend",
"description": "Puts the URL in the textbox when clicking a GIF instead of automatically sending it",
"type": "boolean",
"default": true
},
"videoFilenames": {
"displayName": "Video Filenames",
"type": "boolean",
"default": true
},
"inlineMosaicPlayback": {
"displayName": "Inline Mosaic Playback",
"description": "Allows videos in a media mosaic to be played inline instead of playing in a modal",
"type": "boolean",
"default": true
}
},
"apiLevel": 2
}

0 comments on commit 1bef541

Please sign in to comment.