diff --git a/README.md b/README.md index 5ce6766..8fa768b 100644 --- a/README.md +++ b/README.md @@ -1,22 +1,14 @@ -# create-svelte +# Suyu website -Everything you need to build a Svelte project, powered by [`create-svelte`](https://github.com/sveltejs/kit/tree/main/packages/create-svelte). +This project contains the source code for the Suyu website, found at [suyu.dev](https://suyu.dev) -## Creating a project - -If you're seeing this, you've probably already done this step. Congrats! - -```bash -# create a new project in the current directory -npm create svelte@latest - -# create a new project in my-app -npm create svelte@latest my-app -``` ## Developing +If you are deeloping, please take note of the `.env.example` & the secrets config (found at src/lib/server/secrets/secrets.example.json). +At minimum, please make sure to clone the `secrets.example.json` file and rename it to `secrets.json`. Otherwise, the project will not run or build (you don't have to edit the values to get it running, but you can if you'd like). -Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server: + +Once you've installed dependencies with `npm install` (or `pnpm install` or `yarn`), you can start a development server by running: ```bash npm run dev @@ -27,12 +19,9 @@ npm run dev -- --open ## Building -To create a production version of your app: +To create a production version of our app, you can run: ```bash npm run build ``` -You can preview the production build with `npm run preview`. - -> To deploy your app, you may need to install an [adapter](https://kit.svelte.dev/docs/adapters) for your target environment. diff --git a/src/app.pcss b/src/app.pcss index 64b0630..46ea02e 100644 --- a/src/app.pcss +++ b/src/app.pcss @@ -41,6 +41,22 @@ h3 { @apply outline-none ring-2 ring-sky-400; } +::-webkit-scrollbar { + @apply w-[8px]; +} + +::-webkit-scrollbar-track { + @apply bg-[var(--page-bg)] +} + +::-webkit-scrollbar-thumb { + @apply rounded-xl bg-[#3c4f7c] +} + +::-webkit-scrollbar-thumb:hover { + @apply bg-[#526ca8] +} + .cta-button { background: linear-gradient(0deg, rgba(0, 0, 0, 0.06), rgba(0, 0, 0, 0.06)), radial-gradient(109.26% 109.26% at 49.83% 13.37%, #ffffff 0%, #babaca 100%); diff --git a/src/assets/branding/tuta.png b/src/assets/branding/tuta.png new file mode 100644 index 0000000..63dbe1b Binary files /dev/null and b/src/assets/branding/tuta.png differ diff --git a/src/assets/fonts/suivar.ttf b/src/assets/fonts/suivar.ttf new file mode 100644 index 0000000..859db80 Binary files /dev/null and b/src/assets/fonts/suivar.ttf differ diff --git a/src/components/Card.svelte b/src/components/Card.svelte new file mode 100644 index 0000000..f013004 --- /dev/null +++ b/src/components/Card.svelte @@ -0,0 +1,78 @@ + + +
+
+ Mario Odyssey +
+
+

{title}

