Forbid external media by default

This commit is contained in:
Cohee 2024-04-20 01:11:37 +03:00
parent a3f6ce52e4
commit 3ff5884112
4 changed files with 12 additions and 11 deletions

View File

@ -194,7 +194,8 @@
"encode_tags": false,
"enableLabMode": false,
"enableZenSliders": false,
"ui_mode": 1
"ui_mode": 1,
"forbid_external_media": true
},
"extension_settings": {
"apiUrl": "http://localhost:5100",

View File

@ -3944,8 +3944,8 @@
<span class="fa-solid fa-circle-question note-link-span"></span>
</a>
</label>
<label class="checkbox_label" for="forbid_external_images" title="Disalow embedded media from other domains in chat messages." data-i18n="[title]Disalow embedded media from other domains in chat messages">
<input id="forbid_external_images" type="checkbox" />
<label class="checkbox_label" for="forbid_external_media" title="Disalow embedded media from other domains in chat messages." data-i18n="[title]Disalow embedded media from other domains in chat messages">
<input id="forbid_external_media" type="checkbox" />
<span data-i18n="Forbid External Media">Forbid External Media</span>
</label>
<label data-newbie-hidden class="checkbox_label" for="allow_name2_display">

View File

@ -458,8 +458,8 @@ async function openExternalMediaOverridesDialog() {
}
const template = $('#forbid_media_override_template > .forbid_media_override').clone();
template.find('.forbid_media_global_state_forbidden').toggle(power_user.forbid_external_images);
template.find('.forbid_media_global_state_allowed').toggle(!power_user.forbid_external_images);
template.find('.forbid_media_global_state_forbidden').toggle(power_user.forbid_external_media);
template.find('.forbid_media_global_state_allowed').toggle(!power_user.forbid_external_media);
if (power_user.external_media_allowed_overrides.includes(entityId)) {
template.find('#forbid_media_override_allowed').prop('checked', true);
@ -485,7 +485,7 @@ export function getCurrentEntityId() {
export function isExternalMediaAllowed() {
const entityId = getCurrentEntityId();
if (!entityId) {
return !power_user.forbid_external_images;
return !power_user.forbid_external_media;
}
if (power_user.external_media_allowed_overrides.includes(entityId)) {
@ -496,7 +496,7 @@ export function isExternalMediaAllowed() {
return false;
}
return !power_user.forbid_external_images;
return !power_user.forbid_external_media;
}
function enlargeMessageImage() {

View File

@ -255,7 +255,7 @@ let power_user = {
compact_input_area: true,
auto_connect: false,
auto_load_chat: false,
forbid_external_images: false,
forbid_external_media: true,
external_media_allowed_overrides: [],
external_media_forbidden_overrides: [],
};
@ -1584,7 +1584,7 @@ function loadPowerUserSettings(settings, data) {
$('#reduced_motion').prop('checked', power_user.reduced_motion);
$('#auto-connect-checkbox').prop('checked', power_user.auto_connect);
$('#auto-load-chat-checkbox').prop('checked', power_user.auto_load_chat);
$('#forbid_external_images').prop('checked', power_user.forbid_external_images);
$('#forbid_external_media').prop('checked', power_user.forbid_external_media);
for (const theme of themes) {
const option = document.createElement('option');
@ -3471,8 +3471,8 @@ $(document).ready(() => {
saveSettingsDebounced();
});
$('#forbid_external_images').on('input', function () {
power_user.forbid_external_images = !!$(this).prop('checked');
$('#forbid_external_media').on('input', function () {
power_user.forbid_external_media = !!$(this).prop('checked');
saveSettingsDebounced();
reloadCurrentChat();
});