Hi!
I think i found a solution but need some help to finalize.
First, i add Access-Control-Allow-Credentials in middleware.js (nodebb) :
var headers = {
'X-Powered-By': meta.config['powered-by'],
'X-Frame-Options': meta.config['allow-from-uri'] ? 'ALLOW-FROM ' + meta.config['allow-from-uri'] : undefined,
'Access-Control-Allow-Origin': meta.config['access-control-allow-origin'],
'Access-Control-Allow-Methods': meta.config['access-control-allow-methods'],
'Access-Control-Allow-Headers': meta.config['access-control-allow-headers'],
'Access-Control-Allow-Credentials' : true
};
After that, my ajax request (modify with credentials) give me the number of unread on console browser :
$.ajax({
url:"http://ip:port/api/unread/total",
dataType:"json",
type:"GET",
xhrFields: { withCredentials: true }
success:function(data){
console.log(data);
}
});
First step ok
Second step, obtain unread for a non connect user!
I have installed nodebb-plugin-ns-login plugin which provide user information with api access.
This request give me user information in my console browser :
$.ajax({
url:"http://ip:port/api/ns/login",
dataType:"json",
type:"POST",
data:{username:"myuser",password:"mypassword"},
success:function(data){
console.log(data);
}
});
So, i can obtain specific user information, i can obtain unread with the first method... the goal was to obtain via nodebb-plugin-ns-login the unread for a specific user and here... i'm block...
I suppose i must modify res.json(user); by something like controllers.unreadTotal but... i don't knwo what i must write... and if someone get an idea...
Thanks by advance!