+
Released: {releaseYear}
+
+ Compatibility: {capitalizeFirstLetter(compatibility)} +
+
+
+ + diff --git a/src/components/CardCarousel.svelte b/src/components/CardCarousel.svelte new file mode 100644 index 0000000..dbe33c4 --- /dev/null +++ b/src/components/CardCarousel.svelte @@ -0,0 +1,283 @@ + + + + + + +
+
+ +
+ + +
go(-1)}> + +
+
+ +
+ +
go(1)}> + +
+
+ +
+
+ + diff --git a/src/components/HomepageCounter.svelte b/src/components/HomepageCounter.svelte new file mode 100644 index 0000000..68ded98 --- /dev/null +++ b/src/components/HomepageCounter.svelte @@ -0,0 +1,21 @@ + + +{#if count > 0} +
+

+ + {count}+ +

+
{subText}
+
+{/if} diff --git a/src/components/Room.svelte b/src/components/Room.svelte index 470b907..5a57fbc 100644 --- a/src/components/Room.svelte +++ b/src/components/Room.svelte @@ -52,7 +52,7 @@ {player.nickname}{#if player !== room.players[room.players.length - 1]},{" "} {/if} {/each} - {/if} | {room.hasPassword ? "Private" : "Public"} | {room.address}:{room.port} + {/if} | {room.hasPassword ? "Private" : "Public"} diff --git a/src/lib/data/strings.json b/src/lib/data/strings.json new file mode 100644 index 0000000..f799165 --- /dev/null +++ b/src/lib/data/strings.json @@ -0,0 +1,5 @@ +{ + "landingHeader": "suyu", + "landingOne": "Suyu is an open-source, Switch compatible emulator with almost full coverage of the game library.", + "landingCardHeader": "We care about preservation" +} diff --git a/src/lib/index.ts b/src/lib/index.ts new file mode 100644 index 0000000..856f2b6 --- /dev/null +++ b/src/lib/index.ts @@ -0,0 +1 @@ +// place files you want to import through the `$lib` alias in this folder. diff --git a/src/lib/server/class/Room.ts b/src/lib/server/class/Room.ts index 2852066..5c6fa5e 100644 --- a/src/lib/server/class/Room.ts +++ b/src/lib/server/class/Room.ts @@ -4,7 +4,7 @@ import type { SuyuUser } from "../schema"; import { v4 } from "uuid"; export class RoomManager { - private static rooms: Room[] = []; + static rooms: Room[] = []; static roomTimeout: Record = {}; // room id, last heard from static createRoom(room: IRoomConfig) { const existingRoom = this.rooms.find((r) => r.host.username === room.host.username); diff --git a/src/lib/util/api/index.ts b/src/lib/util/api/index.ts index 58ab377..b5c24e4 100644 --- a/src/lib/util/api/index.ts +++ b/src/lib/util/api/index.ts @@ -21,13 +21,22 @@ export async function useAuth( const decoded: IJwtData = jwt.verify(token, Buffer.from(PUBLIC_KEY), { algorithms: ["RS256"], }) as IJwtData; - const user = await userRepo.findOne({ + let user = await userRepo.findOne({ where: { apiKey: decoded.apiKey, }, loadEagerRelations: eager || false, relations: eager ? ["sentFriendRequests", "receivedFriendRequests"] : [], }); + if (!user) { + user = await userRepo.findOne({ + where: { + id: decoded.id, + }, + loadEagerRelations: eager || false, + relations: eager ? ["sentFriendRequests", "receivedFriendRequests"] : [], + }); + } return user; } const user = await userRepo.findOne({ diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index ffc066e..5bee5a2 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -142,15 +142,15 @@ }, { name: "FAQ", - href: "/coming-soon", + href: "/faq", }, { name: "Discord", href: "https://discord.gg/suyu", }, { - name: "GitLab", - href: "https://gitlab.com/suyu-emu/suyu", + name: "Git", + href: "https://git.suyu.dev/suyu/suyu", }, // { // name: $token || data.tokenCookie ? "Account" : "Sign up", @@ -290,13 +290,13 @@ > Blog Docs - FAQ + FAQ
diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte index 4af965f..7447cf2 100644 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -2,6 +2,7 @@ import embedImage from "$assets/branding/suyu__Embed-Image.png"; import type { PageData } from "./$types"; import suyuWindow from "$assets/mockups/suyuwindow.png"; + import HomepageCounter from "$components/HomepageCounter.svelte"; import { XCircleOutline } from "flowbite-svelte-icons"; import { Dialog } from "radix-svelte"; @@ -70,18 +71,15 @@

-

GitLab

+

Git

- GitLab is where all the magic of suyu happens. We're always looking for new contributors + Our Git instance is where all the magic of suyu happens. We're always looking for new contributors to help us out, so feel free to check out our code.

r.toJSON()) || []; return { - rooms: rooms, + rooms: rooms.reverse(), }; } diff --git a/src/routes/download/+page.svelte b/src/routes/download/+page.svelte new file mode 100644 index 0000000..0acb36c --- /dev/null +++ b/src/routes/download/+page.svelte @@ -0,0 +1,129 @@ + + + + + Downloading Suyu + + +
diff --git a/src/routes/faq/+page.svelte b/src/routes/faq/+page.svelte new file mode 100644 index 0000000..741b64b --- /dev/null +++ b/src/routes/faq/+page.svelte @@ -0,0 +1,53 @@ + + + + FAQ + + +
+ + + + + +

+ FAQ +

+

+ Got some questions? We got answers! +

+

Q: How is this project different from Yuzu? How do we know you won't have the same fate as Yuzu?

+

A: Unlike Yuzu, Suyu does not include many of the core "requirements" to run it. You need to legally dump your Nintendo Switch to obtain a title.keys file, which Yuzu did not do. Additionally, you must dump your own firmware.

+

Q: What is the purpose of Suyu?

+

A: The purpose of this project is to provide a free, open-source alternative to the now-dead Yuzu emulator. We believe that the community should be able to emulate their Switch device (legally) and be able to enjoy their favorite game titles.

+

Q: How can I contribute to Suyu?

+

A: You can contribute to this project by submitting a pull request on our Git page. We are always looking for new contributors to help us improve the project!

+

Q: Where can I download Suyu?

+

A: You can download the latest build of Suyu from our Git. Please make sure you are using the right URL!

+

Q: What is the current progress for Suyu?

+

A: As of 3/20/2024, we have released our first Windows binary 🎉! You can find it here. We are always trying to make more and more progress, so please feel free to join the Discord!

