diff --git a/cogs/web/static/configuration.css b/cogs/web/static/configuration.css new file mode 100644 index 0000000..fca533e --- /dev/null +++ b/cogs/web/static/configuration.css @@ -0,0 +1,88 @@ +body { + font-family: Arial, sans-serif; + margin: 0; + padding: 0; + background-color: #2c3e50; + color: #fff; +} + +.logo { + width: 25; + height: 25; +} + +header { + background-color: #3e4982; + color: #fff; + padding: 20px; + text-align: center; +} + +header h1 { + margin: 0; +} + +.container { + display: flex; +} + +table { + font-family: Arial, Helvetica, sans-serif; + border-collapse: collapse; + width: 100%; +} + +table td, +#status th { + border: 1px solid #ddd; + padding: 8px; +} + +table tr:nth-child(even) { + background-color: #1c567d; +} + +table tr:hover { + background-color: #2980b9; +} + +table th { + padding-top: 12px; + padding-bottom: 12px; + text-align: left; + background-color: #04AA6D; + color: white; +} + +nav { + background-color: #34495e; + width: 200px; + padding: 20px; + text-align: center; +} + +nav ul { + list-style: none; + margin: 0; + padding: 0; +} + +nav li a { + color: #fff; + text-decoration: none; + padding: 10px 0; + display: block; +} + +nav li a:hover { + background-color: #2980b9; +} + +.selected { + background-color: #2980b9; +} + +main { + padding: 20px; + flex-grow: 1; +} \ No newline at end of file diff --git a/cogs/web/static/dashboard.css b/cogs/web/static/dashboard.css new file mode 100644 index 0000000..b92a2c9 --- /dev/null +++ b/cogs/web/static/dashboard.css @@ -0,0 +1,88 @@ +body { + font-family: Arial, sans-serif; + margin: 0; + padding: 0; + background-color: #2c3e50; + color: #fff; +} + +.logo { + width: 25; + height: 25; +} + +header { + background-color: #3e4982; + color: #fff; + padding: 20px; + text-align: center; +} + +header h1 { + margin: 0; +} + +.container { + display: flex; +} + +table { + font-family: Arial, Helvetica, sans-serif; + border-collapse: collapse; + width: 100%; +} + +table td, +#status th { + border: 1px solid #ddd; + padding: 8px; +} + +table tr:nth-child(even) { + background-color: #1c567d; +} + +table tr:hover { + background-color: #2980b9; +} + +table th { + padding-top: 12px; + padding-bottom: 12px; + text-align: left; + background-color: #04AA6D; + color: white; +} + +nav { + background-color: #34495e; + width: 200px; + padding: 20px; + text-align: center; +} + +nav ul { + list-style: none; + margin: 0; + padding: 0; +} + +nav li a { + color: #fff; + text-decoration: none; + padding: 10px 0; + display: block; +} + +nav li a:hover { + background-color: #2980b9; +} + +.selected { + background-color: #2980b9; +} + +main { + padding: 20px; + flex-grow: 1; +} diff --git a/cogs/web/static/index.css b/cogs/web/static/index.css new file mode 100644 index 0000000..9ac95ae --- /dev/null +++ b/cogs/web/static/index.css @@ -0,0 +1,61 @@ +body { + font-family: Arial, sans-serif; + margin: 0; + padding: 0; + background-color: #2c3e50; + color: #fff; +} +.selected { + background-color: #2980b9; +} +.logo { + width: 25; + height: 25; +} + +header { + background-color: #3e4982; + color: #fff; + padding: 20px; + text-align: center; +} + +header h1 { + margin: 0; +} + +.container { + display: flex; +} + +nav { + background-color: #34495e; + width: 200px; + padding: 20px; + text-align: center; +} + +nav ul { + list-style: none; + margin: 0; + padding: 0; +} + +nav li a { + color: #fff; + text-decoration: none; + padding: 10px 0; + display: block; +} + +nav li a:hover { + background-color: #2980b9; +} + +main { + padding: 20px; + flex-grow: 1; +} + + + diff --git a/cogs/web/static/js/configuration.js b/cogs/web/static/js/configuration.js new file mode 100644 index 0000000..4aa072e --- /dev/null +++ b/cogs/web/static/js/configuration.js @@ -0,0 +1,66 @@ +const form = document.querySelector("form"); +const tokenInput = form.querySelector("#token"); +const nameInput = form.querySelector("#name"); +const statusSelect = form.querySelector("#status"); + +// set the token input as password field +tokenInput.setAttribute("type", "password"); + +// function to get the config values from the server +const getConfigValues = async () => { + try { + const tokenResponse = await fetch('/api/token'); + const tokenValue = await tokenResponse.text(); + tokenInput.value = tokenValue; + + const nameResponse = await fetch('/api/name'); + const nameValue = await nameResponse.text(); + nameInput.value = nameValue; + + const statusResponse = await fetch('/api/status'); + const statusValue = await statusResponse.text(); + statusSelect.value = statusValue; + } catch (error) { + console.error(error); + } +} + +getConfigValues(); + +form.addEventListener("submit", async (event) => { + event.preventDefault(); + const token = tokenInput.value; + const name = nameInput.value; + const status = statusSelect.value; + + try { + // send POST request to /api/token endpoint with token as the body + if (token !== '') { + await fetch('/api/token', { + method: 'POST', + body: token + }); + } + + + // send POST request to /api/name endpoint with name as the body + if (name !== '') { + await fetch('/api/name', { + method: 'POST', + body: name + }); + } + + + // send POST request to /api/status endpoint with status as the body + if (status !== '') { + await fetch('/api/status', { + method: 'POST', + body: status + }); + } + + } catch (error) { + console.error(error); + } +}); \ No newline at end of file diff --git a/cogs/web/static/plugins.css b/cogs/web/static/plugins.css new file mode 100644 index 0000000..fca533e --- /dev/null +++ b/cogs/web/static/plugins.css @@ -0,0 +1,88 @@ +body { + font-family: Arial, sans-serif; + margin: 0; + padding: 0; + background-color: #2c3e50; + color: #fff; +} + +.logo { + width: 25; + height: 25; +} + +header { + background-color: #3e4982; + color: #fff; + padding: 20px; + text-align: center; +} + +header h1 { + margin: 0; +} + +.container { + display: flex; +} + +table { + font-family: Arial, Helvetica, sans-serif; + border-collapse: collapse; + width: 100%; +} + +table td, +#status th { + border: 1px solid #ddd; + padding: 8px; +} + +table tr:nth-child(even) { + background-color: #1c567d; +} + +table tr:hover { + background-color: #2980b9; +} + +table th { + padding-top: 12px; + padding-bottom: 12px; + text-align: left; + background-color: #04AA6D; + color: white; +} + +nav { + background-color: #34495e; + width: 200px; + padding: 20px; + text-align: center; +} + +nav ul { + list-style: none; + margin: 0; + padding: 0; +} + +nav li a { + color: #fff; + text-decoration: none; + padding: 10px 0; + display: block; +} + +nav li a:hover { + background-color: #2980b9; +} + +.selected { + background-color: #2980b9; +} + +main { + padding: 20px; + flex-grow: 1; +} \ No newline at end of file diff --git a/cogs/web/templates/configuration.html b/cogs/web/templates/configuration.html new file mode 100644 index 0000000..c416904 --- /dev/null +++ b/cogs/web/templates/configuration.html @@ -0,0 +1,47 @@ + + + +
+This is the admin dashboard. Here you can see important thing like the uptime, hits per minute, cogs status etc..
+Module | +Status | +Module link | +
---|---|---|
Uptime | +1 Year | +/api/uptime | +
Hits Per Minute | +10 | +/api/hpm | +
Plugin - Fivem | +Online | +/plugins/fivem | +
This bot is designed to help you with various tasks and make your life easier
+Here you can find information about the bot's features, plugins, configuration, and support. All this info is public. If you want you can turn it off in the settings page.
+This is the plugin page here you can disable/enable the individual cogs.
+Plugin | +Status | +Plugin link | +
---|---|---|
Uptime | +1 Year | +/api/uptime | +
Hits Per Minute | +10 | +/api/hpm | +
Plugin - Fivem | +Online | +/plugins/fivem | +