Fixed Vssue GitLab Integration¶
Updated: May 07, 2024
Vssue [1] is a comment system which uses GitLab [2] issues as comments. After I decided to use it. I faced one issue which very much become a blocker issue.
GitLab’s Redirect URL Limitation¶
Basically, GitLab’s Oauth2 redirect_url
will not allow any wildcard characters. So, you cannot use a redirect_url
like https://mohan43u.space/*, you have to provide full url like https://mohan43u.space/path/to/article.html. For static websites, this means, we have to add each and every article’s path into GitLab which is impossible. The author of Vssue
raised this issue [3] with GitLab
but due to security concerns, they are not going to fix this. Without fixing this issue, I cannot use Vssue
with my static site.
I was frustrated. I thought I should just forget about the comment system entirely, but somehow decided to see what actually happening inside Vssue
when OAuth2 takes place. Soon, I found that there is a parameter [4] in the Authorize call which we can utilize to wrap the current url. When the redirect takes place and response comes from GitLab, we check for this parameter
an then unwrap to see the original url which requested Oauth2. Thus, we can again do local redirect to that original url.
Pull Request for Vssue¶
Vssue
is written in Vue.js [5]. Without properly understanding how to create PR for Vssue
, I just added my fix and created a pull request. But my pull request failed in CI, then I came to know that I have to write proper test case for my change.
Writing Test case in Vssue¶
Vssue
uses jest [6] as its test framework. Since my pull request failed in CI, I have to write proper test case for my change. The actual fix is basically very simple, but writing test case become difficult for me. Every time I thought few test cases is enough, the code coverage in CI dont accept because not all code path was tested. So, I have to again and again write test cases to finally make CI succeed for my pull request.
My pull request [7] is still waiting for approval in Vssue but I’m already using it in my static website. People also tried my changes in their static websites and it seems it is working
To be continued..