+
+
Email hosting lovingly provided by + + Tuta + +
+
diff --git a/src/routes/lobby/+server.ts b/src/routes/lobby/+server.ts index e14f286..bb80a7d 100644 --- a/src/routes/lobby/+server.ts +++ b/src/routes/lobby/+server.ts @@ -41,7 +41,6 @@ export async function POST({ request, getClientAddress }) { if (!token) return new Response(null, { status: 401 }); // TODO: jwt utils which type and validate automatically const user = await useAuth(token); - console.log(user); if (!user) return new Response(null, { status: 401 }); const borkedIp = getClientAddress(); const room = RoomManager.createRoom({ @@ -67,5 +66,11 @@ export async function POST({ request, getClientAddress }) { hasPassword: body.hasPassword || false, }); console.log("Room added:", JSON.stringify(room, null, 2)); + // push every room to the top which starts with `[SUYU OFFICIAL]` and was created with username "suyu" + const suyuRoom = RoomManager.rooms.find((r) => r.roomInfo.name.startsWith("[SUYU OFFICIAL]")); + if (suyuRoom && suyuRoom.host.username === "suyu") { + RoomManager.rooms.splice(RoomManager.rooms.indexOf(suyuRoom), 1); + RoomManager.rooms.unshift(suyuRoom); + } return json(room.toJSON()); } diff --git a/src/routes/lobby/[id]/+server.ts b/src/routes/lobby/[id]/+server.ts index b85cea8..16c70f9 100644 --- a/src/routes/lobby/[id]/+server.ts +++ b/src/routes/lobby/[id]/+server.ts @@ -5,6 +5,7 @@ import { useAuth } from "$lib/util/api/index.js"; /* thanks again janeberru for the shape of this data */ export async function POST({ request, params }) { const body = await request.json(); + console.log(body); const { id } = params; const room = RoomManager.getRoom(id); if (!room) return new Response(null, { status: 500 }); @@ -12,8 +13,9 @@ export async function POST({ request, params }) { if (!user) return new Response(null, { status: 401 }); if (user.id !== room.host.id) return new Response(null, { status: 401 }); if (body.players.length === 0 && room.roomInfo.owner) { - console.log(room.roomInfo.players); room.setPlayerList([{ gameId: 0, gameName: "", nickname: room.roomInfo.owner }]); + } else { + room.setPlayerList(body.players); } return json({ message: "Lobby updated successfully" }); } diff --git a/src/routes/mockup/boot/[game]/+page.server.ts b/src/routes/mockup/boot/[game]/+page.server.ts new file mode 100644 index 0000000..52cd706 --- /dev/null +++ b/src/routes/mockup/boot/[game]/+page.server.ts @@ -0,0 +1,11 @@ +import type { PageServerLoad } from "./$types"; +import { getQueriedGamesAmerica, type GameUS } from "nintendo-switch-eshop"; + +export const load: PageServerLoad = async ({ params }) => { + const games = await getQueriedGamesAmerica(params.game); + return { + props: { + games, + }, + }; +}; diff --git a/src/routes/mockup/boot/[game]/+page.svelte b/src/routes/mockup/boot/[game]/+page.svelte new file mode 100644 index 0000000..a3512f4 --- /dev/null +++ b/src/routes/mockup/boot/[game]/+page.svelte @@ -0,0 +1,150 @@ + + +
+
+ Box art for {game.title} +
+

Launching {game.title}

+

Shaders compiled: {shadersDone} / {shadersTotal}

+
+ +
+
+
+ +
+
+
+ + diff --git a/src/routes/mockup/w11/+page.svelte b/src/routes/mockup/w11/+page.svelte new file mode 100644 index 0000000..c258d80 --- /dev/null +++ b/src/routes/mockup/w11/+page.svelte @@ -0,0 +1,228 @@ + + +
+
+
+
+
+
+
+ +
+
suyu | dev-1574a6818
+
+
+ +
+
+
+
+
+ Minimize +
+
+ Maximize +
+
+ Close +
+
+
+
+ +
+
+
+
+

Disclaimer

+

+ This is a concept for suyu's launcher, made by nullptr. It is not
a true + desktop application, it is non-functional and running in
a browser. +

+
+
+
+ + diff --git a/src/routes/mockup/w11/components/Card.svelte b/src/routes/mockup/w11/components/Card.svelte new file mode 100644 index 0000000..d8aac0a --- /dev/null +++ b/src/routes/mockup/w11/components/Card.svelte @@ -0,0 +1,91 @@ + + +
+
+
+ smo +
+
+
Super Mario Odyssey
+
1.1 KB • 382 hours
+
+
+ +
+ + diff --git a/src/routes/mockup/w11/components/Sidebar.svelte b/src/routes/mockup/w11/components/Sidebar.svelte new file mode 100644 index 0000000..9b3eb6b --- /dev/null +++ b/src/routes/mockup/w11/components/Sidebar.svelte @@ -0,0 +1,193 @@ + + +