mirror of
				https://github.com/NodeBB/NodeBB.git
				synced 2025-10-31 11:05:54 +01:00 
			
		
		
		
	log server errors in browser
added uid to posts
This commit is contained in:
		
							
								
								
									
										12
									
								
								.project
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								.project
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,12 @@ | ||||
| <?xml version="1.0" encoding="UTF-8"?> | ||||
| <projectDescription> | ||||
| 	<name>node-forum</name> | ||||
| 	<comment></comment> | ||||
| 	<projects> | ||||
| 	</projects> | ||||
| 	<buildSpec> | ||||
| 	</buildSpec> | ||||
| 	<natures> | ||||
| 		<nature>com.aptana.projects.webnature</nature> | ||||
| 	</natures> | ||||
| </projectDescription> | ||||
							
								
								
									
										6
									
								
								app.js
									
									
									
									
									
								
							
							
						
						
									
										6
									
								
								app.js
									
									
									
									
									
								
							| @@ -17,6 +17,12 @@ global.modules = modules; | ||||
| // global.uid = 1; | ||||
|  | ||||
|  | ||||
| process.on('uncaughtException', function(err) { | ||||
|     // handle the error safely | ||||
|     console.log("error message "+err); | ||||
|     global.socket.emit('event:consolelog',{type:'uncaughtException',stack:err.stack,error:err.toString()}); | ||||
| }); | ||||
|  | ||||
|  | ||||
| (function(config) { | ||||
|     config['ROOT_DIRECTORY'] = __dirname; | ||||
|   | ||||
| @@ -18,6 +18,10 @@ var socket, | ||||
| 			socket.on('event:alert', function(data) { | ||||
| 				app.alert(data); | ||||
| 			}); | ||||
| 			 | ||||
| 			socket.on('event:consolelog', function(data) { | ||||
| 				console.log(data); | ||||
| 			}); | ||||
| 		}, | ||||
| 		async: false | ||||
|  | ||||
|   | ||||
| @@ -62,13 +62,15 @@ var	RDB = require('./redis.js'); | ||||
|  | ||||
| 	}; | ||||
|  | ||||
| 	Posts.create = function(content, callback) { | ||||
| 		if (global.uid === null) return; | ||||
| 	Posts.create = function(uid, content, callback) { | ||||
| 		console.log("global uid "+uid); | ||||
| 		 | ||||
| 		if (uid === null) return; | ||||
| 		 | ||||
| 		RDB.incr('global:next_post_id', function(pid) { | ||||
| 			// Posts Info | ||||
| 			RDB.set('pid:' + pid + ':content', content); | ||||
| 			RDB.set('pid:' + pid + ':uid', global.uid); | ||||
| 			RDB.set('pid:' + pid + ':uid', uid); | ||||
| 			RDB.set('pid:' + pid + ':timestamp', new Date().getTime()); | ||||
| 			 | ||||
| 			// User Details - move this out later | ||||
|   | ||||
| @@ -137,7 +137,7 @@ var	RDB = require('./redis.js'), | ||||
| 			RDB.set('topic:slug:' + slug + ':tid', tid); | ||||
|  | ||||
| 			// Posts | ||||
| 			posts.create(content, function(pid) { | ||||
| 			posts.create(uid, content, function(pid) { | ||||
| 				RDB.lpush('tid:' + tid + ':posts', pid); | ||||
| 			}); | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user