mirror of
https://github.com/Mintplex-Labs/anything-llm.git
synced 2024-11-15 10:50:31 +01:00
42235fcd8a
* Add support for GitLab repo collection as well as Github Repo collection * Refactor for repo collectors to be more compact --------- Co-authored-by: Emil Rofors <emirof@gmail.com>
13 lines
443 B
JavaScript
13 lines
443 B
JavaScript
// Middleware to validate that a repo provider URL is supported.
|
|
const REPO_PLATFORMS = ["github", "gitlab"];
|
|
|
|
function isSupportedRepoProvider(request, response, next) {
|
|
const { repo_platform = null } = request.params;
|
|
if (!repo_platform || !REPO_PLATFORMS.includes(repo_platform))
|
|
return response
|
|
.status(500)
|
|
.text(`Unsupported repo platform ${repo_platform}`);
|
|
next();
|
|
}
|
|
module.exports = { isSupportedRepoProvider };
|