mirror of
https://github.com/Mintplex-Labs/anything-llm
synced 2026-04-26 01:25:15 +02:00
* Implement DrupalWiki collector * Add attachment downloading and processing functionality (#3) * linting * Linting Add citation image small refactors add URL for citation identifier --------- Co-authored-by: em <eugen.mayer@kontextwork.de> Co-authored-by: rexjohannes <53578137+rexjohannes@users.noreply.github.com> Co-authored-by: Eugen Mayer <136934+EugenMayer@users.noreply.github.com>
36 lines
781 B
JavaScript
36 lines
781 B
JavaScript
process.env.NODE_ENV === "development"
|
|
? require("dotenv").config({ path: `.env.${process.env.NODE_ENV}` })
|
|
: require("dotenv").config();
|
|
|
|
function reqBody(request) {
|
|
return typeof request.body === "string"
|
|
? JSON.parse(request.body)
|
|
: request.body;
|
|
}
|
|
|
|
function queryParams(request) {
|
|
return request.query;
|
|
}
|
|
|
|
/**
|
|
* Validates if the provided baseUrl is a valid URL at all.
|
|
* - Does not validate if the URL is reachable or accessible.
|
|
* - Does not do any further validation of the URL like `validURL` in `utils/url/index.js`
|
|
* @param {string} baseUrl
|
|
* @returns {boolean}
|
|
*/
|
|
function validBaseUrl(baseUrl) {
|
|
try {
|
|
new URL(baseUrl);
|
|
return true;
|
|
} catch (e) {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
module.exports = {
|
|
reqBody,
|
|
queryParams,
|
|
validBaseUrl,
|
|
};
|