kimmanuel
Posts
-
Delete Post -
JS use in homepage@bentael I need my menu.tpl updated based in js file I am going to create
-
JS use in homepage@bentael what do you mean the naked eye?
-
JS use in homepage@bentael Does the script will load first before the menu.tpl
-
JS use in homepageMay I know what js file is used at the very start of loading the homepage?
Thanks!
-
Delete PostWhen I delete post, it's not automatically deleted, I have to refresh the page first before the page will be updated. I think I might edited a file which I don't remember anymore.
-
Unread CountWhat makes unread count updated in header when I red one of the unread topics?
-
Add js file before loading/rendering header.tpl in middleware@psychobunny @a_5mith Does the .js file here loaded only once when I start nodebb? Whenever I want to refresh the page, it must be load again the js file right? Is this what will happen in creating the plugin?
Thanks!
-
Add js file before loading/rendering header.tpl in middlewareIs this possible? Because I have a problem, in my header.tpl, I included script that gets/sets token and request for logged in user from different server, the problem is that I have to refresh the page twice so that the isLoggedIn validation in menu.tpl will be TRUE, because in actual, the first time I load the page Header.tpl, menu.tpl is already loaded then ---> will read get/set token --> refresh page twice (must be refreshed only once):
Is there a way that script file for get/set token will be loaded first before the renderHeader in middleware.js?
This is my script:
**<script>
//START TOKEN
var _session = {};
var domain = config_ws.cookieUrl? 'domain='+config_ws.cookieUrl+';': '';
var dmName = document.createElement("input");
dmName.setAttribute('type', 'hidden');
dmName.setAttribute('value', domain);
dmName.setAttribute('id', 'domainValue');
_session.setToken = function(t) {
// we won't be using the $cookie service when setting the token
// because it doesn't allow setting the domainif (!t || t == '') { //$cookies.accessToken = ''; document.cookie = 'accessToken=; expires=Thu, 01 Jan 1970 00:00:00 GMT; '+domain+' path=/'; } else { //$cookies.accessToken = t; document.cookie = 'accessToken='+t+'; expires=0; '+domain+' path=/'; } }; _session.getToken = function() { /*if ($cookies.accessToken && $cookies.accessToken != '') { return $cookies.accessToken; } else { return ''; }*/ var match = document.cookie.match(new RegExp('accessToken=([^;]+)')); return match && match[1]? match[1]: ''; }; _session.hasToken = function() { return _session.getToken().length > 0? true: false; }; var csrf = $('#csrf_token').val(); var userLoggedIn = $('#user_loggedin').val(); if(userLoggedIn == "true") { var userWsid = $('#user_wsid').val(); if(userWsid == 0) { // means user logged in is a NodeBB User // level of priority NodeBB User } else { // means user logged in is from WS setUserToken(); } } else { setUserToken(); } function setUserToken() { // means user logged in is from WS if(_session.hasToken() == true) { $.ajax({ type: "GET", beforeSend: function (request) { request.setRequestHeader("Authorization", "Bearer " + _session.getToken()); }, url: config_ws.wsBaseUrl + "/api/user/get", success: function(wsuser) { // console.dir(wsuser); //get billing info $.ajax({ type: "GET", beforeSend: function (request) { request.setRequestHeader("Authorization", "Bearer " + _session.getToken()); _session.setToken(_session.getToken()); }, url: config_ws.wsBaseUrl + "/api/user/billing-info?userId=" + wsuser.userId, success: function(wslocation) { // create or update ws user $.ajax({ type: "POST", data:{user: wsuser, _csrf: csrf, wsBaseUrl: config_ws.wsBaseUrl, wsuserlocation: wslocation}, url: RELATIVE_PATH + '/api/wsuser', cache: false, success: function(res) { // if (previousUrl) { // app.previousUrl = previousUrl; // } else if (!app.previousUrl) { // app.previousUrl = '/'; // } //window.location.replace(window.location.pathname); app.loadConfig(); }, complete: function() { setTimeout(setUserToken,1000); //After completion of request, time to redo it after a second }, error: function() { console.log("error-post"); }, dataType: 'json', async: true }); } }); }, error: function(request,error) { console.log(error); }, dataType: 'json', async: true }); } else { if(userLoggedIn == "true") { $.post(RELATIVE_PATH + '/logout', { _csrf: $('#csrf_token').val() }, function() { if(window.location.pathname != RELATIVE_PATH + '/') { window.location.href = RELATIVE_PATH + '/'; } }); } } } // END TOKEN </script>
**
Thank You!
-
SearchEnabled Not working@Ted @a_5mith Okay. I'm going to disable solr plugin then. Thank you guys for your help.
-
Header IconHow to change NodeBB header icon?
-
SearchEnabled Not workingI am getting this kind of warning and I cannot search for topic/posts anymore:
warn: [plugin/solr] Another search plugin (dbsearch) is enabled, so search via Solr was aborted.
-
NodeBB Emoji@a_5mith I have nodebb-plugin-emojis AND emojis-extended installed. I removed the nodebb-plugin-emojis plugin but still not working, I have already configure config.json file and changed it to 127.0.0.1. New warning has prompted me:
warn: [socket.io] Unrecognized message: modules.emojiExtended
I have also nodebb-plugin-emoji-skype installed.
-
NodeBB EmojiI have installed and enabled nodebb-plugin-emoji in my workspace, however when I am loading the page with posts that contains emoji codes, images are not loading. I have noticed also in my terminal this warning:
warn: [plugins/nodebb-plugin-emoji] "callbacked" deprecated as of 0.4x. Use asynchronous method instead for hook: filter:post.parse
Is this something related for not loading the images? What should I do?
-
NodeBB PluginWhat plugin should I install for this code to work?
plugins.hasListeners('filter:search.query')
-
[Solved] error: [meta/js] Could not compile client-side scripts! Unexpected characterWhen I'm running NodeBB, an error prompted me this:
"error: [meta/js] Could not compile client-side scripts! Unexpected character ''Anyone who encountered this kind of error?
-
How to set NodeBB req.user?How to set NodeBB req.user?
-
NodeBB OAuth SSO@julian Oh I see.... I have already forked the plugin, then what should I do next? What should I configure in OAuth so that I can connect it in another server?
-
NodeBB OAuth SSO@julian Hi, do you have tutorial for that?
-
NodeBB OAuth SSOI am currently running NodeBB as a third party attached to a website with different servers. (Example.com: 3000 and NodeBB Forum: 4567). In order to use NodeBB's plugin OAuth, do I need to replicate the data from another database just to use user-information in nodebb?