Skip to content

Commit

Permalink
fixed website install infinite connecting (#618)
Browse files Browse the repository at this point in the history
* fixed

* fixed stupid lint
  • Loading branch information
zrodevkaan authored May 20, 2024
1 parent 2f9d716 commit 49fc063
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions src/renderer/coremods/installer/index.tsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
import { parser } from "@common";
import { Injector } from "@replugged";
import type { Capture, DefaultInRule } from "simple-markdown";
import { plugins } from "src/renderer/managers/plugins";
import { themes } from "src/renderer/managers/themes";
import { filters, waitForModule } from "src/renderer/modules/webpack";
import { ObjectExports } from "src/types";
import { registerRPCCommand } from "../rpc";
import { generalSettings } from "../settings/pages";
import AddonEmbed from "./AddonEmbed";
import { loadCommands } from "./commands";
import {
InstallLinkProps,
InstallResponse,
InstallerSource,
installFlow,
parseInstallLink,
} from "./util";
import { plugins } from "src/renderer/managers/plugins";
import { themes } from "src/renderer/managers/themes";
import AddonEmbed from "./AddonEmbed";
import { generalSettings } from "../settings/pages";
import type { Capture, DefaultInRule } from "simple-markdown";
import { parser } from "@common";
import { loadCommands } from "./commands";

const injector = new Injector();

Expand Down Expand Up @@ -91,20 +91,18 @@ async function injectLinks(): Promise<void> {
raw: true,
});
const exports = linkMod.exports as ObjectExports & {
default: React.FC<React.PropsWithChildren<AnchorProps>>;
Anchor: React.FC<React.PropsWithChildren<AnchorProps>>;
};

injector.instead(exports, "default", (args, fn) => {
injector.instead(exports, "Anchor", (args, fn) => {
const { href } = args[0];
if (!href) return fn(...args);
const installLink = parseInstallLink(href);
if (!installLink) return fn(...args);

args[0].onClick = (e) => triggerInstall(installLink, e);

const res = fn(...args);

return res;
return fn(...args);
});

const defaultRules = parser.defaultRules as typeof parser.defaultRules & {
Expand Down

0 comments on commit 49fc063

Please sign in to comment.