Skip to content

Conversation

AllanChain
Copy link
Member

Adapted from https://github.com/BYRIO/overleaf/

Description

Enable autocompletion of bibliography entries when typing \cite.

Screenshot

The open source version of Overleaf disables the reference autocompletion feature and removes a service called "references". (They didn't even change package-lock.json.) As demonstrated in the following figure, we only need to enable the arrow from web service to references service and implement the references service.

graph LR
    A[Frontend] -->|/indexAll| B(Web Service)
    B -->|/index| C(References Service)
Loading

Specifically, we need to add the following lines to config:

references: {
url: `http://${process.env.REFERENCES_HOST || 'localhost'}:3006`,
},

And then implement a new references service, which is basically copied from https://github.com/BYRIO/overleaf/. On change is that I replaced request module with Node.js built-in fetch, because request is not included in @overleaf/references module according to package-lock.json and I want to keep package-lock.json unchanged.

Related issues / Pull Requests

None

Additional notes

I have removed all irrelevant modifications in this PR. They are mostly dev-related ones. Therefore, if the code fails to run because of this, I can open another PR to update these modifications.

Files from https://github.com/BYRIO/overleaf/, especially BibParser.js, are not reviewed. We can review these files together.

@AllanChain AllanChain force-pushed the feat/references branch 4 times, most recently from 5d600dd to 3f92079 Compare November 7, 2024 09:28
@HolgerHuo
Copy link

Hi! To make this work, you need to change permission for the runinit script:

diff --git a/server-ce/runit/references-overleaf/run b/server-ce/runit/references-overleaf/run
old mode 100644
new mode 100755

I didn't figure out how to do it on my end (seems that i can only use a web-based editor to change text content of pr?), so I might need your help on this.

@HolgerHuo
Copy link

The rest of the code lgtm and works well.

@AllanChain
Copy link
Member Author

That's fine. I have changed the permission.

The option "Allow edits and access to secrets by maintainers" was enabled. I guess you can try GitHub CLI, run gh pr checkout 17, edit, and push?

@HolgerHuo
Copy link

Thank you! I will now merge this pr and deploy it.

I guess you can try GitHub CLI, run gh pr checkout 17, edit, and push?

You are right. I'm not currently using github cli, maybe give it a try some time.

@HolgerHuo HolgerHuo merged commit 9964aeb into lcpu-club:main Nov 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants