Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configure path prefix for the API server #558

Closed
tnajdek opened this issue Aug 13, 2024 · 8 comments
Closed

Configure path prefix for the API server #558

tnajdek opened this issue Aug 13, 2024 · 8 comments

Comments

@tnajdek
Copy link
Member

tnajdek commented Aug 13, 2024

(I've split this from another issue, as it pertains to configuring the API server and not the web library's routing.)

Dear @glorieux-f and @tnajdek,

I run into a similar problem: the current zotero-webapp implementation allows to configure the apiAuthorityPart in index.html, like below. But how is it possible to change the API path of the API server ? So, e.g., in the case of @glorieux-f ,
how would I set https://www.unige.ch/piaget/api/ as the route to the zotero API endpoint ?
(We do not want to set up a second domain, just for the zotero server).

Thanks and merci !

<script type="application/json" id="zotero-web-library-config">
		{
			"userSlug": "zotero-user",
			"userId": "475425",
			"apiConfig": {
				"apiAuthorityPart": "api.zotero.org"
			},
			"libraries": {
				"include": [
					{
						"key": "g729",
						"name": "All Things Zotero",
						"isGroupLibrary": true
					}
				],
				"includeMyLibrary": true,
				"includeUserGroups": false
			}
		}
	</script>

Originally posted by @markdoerr in #534 (comment)

@markdoerr
Copy link

@tnajdek,
thanks for opening a new issue 👍 - I hope it can be easily solved :)

@tnajdek
Copy link
Member Author

tnajdek commented Aug 13, 2024

So basically apiConfig is passed to zotero-api-client and eventually used here and here.

It should be trivial to add support for apiPathPrefix or something along these lines.

@markdoerr
Copy link

Thanks, @tnajdek, for pointing at the positions in the code. Yes, indeed it would be trivial to add this extra option here, like, e.g. :

const url = https://${options.apiAuthorityPart}/${path}${query};

-> const url = https://${options.apiAuthorityPart}/${options.apiPathPrefix}${query};

Will you do this please ? (I am heading for holidays tomorrow, so I would only have time to make a PR in September :( )

@markdoerr
Copy link

or better (?) :
const url = https://${options.apiAuthorityPart}/${options.apiPathPrefix}${path}${query};

tnajdek added a commit to tnajdek/zotero-api-client that referenced this issue Aug 30, 2024
@markdoerr
Copy link

Thanx, @tnajdek,
for adding this small, but important feature :) - I will test it in the next days ...

@tnajdek
Copy link
Member Author

tnajdek commented Sep 2, 2024

Please note that this feature is currently only available in the underlying zotero-api-client dependency and is not yet included in the web library. To use it, you will need to update the dependency locally in your build. I will update the web library before the next release.

@markdoerr
Copy link

Thanks for the hint, Tom (I guessed so ;) - looking also forward to the next release....

@tnajdek
Copy link
Member Author

tnajdek commented Sep 28, 2024

Resolved in 2553365

@tnajdek tnajdek closed this as completed Sep 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants