diff --git a/.idea/.gitignore b/.idea/.gitignore
new file mode 100644
index 0000000..88bf7a7
--- /dev/null
+++ b/.idea/.gitignore
@@ -0,0 +1,8 @@
+# Ignore everything for IntelliJ except for project essential code-styles
+*
+
+!copyright/*
+!codeStyles/*
+!.gitignore
+
+!*/
\ No newline at end of file
diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml
new file mode 100644
index 0000000..5dcac8f
--- /dev/null
+++ b/.idea/codeStyles/Project.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/codeStyles/codeStyleConfig.xml b/.idea/codeStyles/codeStyleConfig.xml
new file mode 100644
index 0000000..79ee123
--- /dev/null
+++ b/.idea/codeStyles/codeStyleConfig.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/.vscode/.gitignore b/.vscode/.gitignore
new file mode 100644
index 0000000..95d594d
--- /dev/null
+++ b/.vscode/.gitignore
@@ -0,0 +1,6 @@
+# Ignore everything for VSCode except for project essential code-styles
+*
+
+!extensions.json
+!settings.json
+!.gitignore
\ No newline at end of file
diff --git a/.vscode/extensions.json b/.vscode/extensions.json
new file mode 100644
index 0000000..9e91c17
--- /dev/null
+++ b/.vscode/extensions.json
@@ -0,0 +1,5 @@
+{
+ "recommendations": [
+ "sarfrajansari.copyright-header-injector"
+ ]
+}
\ No newline at end of file
diff --git a/.vscode/settings.json b/.vscode/settings.json
new file mode 100644
index 0000000..e4ad59b
--- /dev/null
+++ b/.vscode/settings.json
@@ -0,0 +1,3 @@
+{
+ "copyright-header-injector.copyrightText": "/*\n * MHSF, Minehut Server List\n * All external content is rather licensed under the ECA Agreement\n * located here: https://mhsf.app/docs/legal/external-content-agreement\n *\n * All code under MHSF is licensed under the MIT License\n * by open source contributors\n *\n * Copyright (c) 2024 dvelo\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to\n * deal in the Software without restriction, including without limitation the\n * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or\n * sell copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES\n * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\n * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR\n * OTHER DEALINGS IN THE SOFTWARE.\n */"
+}
\ No newline at end of file
diff --git a/package.json b/package.json
index 6e4bba6..1c09685 100644
--- a/package.json
+++ b/package.json
@@ -25,6 +25,7 @@
"@radix-ui/react-icons": "^1.3.0",
"@radix-ui/react-menubar": "^1.1.1",
"@radix-ui/react-primitive": "^2.0.0",
+ "@radix-ui/react-select": "^2.1.2",
"@radix-ui/react-switch": "^1.1.0",
"@unocss/eslint-plugin": "^0.61.5",
"@unocss/postcss": "^0.61.5",
@@ -105,7 +106,7 @@
"react-markdown": "^9.0.1",
"react-resizable-panels": "^2.0.23",
"recharts": "^2.12.7",
- "shiki": "^1.22.2",
+ "shiki": "^1.23.0",
"tailwindcss": "^3.4.1",
"typescript": "^5",
"vaul": "^0.9.1",
diff --git a/src/app/(embeds)/embed/[server]/page.tsx b/src/app/(embeds)/embed/[server]/page.tsx
new file mode 100644
index 0000000..b2a739e
--- /dev/null
+++ b/src/app/(embeds)/embed/[server]/page.tsx
@@ -0,0 +1,39 @@
+/*
+ * MHSF, Minehut Server List
+ * All external content is rather licensed under the ECA Agreement
+ * located here: https://mhsf.app/docs/legal/external-content-agreement
+ *
+ * All code under MHSF is licensed under the MIT License
+ * by open source contributors
+ *
+ * Copyright (c) 2024 dvelo
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+import Embed from "@/components/feat/Embed";
+
+export default function EmbedPage({
+ params,
+}: {
+ params: { server: string };
+}) {
+ return ;
+}
diff --git a/src/app/(embeds)/layout.tsx b/src/app/(embeds)/layout.tsx
new file mode 100644
index 0000000..cc0b9eb
--- /dev/null
+++ b/src/app/(embeds)/layout.tsx
@@ -0,0 +1,58 @@
+/*
+ * MHSF, Minehut Server List
+ * All external content is rather licensed under the ECA Agreement
+ * located here: https://mhsf.app/docs/legal/external-content-agreement
+ *
+ * All code under MHSF is licensed under the MIT License
+ * by open source contributors
+ *
+ * Copyright (c) 2024 dvelo
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+"use client";
+
+import { TooltipProvider } from "@/components/ui/tooltip";
+import "../globals.css";
+import { ThemeProvider } from "@/components/ThemeProvider";
+import { useSearchParams } from "next/navigation";
+
+export default function RootLayout({
+ children,
+}: {
+ children: React.ReactNode;
+}) {
+ const searchParams = useSearchParams();
+ const search = searchParams?.get("theme") || "light";
+ return (
+
+
-
-
- Plan Details
-
- Information about the plan being used by the server
-
-
- {(() => {
- console.log(serverObject);
- return true;
- })()}
-
- {" "}
-
-
-
Server plan
-
- {serverObject?.expired == undefined ? (
-
- Free{" "}
-
-
-
-
-
-
-
- The plan is really unknown, but in most
- scenarios, the Minehut API returns{" "}
- undefined if the server is free.
-
-
-
+
+
+ Plan Details
+
+ Information about the plan being used by the server
+
+
+ {(() => {
+ console.log(serverObject);
+ return true;
+ })()}
+
+ {" "}
+
+
+
Server plan
+
+ {serverObject?.expired == undefined ? (
+
+ Free{" "}
+
+
+
+
+
+
+
+ The plan is really unknown, but in most
+ scenarios, the Minehut API returns{" "}
+ undefined if the server is free.
+
+
+
+ );
+}
diff --git a/src/components/feat/EmbedSelector.tsx b/src/components/feat/EmbedSelector.tsx
new file mode 100644
index 0000000..2d76a8f
--- /dev/null
+++ b/src/components/feat/EmbedSelector.tsx
@@ -0,0 +1,306 @@
+/*
+ * MHSF, Minehut Server List
+ * All external content is rather licensed under the ECA Agreement
+ * located here: https://mhsf.app/docs/legal/external-content-agreement
+ *
+ * All code under MHSF is licensed under the MIT License
+ * by open source contributors
+ *
+ * Copyright (c) 2024 dvelo
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+"use client";
+
+import { TabsContent } from "@radix-ui/react-tabs";
+import { Button } from "../ui/button";
+import { DrawerFooter, DrawerTrigger } from "../ui/drawer";
+import { Tabs, TabsList, TabsTrigger } from "../ui/tabs";
+import { useEffect, useState } from "react";
+import { codeToHtml } from "shiki";
+import { useTheme } from "next-themes";
+import { Asterisk, Copy } from "lucide-react";
+import useClipboard from "@/lib/useClipboard";
+import toast from "react-hot-toast";
+import { Checkbox } from "../ui/checkbox";
+import {
+ Select,
+ SelectContent,
+ SelectItem,
+ SelectTrigger,
+ SelectValue,
+} from "../ui/select";
+
+export default function EmbedSelector({ server }: { server: string }) {
+ const { theme, systemTheme, resolvedTheme } = useTheme();
+
+ const [embedTheme, setEmbedTheme] = useState("");
+ const [embedStatic, setEmbedStatic] = useState(false);
+ const [highlightedHtml, setHighlightedHtml] = useState("");
+ const [highlightedJsx, setHighlightedJsx] = useState("");
+ const [selectedCodeType, setSelectedCodeType] = useState("jsx");
+ const [noMinehutBranding, setNoMinehutBranding] = useState(false);
+ const clipboard = useClipboard();
+ const [url, setURL] = useState(`https://mhsf.app/embed/${server}?`);
+ const [jsxCode, setJsxCode] = useState(``);
+ const [htmlCode, setHtmlCode] = useState(``);
+
+ useEffect(() => {
+ setHtmlCode(``);
+ setJsxCode(``);
+
+ const currentTheme = theme === "system" ? systemTheme : theme;
+ const selectedTheme =
+ currentTheme === "dark" ? "vitesse-dark" : "vitesse-light";
+
+ async function highlightCode() {
+ const jsx = await codeToHtml(jsxCode, {
+ lang: "jsx",
+ theme: selectedTheme,
+ });
+ const html = await codeToHtml(htmlCode, {
+ lang: "html",
+ theme: selectedTheme,
+ });
+ setHighlightedHtml(html);
+ setHighlightedJsx(jsx);
+ }
+
+ highlightCode();
+ }, [
+ theme,
+ systemTheme,
+ jsxCode,
+ htmlCode,
+ embedStatic,
+ noMinehutBranding,
+ url,
+ ]);
+
+ const renderCode = (code: string, highlighted: string) => {
+ if (highlighted) {
+ return (
+
+ );
+ } else {
+ return (
+
• Fixed right-click context menu on the server list
-
• Fixed metadata bugs
-
-
-
- Hey! Update on statistics. Recently, we have figured out the Minehut
- API is blocked to Vercel servers (atleast the /servers{" "}
- endpoint). I'm actively trying to find a loop-hole so that statistics
- works correctly. Thank you {":)"}
-
-
-
• Fixed right-click context menu on the server list
+
• Fixed metadata bugs
+
+
+
+ Hey! Update on statistics. Recently, we have figured out the Minehut
+ API is blocked to Vercel servers (atleast the /servers{" "}
+ endpoint). I'm actively trying to find a loop-hole so that statistics
+ works correctly. Thank you {":)"}
+
+
+