diff --git a/src/equicordplugins/clipsEnhancements.discordDesktop/index.tsx b/src/equicordplugins/clipsEnhancements.discordDesktop/index.tsx index e91803310..cd1b4b25d 100644 --- a/src/equicordplugins/clipsEnhancements.discordDesktop/index.tsx +++ b/src/equicordplugins/clipsEnhancements.discordDesktop/index.tsx @@ -7,12 +7,13 @@ import { definePluginSettings, migratePluginSettings, migrateSettingsFromPlugin } from "@api/Settings"; import { Button } from "@components/Button"; import { Devs, EquicordDevs } from "@utils/constants"; -import definePlugin, { makeRange, OptionType } from "@utils/types"; -import { Activity, SelectOption } from "@vencord/discord-types"; +import { getIntlMessage } from "@utils/discord"; +import definePlugin, { OptionType } from "@utils/types"; +import { Activity } from "@vencord/discord-types"; import { openUserSettingsPanel, PresenceStore, UserStore } from "@webpack/common"; -migratePluginSettings("ClipsEnhancements", "TimelessClips"); -migrateSettingsFromPlugin("ClipsEnhancements", "TimelessClips", "clipLength"); +const extraTimeslots = [3, 4, 5, 6, 7, 10, 15, 20, 25, 30]; +const extraFramerates = [45, 90, 120, 144, 165, 240]; const settings = definePluginSettings({ richPresenceTagging: { @@ -24,13 +25,6 @@ const settings = definePluginSettings({ { label: "Never", value: "never" }, ] }, - clipLength: { - description: "Custom clip length in minutes", - type: OptionType.SLIDER, - markers: makeRange(3, 30, 1), - default: 5, - stickToMarkers: true, - }, enableScreenshotKeybind: { type: OptionType.BOOLEAN, description: "Enable the screenshot keybind feature", @@ -68,15 +62,23 @@ const settings = definePluginSettings({ }, }); +migratePluginSettings("ClipsEnhancements", "TimelessClips"); +migrateSettingsFromPlugin("ClipsEnhancements", "TimelessClips", "clipLength"); export default definePlugin({ name: "ClipsEnhancements", description: "Add more Clip FPS and duration options, custom clip length, RPC tagging and more", authors: [Devs.niko, Devs.Joona, EquicordDevs.keyages], settings, patches: [ - // FPS and duration options { - find: "clips_recording_settings", + find: "#{intl::CLIPS_UNKNOWN_SOURCE}", + replacement: { + match: /(applicationName:)(.{0,50})(,applicationId:)(\i)/, + replace: "$1$2$3$self.getApplicationId($2)??$4" + } + }, + { + find: "#{intl::CLIPS_SETTINGS_ENABLE_CLIPS_HELP}),checked", replacement: [ { match: /\[\{.{0,25}\i.\i.FPS_15.{0,500}\}\]/, @@ -88,21 +90,6 @@ export default definePlugin({ }, ] }, - { - find: "#{intl::CLIPS_UNKNOWN_SOURCE}", - replacement: { - match: /(applicationName:)(.{0,50})(,applicationId:)(\i)/, - replace: "$1$2$3$self.getApplicationId($2)??$4" - } - }, - // TimelessClips custom clip length - { - find: '"Save clip keybind unset"', - replacement: { - match: /\)}](?<={value:.{14,17},label:(.{35,55}:).{3,7})/, - replace: "$&.concat({value:$self.getClipLength(true),label:$1$self.getClipLength(false)})})" - } - }, // enables clips { find: "2022-11_clips_experiment", @@ -120,29 +107,37 @@ export default definePlugin({ } ], - patchTimeslots(timeslots: SelectOption[]) { + patchTimeslots(timeslots) { const newTimeslots = [...timeslots]; - const extraTimeslots = [3, 5, 7, 10, 15, 20, 25, 30]; - extraTimeslots.forEach(timeslot => newTimeslots.push({ value: timeslot * 60000, label: `${timeslot} Minutes` })); + extraTimeslots.forEach(timeslot => newTimeslots.push({ + id: `${timeslot}min`, + value: timeslot * 60000, + label: getIntlMessage("CLIPS_LENGTH_MINUTES", { + count: timeslot + }) + })); - return newTimeslots; + return newTimeslots.toSorted(); }, - patchFramerates(framerates: SelectOption[]) { + patchFramerates(framerates) { const newFramerates = [...framerates]; - const extraFramerates = [45, 90, 120, 144, 165, 240]; // Lower framerates than 15FPS have adverse affects on compression, 3 minute clips at 10FPS skyrocket the filesize to 200mb!! - extraFramerates.forEach(framerate => newFramerates.push({ value: framerate, label: `${framerate}FPS` })); + extraFramerates.forEach(framerate => newFramerates.push({ + id: `${framerate}fps`, + value: framerate, + label: getIntlMessage("SCREENSHARE_FPS_ABBREVIATED", { + count: framerate + }) + })); return newFramerates.toSorted(); }, getApplicationId(activityName: string) { - if (settings.store.richPresenceTagging === "never") { - return null; - } + if (settings.store.richPresenceTagging === "never") return null; const activities: Activity[] = PresenceStore.getActivities(UserStore.getCurrentUser().id); const validActivities = activities.filter(activity => activity.type === 0 && activity.application_id !== null); @@ -161,9 +156,4 @@ export default definePlugin({ return null; }, - - getClipLength(millis: boolean) { - const minutes = settings.store.clipLength; - return millis ? minutes * 6e4 : minutes; - } }); diff --git a/src/equicordplugins/instantScreenshare/index.tsx b/src/equicordplugins/instantScreenshare/index.tsx index abc3e0c02..1a29d719f 100644 --- a/src/equicordplugins/instantScreenshare/index.tsx +++ b/src/equicordplugins/instantScreenshare/index.tsx @@ -97,8 +97,8 @@ export default definePlugin({ find: "keybindActionTypes()", predicate: () => settings.store.keybindScreenshare, replacement: { - match: /=\[(\{value:\i\.\i\.UNASSIGNED)/, - replace: '=[{value:"INSTANT_SCREEN_SHARE",label:"Instant Screenshare"},$1' + match: /=\[(\{id:.{0,25}value:\i\.\i\.UNASSIGNED)/, + replace: '=[{id:"instant-screen-share",value:"INSTANT_SCREEN_SHARE",label:"Instant Screenshare"},$1' } } ],