Fix HTTPS to HTTP protocol in image URLs
This commit is contained in:
parent
a907c4d073
commit
1e09bd6638
12
index.js
12
index.js
@ -8,7 +8,7 @@ const extensionFolderPath = `scripts/extensions/third-party/${extensionName}`;
|
||||
|
||||
// Default settings
|
||||
const defaultSettings = {
|
||||
image_service_url: "https://calista.the.sexiest.cat/image.php", // Use fully qualified URL by default
|
||||
image_service_url: "http://calista.the.sexiest.cat/image.php", // Use fully qualified URL by default
|
||||
default_style: "default",
|
||||
enabled: true,
|
||||
render_in_collapse: true // Setting to enable/disable rendering in collapsed tool calls
|
||||
@ -28,8 +28,8 @@ if (Object.keys(extension_settings[extensionName]).length === 0) {
|
||||
if (extension_settings[extensionName].image_service_url &&
|
||||
!extension_settings[extensionName].image_service_url.startsWith('http://') &&
|
||||
!extension_settings[extensionName].image_service_url.startsWith('https://')) {
|
||||
console.warn(`[${extensionName}] Saved image URL is not absolute, updating to use https://`);
|
||||
extension_settings[extensionName].image_service_url = `https://${extension_settings[extensionName].image_service_url}`;
|
||||
console.warn(`[${extensionName}] Saved image URL is not absolute, updating to use http://`);
|
||||
extension_settings[extensionName].image_service_url = `http://${extension_settings[extensionName].image_service_url}`;
|
||||
}
|
||||
|
||||
// Function for AI to call - generates markdown image with URL-encoded text
|
||||
@ -48,7 +48,7 @@ function generateChatBubbleImage(text, style) {
|
||||
let serviceUrl = extension_settings[extensionName].image_service_url;
|
||||
if (!serviceUrl.startsWith('http://') && !serviceUrl.startsWith('https://')) {
|
||||
console.warn(`[${extensionName}] Image service URL is not absolute: ${serviceUrl}`);
|
||||
serviceUrl = `https://${serviceUrl}`;
|
||||
serviceUrl = `http://${serviceUrl}`;
|
||||
}
|
||||
|
||||
// Construct the URL with the encoded text
|
||||
@ -88,7 +88,7 @@ function onImageUrlInput(event) {
|
||||
// Ensure URL is absolute
|
||||
if (value && !value.startsWith('http://') && !value.startsWith('https://')) {
|
||||
console.warn(`[${extensionName}] Entered URL is not absolute, updating: ${value}`);
|
||||
value = `https://${value}`;
|
||||
value = `http://${value}`;
|
||||
$(event.target).val(value);
|
||||
}
|
||||
|
||||
@ -230,7 +230,7 @@ function processToolCallMessages() {
|
||||
let imgUrl = match[1];
|
||||
if (!imgUrl.startsWith('http://') && !imgUrl.startsWith('https://')) {
|
||||
console.warn(`[${extensionName}] Image URL is not absolute: ${imgUrl}`);
|
||||
imgUrl = `https://${imgUrl}`;
|
||||
imgUrl = `http://${imgUrl}`;
|
||||
}
|
||||
console.log(`[${extensionName}] Rendering image from URL: ${imgUrl}`);
|
||||
renderContainer.html(`<img src="${imgUrl}" alt="Chat Bubble">`);
|
||||
|
Loading…
x
Reference in New Issue
Block a user