mirror of
				https://github.com/TriliumNext/Notes.git
				synced 2025-10-31 13:01:31 +08:00 
			
		
		
		
	added date_modified to options as preparation for options syncing
This commit is contained in:
		
							parent
							
								
									af13b28cab
								
							
						
					
					
						commit
						afadd6ec06
					
				
							
								
								
									
										1
									
								
								migrations/0019__date_modified_for_options.sql
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								migrations/0019__date_modified_for_options.sql
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1 @@ | |||||||
|  | ALTER TABLE options ADD COLUMN date_modified INTEGER NOT NULL DEFAULT 0 | ||||||
| @ -4,7 +4,9 @@ function syncNow() { | |||||||
|         type: 'POST', |         type: 'POST', | ||||||
|         success: result => { |         success: result => { | ||||||
|             if (result.success) { |             if (result.success) { | ||||||
|                 alert("Sync finished successfully"); |                 checkAudit(); | ||||||
|  | 
 | ||||||
|  |                 message("Sync finished successfully"); | ||||||
| 
 | 
 | ||||||
|                 for (const l of result.log) |                 for (const l of result.log) | ||||||
|                 { |                 { | ||||||
|  | |||||||
| @ -88,7 +88,7 @@ let globalEncryptionSessionTimeout; | |||||||
| let globalEncryptedDataKey; | let globalEncryptedDataKey; | ||||||
| let globalFullLoadTime; | let globalFullLoadTime; | ||||||
| 
 | 
 | ||||||
| setInterval(() => { | function checkAudit() { | ||||||
|     $.ajax({ |     $.ajax({ | ||||||
|         url: baseApiUrl + 'audit/' + globalFullLoadTime, |         url: baseApiUrl + 'audit/' + globalFullLoadTime, | ||||||
|         type: 'GET', |         type: 'GET', | ||||||
| @ -109,7 +109,9 @@ setInterval(() => { | |||||||
|             } |             } | ||||||
|         } |         } | ||||||
|     }); |     }); | ||||||
| }, 10 * 1000); | } | ||||||
|  | 
 | ||||||
|  | setInterval(checkAudit, 10 * 1000); | ||||||
| 
 | 
 | ||||||
| $(() => { | $(() => { | ||||||
|     $.get(baseApiUrl + 'tree').then(resp => { |     $.get(baseApiUrl + 'tree').then(resp => { | ||||||
|  | |||||||
| @ -3,7 +3,7 @@ const sql = require('./sql'); | |||||||
| const fs = require('fs-extra'); | const fs = require('fs-extra'); | ||||||
| const log = require('./log'); | const log = require('./log'); | ||||||
| 
 | 
 | ||||||
| const APP_DB_VERSION = 18; | const APP_DB_VERSION = 19; | ||||||
| const MIGRATIONS_DIR = "./migrations"; | const MIGRATIONS_DIR = "./migrations"; | ||||||
| 
 | 
 | ||||||
| async function migrate() { | async function migrate() { | ||||||
|  | |||||||
| @ -44,7 +44,9 @@ async function getOption(optName) { | |||||||
| } | } | ||||||
| 
 | 
 | ||||||
| async function setOption(optName, optValue) { | async function setOption(optName, optValue) { | ||||||
|     await execute("UPDATE options SET opt_value = ? WHERE opt_name = ?", [optValue, optName]); |     const now = utils.nowTimestamp(); | ||||||
|  | 
 | ||||||
|  |     await execute("UPDATE options SET opt_value = ?, date_modified = ? WHERE opt_name = ?", [optValue, now, optName]); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| async function getSingleResult(query, params = []) { | async function getSingleResult(query, params = []) { | ||||||
|  | |||||||
| @ -158,11 +158,11 @@ async function login() { | |||||||
| async function sync() { | async function sync() { | ||||||
|     const syncLog = []; |     const syncLog = []; | ||||||
| 
 | 
 | ||||||
|     // if (syncInProgress) {
 |     if (syncInProgress) { | ||||||
|     //     syncLog.push("Sync already in progress");
 |         syncLog.push("Sync already in progress"); | ||||||
|     //
 | 
 | ||||||
|     //     return syncLog;
 |         return syncLog; | ||||||
|     // }
 |     } | ||||||
| 
 | 
 | ||||||
|     syncInProgress = true; |     syncInProgress = true; | ||||||
| 
 | 
 | ||||||
| @ -269,7 +269,7 @@ async function putNote(note, syncLog) { | |||||||
|     } |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| if (SYNC_SERVER && false) { | if (SYNC_SERVER) { | ||||||
|     log.info("Setting up sync"); |     log.info("Setting up sync"); | ||||||
| 
 | 
 | ||||||
|     setInterval(sync, 60000); |     setInterval(sync, 60000); | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 azivner
						azivner