Navigation

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Popular
    • Tags
    • Users
    • Groups
    1. Home
    2. kimmanuel
    • Profile
    • Following
    • Followers
    • Topics
    • Posts
    • Best
    • Groups

    kimmanuel

    @kimmanuel

    2
    Reputation
    20
    Posts
    917
    Profile views
    2
    Followers
    2
    Following
    Joined Last Online

    kimmanuel Follow

    Best posts made by kimmanuel

    • RE: 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? 🙂

      posted in General Discussion
      kimmanuel
      kimmanuel
    • [Solved] error: [meta/js] Could not compile client-side scripts! Unexpected character

      When 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?

      posted in General Discussion
      kimmanuel
      kimmanuel

    Latest posts made by kimmanuel

    • RE: Delete Post

      @kimmanuel 😄

      posted in General Discussion
      kimmanuel
      kimmanuel
    • RE: JS use in homepage

      @bentael I need my menu.tpl updated based in js file I am going to create 😄 🙂

      posted in General Discussion
      kimmanuel
      kimmanuel
    • RE: JS use in homepage

      @bentael what do you mean the naked eye? 😄

      posted in General Discussion
      kimmanuel
      kimmanuel
    • RE: JS use in homepage

      @bentael Does the script will load first before the menu.tpl

      posted in General Discussion
      kimmanuel
      kimmanuel
    • JS use in homepage

      May I know what js file is used at the very start of loading the homepage?

      Thanks! 🙂

      posted in General Discussion
      kimmanuel
      kimmanuel
    • Delete Post

      When 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.

      posted in General Discussion
      kimmanuel
      kimmanuel
    • Unread Count

      What makes unread count updated in header when I red one of the unread topics?

      posted in General Discussion
      kimmanuel
      kimmanuel
    • RE: 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! 🙂

      posted in General Discussion
      kimmanuel
      kimmanuel
    • Add js file before loading/rendering header.tpl in middleware

      Is 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 domain

      	      if (!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! 🙂

      posted in General Discussion
      kimmanuel
      kimmanuel
    • RE: SearchEnabled Not working

      @Ted @a_5mith Okay. I'm going to disable solr plugin then. Thank you guys for your help. 🙂

      posted in General Discussion
      kimmanuel
      kimmanuel