Skip to content

Commit 6ab237b

Browse files
author
Jannes Magnusson
committed
include zotero local api
1 parent ffd0179 commit 6ab237b

File tree

7 files changed

+1845
-1479
lines changed

7 files changed

+1845
-1479
lines changed

GENERATOR_DOC.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ This documentation describes how to create a plugin, and how to work with the pl
77
First, install [Yeoman](http://yeoman.io) and generator-joplin using [npm](https://www.npmjs.com/) (we assume you have pre-installed [node.js](https://nodejs.org/)).
88

99
```bash
10-
npm install -g yo
10+
npm install -g yo@4.3.1
1111
npm install -g generator-joplin
1212
```
1313

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ Conntect Zotero with Joplin to reference sources in notes and open them via `zot
44

55
## Installation
66

7+
### Zotero >= 7
8+
9+
Just install this plugin.
10+
11+
### Zotero <= 6
12+
713
1. Install [ZotServer](https://github.com/MunGell/ZotServer) in Zotero
814
2. Install this plugin
915

@@ -12,4 +18,3 @@ Conntect Zotero with Joplin to reference sources in notes and open them via `zot
1218
1. Open a note and enter `z@`
1319
2. Search for your reference
1420
3. Select it
15-

package-lock.json

Lines changed: 1824 additions & 1468 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "joplin-plugin-zotero-link",
3-
"version": "1.0.2",
3+
"version": "1.1.0",
44
"scripts": {
55
"dist": "webpack --env joplin-plugin-config=buildMain && webpack --env joplin-plugin-config=buildExtraScripts && webpack --env joplin-plugin-config=createArchive",
66
"prepare": "npm run dist",
@@ -30,4 +30,4 @@
3030
"dependencies": {
3131
"@types/codemirror": "^5.60.15"
3232
}
33-
}
33+
}

src/manifest.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"manifest_version": 1,
33
"id": "nz.magnusso.zotero-link",
44
"app_min_version": "2.12",
5-
"version": "1.0.2",
5+
"version": "1.1.0",
66
"name": "Zotero Link",
77
"description": "Link Zotero entries in notes",
88
"author": "Jannes Magnusson",
@@ -12,4 +12,4 @@
1212
"categories": [],
1313
"screenshots": [],
1414
"icons": {}
15-
}
15+
}

src/zotero-query.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ export class ZoteroQuery {
9292
try {
9393
const query = new URLSearchParams({
9494
itemType: '-attachment',
95-
q: query
95+
q: ''
9696
}).toString();
9797

9898
const res = await fetch(`http://localhost:23119/api/user/0/items?${query}`, {

webpack.config.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,19 +93,24 @@ function validateCategories(categories) {
9393

9494
function validateScreenshots(screenshots) {
9595
if (!screenshots) return null;
96-
// eslint-disable-next-line github/array-foreach -- Old code before rule was applied
97-
screenshots.forEach(screenshot => {
96+
for (const screenshot of screenshots) {
9897
if (!screenshot.src) throw new Error('You must specify a src for each screenshot');
9998

99+
// Avoid attempting to download and verify URL screenshots.
100+
if (screenshot.src.startsWith('https://') || screenshot.src.startsWith('http://')) {
101+
continue;
102+
}
103+
100104
const screenshotType = screenshot.src.split('.').pop();
101105
if (!allPossibleScreenshotsType.includes(screenshotType)) throw new Error(`${screenshotType} is not a valid screenshot type. Valid types are: \n${allPossibleScreenshotsType}\n`);
102106

103-
const screenshotPath = path.resolve(srcDir, screenshot.src);
107+
const screenshotPath = path.resolve(rootDir, screenshot.src);
108+
104109
// Max file size is 1MB
105110
const fileMaxSize = 1024;
106111
const fileSize = fs.statSync(screenshotPath).size / 1024;
107112
if (fileSize > fileMaxSize) throw new Error(`Max screenshot file size is ${fileMaxSize}KB. ${screenshotPath} is ${fileSize}KB`);
108-
});
113+
}
109114
}
110115

111116
function readManifest(manifestPath) {

0 commit comments

Comments
 (0)