First version of the Minecraft info site page complete.
This commit is contained in:
parent
a9c31d6959
commit
80b6ad7e83
@ -1,4 +1,5 @@
|
|||||||
--- # Introduction YAML
|
--- # Introduction YAML
|
||||||
|
|
||||||
intro: |
|
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.
|
||||||
|
@ -4,23 +4,48 @@ import WCard from "../../components/werefox-card";
|
|||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
|
|
||||||
export const getPlugins = async () =>
|
export const getPlugins = async () =>
|
||||||
await axios.get("http://192.168.0.202:8111/api/plugins/list").then(
|
await axios
|
||||||
(result) => {
|
.get("http://192.168.0.202:8111/api/plugins/list", {
|
||||||
return result.data;
|
headers: {
|
||||||
},
|
authorization:
|
||||||
(error) => {
|
"rawCvRhEhSJR9TDo9Snw25ZyNYzTKERMsZSVbseqMTyh957JhpbhspderiUAzb7d",
|
||||||
console.log(error);
|
},
|
||||||
return null;
|
})
|
||||||
}
|
.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
|
// Grab data from a static YAML file
|
||||||
export async function getStaticProps() {
|
export async function getStaticProps() {
|
||||||
const fs = require("fs");
|
const fs = require("fs");
|
||||||
const yaml = require("js-yaml");
|
const yaml = require("js-yaml");
|
||||||
let INTRODUCTION = {};
|
let INTRODUCTION = {};
|
||||||
const promise = getPlugins();
|
const info = await Promise.resolve(getInfo());
|
||||||
const plugins = await Promise.resolve(promise);
|
const plugins = await Promise.resolve(getPlugins());
|
||||||
const plugins_sorted = plugins.plugins
|
const plugins_sorted = plugins.plugins
|
||||||
.map((p) => {
|
.map((p) => {
|
||||||
return p[0].toUpperCase() + p.substr(1);
|
return p[0].toUpperCase() + p.substr(1);
|
||||||
@ -40,11 +65,16 @@ export async function getStaticProps() {
|
|||||||
props: {
|
props: {
|
||||||
INTRODUCTION,
|
INTRODUCTION,
|
||||||
plugins_list: plugins_sorted,
|
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 (
|
return (
|
||||||
<HomePage
|
<HomePage
|
||||||
theme="Ada"
|
theme="Ada"
|
||||||
@ -54,6 +84,13 @@ export default function Minecraft({ plugins_list, INTRODUCTION }) {
|
|||||||
<WCard theme="Ada" title="Queercule Minecraft Server">
|
<WCard theme="Ada" title="Queercule Minecraft Server">
|
||||||
<ICard theme="Ada" introduction={INTRODUCTION.intro} emoji_paths={{}} />
|
<ICard theme="Ada" introduction={INTRODUCTION.intro} emoji_paths={{}} />
|
||||||
</WCard>
|
</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">
|
<WCard theme="Ada" title="Plugins">
|
||||||
{Object.keys(plugins_list).map((plugin) => (
|
{Object.keys(plugins_list).map((plugin) => (
|
||||||
<div key={plugin} className="">
|
<div key={plugin} className="">
|
||||||
|
Loading…
Reference in New Issue
Block a user