Modif Odmdb
This commit is contained in:
parent
5a6d49d072
commit
21effdf5be
@ -114,8 +114,8 @@ apxtri.setuptribe = async (tribe, conf) => {
|
|||||||
inittribe.sudoUser = process.env.USER;
|
inittribe.sudoUser = process.env.USER;
|
||||||
//check nation exist and town does not exist
|
//check nation exist and town does not exist
|
||||||
if (
|
if (
|
||||||
!fs.existsSync("../adminapi/objects/nations/idx/lst_nations.json") ||
|
!fs.existsSync("../adminapi/objects/nations/idx/lst_nationId.json") ||
|
||||||
!fs.existsSync("../adminapi/objects/towns/idx/lst_towns.json")
|
!fs.existsSync("../adminapi/objects/towns/idx/lst_townId.json")
|
||||||
) {
|
) {
|
||||||
console.log(
|
console.log(
|
||||||
`Sorry, check setup.sh process that was not able to init your adminapi/objects `
|
`Sorry, check setup.sh process that was not able to init your adminapi/objects `
|
||||||
@ -229,7 +229,7 @@ apxtri.runexpress = async (tribesdns, conf) => {
|
|||||||
const context = {};
|
const context = {};
|
||||||
const pathtr = path.resolve(`../${t}`);
|
const pathtr = path.resolve(`../${t}`);
|
||||||
context.routes = [];
|
context.routes = [];
|
||||||
tribroutes = glob.sync(`${pathtr}/apxtri/routes/*.js`).map((f) => {
|
tribroutes = glob.sync(`${pathtr}/apxtri/routes/*.js`).map((f) => {
|
||||||
const rt = `/${t}/${path.basename(f, ".js")}`;
|
const rt = `/${t}/${path.basename(f, ".js")}`;
|
||||||
context.routes.push(rt);
|
context.routes.push(rt);
|
||||||
return { url: rt, route: f };
|
return { url: rt, route: f };
|
||||||
@ -275,22 +275,23 @@ apxtri.runexpress = async (tribesdns, conf) => {
|
|||||||
console.log(currentmod, " app.locals.tribeids", app.locals.tribeids);
|
console.log(currentmod, " app.locals.tribeids", app.locals.tribeids);
|
||||||
|
|
||||||
// Cors management
|
// Cors management
|
||||||
let originlst = "test";
|
let regtxt = "(test";
|
||||||
doms.forEach((d) => {
|
doms.forEach((d) => {
|
||||||
originlst += `|${d.replace(/\./g, "\\.")}`;
|
regtxt += `|${d.replace(/\./g, "\\.")}`;
|
||||||
});
|
});
|
||||||
const regtxt = `^http.?:\/\/(${originlst})`;
|
regtxt+=")$"
|
||||||
let cor = false;
|
// let cor = false;
|
||||||
const regorigin = new RegExp(regtxt);
|
const regorigin = new RegExp(regtxt);
|
||||||
app.use((req, res, next) => {
|
app.use((req, res, next) => {
|
||||||
if (req.headers.origin == undefined) {
|
/*if (req.headers.origin == undefined) {
|
||||||
cor = true;
|
cor = true;
|
||||||
} else {
|
} else {
|
||||||
cor = regorigin.test(req.headers.origin);
|
cor = regorigin.test(req.headers.origin);
|
||||||
}
|
}*/
|
||||||
|
const cor=regorigin.test(req.headers.origin);
|
||||||
if (!cor)
|
if (!cor)
|
||||||
console.log(
|
console.log(
|
||||||
`The domain name ${req.headers.origin} is not allow to access for CORS settings, add it in itm/tribename.json in dns`
|
`The domain name ${req.headers.origin} is not allow to access for CORS settings, add it in itm/tribename.json in dns current origin allow are filter by ${regtxt}`
|
||||||
);
|
);
|
||||||
cors({
|
cors({
|
||||||
origin: cor,
|
origin: cor,
|
||||||
|
@ -649,7 +649,7 @@ Odmdb.cud = (objectPathname, crud, itm, role, runindex = true) => {
|
|||||||
if (crud == "U" && accessright.U.length > 0) {
|
if (crud == "U" && accessright.U.length > 0) {
|
||||||
itmtostore = itmold;
|
itmtostore = itmold;
|
||||||
const keynotallow = Object.keys(itm).filter(
|
const keynotallow = Object.keys(itm).filter(
|
||||||
(el) => !accessright.U.includes(el)
|
(el) => !(el==getschema.data.schema.apxid || accessright.U.includes(el))
|
||||||
);
|
);
|
||||||
if (keynotallow.length > 0) {
|
if (keynotallow.length > 0) {
|
||||||
feedbackinfo.keynotallow = keynotallow;
|
feedbackinfo.keynotallow = keynotallow;
|
||||||
|
@ -87,14 +87,14 @@ router.post(
|
|||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @api {POST} adminapi/notifications/registeranonymous/:tribe/:mlist/:typekey/:data -Register email||phone to mlist
|
* @api {POST} adminapi/notifications/registeranonymous -Register email||phone to mlist
|
||||||
* @apiName register
|
* @apiName register
|
||||||
* @apiGroup Notifications
|
* @apiGroup Notifications
|
||||||
* @apiDescription Register an email or phone into a mailinglist mlist
|
* @apiDescription Register an email or phone into a mailinglist mlist
|
||||||
* @apiBody {string} tribe an existing tribe
|
* @apiBody {string} tribe an existing tribe
|
||||||
* @apiBody {string} mlist a mailing list name
|
* @apiBody {string} mlist a mailing list name
|
||||||
* @apiBody {string} key email or phone keyword
|
* @apiBody {string} key email or phone keyword
|
||||||
* @apiBod {string} srckey must exist in tribes/schema/lg/enumtrk_xx.json
|
* @apiBody {string} srckey must exist in tribes/schema/lg/enumtrk_xx.json
|
||||||
* @apiParams {string} data the email or phone value
|
* @apiParams {string} data the email or phone value
|
||||||
* @apiSuccess {object} update mailinglist/{mlist}.json successfull
|
* @apiSuccess {object} update mailinglist/{mlist}.json successfull
|
||||||
* @apiSuccessExample {json} successfullmessage
|
* @apiSuccessExample {json} successfullmessage
|
||||||
|
@ -4,16 +4,16 @@ add_header 'Access-Control-Allow-Origin' '*' always;
|
|||||||
add_header 'Access-Control-Allow-Credentials' 'true' always;
|
add_header 'Access-Control-Allow-Credentials' 'true' always;
|
||||||
add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS' always;
|
add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS' always;
|
||||||
add_header 'Access-Control-Allow-Headers' '*' always;
|
add_header 'Access-Control-Allow-Headers' '*' always;
|
||||||
# usefull to debug nginx conf 3 next line:
|
access_log {{{townpath}}}/{{{tribeId}}}/logs/nginx/{{{website}}}.{{{tribeId}}}.{{{townId}}}.{{{nationId}}}.access.log main;
|
||||||
access_log {{{townpath}}}/{{{tribeId}}}/logs/nginx/{{{tribeId}}}_{{{website}}}.access.log main;
|
error_log {{{townpath}}}/{{{tribeId}}}/logs/nginx/{{{website}}}.{{{tribeId}}}.{{{townId}}}.{{{nationId}}}.error.log debug;
|
||||||
error_log {{{townpath}}}/{{{tribeId}}}/logs/nginx/{{{tribeId}}}_{{{website}}}.error.log debug;
|
# usefull to debug nginx:
|
||||||
add_header xdebug "testmsg debug: $uri - $request - liste args: $args - url:$arg_url - alias:$arg_alias " always;
|
#add_header xdebug "testmsg debug: $uri - $request - liste args: $args - url:$arg_url - alias:$arg_alias " always;
|
||||||
|
|
||||||
set $trackme 0;
|
set $trackme 0;
|
||||||
if ( $uri ~ ^/trk/ ){
|
if ( $uri ~ ^/trk/ ){
|
||||||
set $trackme 1;
|
set $trackme 1;
|
||||||
}
|
}
|
||||||
access_log {{{townpath}}}/{{{tribeId}}}/logs/nginx/{{{tribeId}}}_{{{website}}}.trk.log tracker if=$trackme ;
|
access_log {{{townpath}}}/{{{tribeId}}}/logs/nginx/{{{website}}}.{{{tribeId}}}.{{{townId}}}.{{{nationId}}}.trk.log tracker if=$trackme ;
|
||||||
location ~* /trk/ {
|
location ~* /trk/ {
|
||||||
if ( $uri ~ ^/trk/redirect ){
|
if ( $uri ~ ^/trk/redirect ){
|
||||||
return 301 $arg_url;
|
return 301 $arg_url;
|
||||||
@ -42,12 +42,12 @@ location /cdn/ {
|
|||||||
}
|
}
|
||||||
location /api/ {
|
location /api/ {
|
||||||
rewrite /api/(.*$) /$1 break;
|
rewrite /api/(.*$) /$1 break;
|
||||||
proxy_pass http://localhost:3020;
|
proxy_pass http://localhost:{{{apiport}}};
|
||||||
proxy_redirect off;
|
proxy_redirect off;
|
||||||
include proxy_params;
|
include proxy_params;
|
||||||
}
|
}
|
||||||
location /socket/ {
|
location /socket/ {
|
||||||
proxy_pass http://127.0.0.1:3030;
|
proxy_pass http://127.0.0.1:{{socketport}};
|
||||||
proxy_http_version 1.1;
|
proxy_http_version 1.1;
|
||||||
proxy_set_header Upgrade $http_upgrade;
|
proxy_set_header Upgrade $http_upgrade;
|
||||||
proxy_set_header Connection 'upgrade';
|
proxy_set_header Connection 'upgrade';
|
||||||
@ -55,7 +55,7 @@ location /socket/ {
|
|||||||
proxy_cache_bypass $http_upgrade;
|
proxy_cache_bypass $http_upgrade;
|
||||||
}
|
}
|
||||||
location /apidoc/ {
|
location /apidoc/ {
|
||||||
root {{{townpath}}}/{{{tribeId}}}/objects/wwws/apidoc/;
|
root {{{townpath}}}/{{{tribeId}}}/objects/wwws/apidoc;
|
||||||
index index.html;
|
index index.html;
|
||||||
}
|
}
|
||||||
location /src/ {
|
location /src/ {
|
||||||
@ -64,7 +64,7 @@ location /src/ {
|
|||||||
index index.html index_fr.html index_en.html;
|
index index.html index_fr.html index_en.html;
|
||||||
}
|
}
|
||||||
location / {
|
location / {
|
||||||
root {{{townpath}}}/{{{tribeId}}}/objects/wwws/{{{website}}}/dist/;
|
root {{{townpath}}}/{{{tribeId}}}/objects/wwws/{{{website}}}/dist;
|
||||||
index index.html index_fr.html index_en.html;
|
index index.html index_fr.html index_en.html;
|
||||||
}
|
}
|
||||||
error_page 404 /404.html;
|
error_page 404 /404.html;
|
||||||
|
Loading…
Reference in New Issue
Block a user