mirror of
				https://github.com/TriliumNext/Notes.git
				synced 2025-10-31 21:11:30 +08:00 
			
		
		
		
	fix #105
This commit is contained in:
		
							parent
							
								
									0ce5caefe8
								
							
						
					
					
						commit
						a372cbb2df
					
				| @ -21,8 +21,11 @@ class Entity { | |||||||
|             contentToHash += "|" + this[propertyName]; |             contentToHash += "|" + this[propertyName]; | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|  |         // this IF is to ease the migration from before hashed options, can be later removed
 | ||||||
|  |         if (this.constructor.tableName !== 'options' || this.isSynced) { | ||||||
|             this["hash"] = utils.hash(contentToHash).substr(0, 10); |             this["hash"] = utils.hash(contentToHash).substr(0, 10); | ||||||
|         } |         } | ||||||
|  |     } | ||||||
| 
 | 
 | ||||||
|     async save() { |     async save() { | ||||||
|         await repository.updateEntity(this); |         await repository.updateEntity(this); | ||||||
|  | |||||||
| @ -1,6 +1,8 @@ | |||||||
| const sql = require('./sql'); | const sql = require('./sql'); | ||||||
| const ScriptContext = require('./script_context'); | const ScriptContext = require('./script_context'); | ||||||
| const repository = require('./repository'); | const repository = require('./repository'); | ||||||
|  | const cls = require('./cls'); | ||||||
|  | const sourceIdService = require('./source_id'); | ||||||
| 
 | 
 | ||||||
| async function executeNote(note) { | async function executeNote(note) { | ||||||
|     if (!note.isJavaScript()) { |     if (!note.isJavaScript()) { | ||||||
| @ -49,6 +51,9 @@ async function executeScript(script, params, startNoteId, currentNoteId) { | |||||||
| } | } | ||||||
| 
 | 
 | ||||||
| async function execute(ctx, script, paramsStr) { | async function execute(ctx, script, paramsStr) { | ||||||
|  |     // scripts run as "server" sourceId so clients recognize the changes as "foreign" and update themselves
 | ||||||
|  |     cls.namespace.set('sourceId', sourceIdService.getCurrentSourceId()); | ||||||
|  | 
 | ||||||
|     return await (function() { return eval(`const apiContext = this;\r\n(${script}\r\n)(${paramsStr})`); }.call(ctx)); |     return await (function() { return eval(`const apiContext = this;\r\n(${script}\r\n)(${paramsStr})`); }.call(ctx)); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 azivner
						azivner