From 266cef9bafa622a796cf8b50c059d355569f7058 Mon Sep 17 00:00:00 2001 From: uku Date: Fri, 1 Nov 2024 21:24:53 +0100 Subject: [PATCH 1/2] flake.lock: Update MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Flake lock file updates: • Updated input 'catppuccin': 'github:Stonks3141/ctp-nix/0b7bf04628414a402d255924f65e9a0d1a53d92b' (2024-10-27) → 'github:Stonks3141/ctp-nix/191fbf2d81a63fad8f62f1233c0051f09b75d0ad' (2024-11-01) • Updated input 'ghostty': 'git+ssh://git@github.com/ghostty-org/ghostty?ref=refs/heads/main&rev=c413f2445d8fc9af8919bae818ec01b5a543cec2' (2024-10-28) → 'git+ssh://git@github.com/ghostty-org/ghostty?ref=refs/heads/main&rev=e7ccc60ed57f9897f390da42f0d7e06f094d46f3' (2024-10-31) • Updated input 'home-manager': 'github:nix-community/home-manager/e83414058edd339148dc142a8437edb9450574c8' (2024-10-27) → 'github:nix-community/home-manager/8ca921e5a806b5b6171add542defe7bdac79d189' (2024-11-01) • Updated input 'mystia': 'github:soopyc/mystia/3b6f001db02f5135386dbf0b3628e9679c2cdb63' (2024-10-26) → 'github:soopyc/mystia/663145aa050103c278863d55e136ce30e341497e' (2024-11-01) • Updated input 'nixos-wsl': 'github:nix-community/NixOS-WSL/b124084667fb4c912fda68fdd9d05f59e18b6ef7' (2024-10-28) → 'github:nix-community/NixOS-WSL/adb6bc4b661a43328752b4575be4968a4990c033' (2024-11-01) • Updated input 'nixpkgs': 'github:NixOS/nixpkgs/18536bf04cd71abd345f9579158841376fdd0c5a' (2024-10-25) → 'github:NixOS/nixpkgs/807e9154dcb16384b1b765ebe9cd2bba2ac287fd' (2024-10-29) • Updated input 'vscode-extensions': 'github:nix-community/nix-vscode-extensions/be01145d66a5cdaf0a620b8b277a8e05f1fba84b' (2024-10-29) → 'github:nix-community/nix-vscode-extensions/96dcbddd24edc60ad47f41bb2a73e06099eba4af' (2024-11-01) --- flake.lock | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/flake.lock b/flake.lock index 2e67ec7..c56a7f4 100644 --- a/flake.lock +++ b/flake.lock @@ -75,11 +75,11 @@ }, "catppuccin": { "locked": { - "lastModified": 1730036420, - "narHash": "sha256-rv2bz7J6Wo7AenPiu4+ptCB1AFyaMcS77y89zbRAtI8=", + "lastModified": 1730458408, + "narHash": "sha256-JQ+SphQn13bdibKUrBBBznYehXX4xJrxD1ifBp6vSWw=", "owner": "Stonks3141", "repo": "ctp-nix", - "rev": "0b7bf04628414a402d255924f65e9a0d1a53d92b", + "rev": "191fbf2d81a63fad8f62f1233c0051f09b75d0ad", "type": "github" }, "original": { @@ -172,11 +172,11 @@ "zig": "zig" }, "locked": { - "lastModified": 1730155692, - "narHash": "sha256-2p90mOK7JC3Rt8hH2tQDV4WxbukjWpq2+OH2WptEgag=", + "lastModified": 1730394182, + "narHash": "sha256-gICiMiFZcxz/oY29iEsYi9Q/gC8Fx2nW1L872J1TA74=", "ref": "refs/heads/main", - "rev": "c413f2445d8fc9af8919bae818ec01b5a543cec2", - "revCount": 7836, + "rev": "e7ccc60ed57f9897f390da42f0d7e06f094d46f3", + "revCount": 7858, "type": "git", "url": "ssh://git@github.com/ghostty-org/ghostty" }, @@ -192,11 +192,11 @@ ] }, "locked": { - "lastModified": 1730016908, - "narHash": "sha256-bFCxJco7d8IgmjfNExNz9knP8wvwbXU4s/d53KOK6U0=", + "lastModified": 1730450782, + "narHash": "sha256-0AfApF8aexgB6o34qqLW2cCX4LaWJajBVdU6ddiWZBM=", "owner": "nix-community", "repo": "home-manager", - "rev": "e83414058edd339148dc142a8437edb9450574c8", + "rev": "8ca921e5a806b5b6171add542defe7bdac79d189", "type": "github" }, "original": { @@ -243,11 +243,11 @@ ] }, "locked": { - "lastModified": 1729935605, - "narHash": "sha256-CLMq9+IxT7r3Du2tNNUPoM1exJL6D6jxe9GSar51lbM=", + "lastModified": 1730448125, + "narHash": "sha256-egDk4Sdd2NtPhPrSKAzagW+7mG5zzVsqdrLNjIk20xg=", "owner": "soopyc", "repo": "mystia", - "rev": "3b6f001db02f5135386dbf0b3628e9679c2cdb63", + "rev": "663145aa050103c278863d55e136ce30e341497e", "type": "github" }, "original": { @@ -287,11 +287,11 @@ ] }, "locked": { - "lastModified": 1730120924, - "narHash": "sha256-I6hwd+YlgefioLfmsM04MxzbEAES1N328/T+VqhcWnQ=", + "lastModified": 1730453870, + "narHash": "sha256-d+kIgz4BvTXb7emjSFV3zjNydGmLUmuluQjdBb51R9o=", "owner": "nix-community", "repo": "NixOS-WSL", - "rev": "b124084667fb4c912fda68fdd9d05f59e18b6ef7", + "rev": "adb6bc4b661a43328752b4575be4968a4990c033", "type": "github" }, "original": { @@ -302,11 +302,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1729880355, - "narHash": "sha256-RP+OQ6koQQLX5nw0NmcDrzvGL8HDLnyXt/jHhL1jwjM=", + "lastModified": 1730200266, + "narHash": "sha256-l253w0XMT8nWHGXuXqyiIC/bMvh1VRszGXgdpQlfhvU=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "18536bf04cd71abd345f9579158841376fdd0c5a", + "rev": "807e9154dcb16384b1b765ebe9cd2bba2ac287fd", "type": "github" }, "original": { @@ -438,11 +438,11 @@ ] }, "locked": { - "lastModified": 1730166645, - "narHash": "sha256-r+cFrkHjf93QHzAid/IAIoTjY8icOFu5iCCQ5e/Sd98=", + "lastModified": 1730426202, + "narHash": "sha256-swwKpE3lrdvcSh6Hjyf/eSe/zPnsZgeVlSl+B4yBpeo=", "owner": "nix-community", "repo": "nix-vscode-extensions", - "rev": "be01145d66a5cdaf0a620b8b277a8e05f1fba84b", + "rev": "96dcbddd24edc60ad47f41bb2a73e06099eba4af", "type": "github" }, "original": { From e2f73b4e518bb7a6563757ae6e3d4875c1270e24 Mon Sep 17 00:00:00 2001 From: uku Date: Fri, 1 Nov 2024 21:38:17 +0100 Subject: [PATCH 2/2] fix(exprs): fetch ventex in cool mode --- exprs/overlay.nix | 13 ++++- exprs/ventex.patch | 128 --------------------------------------------- 2 files changed, 11 insertions(+), 130 deletions(-) delete mode 100644 exprs/ventex.patch diff --git a/exprs/overlay.nix b/exprs/overlay.nix index 64acc39..e6671f7 100644 --- a/exprs/overlay.nix +++ b/exprs/overlay.nix @@ -12,7 +12,7 @@ vencord-input: final: prev: { idea-ultimate-fixed = prev.callPackage ./idea-fixed.nix {}; - vencord = prev.vencord.overrideAttrs (old: { + vencord = prev.vencord.overrideAttrs (old: rec { src = vencord-input // { @@ -20,6 +20,15 @@ vencord-input: final: prev: { repo = "Vencord"; }; - patches = old.patches or [] ++ [./ventex.patch]; + ventex = prev.fetchFromGitHub { + owner = "vgskye"; + repo = "ventex"; + rev = "158c14e7d88acb140a71766c514d8a3724d260cd"; + hash = "sha256-Svc8dI2weFcqPSk064t/pL/4Hopn6/mWP6cIrT+FIr8="; + }; + + postConfigure = '' + cp -r ${ventex} src/plugins/ventex + ''; }); } diff --git a/exprs/ventex.patch b/exprs/ventex.patch deleted file mode 100644 index 61e1c8f..0000000 --- a/exprs/ventex.patch +++ /dev/null @@ -1,128 +0,0 @@ -diff --git a/src/plugins/ventex/README.md b/src/plugins/ventex/README.md -new file mode 100644 -index 00000000..3a0dc43d ---- /dev/null -+++ b/src/plugins/ventex/README.md -@@ -0,0 +1,4 @@ -+# vencord katex thing -+[forum guidelines told me to link this](https://docs.vencord.dev/installing/custom-plugins/) -+ -+renders inline codeblocks starting and ending in `$` and codeblocks with the language `latex` in TeX using KaTeX -\ No newline at end of file -diff --git a/src/plugins/ventex/index.tsx b/src/plugins/ventex/index.tsx -new file mode 100644 -index 00000000..11fc0d22 ---- /dev/null -+++ b/src/plugins/ventex/index.tsx -@@ -0,0 +1,97 @@ -+import "./katex.css"; -+ -+import { Devs } from "@utils/constants"; -+import definePlugin, { ReporterTestable } from "@utils/types"; -+import { makeLazy } from "@utils/lazy"; -+import { React, useEffect, useMemo, useState } from "@webpack/common"; -+ -+// @ts-expect-error -+export const getKatex = /* #__PURE__*/ makeLazy(async () => (await import("https://unpkg.com/katex@0.16.9/dist/katex.mjs")).default); -+ -+export function useKatex() { -+ const [katex, setKatex] = useState(); -+ useEffect(() => { -+ if (katex === undefined) -+ getKatex().then(setKatex); -+ }); -+ return katex; -+} -+ -+// @ts-expect-error -+export const getDomPurify = /* #__PURE__*/ makeLazy(async () => (await import("https://unpkg.com/dompurify@3.1.7/dist/purify.es.mjs")).default); -+ -+export function useDomPurify() { -+ const [domPurify, setDomPurify] = useState(); -+ useEffect(() => { -+ if (domPurify === undefined) -+ getDomPurify().then(setDomPurify); -+ }); -+ return domPurify; -+} -+ -+export interface HighlighterProps { -+ lang?: string; -+ content: string; -+ isPreview: boolean; -+ tempSettings?: Record; -+} -+ -+export default definePlugin({ -+ name: "KaTeX", -+ description: "TeX typesetting in discord", -+ authors: [Devs.skyevg], -+ reporterTestable: ReporterTestable.Patches, -+ -+ patches: [ -+ { -+ find: "codeBlock:{react(", -+ replacement: { -+ match: /codeBlock:\{react\((\i),(\i),(\i)\)\{/, -+ replace: "$&if($1.lang == 'latex') return $self.createBlock($1,$2,$3);" -+ } -+ }, -+ { -+ find: "inlineCode:{react:(", -+ replacement: { -+ match: /inlineCode:\{react:\((\i),(\i),(\i)\)=>/, -+ replace: "$&($1.content.startsWith('$$') && $1.content.endsWith('$$'))?$self.createInline($1,$2,$3):" -+ } -+ } -+ ], -+ start: async () => { -+ useKatex(); -+ useDomPurify(); -+ }, -+ stop: () => { -+ }, -+ -+ createBlock: (props: HighlighterProps) => ( -+ -+ ), -+ createInline: (props: HighlighterProps) => ( -+ -+ ), -+}); -+ -+function LazyLatex(props) { -+ const { formula } = props; -+ const katex = useKatex(); -+ const domPurify = useDomPurify(); -+ return katex && domPurify -+ ? -+ : {formula}; -+} -+ -+function Latex({ katex, formula, displayMode, domPurify }) { -+ const result = useMemo(() => { -+ const html = katex.renderToString(formula, { -+ displayMode, -+ throwOnError: false -+ }); -+ return domPurify.sanitize(html); -+ }, [formula, displayMode]); -+ -+ return displayMode -+ ?
-+ : ; -+} -\ No newline at end of file -diff --git a/src/plugins/ventex/katex.css b/src/plugins/ventex/katex.css -new file mode 100644 -index 00000000..fbc06b44 ---- /dev/null -+++ b/src/plugins/ventex/katex.css -@@ -0,0 +1,6 @@ -+@import url("https://unpkg.com/katex@0.16.9/dist/katex.min.css"); -+ -+.katex-display { -+ width: min-content; -+ margin: 1em; -+} -\ No newline at end of file