diff --git a/packages/docs/README.md b/packages/docs/README.md index 2b4c09a..63b9290 100644 --- a/packages/docs/README.md +++ b/packages/docs/README.md @@ -1,14 +1,208 @@ -# docs +# DropOut Documentation -This is a React Router application generated with -[Create Fumadocs](https://github.com/fuma-nama/fumadocs). +This is the official documentation site for DropOut Minecraft Launcher, built with [Fumadocs](https://fumadocs.dev) and React Router v7. -Run development server: +## Overview + +The documentation covers: +- **Getting Started**: Installation and first-time setup +- **Features**: Detailed guides for all launcher features +- **Architecture**: Technical design and implementation details +- **Development**: Building and contributing to DropOut +- **Troubleshooting**: Common issues and solutions + +### Multi-language Support + +The documentation is available in: +- **English** (default) - `content/docs/en/` +- **简体中文** (Simplified Chinese) - `content/docs/zh/` + +## Development + +### Prerequisites + +- Node.js 22+ +- pnpm 9+ + +### Setup + +Install dependencies: + +```bash +pnpm install +``` + +### Run Development Server ```bash -npm run dev -# or pnpm dev -# or -yarn dev ``` + +This starts the development server at `http://localhost:5173` with hot reload enabled. + +The documentation automatically supports language switching between English and Chinese. + +### Build for Production + +```bash +pnpm build +``` + +The production build will be output to the `build/` directory. + +### Type Checking + +```bash +pnpm types:check +``` + +### Linting and Formatting + +```bash +# Check code +pnpm lint + +# Format code +pnpm format +``` + +## Project Structure + +``` +packages/docs/ +├── content/ +│ └── docs/ # Documentation content (MDX) +│ ├── en/ # English documentation +│ │ ├── index.mdx +│ │ ├── getting-started.mdx +│ │ ├── architecture.mdx +│ │ ├── development.mdx +│ │ ├── troubleshooting.mdx +│ │ └── features/ +│ └── zh/ # Chinese documentation +│ ├── index.mdx +│ ├── getting-started.mdx +│ ├── architecture.mdx +│ ├── development.mdx +│ ├── troubleshooting.mdx +│ └── features/ +├── app/ # React Router app +├── public/ # Static assets +├── source.config.ts # Fumadocs configuration (i18n enabled) +└── react-router.config.ts # React Router configuration +``` + +## Internationalization (i18n) + +### Structure + +Documentation is organized by locale: +- English: `content/docs/en/` +- Chinese: `content/docs/zh/` + +Each locale has the same structure with translated content. + +### Configuration + +i18n is configured in: +- `source.config.ts`: Enables i18n support +- `app/lib/source.ts`: Defines available languages and default + +### Adding a New Language + +1. Create a new directory: `content/docs/{locale}/` +2. Copy the structure from `en/` or `zh/` +3. Translate all `.mdx` files +4. Update `meta.json` files with translated titles +5. Add the language to `app/lib/source.ts` + +## Writing Documentation + +### MDX Format + +All documentation is written in MDX (Markdown with JSX): + +```mdx +--- +title: Page Title +description: Page description for SEO +--- + +# Page Title + +Content goes here... + + + + +``` + +### Available Components + +Fumadocs provides several components: + +- `` - Link cards +- `` - Card container +- `` - Info/warning boxes +- `` - Tabbed content +- `` - Numbered steps +- Code blocks with syntax highlighting + +### Adding New Pages + +1. Create new `.mdx` file in `content/docs/{locale}/` +2. Add frontmatter with title and description +3. Write content using MDX +4. Update `meta.json` to include the page +5. Repeat for all supported languages +6. Test locally with `pnpm dev` + +### Translation Guidelines + +When translating content: +- Keep all code blocks in English +- Translate frontmatter (title, description) +- Keep technical terms (Tauri, Rust, Svelte, etc.) in English +- Translate UI elements and descriptions +- Keep all links and URLs unchanged +- Maintain the same structure and formatting + +### Organizing Content + +Use `meta.json` files to organize navigation: + +```json +{ + "title": "Section Title", + "pages": [ + "page1", + "page2", + { + "title": "Subsection", + "pages": ["sub1", "sub2"] + } + ] +} +``` + +## Deployment + +The documentation is automatically deployed when changes are merged to the main branch. + +## Contributing + +1. Fork the repository +2. Create a feature branch +3. Make your changes (in all supported languages) +4. Test locally +5. Submit a pull request + +## Links + +- [DropOut Repository](https://github.com/HydroRoll-Team/DropOut) +- [Fumadocs](https://fumadocs.dev) +- [React Router](https://reactrouter.com) + +## License + +MIT License - see the main repository for details. diff --git a/packages/docs/app/docs/page.tsx b/packages/docs/app/docs/page.tsx index 2618989..a9e3433 100644 --- a/packages/docs/app/docs/page.tsx +++ b/packages/docs/app/docs/page.tsx @@ -1,51 +1,58 @@ import type { Route } from './+types/page'; +import defaultMdxComponents from 'fumadocs-ui/mdx'; import { DocsLayout } from 'fumadocs-ui/layouts/docs'; -import { DocsBody, DocsDescription, DocsPage, DocsTitle } from 'fumadocs-ui/layouts/docs/page'; +import { DocsPage, DocsBody, DocsDescription, DocsTitle } from 'fumadocs-ui/page'; +import { Card, Cards } from 'fumadocs-ui/components/card'; import { source } from '@/lib/source'; -import defaultMdxComponents from 'fumadocs-ui/mdx'; -import browserCollections from 'fumadocs-mdx:collections/browser'; +import { i18n } from '@/lib/i18n'; import { baseOptions } from '@/lib/layout.shared'; import { useFumadocsLoader } from 'fumadocs-core/source/client'; +import browserCollections from 'fumadocs-mdx:collections/browser'; export async function loader({ params }: Route.LoaderArgs) { - const slugs = params['*'].split('/').filter((v) => v.length > 0); - const page = source.getPage(slugs); - if (!page) throw new Response('Not found', { status: 404 }); + // 从路由参数获取语言,如果没有则使用默认语言 + // URL 格式: /docs/getting-started (默认语言 zh) + // URL 格式: /en/docs/getting-started (英语) + const lang = (params.lang && i18n.languages.includes(params.lang as any)) + ? (params.lang as 'zh' | 'en') + : (i18n.defaultLanguage as 'zh' | 'en'); + + // 获取文档路径 slugs + const slugs = params['*']?.split('/').filter((v) => v.length > 0) || []; + + const page = source.getPage(slugs, lang); + + if (!page) { + throw new Response('Not found', { status: 404 }); + } return { path: page.path, - pageTree: await source.serializePageTree(source.getPageTree()), + pageTree: await source.serializePageTree(source.getPageTree(lang)), + lang, }; } const clientLoader = browserCollections.docs.createClientLoader({ - component( - { toc, frontmatter, default: Mdx }, - // you can define props for the `` component - props?: { - className?: string; - }, - ) { + component({ toc, frontmatter, default: Mdx }) { return ( - - {frontmatter.title} - + {frontmatter.title} {frontmatter.description} - + ); }, }); -export default function Page({ loaderData }: Route.ComponentProps) { - const { path, pageTree } = useFumadocsLoader(loaderData); +export default function Page({ loaderData, params }: Route.ComponentProps) { + const { pageTree, lang } = useFumadocsLoader(loaderData); return ( - - {clientLoader.useContent(path)} + + {clientLoader.useContent(loaderData.path)} ); } diff --git a/packages/docs/app/docs/search.ts b/packages/docs/app/docs/search.ts index 9603c72..a98edd5 100644 --- a/packages/docs/app/docs/search.ts +++ b/packages/docs/app/docs/search.ts @@ -3,8 +3,11 @@ import { createFromSource } from 'fumadocs-core/search/server'; import { source } from '@/lib/source'; const server = createFromSource(source, { - // https://docs.orama.com/docs/orama-js/supported-languages - language: 'english', + localeMap: { + zh: { + language: 'english', + }, + }, }); export async function loader({ request }: Route.LoaderArgs) { diff --git a/packages/docs/app/lib/i18n.ts b/packages/docs/app/lib/i18n.ts new file mode 100644 index 0000000..a9f18b1 --- /dev/null +++ b/packages/docs/app/lib/i18n.ts @@ -0,0 +1,8 @@ +import { defineI18n } from 'fumadocs-core/i18n'; + +export const i18n = defineI18n({ + defaultLanguage: 'zh', + languages: ['zh', 'en'], + hideLocale: 'default-locale', + parser: 'dir', // 使用目录结构 (content/zh/*, content/en/*) +}); diff --git a/packages/docs/app/lib/layout.shared.tsx b/packages/docs/app/lib/layout.shared.tsx index af2b6f0..6e90ba0 100644 --- a/packages/docs/app/lib/layout.shared.tsx +++ b/packages/docs/app/lib/layout.shared.tsx @@ -1,9 +1,24 @@ import type { BaseLayoutProps } from 'fumadocs-ui/layouts/shared'; +import { i18n } from './i18n'; -export function baseOptions(): BaseLayoutProps { +export function baseOptions(locale: string): BaseLayoutProps { + // 默认语言(zh)不显示前缀,其他语言显示前缀 + const isDefaultLocale = locale === i18n.defaultLanguage; + const localePrefix = isDefaultLocale ? '' : `/${locale}`; + return { + i18n, nav: { - title: 'React Router', + title: 'DropOut', + url: localePrefix || '/', }, + githubUrl: 'https://github.com/HydroRoll-Team/DropOut', + links: [ + { + type: 'main', + text: locale === 'zh' ? '文档' : 'Documentation', + url: `${localePrefix}/docs`, + }, + ], }; } diff --git a/packages/docs/app/lib/source.ts b/packages/docs/app/lib/source.ts index 97cf767..bce9bf9 100644 --- a/packages/docs/app/lib/source.ts +++ b/packages/docs/app/lib/source.ts @@ -1,7 +1,12 @@ import { loader } from 'fumadocs-core/source'; import { docs } from 'fumadocs-mdx:collections/server'; +import { i18n } from './i18n'; export const source = loader({ source: docs.toFumadocsSource(), baseUrl: '/docs', + i18n, + // hideLocale: 'default-locale' 会自动生成正确的 URL: + // - 默认语言 (zh): /docs/getting-started + // - 其他语言 (en): /en/docs/getting-started }); diff --git a/packages/docs/app/root.tsx b/packages/docs/app/root.tsx index 08b8aa8..9032c80 100644 --- a/packages/docs/app/root.tsx +++ b/packages/docs/app/root.tsx @@ -1,15 +1,30 @@ import { isRouteErrorResponse, + Link, Links, Meta, Outlet, Scripts, ScrollRestoration, + useParams, } from 'react-router'; import { RootProvider } from 'fumadocs-ui/provider/react-router'; import type { Route } from './+types/root'; import './app.css'; +import { defineI18nUI } from 'fumadocs-ui/i18n'; +import { i18n } from './lib/i18n'; +const { provider } = defineI18nUI(i18n, { + translations: { + en: { + displayName: 'English', + }, + zh: { + displayName: '中文', + search: '查找文档', + }, + }, +}); export const links: Route.LinksFunction = () => [ { rel: 'preconnect', href: 'https://fonts.googleapis.com' }, { @@ -24,8 +39,10 @@ export const links: Route.LinksFunction = () => [ ]; export function Layout({ children }: { children: React.ReactNode }) { + const { lang = i18n.defaultLanguage } = useParams(); + return ( - + @@ -33,7 +50,7 @@ export function Layout({ children }: { children: React.ReactNode }) { - {children} + {children} @@ -60,13 +77,27 @@ export function ErrorBoundary({ error }: Route.ErrorBoundaryProps) { } return ( -
-

{message}

-

{details}

+
+

+ {message} +

+

{details}

+

+ Sorry, we couldn't find the page you're looking for. It might have been moved or deleted. +

