How to use the evt.setHost function in evt

To help you get started, we’ve selected a few evt examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github leanote / desktop-app / node_modules / api.js View on Github external
auth: function(email, pwd, host, callback) { 
		var me = this;

		// 设置server host
		Evt.setHost(host);

		// log({emai: email, pwd: pwd});
		// console.log(this.getUrl('auth/login', {email: email, pwd: pwd}));
		// console.log('????????????')
		needle.post(this.getUrl('auth/login', {macAddr: macAddr}), {email: email, pwd: pwd}, {timeout: 10000}, function(error, response) {
			me.checkError(error, response);
			if(error) {
				return callback && callback(false);
			}
			
			// needle.get('http://localhost/phpinfo.php?email=xx', {emai: email, pwd: pwd}, function(error, response) {
			var ret = response.body;
			// 登录成功, 保存token
			// console.log('login ret');
			// console.log(ret);
			if(Common.isOk(ret)) {
github leanote / desktop-app / src / node_modules / user.js View on Github external
db.users.findOne({IsActive: true}, function(err, user) {
				if(err || !user || !user.UserId) {
					console.log('不存在');
					callback && callback(false);
				} else {
					// me.setCurUser(doc);
					me.token = user.Token;
					me.userId = user.UserId;
					me.email = user.Email;
					me.username = user.Username;
					me.LastSyncUsn = user.LastSyncUsn;
					me.LastSyncTime = user.LastSyncTime;
					me.host = user.Host;
					me.local = user.IsLocal;
					Evt.setHost(me.host);

					// 全局配置也在user中, 到web端
					for(var i in me.g) {
						user[i] = me.g[i];
					}

					// 设置当前用户数据路径
					me.setUserDataPath();

					callback && callback(user);
				}
			});
github leanote / desktop-app / node_modules / user.js View on Github external
me.token = user.Token;
					me.userId = user.UserId;
					me.email = user.Email;
					me.username = user.Username;
					me.LastSyncUsn = user.LastSyncUsn;
					me.LastSyncTime = user.LastSyncTime;
					me.host = user.Host;
					me.local = user.IsLocal;

					me.hasDB = user.HasDB; // 是否有自己的DB

					// 为该用户初始化数据库
					db.initDBForUser(me.hasDB ? me.userId : '', user);

					Evt.setHost(me.host);

					// 全局配置也在user中, 到web端
					for(var i in me.g) {
						user[i] = me.g[i];
					}

					// 设置当前用户数据路径
					me.setUserDataPath();

					callback && callback(user);
				}
			});
github leanote / desktop-app / node_modules / user.js View on Github external
db.users.update({_id: everUserId}, {$set: data}, function(err, cnt) {

					if(err || cnt == 0) {
						console.log('用户信息更新失败', err);

					} else {
						Evt.setHost(me.host);
						console.log('用户信息更新成功');

						db.notes.update({UserId: everUserId}, {$set: {UserId: me.userId, IsDirty: true, ServerNoteId: '', LocalIsNew: true}}, {multi: true}, function () {
							console.log('数据更新成功');
						});

						db.notebooks.update({UserId: everUserId}, {$set: {UserId: me.userId, IsDirty: true, ServerNotebookId: '', LocalIsNew: true}}, {multi: true});
						db.tags.update({UserId: everUserId}, {$set: {UserId: me.userId, IsDirty: true}}, {multi: true});

					}
				});
			} else {