mirror of
https://github.com/zadam/trilium.git
synced 2025-11-02 11:26:15 +01:00
we now remember past source ids so app restart won't change anything in sync operation
This commit is contained in:
@@ -1,8 +1,27 @@
|
||||
const utils = require('./utils');
|
||||
const log = require('./log');
|
||||
const sql = require('./sql');
|
||||
|
||||
const sourceId = utils.randomString(16);
|
||||
const currentSourceId = utils.randomString(12);
|
||||
|
||||
log.info("Using sourceId=" + sourceId);
|
||||
log.info("Using sourceId=" + currentSourceId);
|
||||
|
||||
module.exports = sourceId;
|
||||
let allSourceIds = [];
|
||||
|
||||
sql.dbReady.then(async () => {
|
||||
sql.insert("source_ids", {
|
||||
source_id: currentSourceId,
|
||||
date_created: utils.nowTimestamp()
|
||||
});
|
||||
|
||||
allSourceIds = await sql.getFlattenedResults("source_id", "SELECT source_id FROM source_ids");
|
||||
});
|
||||
|
||||
function isLocalSourceId(srcId) {
|
||||
return allSourceIds.includes(srcId);
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
currentSourceId,
|
||||
isLocalSourceId
|
||||
};
|
||||
Reference in New Issue
Block a user