diff --git a/.prettierrc b/.prettierrc index daff9d2..142ae0e 100644 --- a/.prettierrc +++ b/.prettierrc @@ -1,5 +1,5 @@ { - "printWidth": 80, + "printWidth": 120, "trailingComma": "none", "tabWidth": 2, "singleQuote": false diff --git a/package.json b/package.json index c920470..de362ee 100644 --- a/package.json +++ b/package.json @@ -13,6 +13,6 @@ "esbuild-copy-static-files": "^0.1.0" }, "dependencies": { - "@moonlight-mod/types": "^1.2.0" + "@moonlight-mod/types": "^1.3.0" } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index f3d6e5c..5c530fe 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -9,8 +9,8 @@ importers: .: dependencies: '@moonlight-mod/types': - specifier: ^1.2.0 - version: 1.2.0 + specifier: ^1.3.0 + version: 1.3.0 devDependencies: '@electron/asar': specifier: ^3.2.8 @@ -164,8 +164,8 @@ packages: '@moonlight-mod/lunast@1.0.0': resolution: {integrity: sha512-kJgf41K12i6/2LbXK97CNO+pNO7ADGh9N4bCQcOPwosocKMcwKHDEZUgPqeihNshY3c3AEW1LiyXjlsl24PdDw==} - '@moonlight-mod/mappings@1.0.0': - resolution: {integrity: sha512-n6ybbTqFxXVKvTHcIGEtCS9208an6BFnTojK56giWE/bjuqq6DvFrk/0+C3ZRDEjgohGf/DuUKc9f0qe9UH6Rg==} + '@moonlight-mod/mappings@1.0.2': + resolution: {integrity: sha512-PjIv4LFyt3j4LyGiokUmJ6a0L5JljoLXjUkixCynLLpNLd660qTcLe8f9tbhOovvD8joqejq+f5oqSo2V4/Vfg==} peerDependencies: '@moonlight-mod/lunast': ^1.0.0 '@moonlight-mod/moonmap': ^1.0.0 @@ -173,8 +173,8 @@ packages: '@moonlight-mod/moonmap@1.0.2': resolution: {integrity: sha512-dqMFwk8o0duRfvBNYo6EwalEUWWR3bNF5V2N04ogHp4gYON6/5+XOUrTlQ9BFBDj9anZwGgVwGqnxV42Qs9pPw==} - '@moonlight-mod/types@1.2.0': - resolution: {integrity: sha512-XlysDTSnWD/2LrUE/t8MVOnU2shARmMnd+cyipQF6+FJ+gsOOBq43j6Lx/MqObs8MnQ1NwK8UTTuv3SCmIyMHw==} + '@moonlight-mod/types@1.3.0': + resolution: {integrity: sha512-JItxaIgdfcPcVW/Hl1yLvvOQHJf1rNMWg/KyzqFHQm4zmxKH1KNftc4SoZVtxoyZrWTSGsAwkZ+O8EftX+w/kQ==} '@types/estree-jsx@1.0.5': resolution: {integrity: sha512-52CcUVNFyfb1A2ALocQw/Dd1BQFNmSdkuC3BkZ6iqhdMfQz7JWOFRuJFloOzjk+6WijU56m9oKXFAXc7o3Towg==} @@ -214,9 +214,6 @@ packages: concat-map@0.0.1: resolution: {integrity: sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=} - csstype@3.1.2: - resolution: {integrity: sha512-I7K1Uu0MBPzaFKg4nI5Q7Vs2t+3gWWW648spaF+Rg7pI9ds18Ugn+lvg4SHczUdKlHI5LWBXyqfS8+DufyBsgQ==} - csstype@3.1.3: resolution: {integrity: sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==} @@ -346,7 +343,7 @@ snapshots: estree-toolkit: 1.7.8 meriyah: 6.0.2 - '@moonlight-mod/mappings@1.0.0(@moonlight-mod/lunast@1.0.0)(@moonlight-mod/moonmap@1.0.2)': + '@moonlight-mod/mappings@1.0.2(@moonlight-mod/lunast@1.0.0)(@moonlight-mod/moonmap@1.0.2)': dependencies: '@moonlight-mod/lunast': 1.0.0 '@moonlight-mod/moonmap': 1.0.2 @@ -356,13 +353,13 @@ snapshots: '@moonlight-mod/moonmap@1.0.2': {} - '@moonlight-mod/types@1.2.0': + '@moonlight-mod/types@1.3.0': dependencies: '@moonlight-mod/lunast': 1.0.0 - '@moonlight-mod/mappings': 1.0.0(@moonlight-mod/lunast@1.0.0)(@moonlight-mod/moonmap@1.0.2) + '@moonlight-mod/mappings': 1.0.2(@moonlight-mod/lunast@1.0.0)(@moonlight-mod/moonmap@1.0.2) '@moonlight-mod/moonmap': 1.0.2 '@types/react': 18.3.11 - csstype: 3.1.2 + csstype: 3.1.3 standalone-electron-types: 1.0.0 '@types/estree-jsx@1.0.5': @@ -387,7 +384,7 @@ snapshots: '@types/react@18.3.11': dependencies: '@types/prop-types': 15.7.11 - csstype: 3.1.2 + csstype: 3.1.3 astring@1.9.0: {} @@ -402,8 +399,6 @@ snapshots: concat-map@0.0.1: {} - csstype@3.1.2: {} - csstype@3.1.3: {} esbuild-copy-static-files@0.1.0: {} diff --git a/src/mediaTweaks/index.ts b/src/mediaTweaks/index.ts index 9570730..27bfdb5 100644 --- a/src/mediaTweaks/index.ts +++ b/src/mediaTweaks/index.ts @@ -6,8 +6,7 @@ export const patches: Patch[] = [ find: "allowLinks:!!", replace: { match: /,(\(null!=.\?.:.\)\.embeds\)\),)/, - replacement: (_, orig) => - `,moonlight.getConfigOption("mediaTweaks","imageUrls")??true?{}:${orig}` + replacement: (_, orig) => `,moonlight.getConfigOption("mediaTweaks","imageUrls")??true?{}:${orig}` } }, @@ -16,8 +15,7 @@ export const patches: Patch[] = [ find: ".TOGGLE_GIF_PICKER,handler:", replace: { match: /.{1,2}===.\..\.CREATE_FORUM_POST/, - replacement: (orig: string) => - `(moonlight.getConfigOption("mediaTweaks","noGifAutosend")??true?true:${orig})` + replacement: (orig: string) => `(moonlight.getConfigOption("mediaTweaks","noGifAutosend")??true?true:${orig})` } }, @@ -55,8 +53,7 @@ export const patches: Patch[] = [ // Add button { - match: - /(?<=isVisualMediaType:.,channelId:.+?}=(.);.+?(\(0,.\.jsx\)).+?\.forceShowHover]:.}\),children:\[)/, + match: /(?<=isVisualMediaType:.,channelId:.+?}=(.);.+?(\(0,.\.jsx\)).+?\.forceShowHover]:.}\),children:\[)/, replacement: (_, props, createElement) => `${createElement}(require("mediaTweaks_enlargeVideoButton").default,${props}),` } @@ -70,11 +67,7 @@ export const webpackModules: Record = { }, enlargeVideoButton: { - dependencies: [ - { id: "react" }, - { ext: "spacepack", id: "spacepack" }, - { id: "discord/components/common/index" } - ] + dependencies: [{ id: "react" }, { ext: "spacepack", id: "spacepack" }, { id: "discord/components/common/index" }] } }; diff --git a/src/mediaTweaks/manifest.json b/src/mediaTweaks/manifest.json index 49fe632..9107e9a 100644 --- a/src/mediaTweaks/manifest.json +++ b/src/mediaTweaks/manifest.json @@ -5,18 +5,11 @@ "meta": { "name": "Media Tweaks", "tagline": "Various tweaks to images and videos. Every feature togglable.", - "authors": [ - "Cynosphere" - ], - "tags": [ - "qol", - "chat" - ], + "authors": ["Cynosphere"], + "tags": ["qol", "chat"], "source": "https://github.com/Cynosphere/moonlight-extensions" }, - "dependencies": [ - "spacepack" - ], + "dependencies": ["spacepack"], "settings": { "imageUrls": { "displayName": "Image URLs", diff --git a/src/mediaTweaks/webpackModules/enlargeVideoButton.tsx b/src/mediaTweaks/webpackModules/enlargeVideoButton.tsx index 5b36947..1929641 100644 --- a/src/mediaTweaks/webpackModules/enlargeVideoButton.tsx +++ b/src/mediaTweaks/webpackModules/enlargeVideoButton.tsx @@ -2,8 +2,7 @@ import React from "@moonlight-mod/wp/react"; import spacepack from "@moonlight-mod/wp/spacepack_spacepack"; import * as Components from "@moonlight-mod/wp/discord/components/common/index"; -const { Clickable, Tooltip, MaximizeIcon, openModal, ModalRoot, ModalSize } = - Components; +const { Clickable, Tooltip, MaximizeIcon, openModal, ModalRoot, ModalSize } = Components; const HoverButtonClasses = spacepack.findByExports("hoverButton")[0].exports; @@ -21,10 +20,7 @@ const MediaModalClasses = spacepack.findByExports("modal", "image")[0].exports; const noop = () => null; -export default function EnlargeVideoButton({ - mimeType, - item -}: HoverButtonsProps) { +export default function EnlargeVideoButton({ mimeType, item }: HoverButtonsProps) { return mimeType?.[0] !== "video" ? null : ( {(tooltipProps: any) => ( @@ -50,23 +46,14 @@ export default function EnlargeVideoButton({ ); return ( - + {MediaModal} ); }); }} > - + )} diff --git a/src/noRpc/index.ts b/src/noRpc/index.ts index cac6010..3d93ae1 100644 --- a/src/noRpc/index.ts +++ b/src/noRpc/index.ts @@ -19,8 +19,7 @@ export const patches: Patch[] = [ find: '"RunningGameStore"', replace: [ { - match: - /.\.[a-zA-Z]+\.dispatch(\({type:"RUNNING_GAMES_CHANGE",games:.,added:.,removed:.}\))/, + match: /.\.[a-zA-Z]+\.dispatch(\({type:"RUNNING_GAMES_CHANGE",games:.,added:.,removed:.}\))/, // this isn't just a removal because haha removing breaks quietLoggers // and i dont feel like fixing (nor should i even have to fix, if you // pretend that im just a standard extension dev in this scenario) diff --git a/src/noRpc/manifest.json b/src/noRpc/manifest.json index 19f60e2..416eed6 100644 --- a/src/noRpc/manifest.json +++ b/src/noRpc/manifest.json @@ -5,12 +5,8 @@ "meta": { "name": "No RPC", "tagline": "Disable RPC and game detection", - "authors": [ - "Cynosphere" - ], - "tags": [ - "development" - ], + "authors": ["Cynosphere"], + "tags": ["development"], "source": "https://github.com/Cynosphere/moonlight-extensions" }, "settings": { diff --git a/src/platformStyles/host.ts b/src/platformStyles/host.ts index a338963..f8d2c4a 100644 --- a/src/platformStyles/host.ts +++ b/src/platformStyles/host.ts @@ -1,21 +1,15 @@ import { BrowserWindowConstructorOptions } from "electron"; import { PlatformStyle } from "./types"; -moonlightHost.events.on( - "window-options", - (options: BrowserWindowConstructorOptions) => { - const style = - moonlightHost.getConfigOption("platformStyles", "style") ?? - "default"; - const useFrame = style === "linux"; +moonlightHost.events.on("window-options", (options: BrowserWindowConstructorOptions) => { + const style = moonlightHost.getConfigOption("platformStyles", "style") ?? "default"; + const useFrame = style === "linux"; - const isPopout = - options.center && options.width === 300 && options.height === 350; + const isPopout = options.center && options.width === 300 && options.height === 350; - if (!isPopout) { - if (style !== "default") { - options.frame = useFrame; - } + if (!isPopout) { + if (style !== "default") { + options.frame = useFrame; } } -); +}); diff --git a/src/platformStyles/index.ts b/src/platformStyles/index.ts index f864f41..0a5a3db 100644 --- a/src/platformStyles/index.ts +++ b/src/platformStyles/index.ts @@ -21,8 +21,7 @@ export const patches: Patch[] = [ { find: ".ensureIsInPosition=", replace: { - match: - /(.{1,2})=.{1,2}!==(.{1,2})\.PlatformTypes\.WEB&&this\.inPopout\?22:0;/, + match: /(.{1,2})=.{1,2}!==(.{1,2})\.PlatformTypes\.WEB&&this\.inPopout\?22:0;/, replacement: (_, pipOffset, platformUtil) => `${pipOffset}=require("platformStyles_helper").platformBorders(${platformUtil})!==${platformUtil}.PlatformTypes.WEB&&this.inPopout?22:0;` } @@ -32,9 +31,7 @@ export const patches: Patch[] = [ export const webpackModules: Record = { helper: { run: function (module, exports, require) { - const style = - moonlight.getConfigOption("platformStyles", "style") ?? - "default"; + const style = moonlight.getConfigOption("platformStyles", "style") ?? "default"; function platformBorders(platformUtils: PlatformUtils) { switch (style) { @@ -70,5 +67,10 @@ export const webpackModules: Record = { platformClass }; } + }, + + popoutFix: { + dependencies: [{ id: "discord/Dispatcher" }], + entrypoint: true } }; diff --git a/src/platformStyles/manifest.json b/src/platformStyles/manifest.json index a13803e..e6add0f 100644 --- a/src/platformStyles/manifest.json +++ b/src/platformStyles/manifest.json @@ -1,6 +1,7 @@ { "$schema": "https://moonlight-mod.github.io/manifest.schema.json", "id": "platformStyles", + "version": "1.0.1", "meta": { "name": "Platform Styles", "tagline": "Change the window border apperance to another operating system's style.", diff --git a/src/platformStyles/webpackModules/popoutFix.ts b/src/platformStyles/webpackModules/popoutFix.ts new file mode 100644 index 0000000..4a066c9 --- /dev/null +++ b/src/platformStyles/webpackModules/popoutFix.ts @@ -0,0 +1,12 @@ +import Dispatcher from "@moonlight-mod/wp/discord/Dispatcher"; +import { PlatformStyle } from "../types"; + +Dispatcher.addInterceptor((data) => { + if (data.type == "POPOUT_WINDOW_OPEN") { + const style = moonlight.getConfigOption("platformStyles", "style") ?? "default"; + + if (style === "linux") data.features.frame = true; + } + + return false; +});