mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-27 16:26:31 +01:00 
			
		
		
		
	Compare commits
	
		
			7 Commits
		
	
	
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|  | eabc7f80b7 | ||
|  | 6405d6e066 | ||
|  | f6d481a9e2 | ||
|  | 695f0e5879 | ||
|  | ae337e4500 | ||
|  | 19ffa14f10 | ||
|  | bf3f26fde8 | 
							
								
								
									
										10
									
								
								bin/build.sh
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								bin/build.sh
									
									
									
									
									
								
							| @@ -8,9 +8,15 @@ cp -r ../trilium-node-binaries/sqlite/* node_modules/sqlite3/lib/binding/ | |||||||
|  |  | ||||||
| cp -r ../trilium-node-binaries/scrypt/* node_modules/scrypt/bin/ | cp -r ../trilium-node-binaries/scrypt/* node_modules/scrypt/bin/ | ||||||
|  |  | ||||||
| ./node_modules/.bin/electron-rebuild | ./node_modules/.bin/electron-rebuild --arch=ia32 | ||||||
|  |  | ||||||
| ./node_modules/.bin/electron-packager . --out=dist --platform=linux,win32 --overwrite | ./node_modules/.bin/electron-packager . --out=dist --platform=linux --arch=ia32 --overwrite | ||||||
|  |  | ||||||
|  | ./node_modules/.bin/electron-rebuild --arch=x64 | ||||||
|  |  | ||||||
|  | ./node_modules/.bin/electron-packager . --out=dist --platform=linux --arch=x64 --overwrite | ||||||
|  |  | ||||||
|  | ./node_modules/.bin/electron-packager . --out=dist --platform=win32 --arch=x64 --overwrite | ||||||
|  |  | ||||||
| # can't copy this before the packaging because the same file name is used for both linux and windows build | # can't copy this before the packaging because the same file name is used for both linux and windows build | ||||||
| cp ../trilium-node-binaries/scrypt.node ./dist/trilium-win32-x64/resources/app/node_modules/scrypt/build/Release/ | cp ../trilium-node-binaries/scrypt.node ./dist/trilium-win32-x64/resources/app/node_modules/scrypt/build/Release/ | ||||||
|   | |||||||
| @@ -4,8 +4,11 @@ VERSION=`jq -r ".version" package.json` | |||||||
|  |  | ||||||
| cd dist | cd dist | ||||||
|  |  | ||||||
| echo "Packaging windows electron distribution..." | echo "Packaging linux x64 electron distribution..." | ||||||
| 7z a trilium-windows-${VERSION}.7z trilium-win32-x64 | 7z a trilium-linux-x64-${VERSION}.7z trilium-linux-x64 | ||||||
|  |  | ||||||
| echo "Packaging linux electron distribution..." | echo "Packaging linux ia32 electron distribution..." | ||||||
| 7z a trilium-linux-${VERSION}.7z trilium-linux-x64 | 7z a trilium-linux-ia32-${VERSION}.7z trilium-linux-ia32 | ||||||
|  |  | ||||||
|  | echo "Packaging windows x64 electron distribution..." | ||||||
|  | 7z a trilium-windows-x64-${VERSION}.7z trilium-win32-x64 | ||||||
| @@ -44,8 +44,9 @@ bin/build.sh | |||||||
|  |  | ||||||
| bin/package.sh | bin/package.sh | ||||||
|  |  | ||||||
| LINUX_BUILD=trilium-linux-$VERSION.7z | LINUX_X64_BUILD=trilium-linux-x64-$VERSION.7z | ||||||
| WINDOWS_BUILD=trilium-windows-$VERSION.7z | LINUX_IA32_BUILD=trilium-linux-ia32-$VERSION.7z | ||||||
|  | WINDOWS_X64_BUILD=trilium-windows-x64-$VERSION.7z | ||||||
|  |  | ||||||
| echo "Creating release in GitHub" | echo "Creating release in GitHub" | ||||||
|  |  | ||||||
| @@ -53,18 +54,25 @@ github-release release \ | |||||||
|     --tag $TAG \ |     --tag $TAG \ | ||||||
|     --name "$TAG release" |     --name "$TAG release" | ||||||
|  |  | ||||||
| echo "Uploading linux build" | echo "Uploading linux x64 build" | ||||||
|  |  | ||||||
| github-release upload \ | github-release upload \ | ||||||
|     --tag $TAG \ |     --tag $TAG \ | ||||||
|     --name "$LINUX_BUILD" \ |     --name "$LINUX_X64_BUILD" \ | ||||||
|     --file "dist/$LINUX_BUILD" |     --file "dist/$LINUX_X64_BUILD" | ||||||
|  |  | ||||||
| echo "Uploading windows build" | echo "Uploading linux ia32 build" | ||||||
|  |  | ||||||
| github-release upload \ | github-release upload \ | ||||||
|     --tag $TAG \ |     --tag $TAG \ | ||||||
|     --name "$WINDOWS_BUILD" \ |     --name "$LINUX_IA32_BUILD" \ | ||||||
|     --file "dist/$WINDOWS_BUILD" |     --file "dist/$LINUX_IA32_BUILD" | ||||||
|  |  | ||||||
|  | echo "Uploading windows x64 build" | ||||||
|  |  | ||||||
|  | github-release upload \ | ||||||
|  |     --tag $TAG \ | ||||||
|  |     --name "$WINDOWS_X64_BUILD" \ | ||||||
|  |     --file "dist/$WINDOWS_X64_BUILD" | ||||||
|  |  | ||||||
| echo "Release finished!" | echo "Release finished!" | ||||||
							
								
								
									
										1
									
								
								index.js
									
									
									
									
									
								
							
							
						
						
									
										1
									
								
								index.js
									
									
									
									
									
								
							| @@ -21,6 +21,7 @@ function createMainWindow() { | |||||||
|     const win = new electron.BrowserWindow({ |     const win = new electron.BrowserWindow({ | ||||||
|         width: 1200, |         width: 1200, | ||||||
|         height: 900, |         height: 900, | ||||||
|  |         title: 'Trilium Notes', | ||||||
|         icon: path.join(__dirname, 'public/images/app-icons/png/256x256.png') |         icon: path.join(__dirname, 'public/images/app-icons/png/256x256.png') | ||||||
|     }); |     }); | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,7 +1,7 @@ | |||||||
| { | { | ||||||
|   "name": "trilium", |   "name": "trilium", | ||||||
|   "description": "Trilium Notes", |   "description": "Trilium Notes", | ||||||
|   "version": "0.0.11", |   "version": "0.1.1", | ||||||
|   "scripts": { |   "scripts": { | ||||||
|     "start": "node ./bin/www", |     "start": "node ./bin/www", | ||||||
|     "test-electron": "xo", |     "test-electron": "xo", | ||||||
|   | |||||||
| @@ -9,7 +9,8 @@ const noteSource = (function() { | |||||||
|  |  | ||||||
|         dialogEl.dialog({ |         dialogEl.dialog({ | ||||||
|             modal: true, |             modal: true, | ||||||
|             width: 800 |             width: 800, | ||||||
|  |             height: 500 | ||||||
|         }); |         }); | ||||||
|  |  | ||||||
|         const noteText = noteEditor.getCurrentNote().detail.note_text; |         const noteText = noteEditor.getCurrentNote().detail.note_text; | ||||||
|   | |||||||
| @@ -49,7 +49,7 @@ $(document).bind('keydown', 'ctrl+f', () => { | |||||||
|         const searchInPage = require('electron-in-page-search').default; |         const searchInPage = require('electron-in-page-search').default; | ||||||
|         const remote = require('electron').remote; |         const remote = require('electron').remote; | ||||||
|  |  | ||||||
|         const inPageSearch = searchInPage(remote.getCurrentWebContents(), { openDevToolsOfSearchWindow: true }); |         const inPageSearch = searchInPage(remote.getCurrentWebContents()); | ||||||
|  |  | ||||||
|         inPageSearch.openSearchWindow(); |         inPageSearch.openSearchWindow(); | ||||||
|  |  | ||||||
| @@ -165,3 +165,5 @@ window.onerror = function (msg, url, lineNo, columnNo, error) { | |||||||
|  |  | ||||||
|     return false; |     return false; | ||||||
| }; | }; | ||||||
|  |  | ||||||
|  | $("#logout-button").toggle(!isElectron()); | ||||||
| @@ -185,6 +185,12 @@ div.ui-tooltip { | |||||||
|     margin-left: 10px; |     margin-left: 10px; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | #note-source { | ||||||
|  |     height: 98%; | ||||||
|  |     width: 100%; | ||||||
|  |     overflow: scroll; | ||||||
|  | } | ||||||
|  |  | ||||||
| #loader-wrapper{position:fixed;top:0;left:0;width:100%;height:100%;z-index:1000;background-color:#fff;opacity:1;transition:opacity 2s ease} | #loader-wrapper{position:fixed;top:0;left:0;width:100%;height:100%;z-index:1000;background-color:#fff;opacity:1;transition:opacity 2s ease} | ||||||
| #loader{display:block;position:relative;left:50%;top:50%;width:150px;height:150px;margin:-75px 0 0 -75px;border-radius:50%;border:3px solid transparent;border-top-color:#777;-webkit-animation:spin 2s linear infinite;animation:spin 2s linear infinite} | #loader{display:block;position:relative;left:50%;top:50%;width:150px;height:150px;margin:-75px 0 0 -75px;border-radius:50%;border:3px solid transparent;border-top-color:#777;-webkit-animation:spin 2s linear infinite;animation:spin 2s linear infinite} | ||||||
| #loader:before{content:"";position:absolute;top:5px;left:5px;right:5px;bottom:5px;border-radius:50%;border:3px solid transparent;border-top-color:#aaa;-webkit-animation:spin 3s linear infinite;animation:spin 3s linear infinite} | #loader:before{content:"";position:absolute;top:5px;left:5px;right:5px;bottom:5px;border-radius:50%;border:3px solid transparent;border-top-color:#aaa;-webkit-animation:spin 3s linear infinite;animation:spin 3s linear infinite} | ||||||
|   | |||||||
| @@ -1 +1 @@ | |||||||
| module.exports = { build_date:"2017-12-26T19:57:44-05:00", build_revision: "baab7454626b154b43144c1a07e1962ab083bde2" }; | module.exports = { build_date:"2017-12-27T17:41:07-05:00", build_revision: "6405d6e06658188f14f29b0a2e1891e5287000f5" }; | ||||||
|   | |||||||
| @@ -4,8 +4,9 @@ const ini = require('ini'); | |||||||
| const fs = require('fs'); | const fs = require('fs'); | ||||||
| const dataDir = require('./data_dir'); | const dataDir = require('./data_dir'); | ||||||
| const path = require('path'); | const path = require('path'); | ||||||
|  | const resource_dir = require('./resource_dir'); | ||||||
|  |  | ||||||
| const configSampleFilePath = path.resolve(__dirname, "..", "config-sample.ini"); | const configSampleFilePath = path.resolve(resource_dir.RESOURCE_DIR, "config-sample.ini"); | ||||||
|  |  | ||||||
| const configFilePath = dataDir.TRILIUM_DATA_DIR + '/config.ini'; | const configFilePath = dataDir.TRILIUM_DATA_DIR + '/config.ini'; | ||||||
|  |  | ||||||
|   | |||||||
| @@ -3,14 +3,7 @@ const sql = require('./sql'); | |||||||
| const options = require('./options'); | const options = require('./options'); | ||||||
| const fs = require('fs-extra'); | const fs = require('fs-extra'); | ||||||
| const log = require('./log'); | const log = require('./log'); | ||||||
| const path = require('path'); | const resource_dir = require('./resource_dir'); | ||||||
|  |  | ||||||
| const MIGRATIONS_DIR = path.resolve(__dirname, "..", "migrations"); |  | ||||||
|  |  | ||||||
| if (!fs.existsSync(MIGRATIONS_DIR)) { |  | ||||||
|     log.error("Could not find migration directory: " + MIGRATIONS_DIR); |  | ||||||
|     process.exit(1); |  | ||||||
| } |  | ||||||
|  |  | ||||||
| async function migrate() { | async function migrate() { | ||||||
|     const migrations = []; |     const migrations = []; | ||||||
| @@ -20,7 +13,7 @@ async function migrate() { | |||||||
|  |  | ||||||
|     const currentDbVersion = parseInt(await options.getOption('db_version')); |     const currentDbVersion = parseInt(await options.getOption('db_version')); | ||||||
|  |  | ||||||
|     fs.readdirSync(MIGRATIONS_DIR).forEach(file => { |     fs.readdirSync(resource_dir.MIGRATIONS_DIR).forEach(file => { | ||||||
|         const match = file.match(/([0-9]{4})__([a-zA-Z0-9_ ]+)\.(sql|js)/); |         const match = file.match(/([0-9]{4})__([a-zA-Z0-9_ ]+)\.(sql|js)/); | ||||||
|  |  | ||||||
|         if (match) { |         if (match) { | ||||||
| @@ -53,7 +46,7 @@ async function migrate() { | |||||||
|  |  | ||||||
|             await sql.doInTransaction(async () => { |             await sql.doInTransaction(async () => { | ||||||
|                 if (mig.type === 'sql') { |                 if (mig.type === 'sql') { | ||||||
|                     const migrationSql = fs.readFileSync(MIGRATIONS_DIR + "/" + mig.file).toString('utf8'); |                     const migrationSql = fs.readFileSync(resource_dir.MIGRATIONS_DIR + "/" + mig.file).toString('utf8'); | ||||||
|  |  | ||||||
|                     console.log("Migration with SQL script: " + migrationSql); |                     console.log("Migration with SQL script: " + migrationSql); | ||||||
|  |  | ||||||
| @@ -62,7 +55,7 @@ async function migrate() { | |||||||
|                 else if (mig.type === 'js') { |                 else if (mig.type === 'js') { | ||||||
|                     console.log("Migration with JS module"); |                     console.log("Migration with JS module"); | ||||||
|  |  | ||||||
|                     const migrationModule = require("../" + MIGRATIONS_DIR + "/" + mig.file); |                     const migrationModule = require("../" + resource_dir.MIGRATIONS_DIR + "/" + mig.file); | ||||||
|                     await migrationModule(db); |                     await migrationModule(db); | ||||||
|                 } |                 } | ||||||
|                 else { |                 else { | ||||||
|   | |||||||
							
								
								
									
										25
									
								
								services/resource_dir.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								services/resource_dir.js
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,25 @@ | |||||||
|  | const log = require('./log'); | ||||||
|  | const path = require('path'); | ||||||
|  | const fs = require('fs'); | ||||||
|  |  | ||||||
|  | const RESOURCE_DIR = path.resolve(__dirname, ".."); | ||||||
|  |  | ||||||
|  | const MIGRATIONS_DIR = path.resolve(RESOURCE_DIR, "migrations"); | ||||||
|  |  | ||||||
|  | if (!fs.existsSync(MIGRATIONS_DIR)) { | ||||||
|  |     log.error("Could not find migration directory: " + MIGRATIONS_DIR); | ||||||
|  |     process.exit(1); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | const DB_INIT_DIR = path.resolve(RESOURCE_DIR, "db"); | ||||||
|  |  | ||||||
|  | if (!fs.existsSync(DB_INIT_DIR)) { | ||||||
|  |     log.error("Could not find DB initialization directory: " + DB_INIT_DIR); | ||||||
|  |     process.exit(1); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | module.exports = { | ||||||
|  |     RESOURCE_DIR, | ||||||
|  |     MIGRATIONS_DIR, | ||||||
|  |     DB_INIT_DIR | ||||||
|  | }; | ||||||
| @@ -4,8 +4,8 @@ const log = require('./log'); | |||||||
| const dataDir = require('./data_dir'); | const dataDir = require('./data_dir'); | ||||||
| const fs = require('fs'); | const fs = require('fs'); | ||||||
| const sqlite = require('sqlite'); | const sqlite = require('sqlite'); | ||||||
| const utils = require('./utils'); |  | ||||||
| const app_info = require('./app_info'); | const app_info = require('./app_info'); | ||||||
|  | const resource_dir = require('./resource_dir'); | ||||||
|  |  | ||||||
| async function createConnection() { | async function createConnection() { | ||||||
|     return await sqlite.open(dataDir.DOCUMENT_PATH, {Promise}); |     return await sqlite.open(dataDir.DOCUMENT_PATH, {Promise}); | ||||||
| @@ -28,9 +28,9 @@ const dbReady = new Promise((resolve, reject) => { | |||||||
|         if (tableResults.length !== 1) { |         if (tableResults.length !== 1) { | ||||||
|             log.info("Connected to db, but schema doesn't exist. Initializing schema ..."); |             log.info("Connected to db, but schema doesn't exist. Initializing schema ..."); | ||||||
|  |  | ||||||
|             const schema = fs.readFileSync('db/schema.sql', 'UTF-8'); |             const schema = fs.readFileSync(resource_dir.DB_INIT_DIR + '/schema.sql', 'UTF-8'); | ||||||
|             const notesSql = fs.readFileSync('db/main_notes.sql', 'UTF-8'); |             const notesSql = fs.readFileSync(resource_dir.DB_INIT_DIR + '/main_notes.sql', 'UTF-8'); | ||||||
|             const notesTreeSql = fs.readFileSync('db/main_notes_tree.sql', 'UTF-8'); |             const notesTreeSql = fs.readFileSync(resource_dir.DB_INIT_DIR + '/main_notes_tree.sql', 'UTF-8'); | ||||||
|  |  | ||||||
|             await doInTransaction(async () => { |             await doInTransaction(async () => { | ||||||
|                 await executeScript(schema); |                 await executeScript(schema); | ||||||
|   | |||||||
| @@ -29,7 +29,7 @@ | |||||||
|  |  | ||||||
|           <button class="btn btn-xs" onclick="settings.showDialog();">Settings</button> |           <button class="btn btn-xs" onclick="settings.showDialog();">Settings</button> | ||||||
|  |  | ||||||
|           <form action="logout" method="POST" style="display: inline;"> |           <form action="logout" id="logout-button" method="POST" style="display: inline;"> | ||||||
|             <input type="submit" class="btn btn-xs" value="Logout"> |             <input type="submit" class="btn btn-xs" value="Logout"> | ||||||
|           </form> |           </form> | ||||||
|         </div> |         </div> | ||||||
| @@ -172,11 +172,11 @@ | |||||||
|     <div id="protected-session-password-dialog" title="Protected session" style="display: none;"> |     <div id="protected-session-password-dialog" title="Protected session" style="display: none;"> | ||||||
|       <form id="protected-session-password-form"> |       <form id="protected-session-password-form"> | ||||||
|         <div class="form-group"> |         <div class="form-group"> | ||||||
|           <label for="protected-session-password">To proceed with requested action you need to enter protected session by entering password:</label> |           <label for="protected-session-password">To proceed with requested action you need to start protected session by entering password:</label> | ||||||
|           <input id="protected-session-password" class="form-control" type="password"> |           <input id="protected-session-password" class="form-control" type="password"> | ||||||
|         </div> |         </div> | ||||||
|  |  | ||||||
|         <button class="btn btn-sm">Enter protected session <kbd>enter</kbd></button> |         <button class="btn btn-sm">Start protected session <kbd>enter</kbd></button> | ||||||
|       </form> |       </form> | ||||||
|     </div> |     </div> | ||||||
|  |  | ||||||
| @@ -327,7 +327,7 @@ | |||||||
|     </div> |     </div> | ||||||
|  |  | ||||||
|     <div id="note-source-dialog" title="Note source" style="display: none; padding: 20px;"> |     <div id="note-source-dialog" title="Note source" style="display: none; padding: 20px;"> | ||||||
|       <pre id="note-source"></pre> |       <textarea id="note-source" readonly="readonly"></textarea> | ||||||
|     </div> |     </div> | ||||||
|  |  | ||||||
|     <div id="tooltip" style="display: none;"></div> |     <div id="tooltip" style="display: none;"></div> | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user