Merge pull request #901 from 50h100a/mancer-urlfix

Relax URL requirements when Mancer is enabled.
This commit is contained in:
Cohee
2023-08-08 23:27:05 +03:00
committed by GitHub
2 changed files with 10 additions and 4 deletions

View File

@ -99,11 +99,17 @@ function selectPreset(name) {
saveSettingsDebounced();
}
function formatTextGenURL(value) {
function formatTextGenURL(value, use_mancer) {
try {
const url = new URL(value);
if (!power_user.relaxed_api_urls) {
url.pathname = '/api';
if (use_mancer) { // If Mancer is in use, only require the URL to *end* with `/api`.
if (!url.pathname.endsWith('/api')) {
return null;
}
} else {
url.pathname = '/api';
}
}
return url.toString();
} catch { } // Just using URL as a validation check