Merge branch 'staging' into qr-rewrite

This commit is contained in:
LenAnderson 2023-12-28 11:24:44 +00:00
commit 43d37b58db
2 changed files with 26 additions and 7 deletions

View File

@ -4130,6 +4130,7 @@ export async function sendMessageAsUser(messageText, messageBias, insertAt = nul
if (messageBias) {
message.extra.bias = messageBias;
message.mes = removeMacros(message.mes);
}
await populateFileAttachment(message);

View File

@ -18,6 +18,8 @@ const defaultUrl = 'http://localhost:5100';
let saveMetadataTimeout = null;
let requiresReload = false;
export function saveMetadataDebounced() {
const context = getContext();
const groupId = context.groupId;
@ -193,24 +195,32 @@ async function discoverExtensions() {
function onDisableExtensionClick() {
const name = $(this).data('name');
disableExtension(name);
disableExtension(name, false);
}
function onEnableExtensionClick() {
const name = $(this).data('name');
enableExtension(name);
enableExtension(name, false);
}
async function enableExtension(name) {
async function enableExtension(name, reload = true) {
extension_settings.disabledExtensions = extension_settings.disabledExtensions.filter(x => x !== name);
await saveSettings();
if (reload) {
location.reload();
} else {
requiresReload = true;
}
}
async function disableExtension(name) {
async function disableExtension(name, reload = true) {
extension_settings.disabledExtensions.push(name);
await saveSettings();
if (reload) {
location.reload();
} else {
requiresReload = true;
}
}
async function getManifests(names) {
@ -560,6 +570,7 @@ function getModuleInformation() {
* Generates the HTML strings for all extensions and displays them in a popup.
*/
async function showExtensionsDetails() {
let popupPromise;
try {
showLoader();
let htmlDefault = '<h3>Built-in Extensions:</h3>';
@ -590,13 +601,20 @@ async function showExtensionsDetails() {
${htmlDefault}
${htmlExternal}
`;
callPopup(`<div class="extensions_info">${html}</div>`, 'text');
popupPromise = callPopup(`<div class="extensions_info">${html}</div>`, 'text');
} catch (error) {
toastr.error('Error loading extensions. See browser console for details.');
console.error(error);
} finally {
hideLoader();
}
if (popupPromise) {
await popupPromise;
}
if (requiresReload) {
showLoader();
location.reload();
}
}