mirror of
https://github.com/laurent22/joplin.git
synced 2026-06-18 20:16:34 +02:00
All: Started moving sync glue logic to SyncTarget classes
This commit is contained in:
1 parent
a2ae2c766a
commit
d7f3cfd778
15 files changed
+329
-138
No files matched your search
@@ -16,7 +16,7 @@ class Command extends BaseCommand {
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
this.syncTarget_ = null;
|
||||
this.syncTargetId_ = null;
|
||||
this.releaseLockFn_ = null;
|
||||
this.oneDriveApiUtils_ = null;
|
||||
}
|
||||
@@ -62,6 +62,27 @@ class Command extends BaseCommand {
|
||||
});
|
||||
}
|
||||
|
||||
async doAuth(syncTargetId) {
|
||||
const syncTarget = reg.syncTarget(this.syncTargetId_);
|
||||
this.oneDriveApiUtils_ = new OneDriveApiNodeUtils(syncTarget.oneDriveApi());
|
||||
const auth = await this.oneDriveApiUtils_.oauthDance({
|
||||
log: (...s) => { return this.stdout(...s); }
|
||||
});
|
||||
this.oneDriveApiUtils_ = null;
|
||||
return auth;
|
||||
}
|
||||
|
||||
cancelAuth() {
|
||||
if (this.oneDriveApiUtils_) {
|
||||
this.oneDriveApiUtils_.cancelOAuthDance();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
doingAuth() {
|
||||
return !!this.oneDriveApiUtils_;
|
||||
}
|
||||
|
||||
async action(args) {
|
||||
this.releaseLockFn_ = null;
|
||||
|
||||
@@ -91,25 +112,24 @@ class Command extends BaseCommand {
|
||||
};
|
||||
|
||||
try {
|
||||
this.syncTarget_ = Setting.value('sync.target');
|
||||
if (args.options.target) this.syncTarget_ = args.options.target;
|
||||
this.syncTargetId_ = Setting.value('sync.target');
|
||||
if (args.options.target) this.syncTargetId_ = args.options.target;
|
||||
|
||||
if (this.syncTarget_ == Setting.SYNC_TARGET_ONEDRIVE && !reg.syncHasAuth(this.syncTarget_)) {
|
||||
const syncTarget = reg.syncTarget(this.syncTargetId_);
|
||||
|
||||
if (syncTarget.isAuthenticated()) {
|
||||
app().gui().showConsole();
|
||||
app().gui().maximizeConsole();
|
||||
this.oneDriveApiUtils_ = new OneDriveApiNodeUtils(reg.oneDriveApi());
|
||||
const auth = await this.oneDriveApiUtils_.oauthDance({
|
||||
log: (...s) => { return this.stdout(...s); }
|
||||
});
|
||||
this.oneDriveApiUtils_ = null;
|
||||
Setting.setValue('sync.3.auth', auth ? JSON.stringify(auth) : null);
|
||||
|
||||
const auth = await this.doAuth(this.syncTargetId_);
|
||||
Setting.setValue('sync.' + this.syncTargetId_ + '.auth', auth ? JSON.stringify(auth) : null);
|
||||
if (!auth) {
|
||||
this.stdout(_('Authentication was not completed (did not receive an authentication token).'));
|
||||
return cleanUp();
|
||||
}
|
||||
}
|
||||
|
||||
let sync = await reg.synchronizer(this.syncTarget_);
|
||||
const sync = await syncTarget.synchronizer();
|
||||
|
||||
let options = {
|
||||
onProgress: (report) => {
|
||||
@@ -123,13 +143,13 @@ class Command extends BaseCommand {
|
||||
randomFailures: args.options['random-failures'] === true,
|
||||
};
|
||||
|
||||
this.stdout(_('Synchronisation target: %s (%s)', Setting.enumOptionLabel('sync.target', this.syncTarget_), this.syncTarget_));
|
||||
this.stdout(_('Synchronisation target: %s (%s)', Setting.enumOptionLabel('sync.target', this.syncTargetId_), this.syncTargetId_));
|
||||
|
||||
if (!sync) throw new Error(_('Cannot initialize synchroniser.'));
|
||||
|
||||
this.stdout(_('Starting synchronisation...'));
|
||||
|
||||
const contextKey = 'sync.' + this.syncTarget_ + '.context';
|
||||
const contextKey = 'sync.' + this.syncTargetId_ + '.context';
|
||||
let context = Setting.value(contextKey);
|
||||
|
||||
context = context ? JSON.parse(context) : {};
|
||||
@@ -156,26 +176,28 @@ class Command extends BaseCommand {
|
||||
}
|
||||
|
||||
async cancel() {
|
||||
if (this.oneDriveApiUtils_) {
|
||||
this.oneDriveApiUtils_.cancelOAuthDance();
|
||||
if (this.doingAuth()) {
|
||||
this.cancelAuth();
|
||||
return;
|
||||
}
|
||||
|
||||
const target = this.syncTarget_ ? this.syncTarget_ : Setting.value('sync.target');
|
||||
const syncTargetId = this.syncTargetId_ ? this.syncTargetId_ : Setting.value('sync.target');
|
||||
|
||||
cliUtils.redrawDone();
|
||||
|
||||
this.stdout(_('Cancelling... Please wait.'));
|
||||
|
||||
if (reg.syncHasAuth(target)) {
|
||||
let sync = await reg.synchronizer(target);
|
||||
const syncTarget = reg.syncTarget(syncTargetId);
|
||||
|
||||
if (syncTarget.isAuthenticated()) {
|
||||
const sync = await syncTarget.synchronizer();
|
||||
if (sync) await sync.cancel();
|
||||
} else {
|
||||
if (this.releaseLockFn_) this.releaseLockFn_();
|
||||
this.releaseLockFn_ = null;
|
||||
}
|
||||
|
||||
this.syncTarget_ = null;
|
||||
this.syncTargetId_ = null;
|
||||
}
|
||||
|
||||
cancellable() {
|
||||
|
||||
+19
-11
@@ -568,12 +568,15 @@ msgstr ""
|
||||
msgid "Add or remove tags"
|
||||
msgstr ""
|
||||
|
||||
msgid "Switch between note and to-do"
|
||||
msgid "Switch between note and to-do type"
|
||||
msgstr ""
|
||||
|
||||
msgid "Delete"
|
||||
msgstr ""
|
||||
|
||||
msgid "Delete notes?"
|
||||
msgstr ""
|
||||
|
||||
msgid "No notes in here. Create one by clicking on \"New note\"."
|
||||
msgstr ""
|
||||
|
||||
@@ -628,6 +631,9 @@ msgstr ""
|
||||
msgid "Unknown flag: %s"
|
||||
msgstr ""
|
||||
|
||||
msgid "OneDrive"
|
||||
msgstr ""
|
||||
|
||||
#, javascript-format
|
||||
msgid "Unknown log level: %s"
|
||||
msgstr ""
|
||||
@@ -641,11 +647,6 @@ msgid ""
|
||||
"synchronisation again may fix the problem."
|
||||
msgstr ""
|
||||
|
||||
msgid ""
|
||||
"Please set the \"sync.2.path\" config value to the desired synchronisation "
|
||||
"destination."
|
||||
msgstr ""
|
||||
|
||||
#, javascript-format
|
||||
msgid "Cannot access %s"
|
||||
msgstr ""
|
||||
@@ -737,9 +738,6 @@ msgstr ""
|
||||
msgid "File system"
|
||||
msgstr ""
|
||||
|
||||
msgid "OneDrive"
|
||||
msgstr ""
|
||||
|
||||
msgid "Text editor"
|
||||
msgstr ""
|
||||
|
||||
@@ -784,10 +782,10 @@ msgstr ""
|
||||
msgid "%d hours"
|
||||
msgstr ""
|
||||
|
||||
msgid "Show advanced options"
|
||||
msgid "Automatically update the application"
|
||||
msgstr ""
|
||||
|
||||
msgid "Automatically update the application"
|
||||
msgid "Show advanced options"
|
||||
msgstr ""
|
||||
|
||||
msgid "Sync status (synced items / total items)"
|
||||
@@ -819,6 +817,9 @@ msgstr ""
|
||||
msgid "There are currently no notes. Create one by clicking on the (+) button."
|
||||
msgstr ""
|
||||
|
||||
msgid "Delete these notes?"
|
||||
msgstr ""
|
||||
|
||||
msgid "Log"
|
||||
msgstr ""
|
||||
|
||||
@@ -828,6 +829,13 @@ msgstr ""
|
||||
msgid "Export Debug Report"
|
||||
msgstr ""
|
||||
|
||||
msgid "Move to notebook..."
|
||||
msgstr ""
|
||||
|
||||
#, javascript-format
|
||||
msgid "Move %d notes to notebook \"%s\"?"
|
||||
msgstr ""
|
||||
|
||||
msgid "Cancel synchronisation"
|
||||
msgstr ""
|
||||
|
||||
|
||||
+31
-14
@@ -620,12 +620,17 @@ msgstr "Disposition"
|
||||
msgid "Add or remove tags"
|
||||
msgstr "Gérer les étiquettes"
|
||||
|
||||
msgid "Switch between note and to-do"
|
||||
#, fuzzy
|
||||
msgid "Switch between note and to-do type"
|
||||
msgstr "Alterner entre note et tâche"
|
||||
|
||||
msgid "Delete"
|
||||
msgstr "Supprimer"
|
||||
|
||||
#, fuzzy
|
||||
msgid "Delete notes?"
|
||||
msgstr "Supprimer la note ?"
|
||||
|
||||
msgid "No notes in here. Create one by clicking on \"New note\"."
|
||||
msgstr ""
|
||||
"Pas de notes ici. Créez-en une en pressant le bouton \"Nouvelle note\"."
|
||||
@@ -681,6 +686,9 @@ msgstr "Utilisation : %s"
|
||||
msgid "Unknown flag: %s"
|
||||
msgstr "Paramètre inconnu : %s"
|
||||
|
||||
msgid "OneDrive"
|
||||
msgstr "OneDrive"
|
||||
|
||||
#, javascript-format
|
||||
msgid "Unknown log level: %s"
|
||||
msgstr "Paramètre inconnu : %s"
|
||||
@@ -696,13 +704,6 @@ msgstr ""
|
||||
"Impossible de rafraîchir la connexion à OneDrive. Démarrez la "
|
||||
"synchronisation à nouveau pour corriger le problème."
|
||||
|
||||
msgid ""
|
||||
"Please set the \"sync.2.path\" config value to the desired synchronisation "
|
||||
"destination."
|
||||
msgstr ""
|
||||
"Veuillez attribuer une valeur au paramètre de configuration \"sync.2.path\" "
|
||||
"pour indiquer le dossier où devra se faire la synchronisation."
|
||||
|
||||
#, javascript-format
|
||||
msgid "Cannot access %s"
|
||||
msgstr "Impossible d'accéder à %s"
|
||||
@@ -798,9 +799,6 @@ msgstr ""
|
||||
msgid "File system"
|
||||
msgstr "Système de fichier"
|
||||
|
||||
msgid "OneDrive"
|
||||
msgstr "OneDrive"
|
||||
|
||||
msgid "Text editor"
|
||||
msgstr "Éditeur de texte"
|
||||
|
||||
@@ -847,13 +845,13 @@ msgstr "%d heure"
|
||||
msgid "%d hours"
|
||||
msgstr "%d heures"
|
||||
|
||||
msgid "Show advanced options"
|
||||
msgstr "Montrer les options avancées"
|
||||
|
||||
#, fuzzy
|
||||
msgid "Automatically update the application"
|
||||
msgstr "Quitter le logiciel."
|
||||
|
||||
msgid "Show advanced options"
|
||||
msgstr "Montrer les options avancées"
|
||||
|
||||
msgid "Sync status (synced items / total items)"
|
||||
msgstr "Status de la synchronisation (objets synchro. / total)"
|
||||
|
||||
@@ -885,6 +883,10 @@ msgstr ""
|
||||
"Ce carnet ne contient aucune note. Créez-en une en appuyant sur le bouton "
|
||||
"(+)."
|
||||
|
||||
#, fuzzy
|
||||
msgid "Delete these notes?"
|
||||
msgstr "Supprimer la note ?"
|
||||
|
||||
msgid "Log"
|
||||
msgstr "Journal"
|
||||
|
||||
@@ -894,6 +896,14 @@ msgstr "État"
|
||||
msgid "Export Debug Report"
|
||||
msgstr "Exporter rapport de débogage"
|
||||
|
||||
#, fuzzy
|
||||
msgid "Move to notebook..."
|
||||
msgstr "Déplacer la note vers un carnet."
|
||||
|
||||
#, fuzzy, javascript-format
|
||||
msgid "Move %d notes to notebook \"%s\"?"
|
||||
msgstr "Déplacer la note vers un carnet."
|
||||
|
||||
msgid "Cancel synchronisation"
|
||||
msgstr "Annuler synchronisation"
|
||||
|
||||
@@ -962,6 +972,13 @@ msgstr ""
|
||||
msgid "Welcome"
|
||||
msgstr "Bienvenue"
|
||||
|
||||
#~ msgid ""
|
||||
#~ "Please set the \"sync.2.path\" config value to the desired "
|
||||
#~ "synchronisation destination."
|
||||
#~ msgstr ""
|
||||
#~ "Veuillez attribuer une valeur au paramètre de configuration \"sync.2.path"
|
||||
#~ "\" pour indiquer le dossier où devra se faire la synchronisation."
|
||||
|
||||
#~ msgid "Seach:"
|
||||
#~ msgstr "Chercher :"
|
||||
|
||||
|
||||
@@ -568,12 +568,15 @@ msgstr ""
|
||||
msgid "Add or remove tags"
|
||||
msgstr ""
|
||||
|
||||
msgid "Switch between note and to-do"
|
||||
msgid "Switch between note and to-do type"
|
||||
msgstr ""
|
||||
|
||||
msgid "Delete"
|
||||
msgstr ""
|
||||
|
||||
msgid "Delete notes?"
|
||||
msgstr ""
|
||||
|
||||
msgid "No notes in here. Create one by clicking on \"New note\"."
|
||||
msgstr ""
|
||||
|
||||
@@ -628,6 +631,9 @@ msgstr ""
|
||||
msgid "Unknown flag: %s"
|
||||
msgstr ""
|
||||
|
||||
msgid "OneDrive"
|
||||
msgstr ""
|
||||
|
||||
#, javascript-format
|
||||
msgid "Unknown log level: %s"
|
||||
msgstr ""
|
||||
@@ -641,11 +647,6 @@ msgid ""
|
||||
"synchronisation again may fix the problem."
|
||||
msgstr ""
|
||||
|
||||
msgid ""
|
||||
"Please set the \"sync.2.path\" config value to the desired synchronisation "
|
||||
"destination."
|
||||
msgstr ""
|
||||
|
||||
#, javascript-format
|
||||
msgid "Cannot access %s"
|
||||
msgstr ""
|
||||
@@ -737,9 +738,6 @@ msgstr ""
|
||||
msgid "File system"
|
||||
msgstr ""
|
||||
|
||||
msgid "OneDrive"
|
||||
msgstr ""
|
||||
|
||||
msgid "Text editor"
|
||||
msgstr ""
|
||||
|
||||
@@ -784,10 +782,10 @@ msgstr ""
|
||||
msgid "%d hours"
|
||||
msgstr ""
|
||||
|
||||
msgid "Show advanced options"
|
||||
msgid "Automatically update the application"
|
||||
msgstr ""
|
||||
|
||||
msgid "Automatically update the application"
|
||||
msgid "Show advanced options"
|
||||
msgstr ""
|
||||
|
||||
msgid "Sync status (synced items / total items)"
|
||||
@@ -819,6 +817,9 @@ msgstr ""
|
||||
msgid "There are currently no notes. Create one by clicking on the (+) button."
|
||||
msgstr ""
|
||||
|
||||
msgid "Delete these notes?"
|
||||
msgstr ""
|
||||
|
||||
msgid "Log"
|
||||
msgstr ""
|
||||
|
||||
@@ -828,6 +829,13 @@ msgstr ""
|
||||
msgid "Export Debug Report"
|
||||
msgstr ""
|
||||
|
||||
msgid "Move to notebook..."
|
||||
msgstr ""
|
||||
|
||||
#, javascript-format
|
||||
msgid "Move %d notes to notebook \"%s\"?"
|
||||
msgstr ""
|
||||
|
||||
msgid "Cancel synchronisation"
|
||||
msgstr ""
|
||||
|
||||
|
||||
@@ -30,8 +30,6 @@ const logDir = __dirname + '/../tests/logs';
|
||||
fs.mkdirpSync(logDir, 0o755);
|
||||
|
||||
const syncTargetId_ = Setting.SYNC_TARGET_MEMORY;
|
||||
//const syncTargetId_ = Setting.SYNC_TARGET_FILESYSTEM;
|
||||
//const syncTargetId_ = Setting.SYNC_TARGET_ONEDRIVE;
|
||||
const syncDir = __dirname + '/../tests/sync';
|
||||
|
||||
const sleepTime = syncTargetId_ == Setting.SYNC_TARGET_FILESYSTEM ? 1001 : 400;
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"Give focus to next pane":"","Give focus to previous pane":"","Enter command line mode":"","Exit command line mode":"","Edit the selected note":"","Cancel the current command.":"","Exit the application.":"","Delete the currently selected note or notebook.":"","To delete a tag, untag the associated notes.":"","Please select the note or notebook to be deleted first.":"","Set a to-do as completed / not completed":"","[t]oggle [c]onsole between maximized/minimized/hidden/visible.":"","Search":"","[t]oggle note [m]etadata.":"","[M]ake a new [n]ote":"","[M]ake a new [t]odo":"","[M]ake a new note[b]ook":"","Copy ([Y]ank) the [n]ote to a notebook.":"","Move the note to a notebook.":"","Press Ctrl+D or type \"exit\" to exit the application":"","More than one item match \"%s\". Please narrow down your query.":"","No notebook selected.":"","No notebook has been specified.":"","Y":"","n":"","N":"","y":"","Cancelling background synchronisation... Please wait.":"","The command \"%s\" is only available in GUI mode":"","Missing required argument: %s":"","%s: %s":"","Your choice: ":"","Invalid answer: %s":"","Attaches the given file to the note.":"","Cannot find \"%s\".":"","Displays the given note.":"","Displays the complete information about note.":"","Gets or sets a config value. If [value] is not provided, it will show the value of [name]. If neither [name] nor [value] is provided, it will list the current configuration.":"","Also displays unset and hidden config variables.":"","%s = %s (%s)":"","%s = %s":"","Duplicates the notes matching <note> to [notebook]. If no notebook is specified the note is duplicated in the current notebook.":"","Marks a to-do as done.":"","Note is not a to-do: \"%s\"":"","Edit note.":"","No text editor is defined. Please set it using `config editor <editor-path>`":"","No active notebook.":"","Note does not exist: \"%s\". Create it?":"","Starting to edit note. Close the editor to get back to the prompt.":"","Note has been saved.":"","Exits the application.":"","Exports Joplin data to the given directory. By default, it will export the complete database including notebooks, notes, tags and resources.":"","Exports only the given note.":"","Exports only the given notebook.":"","Displays a geolocation URL for the note.":"","Displays usage information.":"","Shortcuts are not available in CLI mode.":"","Type `help [command]` for more information about a command.":"","The possible commands are:":"","In any command, a note or notebook can be refered to by title or ID, or using the shortcuts `$n` or `$b` for, respectively, the currently selected note or notebook. `$c` can be used to refer to the currently selected item.":"","To move from one pane to another, press Tab or Shift+Tab.":"","Use the arrows and page up/down to scroll the lists and text areas (including this console).":"","To maximise/minimise the console, press \"TC\".":"","To enter command line mode, press \":\"":"","To exit command line mode, press ESCAPE":"","For the complete list of available keyboard shortcuts, type `help shortcuts`":"","Imports an Evernote notebook file (.enex file).":"","Do not ask for confirmation.":"","File \"%s\" will be imported into existing notebook \"%s\". Continue?":"","New notebook \"%s\" will be created and file \"%s\" will be imported into it. Continue?":"","Found: %d.":"","Created: %d.":"","Updated: %d.":"","Skipped: %d.":"","Resources: %d.":"","Tagged: %d.":"","Importing notes...":"","The notes have been imported: %s":"","Displays the notes in the current notebook. Use `ls /` to display the list of notebooks.":"","Displays only the first top <num> notes.":"","Sorts the item by <field> (eg. title, updated_time, created_time).":"","Reverses the sorting order.":"","Displays only the items of the specific type(s). Can be `n` for notes, `t` for to-dos, or `nt` for notes and to-dos (eg. `-tt` would display only the to-dos, while `-ttd` would display notes and to-dos.":"","Either \"text\" or \"json\"":"","Use long list format. Format is ID, NOTE_COUNT (for notebook), DATE, TODO_CHECKED (for to-dos), TITLE":"","Please select a notebook first.":"","Creates a new notebook.":"","Creates a new note.":"","Notes can only be created within a notebook.":"","Creates a new to-do.":"","Moves the notes matching <note> to [notebook].":"","Renames the given <item> (note or notebook) to <name>.":"","Deletes the given notebook.":"","Deletes the notebook without asking for confirmation.":"","Delete notebook \"%s\"?":"","Deletes the notes matching <note-pattern>.":"","Deletes the notes without asking for confirmation.":"","%d notes match this pattern. Delete them?":"","Delete note?":"","Searches for the given <pattern> in all the notes.":"","Sets the property <name> of the given <note> to the given [value].":"","Displays summary about the notes and notebooks.":"","Synchronises with remote storage.":"","Sync to provided target (defaults to sync.target config value)":"","Synchronisation is already in progress.":"","Lock file is alLine truncated
|
||||
{"Give focus to next pane":"","Give focus to previous pane":"","Enter command line mode":"","Exit command line mode":"","Edit the selected note":"","Cancel the current command.":"","Exit the application.":"","Delete the currently selected note or notebook.":"","To delete a tag, untag the associated notes.":"","Please select the note or notebook to be deleted first.":"","Set a to-do as completed / not completed":"","[t]oggle [c]onsole between maximized/minimized/hidden/visible.":"","Search":"","[t]oggle note [m]etadata.":"","[M]ake a new [n]ote":"","[M]ake a new [t]odo":"","[M]ake a new note[b]ook":"","Copy ([Y]ank) the [n]ote to a notebook.":"","Move the note to a notebook.":"","Press Ctrl+D or type \"exit\" to exit the application":"","More than one item match \"%s\". Please narrow down your query.":"","No notebook selected.":"","No notebook has been specified.":"","Y":"","n":"","N":"","y":"","Cancelling background synchronisation... Please wait.":"","The command \"%s\" is only available in GUI mode":"","Missing required argument: %s":"","%s: %s":"","Your choice: ":"","Invalid answer: %s":"","Attaches the given file to the note.":"","Cannot find \"%s\".":"","Displays the given note.":"","Displays the complete information about note.":"","Gets or sets a config value. If [value] is not provided, it will show the value of [name]. If neither [name] nor [value] is provided, it will list the current configuration.":"","Also displays unset and hidden config variables.":"","%s = %s (%s)":"","%s = %s":"","Duplicates the notes matching <note> to [notebook]. If no notebook is specified the note is duplicated in the current notebook.":"","Marks a to-do as done.":"","Note is not a to-do: \"%s\"":"","Edit note.":"","No text editor is defined. Please set it using `config editor <editor-path>`":"","No active notebook.":"","Note does not exist: \"%s\". Create it?":"","Starting to edit note. Close the editor to get back to the prompt.":"","Note has been saved.":"","Exits the application.":"","Exports Joplin data to the given directory. By default, it will export the complete database including notebooks, notes, tags and resources.":"","Exports only the given note.":"","Exports only the given notebook.":"","Displays a geolocation URL for the note.":"","Displays usage information.":"","Shortcuts are not available in CLI mode.":"","Type `help [command]` for more information about a command.":"","The possible commands are:":"","In any command, a note or notebook can be refered to by title or ID, or using the shortcuts `$n` or `$b` for, respectively, the currently selected note or notebook. `$c` can be used to refer to the currently selected item.":"","To move from one pane to another, press Tab or Shift+Tab.":"","Use the arrows and page up/down to scroll the lists and text areas (including this console).":"","To maximise/minimise the console, press \"TC\".":"","To enter command line mode, press \":\"":"","To exit command line mode, press ESCAPE":"","For the complete list of available keyboard shortcuts, type `help shortcuts`":"","Imports an Evernote notebook file (.enex file).":"","Do not ask for confirmation.":"","File \"%s\" will be imported into existing notebook \"%s\". Continue?":"","New notebook \"%s\" will be created and file \"%s\" will be imported into it. Continue?":"","Found: %d.":"","Created: %d.":"","Updated: %d.":"","Skipped: %d.":"","Resources: %d.":"","Tagged: %d.":"","Importing notes...":"","The notes have been imported: %s":"","Displays the notes in the current notebook. Use `ls /` to display the list of notebooks.":"","Displays only the first top <num> notes.":"","Sorts the item by <field> (eg. title, updated_time, created_time).":"","Reverses the sorting order.":"","Displays only the items of the specific type(s). Can be `n` for notes, `t` for to-dos, or `nt` for notes and to-dos (eg. `-tt` would display only the to-dos, while `-ttd` would display notes and to-dos.":"","Either \"text\" or \"json\"":"","Use long list format. Format is ID, NOTE_COUNT (for notebook), DATE, TODO_CHECKED (for to-dos), TITLE":"","Please select a notebook first.":"","Creates a new notebook.":"","Creates a new note.":"","Notes can only be created within a notebook.":"","Creates a new to-do.":"","Moves the notes matching <note> to [notebook].":"","Renames the given <item> (note or notebook) to <name>.":"","Deletes the given notebook.":"","Deletes the notebook without asking for confirmation.":"","Delete notebook \"%s\"?":"","Deletes the notes matching <note-pattern>.":"","Deletes the notes without asking for confirmation.":"","%d notes match this pattern. Delete them?":"","Delete note?":"","Searches for the given <pattern> in all the notes.":"","Sets the property <name> of the given <note> to the given [value].":"","Displays summary about the notes and notebooks.":"","Synchronises with remote storage.":"","Sync to provided target (defaults to sync.target config value)":"","Synchronisation is already in progress.":"","Lock file is alLine truncated
|
||||
@@ -1 +1 @@
|
||||
{"Give focus to next pane":"Activer le volet suivant","Give focus to previous pane":"Activer le volet précédent","Enter command line mode":"Démarrer le mode de ligne de commande","Exit command line mode":"Sortir du mode de ligne de commande","Edit the selected note":"Éditer la note sélectionnée","Cancel the current command.":"Annuler la commande en cours.","Exit the application.":"Quitter le logiciel.","Delete the currently selected note or notebook.":"Supprimer la note ou carnet sélectionné.","To delete a tag, untag the associated notes.":"Pour supprimer une vignette, enlever là des notes associées.","Please select the note or notebook to be deleted first.":"Veuillez d'abord sélectionner un carnet.","Set a to-do as completed / not completed":"Marquer une tâches comme complétée / non-complétée","[t]oggle [c]onsole between maximized/minimized/hidden/visible.":"Maximiser, minimiser, cacher ou rendre visible la console.","Search":"Chercher","[t]oggle note [m]etadata.":"Afficher/Cacher les métadonnées des notes.","[M]ake a new [n]ote":"Créer une nouvelle note","[M]ake a new [t]odo":"Créer une nouvelle tâche","[M]ake a new note[b]ook":"Créer un nouveau carnet","Copy ([Y]ank) the [n]ote to a notebook.":"Copier la note dans un autre carnet.","Move the note to a notebook.":"Déplacer la note vers un carnet.","Press Ctrl+D or type \"exit\" to exit the application":"Appuyez sur Ctrl+D ou tapez \"exit\" pour sortir du logiciel","More than one item match \"%s\". Please narrow down your query.":"Plus d'un objet correspond à \"%s\". Veuillez préciser votre requête.","No notebook selected.":"Aucun carnet n'est sélectionné.","No notebook has been specified.":"Aucun carnet n'est spécifié.","Y":"O","n":"n","N":"N","y":"o","Cancelling background synchronisation... Please wait.":"Annulation de la synchronisation... Veuillez patienter.","The command \"%s\" is only available in GUI mode":"La commande \"%s\" est disponible uniquement en mode d'interface graphique","Missing required argument: %s":"Paramètre requis manquant : %s","%s: %s":"%s : %s","Your choice: ":"Votre choix : ","Invalid answer: %s":"Réponse invalide : %s","Attaches the given file to the note.":"Joindre le fichier fourni à la note.","Cannot find \"%s\".":"Impossible de trouver \"%s\".","Displays the given note.":"Affiche la note.","Displays the complete information about note.":"Affiche tous les détails de la note.","Gets or sets a config value. If [value] is not provided, it will show the value of [name]. If neither [name] nor [value] is provided, it will list the current configuration.":"Obtient ou modifie une valeur de configuration. Si la [valeur] n'est pas fournie, la valeur de [nom] est affichée. Si ni le [nom] ni la [valeur] ne sont fournis, la configuration complète est affichée.","Also displays unset and hidden config variables.":"Afficher également les variables cachées.","%s = %s (%s)":"%s = %s (%s)","%s = %s":"%s = %s","Duplicates the notes matching <note> to [notebook]. If no notebook is specified the note is duplicated in the current notebook.":"Copier les notes correspondant à <nom> vers [carnet]. Si aucun carnet n'est spécifié, la note est dupliquée sur place.","Marks a to-do as done.":"Marquer la tâche comme complétée.","Note is not a to-do: \"%s\"":"La note n'est pas une tâche : \"%s\"","Edit note.":"Éditer la note.","No text editor is defined. Please set it using `config editor <editor-path>`":"Aucun éditeur de texte n'est défini. Veuillez le définir en utilisant la commande `config editor <chemin-editeur>`","No active notebook.":"Aucun carnet actif.","Note does not exist: \"%s\". Create it?":"Cette note n'existe pas : \"%s\". La créer ?","Starting to edit note. Close the editor to get back to the prompt.":"Édition de la note en cours. Fermez l'éditeur de texte pour retourner à l'invite de commande.","Note has been saved.":"La note a été enregistrée.","Exits the application.":"Quitter le logiciel.","Exports Joplin data to the given directory. By default, it will export the complete database including notebooks, notes, tags and resources.":"Exporter les données de Joplin vers le dossier fourni. Par défaut, la base de donnée complète sera exportée, y compris les carnets, notes, tags et resources.","Exports only the given note.":"Exporter uniquement la note spécifiée.","Exports only the given notebook.":"Exporter uniquement le carnet spécifié.","Displays a geolocation URL for the note.":"Afficher l'URL de l'emplacement de la note.","Displays usage information.":"Affiche les informations d'utilisation.","Shortcuts are not available in CLI mode.":"Les raccourcis ne sont pas disponible en mode de ligne de commande.","Type `help [command]` for more information about a command.":"Tapez `help [command]` pour plus d'information sur une commande.","The possible commands are:":"Les commandes possibles sont :","In any command, a note or notebook can be refered to by title or ID, or using theLine truncated
|
||||
{"Give focus to next pane":"Activer le volet suivant","Give focus to previous pane":"Activer le volet précédent","Enter command line mode":"Démarrer le mode de ligne de commande","Exit command line mode":"Sortir du mode de ligne de commande","Edit the selected note":"Éditer la note sélectionnée","Cancel the current command.":"Annuler la commande en cours.","Exit the application.":"Quitter le logiciel.","Delete the currently selected note or notebook.":"Supprimer la note ou carnet sélectionné.","To delete a tag, untag the associated notes.":"Pour supprimer une vignette, enlever là des notes associées.","Please select the note or notebook to be deleted first.":"Veuillez d'abord sélectionner un carnet.","Set a to-do as completed / not completed":"Marquer une tâches comme complétée / non-complétée","[t]oggle [c]onsole between maximized/minimized/hidden/visible.":"Maximiser, minimiser, cacher ou rendre visible la console.","Search":"Chercher","[t]oggle note [m]etadata.":"Afficher/Cacher les métadonnées des notes.","[M]ake a new [n]ote":"Créer une nouvelle note","[M]ake a new [t]odo":"Créer une nouvelle tâche","[M]ake a new note[b]ook":"Créer un nouveau carnet","Copy ([Y]ank) the [n]ote to a notebook.":"Copier la note dans un autre carnet.","Move the note to a notebook.":"Déplacer la note vers un carnet.","Press Ctrl+D or type \"exit\" to exit the application":"Appuyez sur Ctrl+D ou tapez \"exit\" pour sortir du logiciel","More than one item match \"%s\". Please narrow down your query.":"Plus d'un objet correspond à \"%s\". Veuillez préciser votre requête.","No notebook selected.":"Aucun carnet n'est sélectionné.","No notebook has been specified.":"Aucun carnet n'est spécifié.","Y":"O","n":"n","N":"N","y":"o","Cancelling background synchronisation... Please wait.":"Annulation de la synchronisation... Veuillez patienter.","The command \"%s\" is only available in GUI mode":"La commande \"%s\" est disponible uniquement en mode d'interface graphique","Missing required argument: %s":"Paramètre requis manquant : %s","%s: %s":"%s : %s","Your choice: ":"Votre choix : ","Invalid answer: %s":"Réponse invalide : %s","Attaches the given file to the note.":"Joindre le fichier fourni à la note.","Cannot find \"%s\".":"Impossible de trouver \"%s\".","Displays the given note.":"Affiche la note.","Displays the complete information about note.":"Affiche tous les détails de la note.","Gets or sets a config value. If [value] is not provided, it will show the value of [name]. If neither [name] nor [value] is provided, it will list the current configuration.":"Obtient ou modifie une valeur de configuration. Si la [valeur] n'est pas fournie, la valeur de [nom] est affichée. Si ni le [nom] ni la [valeur] ne sont fournis, la configuration complète est affichée.","Also displays unset and hidden config variables.":"Afficher également les variables cachées.","%s = %s (%s)":"%s = %s (%s)","%s = %s":"%s = %s","Duplicates the notes matching <note> to [notebook]. If no notebook is specified the note is duplicated in the current notebook.":"Copier les notes correspondant à <nom> vers [carnet]. Si aucun carnet n'est spécifié, la note est dupliquée sur place.","Marks a to-do as done.":"Marquer la tâche comme complétée.","Note is not a to-do: \"%s\"":"La note n'est pas une tâche : \"%s\"","Edit note.":"Éditer la note.","No text editor is defined. Please set it using `config editor <editor-path>`":"Aucun éditeur de texte n'est défini. Veuillez le définir en utilisant la commande `config editor <chemin-editeur>`","No active notebook.":"Aucun carnet actif.","Note does not exist: \"%s\". Create it?":"Cette note n'existe pas : \"%s\". La créer ?","Starting to edit note. Close the editor to get back to the prompt.":"Édition de la note en cours. Fermez l'éditeur de texte pour retourner à l'invite de commande.","Note has been saved.":"La note a été enregistrée.","Exits the application.":"Quitter le logiciel.","Exports Joplin data to the given directory. By default, it will export the complete database including notebooks, notes, tags and resources.":"Exporter les données de Joplin vers le dossier fourni. Par défaut, la base de donnée complète sera exportée, y compris les carnets, notes, tags et resources.","Exports only the given note.":"Exporter uniquement la note spécifiée.","Exports only the given notebook.":"Exporter uniquement le carnet spécifié.","Displays a geolocation URL for the note.":"Afficher l'URL de l'emplacement de la note.","Displays usage information.":"Affiche les informations d'utilisation.","Shortcuts are not available in CLI mode.":"Les raccourcis ne sont pas disponible en mode de ligne de commande.","Type `help [command]` for more information about a command.":"Tapez `help [command]` pour plus d'information sur une commande.","The possible commands are:":"Les commandes possibles sont :","In any command, a note or notebook can be refered to by title or ID, or using theLine truncated
|
||||
@@ -14,6 +14,7 @@ const { Logger } = require('lib/logger.js');
|
||||
const { splitCommandString } = require('lib/string-utils.js');
|
||||
const { sprintf } = require('sprintf-js');
|
||||
const { reg } = require('lib/registry.js');
|
||||
const BaseSyncTarget = require('lib/BaseSyncTarget.js');
|
||||
const { fileExtension } = require('lib/path-utils.js');
|
||||
const { shim } = require('lib/shim.js');
|
||||
const { _, setLocale, defaultLocale, closestSupportedLocale } = require('lib/locale.js');
|
||||
@@ -276,6 +277,7 @@ class BaseApplication {
|
||||
BaseModel.dispatch = this.store().dispatch;
|
||||
FoldersScreenUtils.dispatch = this.store().dispatch;
|
||||
reg.dispatch = this.store().dispatch;
|
||||
BaseSyncTarget.dispatch = this.store().dispatch;
|
||||
}
|
||||
|
||||
async readFlagsFromFile(flagPath) {
|
||||
|
||||
@@ -0,0 +1,82 @@
|
||||
const { reg } = require('lib/registry.js');
|
||||
|
||||
class BaseSyncTarget {
|
||||
|
||||
constructor(db) {
|
||||
this.db_ = db;
|
||||
this.synchronizer_ = null;
|
||||
this.initState_ = null;
|
||||
this.logger_ = null;
|
||||
}
|
||||
|
||||
logger() {
|
||||
return this.logger_;
|
||||
}
|
||||
|
||||
setLogger(v) {
|
||||
this.logger_ = v;
|
||||
}
|
||||
|
||||
db() {
|
||||
return this.db_;
|
||||
}
|
||||
|
||||
isAuthenticated() {
|
||||
return false;
|
||||
}
|
||||
|
||||
name() {
|
||||
throw new Error('Not implemented');
|
||||
}
|
||||
|
||||
label() {
|
||||
throw new Error('Not implemented');
|
||||
}
|
||||
|
||||
async initSynchronizer() {
|
||||
throw new Error('Not implemented');
|
||||
}
|
||||
|
||||
async synchronizer() {
|
||||
if (this.synchronizer_) return this.synchronizer_;
|
||||
|
||||
if (this.initState_ == 'started') {
|
||||
// Synchronizer is already being initialized, so wait here till it's done.
|
||||
return new Promise((resolve, reject) => {
|
||||
const iid = setInterval(() => {
|
||||
if (this.initState_ == 'ready') {
|
||||
clearInterval(iid);
|
||||
resolve(this.synchronizer_);
|
||||
}
|
||||
if (this.initState_ == 'error') {
|
||||
clearInterval(iid);
|
||||
reject(new Error('Could not initialise synchroniser'));
|
||||
}
|
||||
}, 1000);
|
||||
});
|
||||
} else {
|
||||
this.initState_ = 'started';
|
||||
|
||||
try {
|
||||
this.synchronizer_ = await this.initSynchronizer();
|
||||
this.synchronizer_.setLogger(this.logger());
|
||||
this.synchronizer_.dispatch = BaseSyncTarget.dispatch;
|
||||
this.initState_ = 'ready';
|
||||
return this.synchronizer_;
|
||||
} catch (error) {
|
||||
this.initState_ = 'error';
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async syncStarted() {
|
||||
if (!this.synchronizer_) return false;
|
||||
if (!this.isAuthenticated()) return false;
|
||||
const sync = await this.synchronizer();
|
||||
return sync.state() != 'idle';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
module.exports = BaseSyncTarget;
|
||||
@@ -0,0 +1,23 @@
|
||||
const BaseSyncTarget = require('lib/BaseSyncTarget.js');
|
||||
|
||||
class SyncTarget1 extends BaseSyncTarget {
|
||||
|
||||
id() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
name() {
|
||||
return 'Memory';
|
||||
}
|
||||
|
||||
label() {
|
||||
return 'Memory';
|
||||
}
|
||||
|
||||
isAuthenticated() {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
module.exports = SyncTarget1;
|
||||
@@ -0,0 +1,80 @@
|
||||
const BaseSyncTarget = require('lib/BaseSyncTarget.js');
|
||||
const { _ } = require('lib/locale.js');
|
||||
const { OneDriveApi } = require('lib/onedrive-api.js');
|
||||
const { Setting } = require('lib/models/setting.js');
|
||||
const { parameters } = require('lib/parameters.js');
|
||||
const { FileApi } = require('lib/file-api.js');
|
||||
const { Synchronizer } = require('lib/synchronizer.js');
|
||||
const { FileApiDriverOneDrive } = require('lib/file-api-driver-onedrive.js');
|
||||
|
||||
class SyncTarget3 extends BaseSyncTarget {
|
||||
|
||||
constructor(db) {
|
||||
super();
|
||||
this.oneDriveApi_ = null;
|
||||
}
|
||||
|
||||
id() {
|
||||
return 3;
|
||||
}
|
||||
|
||||
name() {
|
||||
return 'OneDrive';
|
||||
}
|
||||
|
||||
label() {
|
||||
return _('OneDrive');
|
||||
}
|
||||
|
||||
isAuthenticated() {
|
||||
return this.oneDriveApi_ && this.oneDriveApi_.auth();
|
||||
}
|
||||
|
||||
oneDriveApi() {
|
||||
if (this.oneDriveApi_) return this.oneDriveApi_;
|
||||
|
||||
const isPublic = Setting.value('appType') != 'cli';
|
||||
|
||||
this.oneDriveApi_ = new OneDriveApi(parameters().oneDrive.id, parameters().oneDrive.secret, isPublic);
|
||||
this.oneDriveApi_.setLogger(this.logger());
|
||||
|
||||
this.oneDriveApi_.on('authRefreshed', (a) => {
|
||||
this.logger().info('Saving updated OneDrive auth.');
|
||||
Setting.setValue('sync.' + this.id() + '.auth', a ? JSON.stringify(a) : null);
|
||||
});
|
||||
|
||||
let auth = Setting.value('sync.' + this.id() + '.auth');
|
||||
if (auth) {
|
||||
try {
|
||||
auth = JSON.parse(auth);
|
||||
} catch (error) {
|
||||
this.logger().warn('Could not parse OneDrive auth token');
|
||||
this.logger().warn(error);
|
||||
auth = null;
|
||||
}
|
||||
|
||||
this.oneDriveApi_.setAuth(auth);
|
||||
}
|
||||
|
||||
return this.oneDriveApi_;
|
||||
}
|
||||
|
||||
async initSynchronizer() {
|
||||
let fileApi = null;
|
||||
|
||||
if (!this.oneDriveApi().auth()) throw new Error('User is not authentified');
|
||||
const appDir = await this.oneDriveApi().appDirectory();
|
||||
fileApi = new FileApi(appDir, new FileApiDriverOneDrive(this.oneDriveApi()));
|
||||
fileApi.setSyncTargetId(this.id());
|
||||
fileApi.setLogger(this.logger());
|
||||
|
||||
return new Synchronizer(this.db(), fileApi, Setting.value('appType'));
|
||||
}
|
||||
|
||||
isAuthenticated() {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
module.exports = SyncTarget3;
|
||||
@@ -72,16 +72,19 @@ class Setting extends BaseModel {
|
||||
});
|
||||
}
|
||||
|
||||
static dispatchUpdateAll() {
|
||||
static toPlainObject() {
|
||||
const keys = this.keys();
|
||||
let keyToValues = {};
|
||||
for (let i = 0; i < keys.length; i++) {
|
||||
keyToValues[keys[i]] = this.value(keys[i]);
|
||||
}
|
||||
return keyToValues;
|
||||
}
|
||||
|
||||
static dispatchUpdateAll() {
|
||||
this.dispatch({
|
||||
type: 'SETTING_UPDATE_ALL',
|
||||
settings: keyToValues,
|
||||
settings: this.toPlainObject(),
|
||||
});
|
||||
}
|
||||
|
||||
@@ -326,6 +329,7 @@ class Setting extends BaseModel {
|
||||
Setting.SYNC_TARGET_MEMORY = 1;
|
||||
Setting.SYNC_TARGET_FILESYSTEM = 2;
|
||||
Setting.SYNC_TARGET_ONEDRIVE = 3;
|
||||
//Setting.SYNC_TARGET_ONEDRIVE_DEV = 4;
|
||||
|
||||
Setting.TYPE_INT = 1;
|
||||
Setting.TYPE_STRING = 2;
|
||||
@@ -341,11 +345,13 @@ Setting.metadata_ = {
|
||||
'firstStart': { value: true, type: Setting.TYPE_BOOL, public: false },
|
||||
'sync.2.path': { value: '', type: Setting.TYPE_STRING, public: true, appTypes: ['cli'], label: () => _('File system synchronisation target directory'), description: () => _('The path to synchronise with when file system synchronisation is enabled. See `sync.target`.') },
|
||||
'sync.3.auth': { value: '', type: Setting.TYPE_STRING, public: false },
|
||||
'sync.4.auth': { value: '', type: Setting.TYPE_STRING, public: false },
|
||||
'sync.target': { value: Setting.SYNC_TARGET_ONEDRIVE, type: Setting.TYPE_INT, isEnum: true, public: true, label: () => _('Synchronisation target'), description: () => _('The target to synchonise to. If synchronising with the file system, set `sync.2.path` to specify the target directory.'), options: () => {
|
||||
let output = {};
|
||||
output[Setting.SYNC_TARGET_MEMORY] = 'Memory';
|
||||
output[Setting.SYNC_TARGET_FILESYSTEM] = _('File system');
|
||||
output[Setting.SYNC_TARGET_ONEDRIVE] = _('OneDrive');
|
||||
//output[Setting.SYNC_TARGET_ONEDRIVE_DEV] = _('OneDrive (Testing Only)');
|
||||
return output;
|
||||
}},
|
||||
'sync.1.context': { value: '', type: Setting.TYPE_STRING, public: false },
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
const { Logger } = require('lib/logger.js');
|
||||
const { Setting } = require('lib/models/setting.js');
|
||||
const { OneDriveApi } = require('lib/onedrive-api.js');
|
||||
const { parameters } = require('lib/parameters.js');
|
||||
const { FileApi } = require('lib/file-api.js');
|
||||
const { Database } = require('lib/database.js');
|
||||
const { Synchronizer } = require('lib/synchronizer.js');
|
||||
const SyncTarget1 = require('lib/SyncTarget1.js');
|
||||
const SyncTarget3 = require('lib/SyncTarget3.js');
|
||||
const { FileApiDriverOneDrive } = require('lib/file-api-driver-onedrive.js');
|
||||
const { shim } = require('lib/shim.js');
|
||||
const { time } = require('lib/time-utils.js');
|
||||
@@ -14,6 +15,12 @@ const { _ } = require('lib/locale.js');
|
||||
const reg = {};
|
||||
|
||||
reg.initSynchronizerStates_ = {};
|
||||
reg.syncTargetClasses_ = {
|
||||
1: SyncTarget1,
|
||||
// 2: SyncTarget2,
|
||||
3: SyncTarget3,
|
||||
};
|
||||
reg.syncTargets_ = {};
|
||||
reg.synchronizers_ = {};
|
||||
|
||||
reg.logger = () => {
|
||||
@@ -29,71 +36,17 @@ reg.setLogger = (l) => {
|
||||
reg.logger_ = l;
|
||||
}
|
||||
|
||||
reg.oneDriveApi = () => {
|
||||
if (reg.oneDriveApi_) return reg.oneDriveApi_;
|
||||
reg.syncTarget = (syncTargetId = null) => {
|
||||
if (syncTargetId === null) syncTargetId = Setting.value('sync.target');
|
||||
if (reg.syncTargets_[syncTargetId]) return reg.syncTargets_[syncTargetId];
|
||||
|
||||
const isPublic = Setting.value('appType') != 'cli';
|
||||
const SyncTargetClass = reg.syncTargetClasses_[syncTargetId];
|
||||
if (!reg.db()) throw new Error('Cannot initialize sync without a db');
|
||||
|
||||
reg.oneDriveApi_ = new OneDriveApi(parameters().oneDrive.id, parameters().oneDrive.secret, isPublic);
|
||||
reg.oneDriveApi_.setLogger(reg.logger());
|
||||
|
||||
reg.oneDriveApi_.on('authRefreshed', (a) => {
|
||||
reg.logger().info('Saving updated OneDrive auth.');
|
||||
Setting.setValue('sync.3.auth', a ? JSON.stringify(a) : null);
|
||||
});
|
||||
|
||||
let auth = Setting.value('sync.3.auth');
|
||||
if (auth) {
|
||||
try {
|
||||
auth = JSON.parse(auth);
|
||||
} catch (error) {
|
||||
reg.logger().warn('Could not parse OneDrive auth token');
|
||||
reg.logger().warn(error);
|
||||
auth = null;
|
||||
}
|
||||
|
||||
reg.oneDriveApi_.setAuth(auth);
|
||||
}
|
||||
|
||||
return reg.oneDriveApi_;
|
||||
}
|
||||
|
||||
reg.initSynchronizer_ = async (syncTargetId) => {
|
||||
if (!reg.db()) throw new Error('Cannot initialize synchronizer: db not initialized');
|
||||
|
||||
let fileApi = null;
|
||||
|
||||
if (syncTargetId == Setting.SYNC_TARGET_ONEDRIVE) {
|
||||
|
||||
if (!reg.oneDriveApi().auth()) throw new Error('User is not authentified');
|
||||
let appDir = await reg.oneDriveApi().appDirectory();
|
||||
fileApi = new FileApi(appDir, new FileApiDriverOneDrive(reg.oneDriveApi()));
|
||||
|
||||
} else if (syncTargetId == Setting.SYNC_TARGET_MEMORY) {
|
||||
|
||||
fileApi = new FileApi('joplin', new FileApiDriverMemory());
|
||||
|
||||
} else if (syncTargetId == Setting.SYNC_TARGET_FILESYSTEM) {
|
||||
|
||||
let syncDir = Setting.value('sync.2.path');
|
||||
if (!syncDir) throw new Error(_('Please set the "sync.2.path" config value to the desired synchronisation destination.'));
|
||||
await shim.fs.mkdirp(syncDir, 0o755);
|
||||
fileApi = new FileApi(syncDir, new shim.FileApiDriverLocal());
|
||||
|
||||
} else {
|
||||
|
||||
throw new Error('Unknown sync target: ' + syncTargetId);
|
||||
|
||||
}
|
||||
|
||||
fileApi.setSyncTargetId(syncTargetId);
|
||||
fileApi.setLogger(reg.logger());
|
||||
|
||||
let sync = new Synchronizer(reg.db(), fileApi, Setting.value('appType'));
|
||||
sync.setLogger(reg.logger());
|
||||
sync.dispatch = reg.dispatch;
|
||||
|
||||
return sync;
|
||||
const target = new SyncTargetClass(reg.db());
|
||||
target.setLogger(reg.logger());
|
||||
reg.syncTargets_[syncTargetId] = target;
|
||||
return target;
|
||||
}
|
||||
|
||||
reg.synchronizer = async (syncTargetId) => {
|
||||
@@ -130,11 +83,7 @@ reg.synchronizer = async (syncTargetId) => {
|
||||
}
|
||||
|
||||
reg.syncHasAuth = (syncTargetId) => {
|
||||
if (syncTargetId == Setting.SYNC_TARGET_ONEDRIVE && !reg.oneDriveApi().auth()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
return reg.syncTargets(syncTargetId).isAuthenticated();
|
||||
}
|
||||
|
||||
reg.scheduleSync = async (delay = null) => {
|
||||
@@ -164,7 +113,7 @@ reg.scheduleSync = async (delay = null) => {
|
||||
}
|
||||
|
||||
try {
|
||||
const sync = await reg.synchronizer(syncTargetId);
|
||||
const sync = await reg.syncTarget(syncTargetId).synchronizer();
|
||||
|
||||
const contextKey = 'sync.' + syncTargetId + '.context';
|
||||
let context = Setting.value(contextKey);
|
||||
@@ -195,11 +144,7 @@ reg.scheduleSync = async (delay = null) => {
|
||||
}
|
||||
|
||||
reg.syncStarted = async () => {
|
||||
const syncTarget = Setting.value('sync.target');
|
||||
if (!reg.synchronizers_[syncTarget]) return false;
|
||||
if (!reg.syncHasAuth(syncTarget)) return false;
|
||||
const sync = await reg.synchronizer(syncTarget);
|
||||
return sync.state() != 'idle';
|
||||
return reg.syncTarget().syncStarted();
|
||||
}
|
||||
|
||||
reg.setupRecurrentSync = () => {
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"Give focus to next pane":"","Give focus to previous pane":"","Enter command line mode":"","Exit command line mode":"","Edit the selected note":"","Cancel the current command.":"","Exit the application.":"","Delete the currently selected note or notebook.":"","To delete a tag, untag the associated notes.":"","Please select the note or notebook to be deleted first.":"","Set a to-do as completed / not completed":"","[t]oggle [c]onsole between maximized/minimized/hidden/visible.":"","Search":"","[t]oggle note [m]etadata.":"","[M]ake a new [n]ote":"","[M]ake a new [t]odo":"","[M]ake a new note[b]ook":"","Copy ([Y]ank) the [n]ote to a notebook.":"","Move the note to a notebook.":"","Press Ctrl+D or type \"exit\" to exit the application":"","More than one item match \"%s\". Please narrow down your query.":"","No notebook selected.":"","No notebook has been specified.":"","Y":"","n":"","N":"","y":"","Cancelling background synchronisation... Please wait.":"","The command \"%s\" is only available in GUI mode":"","Missing required argument: %s":"","%s: %s":"","Your choice: ":"","Invalid answer: %s":"","Attaches the given file to the note.":"","Cannot find \"%s\".":"","Displays the given note.":"","Displays the complete information about note.":"","Gets or sets a config value. If [value] is not provided, it will show the value of [name]. If neither [name] nor [value] is provided, it will list the current configuration.":"","Also displays unset and hidden config variables.":"","%s = %s (%s)":"","%s = %s":"","Duplicates the notes matching <note> to [notebook]. If no notebook is specified the note is duplicated in the current notebook.":"","Marks a to-do as done.":"","Note is not a to-do: \"%s\"":"","Edit note.":"","No text editor is defined. Please set it using `config editor <editor-path>`":"","No active notebook.":"","Note does not exist: \"%s\". Create it?":"","Starting to edit note. Close the editor to get back to the prompt.":"","Note has been saved.":"","Exits the application.":"","Exports Joplin data to the given directory. By default, it will export the complete database including notebooks, notes, tags and resources.":"","Exports only the given note.":"","Exports only the given notebook.":"","Displays a geolocation URL for the note.":"","Displays usage information.":"","Shortcuts are not available in CLI mode.":"","Type `help [command]` for more information about a command.":"","The possible commands are:":"","In any command, a note or notebook can be refered to by title or ID, or using the shortcuts `$n` or `$b` for, respectively, the currently selected note or notebook. `$c` can be used to refer to the currently selected item.":"","To move from one pane to another, press Tab or Shift+Tab.":"","Use the arrows and page up/down to scroll the lists and text areas (including this console).":"","To maximise/minimise the console, press \"TC\".":"","To enter command line mode, press \":\"":"","To exit command line mode, press ESCAPE":"","For the complete list of available keyboard shortcuts, type `help shortcuts`":"","Imports an Evernote notebook file (.enex file).":"","Do not ask for confirmation.":"","File \"%s\" will be imported into existing notebook \"%s\". Continue?":"","New notebook \"%s\" will be created and file \"%s\" will be imported into it. Continue?":"","Found: %d.":"","Created: %d.":"","Updated: %d.":"","Skipped: %d.":"","Resources: %d.":"","Tagged: %d.":"","Importing notes...":"","The notes have been imported: %s":"","Displays the notes in the current notebook. Use `ls /` to display the list of notebooks.":"","Displays only the first top <num> notes.":"","Sorts the item by <field> (eg. title, updated_time, created_time).":"","Reverses the sorting order.":"","Displays only the items of the specific type(s). Can be `n` for notes, `t` for to-dos, or `nt` for notes and to-dos (eg. `-tt` would display only the to-dos, while `-ttd` would display notes and to-dos.":"","Either \"text\" or \"json\"":"","Use long list format. Format is ID, NOTE_COUNT (for notebook), DATE, TODO_CHECKED (for to-dos), TITLE":"","Please select a notebook first.":"","Creates a new notebook.":"","Creates a new note.":"","Notes can only be created within a notebook.":"","Creates a new to-do.":"","Moves the notes matching <note> to [notebook].":"","Renames the given <item> (note or notebook) to <name>.":"","Deletes the given notebook.":"","Deletes the notebook without asking for confirmation.":"","Delete notebook \"%s\"?":"","Deletes the notes matching <note-pattern>.":"","Deletes the notes without asking for confirmation.":"","%d notes match this pattern. Delete them?":"","Delete note?":"","Searches for the given <pattern> in all the notes.":"","Sets the property <name> of the given <note> to the given [value].":"","Displays summary about the notes and notebooks.":"","Synchronises with remote storage.":"","Sync to provided target (defaults to sync.target config value)":"","Synchronisation is already in progress.":"","Lock file is alLine truncated
|
||||
{"Give focus to next pane":"","Give focus to previous pane":"","Enter command line mode":"","Exit command line mode":"","Edit the selected note":"","Cancel the current command.":"","Exit the application.":"","Delete the currently selected note or notebook.":"","To delete a tag, untag the associated notes.":"","Please select the note or notebook to be deleted first.":"","Set a to-do as completed / not completed":"","[t]oggle [c]onsole between maximized/minimized/hidden/visible.":"","Search":"","[t]oggle note [m]etadata.":"","[M]ake a new [n]ote":"","[M]ake a new [t]odo":"","[M]ake a new note[b]ook":"","Copy ([Y]ank) the [n]ote to a notebook.":"","Move the note to a notebook.":"","Press Ctrl+D or type \"exit\" to exit the application":"","More than one item match \"%s\". Please narrow down your query.":"","No notebook selected.":"","No notebook has been specified.":"","Y":"","n":"","N":"","y":"","Cancelling background synchronisation... Please wait.":"","The command \"%s\" is only available in GUI mode":"","Missing required argument: %s":"","%s: %s":"","Your choice: ":"","Invalid answer: %s":"","Attaches the given file to the note.":"","Cannot find \"%s\".":"","Displays the given note.":"","Displays the complete information about note.":"","Gets or sets a config value. If [value] is not provided, it will show the value of [name]. If neither [name] nor [value] is provided, it will list the current configuration.":"","Also displays unset and hidden config variables.":"","%s = %s (%s)":"","%s = %s":"","Duplicates the notes matching <note> to [notebook]. If no notebook is specified the note is duplicated in the current notebook.":"","Marks a to-do as done.":"","Note is not a to-do: \"%s\"":"","Edit note.":"","No text editor is defined. Please set it using `config editor <editor-path>`":"","No active notebook.":"","Note does not exist: \"%s\". Create it?":"","Starting to edit note. Close the editor to get back to the prompt.":"","Note has been saved.":"","Exits the application.":"","Exports Joplin data to the given directory. By default, it will export the complete database including notebooks, notes, tags and resources.":"","Exports only the given note.":"","Exports only the given notebook.":"","Displays a geolocation URL for the note.":"","Displays usage information.":"","Shortcuts are not available in CLI mode.":"","Type `help [command]` for more information about a command.":"","The possible commands are:":"","In any command, a note or notebook can be refered to by title or ID, or using the shortcuts `$n` or `$b` for, respectively, the currently selected note or notebook. `$c` can be used to refer to the currently selected item.":"","To move from one pane to another, press Tab or Shift+Tab.":"","Use the arrows and page up/down to scroll the lists and text areas (including this console).":"","To maximise/minimise the console, press \"TC\".":"","To enter command line mode, press \":\"":"","To exit command line mode, press ESCAPE":"","For the complete list of available keyboard shortcuts, type `help shortcuts`":"","Imports an Evernote notebook file (.enex file).":"","Do not ask for confirmation.":"","File \"%s\" will be imported into existing notebook \"%s\". Continue?":"","New notebook \"%s\" will be created and file \"%s\" will be imported into it. Continue?":"","Found: %d.":"","Created: %d.":"","Updated: %d.":"","Skipped: %d.":"","Resources: %d.":"","Tagged: %d.":"","Importing notes...":"","The notes have been imported: %s":"","Displays the notes in the current notebook. Use `ls /` to display the list of notebooks.":"","Displays only the first top <num> notes.":"","Sorts the item by <field> (eg. title, updated_time, created_time).":"","Reverses the sorting order.":"","Displays only the items of the specific type(s). Can be `n` for notes, `t` for to-dos, or `nt` for notes and to-dos (eg. `-tt` would display only the to-dos, while `-ttd` would display notes and to-dos.":"","Either \"text\" or \"json\"":"","Use long list format. Format is ID, NOTE_COUNT (for notebook), DATE, TODO_CHECKED (for to-dos), TITLE":"","Please select a notebook first.":"","Creates a new notebook.":"","Creates a new note.":"","Notes can only be created within a notebook.":"","Creates a new to-do.":"","Moves the notes matching <note> to [notebook].":"","Renames the given <item> (note or notebook) to <name>.":"","Deletes the given notebook.":"","Deletes the notebook without asking for confirmation.":"","Delete notebook \"%s\"?":"","Deletes the notes matching <note-pattern>.":"","Deletes the notes without asking for confirmation.":"","%d notes match this pattern. Delete them?":"","Delete note?":"","Searches for the given <pattern> in all the notes.":"","Sets the property <name> of the given <note> to the given [value].":"","Displays summary about the notes and notebooks.":"","Synchronises with remote storage.":"","Sync to provided target (defaults to sync.target config value)":"","Synchronisation is already in progress.":"","Lock file is alLine truncated
|
||||
@@ -1 +1 @@
|
||||
{"Give focus to next pane":"Activer le volet suivant","Give focus to previous pane":"Activer le volet précédent","Enter command line mode":"Démarrer le mode de ligne de commande","Exit command line mode":"Sortir du mode de ligne de commande","Edit the selected note":"Éditer la note sélectionnée","Cancel the current command.":"Annuler la commande en cours.","Exit the application.":"Quitter le logiciel.","Delete the currently selected note or notebook.":"Supprimer la note ou carnet sélectionné.","To delete a tag, untag the associated notes.":"Pour supprimer une vignette, enlever là des notes associées.","Please select the note or notebook to be deleted first.":"Veuillez d'abord sélectionner un carnet.","Set a to-do as completed / not completed":"Marquer une tâches comme complétée / non-complétée","[t]oggle [c]onsole between maximized/minimized/hidden/visible.":"Maximiser, minimiser, cacher ou rendre visible la console.","Search":"Chercher","[t]oggle note [m]etadata.":"Afficher/Cacher les métadonnées des notes.","[M]ake a new [n]ote":"Créer une nouvelle note","[M]ake a new [t]odo":"Créer une nouvelle tâche","[M]ake a new note[b]ook":"Créer un nouveau carnet","Copy ([Y]ank) the [n]ote to a notebook.":"Copier la note dans un autre carnet.","Move the note to a notebook.":"Déplacer la note vers un carnet.","Press Ctrl+D or type \"exit\" to exit the application":"Appuyez sur Ctrl+D ou tapez \"exit\" pour sortir du logiciel","More than one item match \"%s\". Please narrow down your query.":"Plus d'un objet correspond à \"%s\". Veuillez préciser votre requête.","No notebook selected.":"Aucun carnet n'est sélectionné.","No notebook has been specified.":"Aucun carnet n'est spécifié.","Y":"O","n":"n","N":"N","y":"o","Cancelling background synchronisation... Please wait.":"Annulation de la synchronisation... Veuillez patienter.","The command \"%s\" is only available in GUI mode":"La commande \"%s\" est disponible uniquement en mode d'interface graphique","Missing required argument: %s":"Paramètre requis manquant : %s","%s: %s":"%s : %s","Your choice: ":"Votre choix : ","Invalid answer: %s":"Réponse invalide : %s","Attaches the given file to the note.":"Joindre le fichier fourni à la note.","Cannot find \"%s\".":"Impossible de trouver \"%s\".","Displays the given note.":"Affiche la note.","Displays the complete information about note.":"Affiche tous les détails de la note.","Gets or sets a config value. If [value] is not provided, it will show the value of [name]. If neither [name] nor [value] is provided, it will list the current configuration.":"Obtient ou modifie une valeur de configuration. Si la [valeur] n'est pas fournie, la valeur de [nom] est affichée. Si ni le [nom] ni la [valeur] ne sont fournis, la configuration complète est affichée.","Also displays unset and hidden config variables.":"Afficher également les variables cachées.","%s = %s (%s)":"%s = %s (%s)","%s = %s":"%s = %s","Duplicates the notes matching <note> to [notebook]. If no notebook is specified the note is duplicated in the current notebook.":"Copier les notes correspondant à <nom> vers [carnet]. Si aucun carnet n'est spécifié, la note est dupliquée sur place.","Marks a to-do as done.":"Marquer la tâche comme complétée.","Note is not a to-do: \"%s\"":"La note n'est pas une tâche : \"%s\"","Edit note.":"Éditer la note.","No text editor is defined. Please set it using `config editor <editor-path>`":"Aucun éditeur de texte n'est défini. Veuillez le définir en utilisant la commande `config editor <chemin-editeur>`","No active notebook.":"Aucun carnet actif.","Note does not exist: \"%s\". Create it?":"Cette note n'existe pas : \"%s\". La créer ?","Starting to edit note. Close the editor to get back to the prompt.":"Édition de la note en cours. Fermez l'éditeur de texte pour retourner à l'invite de commande.","Note has been saved.":"La note a été enregistrée.","Exits the application.":"Quitter le logiciel.","Exports Joplin data to the given directory. By default, it will export the complete database including notebooks, notes, tags and resources.":"Exporter les données de Joplin vers le dossier fourni. Par défaut, la base de donnée complète sera exportée, y compris les carnets, notes, tags et resources.","Exports only the given note.":"Exporter uniquement la note spécifiée.","Exports only the given notebook.":"Exporter uniquement le carnet spécifié.","Displays a geolocation URL for the note.":"Afficher l'URL de l'emplacement de la note.","Displays usage information.":"Affiche les informations d'utilisation.","Shortcuts are not available in CLI mode.":"Les raccourcis ne sont pas disponible en mode de ligne de commande.","Type `help [command]` for more information about a command.":"Tapez `help [command]` pour plus d'information sur une commande.","The possible commands are:":"Les commandes possibles sont :","In any command, a note or notebook can be refered to by title or ID, or using theLine truncated
|
||||
{"Give focus to next pane":"Activer le volet suivant","Give focus to previous pane":"Activer le volet précédent","Enter command line mode":"Démarrer le mode de ligne de commande","Exit command line mode":"Sortir du mode de ligne de commande","Edit the selected note":"Éditer la note sélectionnée","Cancel the current command.":"Annuler la commande en cours.","Exit the application.":"Quitter le logiciel.","Delete the currently selected note or notebook.":"Supprimer la note ou carnet sélectionné.","To delete a tag, untag the associated notes.":"Pour supprimer une vignette, enlever là des notes associées.","Please select the note or notebook to be deleted first.":"Veuillez d'abord sélectionner un carnet.","Set a to-do as completed / not completed":"Marquer une tâches comme complétée / non-complétée","[t]oggle [c]onsole between maximized/minimized/hidden/visible.":"Maximiser, minimiser, cacher ou rendre visible la console.","Search":"Chercher","[t]oggle note [m]etadata.":"Afficher/Cacher les métadonnées des notes.","[M]ake a new [n]ote":"Créer une nouvelle note","[M]ake a new [t]odo":"Créer une nouvelle tâche","[M]ake a new note[b]ook":"Créer un nouveau carnet","Copy ([Y]ank) the [n]ote to a notebook.":"Copier la note dans un autre carnet.","Move the note to a notebook.":"Déplacer la note vers un carnet.","Press Ctrl+D or type \"exit\" to exit the application":"Appuyez sur Ctrl+D ou tapez \"exit\" pour sortir du logiciel","More than one item match \"%s\". Please narrow down your query.":"Plus d'un objet correspond à \"%s\". Veuillez préciser votre requête.","No notebook selected.":"Aucun carnet n'est sélectionné.","No notebook has been specified.":"Aucun carnet n'est spécifié.","Y":"O","n":"n","N":"N","y":"o","Cancelling background synchronisation... Please wait.":"Annulation de la synchronisation... Veuillez patienter.","The command \"%s\" is only available in GUI mode":"La commande \"%s\" est disponible uniquement en mode d'interface graphique","Missing required argument: %s":"Paramètre requis manquant : %s","%s: %s":"%s : %s","Your choice: ":"Votre choix : ","Invalid answer: %s":"Réponse invalide : %s","Attaches the given file to the note.":"Joindre le fichier fourni à la note.","Cannot find \"%s\".":"Impossible de trouver \"%s\".","Displays the given note.":"Affiche la note.","Displays the complete information about note.":"Affiche tous les détails de la note.","Gets or sets a config value. If [value] is not provided, it will show the value of [name]. If neither [name] nor [value] is provided, it will list the current configuration.":"Obtient ou modifie une valeur de configuration. Si la [valeur] n'est pas fournie, la valeur de [nom] est affichée. Si ni le [nom] ni la [valeur] ne sont fournis, la configuration complète est affichée.","Also displays unset and hidden config variables.":"Afficher également les variables cachées.","%s = %s (%s)":"%s = %s (%s)","%s = %s":"%s = %s","Duplicates the notes matching <note> to [notebook]. If no notebook is specified the note is duplicated in the current notebook.":"Copier les notes correspondant à <nom> vers [carnet]. Si aucun carnet n'est spécifié, la note est dupliquée sur place.","Marks a to-do as done.":"Marquer la tâche comme complétée.","Note is not a to-do: \"%s\"":"La note n'est pas une tâche : \"%s\"","Edit note.":"Éditer la note.","No text editor is defined. Please set it using `config editor <editor-path>`":"Aucun éditeur de texte n'est défini. Veuillez le définir en utilisant la commande `config editor <chemin-editeur>`","No active notebook.":"Aucun carnet actif.","Note does not exist: \"%s\". Create it?":"Cette note n'existe pas : \"%s\". La créer ?","Starting to edit note. Close the editor to get back to the prompt.":"Édition de la note en cours. Fermez l'éditeur de texte pour retourner à l'invite de commande.","Note has been saved.":"La note a été enregistrée.","Exits the application.":"Quitter le logiciel.","Exports Joplin data to the given directory. By default, it will export the complete database including notebooks, notes, tags and resources.":"Exporter les données de Joplin vers le dossier fourni. Par défaut, la base de donnée complète sera exportée, y compris les carnets, notes, tags et resources.","Exports only the given note.":"Exporter uniquement la note spécifiée.","Exports only the given notebook.":"Exporter uniquement le carnet spécifié.","Displays a geolocation URL for the note.":"Afficher l'URL de l'emplacement de la note.","Displays usage information.":"Affiche les informations d'utilisation.","Shortcuts are not available in CLI mode.":"Les raccourcis ne sont pas disponible en mode de ligne de commande.","Type `help [command]` for more information about a command.":"Tapez `help [command]` pour plus d'information sur une commande.","The possible commands are:":"Les commandes possibles sont :","In any command, a note or notebook can be refered to by title or ID, or using theLine truncated
|
||||
Reference in new issue
Block a user