2023-12-07 12:04:19 +01:00
const express = require ( "express" ) ;
const path = require ( "path" ) ;
// Classes
const Wwws = require ( "../models/Wwws.js" ) ;
// Middlewares
const checkHeaders = require ( "../middlewares/checkHeaders" ) ;
const isAuthenticated = require ( "../middlewares/isAuthenticated" ) ;
const router = express . Router ( ) ;
// GET api/wwws/conf/:tribeId/:website
// if profils accessright return the nginx conf in ${conf.dirtown}/tribes/${req.param.tribeId}/www/nginx_${req.params.tribeId}_${req.params.website}.conf
router . get ( "/conf/:tribeId/:website" , checkHeaders , isAuthenticated , ( req , res ) => {
res . send ( Www . configlist ( req . params . tribeId ) ) ;
} ) ;
router . post ( "/conf/:tribeId/:website" , checkHeaders , isAuthenticated , ( req , res ) => {
res . send ( Wwws . create ( req . params . tribeId ) ) ;
} ) ;
2024-04-18 11:35:29 +02:00
/ * *
* @ api { get } / adminapi / wwws / localstorage / : tribe / : appname - Get app data model
* @ apiGroup Odmdb
* @ apiName getOption
* @ apiDescription Get data from backend to custome app
*
* @ apiParams { string } tribe ( adminapi , smatchit , . . ) to looking for
* @ apiParams { string } appname agregate a full data referential to store localy
* @ apiSuccess { object } contain data model for a local web or mobile app in a PWA logical in the language of the header
* @ apiSuccessExample { json } Success - Response :
* HTTP / 1.1 200 OK
* { "status" : 200 , "ref" : "Odmdb" , "msg" : "datamodel" , "data" : { }
* /
router . get ( "/initlocaldb/:tribe/:appname" , checkHeaders , isAuthenticated , ( req , res ) => {
console . log ( 'pass localstorage' )
const getlocal = Wwws . initlocaldata ( req . params . tribe , req . params . appname , req . session . header . xprofils , req . session . header . xlang ) ;
res . status ( getlocal . status ) . json ( getlocal )
} ) ;
2023-12-07 12:04:19 +01:00
module . exports = router ;