mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 18:36:30 +01:00 
			
		
		
		
	Merge branch 'stable'
# Conflicts: # docs/backend_api/BNote.html # docs/backend_api/BackendScriptApi.html # docs/backend_api/services_backend_script_api.js.html # docs/frontend_api/FAttribute.html # docs/frontend_api/FBranch.html # docs/frontend_api/FNote.html # docs/frontend_api/FrontendScriptApi.html # docs/frontend_api/entities_fattachment.js.html # docs/frontend_api/entities_fattribute.js.html # docs/frontend_api/entities_fblob.js.html # docs/frontend_api/entities_fbranch.js.html # docs/frontend_api/entities_fnote.js.html # docs/frontend_api/global.html # docs/frontend_api/index.html # docs/frontend_api/services_frontend_script_api.js.html # package.json # src/services/backend_script_api.js # src/services/build.js
This commit is contained in:
		| @@ -1202,14 +1202,8 @@ class BNote extends AbstractBeccaEntity { | ||||
|  | ||||
|     /** @returns {BAttachment} */ | ||||
|     getAttachmentByTitle(title) { | ||||
|         return sql.getRows(` | ||||
|                 SELECT attachments.* | ||||
|                 FROM attachments  | ||||
|                 WHERE ownerId = ?  | ||||
|                   AND title = ? | ||||
|                   AND isDeleted = 0 | ||||
|                 ORDER BY position`, [this.noteId, title]) | ||||
|             .map(row => new BAttachment(row))[0]; | ||||
|         // cannot use SQL to filter by title since it can be encrypted | ||||
|         return this.getAttachments().filter(attachment => attachment.title === title)[0]; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|   | ||||
| @@ -185,14 +185,8 @@ class BRevision extends AbstractBeccaEntity { | ||||
|  | ||||
|     /** @returns {BAttachment} */ | ||||
|     getAttachmentByTitle(title) { | ||||
|         return sql.getRows(` | ||||
|                 SELECT attachments.* | ||||
|                 FROM attachments  | ||||
|                 WHERE ownerId = ?  | ||||
|                   AND title = ? | ||||
|                   AND isDeleted = 0 | ||||
|                 ORDER BY position`, [this.revisionId, title]) | ||||
|             .map(row => new BAttachment(row))[0]; | ||||
|         // cannot use SQL to filter by title since it can be encrypted | ||||
|         return this.getAttachments().filter(attachment => attachment.title === title)[0]; | ||||
|     } | ||||
|  | ||||
|     beforeSaving() { | ||||
|   | ||||
| @@ -19,7 +19,8 @@ const SpacedUpdate = require("./spaced_update"); | ||||
| const specialNotesService = require("./special_notes"); | ||||
| const branchService = require("./branches"); | ||||
| const exportService = require("./export/zip"); | ||||
| const syncMutex = require("./sync_mutex.js"); | ||||
| const syncMutex = require("./sync_mutex"); | ||||
| const backupService = require("./backup"); | ||||
| const optionsService = require("./options"); | ||||
|  | ||||
|  | ||||
| @@ -663,6 +664,13 @@ function BackendScriptApi(currentNote, apiParams) { | ||||
|      */ | ||||
|     this.runOutsideOfSync = syncMutex.doExclusively; | ||||
|  | ||||
|     /** | ||||
|      * @method | ||||
|      * @param {string} backupName - If the backupName is e.g. "now", then the backup will be written to "backup-now.db" file | ||||
|      * @returns {Promise} - resolves once the backup is finished | ||||
|      */ | ||||
|     this.backupNow = backupService.backupNow; | ||||
|  | ||||
|     /** | ||||
|      * This object contains "at your risk" and "no BC guarantees" objects for advanced use cases. | ||||
|      * | ||||
|   | ||||
| @@ -160,6 +160,8 @@ function getImage(imageUrl) { | ||||
|     }); | ||||
| } | ||||
|  | ||||
| const HTTP = 'http:', HTTPS = 'https:'; | ||||
|  | ||||
| function getProxyAgent(opts) { | ||||
|     if (!opts.proxy) { | ||||
|         return null; | ||||
| @@ -167,15 +169,15 @@ function getProxyAgent(opts) { | ||||
|  | ||||
|     const {protocol} = url.parse(opts.url); | ||||
|  | ||||
|     if (protocol === 'http:' || protocol === 'https:') { | ||||
|         const protoNoColon = protocol.substr(0, protocol.length - 1); | ||||
|         const AgentClass = require(`${protoNoColon}-proxy-agent`); | ||||
|  | ||||
|         return new AgentClass(opts.proxy); | ||||
|     } | ||||
|     else { | ||||
|     if (![HTTP, HTTPS].includes(protocol)) { | ||||
|         return null; | ||||
|     } | ||||
|  | ||||
|     const AgentClass = HTTP === protocol | ||||
|         ? require("http-proxy-agent").HttpProxyAgent | ||||
|         : require("https-proxy-agent").HttpsProxyAgent; | ||||
|  | ||||
|     return new AgentClass(opts.proxy); | ||||
| } | ||||
|  | ||||
| function getClient(opts) { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user