You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-11-26 22:41:17 +02:00
All: Prevent export of encrypted items
This commit is contained in:
@@ -45,6 +45,14 @@ class BaseModel {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static modelTypeToName(type) {
|
||||||
|
for (let i = 0; i < BaseModel.typeEnum_.length; i++) {
|
||||||
|
const e = BaseModel.typeEnum_[i];
|
||||||
|
if (e[1] === type) return e[0].substr(5).toLowerCase();
|
||||||
|
}
|
||||||
|
throw new Error('Unknown model type: ' + type);
|
||||||
|
}
|
||||||
|
|
||||||
static hasField(name) {
|
static hasField(name) {
|
||||||
let fields = this.fieldNames();
|
let fields = this.fieldNames();
|
||||||
return fields.indexOf(name) >= 0;
|
return fields.indexOf(name) >= 0;
|
||||||
@@ -487,15 +495,32 @@ class BaseModel {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BaseModel.TYPE_NOTE = 1;
|
BaseModel.typeEnum_ = [
|
||||||
BaseModel.TYPE_FOLDER = 2;
|
['TYPE_NOTE', 1],
|
||||||
BaseModel.TYPE_SETTING = 3;
|
['TYPE_FOLDER', 2],
|
||||||
BaseModel.TYPE_RESOURCE = 4;
|
['TYPE_SETTING', 3],
|
||||||
BaseModel.TYPE_TAG = 5;
|
['TYPE_RESOURCE', 4],
|
||||||
BaseModel.TYPE_NOTE_TAG = 6;
|
['TYPE_TAG', 5],
|
||||||
BaseModel.TYPE_SEARCH = 7;
|
['TYPE_NOTE_TAG', 6],
|
||||||
BaseModel.TYPE_ALARM = 8;
|
['TYPE_SEARCH', 7],
|
||||||
BaseModel.TYPE_MASTER_KEY = 9;
|
['TYPE_ALARM', 8],
|
||||||
|
['TYPE_MASTER_KEY', 9],
|
||||||
|
];
|
||||||
|
|
||||||
|
for (let i = 0; i < BaseModel.typeEnum_.length; i++) {
|
||||||
|
const e = BaseModel.typeEnum_[i];
|
||||||
|
BaseModel[e[0]] = e[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
// BaseModel.TYPE_NOTE = 1;
|
||||||
|
// BaseModel.TYPE_FOLDER = 2;
|
||||||
|
// BaseModel.TYPE_SETTING = 3;
|
||||||
|
// BaseModel.TYPE_RESOURCE = 4;
|
||||||
|
// BaseModel.TYPE_TAG = 5;
|
||||||
|
// BaseModel.TYPE_NOTE_TAG = 6;
|
||||||
|
// BaseModel.TYPE_SEARCH = 7;
|
||||||
|
// BaseModel.TYPE_ALARM = 8;
|
||||||
|
// BaseModel.TYPE_MASTER_KEY = 9;
|
||||||
|
|
||||||
BaseModel.db_ = null;
|
BaseModel.db_ = null;
|
||||||
BaseModel.dispatch = function(o) {};
|
BaseModel.dispatch = function(o) {};
|
||||||
|
|||||||
@@ -222,6 +222,8 @@ class InteropService {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (item.encryption_applied || item.encryption_blob_encrypted) throw new Error(_('This item is currently encrypted: %s "%s". Please wait for all items to be decrypted and try again.', BaseModel.modelTypeToName(itemType), item.title ? item.title : item.id));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (itemType == BaseModel.TYPE_RESOURCE) {
|
if (itemType == BaseModel.TYPE_RESOURCE) {
|
||||||
const resourcePath = Resource.fullPath(item);
|
const resourcePath = Resource.fullPath(item);
|
||||||
|
|||||||
Reference in New Issue
Block a user