This repository has been archived by the owner on Aug 2, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
197 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
import { useContext } from "react"; | ||
import { ConfigContext } from "@stores/config"; | ||
import Button from "@components/Button"; | ||
import styles from "@styles"; | ||
|
||
export default function Finalize() { | ||
const { config } = useContext(ConfigContext); | ||
|
||
const convertConfigToFile = () => { | ||
const configStore = { ...config }; | ||
delete configStore.canGoForward; | ||
const blob = new Blob([JSON.stringify(configStore, null, 4)], { type: "application/json" }); | ||
const url = URL.createObjectURL(blob); | ||
const a = document.createElement("a"); | ||
a.href = url; | ||
a.download = "config.json"; | ||
a.click(); | ||
URL.revokeObjectURL(url); | ||
} | ||
|
||
return ( | ||
<> | ||
<div className={styles.all.bigText}>Are these settings correct?</div> | ||
<div className={styles.all.smallText}> | ||
You can always go back and change these settings at any time. | ||
<details style={{ marginTop: "20px" }}> | ||
<summary>Information</summary> | ||
<ul style={{ textAlign: "left" }}> | ||
<li><b>Server Name:</b> {config.information.name}</li> | ||
<li><b>Welcome Message:</b> {config.information.welcome}</li> | ||
<li><b>Welcome Description:</b> {config.information.description}</li> | ||
<li><b>Pronunciation Enabled:</b> {config.information.pronunciation.enabled ? "Yes" : "No"}</li> | ||
{ | ||
config.information.pronunciation.enabled && <li><b>Pronunciation Text:</b> {config.information.pronunciation.text}</li> | ||
} | ||
</ul> | ||
</details> | ||
<details> | ||
<summary>Theme</summary> | ||
<ul style={{ textAlign: "left" }}> | ||
<li><b>Background Color:</b> {config.theme.backgroundColor || "Default"}</li> | ||
<li><b>Background Blooks Enabled:</b> {config.theme.backgroundBlooks ? "Yes" : "No"}</li> | ||
<li><b>Primary Color:</b> {config.theme.primaryColor || "Default"}</li> | ||
<li><b>Secondary Color:</b> {config.theme.secondaryColor || "Default"}</li> | ||
<li><b>Accent Color:</b> {config.theme.accentColor || "Default"}</li> | ||
</ul> | ||
</details> | ||
<details> | ||
<summary>Database</summary> | ||
<ul style={{ textAlign: "left" }}> | ||
<li><b>Database Type:</b> {config.database.type}</li> | ||
{!["", "sqlite"].includes(config.database.type) && <> | ||
<li><b>Database Host:</b> {config.database.host}</li> | ||
<li><b>Database Port:</b> {config.database.port}</li> | ||
<li><b>Database Name:</b> {config.database.name}</li> | ||
<li><b>Database Username:</b> {config.database.username}</li> | ||
<li><b>Database Password Enabled:</b> {config.database.password.enabled ? "Yes" : "No"}</li> | ||
{ | ||
config.database.password.enabled && <li><b>Database Password:</b> {config.database.password.value.split("").map(() => "*").join("")}</li> | ||
} | ||
</>} | ||
</ul> | ||
</details> | ||
<details> | ||
<summary>PayPal</summary> | ||
<ul style={{ textAlign: "left" }}> | ||
<li><b>PayPal Enabled:</b> {config.paypal.enabled ? "Yes" : "No"}</li> | ||
{ | ||
config.paypal.enabled && <> | ||
<li><b>PayPal Mode:</b> {config.paypal.mode}</li> | ||
<li><b>PayPal Client ID:</b> {config.paypal.clientID}</li> | ||
<li><b>PayPal Client Secret:</b> {config.paypal.clientSecret.split("").map(() => "*").join("")}</li> | ||
</> | ||
} | ||
</ul> | ||
</details> | ||
<details> | ||
<summary>Miscellaneous</summary> | ||
<ul style={{ textAlign: "left" }}> | ||
<li><b>Server Port:</b> {config.miscellaneous.server_port}</li> | ||
{ | ||
config.miscellaneous.discord_invite !== "" && <li><b>Discord Invite:</b> {config.miscellaneous.discord_invite}</li> | ||
} | ||
<li><b>Verbose Logging Enabled:</b> {config.miscellaneous.verbose_logging ? "Yes" : "No"}</li> | ||
<li><b>Block Proxies Enabled:</b> {config.miscellaneous.block_proxies ? "Yes" : "No"}</li> | ||
<li><b>Allow Multiple Accounts Enabled:</b> {config.miscellaneous.allow_multiple_accounts ? "Yes" : "No"}</li> | ||
<li><b>Backup Enabled:</b> {config.miscellaneous.backup_enabled ? "Yes" : "No"}</li> | ||
{ | ||
config.miscellaneous.backup_enabled && <li><b>Backup Interval:</b> {config.miscellaneous.backup_interval}</li> | ||
} | ||
<li><b>Level Difficulty:</b> {config.miscellaneous.level_difficulty}</li> | ||
</ul> | ||
</details> | ||
|
||
<div style={{ marginTop: "20px", width: "50%", marginLeft: "auto", marginRight: "auto" }}> | ||
<Button onClick={convertConfigToFile}> | ||
Download Configuration | ||
</Button> | ||
</div> | ||
</div> | ||
</> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
import { useContext } from "react"; | ||
import { ConfigContext } from "@stores/config"; | ||
import Container from "@components/Container"; | ||
import Select from "@components/Select"; | ||
import Input from "@components/Input"; | ||
import Checkbox from "@components/Checkbox"; | ||
|
||
export default function Miscellaneous() { | ||
const { config, setConfig } = useContext(ConfigContext); | ||
|
||
return ( | ||
<> | ||
<Container header={{ | ||
big: "Miscellaneous", | ||
small: <> | ||
Miscellaneous settings for your Blacket server. | ||
</> | ||
}}> | ||
|
||
<Input icon="fas fa-colon" placeholder="Server Port" onChange={(e) => { | ||
if (e.target.value.match(/[^0-9]/gi) || e.target.value > 65535 || e.target.value.startsWith("0")) return e.preventDefault(); | ||
config.miscellaneous.server_port = e.target.value; | ||
setConfig({ ...config }); | ||
}} value={config.miscellaneous.server_port} /> | ||
|
||
<Input icon="fab fa-discord" placeholder="Discord Invite" onChange={(e) => { | ||
if (e.target.value.match(/[^a-z0-9]/gi)) return e.preventDefault(); | ||
config.miscellaneous.discord_invite = e.target.value; | ||
setConfig({ ...config }); | ||
}} value={config.miscellaneous.discord_invite} /> | ||
|
||
<Checkbox checked={config.miscellaneous.verbose_logging} onClick={() => { | ||
config.miscellaneous.verbose_logging = !config.miscellaneous.verbose_logging; | ||
setConfig({ ...config }); | ||
}}> | ||
Verbose Logging | ||
</Checkbox> | ||
|
||
<Checkbox checked={config.miscellaneous.block_proxies} onClick={() => { | ||
config.miscellaneous.block_proxies = !config.miscellaneous.block_proxies; | ||
setConfig({ ...config }); | ||
}}> | ||
Block Proxies | ||
</Checkbox> | ||
|
||
<Checkbox checked={config.miscellaneous.allow_multiple_accounts} onClick={() => { | ||
config.miscellaneous.allow_multiple_accounts = !config.miscellaneous.allow_multiple_accounts; | ||
setConfig({ ...config }); | ||
}}> | ||
Allow Multiple Accounts | ||
</Checkbox> | ||
|
||
<Checkbox checked={config.miscellaneous.backup_enabled} onClick={() => { | ||
config.miscellaneous.backup_enabled = !config.miscellaneous.backup_enabled; | ||
setConfig({ ...config }); | ||
}}> | ||
Enable Backups | ||
</Checkbox> | ||
|
||
{config.miscellaneous.backup_enabled && <> | ||
<Input icon="fas fa-clock" placeholder="Backup Interval" onChange={(e) => { | ||
if (e.target.value.match(/[^0-9]/gi) || e.target.value.startsWith("0")) return e.preventDefault(); | ||
config.miscellaneous.backup_interval = e.target.value; | ||
setConfig({ ...config }); | ||
}} value={config.miscellaneous.backup_interval} /> | ||
</>} | ||
|
||
<Input icon="fas fa-turn-up" placeholder="Level Difficulty" onChange={(e) => { | ||
if (isNaN(e.target.value)) return e.preventDefault(); | ||
config.miscellaneous.level_difficulty = e.target.value; | ||
setConfig({ ...config }); | ||
}} value={config.miscellaneous.level_difficulty} /> | ||
</Container> | ||
</> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters