diff --git a/.gitignore b/.gitignore
index 03a4363..1b4b1c1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -13,3 +13,4 @@ database.sqlite-journal
docker/nginx/chibisafe.moe.conf
docker-compose.config.yml
/coverage
+local/
diff --git a/src/api/routes/service/configSchemaGET.js b/src/api/routes/service/configSchemaGET.js
new file mode 100644
index 0000000..90befa9
--- /dev/null
+++ b/src/api/routes/service/configSchemaGET.js
@@ -0,0 +1,17 @@
+const Route = require('../../structures/Route');
+const { configSchema } = require('../../structures/Setting');
+
+class configGET extends Route {
+ constructor() {
+ super('/service/config/schema', 'get', { adminOnly: true });
+ }
+
+ run(req, res) {
+ return res.json({
+ message: 'Successfully retrieved schema',
+ schema: configSchema
+ });
+ }
+}
+
+module.exports = configGET;
diff --git a/src/api/structures/Setting.js b/src/api/structures/Setting.js
index 068ebf1..7b2041d 100644
--- a/src/api/structures/Setting.js
+++ b/src/api/structures/Setting.js
@@ -9,15 +9,6 @@ const StatsGenerator = require('../utils/StatsGenerator');
// use meta to set custom rendering (render as radio instead of dropdown for example) and custom order
// use description to add comments which will show up as a note somewhere next to the option
const schema = Joi.object({
- // Server related settings
- rateLimitWindow: Joi.number().integer().default(2)
- .label('API rate limit window')
- .description('Timeframe for which requests are checked/remembered'),
-
- rateLimitMax: Joi.number().integer().default(5)
- .label('API maximum limit')
- .description('Max number of connections during windowMs milliseconds before sending a 429 response'),
-
// Service settings
serviceName: Joi.string().default('change-me')
.label('Service name')
@@ -118,9 +109,18 @@ const schema = Joi.object({
savedStatistics: Joi.array().items(Joi.string().valid(...Object.keys(StatsGenerator.statGenerators)).optional())
.meta({ displayType: 'checkbox' })
.label('Cached statistics')
- .description('Which statistics should be saved to the database (refer to Statistics schedule for scheduling). If a statistics is enabled but not set to be saved, it will be generated every time the statistics page is opened')
+ .description('Which statistics should be saved to the database (refer to Statistics schedule for scheduling).')
+ .note('If a statistics is enabled but not set to be saved, it will be generated every time the statistics page is opened'),
+
+ // Server related settings
+ rateLimitWindow: Joi.number().integer().default(2)
+ .label('API rate limit window')
+ .description('Timeframe for which requests are checked/remembered'),
+
+ rateLimitMax: Joi.number().integer().default(5)
+ .label('API maximum limit')
+ .description('Max number of connections during windowMs milliseconds before sending a 429 response')
});
-// schema._ids._byKey.keys()
-
module.exports.schema = schema;
+module.exports.configSchema = schema.describe();
diff --git a/src/site/components/settings/JoiObject.vue b/src/site/components/settings/JoiObject.vue
new file mode 100644
index 0000000..e842792
--- /dev/null
+++ b/src/site/components/settings/JoiObject.vue
@@ -0,0 +1,141 @@
+
+