Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions i18n/en-US.messages.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -956,6 +956,19 @@ export declare const messages: {
* Missing translations: `bg`, `da`, `es-419`, `fr`, `hi`, `hr`, `hu`, `ko`, `lt`, `no`, `ro`, `th`, `vi`, `zh-CN`
*/
'REPLUGGED_COMMAND_SUCCESS_GENERIC': TypedIntlMessageGetter<{}>,
/**
* Key: `rKwDiI`
*
* ### Definition
* ```text
* Configuration
* ```
*
* ### Problems
*
* Missing translations: `bg`, `cs`, `da`, `de`, `el`, `en-GB`, `es-419`, `es-ES`, `fi`, `fr`, `hi`, `hr`, `hu`, `it`, `ja`, `ko`, `lt`, `nl`, `no`, `pl`, `pt-BR`, `ro`, `ru`, `sv-SE`, `th`, `tr`, `uk`, `vi`, `zh-CN`, `zh-TW`
*/
'REPLUGGED_CONFIGURATION': TypedIntlMessageGetter<{}>,
/**
* Key: `zENqYW`
*
Expand Down
3 changes: 2 additions & 1 deletion i18n/en-US.messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ export default defineMessages({
"REPLUGGED_PLUGIN": "Plugin",
"REPLUGGED_PLUGINS": "Plugins",
"REPLUGGED_QUICKCSS": "Quick CSS",
"REPLUGGED_CONFIGURATION": "Configuration",
"REPLUGGED_SETTINGS_ADVANCED_DESC": "Don't touch stuff in here if you don't know what you're doing. Unexpected things can happen to your cat.",
"REPLUGGED_SETTINGS_BACKEND": "Backend URL",
"REPLUGGED_SETTINGS_BACKEND_DESC": "URL used to fetch some assets and to query Replugged's REST API.",
Expand Down Expand Up @@ -210,4 +211,4 @@ export default defineMessages({
"REPLUGGED_SETTINGS_WIN_UPDATER": "Keep Replugged After Updates",
"REPLUGGED_SETTINGS_WIN_UPDATER_DESC": "Automatically reapplies Replugged after Discord updates.",
"REPLUGGED_SETTINGS_DEVELOPMENT_TOOLS": "Development Tools"
});
});
19 changes: 10 additions & 9 deletions src/main/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,11 @@ Object.defineProperty(global, "appSettings", {
// Thank you, Ven, for pointing this out!
class BrowserWindow extends electron.BrowserWindow {
public constructor(opts: Electron.BrowserWindowConstructorOptions) {
const generalSettings = getAllSettings("dev.replugged.Settings");
const repluggedSettings = getAllSettings("dev.replugged.Settings");
const originalPreload = opts.webPreferences?.preload;

if (opts.frame && process.platform === "linux" && generalSettings.titleBar) opts.frame = void 0;
if (opts.frame && process.platform === "linux" && repluggedSettings.titleBar)
opts.frame = void 0;

// Load our preload script if it's the main window or the splash screen
if (
Expand All @@ -45,25 +46,25 @@ class BrowserWindow extends electron.BrowserWindow {
) {
opts.webPreferences.preload = join(__dirname, "./preload.js");

if (generalSettings.transparency) {
if (repluggedSettings.transparency) {
opts.transparent = true;
opts.backgroundColor = "#00000000";
if (process.platform === "win32" && generalSettings.backgroundMaterial) {
opts.backgroundMaterial = generalSettings.backgroundMaterial as BackgroundMaterialType;
if (process.platform === "win32" && repluggedSettings.backgroundMaterial) {
opts.backgroundMaterial = repluggedSettings.backgroundMaterial as BackgroundMaterialType;
}
if (process.platform === "darwin" && generalSettings.vibrancy) {
opts.vibrancy = generalSettings.vibrancy as VibrancyType;
if (process.platform === "darwin" && repluggedSettings.vibrancy) {
opts.vibrancy = repluggedSettings.vibrancy as VibrancyType;
}
}

if (generalSettings.disableMinimumSize) {
if (repluggedSettings.disableMinimumSize) {
opts.minWidth = 0;
opts.minHeight = 0;
}

super(opts);

if (generalSettings.disableMinimumSize) this.setMinimumSize = () => undefined;
if (repluggedSettings.disableMinimumSize) this.setMinimumSize = () => undefined;
(this.webContents as RepluggedWebContents).originalPreload = originalPreload;
}
}
Expand Down
8 changes: 4 additions & 4 deletions src/renderer/coremods/badges/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import React from "@common/react";
import { Logger } from "@replugged";
import { filters, getFunctionKeyBySource, waitForModule } from "@webpack";
import { DISCORD_BLURPLE, DISCORD_INVITE, WEBLATE_URL } from "src/constants";
import { generalSettings } from "src/renderer/managers/settings";
import { repluggedSettings } from "src/renderer/managers/settings";
import { t } from "src/renderer/modules/i18n";
import type { Badge, DisplayProfile } from "src/types";
import { Injector } from "../../modules/injector";
Expand Down Expand Up @@ -49,7 +49,7 @@ interface BadgeCache {
const cache = new Map<string, BadgeCache>();
const REFRESH_INTERVAL = 1000 * 60 * 30;

const contributorsUrl = `${generalSettings.get("apiUrl")}/contributors`;
const contributorsUrl = `${repluggedSettings.get("apiUrl")}/contributors`;
const inviteUrl = `https://discord.gg/${DISCORD_INVITE}`;

const badgeElements = [
Expand Down Expand Up @@ -104,7 +104,7 @@ export async function start(): Promise<void> {
const useBadgesKey = getFunctionKeyBySource(useBadgesMod, "")!;

injector.after(useBadgesMod, useBadgesKey, ([displayProfile], badges) => {
if (!generalSettings.get("badges")) return badges;
if (!repluggedSettings.get("badges")) return badges;

const [badgeCache, setBadgeCache] = React.useState<APIRepluggedBadges | undefined>();

Expand All @@ -120,7 +120,7 @@ export async function start(): Promise<void> {
}

try {
const response = await fetch(`${generalSettings.get("apiUrl")}/api/v1/users/${userId}`);
const response = await fetch(`${repluggedSettings.get("apiUrl")}/api/v1/users/${userId}`);
const body = await response.json();

const badges: APIRepluggedBadges =
Expand Down
6 changes: 3 additions & 3 deletions src/renderer/coremods/experiments/plaintextPatches.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { generalSettings } from "src/renderer/managers/settings";
import { repluggedSettings } from "src/renderer/managers/settings";
import type { PlaintextPatch } from "src/types";

function alwaysTruePatch(find: string | RegExp, match: string | RegExp): PlaintextPatch {
return { find, replacements: [{ match, replace: `$&||true` }] };
}

export default (generalSettings.get("experiments")
export default (repluggedSettings.get("experiments")
? [
{
find: /"displayName","(Developer)?ExperimentStore"/,
Expand All @@ -32,7 +32,7 @@ export default (generalSettings.get("experiments")
},
],
},
...(generalSettings.get("staffDevTools")
...(repluggedSettings.get("staffDevTools")
? [
{
// Set the resulting experiment configuration of the bug reporter to be always true
Expand Down
4 changes: 2 additions & 2 deletions src/renderer/coremods/installer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Injector } from "@replugged";
import type React from "react";
import type { Capture, DefaultInRule } from "simple-markdown";
import { plugins } from "src/renderer/managers/plugins";
import { generalSettings } from "src/renderer/managers/settings";
import { repluggedSettings } from "src/renderer/managers/settings";
import { themes } from "src/renderer/managers/themes";
import { filters, getFunctionKeyBySource, waitForModule } from "src/renderer/modules/webpack";
import type { ObjectExports } from "src/types";
Expand Down Expand Up @@ -115,7 +115,7 @@ async function injectLinks(): Promise<void> {
const installLink = parseInstallLink(match[1]);
if (!installLink) return null;
if (installLink.source !== "store") return null;
if (!generalSettings.get("addonEmbeds")) return null;
if (!repluggedSettings.get("addonEmbeds")) return null;
return match;
},
parse: (capture: Capture) => {
Expand Down
4 changes: 2 additions & 2 deletions src/renderer/coremods/installer/util.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { marginStyles, modal, toast } from "@common";
import { t as discordT, intl } from "@common/i18n";
import { Button, Notice } from "@components";
import { Logger } from "@replugged";
import { generalSettings } from "src/renderer/managers/settings";
import { repluggedSettings } from "src/renderer/managers/settings";
import { setUpdaterState } from "src/renderer/managers/updater";
import { t } from "src/renderer/modules/i18n";
import { openExternal } from "src/renderer/util";
Expand Down Expand Up @@ -39,7 +39,7 @@ export interface InstallLinkProps {
export function parseInstallLink(href: string): InstallLinkProps | null {
try {
const url = new URL(href);
const repluggedHostname = new URL(generalSettings.get("apiUrl")).hostname;
const repluggedHostname = new URL(repluggedSettings.get("apiUrl")).hostname;
if (url.hostname !== repluggedHostname) return null;

if (url.pathname === "/install") {
Expand Down
4 changes: 2 additions & 2 deletions src/renderer/coremods/noXSSDefenses/plaintextPatches.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { generalSettings } from "src/renderer/managers/settings";
import { repluggedSettings } from "src/renderer/managers/settings";
import type { PlaintextPatch } from "src/types";

export default [
{
find: "Messages.SELF_XSS_HEADER",
replacements: [
...(generalSettings.get("keepToken")
...(repluggedSettings.get("keepToken")
? [
{
match: /if\(null!=\i&&"0\.0\.0"/,
Expand Down
14 changes: 7 additions & 7 deletions src/renderer/coremods/settings/index.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { t as discordT, intl } from "@common/i18n";
import { intl } from "@common/i18n";
import { Text } from "@components";
import { filters, waitForModule } from "@webpack";
import { generalSettings } from "src/renderer/managers/settings";
import { repluggedSettings } from "src/renderer/managers/settings";
import { t } from "src/renderer/modules/i18n";
import type { UserSettingsFormType } from "src/types";
import { Divider, Header, Section, insertSections, settingsTools } from "./lib";
import { General, Plugins, QuickCSS, Themes, Updater } from "./pages";
import { Configuration, Plugins, QuickCSS, Themes, Updater } from "./pages";

export { insertSections };

Expand All @@ -32,14 +32,14 @@ export function start(): void {
Divider(),
Header("Replugged"),
Section({
name: "rp-general",
label: () => intl.string(discordT.SETTINGS_GENERAL),
elem: General,
name: "rp-configuration",
label: () => intl.string(t.REPLUGGED_CONFIGURATION),
elem: Configuration,
}),
Section({
name: "rp-quickcss",
label: () => intl.string(t.REPLUGGED_QUICKCSS),
tabPredicate: () => generalSettings.useValue("quickCSS"),
tabPredicate: () => repluggedSettings.useValue("quickCSS"),
elem: QuickCSS,
}),
Section({
Expand Down
6 changes: 3 additions & 3 deletions src/renderer/coremods/settings/pages/Addons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
Tooltip,
} from "@components";
import { Logger, plugins, themes, webpack } from "@replugged";
import { generalSettings } from "src/renderer/managers/settings";
import { repluggedSettings } from "src/renderer/managers/settings";
import { t } from "src/renderer/modules/i18n";
import { openExternal } from "src/renderer/util";
import type { RepluggedPlugin, RepluggedTheme } from "src/types";
Expand Down Expand Up @@ -170,7 +170,7 @@ export function getSourceLink(addon: AnyAddonManifest): string | undefined {
case "github":
return `https://github.com/${updaterId}`;
case "store":
return `${generalSettings.get("apiUrl")}/store/${addonId}`;
return `${repluggedSettings.get("apiUrl")}/store/${addonId}`;
}
return undefined;
}
Expand Down Expand Up @@ -641,7 +641,7 @@ export const Addons = (type: AddonType): React.ReactElement => {
</Button>
<Button
fullWidth
onClick={() => openExternal(`${generalSettings.get("apiUrl")}/store/${type}s`)}
onClick={() => openExternal(`${repluggedSettings.get("apiUrl")}/store/${type}s`)}
color={Button.Colors.PRIMARY}
look={Button.Looks.OUTLINED}>
{intl.format(t.REPLUGGED_ADDON_BROWSE, {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
.replugged-general-tabBarPanel {
.replugged-configuration-tabBarPanel {
margin-top: var(--space-24);
}

.replugged-general-easter-egg {
.replugged-configuration-easter-egg {
display: inherit;
text-align: center;
}
Loading