File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -55,6 +55,7 @@ class Backup {
5555 await this . registerCommands ( ) ;
5656 await this . registerMenues ( ) ;
5757 await this . createErrorDialog ( ) ;
58+ await this . logVerisonInfos ( ) ;
5859 await this . loadSettings ( ) ;
5960 await this . startTimer ( ) ;
6061 await this . upgradeBackupPluginVersion ( ) ;
@@ -545,6 +546,14 @@ class Backup {
545546 ) ;
546547 }
547548
549+ public async logVerisonInfos ( ) {
550+ const joplinVersionInfo = await helper . joplinVersionInfo ( ) ;
551+ const pluginVersion = await helper . getPluginVersion ( ) ;
552+ this . log . verbose ( "Joplin Version: " + joplinVersionInfo . version ) ;
553+ this . log . verbose ( "Node.JS Version: " + process . version ) ;
554+ this . log . info ( "Plugin Version: " + pluginVersion ) ;
555+ }
556+
548557 public async start ( showDoneMsg : boolean = false ) {
549558 // Prevent error message for empty profile on automatic backup
550559 // https://github.com/JackGruber/joplin-plugin-backup/issues/71
@@ -560,6 +569,7 @@ class Backup {
560569 await this . deleteLogFile ( ) ;
561570 await this . fileLogging ( true ) ;
562571 this . log . info ( "Backup started" ) ;
572+ await this . logVerisonInfos ( ) ;
563573
564574 await this . stopTimer ( ) ;
565575
Original file line number Diff line number Diff line change @@ -4,8 +4,21 @@ import { exec } from "child_process";
44import { promisify } from "util" ;
55import { copyFileSync } from "fs-extra" ;
66import { moveSync } from "fs-extra" ;
7+ import * as fs from "fs-extra" ;
78
89export namespace helper {
10+ export async function getPluginVersion ( ) : Promise < string > {
11+ const installationDir = await joplin . plugins . installationDir ( ) ;
12+ try {
13+ const manifest = JSON . parse (
14+ fs . readFileSync ( path . join ( installationDir , "manifest.json" ) , "utf8" )
15+ ) ;
16+ return manifest . version ;
17+ } catch ( error ) {
18+ return "n/a" ;
19+ }
20+ }
21+
922 export async function validFileName ( fileName : string ) {
1023 var regChar = / [: * ? " < > \/ | \\ ] + / ; // forbidden characters \ / : * ? " < > |
1124 var rexNames = / ^ ( n u l | p r n | c o n | l p t [ 0 - 9 ] | c o m [ 0 - 9 ] ) ( \. | $ ) / i; // forbidden file names
You can’t perform that action at this time.
0 commit comments