Skip to content

Commit

Permalink
Fix issue that caused library version number to go stale
Browse files Browse the repository at this point in the history
  • Loading branch information
frthjf committed Sep 19, 2023
1 parent 8d26d48 commit e036161
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ return 'References/' + fp;

export default class ZoteroSyncClientPlugin extends Plugin {
settings: ZoteroSyncClientSettings;
store: Store;
store_directory: string | undefined;
client: ZoteroAPI;
last_sync: Date;
interval: number;
Expand All @@ -132,13 +132,9 @@ export default class ZoteroSyncClientPlugin extends Plugin {
this.addSettingTab(new ClientSettingTab(this.app, this));

// initialize the store which acts as a cache
this.store = new Store
const storeDirectory = this.getPluginPath("store")
if (storeDirectory && !fs.existsSync(storeDirectory)) {
fs.mkdirSync(storeDirectory);
}
if (storeDirectory) {
await this.store.load(storeDirectory)
this.store_directory = this.getPluginPath("store")
if (this.store_directory && !fs.existsSync(this.store_directory)) {
fs.mkdirSync(this.store_directory);
}

// initialize the API client
Expand Down Expand Up @@ -253,7 +249,13 @@ export default class ZoteroSyncClientPlugin extends Plugin {

async syncWithZotero() {
// retrieve latest updates from API and write to store
await this.client.sync(this.store)
await this.authenticate()

const store = new Store;
if (this.store_directory) {
await store.load(this.store_directory)
}
await this.client.sync(store)
}

async applyAllUpdates() {
Expand Down

0 comments on commit e036161

Please sign in to comment.