https://github.com/zotero/web-library
https://github.com/zotero/web-library
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/zotero/web-library
- Owner: zotero
- License: other
- Created: 2012-11-30T22:08:31.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2025-04-09T16:07:47.000Z (3 months ago)
- Last Synced: 2025-04-09T23:18:01.361Z (3 months ago)
- Language: JavaScript
- Size: 38.5 MB
- Stars: 152
- Watchers: 9
- Forks: 50
- Open Issues: 101
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: COPYING
Awesome Lists containing this project
README
[](https://github.com/zotero/web-library/actions/workflows/ci.yml)
Web Library
===========This is [zotero.org's Web Library](https://www.zotero.org/mylibrary) capable of being installed/run on other websites.
Web Library is a single-page application implemented in Javascript. It uses Zotero API via [CORS requests](http://enable-cors.org/) and requires [keys configured](https://www.zotero.org/settings/keys/new) in order to access private libraries.
Installation
------------1. Clone git repository into target web directory (`git clone --recursive https://github.com/zotero/web-library.git`)
2. Ensure up-to-date version of [Node](https://nodejs.org) is used. It should be possible to build Web Library with any recent version of Node, see `.nvmrc` for recommended version of Node (usually current LTS). On systems where [nvm](https://github.com/nvm-sh/nvm) is available it's possible to use `nvm install` and `nvm use` to install and switch to a preferred version of node.
3. Run `npm install` to install dependencies
4. Tweak configuration in `src/html/index.html` and/or `src/html/embedded.html`. Default configuration displays a public library in read-only mode. In order to edit a library, change `userId` and provide `apiKey`.
5. Run development proces: `npm start`
6. Point browser at `http://localhost:8001/` to see the demo
7. Modyfing source files will trigger incremental buildProduction-ready version can be built with `npm run build` and served with `npm run serve`.
Configuration
----------------------
The Web Library reads its configuration from a DOM node with the ID `zotero-web-library-config`. You can find an example configuration in `src/html/index.html`.To access private libraries, `userId` and `apiKey` must be provided. These can be obtained at https://www.zotero.org/settings/security#applications.
Alternatively, it's possible to configure the Web Library to display only specified public libraries. In this case, the `libraries` object must be populated, including a value for `defaultLibraryKey`, and with `includeMyLibrary` set to `false`.
Build targets
-------------
There are two build targets controlled by `TARGET` environment variable: `zotero` and `embedded`. Former produces a single-page app as seen on zotero.org, latter produces a web-library widget that can be embedded on other pages. Embedded build is currently considered experimental. It's also possible to build both variants using `TARGET` set to `all` (default behaviour).Build & Development options
-------------
The following environment variables are recognized:* `DEBUG` - if set to `1` extra info about produced bundle will be printed to the console. Increases build time.
* `EMBEDDED` - if set to `1` dev server will default to `src/html/embedded.html`, otherwise it will serve `src/html/index.html`.
* `LOCALE_CACHE_TIME` - advanced usage, see `scripts/fetch-locale.cjs`.
* `NODE_ENV` - used by build scripts to control various debug options. See `package.json`.
* `PORT` - port on which development server listens for incoming connections.
* `STYLES_CACHE_TIME` - advanced usage, see `scripts/build-styles-json.cjs`.
* `TARGET` - see **Build targets** above.
* `TRANSLATE_URL` - URL where to proxy translation requests.
* `USE_HTTPS` - if set to `1` dev server will use HTTPS. Requires certificates, see `scripts/server.cjs`.