Formatting and working setup page

Signed-off-by: Joshua Castle <26531652+Kas-tle@users.noreply.github.com>
This commit is contained in:
Joshua Castle committed 2024-01-25 22:38:57 -08:00
1 parent 7ee23e37a5
commit 1e1c80cc0c
19 files changed
+509 -14981

No files matched your search

+2
View File
@@ -26,3 +26,5 @@ vendor
npm-debug.log*
yarn-debug.log*
yarn-error.log*
yarn.lock
package-lock.json
+25
View File
@@ -0,0 +1,25 @@
{
"typescript.experimental.tsserver.web.enableProjectWideIntellisense": true,
"typescript.tsserver.experimental.enableProjectDiagnostics": true,
"search.exclude": {
"**/node_modules": true,
"**/dist": true
},
"editor.detectIndentation": false,
"editor.autoIndent": "full",
"editor.indentSize": "tabSize",
"[typescript]": {
"editor.defaultFormatter": "vscode.typescript-language-features",
"editor.tabSize": 4
},
"[json]": {
"editor.defaultFormatter": "vscode.json-language-features",
"editor.tabSize": 4
},
"[javascript]": {
"editor.defaultFormatter": "vscode.typescript-language-features",
"editor.tabSize": 4
},
"typescript.referencesCodeLens.enabled": false,
"typescript.referencesCodeLens.showOnAllFunctions": false
}
-58
View File
@@ -1,58 +0,0 @@
---
title: Setup
page_sidebar: false
---
[//]: # ()
[//]: # (<div class="row gap-4 mx-0" role="tablist">)
[//]: # ( <a class="col btn btn-outline-primary active" href="#" data-bs-toggle="tab" data-bs-target="#host-provider-options" type="button" role="tab" aria-controls="host-provider-options" aria-selected="true">Host Provider</a>)
[//]: # ( <a class="col btn btn-outline-primary" href="#" data-bs-toggle="tab" data-bs-target="#self-host-options" type="button" role="tab" aria-controls="self-host-options" aria-selected="false">Self Host</a>)
[//]: # (</div>)
[//]: # ()
[//]: # (<div class="tab-content mt-4">)
[//]: # ( <div id="host-provider-options" class="tab-pane fade show active" role="tabpanel">)
[//]: # ( {% include setup/host-provider.html %})
[//]: # ()
[//]: # ( {% include setup/instructions/geyser/tabs.html type="provider" %})
[//]: # ( </div>)
[//]: # ()
[//]: # ( <div id="self-host-options" class="tab-pane fade" role="tabpanel">)
[//]: # ( {% include setup/instructions/geyser/tabs.html type="selfhost" show_standalone=true %})
[//]: # ( </div>)
[//]: # (</div>)
[//]: # ()
[//]: # (<div class="alert alert-warning" role="alert">)
[//]: # ( <b>Experiencing issues?</b> )
[//]: # ( Start with the <a href="/geyser/common-issues/">Common Issues</a> page.)
[//]: # ( If your issue is not included there, join our <a href="https://discord.gg/geysermc">Discord server</a> for support.)
[//]: # (</div>)
[//]: # ()
[//]: # (<h4 class="mt-4">Further information:</h4>)
[//]: # (<ul>)
[//]: # ( <li><a href="/geyser/understanding-the-config/">Full config documentation</a></li>)
[//]: # ( <li><a href="/geyser/current-limitations/">Current Limitations</a></li>)
[//]: # ( <li><a href="/geyser/faq/">Frequently asked questions</a></li>)
[//]: # (</ul>)
+51
View File
@@ -0,0 +1,51 @@
---
title: Setup
page_sidebar: false
---
import Tabs from "@theme/Tabs";
import TabItem from "@theme/TabItem";
import Fabric from './setup/provider/fabric.mdx';
import ProxyServers from './setup/provider/proxy-servers.mdx';
import PaperSpigot from './setup/provider/paper-spigot.mdx';
import FabricSelf from './setup/self/fabric.mdx';
import ProxyServersSelf from './setup/self/proxy-servers.mdx';
import PaperSpigotSelf from './setup/self/paper-spigot.mdx';
import Standalone from './setup/self/standalone.mdx';
import { ProviderSelector } from "../../src/components/Provider";
<Tabs>
<TabItem value="host-provider" label="Host Provider" default>
<ProviderSelector/>
<Tabs>
<TabItem value="paper-spigot" label="Paper / Spigot" default>
<PaperSpigot/>
</TabItem>
<TabItem value="fabric" label="Fabric">
<Fabric/>
</TabItem>
<TabItem value="proxy-servers" label="Proxy Servers">
<ProxyServers/>
</TabItem>
</Tabs>
</TabItem>
<TabItem value="self-host" label="Self Host">
<Tabs>
<TabItem value="paper-spigot-self" label="Paper / Spigot" default>
<PaperSpigotSelf/>
</TabItem>
<TabItem value="fabric-self" label="Fabric">
<FabricSelf/>
</TabItem>
<TabItem value="proxy-servers-self" label="Proxy Servers">
<ProxyServersSelf/>
</TabItem>
<TabItem value="standalone" label="Standalone">
<Standalone/>
</TabItem>
</Tabs>
</TabItem>
</Tabs>
+38
View File
@@ -0,0 +1,38 @@
import { Versions } from '../../../../src/components/Versions'
## Fabric setup with server hosting provider
:::caution
Geyser-Fabric runs **only** on a <Versions platform="java"/> Fabric server.
To use Geyser on an older Fabric server, you can use Geyser on a BungeeCord/Velocity proxy, or Geyser Standalone instead.
:::
1. Select your server hosting provider in the dropdown above.
2. Download the mod from [the download page](https://download.geysermc.org/v2/projects/geyser/versions/latest/builds/latest/downloads/fabric).
3. Place the Geyser-Fabric.jar in the `mods` folder, and restart the server. **You also need [FabricAPI](https://modrinth.com/mod/fabric-api).**
4. Open your Geyser config, located in `/config/Geyser-Fabric/config.yml`, and find the following:
```yaml
bedrock:
# The IP address that will listen for connections.
# Generally, you should only uncomment and change this if you want to limit what IPs can connect to your server.
#address: 0.0.0.0
# The port that will listen for connections. This is the port that Bedrock players will use to connect to your server.
port: 19132
# Some hosting services change your Java port everytime you start the server and require the same port to be used for Bedrock.
# This option makes the Bedrock port the same as the Java port every time you start the server.
# This option is for the plugin version only.
clone-remote-port: false
```
The vital part is the port. This is the port that Bedrock players will use to connect to your server.
Follow the instructions in the provider selector - change the port, and if necessary, `clone-remote-port` & `address`.
If `clone-remote-port` is enabled, the bedrock port will be overwritten with the Java port!
**Important**: Other services/mods that rely on ports with UDP, such as Voice Chats or Query, cannot share the port with Geyser.
5. Verify whether connections are possible by running `geyser connectiontest <ip>:<port>` in the console.
:::info
To allow Bedrock Edition players to join your server without needing to log in to a paid Java Edition account, you can use <a href="/floodgate/setup/">Floodgate</a>.
:::
@@ -0,0 +1,38 @@
import { Versions } from '../../../../src/components/Versions'
## Paper / Spigot setup with server hosting provider
:::info
If your server is not running <Versions platform="java"/>, you will need to install <a href="https://www.spigotmc.org/resources/viaversion.19254/">ViaVersion</a>.
See also our <a href="/geyser/faq/#what-server-versions-does-geyser-support">FAQ article</a> on supported versions.
:::
1. Select your server hosting provider in the dropdown above.
2. Download the plugin from [the download page](https://download.geysermc.org/v2/projects/geyser/versions/latest/builds/latest/downloads/spigot).
3. Place the Geyser-Spigot.jar in the `plugins` folder, and restart the server.
4. Open your Geyser config, located in `/plugins/Geyser-Spigot/config.yml`, and find the following:
```yaml
bedrock:
# The IP address that will listen for connections.
# Generally, you should only uncomment and change this if you want to limit what IPs can connect to your server.
#address: 0.0.0.0
# The port that will listen for connections. This is the port that Bedrock players will use to connect to your server.
port: 19132
# Some hosting services change your Java port everytime you start the server and require the same port to be used for Bedrock.
# This option makes the Bedrock port the same as the Java port every time you start the server.
# This option is for the plugin version only.
clone-remote-port: false
```
The vital part is the port. This is the port that Bedrock players will use to connect to your server.
Follow the instructions in the provider selector - change the port, and if necessary, `clone-remote-port` & `address`.
If `clone-remote-port` is enabled, the bedrock port will be overwritten with the Java port!
**Important**: Other services/plugins that rely on ports with UDP, such as Voice Chats or Query, cannot share the port with Geyser.
5. Verify whether connections are possible by running `geyser connectiontest <ip>:<port>` in the console.
:::info
To allow Bedrock Edition players to join your server without needing to log in to a paid Java Edition account, you can use <a href="/floodgate/setup/">Floodgate</a>.
:::
@@ -0,0 +1,39 @@
import { Versions } from '../../../../src/components/Versions'
## Proxy setup with server hosting provider
:::info
- Install Geyser **only** on the proxy server! You can install Floodgate on all servers for better skin support &
network-wide Floodgate API availability for other plugins.
- All servers on the network must accept <Versions platform="java"/> Java clients, as Geyser imitates one.
:::
1. Select your server hosting provider in the dropdown above.
2. Download the plugin for your proxy software from [the download page](https://geysermc.org/download).
3. Place the Geyser jar in the `plugins` folder, and restart the server.
4. Open your Geyser config, located in `/plugins/Geyser-xyz/config.yml`, and find the following:
```yaml
bedrock:
# The IP address that will listen for connections.
# Generally, you should only uncomment and change this if you want to limit what IPs can connect to your server.
#address: 0.0.0.0
# The port that will listen for connections. This is the port that Bedrock players will use to connect to your server.
port: 19132
# Some hosting services change your Java port everytime you start the server and require the same port to be used for Bedrock.
# This option makes the Bedrock port the same as the Java port every time you start the server.
# This option is for the plugin version only.
clone-remote-port: false
```
The vital part is the port. This is the port that Bedrock players will use to connect to your server.
Follow the instructions in the provider selector - change the port, and if necessary, `clone-remote-port` & `address`.
If `clone-remote-port` is enabled, the bedrock port will be overwritten with the Java port!
**Important**: Other services/plugins that rely on ports with UDP, such as Voice Chats or Query, cannot share the port with Geyser.
5. Verify whether connections are possible by running `geyser connectiontest <ip>:<port>` in the console.
:::info
To allow Bedrock Edition players to join your server without needing to log in to a paid Java Edition account, you can use <a href="/floodgate/setup/">Floodgate</a>.
:::
+52
View File
@@ -0,0 +1,52 @@
import { Versions } from '../../../../src/components/Versions'
## Fabric setup - self-hosting
:::caution
Geyser-Fabric runs **only** on a <Versions platform="java"/> Fabric server.
To use Geyser on an older Fabric server, you can use Geyser on a BungeeCord/Velocity proxy, or Geyser Standalone instead.
:::
1. Download the mod from [the download page](https://download.geysermc.org/v2/projects/geyser/versions/latest/builds/latest/downloads/fabric).
2. Place the Geyser-Fabric.jar in the `mods` folder, and restart the server. **You also need [FabricAPI](https://modrinth.com/mod/fabric-api).**
3. Open your Geyser config, located in `/config/Geyser-Fabric/config.yml`, and find the following:
```yaml
bedrock:
# The IP address that will listen for connections.
# Generally, you should only uncomment and change this if you want to limit what IPs can connect to your server.
#address: 0.0.0.0
# The port that will listen for connections. This is the port that Bedrock players will use to connect to your server.
port: 19132
```
The vital part is the port. This is the port that Bedrock players will use to connect to your server!
If you enable `clone-remote-port`, the port will be overridden and the Java port is used.
Since you are self-hosting, you can choose the port freely - the default port is 19132.
**Important**: Other services/mods that rely on ports with UDP, such as Voice Chats or Query, cannot share the port with Geyser.
4. Connecting to your server
**Connecting locally in the same network**
On the same device as the server, you can connect using `localhost`, or `127.0.0.1` as the address.
Do note: When hosting and playing on the same Windows device, you will need the [loopback fix](/geyser/fixing-unable-to-connect-to-world/#Using-Geyser-on-the-same-computer).
Other devices in the same local network can use your local IPv4 to connect - it starts with `10.` or `192.168.`.
**Connecting from a different network**
You will need to expose the port Geyser runs on to the Internet if you want players from outside your network to join.
To achieve that, you have two options:
- Port forwarding: Open the Geyser port (e.g. 19132) on the UDP protocol in your router/modem, and in the Windows/Linux firewall.
[Our port forwarding guide](/geyser/port-forwarding) explains how to do this in detail.
Then, players can connect with your public IPv4 + port to your server.
- playit.gg: Instead of opening a port (which might not be an option/if you do not want to expose your home ip), you can use
the playit.gg service to create a tunnel for you to route the traffic through. See our [playit.gg guide](/geyser/playit-gg).
Ngrok will not work since it is TCP-only.
5. Verify whether connections from other networks are possible by running `geyser connectiontest <ip>:<port>` in the console.
:::info
To allow Bedrock Edition players to join your server without needing to log in to a paid Java Edition account, you can use <a href="/floodgate/setup/">Floodgate</a>.
:::
+52
View File
@@ -0,0 +1,52 @@
import { Versions } from '../../../../src/components/Versions'
## Paper / Spigot setup - self-hosting
:::info
If your server is not running <Versions platform="java"/>, you will need to install <a href="https://www.spigotmc.org/resources/viaversion.19254/">ViaVersion</a>.
See also our <a href="/geyser/faq/#what-server-versions-does-geyser-support">FAQ article</a> on supported versions.
:::
1. Download the plugin from [the download page](https://download.geysermc.org/v2/projects/geyser/versions/latest/builds/latest/downloads/spigot).
2. Place the Geyser-Spigot.jar in the `plugins` folder, and restart the server.
3. Open your Geyser config, located in `/plugins/Geyser-Spigot/config.yml`, and find the following:
```yaml
bedrock:
# The IP address that will listen for connections.
# Generally, you should only uncomment and change this if you want to limit what IPs can connect to your server.
#address: 0.0.0.0
# The port that will listen for connections. This is the port that Bedrock players will use to connect to your server.
port: 19132
```
The vital part is the port. This is the port that Bedrock players will use to connect to your server!
If you enable `clone-remote-port`, the port will be overridden and the Java port is used.
Since you are self-hosting, you can choose the port freely - the default port is 19132.
**Important**: Other services/plugins that rely on ports with UDP, such as Voice Chats or Query, cannot share the port with Geyser.
4. Connecting to your server
**Connecting locally in the same network**
On the same device as the server, you can connect using `localhost`, or `127.0.0.1` as the address.
Do note: When hosting and playing on the same Windows device, you will need the [loopback fix](/geyser/fixing-unable-to-connect-to-world/#Using-Geyser-on-the-same-computer).
Other devices in the same local network can use your local IPv4 to connect - it starts with `10.` or `192.168.`.
**Connecting from a different network**
You will need to expose the port Geyser runs on to the Internet if you want players from outside your network to join.
To achieve that, you have two options:
- Port forwarding: Open the Geyser port (e.g. 19132) on the UDP protocol in your router/modem, and in the Windows/Linux firewall.
[Our port forwarding guide](/geyser/port-forwarding) explains how to do this in detail.
After doing this, players can connect with your public IPv4 + port to your server.
- playit.gg: Instead of opening a port (which might not be an option/if you do not want to expose your home ip), you can use
the playit.gg service to create a tunnel for you to route the traffic through. See our [playit.gg guide](/geyser/playit-gg).
Ngrok will not work since it is TCP-only.
5. Verify whether connections from other networks are possible by running `geyser connectiontest <ip>:<port>` in the console.
:::caution
To allow Bedrock Edition players to join your server without needing to log in to a paid Java Edition account, you can use <a href="/floodgate/setup/">Floodgate</a>.
:::
+52
View File
@@ -0,0 +1,52 @@
import { Versions } from '../../../../src/components/Versions'
## Proxy setup - self-hosting
:::info
- Install Geyser **only** on the proxy server! You can install Floodgate on all servers for better skin support & network-wide Floodgate API availability for other plugins.
- All servers on the network must accept <Versions platform="java"/> Java clients, as Geyser imitates one.
:::
1. Download the plugin for your proxy software from [the download page](https://geysermc.org/download).
2. Place the Geyser jar in the `plugins` folder, and restart the server.
3. Open your Geyser config, located in `/plugins/Geyser-xyz/config.yml`, and find the following:
```yaml
bedrock:
# The IP address that will listen for connections.
# Generally, you should only uncomment and change this if you want to limit what IPs can connect to your server.
#address: 0.0.0.0
# The port that will listen for connections. This is the port that Bedrock players will use to connect to your server.
port: 19132
```
The vital part is the port. This is the port that Bedrock players will use to connect to your server!
If you enable `clone-remote-port`, the port will be overridden and the Java port is used.
Since you are self-hosting, you can choose the port freely - the default port is 19132.
**Important**: Other services/plugins that rely on ports with UDP, such as Voice Chats or Query, cannot share the port with Geyser.
4. Connecting to your server
**Connecting locally in the same network**
On the same device as the server, you can connect using `localhost`, or `127.0.0.1` as the address.
Do note: When hosting and playing on the same Windows device, you will need the [loopback fix](/geyser/fixing-unable-to-connect-to-world/#Using-Geyser-on-the-same-computer).
Other devices in the same local network can use your local IPv4 to connect - it starts with `10.` or `192.168.`.
**Connecting from a different network**
You will need to expose the port Geyser runs on to the Internet if you want players from outside your network to join.
To achieve that, you have two options:
- Port forwarding: Open the Geyser port (e.g. 19132) on the UDP protocol in your router/modem, and in the Windows/Linux firewall.
[Our port forwarding guide](/geyser/port-forwarding) explains how to do this in detail.
Then, players can connect with your public IPv4 + port to your server.
- playit.gg: Instead of opening a port (which might not be an option/if you do not want to expose your home ip), you can use
the playit.gg service to create a tunnel for you to route the traffic through. See our [playit.gg guide](/geyser/playit-gg).
Ngrok will not work since it is TCP-only.
5. Verify whether connections from other networks are possible by running `geyser connectiontest <ip>:<port>` in the console.
:::info
To allow Bedrock Edition players to join your server without needing to log in to a paid Java Edition account, you can use <a href="/floodgate/setup/">Floodgate</a>.
:::
+95
View File
@@ -0,0 +1,95 @@
## Geyser-Standalone Setup
:::info
You need to have Java 17 or higher installed to run Geyser. To run Geyser Standalone on Android, see the bottom of this page.
:::
:::caution
Geyser-Standalone is NOT a plugin or mod! It is a standalone Java program that you would run separately to your Java Edition server.
:::
### General Setup & Configuration
1. Download Geyser Standalone from [here](https://download.geysermc.org/v2/projects/geyser/versions/latest/builds/latest/downloads/standalone).
2. Create a new folder for Geyser, and drop the jar in there.
3. Start Geyser Standalone:
- **GUI** (Recommended):
Double-click the jar file and all the necessary files for Geyser will be created.
- Or use the **console setup**:
Create a new bat or startup script, similar to the one you'd use for a Spigot/Paper server, and take a look at [this](/geyser/creating-a-startup-script/) page for what to put into it.
Run the startup script/bat, and all the necessary files for Geyser will be created.
4. Open your Geyser config (`config.yml`), and find the following:
```yaml
bedrock:
# The IP address that will listen for connections.
# Generally, you should only uncomment and change this if you want to limit what IPs can connect to your server.
#address: 0.0.0.0
# The port that will listen for connections. This is the port that Bedrock players will use to connect to your server.
port: 19132
```
The `port` is the port Bedrock players will enter to connect to the server.
Uncommenting and changing `address` here is only needed if you need to limit connections to a specific IP address.
To configure which Java Edition server Geyser Standalone will send players to, find the remote section:
```yaml
remote:
# The IP address of the remote (Java Edition) server
# If it is "auto", for standalone version the remote address will be set to 127.0.0.1.
address: auto
# The port of the remote (Java Edition) server
port: 25565
# Authentication type. Can be offline, online, or floodgate (see https://github.com/GeyserMC/Geyser/wiki/Floodgate).
auth-type: online
```
Here, change `address` to the Java server's address, or to `auto` if the server is on the same machine as Geyser-Standalone.
Then, change `port` to the Java server's port. If you have set up Floodgate on the remote Java server, you can set auth-type to "floodgate" - otherwise,
set it to either `online` for an online mode server, or `offline` for an offline mode server. To install and set up Floodgate with a Standalone server, see [here](/floodgate/setup).
5. Connecting to your server
**Connecting locally in the same network**
On the same device as the server, you can connect using `localhost`, or `127.0.0.1` as the address.
Do note: When hosting and playing on the same Windows device, you will need the [loopback fix](/geyser/fixing-unable-to-connect-to-world/#Using-Geyser-on-the-same-computer).
Other devices in the same local network can use your local IPv4 to connect - it starts with `10.` or `192.168.`.
Alternatively, open Minecraft: Bedrock edition, and join the LAN-Server in the **Friends** tab.
**Connecting from a different network**
You will need to expose the port Geyser runs on to the Internet if you want players from outside your network to join.
To achieve that, you have two options:
- Port forwarding: Open the Geyser port (e.g. 19132) on the UDP protocol in your router/modem, and in the Windows/Linux firewall.
After doing this, players can connect with your public IPv4 + port to your server.
See [here](/geyser/port-forwarding/) for a helpful guide.
- playit.gg: Instead of opening a port (which might not be an option/if you do not want to expose your home ip), you can use
the playit.gg service to create a tunnel for you to route the traffic through. See our [playit.gg guide](/geyser/playit-gg).
Ngrok will not work since it is TCP-only.
6. Verify whether connections from other networks are possible by running `geyser connectiontest <ip>:<port>` in the console.
### Running Geyser-Standalone on Android
:::caution
Applications such as Termux on Android are capable of running Geyser, but this largely depends on how powerful your Android device is. Please do so at your own risk.
:::
#### Termux (Android)
1. Download and install [Termux](https://termux.com/)
2. Run `pkg install openjdk-17`
3. Run `wget https://download.geysermc.org/v2/projects/geyser/versions/latest/builds/latest/downloads/standalone`
4. Run `java -jar Geyser-Standalone.jar`
OR
We have an automated setup script for clean Termux installs, which might not work for all users. If the manual guide above does not work, try this.
Run this to start the download/install:
```
curl https://gist.githubusercontent.com/rtm516/e3e07d6595ee41e05a38b03c0f4d7a80/raw/install.sh | bash
```
+2 -2
View File
@@ -1,5 +1,5 @@
import {themes as prismThemes} from 'prism-react-renderer';
import type {Config} from '@docusaurus/types';
import { themes as prismThemes } from 'prism-react-renderer';
import type { Config } from '@docusaurus/types';
import type * as Preset from '@docusaurus/preset-classic';
const config: Config = {
+3 -3
View File
@@ -1,5 +1,5 @@
(function () {
function getQueryVariable (variable) {
function getQueryVariable(variable) {
const query = window.location.search.substring(1)
const vars = query.split('&')
@@ -12,7 +12,7 @@
}
}
function getPreview (query, content, previewLength) {
function getPreview(query, content, previewLength) {
previewLength = previewLength || (content.length * 2)
const parts = query.split(' ')
@@ -55,7 +55,7 @@
return preview
}
function displaySearchResults (results, query) {
function displaySearchResults(results, query) {
const searchResultsEl = document.getElementById('search-results')
const searchProcessEl = document.getElementById('search-process')
-14910
View File
File diff suppressed because it is too large. Load diff
+2 -2
View File
@@ -1,4 +1,4 @@
import type {SidebarsConfig} from '@docusaurus/plugin-content-docs';
import type { SidebarsConfig } from '@docusaurus/plugin-content-docs';
/**
* Creating a sidebar enables you to:
@@ -12,7 +12,7 @@ import type {SidebarsConfig} from '@docusaurus/plugin-content-docs';
*/
const sidebars: SidebarsConfig = {
// By default, Docusaurus generates a sidebar from the docs folder structure
tutorialSidebar: [{type: 'autogenerated', dirName: '.'}],
tutorialSidebar: [{ type: 'autogenerated', dirName: '.' }],
geyserSidebar: [
'geyser/index',
+1 -1
View File
@@ -41,7 +41,7 @@ const FeatureList: FeatureItem[] = [
},
];
function Feature({title, Svg, description}: FeatureItem) {
function Feature({ title, Svg, description }: FeatureItem) {
return (
<div className={clsx('col col--4')}>
<div className="text--center">
+50 -3
View File
@@ -1,12 +1,14 @@
import type {Providers, HostingProvider, ProviderType} from "@site/src/types/providers";
import type { Providers, HostingProvider, ProviderType } from "@site/src/types/providers";
import ReactMarkdown from "react-markdown";
import Admonition from '@theme/Admonition';
import React, { useState } from 'react';
export const noP = (props: { children: any; }) => {
const { children } = props;
return children;
}
export const Provider = ({type}) => {
export const Provider = ({ type }) => {
const data: Providers = require('@site/_data/providers.json')
const providers: HostingProvider[] = data[type as ProviderType]
@@ -18,7 +20,7 @@ export const Provider = ({type}) => {
<li>
<a href={provider.url}>{provider.name}</a>
{provider.description != null || provider.description_template != null ? (
<ReactMarkdown children={`&nbsp;&hyphen; ${data.description_templates[provider.description_template] || ''} ${provider.description || ''}`} components={{p: noP}} />
<ReactMarkdown children={`&nbsp;&hyphen; ${data.description_templates[provider.description_template] || ''} ${provider.description || ''}`} components={{ p: noP }} />
) : (
''
)}
@@ -27,3 +29,48 @@ export const Provider = ({type}) => {
</div>
)
}
export const ProviderSelector = () => {
const data: Providers = require('@site/_data/providers.json')
const providers: HostingProvider[] = [
...Object.values(data.built_in),
...Object.values(data.support),
...Object.values(data.no_support)
].flat();
// update providers if description_template is set
providers.forEach((provider) => {
if (provider.description_template != null) {
provider.description = data.description_templates[provider.description_template]
}
})
const [selectedProvider, setSelectedProvider] = useState(null);
const handleSelectionChange = (event) => {
const selectedName = event.target.value;
const provider = providers.find(p => p.name === selectedName);
setSelectedProvider(provider);
}
return (
<div>
<select onChange={handleSelectionChange}>
<option value="none">Select a provider</option>
{providers.map((provider) => (
<option key={provider.name} value={provider.name}>
{provider.name}
</option>
))}
</select>
<Admonition type="info">
{selectedProvider ? (
<ReactMarkdown>{selectedProvider.description}</ReactMarkdown>
) : (
<p>Select a provider to see the description</p>
)}
</Admonition>
</div>
);
}
+5
View File
@@ -0,0 +1,5 @@
import versions from '../../_data/versions.json';
export const Versions = ({ platform }) => {
return versions[platform]
};
+2 -2
View File
@@ -8,7 +8,7 @@ import Heading from '@theme/Heading';
import styles from './index.module.css';
function HomepageHeader() {
const {siteConfig} = useDocusaurusContext();
const { siteConfig } = useDocusaurusContext();
return (
<header className={clsx('hero hero--primary', styles.heroBanner)}>
<div className="container">
@@ -29,7 +29,7 @@ function HomepageHeader() {
}
export default function Home(): JSX.Element {
const {siteConfig} = useDocusaurusContext();
const { siteConfig } = useDocusaurusContext();
return (
<Layout
title={`Hello from ${siteConfig.title}`}