MikanDev Docs

website·Indexed 31 days ago

https://docs.mikn.dev

Documentation for MikanDev projects, including gh-to-gitea (GitHub mirroring), releaselink (GitHub release redirector), rssfetch (RSS parser), CustomRP (Discord Rich Presence), Doujin Game Manager, MD Chat, ShortFlare, and next-discord-auth (JWT-based Discord authentication for Next.js).

Tokens
7.3K
Snippets
31
Records
61
Agent score
57%

What's inside MikanDev

  1. Overview of Doujin Game Manager

    Doujin Game Manager (DGM) provides a management frontend and hosting system for RPG Maker games that include a web version (typically found in the www directory of the game files). It allows users to host these games on their own server to play them in a browser without needing to install the games locally.
  2. Overview of next-discord-auth for Next.js

    next-discord-auth is a JWT-based Discord authentication library specifically designed for Next.js (supporting version 15). It provides a fully server-side solution that does not require a database and returns all user data from Discord. It is compatible with both Server Actions and Route Handlers and is designed as a simpler alternative for those migrating from AuthJS.
  3. Overview of rssfetch

    rssfetch is a lightweight RSS feed fetcher and parser developed using Elysia.js and Bun. It allows users to fetch and parse RSS feeds via a simple API. A free public instance is available at rssfetch.vercel.app.
  4. Overview of releaselink

    releaselink is a download redirector for public GitHub repositories built with Elysia.js and Bun. It automatically redirects users to the appropriate release asset based on their User-Agent (macOS, Windows, Linux, Android, or iOS) and CPU architecture. If a matching asset cannot be found or the device is unidentified, it falls back to the GitHub releases page.
  5. Redirect to the latest GitHub release asset

    Use the /:user/:repo/latest endpoint to redirect a user to the correct asset from the repository's latest release based on their User-Agent and architecture. The response is a 302 redirect.
    # Example: Redirect for the latest release of mikndotdev/SiBuster
    curl -IL "http://localhost:3000/mikndotdev/SiBuster/latest"
  6. Manage and delete your personal data

    Users have the right to delete or request assistance in deleting the personal data collected about them. Data can be managed in two ways: 1. By signing into the account and visiting the account settings section to update, amend, or delete information. 2. By contacting the company directly to request access to, correction of, or deletion of personal information. Note that some information may be retained if there is a legal obligation or lawful basis to do so.
  7. Use @mikandev/next-discord-auth with Client Components

    By default, this package does not provide support for Client Components. The recommended approach is to use server components for any pages requiring authentication. If session data is required in a Client Component, you must set up a session provider route and use client-side hooks.
  8. Configure Logto as the authentication backend for MD Chat

    MD Chat uses Logto for identity and access management. You can use a self-hosted Logto instance or Logto Cloud. To integrate, create a 'Traditional Web app' in Logto with the following configuration:

    • Name: e.g., "MD Chat"
    • Redirect URI: http://(your-app-url)/callback

    Save the Client ID and Client Secret, as they are required for the MD Chat environment variables.

  9. Set up the ShortFlare Cloudflare Worker

    To deploy ShortFlare, you need a Cloudflare account with a D1 database and a Worker.

    1. Create D1 Database: Create a D1 database and add a table named urls with two text columns: slug and destination.
    2. Create Worker: Create a new Cloudflare Worker.
    3. Configure Environment Variables: In the Worker settings, add the following keys:
      • API_TOKEN: A secure token for managing URLs via API.
      • NOT_FOUND_URL: The fallback URL for invalid slugs.
      • TRACKING_API_TOKEN: A token for the analytics API.
      • TRACKING_API_URL: The endpoint for tracking visits (e.g., https://your-frontend-url/api/worker/analytics).
    4. Bind Database: Bind the D1 database to the Worker using the variable name DB.
    5. Deploy Code: Replace the index.js content with the provided ShortFlare worker implementation.
    // Example of the core worker logic for handling redirects and API calls
    export default {
      async fetch(request, env) {
        return await handleRequest(request, env);
      },
    };
    
    async function handleRequest(request, env) {
      const url = new URL(request.url);
      const path = url.pathname;
    
      if (path.startsWith("/api/")) {
        const authHeader = request.headers.get("Authorization");
        if (!authHeader || !authHeader.startsWith("Bearer ")) {
          return new Response("Unauthorized", { status: 401 });
        }
        const token = authHeader.split(" ")[1];
        if (token !== env.API_TOKEN) {
          return new Response("Unauthorized", { status: 401 });
        }
        // API routing logic follows...
      }
      return handleRedirect(request, env);
    }
  10. Deploy rssfetch to Vercel, Cloudflare Workers, or Docker

    rssfetch supports multiple deployment targets:

    • Vercel: Direct deployment is supported with no additional configuration.
    • Cloudflare Workers: Requires manual setup following the Elysia Cloudflare Workers integration guide.
    • Docker: Official images are available on GHCR (github.com/mikndotdev/rssfetch/pkgs/container/rssfetch).
  11. Retrieve the user session in Server Components

    Use the getSession function from @mikandev/next-discord-auth/server-actions to access the current user's session in server components, server actions, or route handlers. The returned Session object is AuthJS-compatible. If the session is null, the user is not authenticated.
    import { getSession } from "@mikandev/next-discord-auth/server-actions";
    import "@/auth"; // Ensure auth setup is initialized
    
    export default async function Page() {
      const session = await getSession();
    
      if (!session) {
        return <h1>You are not signed in.</h1>;
      }
    
      return <h1>Welcome, {session.user.name}!</h1>;
    }
  12. Deploy releaselink to Vercel, Cloudflare Workers, or Docker

    releaselink supports multiple deployment targets:

    • Vercel: Can be deployed directly with no additional configuration.
    • Cloudflare Workers: Requires manual setup following the Elysia Cloudflare Workers documentation.
    • Docker: Official images are available on GHCR.