mirror of
				https://github.com/TriliumNext/Notes.git
				synced 2025-10-31 04:51:31 +08:00 
			
		
		
		
	added #shareRaw label
This commit is contained in:
		
							parent
							
								
									228564f843
								
							
						
					
					
						commit
						091d6a1cf1
					
				
							
								
								
									
										686
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										686
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										16
									
								
								package.json
									
									
									
									
									
								
							
							
						
						
									
										16
									
								
								package.json
									
									
									
									
									
								
							| @ -26,25 +26,25 @@ | |||||||
|   "dependencies": { |   "dependencies": { | ||||||
|     "archiver": "5.3.0", |     "archiver": "5.3.0", | ||||||
|     "async-mutex": "0.3.2", |     "async-mutex": "0.3.2", | ||||||
|     "axios": "0.25.0", |     "axios": "0.26.1", | ||||||
|     "better-sqlite3": "7.4.5", |     "better-sqlite3": "7.4.5", | ||||||
|     "chokidar": "3.5.3", |     "chokidar": "3.5.3", | ||||||
|     "cls-hooked": "4.2.2", |     "cls-hooked": "4.2.2", | ||||||
|     "commonmark": "0.30.0", |     "commonmark": "0.30.0", | ||||||
|     "cookie-parser": "1.4.6", |     "cookie-parser": "1.4.6", | ||||||
|     "csurf": "1.11.0", |     "csurf": "1.11.0", | ||||||
|     "dayjs": "1.10.7", |     "dayjs": "1.11.0", | ||||||
|     "ejs": "3.1.6", |     "ejs": "3.1.6", | ||||||
|     "electron-debug": "3.2.0", |     "electron-debug": "3.2.0", | ||||||
|     "electron-dl": "3.3.0", |     "electron-dl": "3.3.0", | ||||||
|     "electron-find": "1.0.7", |     "electron-find": "1.0.7", | ||||||
|     "electron-window-state": "5.0.3", |     "electron-window-state": "5.0.3", | ||||||
|     "@electron/remote": "2.0.8", |     "@electron/remote": "2.0.8", | ||||||
|     "express": "4.17.2", |     "express": "4.17.3", | ||||||
|     "express-partial-content": "1.0.2", |     "express-partial-content": "1.0.2", | ||||||
|     "express-rate-limit": "6.2.1", |     "express-rate-limit": "6.3.0", | ||||||
|     "express-session": "1.17.2", |     "express-session": "1.17.2", | ||||||
|     "fs-extra": "10.0.0", |     "fs-extra": "10.0.1", | ||||||
|     "helmet": "5.0.2", |     "helmet": "5.0.2", | ||||||
|     "html": "1.0.0", |     "html": "1.0.0", | ||||||
|     "html2plaintext": "2.1.4", |     "html2plaintext": "2.1.4", | ||||||
| @ -57,7 +57,7 @@ | |||||||
|     "jimp": "0.16.1", |     "jimp": "0.16.1", | ||||||
|     "joplin-turndown-plugin-gfm": "1.0.12", |     "joplin-turndown-plugin-gfm": "1.0.12", | ||||||
|     "jsdom": "19.0.0", |     "jsdom": "19.0.0", | ||||||
|     "mime-types": "2.1.34", |     "mime-types": "2.1.35", | ||||||
|     "multer": "1.4.4", |     "multer": "1.4.4", | ||||||
|     "node-abi": "3.8.0", |     "node-abi": "3.8.0", | ||||||
|     "normalize-strings": "1.1.1", |     "normalize-strings": "1.1.1", | ||||||
| @ -83,7 +83,7 @@ | |||||||
|   "devDependencies": { |   "devDependencies": { | ||||||
|     "cross-env": "7.0.3", |     "cross-env": "7.0.3", | ||||||
|     "electron": "16.1.0", |     "electron": "16.1.0", | ||||||
|     "electron-builder": "22.14.5", |     "electron-builder": "22.14.13", | ||||||
|     "electron-packager": "15.4.0", |     "electron-packager": "15.4.0", | ||||||
|     "electron-rebuild": "3.2.7", |     "electron-rebuild": "3.2.7", | ||||||
|     "esm": "3.2.25", |     "esm": "3.2.25", | ||||||
| @ -91,7 +91,7 @@ | |||||||
|     "jsdoc": "3.6.10", |     "jsdoc": "3.6.10", | ||||||
|     "lorem-ipsum": "2.0.4", |     "lorem-ipsum": "2.0.4", | ||||||
|     "rcedit": "3.0.1", |     "rcedit": "3.0.1", | ||||||
|     "webpack": "5.68.0", |     "webpack": "5.70.0", | ||||||
|     "webpack-cli": "4.9.2" |     "webpack-cli": "4.9.2" | ||||||
|   }, |   }, | ||||||
|   "optionalDependencies": { |   "optionalDependencies": { | ||||||
|  | |||||||
| @ -215,6 +215,7 @@ const ATTR_HELP = { | |||||||
|         "shareAlias": "define an alias using which the note will be available under https://your_trilium_host/share/[your_alias]", |         "shareAlias": "define an alias using which the note will be available under https://your_trilium_host/share/[your_alias]", | ||||||
|         "shareOmitDefaultCss": "default share page CSS will be omitted. Use when you make extensive styling changes.", |         "shareOmitDefaultCss": "default share page CSS will be omitted. Use when you make extensive styling changes.", | ||||||
|         "shareRoot": "marks note which is served on /share root.", |         "shareRoot": "marks note which is served on /share root.", | ||||||
|  |         "shareRaw": "note will be served in its raw format, without HTML wrapper", | ||||||
|         "displayRelations": "comma delimited names of relations which should be displayed. All other ones will be hidden.", |         "displayRelations": "comma delimited names of relations which should be displayed. All other ones will be hidden.", | ||||||
|         "hideRelations": "comma delimited names of relations which should be hidden. All other ones will be displayed.", |         "hideRelations": "comma delimited names of relations which should be hidden. All other ones will be displayed.", | ||||||
|     }, |     }, | ||||||
|  | |||||||
| @ -46,6 +46,7 @@ module.exports = [ | |||||||
|     { type: 'label', name: 'shareAlias' }, |     { type: 'label', name: 'shareAlias' }, | ||||||
|     { type: 'label', name: 'shareOmitDefaultCss' }, |     { type: 'label', name: 'shareOmitDefaultCss' }, | ||||||
|     { type: 'label', name: 'shareRoot' }, |     { type: 'label', name: 'shareRoot' }, | ||||||
|  |     { type: 'label', name: 'shareRaw' }, | ||||||
|     { type: 'label', name: 'displayRelations' }, |     { type: 'label', name: 'displayRelations' }, | ||||||
|     { type: 'label', name: 'hideRelations' }, |     { type: 'label', name: 'hideRelations' }, | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -23,6 +23,13 @@ function getSharedSubTreeRoot(note) { | |||||||
| function register(router) { | function register(router) { | ||||||
|     function renderNote(note, res) { |     function renderNote(note, res) { | ||||||
|         if (note) { |         if (note) { | ||||||
|  |             if (note.hasLabel('shareRaw')) { | ||||||
|  |                 res.setHeader('Content-Type', note.mime); | ||||||
|  | 
 | ||||||
|  |                 res.send(note.getContent()); | ||||||
|  |                 return; | ||||||
|  |             } | ||||||
|  | 
 | ||||||
|             const {header, content, isEmpty} = contentRenderer.getContent(note); |             const {header, content, isEmpty} = contentRenderer.getContent(note); | ||||||
| 
 | 
 | ||||||
|             const subRoot = getSharedSubTreeRoot(note); |             const subRoot = getSharedSubTreeRoot(note); | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 zadam
						zadam