From 1bef541d622bcfb54348b999add9c66f83656ed8 Mon Sep 17 00:00:00 2001 From: Cynthia Foxwell Date: Tue, 8 Oct 2024 23:08:47 -0600 Subject: [PATCH] Add Media Tweaks in a basic form as work check-in Only has Image URLs and No GIF Autosend implemented currently, but options for Video Filenames and Inline Mosaic Playback. --- src/mediaTweaks/index.ts | 25 +++++++++++++++++++++ src/mediaTweaks/manifest.json | 41 +++++++++++++++++++++++++++++++++++ 2 files changed, 66 insertions(+) create mode 100644 src/mediaTweaks/index.ts create mode 100644 src/mediaTweaks/manifest.json diff --git a/src/mediaTweaks/index.ts b/src/mediaTweaks/index.ts new file mode 100644 index 0000000..054a09c --- /dev/null +++ b/src/mediaTweaks/index.ts @@ -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 = {}; diff --git a/src/mediaTweaks/manifest.json b/src/mediaTweaks/manifest.json new file mode 100644 index 0000000..85f360a --- /dev/null +++ b/src/mediaTweaks/manifest.json @@ -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 +}