First version of the Minecraft info site page complete.

This commit is contained in:
Alexis Werefox 2022-09-27 00:28:10 +00:00
parent a9c31d6959
commit 80b6ad7e83
2 changed files with 51 additions and 13 deletions

View File

@ -1,4 +1,5 @@
--- # Introduction YAML
intro: |
Here's some information on the Queercule's Minecraft server.
Here's some information on the Queercule's Minecraft server.
If you're here looking for how to play on our server, you'll need to be on our apartment's internet (or on VPN) and either add a server connection or do a direct connection to this site's URL.

View File

@ -4,23 +4,48 @@ import WCard from "../../components/werefox-card";
import axios from "axios";
export const getPlugins = async () =>
await axios.get("http://192.168.0.202:8111/api/plugins/list").then(
(result) => {
return result.data;
},
(error) => {
console.log(error);
return null;
}
);
await axios
.get("http://192.168.0.202:8111/api/plugins/list", {
headers: {
authorization:
"rawCvRhEhSJR9TDo9Snw25ZyNYzTKERMsZSVbseqMTyh957JhpbhspderiUAzb7d",
},
})
.then(
(result) => {
return result.data;
},
(error) => {
console.log(error);
return null;
}
);
export const getInfo = async () =>
await axios
.get("http://192.168.0.202:8111/api/server", {
headers: {
authorization:
"rawCvRhEhSJR9TDo9Snw25ZyNYzTKERMsZSVbseqMTyh957JhpbhspderiUAzb7d",
},
})
.then(
(result) => {
return result.data;
},
(error) => {
console.log(error);
return null;
}
);
// Grab data from a static YAML file
export async function getStaticProps() {
const fs = require("fs");
const yaml = require("js-yaml");
let INTRODUCTION = {};
const promise = getPlugins();
const plugins = await Promise.resolve(promise);
const info = await Promise.resolve(getInfo());
const plugins = await Promise.resolve(getPlugins());
const plugins_sorted = plugins.plugins
.map((p) => {
return p[0].toUpperCase() + p.substr(1);
@ -40,11 +65,16 @@ export async function getStaticProps() {
props: {
INTRODUCTION,
plugins_list: plugins_sorted,
server_info: info,
},
};
}
export default function Minecraft({ plugins_list, INTRODUCTION }) {
export default function Minecraft({ plugins_list, server_info, INTRODUCTION }) {
const server_info_keys = {
serverVersion: "Server Version",
serverBukkitVersion: "Bukkit Version",
};
return (
<HomePage
theme="Ada"
@ -54,6 +84,13 @@ export default function Minecraft({ plugins_list, INTRODUCTION }) {
<WCard theme="Ada" title="Queercule Minecraft Server">
<ICard theme="Ada" introduction={INTRODUCTION.intro} emoji_paths={{}} />
</WCard>
<WCard theme="Ada" title="Server Info">
{Object.keys(server_info_keys).map((key) => (
<div key={key} className="">
{server_info_keys[key]}: {server_info[key]}
</div>
))}
</WCard>
<WCard theme="Ada" title="Plugins">
{Object.keys(plugins_list).map((plugin) => (
<div key={plugin} className="">