+ + Return Home / 返回首页 + {stack && ( -
-          {stack}
-        
+
+

Error Stack

+
+            {stack}
+          
+
)}
); diff --git a/packages/docs/app/routes.ts b/packages/docs/app/routes.ts index 60dd630..2997ecf 100644 --- a/packages/docs/app/routes.ts +++ b/packages/docs/app/routes.ts @@ -1,7 +1,16 @@ -import { index, route, type RouteConfig } from '@react-router/dev/routes'; +import { route, type RouteConfig } from '@react-router/dev/routes'; export default [ - index('routes/home.tsx'), - route('docs/*', 'docs/page.tsx'), - route('api/search', 'docs/search.ts'), + // Home routes: / and /:lang + route(':lang?', 'routes/home.tsx', { id: 'home' }), + + // Docs routes: /docs/* and /:lang/docs/* + route(':lang?/docs', 'routes/docs.tsx', { id: 'docs' }), + route(':lang?/docs/*', 'docs/page.tsx', { id: 'docs-page' }), + + // API routes + route('api/search', 'docs/search.ts', { id: 'api-search' }), + + // Catch-all 404 + route('*', 'routes/not-found.tsx', { id: 'not-found' }), ] satisfies RouteConfig; diff --git a/packages/docs/app/routes/docs.tsx b/packages/docs/app/routes/docs.tsx new file mode 100644 index 0000000..5154d27 --- /dev/null +++ b/packages/docs/app/routes/docs.tsx @@ -0,0 +1,16 @@ +import type { Route } from './+types/docs'; +import { redirect } from 'react-router'; + +import { i18n } from '@/lib/i18n'; + +export function loader({ params }: Route.LoaderArgs) { + const lang = params.lang as string | undefined; + + // 如果没有语言参数或是默认语言,重定向到 /docs/getting-started + if (!lang || lang === i18n.defaultLanguage) { + return redirect('/docs/getting-started'); + } + + // 其他语言重定向到 /:lang/docs/getting-started + return redirect(`/${lang}/docs/getting-started`); +} diff --git a/packages/docs/app/routes/home.tsx b/packages/docs/app/routes/home.tsx index 7f03ba9..66b5333 100644 --- a/packages/docs/app/routes/home.tsx +++ b/packages/docs/app/routes/home.tsx @@ -1,29 +1,172 @@ import type { Route } from './+types/home'; import { HomeLayout } from 'fumadocs-ui/layouts/home'; -import { Link } from 'react-router'; import { baseOptions } from '@/lib/layout.shared'; +import { i18n } from '@/lib/i18n'; -export function meta({}: Route.MetaArgs) { +const texts = { + en: { + hero: { + title: 'DropOut Minecraft Launcher', + subtitle: 'Modern. Reproducible. Developer-Grade.', + description: 'Built with Tauri v2 and Rust for native performance and minimal resource usage', + start: 'Get Started', + features: 'Features', + }, + features: { + items: [ + { title: 'High Performance', desc: 'Built with Rust and Tauri for minimal resource usage and fast startup times' }, + { title: 'Modern UI', desc: 'Clean, distraction-free interface with Svelte 5 and Tailwind CSS 4' }, + { title: 'Secure Auth', desc: 'Microsoft OAuth 2.0 with device code flow and offline mode support' }, + { title: 'Mod Loaders', desc: 'Built-in support for Fabric and Forge with automatic version management' }, + { title: 'Java Management', desc: 'Auto-detection and integrated downloader for Adoptium JDK/JRE' }, + { title: 'Instance System', desc: 'Isolated game environments with independent configs and mods' }, + ] + }, + why: { + title: 'Why DropOut?', + items: [ + { q: 'Your instance worked yesterday but broke today?', a: '→ DropOut makes it traceable.' }, + { q: 'Sharing a modpack means zipping gigabytes?', a: '→ DropOut shares exact dependency manifests.' }, + { q: 'Java, loader, mods, configs drift out of sync?', a: '→ DropOut locks them together.' }, + ] + }, + cta: { + title: 'Ready to get started?', + desc: 'Check out the documentation to learn more about DropOut', + button: 'Read the Docs', + } + }, + zh: { + hero: { + title: 'DropOut Minecraft 启动器', + subtitle: '现代、可复现、开发者级', + description: '基于 Tauri v2 和 Rust 构建,拥有原生性能和极低的资源占用', + start: '开始使用', + features: '功能特性', + }, + features: { + items: [ + { title: '高性能', desc: '使用 Rust 和 Tauri 构建,资源占用最小,启动速度极快' }, + { title: '现代化界面', desc: '简洁、无干扰的界面,使用 Svelte 5 和 Tailwind CSS 4' }, + { title: '安全认证', desc: '支持微软 OAuth 2.0 设备代码流和离线模式' }, + { title: '模组支持', desc: '内置 Fabric 和 Forge 支持,自动管理版本' }, + { title: 'Java 管理', desc: '自动检测并集成 Adoptium JDK/JRE 下载器' }, + { title: '实例系统', desc: '独立的游戏环境,独立的配置和模组' }, + ] + }, + why: { + title: '为什么选择 DropOut?', + items: [ + { q: '你的实例昨天还能用,今天就坏了?', a: '→ DropOut 让它可追溯。' }, + { q: '分享模组包意味着打包数GB的文件?', a: '→ DropOut 分享精确的依赖清单。' }, + { q: 'Java、加载器、模组、配置不同步?', a: '→ DropOut 将它们锁定在一起。' }, + ] + }, + cta: { + title: '准备好开始了?', + desc: '查看文档以了解更多关于 DropOut 的信息', + button: '阅读文档', + } + } +}; + +export function meta({ params }: Route.MetaArgs) { return [ - { title: 'New React Router App' }, - { name: 'description', content: 'Welcome to React Router!' }, + { title: 'DropOut - Modern Minecraft Launcher' }, + { name: 'description', content: 'A modern, reproducible, and developer-grade Minecraft launcher built with Tauri v2 and Rust.' }, ]; } -export default function Home() { +export default function Home({ params }: Route.ComponentProps) { + const lang = (params.lang as 'en' | 'zh') || i18n.defaultLanguage; + const t = texts[lang]; + + // 默认语言(zh)不显示前缀,其他语言显示前缀 + const isDefaultLocale = lang === i18n.defaultLanguage; + const localePrefix = isDefaultLocale ? '' : `/${lang}`; + return ( - -
-

Fumadocs on React Router.

-

- The truly flexible docs framework on React.js. -

- - Open Docs - + +
+ {/* Hero Section */} +
+

+ {t.hero.title} +

+

+ {t.hero.subtitle} +

+

+ {t.hero.description} +

+ +
+ + {/* Launcher Showcase */} +
+
+ DropOut Launcher Interface +
+
+ + {/* Features Grid */} +
+ {t.features.items.map((item, i) => ( +
+

{item.title}

+

+ {item.desc} +

+
+ ))} +
+ + {/* Why DropOut Section */} +
+

{t.why.title}

+
+ {t.why.items.map((item, i) => ( +
+

+ {item.q} +
+ {item.a} +

+
+ ))} +
+
+ + {/* CTA Section */} +
+

{t.cta.title}

+

+ {t.cta.desc} +

+ + {t.cta.button} + +
); diff --git a/packages/docs/app/routes/not-found.tsx b/packages/docs/app/routes/not-found.tsx new file mode 100644 index 0000000..1d9e041 --- /dev/null +++ b/packages/docs/app/routes/not-found.tsx @@ -0,0 +1,7 @@ +export function loader() { + throw new Response('Not Found', { status: 404 }); +} + +export default function NotFound() { + return null; +} diff --git a/packages/docs/content/docs/index.mdx b/packages/docs/content/docs/index.mdx deleted file mode 100644 index 6c2e629..0000000 --- a/packages/docs/content/docs/index.mdx +++ /dev/null @@ -1,32 +0,0 @@ ---- -title: Hello World -description: | - Your first `document` - You'll love it! ---- - -Hey there! Fumadocs is the docs framework that also works on React Router! - -## Heading - -Hello World - - - - - - -```ts -console.log('I love React!'); -``` - -### Heading - -#### Heading - -| Head | Description | -| ------------------------------- | ----------------------------------- | -| `hello` | Hello World | -| very **important** | Hey | -| _Surprisingly_ | Fumadocs | -| very long text that looks weird | hello world hello world hello world | diff --git a/packages/docs/content/docs/meta.json b/packages/docs/content/docs/meta.json deleted file mode 100644 index bc00362..0000000 --- a/packages/docs/content/docs/meta.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "pages": ["index", "..."] -} diff --git a/packages/docs/content/docs/test.mdx b/packages/docs/content/docs/test.mdx deleted file mode 100644 index cac4d26..0000000 --- a/packages/docs/content/docs/test.mdx +++ /dev/null @@ -1,24 +0,0 @@ ---- -title: Test -description: A document to test Fumadocs ---- - -Hey there! - -## Cards - - - - - - -### CodeBlock - -```js -console.log('Hello World'); -``` - -#### List - -- Hello -- World diff --git a/packages/docs/content/en/architecture.mdx b/packages/docs/content/en/architecture.mdx new file mode 100644 index 0000000..5f55c5e --- /dev/null +++ b/packages/docs/content/en/architecture.mdx @@ -0,0 +1,281 @@ +--- +title: Architecture +description: Technical architecture and design of DropOut Minecraft Launcher +--- + +# Architecture + +DropOut is built with a modern tech stack designed for performance, security, and cross-platform compatibility. + +## Technology Stack + +### Backend (Rust) +- **Framework**: Tauri v2 +- **Language**: Rust (Edition 2021) +- **Async Runtime**: Tokio +- **HTTP Client**: reqwest with native-tls + +### Frontend (Svelte) +- **Framework**: Svelte 5 (with runes) +- **Styling**: Tailwind CSS 4 +- **Build Tool**: Vite with Rolldown +- **Package Manager**: pnpm + +### Documentation +- **Framework**: Fumadocs with React Router v7 +- **Content**: MDX files +- **Styling**: Tailwind CSS 4 + +## System Architecture + +``` +┌─────────────────────────────────────────────────────────┐ +│ Frontend (Svelte 5) │ +│ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌─────────┐ │ +│ │ Stores │ │Components│ │ UI Views │ │Particles│ │ +│ └────┬─────┘ └────┬─────┘ └────┬─────┘ └────┬────┘ │ +│ │ │ │ │ │ +│ └─────────────┴─────────────┴──────────────┘ │ +│ │ │ +│ Tauri Commands │ +│ Events/Emitters │ +└──────────────────────────┬──────────────────────────────┘ + │ +┌──────────────────────────┴──────────────────────────────┐ +│ Backend (Rust/Tauri) │ +│ ┌─────────────────────────────────────────────────┐ │ +│ │ main.rs (Commands) │ │ +│ └──────────────┬──────────────────────────────────┘ │ +│ │ │ +│ ┌──────────────┴───────────────────────────────┐ │ +│ │ Core Modules │ │ +│ │ ┌──────┐ ┌────────┐ ┌──────┐ ┌──────────┐ │ │ +│ │ │ Auth │ │Download│ │ Java │ │ Instance │ │ │ +│ │ └──────┘ └────────┘ └──────┘ └──────────┘ │ │ +│ │ ┌──────┐ ┌────────┐ ┌──────┐ ┌──────────┐ │ │ +│ │ │Fabric│ │ Forge │ │Config│ │Manifest │ │ │ +│ │ └──────┘ └────────┘ └──────┘ └──────────┘ │ │ +│ └──────────────────────────────────────────────┘ │ +│ │ +│ ┌─────────────────────────────────────────────────┐ │ +│ │ Utils & Helpers │ │ +│ │ • ZIP extraction • Path utilities │ │ +│ └─────────────────────────────────────────────────┘ │ +└──────────────────────────┬──────────────────────────────┘ + │ + External APIs + │ + ┌──────────────────┼──────────────────┐ + │ │ │ + ┌─────┴────┐ ┌──────┴─────┐ ┌──────┴─────┐ + │ Mojang │ │ Fabric │ │ Forge │ + │ APIs │ │ Meta │ │ Maven │ + └──────────┘ └────────────┘ └────────────┘ +``` + +## Core Components + +### Frontend State Management + +DropOut uses **Svelte 5 runes** for reactive state management: + +```typescript +// stores/auth.svelte.ts +export class AuthState { + currentAccount = $state(null); // Reactive + isLoginModalOpen = $state(false); + + $effect(() => { // Side effects + // Auto-runs when dependencies change + }); +} +``` + +**Key Stores:** +- `auth.svelte.ts`: Authentication state and login flow +- `settings.svelte.ts`: Launcher settings and Java detection +- `game.svelte.ts`: Game running state and logs +- `instances.svelte.ts`: Instance management +- `ui.svelte.ts`: UI state (toasts, modals, active view) + +### Backend Architecture + +#### Command Pattern +All Tauri commands follow this structure: + +```rust +#[tauri::command] +async fn command_name( + window: Window, + state: State<'_, SomeState>, + param: Type, +) -> Result { + emit_log!(window, "Status message"); + // Async logic + Ok(result) +} +``` + +#### Event Communication + +**Rust → Frontend (Progress Updates):** +```rust +window.emit("launcher-log", "Downloading...")?; +window.emit("download-progress", progress_struct)?; +``` + +**Frontend → Rust (Commands):** +```typescript +import { invoke } from "@tauri-apps/api/core"; +const result = await invoke("start_game", { versionId: "1.20.4" }); +``` + +### Core Modules + +#### Authentication (`core/auth.rs`) +- **Microsoft OAuth 2.0**: Device Code Flow +- **Offline Authentication**: Local UUID generation +- **Token Management**: Refresh token storage and auto-refresh +- **Xbox Live Integration**: Full authentication chain + +**Authentication Flow:** +1. Device Code Request → MS Token +2. Xbox Live Authentication +3. XSTS Authorization +4. Minecraft Token Exchange +5. Profile Fetching + +#### Downloader (`core/downloader.rs`) +- **Concurrent Downloads**: Configurable thread pool +- **Resume Support**: `.part` and `.part.meta` files +- **Multi-segment Downloads**: Large files split into chunks +- **Checksum Verification**: SHA1/SHA256 validation +- **Progress Tracking**: Real-time events to frontend + +#### Java Management (`core/java.rs`) +- **Auto-detection**: Scans system paths +- **Adoptium Integration**: Download JDK/JRE on-demand +- **Catalog Caching**: 24-hour cache for version lists +- **Installation**: Extracts to app data directory +- **Cancellation**: Atomic flag for download cancellation + +#### Fabric Support (`core/fabric.rs`) +- **Meta API Integration**: Fetch loader versions +- **Profile Generation**: Creates version JSON +- **Library Resolution**: Maven artifact handling + +#### Forge Support (`core/forge.rs`) +- **Installer Execution**: Runs Forge installer +- **Profile Parsing**: Extracts install profile +- **Library Management**: Handles Forge-specific libraries + +#### Instance System (`core/instance.rs`) +- **Isolation**: Separate directories per instance +- **Configuration**: Per-instance settings +- **Mod Management**: Instance-specific mods +- **Version Locking**: Reproducible environments + +#### Version Management +- **Manifest Parsing** (`manifest.rs`): Mojang version manifest +- **Inheritance System** (`version_merge.rs`): Parent version merging +- **Game Version** (`game_version.rs`): JSON parsing and validation +- **Rules Engine** (`rules.rs`): OS/feature conditional logic + +### File Structure + +``` +~/.local/share/com.dropout.launcher/ (Linux) +~/Library/Application Support/com.dropout.launcher/ (macOS) +%APPDATA%/com.dropout.launcher/ (Windows) +├── versions/ +│ └── / +│ ├── .json +│ ├── .jar +│ └── natives/ +├── libraries/ +│ └── / +├── assets/ +│ ├── indexes/ +│ └── objects/ +├── instances/ +│ └── / +│ ├── mods/ +│ ├── config/ +│ └── saves/ +├── java/ +│ └── / +├── config.json +└── accounts.json +``` + +## Data Flow + +### Game Launch Sequence + +1. **Frontend**: User clicks "Launch Game" +2. **Command**: `start_game(version_id)` invoked +3. **Backend Processing**: + - Load version JSON (with inheritance) + - Resolve all libraries + - Download missing assets + - Extract native libraries + - Build classpath + - Construct JVM arguments + - Replace placeholders +4. **Process Spawn**: Launch Java with arguments +5. **Stream Logs**: Emit stdout/stderr to frontend +6. **Monitor**: Track game process status + +### Download Flow + +1. **Queue Creation**: List of files to download +2. **Concurrent Processing**: Semaphore-limited threads +3. **Resume Check**: Verify existing `.part` files +4. **Download**: Multi-segment for large files +5. **Verification**: Checksum validation +6. **Progress Events**: Real-time updates to UI +7. **Completion**: Move from `.part` to final location + +### Authentication Flow + +1. **Device Code Request**: Get user code + device code +2. **User Authorization**: User visits URL and enters code +3. **Token Polling**: Frontend polls for completion +4. **Token Exchange**: MS token → Xbox → XSTS → Minecraft +5. **Profile Fetch**: Get username and UUID +6. **Storage**: Save account with refresh token +7. **Auto-refresh**: Background token refresh on expiry + +## Platform-Specific Considerations + +### Linux +- Uses GTK WebView (`webkit2gtk`) +- System Java detection from `/usr/lib/jvm` +- Desktop file integration + +### macOS +- Uses system WebKit +- App bundle structure +- Keychain integration for secure storage + +### Windows +- Uses WebView2 runtime +- Registry Java detection +- MSI installer support +- No console window in release builds + +## Performance Optimizations + +- **Concurrent Downloads**: Parallel asset/library downloads +- **Lazy Loading**: Load version manifests on-demand +- **Caching**: Java catalog, version manifests +- **Native Code**: Rust for CPU-intensive operations +- **Async I/O**: Tokio for non-blocking operations + +## Security Features + +- **Token Encryption**: Secure storage of auth tokens +- **HTTPS Only**: All external API calls +- **Checksum Validation**: File integrity verification +- **Sandboxed Execution**: Tauri security model +- **No Arbitrary Code**: No eval or dynamic code execution diff --git a/packages/docs/content/en/development.mdx b/packages/docs/content/en/development.mdx new file mode 100644 index 0000000..8ff2906 --- /dev/null +++ b/packages/docs/content/en/development.mdx @@ -0,0 +1,546 @@ +--- +title: Development Guide +description: Build, test, and contribute to DropOut +--- + +# Development Guide + +This guide will help you set up a development environment, build DropOut from source, and contribute to the project. + +## Prerequisites + +### Required Software + +1. **Rust** (latest stable) + ```bash + # Install via rustup + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh + ``` + +2. **Node.js** (v22+) and **pnpm** (v9+) + ```bash + # Install Node.js from https://nodejs.org/ + # Install pnpm + npm install -g pnpm@9 + ``` + +3. **System Dependencies** + + Follow the [Tauri Prerequisites](https://v2.tauri.app/start/prerequisites/) for your platform: + + **Linux (Debian/Ubuntu):** + ```bash + sudo apt update + sudo apt install libwebkit2gtk-4.1-dev \ + build-essential \ + curl \ + wget \ + file \ + libssl-dev \ + libayatana-appindicator3-dev \ + librsvg2-dev + ``` + + **macOS:** + ```bash + xcode-select --install + ``` + + **Windows:** + - Install [Microsoft Visual C++ Build Tools](https://visualstudio.microsoft.com/visual-cpp-build-tools/) + - Install [WebView2](https://developer.microsoft.com/microsoft-edge/webview2/) + +## Getting Started + +### Clone the Repository + +```bash +git clone https://github.com/HydroRoll-Team/DropOut.git +cd DropOut +``` + +### Install Dependencies + +**Frontend dependencies:** +```bash +cd packages/ui +pnpm install +cd ../.. +``` + +**Documentation dependencies:** +```bash +cd packages/docs +pnpm install +cd ../.. +``` + +### Development Mode + +Run DropOut in development mode with hot reload: + +```bash +cargo tauri dev +``` + +This will: +1. Start the frontend dev server (Vite on port 5173) +2. Compile the Rust backend +3. Open the Tauri window +4. Enable hot reload for frontend changes +5. Recompile on Rust file changes + +**Terminal output:** +- Frontend logs from Vite +- Rust stdout/stderr +- Compilation status + +### Building for Production + +Build release binaries: + +```bash +cargo tauri build +``` + +**Output locations:** +- **Linux**: `src-tauri/target/release/bundle/` + - `.deb` package + - `.AppImage` bundle +- **macOS**: `src-tauri/target/release/bundle/` + - `.dmg` installer + - `.app` bundle +- **Windows**: `src-tauri/target/release/bundle/` + - `.msi` installer + - `.exe` executable + +## Project Structure + +``` +DropOut/ +├── src-tauri/ # Rust backend +│ ├── src/ +│ │ ├── main.rs # Tauri commands & entry point +│ │ ├── core/ # Core modules +│ │ │ ├── auth.rs # Authentication +│ │ │ ├── downloader.rs # Download manager +│ │ │ ├── fabric.rs # Fabric support +│ │ │ ├── forge.rs # Forge support +│ │ │ ├── java.rs # Java management +│ │ │ ├── instance.rs # Instance system +│ │ │ └── ... +│ │ └── utils/ # Utilities +│ └── Cargo.toml +├── packages/ +│ ├── ui/ # Svelte 5 frontend +│ │ ├── src/ +│ │ │ ├── App.svelte +│ │ │ ├── components/ +│ │ │ ├── stores/ # State management +│ │ │ └── lib/ +│ │ └── package.json +│ └── docs/ # Documentation site +│ ├── content/docs/ +│ └── package.json +├── .github/ +│ └── workflows/ # CI/CD pipelines +└── scripts/ # Build scripts +``` + +## Development Workflows + +### Frontend Development + +**Start dev server:** +```bash +cd packages/ui +pnpm dev +``` + +**Type checking:** +```bash +pnpm check +``` + +**Linting:** +```bash +pnpm lint +``` + +**Formatting:** +```bash +pnpm format +``` + +### Backend Development + +**Run Rust tests:** +```bash +cargo test +``` + +**Check code:** +```bash +cargo check +``` + +**Format code:** +```bash +cargo fmt +``` + +**Lint code:** +```bash +cargo clippy +``` + +### Documentation Development + +**Start docs dev server:** +```bash +cd packages/docs +pnpm dev +``` + +**Build docs:** +```bash +pnpm build +``` + +**Type check:** +```bash +pnpm types:check +``` + +## Code Style + +### Rust + +Follow standard Rust conventions: +- Use `cargo fmt` for formatting +- Use `cargo clippy` for linting +- Write documentation comments (`///`) +- Handle errors properly +- Use async/await for I/O + +**Example:** +```rust +/// Starts the Microsoft authentication device flow +#[tauri::command] +async fn start_microsoft_login( + window: Window, +) -> Result { + emit_log!(window, "Starting Microsoft login..."); + + start_device_flow() + .await + .map_err(|e| e.to_string()) +} +``` + +### TypeScript/Svelte + +Follow the project's conventions: +- Use Svelte 5 runes (`$state`, `$effect`) +- Prefer TypeScript over JavaScript +- Use Biome for formatting and linting +- Follow component structure + +**Example:** +```typescript +// stores/auth.svelte.ts +export class AuthState { + currentAccount = $state(null); + isLoginModalOpen = $state(false); + + async login(username: string) { + const account = await invoke('offline_login', { username }); + this.currentAccount = account; + } +} +``` + +## Testing + +### Unit Tests + +**Rust:** +```rust +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_generate_offline_uuid() { + let uuid = generate_offline_uuid("Player"); + assert!(uuid.len() > 0); + } +} +``` + +**Run:** +```bash +cargo test +``` + +### Integration Tests + +Test the full application: +1. Build in dev mode: `cargo tauri dev` +2. Manually test features +3. Check console for errors +4. Verify UI behavior + +### CI Tests + +GitHub Actions runs tests on: +- Ubuntu (latest) +- Arch Linux (Wayland) +- Windows (latest) +- macOS (ARM64) + +View workflow: `.github/workflows/test.yml` + +## Debugging + +### Frontend Debugging + +1. Open DevTools in Tauri window: `Ctrl+Shift+I` (Windows/Linux) or `Cmd+Option+I` (macOS) +2. Check Console for errors +3. Use React DevTools or Svelte DevTools +4. Monitor Network tab for API calls + +### Backend Debugging + +**Print debugging:** +```rust +emit_log!(window, format!("Debug: {}", value)); +println!("Debug: {}", value); +``` + +**Rust debugger:** +```bash +# Install rust-lldb or rust-gdb +cargo install rust-gdb + +# Debug +rust-gdb target/debug/dropout +``` + +### Logging + +**Frontend:** +```typescript +console.log("Info message"); +console.error("Error message"); +``` + +**Backend:** +```rust +emit_log!(window, "Status update"); +eprintln!("Error: {}", error); +``` + +## Contributing + +### Contribution Workflow + +1. **Fork** the repository +2. **Create** a feature branch: + ```bash + git checkout -b feature/my-feature + ``` +3. **Make** your changes +4. **Test** thoroughly +5. **Commit** with conventional commits: + ```bash + git commit -m "feat: add new feature" + ``` +6. **Push** to your fork: + ```bash + git push origin feature/my-feature + ``` +7. **Create** a pull request + +### Commit Messages + +Follow [Conventional Commits](https://www.conventionalcommits.org/): + +**Format:** +``` +[scope]: + +[optional body] + +[optional footer] +``` + +**Types:** +- `feat`: New feature +- `fix`: Bug fix +- `docs`: Documentation +- `style`: Formatting +- `refactor`: Code restructuring +- `perf`: Performance improvement +- `test`: Adding tests +- `chore`: Maintenance + +**Examples:** +```bash +feat(auth): add offline authentication support +fix(java): resolve detection on Windows +docs: update installation guide +refactor(download): simplify progress tracking +``` + +### Pull Request Guidelines + +**Before submitting:** +- [ ] Code follows style guidelines +- [ ] Tests pass locally +- [ ] Documentation updated if needed +- [ ] No unnecessary files committed +- [ ] Commit messages are clear + +**PR Description:** +- Explain what and why +- Link related issues +- List breaking changes +- Add screenshots for UI changes + +### Code Review + +Maintainers will review your PR for: +- Code quality and style +- Test coverage +- Documentation +- Performance impact +- Security implications + +Be responsive to feedback and make requested changes. + +## Common Tasks + +### Adding a Tauri Command + +1. **Define command in `main.rs`:** + ```rust + #[tauri::command] + async fn my_command(param: String) -> Result { + Ok(format!("Received: {}", param)) + } + ``` + +2. **Register in builder:** + ```rust + .invoke_handler(tauri::generate_handler![ + my_command, + // ... other commands + ]) + ``` + +3. **Call from frontend:** + ```typescript + const result = await invoke('my_command', { param: 'value' }); + ``` + +### Adding a UI Component + +1. **Create component file:** + ```svelte + + + + + ``` + +2. **Import and use:** + ```svelte + + + + ``` + +### Adding a Store + +1. **Create store file:** + ```typescript + // packages/ui/src/stores/mystore.svelte.ts + export class MyState { + value = $state(0); + + increment() { + this.value++; + } + } + + export const myState = new MyState(); + ``` + +2. **Use in components:** + ```svelte + + + + ``` + +## Troubleshooting Development Issues + +### Build Failures + +**"cannot find -lwebkit2gtk"** +```bash +# Install WebKit dependencies +sudo apt install libwebkit2gtk-4.1-dev +``` + +**"pnpm not found"** +```bash +# Install pnpm +npm install -g pnpm@9 +``` + +**"Rust version too old"** +```bash +# Update Rust +rustup update +``` + +### Runtime Issues + +**"Failed to load dynamic library"** +- Rebuild: `cargo clean && cargo tauri dev` +- Check library paths +- Verify dependencies installed + +**"CORS error"** +- Normal in dev mode +- Tauri handles CORS automatically + +**"Hot reload not working"** +- Check Vite config +- Restart dev server +- Clear browser cache + +## Resources + +- [Tauri Documentation](https://v2.tauri.app/) +- [Svelte 5 Documentation](https://svelte.dev/docs) +- [Rust Book](https://doc.rust-lang.org/book/) +- [DropOut Repository](https://github.com/HydroRoll-Team/DropOut) + +## Getting Help + +- **Issues**: [GitHub Issues](https://github.com/HydroRoll-Team/DropOut/issues) +- **Discussions**: [GitHub Discussions](https://github.com/HydroRoll-Team/DropOut/discussions) +- **Documentation**: This site diff --git a/packages/docs/content/en/features/authentication.mdx b/packages/docs/content/en/features/authentication.mdx new file mode 100644 index 0000000..b6fc4ba --- /dev/null +++ b/packages/docs/content/en/features/authentication.mdx @@ -0,0 +1,266 @@ +--- +title: Authentication +description: Microsoft OAuth and offline authentication in DropOut +--- + +# Authentication + +DropOut supports two authentication methods: Microsoft Account (for official Minecraft) and Offline Mode (for testing and offline play). + +## Microsoft Authentication + +### Overview + +DropOut uses the **Device Code Flow** for Microsoft authentication, which: +- Doesn't require a redirect URL (no browser integration) +- Works on any device with a browser +- Provides a simple code-based authentication +- Fully compliant with Microsoft OAuth 2.0 + +### Authentication Process + +The authentication chain consists of multiple steps: + +1. **Device Code** → User authorization +2. **MS Token** → Access + refresh tokens +3. **Xbox Live** → Xbox token + UHS +4. **XSTS** → Security token +5. **Minecraft** → Game access token +6. **Profile** → Username + UUID + +#### Step 1: Device Code Request +1. Click "Login with Microsoft" +2. DropOut requests a device code from Microsoft +3. You receive: + - User code (e.g., `A1B2-C3D4`) + - Verification URL (usually `https://microsoft.com/link`) + - Device code (used internally) + +#### Step 2: User Authorization +1. Visit the verification URL in any browser +2. Enter the user code +3. Sign in with your Microsoft account +4. Authorize DropOut to access your Minecraft profile + +#### Step 3: Token Exchange +- DropOut polls Microsoft for authorization completion +- Once authorized, receives an access token and refresh token +- Refresh token is stored for future logins + +#### Step 4: Xbox Live Authentication +- Microsoft token is exchanged for Xbox Live token +- Retrieves User Hash (UHS) for next step + +#### Step 5: XSTS Authorization +- Xbox Live token is used to get XSTS token +- This token is specific to Minecraft services + +#### Step 6: Minecraft Login +- XSTS token is exchanged for Minecraft access token +- Uses endpoint: `/launcher/login` + +#### Step 7: Profile Fetching +- Retrieves your Minecraft username +- Fetches your UUID +- Checks if you own Minecraft + +### Token Management + +**Access Token:** +- Short-lived (typically 1 hour) +- Used for game authentication +- Automatically refreshed when expired + +**Refresh Token:** +- Long-lived (typically 90 days) +- Stored securely in `accounts.json` +- Used to obtain new access tokens + +**Auto-refresh:** +```rust +// Automatic refresh when token expires +if account.expires_at < current_time { + refresh_full_auth(&account).await?; +} +``` + +### Security Considerations + +- Tokens are stored in platform-specific app data directory +- HTTPS only for all API calls +- No credentials stored (only tokens) +- User-Agent header required (bypasses MS WAF) + +### Troubleshooting Microsoft Login + +**"Device code expired"** +- Codes expire after 15 minutes +- Start the login process again + +**"Authorization pending"** +- Normal during the waiting phase +- Complete authorization in the browser + +**"Invalid token"** +- Token may have expired +- Log out and log back in + +**"You don't own Minecraft"** +- Verify your Microsoft account owns Minecraft Java Edition +- Check at https://www.minecraft.net/profile + +## Offline Authentication + +### Overview + +Offline mode creates a local account that doesn't require internet connectivity or a Microsoft account. This is useful for: +- Testing and development +- Playing without internet +- LAN multiplayer +- Mod development + +### Creating an Offline Account + +1. Click "Offline Mode" in the login screen +2. Enter a username (3-16 characters) +3. Click "Create Account" + +### How It Works + +**UUID Generation:** +```rust +// Deterministic UUID v3 from username +let uuid = generate_offline_uuid(&username); +``` + +- Uses UUID v3 (namespace-based) +- Deterministic: same username = same UUID +- No network requests + +**Authentication:** +- Returns `"null"` as access token +- Minecraft accepts null token in offline mode +- Username and UUID stored locally + +### Limitations + +- Cannot join online servers +- No skin support +- No cape support +- No Microsoft account features + +### Use Cases + +**Development:** +```bash +# Testing mod development +cargo tauri dev +# Use offline mode to test quickly +``` + +**LAN Play:** +- Join LAN worlds without authentication +- Host LAN worlds + +**Offline Play:** +- Singleplayer without internet +- No authentication required + +## Account Management + +### Switching Accounts + +Currently, DropOut supports one active account at a time. Multi-account support is planned. + +**To switch accounts:** +1. Log out of current account +2. Log in with new account + +### Account Storage + +Accounts are stored in `accounts.json`: + +```json +{ + "current_account_id": "uuid-here", + "accounts": [ + { + "id": "uuid", + "type": "Microsoft", + "username": "PlayerName", + "access_token": "...", + "refresh_token": "...", + "expires_at": 1234567890 + } + ] +} +``` + +### Deleting Accounts + +To remove an account: +1. Open Settings +2. Navigate to Accounts +3. Click "Log Out" +4. Or manually delete `accounts.json` + +## API Reference + +### Tauri Commands + +**Start Microsoft Login:** +```typescript +const { user_code, verification_uri } = await invoke('start_microsoft_login'); +``` + +**Complete Microsoft Login:** +```typescript +const account = await invoke('complete_microsoft_login', { deviceCode }); +``` + +**Offline Login:** +```typescript +const account = await invoke('offline_login', { username: 'Player' }); +``` + +**Logout:** +```typescript +await invoke('logout'); +``` + +**Get Current Account:** +```typescript +const account = await invoke('get_current_account'); +``` + +### Events + +**Authentication Status:** +```typescript +listen('auth-status', (event) => { + console.log(event.payload); // "logged_in" | "logged_out" +}); +``` + +## Best Practices + +### For Players + +1. **Use Microsoft Account** for official servers +2. **Keep tokens secure** - don't share accounts.json +3. **Refresh tokens regularly** by logging in +4. **Use offline mode** only for testing + +### For Developers + +1. **Handle token expiration** gracefully +2. **Implement retry logic** for network failures +3. **Cache account data** to reduce API calls +4. **Validate tokens** before game launch + +## Future Enhancements + +- **Multi-account support**: Switch between accounts easily +- **Account profiles**: Save per-account settings +- **Auto-login**: Remember last account +- **Token encryption**: Enhanced security for stored tokens diff --git a/packages/docs/content/en/features/index.mdx b/packages/docs/content/en/features/index.mdx new file mode 100644 index 0000000..3a463d0 --- /dev/null +++ b/packages/docs/content/en/features/index.mdx @@ -0,0 +1,176 @@ +--- +title: Features Overview +description: Comprehensive guide to all DropOut features +--- + +# Features Overview + +DropOut is packed with features designed for both casual players and power users. This guide covers all major capabilities. + +## Core Features + + + + + + + + + + +## Quick Feature Matrix + +| Feature | Status | Description | +|---------|--------|-------------| +| Microsoft Authentication | Complete | OAuth 2.0 with device code flow | +| Offline Authentication | Complete | Local accounts for offline play | +| Token Auto-refresh | Complete | Automatic refresh of expired tokens | +| Java Auto-detection | Complete | Scans system for Java installations | +| Java Download | Complete | Download Adoptium JDK/JRE versions | +| Fabric Support | Complete | Install and launch Fabric loader | +| Forge Support | Complete | Install and launch Forge loader | +| Instance System | Complete | Isolated game environments | +| GitHub Integration | Complete | View releases and changelogs | +| Concurrent Downloads | Complete | Multi-threaded asset downloads | +| Resume Downloads | Complete | Resume interrupted downloads | +| AI Assistant | Complete | Built-in troubleshooting helper | +| Config Editor | Complete | JSON/TOML configuration editor | +| Custom Resolution | Complete | Set game window dimensions | +| Memory Allocation | Complete | Customize JVM memory settings | +| Multi-account | In Progress | Switch between multiple accounts | +| Mods Manager | Planned | Enable/disable mods in launcher | +| Launcher Auto-update | Planned | Self-updating mechanism | +| Custom Game Directory | Planned | Choose game files location | +| Import Profiles | Planned | Import from MultiMC/Prism | + +## Performance Features + +### Concurrent Downloads +- Configurable thread count (default: 10) +- Parallel asset and library downloads +- Progress tracking per file +- ETA calculation + +### Resume Support +- Interrupted downloads auto-resume +- `.part` files track progress +- Multi-segment downloads for large files +- Metadata files for state tracking + +### Caching +- Java catalog cached for 24 hours +- Version manifests cached locally +- Asset index caching +- Library deduplication + +## User Interface Features + +### Modern Design +- Dark mode enforced for eye comfort +- Particle background effects +- Clean, distraction-free layout +- Responsive design + +### Real-time Feedback +- Live download progress +- Game console output +- Log streaming +- Toast notifications + +### Settings Management +- Memory allocation slider +- Resolution customization +- Java path selection +- Thread count configuration +- Custom JVM arguments + +## Advanced Features + +### Version Inheritance +Modded versions (Fabric/Forge) automatically inherit from parent vanilla versions: +- Libraries merged from parent + mod loader +- Arguments combined and deduplicated +- Assets inherited from vanilla version + +### Native Library Extraction +- Platform-specific native extraction +- Automatic cleanup +- Proper library path configuration + +### Rules Engine +- OS-specific library filtering +- Feature flag support +- Architecture detection + +### Download Queue Persistence +- Save incomplete downloads +- Resume after launcher restart +- Queue priority management + +## Developer Features + +### Config Editor +Built-in JSON/TOML editor with: +- Syntax highlighting +- Validation +- Quick access to all configs + +### Log Access +- Real-time game logs +- Launcher debug logs +- Copy/export functionality + +### AI Assistant +- Troubleshooting guidance +- Error analysis +- Configuration help +- Documentation search + +## Coming Soon + +### Multi-account Management +- Switch between accounts easily +- Account profiles +- Quick switching + +### Mods Manager +- Browse and install mods +- Enable/disable mods +- Mod compatibility checking +- Version management + +### Profile Import +- Import from MultiMC +- Import from Prism Launcher +- Import from other launchers +- Preserve settings and saves + +### Launcher Auto-update +- Background update checks +- One-click updates +- Version history +- Rollback support diff --git a/packages/docs/content/en/features/java.mdx b/packages/docs/content/en/features/java.mdx new file mode 100644 index 0000000..21b95a9 --- /dev/null +++ b/packages/docs/content/en/features/java.mdx @@ -0,0 +1,394 @@ +--- +title: Java Management +description: Automatic Java detection, download, and installation +--- + +# Java Management + +DropOut provides comprehensive Java management, automatically detecting installed versions and downloading new ones as needed. + +## Auto-detection + +### System Scan + +DropOut scans multiple locations for Java installations: + +**Linux:** +- `/usr/lib/jvm/` +- `/usr/java/` +- `$JAVA_HOME` +- `PATH` environment variable + +**macOS:** +- `/Library/Java/JavaVirtualMachines/` +- `/System/Library/Java/JavaVirtualMachines/` +- `$JAVA_HOME` +- `PATH` environment variable + +**Windows:** +- `C:\Program Files\Java\` +- `C:\Program Files (x86)\Java\` +- `%JAVA_HOME%` +- `PATH` environment variable +- Windows Registry + +### Version Detection + +For each Java installation found, DropOut: +1. Runs `java -version` to get version info +2. Parses major version (8, 11, 17, 21, etc.) +3. Detects architecture (x64, ARM64) +4. Identifies vendor (Oracle, Adoptium, etc.) + +### Results + +All detected Java installations appear in Settings → Java: +- Version number +- Installation path +- Architecture +- Current selection status + +## Java Download + +### Adoptium Integration + +DropOut integrates with the Eclipse Adoptium API to download high-quality, free JDK/JRE builds. + +**Supported Versions:** +- Java 8 (LTS) +- Java 11 (LTS) +- Java 17 (LTS) +- Java 21 (LTS) +- Java 23+ (Latest) + +**Features:** +- Automatic platform detection +- Architecture-specific builds +- JDK or JRE selection +- Checksum verification + +### Download Process + +1. Navigate to Settings → Java +2. Click "Download Java" +3. Select version (e.g., Java 17) +4. Choose JDK or JRE +5. Click Download +6. Wait for download and extraction + +**Progress Tracking:** +- Real-time download speed +- ETA calculation +- Extraction progress +- Installation confirmation + +### Catalog Management + +The Java catalog is cached for 24 hours to improve performance: + +```rust +// Catalog structure +{ + "versions": [ + { + "version": "17.0.9+9", + "major": 17, + "url": "https://api.adoptium.net/...", + "sha256": "...", + "size": 123456789 + } + ], + "last_updated": 1234567890 +} +``` + +**Refresh:** +- Automatic after 24 hours +- Manual refresh in settings +- Forced refresh on download failure + +## Installation + +### Download Directory + +Downloaded Java runtimes are installed to: + +``` +~/.local/share/com.dropout.launcher/java/ (Linux) +~/Library/Application Support/com.dropout.launcher/java/ (macOS) +%APPDATA%/com.dropout.launcher/java/ (Windows) +``` + +### Directory Structure + +``` +java/ +├── jdk-17.0.9+9/ +│ ├── bin/ +│ │ └── java (or java.exe) +│ └── lib/ +├── jdk-21.0.1+12/ +│ ├── bin/ +│ └── lib/ +└── download_queue.json +``` + +### Extraction + +1. Download to `.part` file +2. Verify checksum +3. Extract archive: + - `.tar.gz` on Linux/macOS + - `.zip` on Windows +4. Move to `java//` directory +5. Set executable permissions (Unix) + +## Configuration + +### Memory Allocation + +Configure JVM memory in Settings: + +**Minimum Memory:** +- Default: 1024 MB +- Recommended: 2048 MB for vanilla +- Recommended: 4096+ MB for modded + +**Maximum Memory:** +- Default: 4096 MB +- Adjust based on your system RAM +- Leave 4GB for OS and other apps + +**Format:** +```bash +-Xms1024M -Xmx4096M +``` + +### Custom JVM Arguments + +Add custom JVM arguments for advanced configuration: + +**Common Arguments:** +```bash +# Garbage collection +-XX:+UseG1GC +-XX:+UnlockExperimentalVMOptions + +# Performance +-XX:G1NewSizePercent=20 +-XX:G1ReservePercent=20 +-XX:MaxGCPauseMillis=50 + +# Memory +-XX:G1HeapRegionSize=32M +``` + +### Java Path Selection + +**Auto-select:** +- DropOut recommends the best Java version for each Minecraft version +- Java 8 for Minecraft 1.12.2 and older +- Java 17 for Minecraft 1.18-1.20.4 +- Java 21 for Minecraft 1.20.5+ + +**Manual selection:** +1. Go to Settings → Java +2. Choose from detected installations +3. Or specify custom path + +## Version Recommendations + +### Minecraft Version → Java Version + +| Minecraft Version | Recommended Java | Minimum Java | +|-------------------|------------------|--------------| +| 1.7.10 and older | Java 8 | Java 8 | +| 1.8 - 1.12.2 | Java 8 | Java 8 | +| 1.13 - 1.16.5 | Java 8 or 11 | Java 8 | +| 1.17 - 1.17.1 | Java 16 | Java 16 | +| 1.18 - 1.20.4 | Java 17 | Java 17 | +| 1.20.5+ | Java 21 | Java 21 | + +### Modded Minecraft + +**Fabric:** +- Usually matches vanilla requirements +- Some mods may require newer Java + +**Forge:** +- May require specific Java versions +- Check mod loader documentation +- Often requires exact version match + +## Troubleshooting + +### Java Not Detected + +**Issue:** Installed Java not showing up + +**Solutions:** +1. Verify Java is in standard location +2. Check `JAVA_HOME` environment variable +3. Add Java `bin` directory to `PATH` +4. Restart DropOut +5. Manual path selection + +### Download Fails + +**Issue:** Java download doesn't complete + +**Solutions:** +1. Check internet connection +2. Verify disk space +3. Try different version +4. Clear download queue +5. Manual download from Adoptium + +### Wrong Java Version + +**Issue:** Game crashes due to Java version + +**Solutions:** +1. Check Minecraft version requirements +2. Download correct Java version +3. Select appropriate Java in settings +4. Verify Java path is correct + +### OutOfMemoryError + +**Issue:** Game crashes with memory error + +**Solutions:** +1. Increase maximum memory allocation +2. Close other applications +3. Upgrade system RAM +4. Use 64-bit Java +5. Optimize JVM arguments + +### Performance Issues + +**Issue:** Low FPS or stuttering + +**Solutions:** +1. Adjust memory allocation (not too high!) +2. Enable G1GC garbage collector +3. Add performance JVM arguments +4. Use newer Java version if compatible +5. Allocate 4-8GB for modpacks + +## API Reference + +### Tauri Commands + +**Detect Java Installations:** +```typescript +const javas = await invoke('detect_java_installations'); +// Returns: Array<{ path: string, version: string, major: number }> +``` + +**Get Java Catalog:** +```typescript +const catalog = await invoke('get_java_catalog'); +// Returns: { versions: Array, last_updated: number } +``` + +**Download Java:** +```typescript +await invoke('download_java', { + version: '17.0.9+9', + variant: 'jdk' // or 'jre' +}); +``` + +**Cancel Java Download:** +```typescript +await invoke('cancel_java_download'); +``` + +**Set Java Path:** +```typescript +await invoke('set_java_path', { path: '/path/to/java' }); +``` + +### Events + +**Download Progress:** +```typescript +listen('java-download-progress', (event) => { + const { percent, speed, eta } = event.payload; +}); +``` + +**Download Complete:** +```typescript +listen('java-download-complete', (event) => { + const { path, version } = event.payload; +}); +``` + +## Best Practices + +### For Players + +1. **Use Adoptium builds** - Free, high-quality, maintained +2. **Match Java to Minecraft** - Check version requirements +3. **Don't over-allocate memory** - Leave RAM for OS +4. **Keep Java updated** - Security and performance +5. **Use 64-bit Java** - Required for large memory + +### For Developers + +1. **Test multiple Java versions** - Ensure compatibility +2. **Document Java requirements** - Help users +3. **Handle missing Java** - Graceful fallbacks +4. **Validate Java path** - Before launching +5. **Provide clear errors** - When Java is wrong + +## Advanced Topics + +### Custom Java Installation + +To use a custom Java installation: + +1. Install Java manually +2. Note the installation path +3. In DropOut Settings → Java +4. Click "Custom Path" +5. Browse to Java executable +6. Verify version is correct + +### Java for Servers + +When running a Minecraft server: + +```bash +# Recommended server JVM arguments +-Xms4G -Xmx4G \ +-XX:+UseG1GC \ +-XX:+ParallelRefProcEnabled \ +-XX:MaxGCPauseMillis=200 \ +-XX:+UnlockExperimentalVMOptions \ +-XX:+DisableExplicitGC \ +-XX:G1NewSizePercent=30 \ +-XX:G1MaxNewSizePercent=40 \ +-XX:G1HeapRegionSize=8M \ +-XX:G1ReservePercent=20 \ +-XX:G1HeapWastePercent=5 \ +-XX:G1MixedGCCountTarget=4 \ +-XX:InitiatingHeapOccupancyPercent=15 \ +-XX:G1MixedGCLiveThresholdPercent=90 \ +-XX:G1RSetUpdatingPauseTimePercent=5 \ +-XX:SurvivorRatio=32 \ +-XX:+PerfDisableSharedMem \ +-XX:MaxTenuringThreshold=1 +``` + +### GraalVM + +GraalVM is supported for advanced users: + +1. Download GraalVM from graalvm.org +2. Install manually +3. Add to DropOut as custom Java +4. May improve performance +5. Test thoroughly before use diff --git a/packages/docs/content/en/features/meta.json b/packages/docs/content/en/features/meta.json new file mode 100644 index 0000000..4725321 --- /dev/null +++ b/packages/docs/content/en/features/meta.json @@ -0,0 +1,9 @@ +{ + "title": "Features", + "pages": [ + "index", + "authentication", + "java", + "mod-loaders" + ] +} diff --git a/packages/docs/content/en/features/mod-loaders.mdx b/packages/docs/content/en/features/mod-loaders.mdx new file mode 100644 index 0000000..d6fdf4f --- /dev/null +++ b/packages/docs/content/en/features/mod-loaders.mdx @@ -0,0 +1,409 @@ +--- +title: Mod Loaders +description: Fabric and Forge installation and management +--- + +# Mod Loaders + +DropOut supports the two most popular Minecraft mod loaders: Fabric and Forge. Both can be easily installed and managed directly from the launcher. + +## Fabric Support + +### Overview + +Fabric is a lightweight, modular modding toolchain focused on: +- Fast updates to new Minecraft versions +- Clean, minimal API +- Strong developer community +- Excellent performance + +### Installation + +1. Navigate to **Versions** tab +2. Click **"Install Fabric"** +3. Select Minecraft version +4. Choose Fabric loader version +5. Click **"Install"** +6. Wait for installation to complete + +### How It Works + +**Meta API Integration:** +```rust +// Fetch available Fabric versions +let url = format!( + "https://meta.fabricmc.net/v2/versions/loader/{}", + minecraft_version +); +``` + +**Profile Generation:** +1. Fetch Fabric loader metadata +2. Download Fabric libraries +3. Generate version JSON with `inheritsFrom` +4. Merge with parent Minecraft version +5. Add to versions list + +**Version Format:** +```json +{ + "id": "fabric-loader-0.15.0-1.20.4", + "inheritsFrom": "1.20.4", + "mainClass": "net.fabricmc.loader.impl.launch.knot.KnotClient", + "libraries": [...] +} +``` + +### Fabric Versions + +**Loader Versions:** +- Latest stable (recommended) +- Specific versions for compatibility +- Beta/snapshot versions + +**Game Versions:** +- All Minecraft versions from 1.14+ +- Snapshots supported +- Combat Test versions + +### Library Management + +Fabric libraries are resolved from Maven: + +**Main Library:** +``` +net.fabricmc:fabric-loader:0.15.0 +``` + +**Dependencies:** +- `net.fabricmc:tiny-mappings-parser` +- `net.fabricmc:sponge-mixin` +- `net.fabricmc:access-widener` + +**Download:** +```rust +// Maven resolution +let url = format!( + "https://maven.fabricmc.net/{}/{}", + artifact_path, filename +); +``` + +### Fabric API + +Fabric Loader ≠ Fabric API: +- **Fabric Loader**: Mod loader (installed by DropOut) +- **Fabric API**: Library mod (download separately) + +Many mods require Fabric API: +1. Download from [Modrinth](https://modrinth.com/mod/fabric-api) or [CurseForge](https://www.curseforge.com/minecraft/mc-mods/fabric-api) +2. Place in instance's `mods/` folder + +## Forge Support + +### Overview + +Forge is the original and most popular Minecraft mod loader: +- Extensive mod ecosystem +- Mature API +- Wide version support +- Large community + +### Installation + +1. Navigate to **Versions** tab +2. Click **"Install Forge"** +3. Select Minecraft version +4. Choose Forge version +5. Click **"Install"** +6. Wait for installer to run +7. Installation complete + +### How It Works + +**Forge Installer:** +```rust +// Download Forge installer +let installer_url = format!( + "https://maven.minecraftforge.net/net/minecraftforge/forge/{}/forge-{}-installer.jar", + full_version, full_version +); + +// Run installer +java -jar forge-installer.jar --installClient +``` + +**Profile Parsing:** +1. Forge installer creates version JSON +2. DropOut parses install profile +3. Extracts library dependencies +4. Processes processors (if any) +5. Generates launcher profile + +**Version Format:** +```json +{ + "id": "1.20.4-forge-49.0.26", + "inheritsFrom": "1.20.4", + "mainClass": "cpw.mods.bootstraplauncher.BootstrapLauncher", + "libraries": [...] +} +``` + +### Forge Versions + +**Release Types:** +- **Latest**: Most recent stable +- **Recommended**: Most stable for production +- **Specific**: Version-locked for compatibility + +**Minecraft Version Support:** +- Legacy versions (1.6.4+) +- Modern versions (1.13+) +- Latest versions (1.20+) + +### Library Management + +Forge has many libraries: + +**Core Libraries:** +- `net.minecraftforge:forge:` +- `net.minecraftforge:fmlloader:` +- `org.ow2.asm:asm:` + +**Resolution:** +```rust +// Forge Maven +"https://maven.minecraftforge.net/" + +// Dependencies may use: +// - Maven Central +// - Minecraft Libraries +``` + +### Forge Processors + +Some Forge versions run "processors" during installation: +- Bytecode manipulation +- Library patching +- Mapping generation + +DropOut handles these automatically. + +## Version Inheritance + +Both Fabric and Forge use Minecraft's inheritance system: + +### Parent Version + +```json +{ + "id": "fabric-loader-0.15.0-1.20.4", + "inheritsFrom": "1.20.4" // Parent vanilla version +} +``` + +### Merging Process + +**Libraries:** +```rust +// Merged from both +parent_libraries + modded_libraries +// Duplicates removed +``` + +**Arguments:** +```rust +// Combined +parent_jvm_args + modded_jvm_args +parent_game_args + modded_game_args +``` + +**Assets:** +```rust +// Inherited from parent +assets = parent.assets +``` + +**Main Class:** +```rust +// Overridden by modded +main_class = modded.mainClass +``` + +## Comparison + +| Feature | Fabric | Forge | +|---------|--------|-------| +| **Performance** | Excellent | Good | +| **Update Speed** | Very Fast | Moderate | +| **Mod Selection** | Growing | Extensive | +| **API Simplicity** | Simple | Complex | +| **Version Support** | 1.14+ | 1.6.4+ | +| **Developer Friendly** | Very | Moderate | +| **Stability** | Excellent | Excellent | + +## Installing Mods + +### Fabric Mods + +1. Create/select instance +2. Ensure Fabric is installed +3. Download mods from: + - [Modrinth](https://modrinth.com/) + - [CurseForge](https://www.curseforge.com/) + - [GitHub Releases](https://github.com/) +4. Place `.jar` files in `instances//mods/` +5. Launch game + +**Compatibility:** +- Check Minecraft version +- Check Fabric Loader version +- Check for Fabric API requirement +- Read mod dependencies + +### Forge Mods + +1. Create/select instance +2. Ensure Forge is installed +3. Download mods from: + - [CurseForge](https://www.curseforge.com/) + - [Modrinth](https://modrinth.com/) +4. Place `.jar` files in `instances//mods/` +5. Launch game + +**Compatibility:** +- Check Minecraft version exactly +- Check Forge version range +- Read mod dependencies +- Check for conflicts + +## Troubleshooting + +### Fabric Issues + +**"Fabric Loader not found"** +- Reinstall Fabric +- Check version JSON exists +- Verify libraries downloaded + +**"Mixin apply failed"** +- Mod incompatibility +- Remove conflicting mods +- Update Fabric Loader + +**"Fabric API required"** +- Download Fabric API +- Match Minecraft version +- Place in mods folder + +### Forge Issues + +**"Forge installer failed"** +- Verify Java installation +- Check disk space +- Try older Forge version +- Check logs for details + +**"Missing dependencies"** +- Install required mods +- Check mod version compatibility +- Read error message carefully + +**"Class not found"** +- Forge version mismatch +- Reinstall Forge +- Verify libraries downloaded + +### General Mod Issues + +**Crash on Launch:** +1. Check crash report +2. Identify problematic mod +3. Remove or update mod +4. Test with minimal mods +5. Add mods back incrementally + +**Performance Problems:** +1. Too many mods installed +2. Increase memory allocation +3. Install performance mods: + - Fabric: Sodium, Lithium + - Forge: OptiFine, Magnesium +4. Remove resource-heavy mods + +## API Reference + +### Tauri Commands + +**Install Fabric:** +```typescript +await invoke('install_fabric', { + minecraftVersion: '1.20.4', + loaderVersion: '0.15.0' +}); +``` + +**Install Forge:** +```typescript +await invoke('install_forge', { + minecraftVersion: '1.20.4', + forgeVersion: '49.0.26' +}); +``` + +**List Fabric Versions:** +```typescript +const versions = await invoke('get_fabric_versions', { + minecraftVersion: '1.20.4' +}); +``` + +**List Forge Versions:** +```typescript +const versions = await invoke('get_forge_versions', { + minecraftVersion: '1.20.4' +}); +``` + +### Events + +**Installation Progress:** +```typescript +listen('mod-loader-progress', (event) => { + const { stage, percent } = event.payload; + // Stages: "downloading", "installing", "processing", "complete" +}); +``` + +## Best Practices + +### For Players + +1. **Choose one mod loader** per instance +2. **Match versions exactly** - Minecraft and loader +3. **Read mod requirements** before installing +4. **Start small** - Add mods incrementally +5. **Backup worlds** before adding mods +6. **Check compatibility** lists +7. **Update cautiously** - Test in separate instance + +### For Modpack Creators + +1. **Document versions** - MC, loader, all mods +2. **Test thoroughly** - All features +3. **List dependencies** - Including API +4. **Provide changelog** - For updates +5. **Version lock** - For stability +6. **Include configs** - Pre-configured +7. **Test updates** - Before release + +## Future Features + +- **Mod browser** - Install mods from launcher +- **Automatic updates** - Keep mods current +- **Dependency resolution** - Auto-install requirements +- **Conflict detection** - Warn about incompatibilities +- **Profile export** - Share modpack configurations +- **CurseForge integration** - Direct modpack import +- **Modrinth integration** - Mod search and install diff --git a/packages/docs/content/en/getting-started.mdx b/packages/docs/content/en/getting-started.mdx new file mode 100644 index 0000000..5219f40 --- /dev/null +++ b/packages/docs/content/en/getting-started.mdx @@ -0,0 +1,161 @@ +--- +title: Getting Started +description: Quick start guide to using DropOut Minecraft Launcher +--- + +# Getting Started + +DropOut is a modern, reproducible, and developer-grade Minecraft launcher built with Tauri v2 and Rust. This guide will help you get started with installing and using DropOut. + +## Installation + +### Download Pre-built Binaries + +Download the latest release for your platform from the [Releases](https://github.com/HsiangNianian/DropOut/releases) page. + +| Platform | Files | +| -------------- | ----------------------- | +| Linux x86_64 | `.deb`, `.AppImage` | +| Linux ARM64 | `.deb`, `.AppImage` | +| macOS ARM64 | `.dmg` | +| Windows x86_64 | `.msi`, `.exe` | +| Windows ARM64 | `.msi`, `.exe` | + +### Linux Installation + +#### Using .deb Package +```bash +sudo dpkg -i dropout_*.deb +# Fix dependencies if needed +sudo apt-get install -f +``` + +#### Using AppImage +```bash +chmod +x dropout_*.AppImage +./dropout_*.AppImage +``` + +### macOS Installation + +1. Open the downloaded `.dmg` file +2. Drag DropOut to your Applications folder +3. If you see a security warning, go to System Preferences → Security & Privacy and allow the app + +### Windows Installation + +#### Using .msi Installer +1. Double-click the `.msi` file +2. Follow the installation wizard +3. Launch DropOut from the Start Menu + +#### Using .exe Portable +1. Double-click the `.exe` file +2. DropOut will run directly without installation + +## First Launch + +When you first launch DropOut, you'll need to: + +1. **Choose Authentication Method** + - **Microsoft Account**: Recommended for official Minecraft + - **Offline Mode**: For testing or offline play + +2. **Configure Java Runtime** + - DropOut will automatically detect installed Java versions + - You can download Java directly from the launcher if needed + +3. **Select Minecraft Version** + - Browse available Minecraft versions + - Choose vanilla or modded versions (Fabric/Forge) + +## Quick Start Tutorial + +### 1. Login + + + + + + +**Microsoft Login:** +1. Click "Login with Microsoft" +2. A device code will be displayed +3. Visit the URL shown and enter the code +4. Authorize the application +5. Return to DropOut - you'll be logged in automatically + +**Offline Login:** +1. Click "Offline Mode" +2. Enter a username +3. Click "Create Account" + +### 2. Install Minecraft + +1. Navigate to the **Versions** tab +2. Browse available Minecraft versions +3. Click on a version to install it +4. Wait for the download to complete + +### 3. Launch the Game + +1. Go to the **Home** tab +2. Select your desired version from the dropdown +3. Adjust settings if needed: + - Memory allocation (RAM) + - Window resolution + - Java path +4. Click **"Launch Game"** +5. Monitor the launch process in the console + +## Next Steps + + + + + + + + +## System Requirements + +### Minimum Requirements +- **OS**: Windows 10+, macOS 11+, or Linux (Debian-based) +- **RAM**: 4GB (8GB recommended for modded Minecraft) +- **Storage**: 2GB for launcher + game files +- **Java**: Auto-installed by DropOut if not found + +### Recommended Requirements +- **OS**: Latest stable version of your OS +- **RAM**: 16GB for optimal performance with mods +- **Storage**: 10GB+ for multiple versions and mods +- **Java**: Java 17 or 21 (managed by DropOut) + +## Getting Help + +If you encounter issues: +- Check the [Troubleshooting Guide](/docs/troubleshooting) +- Report bugs on [GitHub Issues](https://github.com/HsiangNianian/DropOut/issues) +- Join our community discussions diff --git a/packages/docs/content/en/index.mdx b/packages/docs/content/en/index.mdx new file mode 100644 index 0000000..9dee19f --- /dev/null +++ b/packages/docs/content/en/index.mdx @@ -0,0 +1,95 @@ +--- +title: Welcome to DropOut +description: Modern, reproducible, and developer-grade Minecraft launcher +--- + +# Welcome to DropOut + +DropOut is a modern Minecraft launcher built with Tauri v2 and Rust, designed for players who value control, transparency, and long-term stability. + +
+ DropOut Launcher +
+ +## Why DropOut? + +Most Minecraft launchers focus on getting you into the game. DropOut focuses on keeping your game **stable**, **debuggable**, and **reproducible**. + +- Your instance worked yesterday but broke today? → **DropOut makes it traceable.** +- Sharing a modpack means zipping gigabytes? → **DropOut shares exact dependency manifests.** +- Java, loader, mods, configs drift out of sync? → **DropOut locks them together.** + +This launcher is built for players who value control, transparency, and long-term stability. + +## Quick Links + + + + + + + + +## Key Features + +### High Performance +Built with Rust and Tauri for minimal resource usage and fast startup times. + +### Modern UI +Clean, distraction-free interface with Svelte 5, Tailwind CSS 4, and particle effects. + +### Secure Authentication +Microsoft OAuth 2.0 with device code flow and offline authentication support. + +### Mod Loader Support +Built-in installation for Fabric and Forge with automatic version management. + +### Java Management +Automatic detection of installed Java versions and integrated downloader for Adoptium JDK/JRE. + +### Instance System +Isolated game environments with independent configurations, mods, and saves. + +### AI Assistant +Built-in AI helper for troubleshooting, configuration, and guidance. + +### Fast Downloads +Concurrent asset and library downloads with resume support and progress tracking. + +## Technology Stack + +- **Backend**: Rust with Tauri v2 +- **Frontend**: Svelte 5 with runes +- **Styling**: Tailwind CSS 4 +- **Build Tool**: Vite with Rolldown +- **Documentation**: Fumadocs with React Router + +## Community + +- **GitHub**: [HydroRoll-Team/DropOut](https://github.com/HydroRoll-Team/DropOut) +- **Issues**: [Report bugs](https://github.com/HydroRoll-Team/DropOut/issues) +- **Roadmap**: [View development roadmap](https://roadmap.sh/r/minecraft-launcher-dev) + +## License + +DropOut is open source software licensed under the MIT License. + +--- + +Ready to get started? Check out the [Getting Started Guide](getting-started)! diff --git a/packages/docs/content/en/meta.json b/packages/docs/content/en/meta.json new file mode 100644 index 0000000..75bf27a --- /dev/null +++ b/packages/docs/content/en/meta.json @@ -0,0 +1,11 @@ +{ + "title": "Documentation", + "pages": [ + "index", + "getting-started", + "architecture", + "features", + "development", + "troubleshooting" + ] +} diff --git a/packages/docs/content/en/troubleshooting.mdx b/packages/docs/content/en/troubleshooting.mdx new file mode 100644 index 0000000..6d97819 --- /dev/null +++ b/packages/docs/content/en/troubleshooting.mdx @@ -0,0 +1,525 @@ +--- +title: Troubleshooting +description: Common issues and solutions for DropOut launcher +--- + +# Troubleshooting + +This guide covers common issues and their solutions. If you don't find your issue here, please [open an issue](https://github.com/HydroRoll-Team/DropOut/issues) on GitHub. + +## Installation Issues + +### Linux: Missing Dependencies + +**Issue:** Error about missing libraries during installation + +**Solution:** +```bash +# Ubuntu/Debian +sudo apt update +sudo apt install libwebkit2gtk-4.1-0 libgtk-3-0 + +# Fedora +sudo dnf install webkit2gtk4.1 gtk3 + +# Arch +sudo pacman -S webkit2gtk gtk3 +``` + +### macOS: "App is damaged" + +**Issue:** macOS says DropOut is damaged and can't be opened + +**Solution:** +1. Open Terminal +2. Run: `xattr -cr /Applications/DropOut.app` +3. Try opening again +4. Or: System Preferences → Security → Allow anyway + +### Windows: SmartScreen Warning + +**Issue:** Windows SmartScreen blocks the installer + +**Solution:** +1. Click "More info" +2. Click "Run anyway" +3. This is normal for new apps without extended validation certificates + +## Authentication Issues + +### Microsoft Login Fails + +**Issue:** Can't complete Microsoft login + +**Possible causes and solutions:** + +**1. Device code expired:** +- Codes expire after 15 minutes +- Start the login process again +- Complete authorization faster + +**2. Network issues:** +- Check internet connection +- Disable VPN temporarily +- Check firewall settings +- Try different network + +**3. Microsoft account issues:** +- Verify account owns Minecraft Java Edition +- Check at https://www.minecraft.net/profile +- Ensure account is not suspended + +**4. Browser problems:** +- Try different browser +- Clear browser cache +- Disable ad blockers +- Use incognito/private mode + +### Token Refresh Fails + +**Issue:** Token refresh fails, must re-login frequently + +**Solution:** +1. Log out completely +2. Delete `accounts.json` from app data directory +3. Log in again +4. If persists, check Microsoft account status + +### Offline Login Not Working + +**Issue:** Can't create offline account + +**Solution:** +- Username must be 3-16 characters +- Use only letters, numbers, underscore +- No special characters +- No spaces + +## Game Launch Issues + +### Java Not Found + +**Issue:** "No Java installation found" + +**Solutions:** + +**1. Auto-detect existing Java:** +- Settings → Java → Detect Installations +- If found, select it +- If not found, proceed to step 2 + +**2. Download Java via DropOut:** +- Settings → Java → Download Java +- Select appropriate version: + - Java 8 for Minecraft 1.12.2 and older + - Java 17 for Minecraft 1.18-1.20.4 + - Java 21 for Minecraft 1.20.5+ + +**3. Manual Java installation:** +- Download from [Adoptium](https://adoptium.net/) +- Install to system +- Restart DropOut +- Detect again + +### Wrong Java Version + +**Issue:** Game crashes with "Unsupported class file version" + +**Solution:** +Match Java version to Minecraft version: + +| Minecraft Version | Java Version | +|-------------------|--------------| +| 1.7.10 and older | Java 8 | +| 1.8 - 1.12.2 | Java 8 | +| 1.13 - 1.16.5 | Java 8 or 11 | +| 1.17 - 1.17.1 | Java 16 | +| 1.18 - 1.20.4 | Java 17 | +| 1.20.5+ | Java 21 | + +### OutOfMemoryError + +**Issue:** Game crashes with `java.lang.OutOfMemoryError` + +**Solutions:** + +**1. Increase memory allocation:** +- Settings → Memory +- Increase Maximum Memory: + - Vanilla: 4GB minimum + - Light mods: 6GB + - Heavy modpacks: 8-12GB +- Don't exceed 80% of system RAM + +**2. Use 64-bit Java:** +- Check current Java architecture +- Download 64-bit Java if needed +- 32-bit Java limited to ~2GB + +**3. Reduce render distance:** +- In-game Video Settings +- Lower render distance to 8-12 chunks + +**4. Optimize JVM arguments:** +```bash +-Xms4G -Xmx8G -XX:+UseG1GC -XX:+UnlockExperimentalVMOptions +``` + +### Game Won't Start + +**Issue:** Game doesn't launch, no error message + +**Check:** + +**1. Log output:** +- Check game console in DropOut +- Look for error messages +- Common issues: + - Missing files + - Corrupted downloads + - Mod conflicts + +**2. Verify files:** +- Delete version folder +- Re-download version +- Try vanilla first before modded + +**3. Check permissions:** +- Ensure DropOut can write to game directory +- Check folder permissions +- On Linux: ensure the launcher directory is only accessible by your user, e.g. `chmod 700 ~/.local/share/com.dropout.launcher` + +## Download Issues + +### Downloads Fail + +**Issue:** Asset or library downloads fail + +**Solutions:** + +**1. Network issues:** +- Check internet connection +- Disable VPN +- Try different network +- Check firewall/antivirus + +**2. Resume downloads:** +- DropOut auto-resumes interrupted downloads +- Close and reopen DropOut +- Downloads should continue + +**3. Clear download cache:** +- Delete `.part` files in libraries/assets +- Restart download + +**4. Manually download:** +- Check logs for failing URL +- Download file manually +- Place in correct location + +### Slow Downloads + +**Issue:** Downloads are very slow + +**Solutions:** + +**1. Adjust thread count:** +- Settings → Downloads +- Try different thread counts: + - Too low: slow overall + - Too high: connection throttling + - Recommended: 5-10 threads + +**2. Network optimization:** +- Close bandwidth-heavy apps +- Use wired connection if possible +- Check for ISP throttling + +**3. Alternative CDN:** +- Mojang mirrors may be slow +- Try at different time of day + +## Mod Loader Issues + +### Fabric Installation Fails + +**Issue:** Can't install Fabric loader + +**Solutions:** + +**1. Check Minecraft version:** +- Fabric supports 1.14+ +- Older versions not supported +- Try newer Minecraft version + +**2. Network issues:** +- Check internet connection +- Fabric Meta API may be down +- Try again later + +**3. Manual installation:** +- Download Fabric from [fabricmc.net](https://fabricmc.net/) +- Use official installer +- Import profile to DropOut + +### Forge Installation Fails + +**Issue:** Forge installer fails or hangs + +**Solutions:** + +**1. Java version:** +- Ensure correct Java version +- Forge 1.17+ requires Java 16+ +- Older Forge may need Java 8 + +**2. Installer timeout:** +- Forge installer can be slow +- Wait up to 10 minutes +- Check logs for progress + +**3. Disk space:** +- Ensure sufficient free space +- Forge needs ~1GB temporarily +- Check `/tmp` on Linux + +**4. Manual installation:** +- Download Forge installer from [minecraftforge.net](https://files.minecraftforge.net/) +- Run installer manually +- Select install client +- Import profile + +### Mod Crashes + +**Issue:** Game crashes with mods installed + +**Solutions:** + +**1. Check compatibility:** +- Verify mod is for correct Minecraft version +- Check mod loader version requirements +- Read mod description for dependencies + +**2. Install dependencies:** +- Fabric mods often need Fabric API +- Some mods require libraries +- Check crash log for "missing" errors + +**3. Remove conflicting mods:** +- Disable mods one by one +- Identify problematic mod +- Check for known conflicts +- Update or replace mod + +**4. Update mods:** +- Use latest mod versions +- Check mod update notes +- Some updates fix crashes + +## Performance Issues + +### Low FPS + +**Issue:** Game runs slowly or stutters + +**Solutions:** + +**1. Allocate more memory:** +- Increase max memory to 6-8GB +- Don't over-allocate (causes GC pauses) + +**2. Install performance mods:** +- **Fabric**: Sodium, Lithium, Phosphor +- **Forge**: OptiFine, Magnesium, Rubidium + +**3. Optimize settings:** +- Lower render distance +- Disable fancy graphics +- Turn off particles +- Disable VSync if fps < 60 + +**4. Update graphics drivers:** +- Download latest from manufacturer +- NVIDIA: GeForce Experience +- AMD: Adrenalin +- Intel: Graphics Command Center + +**5. Close background apps:** +- Free up system resources +- Disable overlays (Discord, etc.) +- Check Task Manager for CPU/RAM hogs + +### Launcher Slow to Start + +**Issue:** DropOut takes long time to launch + +**Solutions:** + +**1. Check system resources:** +- Close unnecessary programs +- Ensure sufficient RAM available +- Check CPU usage + +**2. Antivirus interference:** +- Add DropOut to exceptions +- Temporarily disable to test +- Some AVs slow down significantly + +**3. Corrupted data:** +- Delete `cache` folder in app data +- Restart DropOut +- Will rebuild cache + +## UI Issues + +### Window Won't Open + +**Issue:** DropOut window doesn't appear + +**Solutions:** + +**1. Check if running:** +```bash +# Linux/macOS +ps aux | grep dropout + +# Windows +tasklist | findstr dropout +``` + +**2. Kill and restart:** +```bash +# Linux/macOS +pkill dropout + +# Windows +taskkill /F /IM dropout.exe +``` + +**3. Reset window position:** +- Delete window state config +- Restart DropOut + +### Graphics Glitches + +**Issue:** UI looks wrong or has visual artifacts + +**Solutions:** + +**1. Update graphics drivers:** +- Install latest drivers +- Restart system + +**2. Disable hardware acceleration:** +- Check if option exists in settings +- May reduce performance but fix glitches + +**3. Try different monitor:** +- Multi-monitor setups can cause issues +- Try on different display + +## File System Issues + +### Can't Access Game Directory + +**Issue:** Errors accessing game files + +**Solutions:** + +**1. Check permissions:** +```bash +# Linux (set secure owner-only permissions) +sudo chown -R "$USER":"$USER" ~/.local/share/com.dropout.launcher +chmod -R u+rwX,go-rwx ~/.local/share/com.dropout.launcher + +# macOS (set secure owner-only permissions) +sudo chown -R "$USER":"$USER" ~/Library/Application\ Support/com.dropout.launcher +chmod -R u+rwX,go-rwx ~/Library/Application\ Support/com.dropout.launcher +``` + +**2. Check disk space:** +- Ensure sufficient free space +- Minecraft needs 2-10GB depending on mods +- Clean up old versions + +**3. Antivirus blocking:** +- Add game directory to exceptions +- Some AVs block file access + +### Corrupted Files + +**Issue:** Files appear corrupted or invalid + +**Solutions:** + +**1. Verify checksums:** +- DropOut verifies SHA1/SHA256 +- Failed verification triggers re-download + +**2. Re-download:** +- Delete corrupted file +- Launch version again +- DropOut will re-download + +**3. Clear cache:** +- Delete version folder entirely +- Re-install from scratch + +## Getting More Help + +### Collect Debug Information + +When reporting issues, include: + +**1. System information:** +- OS and version +- DropOut version +- Java version + +**2. Logs:** +- Launcher logs from console +- Game logs if applicable +- Error messages (full text) + +**3. Steps to reproduce:** +- What you did +- What you expected +- What actually happened + +**4. Screenshots:** +- Error messages +- UI issues +- Settings screens + +### Report Issues + +1. Search [existing issues](https://github.com/HydroRoll-Team/DropOut/issues) +2. If not found, [create new issue](https://github.com/HydroRoll-Team/DropOut/issues/new) +3. Use issue template +4. Provide all requested information +5. Be patient and responsive + +### Community Support + +- **GitHub Discussions**: Ask questions +- **Discord**: Real-time help (if available) +- **Documentation**: Check all guides + +## Known Issues + +### Currently Being Worked On + +- Multi-account switching (in progress) +- Custom game directory selection (planned) +- Launcher auto-update (planned) + +### Workarounds Available + +**Issue**: Can't switch between accounts easily +**Workaround**: Log out and log in with different account + +**Issue**: No built-in mod manager +**Workaround**: Manually manage mods in instance folder + +**Issue**: Can't import from other launchers +**Workaround**: Manually copy instance files diff --git a/packages/docs/content/zh/architecture.mdx b/packages/docs/content/zh/architecture.mdx new file mode 100644 index 0000000..6a2a2df --- /dev/null +++ b/packages/docs/content/zh/architecture.mdx @@ -0,0 +1,281 @@ +--- +title: 架构设计 +description: DropOut Minecraft 启动器的技术架构和设计 +--- + +# 架构设计 + +DropOut 采用现代技术栈构建,旨在实现高性能、安全性和跨平台兼容性。 + +## 技术栈 + +### 后端(Rust) +- **框架**: Tauri v2 +- **语言**: Rust(Edition 2021) +- **异步运行时**: Tokio +- **HTTP 客户端**: reqwest with native-tls + +### 前端(Svelte) +- **框架**: Svelte 5(with runes) +- **样式**: Tailwind CSS 4 +- **构建工具**: Vite with Rolldown +- **包管理器**: pnpm + +### 文档 +- **框架**: Fumadocs with React Router v7 +- **内容**: MDX 文件 +- **样式**: Tailwind CSS 4 + +## 系统架构 + +``` +┌─────────────────────────────────────────────────────────┐ +│ 前端(Svelte 5) │ +│ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌─────────┐ │ +│ │ Stores │ │Components│ │ UI Views │ │Particles│ │ +│ └────┬─────┘ └────┬─────┘ └────┬─────┘ └────┬────┘ │ +│ │ │ │ │ │ +│ └─────────────┴─────────────┴──────────────┘ │ +│ │ │ +│ Tauri 命令 │ +│ 事件/发射器 │ +└──────────────────────────┬──────────────────────────────┘ + │ +┌──────────────────────────┴──────────────────────────────┐ +│ 后端(Rust/Tauri) │ +│ ┌─────────────────────────────────────────────────┐ │ +│ │ main.rs(命令) │ │ +│ └──────────────┬──────────────────────────────────┘ │ +│ │ │ +│ ┌──────────────┴───────────────────────────────┐ │ +│ │ 核心模块 │ │ +│ │ ┌──────┐ ┌────────┐ ┌──────┐ ┌──────────┐ │ │ +│ │ │ Auth │ │Download│ │ Java │ │ Instance │ │ │ +│ │ └──────┘ └────────┘ └──────┘ └──────────┘ │ │ +│ │ ┌──────┐ ┌────────┐ ┌──────┐ ┌──────────┐ │ │ +│ │ │Fabric│ │ Forge │ │Config│ │Manifest │ │ │ +│ │ └──────┘ └────────┘ └──────┘ └──────────┘ │ │ +│ └──────────────────────────────────────────────┘ │ +│ │ +│ ┌─────────────────────────────────────────────────┐ │ +│ │ 工具和辅助函数 │ │ +│ │ • ZIP 提取 • 路径工具 │ │ +│ └─────────────────────────────────────────────────┘ │ +└──────────────────────────┬──────────────────────────────┘ + │ + 外部 API + │ + ┌──────────────────┼──────────────────┐ + │ │ │ + ┌─────┴────┐ ┌──────┴─────┐ ┌──────┴─────┐ + │ Mojang │ │ Fabric │ │ Forge │ + │ APIs │ │ Meta │ │ Maven │ + └──────────┘ └────────────┘ └────────────┘ +``` + +## 核心组件 + +### 前端状态管理 + +DropOut 使用 **Svelte 5 runes** 进行响应式状态管理: + +```typescript +// stores/auth.svelte.ts +export class AuthState { + currentAccount = $state(null); // 响应式 + isLoginModalOpen = $state(false); + + $effect(() => { // 副作用 + // 依赖变化时自动运行 + }); +} +``` + +**关键 Stores:** +- `auth.svelte.ts`: 认证状态和登录流程 +- `settings.svelte.ts`: 启动器设置和 Java 检测 +- `game.svelte.ts`: 游戏运行状态和日志 +- `instances.svelte.ts`: 实例管理 +- `ui.svelte.ts`: UI 状态(提示、模态框、活动视图) + +### 后端架构 + +#### 命令模式 +所有 Tauri 命令遵循此结构: + +```rust +#[tauri::command] +async fn command_name( + window: Window, + state: State<'_, SomeState>, + param: Type, +) -> Result { + emit_log!(window, "状态消息"); + // 异步逻辑 + Ok(result) +} +``` + +#### 事件通信 + +**Rust → 前端(进度更新):** +```rust +window.emit("launcher-log", "正在下载...")?; +window.emit("download-progress", progress_struct)?; +``` + +**前端 → Rust(命令):** +```typescript +import { invoke } from "@tauri-apps/api/core"; +const result = await invoke("start_game", { versionId: "1.20.4" }); +``` + +### 核心模块 + +#### 认证(`core/auth.rs`) +- **微软 OAuth 2.0**: 设备代码流 +- **离线认证**: 本地 UUID 生成 +- **令牌管理**: 刷新令牌存储和自动刷新 +- **Xbox Live 集成**: 完整认证链 + +**认证流程:** +1. 设备代码请求 → MS 令牌 +2. Xbox Live 认证 +3. XSTS 授权 +4. Minecraft 令牌交换 +5. 配置文件获取 + +#### 下载器(`core/downloader.rs`) +- **并发下载**: 可配置线程池 +- **断点续传**: `.part` 和 `.part.meta` 文件 +- **多段下载**: 大文件分割成块 +- **校验和验证**: SHA1/SHA256 验证 +- **进度跟踪**: 实时事件到前端 + +#### Java 管理(`core/java.rs`) +- **自动检测**: 扫描系统路径 +- **Adoptium 集成**: 按需下载 JDK/JRE +- **目录缓存**: 版本列表 24 小时缓存 +- **安装**: 提取到应用数据目录 +- **取消**: 下载取消的原子标志 + +#### Fabric 支持(`core/fabric.rs`) +- **Meta API 集成**: 获取加载器版本 +- **配置文件生成**: 创建版本 JSON +- **库解析**: Maven 构件处理 + +#### Forge 支持(`core/forge.rs`) +- **安装程序执行**: 运行 Forge 安装程序 +- **配置文件解析**: 提取安装配置文件 +- **库管理**: 处理 Forge 特定库 + +#### 实例系统(`core/instance.rs`) +- **隔离**: 每个实例独立目录 +- **配置**: 每个实例的设置 +- **模组管理**: 实例特定模组 +- **版本锁定**: 可复现环境 + +#### 版本管理 +- **清单解析**(`manifest.rs`): Mojang 版本清单 +- **继承系统**(`version_merge.rs`): 父版本合并 +- **游戏版本**(`game_version.rs`): JSON 解析和验证 +- **规则引擎**(`rules.rs`): 操作系统/功能条件逻辑 + +### 文件结构 + +``` +~/.local/share/com.dropout.launcher/ (Linux) +~/Library/Application Support/com.dropout.launcher/ (macOS) +%APPDATA%/com.dropout.launcher/ (Windows) +├── versions/ +│ └── / +│ ├── .json +│ ├── .jar +│ └── natives/ +├── libraries/ +│ └── / +├── assets/ +│ ├── indexes/ +│ └── objects/ +├── instances/ +│ └── / +│ ├── mods/ +│ ├── config/ +│ └── saves/ +├── java/ +│ └── / +├── config.json +└── accounts.json +``` + +## 数据流 + +### 游戏启动序列 + +1. **前端**: 用户点击"启动游戏" +2. **命令**: 调用 `start_game(version_id)` +3. **后端处理**: + - 加载版本 JSON(带继承) + - 解析所有库 + - 下载缺少的资源 + - 提取原生库 + - 构建类路径 + - 构造 JVM 参数 + - 替换占位符 +4. **进程生成**: 使用参数启动 Java +5. **流日志**: 向前端发送 stdout/stderr +6. **监视**: 跟踪游戏进程状态 + +### 下载流程 + +1. **队列创建**: 要下载的文件列表 +2. **并发处理**: 信号量限制线程 +3. **恢复检查**: 验证现有 `.part` 文件 +4. **下载**: 大文件多段 +5. **验证**: 校验和验证 +6. **进度事件**: 实时更新到 UI +7. **完成**: 从 `.part` 移动到最终位置 + +### 认证流程 + +1. **设备代码请求**: 获取用户代码 + 设备代码 +2. **用户授权**: 用户访问 URL 并输入代码 +3. **令牌轮询**: 前端轮询完成 +4. **令牌交换**: MS 令牌 → Xbox → XSTS → Minecraft +5. **配置文件获取**: 获取用户名和 UUID +6. **存储**: 使用刷新令牌保存账户 +7. **自动刷新**: 过期时后台令牌刷新 + +## 平台特定考虑 + +### Linux +- 使用 GTK WebView(`webkit2gtk`) +- 从 `/usr/lib/jvm` 系统 Java 检测 +- 桌面文件集成 + +### macOS +- 使用系统 WebKit +- 应用程序包结构 +- 钥匙串集成用于安全存储 + +### Windows +- 使用 WebView2 运行时 +- 注册表 Java 检测 +- MSI 安装程序支持 +- 发布版本中无控制台窗口 + +## 性能优化 + +- **并发下载**: 并行资源/库下载 +- **延迟加载**: 按需加载版本清单 +- **缓存**: Java 目录、版本清单 +- **原生代码**: 用于 CPU 密集型操作的 Rust +- **异步 I/O**: 用于非阻塞操作的 Tokio + +## 安全功能 + +- **令牌加密**: 安全存储认证令牌 +- **仅 HTTPS**: 所有外部 API 调用 +- **校验和验证**: 文件完整性验证 +- **沙箱执行**: Tauri 安全模型 +- **无任意代码**: 无 eval 或动态代码执行 diff --git a/packages/docs/content/zh/development.mdx b/packages/docs/content/zh/development.mdx new file mode 100644 index 0000000..6ba5b1d --- /dev/null +++ b/packages/docs/content/zh/development.mdx @@ -0,0 +1,546 @@ +--- +title: 开发指南 +description: 从源代码构建、测试和贡献 DropOut +--- + +# 开发指南 + +本指南将帮助你设置开发环境、从源代码构建 DropOut,以及为项目做出贡献。 + +## 前置要求 + +### 必需软件 + +1. **Rust** (最新稳定版) + ```bash + # 通过 rustup 安装 + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh + ``` + +2. **Node.js** (v22+) 和 **pnpm** (v9+) + ```bash + # 从 https://nodejs.org/ 安装 Node.js + # 安装 pnpm + npm install -g pnpm@9 + ``` + +3. **系统依赖** + + 按照你的平台参考 [Tauri 前置要求](https://v2.tauri.app/start/prerequisites/): + + **Linux (Debian/Ubuntu):** + ```bash + sudo apt update + sudo apt install libwebkit2gtk-4.1-dev \ + build-essential \ + curl \ + wget \ + file \ + libssl-dev \ + libayatana-appindicator3-dev \ + librsvg2-dev + ``` + + **macOS:** + ```bash + xcode-select --install + ``` + + **Windows:** + - 安装 [Microsoft Visual C++ Build Tools](https://visualstudio.microsoft.com/visual-cpp-build-tools/) + - 安装 [WebView2](https://developer.microsoft.com/microsoft-edge/webview2/) + +## 快速开始 + +### 克隆仓库 + +```bash +git clone https://github.com/HydroRoll-Team/DropOut.git +cd DropOut +``` + +### 安装依赖 + +**前端依赖:** +```bash +cd packages/ui +pnpm install +cd ../.. +``` + +**文档依赖:** +```bash +cd packages/docs +pnpm install +cd ../.. +``` + +### 开发模式 + +以开发模式运行 DropOut,支持热重载: + +```bash +cargo tauri dev +``` + +这将: +1. 启动前端开发服务器(Vite 在 5173 端口) +2. 编译 Rust 后端 +3. 打开 Tauri 窗口 +4. 为前端更改启用热重载 +5. 在 Rust 文件更改时重新编译 + +**终端输出:** +- 来自 Vite 的前端日志 +- Rust 标准输出/标准错误 +- 编译状态 + +### 构建生产版本 + +构建发布二进制文件: + +```bash +cargo tauri build +``` + +**输出位置:** +- **Linux**: `src-tauri/target/release/bundle/` + - `.deb` 软件包 + - `.AppImage` 包 +- **macOS**: `src-tauri/target/release/bundle/` + - `.dmg` 安装器 + - `.app` 包 +- **Windows**: `src-tauri/target/release/bundle/` + - `.msi` 安装器 + - `.exe` 可执行文件 + +## 项目结构 + +``` +DropOut/ +├── src-tauri/ # Rust 后端 +│ ├── src/ +│ │ ├── main.rs # Tauri 命令和入口点 +│ │ ├── core/ # 核心模块 +│ │ │ ├── auth.rs # 身份验证 +│ │ │ ├── downloader.rs # 下载管理器 +│ │ │ ├── fabric.rs # Fabric 支持 +│ │ │ ├── forge.rs # Forge 支持 +│ │ │ ├── java.rs # Java 管理 +│ │ │ ├── instance.rs # 实例系统 +│ │ │ └── ... +│ │ └── utils/ # 工具类 +│ └── Cargo.toml +├── packages/ +│ ├── ui/ # Svelte 5 前端 +│ │ ├── src/ +│ │ │ ├── App.svelte +│ │ │ ├── components/ +│ │ │ ├── stores/ # 状态管理 +│ │ │ └── lib/ +│ │ └── package.json +│ └── docs/ # 文档站点 +│ ├── content/docs/ +│ └── package.json +├── .github/ +│ └── workflows/ # CI/CD 流水线 +└── scripts/ # 构建脚本 +``` + +## 开发工作流 + +### 前端开发 + +**启动开发服务器:** +```bash +cd packages/ui +pnpm dev +``` + +**类型检查:** +```bash +pnpm check +``` + +**代码检查:** +```bash +pnpm lint +``` + +**格式化代码:** +```bash +pnpm format +``` + +### 后端开发 + +**运行 Rust 测试:** +```bash +cargo test +``` + +**检查代码:** +```bash +cargo check +``` + +**格式化代码:** +```bash +cargo fmt +``` + +**代码检查:** +```bash +cargo clippy +``` + +### 文档开发 + +**启动文档开发服务器:** +```bash +cd packages/docs +pnpm dev +``` + +**构建文档:** +```bash +pnpm build +``` + +**类型检查:** +```bash +pnpm types:check +``` + +## 代码风格 + +### Rust + +遵循标准 Rust 约定: +- 使用 `cargo fmt` 格式化 +- 使用 `cargo clippy` 检查 +- 编写文档注释 (`///`) +- 正确处理错误 +- 对 I/O 使用 async/await + +**示例:** +```rust +/// Starts the Microsoft authentication device flow +#[tauri::command] +async fn start_microsoft_login( + window: Window, +) -> Result { + emit_log!(window, "Starting Microsoft login..."); + + start_device_flow() + .await + .map_err(|e| e.to_string()) +} +``` + +### TypeScript/Svelte + +遵循项目约定: +- 使用 Svelte 5 runes (`$state`, `$effect`) +- 优先使用 TypeScript 而非 JavaScript +- 使用 Biome 进行格式化和检查 +- 遵循组件结构 + +**示例:** +```typescript +// stores/auth.svelte.ts +export class AuthState { + currentAccount = $state(null); + isLoginModalOpen = $state(false); + + async login(username: string) { + const account = await invoke('offline_login', { username }); + this.currentAccount = account; + } +} +``` + +## 测试 + +### 单元测试 + +**Rust:** +```rust +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_generate_offline_uuid() { + let uuid = generate_offline_uuid("Player"); + assert!(uuid.len() > 0); + } +} +``` + +**运行:** +```bash +cargo test +``` + +### 集成测试 + +测试完整应用程序: +1. 以开发模式构建:`cargo tauri dev` +2. 手动测试功能 +3. 检查控制台错误 +4. 验证 UI 行为 + +### CI 测试 + +GitHub Actions 在以下平台运行测试: +- Ubuntu(最新版) +- Arch Linux(Wayland) +- Windows(最新版) +- macOS(ARM64) + +查看工作流:`.github/workflows/test.yml` + +## 调试 + +### 前端调试 + +1. 在 Tauri 窗口中打开开发工具:`Ctrl+Shift+I`(Windows/Linux)或 `Cmd+Option+I`(macOS) +2. 检查控制台错误 +3. 使用 React DevTools 或 Svelte DevTools +4. 监控网络标签页查看 API 调用 + +### 后端调试 + +**打印调试:** +```rust +emit_log!(window, format!("Debug: {}", value)); +println!("Debug: {}", value); +``` + +**Rust 调试器:** +```bash +# 安装 rust-lldb 或 rust-gdb +cargo install rust-gdb + +# 调试 +rust-gdb target/debug/dropout +``` + +### 日志 + +**前端:** +```typescript +console.log("Info message"); +console.error("Error message"); +``` + +**后端:** +```rust +emit_log!(window, "Status update"); +eprintln!("Error: {}", error); +``` + +## 贡献 + +### 贡献工作流 + +1. **Fork** 仓库 +2. **创建**功能分支: + ```bash + git checkout -b feature/my-feature + ``` +3. **进行**更改 +4. **彻底测试** +5. **提交**时使用约定式提交: + ```bash + git commit -m "feat: add new feature" + ``` +6. **推送**到你的 fork: + ```bash + git push origin feature/my-feature + ``` +7. **创建** Pull Request + +### 提交消息 + +遵循 [约定式提交](https://www.conventionalcommits.org/): + +**格式:** +``` +[scope]: + +[optional body] + +[optional footer] +``` + +**类型:** +- `feat`: 新功能 +- `fix`: 错误修复 +- `docs`: 文档 +- `style`: 格式化 +- `refactor`: 代码重构 +- `perf`: 性能改进 +- `test`: 添加测试 +- `chore`: 维护 + +**示例:** +```bash +feat(auth): add offline authentication support +fix(java): resolve detection on Windows +docs: update installation guide +refactor(download): simplify progress tracking +``` + +### Pull Request 指南 + +**提交前:** +- [ ] 代码遵循风格指南 +- [ ] 测试在本地通过 +- [ ] 必要时更新文档 +- [ ] 没有提交不必要的文件 +- [ ] 提交消息清晰 + +**PR 描述:** +- 解释做了什么以及为什么 +- 链接相关 issue +- 列出破坏性更改 +- 为 UI 更改添加截图 + +### 代码审查 + +维护者将审查你的 PR: +- 代码质量和风格 +- 测试覆盖率 +- 文档 +- 性能影响 +- 安全影响 + +对反馈保持响应并进行要求的更改。 + +## 常见任务 + +### 添加 Tauri 命令 + +1. **在 `main.rs` 中定义命令:** + ```rust + #[tauri::command] + async fn my_command(param: String) -> Result { + Ok(format!("Received: {}", param)) + } + ``` + +2. **在构建器中注册:** + ```rust + .invoke_handler(tauri::generate_handler![ + my_command, + // ... 其他命令 + ]) + ``` + +3. **从前端调用:** + ```typescript + const result = await invoke('my_command', { param: 'value' }); + ``` + +### 添加 UI 组件 + +1. **创建组件文件:** + ```svelte + + + + + ``` + +2. **导入并使用:** + ```svelte + + + + ``` + +### 添加 Store + +1. **创建 store 文件:** + ```typescript + // packages/ui/src/stores/mystore.svelte.ts + export class MyState { + value = $state(0); + + increment() { + this.value++; + } + } + + export const myState = new MyState(); + ``` + +2. **在组件中使用:** + ```svelte + + + + ``` + +## 开发问题故障排除 + +### 构建失败 + +**"cannot find -lwebkit2gtk"** +```bash +# 安装 WebKit 依赖 +sudo apt install libwebkit2gtk-4.1-dev +``` + +**"pnpm not found"** +```bash +# 安装 pnpm +npm install -g pnpm@9 +``` + +**"Rust version too old"** +```bash +# 更新 Rust +rustup update +``` + +### 运行时问题 + +**"Failed to load dynamic library"** +- 重新构建:`cargo clean && cargo tauri dev` +- 检查库路径 +- 验证已安装依赖 + +**"CORS error"** +- 开发模式下正常 +- Tauri 自动处理 CORS + +**"Hot reload not working"** +- 检查 Vite 配置 +- 重启开发服务器 +- 清除浏览器缓存 + +## 资源 + +- [Tauri 文档](https://v2.tauri.app/) +- [Svelte 5 文档](https://svelte.dev/docs) +- [Rust 程序设计语言](https://doc.rust-lang.org/book/) +- [DropOut 仓库](https://github.com/HydroRoll-Team/DropOut) + +## 获取帮助 + +- **Issues**: [GitHub Issues](https://github.com/HydroRoll-Team/DropOut/issues) +- **讨论**: [GitHub Discussions](https://github.com/HydroRoll-Team/DropOut/discussions) +- **文档**: 本站点 diff --git a/packages/docs/content/zh/features/authentication.mdx b/packages/docs/content/zh/features/authentication.mdx new file mode 100644 index 0000000..e83cc35 --- /dev/null +++ b/packages/docs/content/zh/features/authentication.mdx @@ -0,0 +1,266 @@ +--- +title: 身份验证 +description: DropOut 中的 Microsoft OAuth 和离线身份验证 +--- + +# 身份验证 + +DropOut 支持两种身份验证方法:Microsoft 账户(用于官方 Minecraft)和离线模式(用于测试和离线游玩)。 + +## Microsoft 身份验证 + +### 概述 + +DropOut 使用 **Device Code Flow** 进行 Microsoft 身份验证,具有以下特点: +- 无需重定向 URL(无需浏览器集成) +- 适用于任何拥有浏览器的设备 +- 提供简单的基于代码的身份验证 +- 完全符合 Microsoft OAuth 2.0 标准 + +### 身份验证流程 + +身份验证链包含多个步骤: + +1. **Device Code** → 用户授权 +2. **MS Token** → 访问令牌 + 刷新令牌 +3. **Xbox Live** → Xbox 令牌 + UHS +4. **XSTS** → 安全令牌 +5. **Minecraft** → 游戏访问令牌 +6. **Profile** → 用户名 + UUID + +#### 第 1 步:设备代码请求 +1. 单击"使用 Microsoft 登录" +2. DropOut 从 Microsoft 请求设备代码 +3. 您会收到: + - 用户代码(例如 `A1B2-C3D4`) + - 验证 URL(通常为 `https://microsoft.com/link`) + - 设备代码(内部使用) + +#### 第 2 步:用户授权 +1. 在任何浏览器中访问验证 URL +2. 输入用户代码 +3. 使用 Microsoft 账户登录 +4. 授权 DropOut 访问您的 Minecraft 个人资料 + +#### 第 3 步:令牌交换 +- DropOut 轮询 Microsoft 检查授权完成 +- 授权后接收访问令牌和刷新令牌 +- 刷新令牌被存储以备将来登录使用 + +#### 第 4 步:Xbox Live 身份验证 +- Microsoft 令牌被交换为 Xbox Live 令牌 +- 检索用户哈希 (UHS) 用于下一步 + +#### 第 5 步:XSTS 授权 +- Xbox Live 令牌被用来获取 XSTS 令牌 +- 此令牌特定于 Minecraft 服务 + +#### 第 6 步:Minecraft 登录 +- XSTS 令牌被交换为 Minecraft 访问令牌 +- 使用端点:`/launcher/login` + +#### 第 7 步:个人资料获取 +- 检索您的 Minecraft 用户名 +- 获取您的 UUID +- 检查您是否拥有 Minecraft + +### 令牌管理 + +**访问令牌:** +- 短期有效(通常为 1 小时) +- 用于游戏身份验证 +- 过期时自动刷新 + +**刷新令牌:** +- 长期有效(通常为 90 天) +- 安全存储在 `accounts.json` 中 +- 用于获取新的访问令牌 + +**自动刷新:** +```rust +// Automatic refresh when token expires +if account.expires_at < current_time { + refresh_full_auth(&account).await?; +} +``` + +### 安全考虑 + +- 令牌存储在平台特定的应用数据目录中 +- 所有 API 调用仅使用 HTTPS +- 不存储凭据(仅存储令牌) +- 需要 User-Agent 标头(绕过 MS WAF) + +### Microsoft 登录故障排除 + +**"Device code expired"(设备代码已过期)** +- 代码在 15 分钟后过期 +- 重新开始登录流程 + +**"Authorization pending"(授权待处理)** +- 在等待阶段很正常 +- 在浏览器中完成授权 + +**"Invalid token"(无效令牌)** +- 令牌可能已过期 +- 登出后重新登录 + +**"You don't own Minecraft"(您不拥有 Minecraft)** +- 验证您的 Microsoft 账户拥有 Minecraft Java Edition +- 在 https://www.minecraft.net/profile 检查 + +## 离线身份验证 + +### 概述 + +离线模式创建一个不需要互联网连接或 Microsoft 账户的本地账户。这对以下情况很有用: +- 测试和开发 +- 无网络游玩 +- LAN 多人游戏 +- Mod 开发 + +### 创建离线账户 + +1. 在登录屏幕单击"离线模式" +2. 输入用户名(3-16 个字符) +3. 单击"创建账户" + +### 工作原理 + +**UUID 生成:** +```rust +// Deterministic UUID v3 from username +let uuid = generate_offline_uuid(&username); +``` + +- 使用 UUID v3(基于命名空间) +- 确定性:相同的用户名 = 相同的 UUID +- 无需网络请求 + +**身份验证:** +- 返回 `"null"` 作为访问令牌 +- Minecraft 在离线模式下接受空令牌 +- 用户名和 UUID 本地存储 + +### 限制 + +- 无法加入在线服务器 +- 不支持皮肤 +- 不支持披风 +- 无法使用 Microsoft 账户功能 + +### 用例 + +**开发:** +```bash +# Testing mod development +cargo tauri dev +# Use offline mode to test quickly +``` + +**LAN 游玩:** +- 无需身份验证即可加入 LAN 世界 +- 托管 LAN 世界 + +**离线游玩:** +- 单人游戏无需网络 +- 无需身份验证 + +## 账户管理 + +### 切换账户 + +目前 DropOut 一次只支持一个活跃账户。多账户支持正在规划中。 + +**切换账户的步骤:** +1. 登出当前账户 +2. 使用新账户登录 + +### 账户存储 + +账户存储在 `accounts.json` 中: + +```json +{ + "current_account_id": "uuid-here", + "accounts": [ + { + "id": "uuid", + "type": "Microsoft", + "username": "PlayerName", + "access_token": "...", + "refresh_token": "...", + "expires_at": 1234567890 + } + ] +} +``` + +### 删除账户 + +删除账户的步骤: +1. 打开设置 +2. 导航到账户 +3. 单击"登出" +4. 或手动删除 `accounts.json` + +## API 参考 + +### Tauri 命令 + +**启动 Microsoft 登录:** +```typescript +const { user_code, verification_uri } = await invoke('start_microsoft_login'); +``` + +**完成 Microsoft 登录:** +```typescript +const account = await invoke('complete_microsoft_login', { deviceCode }); +``` + +**离线登录:** +```typescript +const account = await invoke('offline_login', { username: 'Player' }); +``` + +**登出:** +```typescript +await invoke('logout'); +``` + +**获取当前账户:** +```typescript +const account = await invoke('get_current_account'); +``` + +### 事件 + +**身份验证状态:** +```typescript +listen('auth-status', (event) => { + console.log(event.payload); // "logged_in" | "logged_out" +}); +``` + +## 最佳实践 + +### 对于玩家 + +1. **对官方服务器使用 Microsoft 账户** +2. **保护令牌安全** - 不要分享 accounts.json +3. **定期刷新令牌** - 通过登录来刷新 +4. **仅在测试时使用离线模式** + +### 对于开发者 + +1. **优雅地处理令牌过期** +2. **为网络故障实现重试逻辑** +3. **缓存账户数据** 以减少 API 调用 +4. **在游戏启动前验证令牌** + +## 未来增强 + +- **多账户支持**:轻松在账户之间切换 +- **账户配置文件**:保存每个账户的设置 +- **自动登录**:记住最后一个账户 +- **令牌加密**:为存储的令牌增强安全性 diff --git a/packages/docs/content/zh/features/index.mdx b/packages/docs/content/zh/features/index.mdx new file mode 100644 index 0000000..bb53ce2 --- /dev/null +++ b/packages/docs/content/zh/features/index.mdx @@ -0,0 +1,176 @@ +--- +title: 功能概览 +description: DropOut 所有功能的综合指南 +--- + +# 功能概览 + +DropOut 功能丰富,既适合休闲玩家也适合高级用户。本指南涵盖所有主要功能。 + +## 核心功能 + + + + + + + + + + +## 快速功能矩阵 + +| 功能 | 状态 | 描述 | +|---------|--------|-------------| +| Microsoft 身份验证 | 完成 | 使用设备代码流的 OAuth 2.0 | +| 离线身份验证 | 完成 | 用于离线游玩的本地账户 | +| 令牌自动刷新 | 完成 | 自动刷新过期的令牌 | +| Java 自动检测 | 完成 | 扫描系统中的 Java 安装 | +| Java 下载 | 完成 | 下载 Adoptium JDK/JRE 版本 | +| Fabric 支持 | 完成 | 安装和启动 Fabric 加载器 | +| Forge 支持 | 完成 | 安装和启动 Forge 加载器 | +| 实例系统 | 完成 | 隔离的游戏环境 | +| GitHub 集成 | 完成 | 查看发布和更新日志 | +| 并发下载 | 完成 | 多线程资源下载 | +| 断点续传 | 完成 | 恢复中断的下载 | +| AI 助手 | 完成 | 内置故障排除助手 | +| 配置编辑器 | 完成 | JSON/TOML 配置编辑器 | +| 自定义分辨率 | 完成 | 设置游戏窗口尺寸 | +| 内存分配 | 完成 | 自定义 JVM 内存设置 | +| 多账户 | 进行中 | 在多个账户之间切换 | +| 模组管理器 | 计划中 | 在启动器中启用/禁用模组 | +| 启动器自动更新 | 计划中 | 自我更新机制 | +| 自定义游戏目录 | 计划中 | 选择游戏文件位置 | +| 导入配置文件 | 计划中 | 从 MultiMC/Prism 导入 | + +## 性能功能 + +### 并发下载 +- 可配置的线程数(默认:10) +- 并行资源和库下载 +- 每个文件的进度跟踪 +- ETA 计算 + +### 断点续传支持 +- 中断的下载自动恢复 +- `.part` 文件跟踪进度 +- 大文件的多段下载 +- 用于状态跟踪的元数据文件 + +### 缓存 +- Java 目录缓存 24 小时 +- 本地缓存版本清单 +- 资源索引缓存 +- 库去重 + +## 用户界面功能 + +### 现代设计 +- 强制暗色模式保护眼睛 +- 粒子背景效果 +- 简洁、无干扰的布局 +- 响应式设计 + +### 实时反馈 +- 实时下载进度 +- 游戏控制台输出 +- 日志流 +- Toast 通知 + +### 设置管理 +- 内存分配滑块 +- 分辨率自定义 +- Java 路径选择 +- 线程数配置 +- 自定义 JVM 参数 + +## 高级功能 + +### 版本继承 +模组版本(Fabric/Forge)自动从父原版版本继承: +- 从父版本 + 模组加载器合并库 +- 组合并去重参数 +- 从原版版本继承资源 + +### 原生库提取 +- 特定平台的原生提取 +- 自动清理 +- 正确的库路径配置 + +### 规则引擎 +- 特定操作系统的库过滤 +- 功能标志支持 +- 架构检测 + +### 下载队列持久化 +- 保存未完成的下载 +- 启动器重启后恢复 +- 队列优先级管理 + +## 开发者功能 + +### 配置编辑器 +内置 JSON/TOML 编辑器,具有: +- 语法高亮 +- 验证 +- 快速访问所有配置 + +### 日志访问 +- 实时游戏日志 +- 启动器调试日志 +- 复制/导出功能 + +### AI 助手 +- 故障排除指导 +- 错误分析 +- 配置帮助 +- 文档搜索 + +## 即将推出 + +### 多账户管理 +- 轻松切换账户 +- 账户配置文件 +- 快速切换 + +### 模组管理器 +- 浏览和安装模组 +- 启用/禁用模组 +- 模组兼容性检查 +- 版本管理 + +### 配置文件导入 +- 从 MultiMC 导入 +- 从 Prism Launcher 导入 +- 从其他启动器导入 +- 保留设置和存档 + +### 启动器自动更新 +- 后台更新检查 +- 一键更新 +- 版本历史 +- 回滚支持 diff --git a/packages/docs/content/zh/features/java.mdx b/packages/docs/content/zh/features/java.mdx new file mode 100644 index 0000000..bdc3c15 --- /dev/null +++ b/packages/docs/content/zh/features/java.mdx @@ -0,0 +1,394 @@ +--- +title: Java 管理 +description: 自动 Java 检测、下载和安装 +--- + +# Java 管理 + +DropOut 提供全面的 Java 管理,自动检测已安装的版本并根据需要下载新版本。 + +## 自动检测 + +### 系统扫描 + +DropOut 扫描多个位置查找 Java 安装: + +**Linux:** +- `/usr/lib/jvm/` +- `/usr/java/` +- `$JAVA_HOME` +- `PATH` 环境变量 + +**macOS:** +- `/Library/Java/JavaVirtualMachines/` +- `/System/Library/Java/JavaVirtualMachines/` +- `$JAVA_HOME` +- `PATH` 环境变量 + +**Windows:** +- `C:\Program Files\Java\` +- `C:\Program Files (x86)\Java\` +- `%JAVA_HOME%` +- `PATH` 环境变量 +- Windows 注册表 + +### 版本检测 + +对于找到的每个 Java 安装,DropOut 会: +1. 运行 `java -version` 获取版本信息 +2. 解析主要版本(8、11、17、21 等) +3. 检测架构(x64、ARM64) +4. 识别供应商(Oracle、Adoptium 等) + +### 结果 + +所有检测到的 Java 安装都显示在设置 → Java 中: +- 版本号 +- 安装路径 +- 架构 +- 当前选择状态 + +## Java 下载 + +### Adoptium 集成 + +DropOut 集成了 Eclipse Adoptium API 以下载高质量的免费 JDK/JRE 构建版本。 + +**支持的版本:** +- Java 8(LTS) +- Java 11(LTS) +- Java 17(LTS) +- Java 21(LTS) +- Java 23+(最新版) + +**功能:** +- 自动平台检测 +- 特定架构的构建版本 +- JDK 或 JRE 选择 +- 校验和验证 + +### 下载过程 + +1. 导航到设置 → Java +2. 点击"下载 Java" +3. 选择版本(例如 Java 17) +4. 选择 JDK 或 JRE +5. 点击下载 +6. 等待下载和解压 + +**进度跟踪:** +- 实时下载速度 +- ETA 计算 +- 解压进度 +- 安装确认 + +### 目录管理 + +Java 目录缓存 24 小时以提高性能: + +```rust +// 目录结构 +{ + "versions": [ + { + "version": "17.0.9+9", + "major": 17, + "url": "https://api.adoptium.net/...", + "sha256": "...", + "size": 123456789 + } + ], + "last_updated": 1234567890 +} +``` + +**刷新:** +- 24 小时后自动刷新 +- 设置中手动刷新 +- 下载失败时强制刷新 + +## 安装 + +### 下载目录 + +下载的 Java 运行时安装到: + +``` +~/.local/share/com.dropout.launcher/java/ (Linux) +~/Library/Application Support/com.dropout.launcher/java/ (macOS) +%APPDATA%/com.dropout.launcher/java/ (Windows) +``` + +### 目录结构 + +``` +java/ +├── jdk-17.0.9+9/ +│ ├── bin/ +│ │ └── java (或 java.exe) +│ └── lib/ +├── jdk-21.0.1+12/ +│ ├── bin/ +│ └── lib/ +└── download_queue.json +``` + +### 解压 + +1. 下载到 `.part` 文件 +2. 验证校验和 +3. 解压存档: + - Linux/macOS 上的 `.tar.gz` + - Windows 上的 `.zip` +4. 移动到 `java//` 目录 +5. 设置可执行权限(Unix) + +## 配置 + +### 内存分配 + +在设置中配置 JVM 内存: + +**最小内存:** +- 默认:1024 MB +- 推荐:原版 2048 MB +- 推荐:模组 4096+ MB + +**最大内存:** +- 默认:4096 MB +- 根据系统 RAM 调整 +- 为操作系统和其他应用留出 4GB + +**格式:** +```bash +-Xms1024M -Xmx4096M +``` + +### 自定义 JVM 参数 + +为高级配置添加自定义 JVM 参数: + +**常用参数:** +```bash +# 垃圾回收 +-XX:+UseG1GC +-XX:+UnlockExperimentalVMOptions + +# 性能 +-XX:G1NewSizePercent=20 +-XX:G1ReservePercent=20 +-XX:MaxGCPauseMillis=50 + +# 内存 +-XX:G1HeapRegionSize=32M +``` + +### Java 路径选择 + +**自动选择:** +- DropOut 为每个 Minecraft 版本推荐最佳 Java 版本 +- Java 8 用于 Minecraft 1.12.2 及更早版本 +- Java 17 用于 Minecraft 1.18-1.20.4 +- Java 21 用于 Minecraft 1.20.5+ + +**手动选择:** +1. 前往设置 → Java +2. 从检测到的安装中选择 +3. 或指定自定义路径 + +## 版本推荐 + +### Minecraft 版本 → Java 版本 + +| Minecraft 版本 | 推荐 Java | 最低 Java | +|-------------------|------------------|--------------| +| 1.7.10 及更早 | Java 8 | Java 8 | +| 1.8 - 1.12.2 | Java 8 | Java 8 | +| 1.13 - 1.16.5 | Java 8 或 11 | Java 8 | +| 1.17 - 1.17.1 | Java 16 | Java 16 | +| 1.18 - 1.20.4 | Java 17 | Java 17 | +| 1.20.5+ | Java 21 | Java 21 | + +### 模组 Minecraft + +**Fabric:** +- 通常与原版要求匹配 +- 一些模组可能需要更新的 Java + +**Forge:** +- 可能需要特定的 Java 版本 +- 检查模组加载器文档 +- 通常需要完全匹配版本 + +## 故障排除 + +### 未检测到 Java + +**问题:** 已安装的 Java 未显示 + +**解决方案:** +1. 验证 Java 在标准位置 +2. 检查 `JAVA_HOME` 环境变量 +3. 将 Java `bin` 目录添加到 `PATH` +4. 重启 DropOut +5. 手动选择路径 + +### 下载失败 + +**问题:** Java 下载未完成 + +**解决方案:** +1. 检查互联网连接 +2. 验证磁盘空间 +3. 尝试不同版本 +4. 清除下载队列 +5. 从 Adoptium 手动下载 + +### Java 版本错误 + +**问题:** 由于 Java 版本导致游戏崩溃 + +**解决方案:** +1. 检查 Minecraft 版本要求 +2. 下载正确的 Java 版本 +3. 在设置中选择适当的 Java +4. 验证 Java 路径正确 + +### 内存不足错误 + +**问题:** 游戏因内存错误崩溃 + +**解决方案:** +1. 增加最大内存分配 +2. 关闭其他应用程序 +3. 升级系统 RAM +4. 使用 64 位 Java +5. 优化 JVM 参数 + +### 性能问题 + +**问题:** 低 FPS 或卡顿 + +**解决方案:** +1. 调整内存分配(不要太高!) +2. 启用 G1GC 垃圾收集器 +3. 添加性能 JVM 参数 +4. 如兼容使用更新的 Java 版本 +5. 为整合包分配 4-8GB + +## API 参考 + +### Tauri 命令 + +**检测 Java 安装:** +```typescript +const javas = await invoke('detect_java_installations'); +// 返回: Array<{ path: string, version: string, major: number }> +``` + +**获取 Java 目录:** +```typescript +const catalog = await invoke('get_java_catalog'); +// 返回: { versions: Array, last_updated: number } +``` + +**下载 Java:** +```typescript +await invoke('download_java', { + version: '17.0.9+9', + variant: 'jdk' // 或 'jre' +}); +``` + +**取消 Java 下载:** +```typescript +await invoke('cancel_java_download'); +``` + +**设置 Java 路径:** +```typescript +await invoke('set_java_path', { path: '/path/to/java' }); +``` + +### 事件 + +**下载进度:** +```typescript +listen('java-download-progress', (event) => { + const { percent, speed, eta } = event.payload; +}); +``` + +**下载完成:** +```typescript +listen('java-download-complete', (event) => { + const { path, version } = event.payload; +}); +``` + +## 最佳实践 + +### 对于玩家 + +1. **使用 Adoptium 构建版本** - 免费、高质量、维护良好 +2. **Java 与 Minecraft 版本匹配** - 检查版本要求 +3. **不要过度分配内存** - 为操作系统留出 RAM +4. **保持 Java 更新** - 安全性和性能 +5. **使用 64 位 Java** - 大内存所需 + +### 对于开发者 + +1. **测试多个 Java 版本** - 确保兼容性 +2. **记录 Java 要求** - 帮助用户 +3. **处理缺少的 Java** - 优雅的后备方案 +4. **启动前验证 Java 路径** +5. **提供清晰的错误** - 当 Java 错误时 + +## 高级主题 + +### 自定义 Java 安装 + +使用自定义 Java 安装: + +1. 手动安装 Java +2. 记录安装路径 +3. 在 DropOut 设置 → Java 中 +4. 点击"自定义路径" +5. 浏览到 Java 可执行文件 +6. 验证版本正确 + +### 服务器用 Java + +运行 Minecraft 服务器时: + +```bash +# 推荐的服务器 JVM 参数 +-Xms4G -Xmx4G \ +-XX:+UseG1GC \ +-XX:+ParallelRefProcEnabled \ +-XX:MaxGCPauseMillis=200 \ +-XX:+UnlockExperimentalVMOptions \ +-XX:+DisableExplicitGC \ +-XX:G1NewSizePercent=30 \ +-XX:G1MaxNewSizePercent=40 \ +-XX:G1HeapRegionSize=8M \ +-XX:G1ReservePercent=20 \ +-XX:G1HeapWastePercent=5 \ +-XX:G1MixedGCCountTarget=4 \ +-XX:InitiatingHeapOccupancyPercent=15 \ +-XX:G1MixedGCLiveThresholdPercent=90 \ +-XX:G1RSetUpdatingPauseTimePercent=5 \ +-XX:SurvivorRatio=32 \ +-XX:+PerfDisableSharedMem \ +-XX:MaxTenuringThreshold=1 +``` + +### GraalVM + +GraalVM 支持高级用户: + +1. 从 graalvm.org 下载 GraalVM +2. 手动安装 +3. 作为自定义 Java 添加到 DropOut +4. 可能提高性能 +5. 使用前彻底测试 diff --git a/packages/docs/content/zh/features/meta.json b/packages/docs/content/zh/features/meta.json new file mode 100644 index 0000000..2fb2ded --- /dev/null +++ b/packages/docs/content/zh/features/meta.json @@ -0,0 +1,9 @@ +{ + "title": "功能特性", + "pages": [ + "index", + "authentication", + "java", + "mod-loaders" + ] +} diff --git a/packages/docs/content/zh/features/mod-loaders.mdx b/packages/docs/content/zh/features/mod-loaders.mdx new file mode 100644 index 0000000..3687230 --- /dev/null +++ b/packages/docs/content/zh/features/mod-loaders.mdx @@ -0,0 +1,409 @@ +--- +title: 模组加载器 +description: Fabric 和 Forge 安装和管理 +--- + +# 模组加载器 + +DropOut 支持两个最流行的 Minecraft 模组加载器:Fabric 和 Forge。两者都可以直接从启动器中轻松安装和管理。 + +## Fabric 支持 + +### 概述 + +Fabric 是一个轻量级、模块化的模组工具链,专注于: +- 快速更新至新的 Minecraft 版本 +- 干净、极简的 API +- 强大的开发者社区 +- 优异的性能 + +### 安装 + +1. 导航至 **Versions** 选项卡 +2. 点击 **"Install Fabric"** +3. 选择 Minecraft 版本 +4. 选择 Fabric 加载器版本 +5. 点击 **"Install"** +6. 等待安装完成 + +### 工作原理 + +**Meta API 集成:** +```rust +// Fetch available Fabric versions +let url = format!( + "https://meta.fabricmc.net/v2/versions/loader/{}", + minecraft_version +); +``` + +**配置文件生成:** +1. 获取 Fabric 加载器元数据 +2. 下载 Fabric 库 +3. 使用 `inheritsFrom` 生成版本 JSON +4. 与父级 Minecraft 版本合并 +5. 添加至版本列表 + +**版本格式:** +```json +{ + "id": "fabric-loader-0.15.0-1.20.4", + "inheritsFrom": "1.20.4", + "mainClass": "net.fabricmc.loader.impl.launch.knot.KnotClient", + "libraries": [...] +} +``` + +### Fabric 版本 + +**加载器版本:** +- 最新稳定版(推荐) +- 用于兼容性的特定版本 +- Beta/快照版本 + +**游戏版本:** +- 所有 1.14+ 的 Minecraft 版本 +- 支持快照版本 +- 支持战斗测试版本 + +### 库管理 + +Fabric 库从 Maven 解析: + +**主库:** +``` +net.fabricmc:fabric-loader:0.15.0 +``` + +**依赖项:** +- `net.fabricmc:tiny-mappings-parser` +- `net.fabricmc:sponge-mixin` +- `net.fabricmc:access-widener` + +**下载:** +```rust +// Maven resolution +let url = format!( + "https://maven.fabricmc.net/{}/{}", + artifact_path, filename +); +``` + +### Fabric API + +Fabric Loader ≠ Fabric API: +- **Fabric Loader**: 模组加载器(由 DropOut 安装) +- **Fabric API**: 库模组(单独下载) + +许多模组需要 Fabric API: +1. 从 [Modrinth](https://modrinth.com/mod/fabric-api) 或 [CurseForge](https://www.curseforge.com/minecraft/mc-mods/fabric-api) 下载 +2. 放置在实例的 `mods/` 文件夹中 + +## Forge 支持 + +### 概述 + +Forge 是原始的、最流行的 Minecraft 模组加载器: +- 广泛的模组生态系统 +- 成熟的 API +- 广泛的版本支持 +- 庞大的社区 + +### 安装 + +1. 导航至 **Versions** 选项卡 +2. 点击 **"Install Forge"** +3. 选择 Minecraft 版本 +4. 选择 Forge 版本 +5. 点击 **"Install"** +6. 等待安装程序运行 +7. 安装完成 + +### 工作原理 + +**Forge 安装程序:** +```rust +// Download Forge installer +let installer_url = format!( + "https://maven.minecraftforge.net/net/minecraftforge/forge/{}/forge-{}-installer.jar", + full_version, full_version +); + +// Run installer +java -jar forge-installer.jar --installClient +``` + +**配置文件解析:** +1. Forge 安装程序创建版本 JSON +2. DropOut 解析安装配置文件 +3. 提取库依赖项 +4. 处理处理器(如果有) +5. 生成启动器配置文件 + +**版本格式:** +```json +{ + "id": "1.20.4-forge-49.0.26", + "inheritsFrom": "1.20.4", + "mainClass": "cpw.mods.bootstraplauncher.BootstrapLauncher", + "libraries": [...] +} +``` + +### Forge 版本 + +**发布类型:** +- **Latest**: 最新的稳定版本 +- **Recommended**: 生产环境中最稳定的版本 +- **Specific**: 版本锁定以确保兼容性 + +**Minecraft 版本支持:** +- 旧版本 (1.6.4+) +- 现代版本 (1.13+) +- 最新版本 (1.20+) + +### 库管理 + +Forge 有许多库: + +**核心库:** +- `net.minecraftforge:forge:` +- `net.minecraftforge:fmlloader:` +- `org.ow2.asm:asm:` + +**解析:** +```rust +// Forge Maven +"https://maven.minecraftforge.net/" + +// Dependencies may use: +// - Maven Central +// - Minecraft Libraries +``` + +### Forge 处理器 + +某些 Forge 版本在安装期间运行"处理器": +- 字节码操纵 +- 库修补 +- 映射生成 + +DropOut 自动处理这些操作。 + +## 版本继承 + +Fabric 和 Forge 都使用 Minecraft 的继承系统: + +### 父版本 + +```json +{ + "id": "fabric-loader-0.15.0-1.20.4", + "inheritsFrom": "1.20.4" // Parent vanilla version +} +``` + +### 合并过程 + +**库:** +```rust +// Merged from both +parent_libraries + modded_libraries +// Duplicates removed +``` + +**参数:** +```rust +// Combined +parent_jvm_args + modded_jvm_args +parent_game_args + modded_game_args +``` + +**资源:** +```rust +// Inherited from parent +assets = parent.assets +``` + +**主类:** +```rust +// Overridden by modded +main_class = modded.mainClass +``` + +## 对比 + +| 功能 | Fabric | Forge | +|---------|--------|-------| +| **性能** | 优异 | 良好 | +| **更新速度** | 非常快 | 中等 | +| **模组选择** | 增长中 | 广泛 | +| **API 简洁性** | 简洁 | 复杂 | +| **版本支持** | 1.14+ | 1.6.4+ | +| **开发者友好** | 非常友好 | 中等 | +| **稳定性** | 优异 | 优异 | + +## 安装模组 + +### Fabric 模组 + +1. 创建/选择实例 +2. 确保 Fabric 已安装 +3. 从以下位置下载模组: + - [Modrinth](https://modrinth.com/) + - [CurseForge](https://www.curseforge.com/) + - [GitHub Releases](https://github.com/) +4. 将 `.jar` 文件放置在 `instances//mods/` +5. 启动游戏 + +**兼容性:** +- 检查 Minecraft 版本 +- 检查 Fabric Loader 版本 +- 检查 Fabric API 需求 +- 阅读模组依赖项 + +### Forge 模组 + +1. 创建/选择实例 +2. 确保 Forge 已安装 +3. 从以下位置下载模组: + - [CurseForge](https://www.curseforge.com/) + - [Modrinth](https://modrinth.com/) +4. 将 `.jar` 文件放置在 `instances//mods/` +5. 启动游戏 + +**兼容性:** +- 精确检查 Minecraft 版本 +- 检查 Forge 版本范围 +- 阅读模组依赖项 +- 检查冲突 + +## 故障排除 + +### Fabric 问题 + +**"Fabric Loader not found"** +- 重新安装 Fabric +- 检查版本 JSON 是否存在 +- 验证库是否已下载 + +**"Mixin apply failed"** +- 模组不兼容 +- 删除冲突的模组 +- 更新 Fabric Loader + +**"Fabric API required"** +- 下载 Fabric API +- 匹配 Minecraft 版本 +- 放置在 mods 文件夹中 + +### Forge 问题 + +**"Forge installer failed"** +- 验证 Java 安装 +- 检查磁盘空间 +- 尝试旧版本的 Forge +- 检查日志获取详细信息 + +**"Missing dependencies"** +- 安装所需的模组 +- 检查模组版本兼容性 +- 仔细阅读错误消息 + +**"Class not found"** +- Forge 版本不匹配 +- 重新安装 Forge +- 验证库是否已下载 + +### 常见模组问题 + +**启动时崩溃:** +1. 检查崩溃报告 +2. 识别有问题的模组 +3. 删除或更新模组 +4. 使用最少的模组测试 +5. 逐步添加模组回来 + +**性能问题:** +1. 安装了太多模组 +2. 增加内存分配 +3. 安装性能模组: + - Fabric: Sodium, Lithium + - Forge: OptiFine, Magnesium +4. 删除资源密集型模组 + +## API 参考 + +### Tauri 命令 + +**安装 Fabric:** +```typescript +await invoke('install_fabric', { + minecraftVersion: '1.20.4', + loaderVersion: '0.15.0' +}); +``` + +**安装 Forge:** +```typescript +await invoke('install_forge', { + minecraftVersion: '1.20.4', + forgeVersion: '49.0.26' +}); +``` + +**列出 Fabric 版本:** +```typescript +const versions = await invoke('get_fabric_versions', { + minecraftVersion: '1.20.4' +}); +``` + +**列出 Forge 版本:** +```typescript +const versions = await invoke('get_forge_versions', { + minecraftVersion: '1.20.4' +}); +``` + +### 事件 + +**安装进度:** +```typescript +listen('mod-loader-progress', (event) => { + const { stage, percent } = event.payload; + // Stages: "downloading", "installing", "processing", "complete" +}); +``` + +## 最佳实践 + +### 对于玩家 + +1. **每个实例选择一个模组加载器** +2. **精确匹配版本** - Minecraft 和加载器 +3. **安装前阅读模组要求** +4. **循序渐进** - 逐步添加模组 +5. **备份世界** - 添加模组前备份 +6. **检查兼容性** 列表 +7. **谨慎更新** - 在单独的实例中测试 + +### 对于模组包创建者 + +1. **记录版本** - MC、加载器、所有模组 +2. **彻底测试** - 所有功能 +3. **列出依赖项** - 包括 API +4. **提供更新日志** - 用于更新 +5. **版本锁定** - 为了稳定性 +6. **包含配置** - 预配置 +7. **测试更新** - 发布前测试 + +## 未来功能 + +- **模组浏览器** - 从启动器安装模组 +- **自动更新** - 保持模组最新 +- **依赖项解析** - 自动安装需求 +- **冲突检测** - 警告不兼容性 +- **配置文件导出** - 共享模组包配置 +- **CurseForge 集成** - 直接模组包导入 +- **Modrinth 集成** - 模组搜索和安装 diff --git a/packages/docs/content/zh/getting-started.mdx b/packages/docs/content/zh/getting-started.mdx new file mode 100644 index 0000000..05d9aa4 --- /dev/null +++ b/packages/docs/content/zh/getting-started.mdx @@ -0,0 +1,161 @@ +--- +title: 快速开始 +description: 使用 DropOut Minecraft 启动器的快速入门指南 +--- + +# 快速开始 + +DropOut 是一个使用 Tauri v2 和 Rust 构建的现代化、可复现、开发者级别的 Minecraft 启动器。本指南将帮助你开始安装和使用 DropOut。 + +## 安装 + +### 下载预编译二进制文件 + +从[发布页面](https://github.com/HsiangNianian/DropOut/releases)下载适合你平台的最新版本。 + +| 平台 | 文件 | +| -------------- | ----------------------- | +| Linux x86_64 | `.deb`, `.AppImage` | +| Linux ARM64 | `.deb`, `.AppImage` | +| macOS ARM64 | `.dmg` | +| Windows x86_64 | `.msi`, `.exe` | +| Windows ARM64 | `.msi`, `.exe` | + +### Linux 安装 + +#### 使用 .deb 包 +```bash +sudo dpkg -i dropout_*.deb +# 如果需要,修复依赖 +sudo apt-get install -f +``` + +#### 使用 AppImage +```bash +chmod +x dropout_*.AppImage +./dropout_*.AppImage +``` + +### macOS 安装 + +1. 打开下载的 `.dmg` 文件 +2. 将 DropOut 拖到应用程序文件夹 +3. 如果看到安全警告,转到系统偏好设置 → 安全性与隐私并允许该应用 + +### Windows 安装 + +#### 使用 .msi 安装程序 +1. 双击 `.msi` 文件 +2. 按照安装向导操作 +3. 从开始菜单启动 DropOut + +#### 使用 .exe 便携版 +1. 双击 `.exe` 文件 +2. DropOut 将直接运行,无需安装 + +## 首次启动 + +首次启动 DropOut 时,你需要: + +1. **选择认证方式** + - **微软账户**: 推荐用于官方 Minecraft + - **离线模式**: 用于测试或离线游戏 + +2. **配置 Java 运行时** + - DropOut 将自动检测已安装的 Java 版本 + - 如果需要,你可以直接从启动器下载 Java + +3. **选择 Minecraft 版本** + - 浏览可用的 Minecraft 版本 + - 选择原版或模组版本(Fabric/Forge) + +## 快速入门教程 + +### 1. 登录 + + + + + + +**微软登录:** +1. 点击"使用微软登录" +2. 将显示设备代码 +3. 访问显示的 URL 并输入代码 +4. 授权应用程序 +5. 返回 DropOut - 你将自动登录 + +**离线登录:** +1. 点击"离线模式" +2. 输入用户名 +3. 点击"创建账户" + +### 2. 安装 Minecraft + +1. 导航到**版本**标签 +2. 浏览可用的 Minecraft 版本 +3. 点击一个版本进行安装 +4. 等待下载完成 + +### 3. 启动游戏 + +1. 转到**主页**标签 +2. 从下拉菜单中选择你想要的版本 +3. 如果需要,调整设置: + - 内存分配(RAM) + - 窗口分辨率 + - Java 路径 +4. 点击**"启动游戏"** +5. 在控制台中监视启动过程 + +## 下一步 + + + + + + + + +## 系统要求 + +### 最低要求 +- **操作系统**: Windows 10+、macOS 11+ 或 Linux(基于 Debian) +- **内存**: 4GB(推荐 8GB 用于模组 Minecraft) +- **存储**: 启动器 + 游戏文件需要 2GB +- **Java**: 如果找不到,DropOut 会自动安装 + +### 推荐配置 +- **操作系统**: 你操作系统的最新稳定版本 +- **内存**: 16GB 以获得带模组的最佳性能 +- **存储**: 10GB+ 用于多个版本和模组 +- **Java**: Java 17 或 21(由 DropOut 管理) + +## 获取帮助 + +如果遇到问题: +- 查看[故障排除指南](/docs/troubleshooting) +- 在 [GitHub Issues](https://github.com/HsiangNianian/DropOut/issues) 上报告 bug +- 加入我们的社区讨论 diff --git a/packages/docs/content/zh/index.mdx b/packages/docs/content/zh/index.mdx new file mode 100644 index 0000000..b554cca --- /dev/null +++ b/packages/docs/content/zh/index.mdx @@ -0,0 +1,95 @@ +--- +title: 欢迎使用 DropOut +description: 现代化、可复现、开发者级别的 Minecraft 启动器 +--- + +# 欢迎使用 DropOut + +DropOut 是一个使用 Tauri v2 和 Rust 构建的现代 Minecraft 启动器,专为重视控制、透明度和长期稳定性的玩家设计。 + +
+ DropOut 启动器 +
+ +## 为什么选择 DropOut? + +大多数 Minecraft 启动器专注于让你进入游戏。DropOut 专注于保持你的游戏**稳定**、**可调试**和**可复现**。 + +- 你的实例昨天还能用,今天就坏了?→ **DropOut 让它可追溯。** +- 分享模组包意味着打包数GB的文件?→ **DropOut 分享精确的依赖清单。** +- Java、加载器、模组、配置不同步?→ **DropOut 将它们锁定在一起。** + +这个启动器是为重视控制、透明度和长期稳定性的玩家构建的。 + +## 快速链接 + + + + + + + + +## 核心特性 + +### 高性能 +使用 Rust 和 Tauri 构建,资源占用最小,启动速度极快。 + +### 现代化界面 +简洁、无干扰的界面,使用 Svelte 5、Tailwind CSS 4 和粒子效果。 + +### 安全认证 +微软 OAuth 2.0 设备代码流和离线认证支持。 + +### 模组加载器支持 +内置 Fabric 和 Forge 安装,自动版本管理。 + +### Java 管理 +自动检测已安装的 Java 版本,集成 Adoptium JDK/JRE 下载器。 + +### 实例系统 +独立的游戏环境,具有独立的配置、模组和存档。 + +### AI 助手 +内置 AI 帮助,用于故障排除、配置和指导。 + +### 快速下载 +并发资源和库下载,支持断点续传和进度跟踪。 + +## 技术栈 + +- **后端**: Rust + Tauri v2 +- **前端**: Svelte 5 with runes +- **样式**: Tailwind CSS 4 +- **构建工具**: Vite with Rolldown +- **文档**: Fumadocs with React Router + +## 社区 + +- **GitHub**: [HydroRoll-Team/DropOut](https://github.com/HydroRoll-Team/DropOut) +- **问题反馈**: [报告 bug](https://github.com/HydroRoll-Team/DropOut/issues) +- **开发路线图**: [查看开发路线图](https://roadmap.sh/r/minecraft-launcher-dev) + +## 许可证 + +DropOut 是在 MIT 许可证下的开源软件。 + +--- + +准备好开始了吗?查看[快速开始指南](getting-started)! diff --git a/packages/docs/content/zh/meta.json b/packages/docs/content/zh/meta.json new file mode 100644 index 0000000..4fd7ad1 --- /dev/null +++ b/packages/docs/content/zh/meta.json @@ -0,0 +1,11 @@ +{ + "title": "文档", + "pages": [ + "index", + "getting-started", + "architecture", + "features", + "development", + "troubleshooting" + ] +} diff --git a/packages/docs/content/zh/troubleshooting.mdx b/packages/docs/content/zh/troubleshooting.mdx new file mode 100644 index 0000000..c077528 --- /dev/null +++ b/packages/docs/content/zh/troubleshooting.mdx @@ -0,0 +1,523 @@ +--- +title: 故障排除 +description: DropOut 启动器常见问题和解决方案 +--- + +# 故障排除 + +本指南涵盖常见问题及其解决方案。如果在这里找不到你的问题,请在 GitHub 上[提交 issue](https://github.com/HydroRoll-Team/DropOut/issues)。 + +## 安装问题 + +### Linux:缺少依赖 + +**问题:** 安装时提示缺少库 + +**解决方案:** +```bash +# Ubuntu/Debian +sudo apt update +sudo apt install libwebkit2gtk-4.1-0 libgtk-3-0 + +# Fedora +sudo dnf install webkit2gtk4.1 gtk3 + +# Arch +sudo pacman -S webkit2gtk gtk3 +``` + +### macOS:"应用程序已损坏" + +**问题:** macOS 提示 DropOut 已损坏无法打开 + +**解决方案:** +1. 打开终端 +2. 运行:`xattr -cr /Applications/DropOut.app` +3. 再次尝试打开 +4. 或者:系统偏好设置 → 安全性 → 仍要打开 + +### Windows:SmartScreen 警告 + +**问题:** Windows SmartScreen 阻止安装程序 + +**解决方案:** +1. 点击"更多信息" +2. 点击"仍要运行" +3. 这对于没有扩展验证证书的新应用是正常的 + +## 身份验证问题 + +### Microsoft 登录失败 + +**问题:** 无法完成 Microsoft 登录 + +**可能原因和解决方案:** + +**1. 设备代码过期:** +- 代码在 15 分钟后过期 +- 重新开始登录过程 +- 更快地完成授权 + +**2. 网络问题:** +- 检查互联网连接 +- 暂时禁用 VPN +- 检查防火墙设置 +- 尝试不同的网络 + +**3. Microsoft 账户问题:** +- 验证账户拥有 Minecraft Java 版 +- 在 https://www.minecraft.net/profile 检查 +- 确保账户未被封禁 + +**4. 浏览器问题:** +- 尝试不同的浏览器 +- 清除浏览器缓存 +- 禁用广告拦截器 +- 使用无痕/隐私模式 + +### 令牌刷新失败 + +**问题:** 令牌刷新失败,必须频繁重新登录 + +**解决方案:** +1. 完全退出登录 +2. 从应用数据目录删除 `accounts.json` +3. 重新登录 +4. 如果持续存在,检查 Microsoft 账户状态 + +### 离线登录不工作 + +**问题:** 无法创建离线账户 + +**解决方案:** +- 用户名必须是 3-16 个字符 +- 仅使用字母、数字、下划线 +- 不使用特殊字符 +- 不使用空格 + +## 游戏启动问题 + +### 找不到 Java + +**问题:** "未找到 Java 安装" + +**解决方案:** + +**1. 自动检测现有 Java:** +- 设置 → Java → 检测安装 +- 如果找到,选择它 +- 如果未找到,进行步骤 2 + +**2. 通过 DropOut 下载 Java:** +- 设置 → Java → 下载 Java +- 选择适当的版本: + - Java 8 用于 Minecraft 1.12.2 及更早版本 + - Java 17 用于 Minecraft 1.18-1.20.4 + - Java 21 用于 Minecraft 1.20.5+ + +**3. 手动安装 Java:** +- 从 [Adoptium](https://adoptium.net/) 下载 +- 安装到系统 +- 重启 DropOut +- 再次检测 + +### Java 版本错误 + +**问题:** 游戏崩溃并提示"不支持的类文件版本" + +**解决方案:** +将 Java 版本与 Minecraft 版本匹配: + +| Minecraft 版本 | Java 版本 | +|-------------------|--------------| +| 1.7.10 及更早 | Java 8 | +| 1.8 - 1.12.2 | Java 8 | +| 1.13 - 1.16.5 | Java 8 或 11 | +| 1.17 - 1.17.1 | Java 16 | +| 1.18 - 1.20.4 | Java 17 | +| 1.20.5+ | Java 21 | + +### 内存不足错误 + +**问题:** 游戏崩溃并显示 `java.lang.OutOfMemoryError` + +**解决方案:** + +**1. 增加内存分配:** +- 设置 → 内存 +- 增加最大内存: + - 原版:最少 4GB + - 轻度模组:6GB + - 重度整合包:8-12GB +- 不要超过系统 RAM 的 80% + +**2. 使用 64 位 Java:** +- 检查当前 Java 架构 +- 如需要下载 64 位 Java +- 32 位 Java 限制在约 2GB + +**3. 降低渲染距离:** +- 游戏内视频设置 +- 将渲染距离降低到 8-12 区块 + +**4. 优化 JVM 参数:** +```bash +-Xms4G -Xmx8G -XX:+UseG1GC -XX:+UnlockExperimentalVMOptions +``` + +### 游戏无法启动 + +**问题:** 游戏不启动,没有错误消息 + +**检查:** + +**1. 日志输出:** +- 检查 DropOut 中的游戏控制台 +- 查找错误消息 +- 常见问题: + - 文件缺失 + - 下载损坏 + - 模组冲突 + +**2. 验证文件:** +- 删除版本文件夹 +- 重新下载版本 +- 在模组版本之前先尝试原版 + +**3. 检查权限:** +- 确保 DropOut 可以写入游戏目录 +- 检查文件夹权限 +- 在 Linux 上:`chmod -R 700 ~/.local/share/com.dropout.launcher`(仅当前用户可访问) + +## 下载问题 + +### 下载失败 + +**问题:** 资源或库下载失败 + +**解决方案:** + +**1. 网络问题:** +- 检查互联网连接 +- 禁用 VPN +- 尝试不同的网络 +- 检查防火墙/杀毒软件 + +**2. 恢复下载:** +- DropOut 自动恢复中断的下载 +- 关闭并重新打开 DropOut +- 下载应该继续 + +**3. 清除下载缓存:** +- 删除 libraries/assets 中的 `.part` 文件 +- 重新开始下载 + +**4. 手动下载:** +- 检查日志中失败的 URL +- 手动下载文件 +- 放置在正确位置 + +### 下载缓慢 + +**问题:** 下载非常慢 + +**解决方案:** + +**1. 调整线程数:** +- 设置 → 下载 +- 尝试不同的线程数: + - 太低:整体较慢 + - 太高:连接限流 + - 推荐:5-10 个线程 + +**2. 网络优化:** +- 关闭占用大量带宽的应用 +- 如可能使用有线连接 +- 检查 ISP 限速 + +**3. 备用 CDN:** +- Mojang 镜像可能很慢 +- 尝试在一天中的不同时间 + +## 模组加载器问题 + +### Fabric 安装失败 + +**问题:** 无法安装 Fabric 加载器 + +**解决方案:** + +**1. 检查 Minecraft 版本:** +- Fabric 支持 1.14+ +- 不支持更早版本 +- 尝试更新的 Minecraft 版本 + +**2. 网络问题:** +- 检查互联网连接 +- Fabric Meta API 可能宕机 +- 稍后再试 + +**3. 手动安装:** +- 从 [fabricmc.net](https://fabricmc.net/) 下载 Fabric +- 使用官方安装器 +- 将配置文件导入 DropOut + +### Forge 安装失败 + +**问题:** Forge 安装器失败或挂起 + +**解决方案:** + +**1. Java 版本:** +- 确保 Java 版本正确 +- Forge 1.17+ 需要 Java 16+ +- 更早的 Forge 可能需要 Java 8 + +**2. 安装器超时:** +- Forge 安装器可能很慢 +- 等待最多 10 分钟 +- 检查日志查看进度 + +**3. 磁盘空间:** +- 确保有足够的可用空间 +- Forge 临时需要约 1GB +- 检查 Linux 上的 `/tmp` + +**4. 手动安装:** +- 从 [minecraftforge.net](https://files.minecraftforge.net/) 下载 Forge 安装器 +- 手动运行安装器 +- 选择安装客户端 +- 导入配置文件 + +### 模组崩溃 + +**问题:** 安装模组后游戏崩溃 + +**解决方案:** + +**1. 检查兼容性:** +- 验证模组适用于正确的 Minecraft 版本 +- 检查模组加载器版本要求 +- 阅读模组说明了解依赖项 + +**2. 安装依赖项:** +- Fabric 模组通常需要 Fabric API +- 一些模组需要库 +- 检查崩溃日志中的"缺失"错误 + +**3. 移除冲突的模组:** +- 逐一禁用模组 +- 识别有问题的模组 +- 检查已知冲突 +- 更新或替换模组 + +**4. 更新模组:** +- 使用最新的模组版本 +- 检查模组更新说明 +- 一些更新修复崩溃 + +## 性能问题 + +### 低 FPS + +**问题:** 游戏运行缓慢或卡顿 + +**解决方案:** + +**1. 分配更多内存:** +- 将最大内存增加到 6-8GB +- 不要过度分配(导致 GC 暂停) + +**2. 安装性能模组:** +- **Fabric**: Sodium、Lithium、Phosphor +- **Forge**: OptiFine、Magnesium、Rubidium + +**3. 优化设置:** +- 降低渲染距离 +- 禁用精美图形 +- 关闭粒子 +- 如果 fps < 60 禁用垂直同步 + +**4. 更新显卡驱动:** +- 从制造商下载最新版本 +- NVIDIA: GeForce Experience +- AMD: Adrenalin +- Intel: Graphics Command Center + +**5. 关闭后台应用:** +- 释放系统资源 +- 禁用覆盖层(Discord 等) +- 检查任务管理器中的 CPU/RAM 占用 + +### 启动器启动缓慢 + +**问题:** DropOut 启动时间很长 + +**解决方案:** + +**1. 检查系统资源:** +- 关闭不必要的程序 +- 确保有足够的 RAM 可用 +- 检查 CPU 使用率 + +**2. 杀毒软件干扰:** +- 将 DropOut 添加到例外 +- 暂时禁用以测试 +- 一些杀毒软件会显著减慢速度 + +**3. 损坏的数据:** +- 删除应用数据中的 `cache` 文件夹 +- 重启 DropOut +- 将重建缓存 + +## UI 问题 + +### 窗口不打开 + +**问题:** DropOut 窗口不出现 + +**解决方案:** + +**1. 检查是否在运行:** +```bash +# Linux/macOS +ps aux | grep dropout + +# Windows +tasklist | findstr dropout +``` + +**2. 终止并重启:** +```bash +# Linux/macOS +pkill dropout + +# Windows +taskkill /F /IM dropout.exe +``` + +**3. 重置窗口位置:** +- 删除窗口状态配置 +- 重启 DropOut + +### 图形故障 + +**问题:** UI 看起来不对或有视觉伪影 + +**解决方案:** + +**1. 更新显卡驱动:** +- 安装最新驱动 +- 重启系统 + +**2. 禁用硬件加速:** +- 检查设置中是否存在选项 +- 可能会降低性能但修复故障 + +**3. 尝试不同的显示器:** +- 多显示器设置可能导致问题 +- 在不同显示器上尝试 + +## 文件系统问题 + +### 无法访问游戏目录 + +**问题:** 访问游戏文件时出错 + +**解决方案:** + +**1. 检查权限:** +```bash +# Linux +chmod -R 700 ~/.local/share/com.dropout.launcher + +# macOS +chmod -R 700 ~/Library/Application\ Support/com.dropout.launcher +``` + +**2. 检查磁盘空间:** +- 确保有足够的可用空间 +- Minecraft 需要 2-10GB,取决于模组 +- 清理旧版本 + +**3. 杀毒软件阻止:** +- 将游戏目录添加到例外 +- 一些杀毒软件会阻止文件访问 + +### 文件损坏 + +**问题:** 文件似乎损坏或无效 + +**解决方案:** + +**1. 验证校验和:** +- DropOut 验证 SHA1/SHA256 +- 验证失败会触发重新下载 + +**2. 重新下载:** +- 删除损坏的文件 +- 再次启动版本 +- DropOut 将重新下载 + +**3. 清除缓存:** +- 完全删除版本文件夹 +- 从头重新安装 + +## 获取更多帮助 + +### 收集调试信息 + +报告问题时,包括: + +**1. 系统信息:** +- 操作系统和版本 +- DropOut 版本 +- Java 版本 + +**2. 日志:** +- 控制台的启动器日志 +- 如适用的游戏日志 +- 错误消息(完整文本) + +**3. 重现步骤:** +- 你做了什么 +- 你期望什么 +- 实际发生了什么 + +**4. 截图:** +- 错误消息 +- UI 问题 +- 设置屏幕 + +### 报告问题 + +1. 搜索[现有 issues](https://github.com/HydroRoll-Team/DropOut/issues) +2. 如果未找到,[创建新 issue](https://github.com/HydroRoll-Team/DropOut/issues/new) +3. 使用 issue 模板 +4. 提供所有要求的信息 +5. 保持耐心和响应 + +### 社区支持 + +- **GitHub 讨论**:提问 +- **Discord**:实时帮助(如果可用) +- **文档**:查看所有指南 + +## 已知问题 + +### 目前正在处理 + +- 多账户切换(进行中) +- 自定义游戏目录选择(计划中) +- 启动器自动更新(计划中) + +### 可用的变通方法 + +**问题**:无法轻松切换账户 +**变通方法**:退出登录并使用不同账户登录 + +**问题**:没有内置模组管理器 +**变通方法**:在实例文件夹中手动管理模组 + +**问题**:无法从其他启动器导入 +**变通方法**:手动复制实例文件 diff --git a/packages/docs/public/favicon.ico b/packages/docs/public/favicon.ico index 5dbdfcd..be3c285 100644 Binary files a/packages/docs/public/favicon.ico and b/packages/docs/public/favicon.ico differ diff --git a/packages/docs/public/image.png b/packages/docs/public/image.png new file mode 100644 index 0000000..5bd52e1 Binary files /dev/null and b/packages/docs/public/image.png differ diff --git a/packages/docs/react-router.config.ts b/packages/docs/react-router.config.ts index cfcfbe4..51e8967 100644 --- a/packages/docs/react-router.config.ts +++ b/packages/docs/react-router.config.ts @@ -1,23 +1,5 @@ import type { Config } from '@react-router/dev/config'; -import { glob } from 'node:fs/promises'; -import { createGetUrl, getSlugs } from 'fumadocs-core/source'; - -const getUrl = createGetUrl('/docs'); export default { ssr: true, - async prerender({ getStaticPaths }) { - const paths: string[] = []; - const excluded: string[] = ['/api/search']; - - for (const path of getStaticPaths()) { - if (!excluded.includes(path)) paths.push(path); - } - - for await (const entry of glob('**/*.mdx', { cwd: 'content/docs' })) { - paths.push(getUrl(getSlugs(entry))); - } - - return paths; - }, } satisfies Config; diff --git a/packages/docs/source.config.ts b/packages/docs/source.config.ts index 0564068..d67a91b 100644 --- a/packages/docs/source.config.ts +++ b/packages/docs/source.config.ts @@ -1,7 +1,7 @@ import { defineConfig, defineDocs } from 'fumadocs-mdx/config'; export const docs = defineDocs({ - dir: 'content/docs', + dir: 'content', }); export default defineConfig();