Documentation!

This commit is contained in:
BinarySandia04 2024-10-05 14:31:09 +02:00
parent 57f3e30a0b
commit 48e607a5d2
15 changed files with 157 additions and 15 deletions

37
DOCS.md Normal file
View File

@ -0,0 +1,37 @@
<div align="center">
<img src='static/media/logo-splash.png' class='logo-splash-dark'/>
<img src='static/media/logo-splash-light.png' class='logo-splash-light'/>
</div>
<hr>
<p align="center">
<a href="https://git.aranroig.com/BinarySandia04/Dragonroll">Original web</a> |
<a href="">Documentation</a>
</p>
<br>
# 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

View File

@ -1,24 +1,80 @@
const mongoose = require("mongoose"); const mongoose = require("mongoose");
const Schema = mongoose.Schema; const Schema = mongoose.Schema;
class BackendApi {
/** /**
* Plugin * Test
*/
class Router {
constructor(){
}
/**
* @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 * @param {plugin} Plugin instance
*/ */
constructor(plugin){ 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){ createModel(name, schema){
return mongoose.model(name, new Schema(schema)) return mongoose.model(name, new Schema(schema))
} }
}; };
module.exports = { module.exports = {
BackendApi BackendApi,
Router
} }

View File

@ -1,6 +1,6 @@
const fs = require('fs'); const fs = require('fs');
const path = require('path') const path = require('path')
const Api = require('./api').Api const BackendApi = require('./api').BackendApi
const basePath = path.resolve(__dirname, '../') const basePath = path.resolve(__dirname, '../')
console.log(basePath) console.log(basePath)
@ -25,7 +25,7 @@ function init(){
// Execute main // Execute main
Object.keys(plugins).forEach(k => { Object.keys(plugins).forEach(k => {
plugins[k].Main(new Api(k)) plugins[k].Main(new BackendApi(k))
}) })
} }

View File

@ -1,5 +1,10 @@
#!/bin/bash #!/bin/bash
node prebuild.js # Gen docs
npm run generate-docs npm run generate-docs
cp -r media docs/dragonroll/1.0.0/
# 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

View File

@ -2,7 +2,9 @@
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<link rel="icon" href="/favicon.ico"> <link rel="icon"
type="image/png"
href="favicon.png">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Dragonroll</title> <title>Dragonroll</title>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

View File

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

View File

@ -66,7 +66,11 @@ function ShowMainMenu(){
<div class="window-wrapper" :id="'window-wrapper-' + id"> <div class="window-wrapper" :id="'window-wrapper-' + id">
<WindowHandle :window="id" ref="handle"></WindowHandle> <WindowHandle :window="id" ref="handle"></WindowHandle>
<img src="/img/logo-splash.png" class="splash-image" draggable="false"> <picture align="center">
<source media="(prefers-color-scheme: dark)" srcset="/img/logo-splash.png">
<source media="(prefers-color-scheme: light)" srcset="/img/logo-splash-light.png">
<img alt="Dragonroll logo" src="client/public/img/logo-splash.png" class="splash-image" draggable="false">
</picture>
<form v-on:submit.prevent="login"> <form v-on:submit.prevent="login">
<div class="form-field"> <div class="form-field">

View File

@ -1,22 +1,26 @@
{ {
"source": { "source": {
"includePattern": ".+\\.js(doc|x)?$", "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"] "exclude": ["node_modules"]
}, },
"plugins": ["plugins/markdown"], "plugins": ["plugins/markdown"],
"recurseDepth": 10, "recurseDepth": 10,
"opts": { "opts": {
"encoding": "utf8", "encoding": "utf8",
"readme": "./README.md", "readme": "./DOCS.md",
"destination": "docs/", "destination": "docs/",
"recurse": true, "recurse": true,
"verbose": true, "verbose": true,
"template": "node_modules/clean-jsdoc-theme", "template": "node_modules/clean-jsdoc-theme",
"tutorials": "./tutorials",
"theme_opts": { "theme_opts": {
"default_theme": "dark", "default_theme": "dark",
"homepageTitle": "Dragonroll API", "homepageTitle": "Dragonroll API",
"title": "<img src='media/logo-splash.png' class='my-custom-class'/>" "title": "<a href='index.html'><img src='static/media/logo-splash.png' class='logo-splash-dark'/><img src='static/media/logo-splash-light.png' class='logo-splash-light'/></a>",
"static_dir": ["./static"],
"include_js": ["./static/scripts/themeWatch.js"],
"favicon": "static/media/logo.png"
} }
}, },
"markdown": { "markdown": {

View File

Before

Width:  |  Height:  |  Size: 312 KiB

After

Width:  |  Height:  |  Size: 312 KiB

View File

Before

Width:  |  Height:  |  Size: 54 KiB

After

Width:  |  Height:  |  Size: 54 KiB

BIN
static/media/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

View File

@ -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();
});

2
tutorials/Test.md Normal file
View File

@ -0,0 +1,2 @@
# Hola
hola test

5
tutorials/tutorials.json Normal file
View File

@ -0,0 +1,5 @@
{
"test": {
"title": "Test tutorial"
}
}