diff --git a/DOCS.md b/DOCS.md new file mode 100644 index 00000000..8f5bca7f --- /dev/null +++ b/DOCS.md @@ -0,0 +1,37 @@ +
+ + +
+ +
+

+ Original web | + Documentation +

+
+ +# Quick start + +## Installation 🛠️ + +Run +``` +./install.sh +``` + +This will install all the necesary npm packages both for the frontend and the backend + +## Running 🚀 + +Run +``` +./start.sh +``` + +or + +``` +./start-dev.sh +``` + +if you want to start the development environments \ No newline at end of file diff --git a/backend/services/api.js b/backend/services/api.js index 1334c0f1..862d5d6d 100644 --- a/backend/services/api.js +++ b/backend/services/api.js @@ -1,24 +1,80 @@ const mongoose = require("mongoose"); const Schema = mongoose.Schema; -class BackendApi { +/** + * Test + */ +class Router { + constructor(){ + + } + /** - * Plugin + * @param {String} route + * Hola + */ + get(route){ + + } + + /** + * @param {String} route + * + */ + post(route){ + + } + + /** + * @param {String} route + * + */ + put(route){ + + } + + /** + * @param {String} route + * + */ + delete(route){ + + } +} + +class BackendApi { + #_plugin; + #_router; + + /** + * This object is already created for you * @param {plugin} Plugin instance */ constructor(plugin){ - this.plugin = plugin; + this._plugin = plugin; + this._router = new Router(); } - createRoute(){ - + /** + * Gets the router for your plugin + * @type {Router} router + */ + get router(){ + return this.router; } + /** + * Returns a new database model for the plguin + * @param {String} name + * @param {Object} schema + * @returns {mongoose.model} + */ createModel(name, schema){ return mongoose.model(name, new Schema(schema)) } }; module.exports = { - BackendApi + BackendApi, + Router } \ No newline at end of file diff --git a/backend/services/plugins.js b/backend/services/plugins.js index 7e0cb209..a1d24a1d 100644 --- a/backend/services/plugins.js +++ b/backend/services/plugins.js @@ -1,6 +1,6 @@ const fs = require('fs'); const path = require('path') -const Api = require('./api').Api +const BackendApi = require('./api').BackendApi const basePath = path.resolve(__dirname, '../') console.log(basePath) @@ -25,7 +25,7 @@ function init(){ // Execute main Object.keys(plugins).forEach(k => { - plugins[k].Main(new Api(k)) + plugins[k].Main(new BackendApi(k)) }) } diff --git a/build.sh b/build.sh index f5a47307..62340309 100755 --- a/build.sh +++ b/build.sh @@ -1,5 +1,10 @@ #!/bin/bash -node prebuild.js +# Gen docs npm run generate-docs -cp -r media docs/dragonroll/1.0.0/ \ No newline at end of file + +# Copy media to all versions of documentation (if there is more than one) +# for d in docs/dragonroll/*/; do cp -r media "$d/media"; done + +# Prebuild files for execution +node prebuild.js \ No newline at end of file diff --git a/client/index.html b/client/index.html index 52ec691d..47d976b1 100644 --- a/client/index.html +++ b/client/index.html @@ -2,7 +2,9 @@ - + Dragonroll diff --git a/client/public/favicon.ico b/client/public/favicon.ico deleted file mode 100644 index 31b0d670..00000000 Binary files a/client/public/favicon.ico and /dev/null differ diff --git a/media/logo.png b/client/public/favicon.png similarity index 100% rename from media/logo.png rename to client/public/favicon.png diff --git a/client/src/views/windows/LoginWindow.vue b/client/src/views/windows/LoginWindow.vue index 2b8ea758..5f32852d 100644 --- a/client/src/views/windows/LoginWindow.vue +++ b/client/src/views/windows/LoginWindow.vue @@ -66,7 +66,11 @@ function ShowMainMenu(){
- + + + + Dragonroll logo +
diff --git a/jsdoc.json b/jsdoc.json index 3ae04dbe..4c56dd44 100644 --- a/jsdoc.json +++ b/jsdoc.json @@ -1,22 +1,26 @@ { "source": { "includePattern": ".+\\.js(doc|x)?$", - "include": ["./client/src/services/Api.js", "./backend/services/api.js", "package.json", "README.md"], + "include": ["./client/src/services/Api.js", "./backend/services/api.js", "package.json", "DOCS.md"], "exclude": ["node_modules"] }, "plugins": ["plugins/markdown"], "recurseDepth": 10, "opts": { "encoding": "utf8", - "readme": "./README.md", + "readme": "./DOCS.md", "destination": "docs/", "recurse": true, "verbose": true, "template": "node_modules/clean-jsdoc-theme", + "tutorials": "./tutorials", "theme_opts": { "default_theme": "dark", "homepageTitle": "Dragonroll API", - "title": "" + "title": "", + "static_dir": ["./static"], + "include_js": ["./static/scripts/themeWatch.js"], + "favicon": "static/media/logo.png" } }, "markdown": { diff --git a/media/logo-splash-light.png b/static/media/logo-splash-light.png similarity index 100% rename from media/logo-splash-light.png rename to static/media/logo-splash-light.png diff --git a/media/logo-splash.png b/static/media/logo-splash.png similarity index 100% rename from media/logo-splash.png rename to static/media/logo-splash.png diff --git a/static/media/logo.png b/static/media/logo.png new file mode 100644 index 00000000..5a2e59fc Binary files /dev/null and b/static/media/logo.png differ diff --git a/static/scripts/themeWatch.js b/static/scripts/themeWatch.js new file mode 100644 index 00000000..774e89a8 --- /dev/null +++ b/static/scripts/themeWatch.js @@ -0,0 +1,27 @@ +function updateLogoThemes(){ + let theme = localStorage.getItem('theme') + let darkLogos = document.getElementsByClassName('logo-splash-dark'); + let lightLogos = document.getElementsByClassName('logo-splash-light'); + if(theme == 'dark'){ + for(let i = 0; i < darkLogos.length; i++) darkLogos[i].style.display = "unset"; + for(let i = 0; i < lightLogos.length; i++) lightLogos[i].style.display = "none"; + } else { + for(let i = 0; i < darkLogos.length; i++) darkLogos[i].style.display = "none"; + for(let i = 0; i < lightLogos.length; i++) lightLogos[i].style.display = "unset"; + } +} + +document.addEventListener("DOMContentLoaded", (event) => { + + const attrObserver = new MutationObserver((mutations) => { + mutations.forEach(mu => { + if (mu.type !== "attributes" && mu.attributeName !== "class") return; + updateLogoThemes(); + }); + }); + + const ELS_test = document.querySelectorAll("body"); + ELS_test.forEach(el => attrObserver.observe(el, {attributes: true})); + + updateLogoThemes(); +}); diff --git a/tutorials/Test.md b/tutorials/Test.md new file mode 100644 index 00000000..f0de4041 --- /dev/null +++ b/tutorials/Test.md @@ -0,0 +1,2 @@ +# Hola +hola test \ No newline at end of file diff --git a/tutorials/tutorials.json b/tutorials/tutorials.json new file mode 100644 index 00000000..48579229 --- /dev/null +++ b/tutorials/tutorials.json @@ -0,0 +1,5 @@ +{ + "test": { + "title": "Test tutorial" + } +} \ No newline at end of file