diff options
| author | Hazelnoot <acomputerdog@gmail.com> | 2025-02-21 22:04:36 -0500 |
|---|---|---|
| committer | Hazelnoot <acomputerdog@gmail.com> | 2025-03-16 10:07:57 -0400 |
| commit | a35c2f214b1b1054229f31569f6df4090a7375a5 (patch) | |
| tree | a9e8c42026eeb6a4dcd0e582eefe506943afa0a5 /packages/frontend/src | |
| parent | merge: fetch linked notes manually, unless we have them in DB - fixes 1006 (!... (diff) | |
| download | sharkey-a35c2f214b1b1054229f31569f6df4090a7375a5.tar.gz sharkey-a35c2f214b1b1054229f31569f6df4090a7375a5.tar.bz2 sharkey-a35c2f214b1b1054229f31569f6df4090a7375a5.zip | |
convert Authorized Fetch to a setting and add support for hybrid mode (essential metadata only)
Diffstat (limited to 'packages/frontend/src')
| -rw-r--r-- | packages/frontend/src/pages/admin/index.vue | 7 | ||||
| -rw-r--r-- | packages/frontend/src/pages/admin/security.vue | 25 | ||||
| -rw-r--r-- | packages/frontend/src/pages/settings/privacy.vue | 23 |
3 files changed, 55 insertions, 0 deletions
diff --git a/packages/frontend/src/pages/admin/index.vue b/packages/frontend/src/pages/admin/index.vue index cbd0d12dcc..3a95e0a5a6 100644 --- a/packages/frontend/src/pages/admin/index.vue +++ b/packages/frontend/src/pages/admin/index.vue @@ -19,6 +19,7 @@ SPDX-License-Identifier: AGPL-3.0-only <MkInfo v-if="noBotProtection" warn class="info">{{ i18n.ts.noBotProtectionWarning }} <MkA to="/admin/security" class="_link">{{ i18n.ts.configure }}</MkA></MkInfo> <MkInfo v-if="noEmailServer" warn class="info">{{ i18n.ts.noEmailServerWarning }} <MkA to="/admin/email-settings" class="_link">{{ i18n.ts.configure }}</MkA></MkInfo> <MkInfo v-if="pendingUserApprovals" warn class="info">{{ i18n.ts.pendingUserApprovals }} <MkA to="/admin/approvals" class="_link">{{ i18n.ts.check }}</MkA></MkInfo> + <MkInfo v-if="hasLegacyAuthFetchSetting" warn class="info">{{ i18n.ts.authorizedFetchLegacyWarning }}</MkInfo> </div> <MkSuperMenu :def="menuDef" :grid="narrow"></MkSuperMenu> @@ -69,6 +70,7 @@ const noEmailServer = computed(() => !instance.enableEmail); const noInquiryUrl = computed(() => isEmpty(instance.inquiryUrl)); const thereIsUnresolvedAbuseReport = ref(false); const pendingUserApprovals = ref(false); +const hasLegacyAuthFetchSetting = ref(false); const currentPage = computed(() => router.currentRef.value.child); misskeyApi('admin/abuse-user-reports', { @@ -86,6 +88,11 @@ misskeyApi('admin/show-users', { if (approvals.length > 0) pendingUserApprovals.value = true; }); +misskeyApi('admin/meta') + .then(meta => { + hasLegacyAuthFetchSetting.value = meta.hasLegacyAuthFetchSetting; + }); + const NARROW_THRESHOLD = 600; const ro = new ResizeObserver((entries, observer) => { if (entries.length === 0) return; diff --git a/packages/frontend/src/pages/admin/security.vue b/packages/frontend/src/pages/admin/security.vue index 4358821092..38986dc977 100644 --- a/packages/frontend/src/pages/admin/security.vue +++ b/packages/frontend/src/pages/admin/security.vue @@ -8,6 +8,22 @@ SPDX-License-Identifier: AGPL-3.0-only <template #header><XHeader :actions="headerActions" :tabs="headerTabs"/></template> <MkSpacer :contentMax="700" :marginMin="16" :marginMax="32"> <div class="_gaps_m"> + <MkFolder v-if="meta.federation !== 'none'"> + <template #label>{{ i18n.ts.authorizedFetchSection }}</template> + <template #suffix>{{ meta.allowUnsignedFetch !== 'always' ? i18n.ts.enabled : i18n.ts.disabled }}</template> + <template v-if="authFetchForm.modified.value" #footer> + <MkFormFooter :form="authFetchForm"/> + </template> + + <MkRadios v-model="authFetchForm.state.allowUnsignedFetch"> + <template #label>{{ i18n.ts.authorizedFetchLabel }}</template> + <template #caption>{{ i18n.ts.authorizedFetchDescription }}</template> + <option value="never">{{ i18n.ts._authorizedFetchValue.never }} - {{ i18n.ts._authorizedFetchValueDescription.never }}</option> + <option value="always">{{ i18n.ts._authorizedFetchValue.always }} - {{ i18n.ts._authorizedFetchValueDescription.always }}</option> + <option value="essential">{{ i18n.ts._authorizedFetchValue.essential }} - {{ i18n.ts._authorizedFetchValueDescription.essential }}</option> + </MkRadios> + </MkFolder> + <XBotProtection/> <MkFolder> @@ -96,6 +112,15 @@ import MkFormFooter from '@/components/MkFormFooter.vue'; const meta = await misskeyApi('admin/meta'); +const authFetchForm = useForm({ + allowUnsignedFetch: meta.allowUnsignedFetch, +}, async state => { + await os.apiWithDialog('admin/update-meta', { + allowUnsignedFetch: state.allowUnsignedFetch, + }); + fetchInstance(true); +}); + const ipLoggingForm = useForm({ enableIpLogging: meta.enableIpLogging, }, async (state) => { diff --git a/packages/frontend/src/pages/settings/privacy.vue b/packages/frontend/src/pages/settings/privacy.vue index 0b8e89a6a5..bcedb8b139 100644 --- a/packages/frontend/src/pages/settings/privacy.vue +++ b/packages/frontend/src/pages/settings/privacy.vue @@ -132,6 +132,20 @@ SPDX-License-Identifier: AGPL-3.0-only <div v-if="instance.federation !== 'none'"><i class="ti ti-alert-triangle" style="color: var(--MI_THEME-warn);"></i> {{ i18n.ts._accountSettings.mayNotEffectForFederatedNotes }}</div> </template> </FormSlot> + + <MkFolder v-if="instance.federation !== 'none'"> + <template #label>{{ i18n.ts.authorizedFetchSection }}</template> + <template #suffix>{{ computedAllowUnsignedFetch !== 'always' ? i18n.ts.enabled : i18n.ts.disabled }}</template> + + <MkRadios v-model="allowUnsignedFetch" @update:modelValue="save()"> + <template #label>{{ i18n.ts.authorizedFetchLabel }}</template> + <template #caption>{{ i18n.ts.authorizedFetchDescription }}</template> + <option value="never">{{ i18n.ts._authorizedFetchValue.never }} - {{ i18n.ts._authorizedFetchValueDescription.never }}</option> + <option value="always">{{ i18n.ts._authorizedFetchValue.always }} - {{ i18n.ts._authorizedFetchValueDescription.always }}</option> + <option value="essential">{{ i18n.ts._authorizedFetchValue.essential }} - {{ i18n.ts._authorizedFetchValueDescription.essential }}</option> + <option value="staff">{{ i18n.ts._authorizedFetchValue.staff }} - {{ i18n.tsx._authorizedFetchValueDescription.staff({ value: i18n.ts._authorizedFetchValue[instance.allowUnsignedFetch] }) }}</option> + </MkRadios> + </MkFolder> </div> </FormSection> @@ -192,6 +206,7 @@ import FormSlot from '@/components/form/slot.vue'; import { formatDateTimeString } from '@/scripts/format-time-string.js'; import MkInput from '@/components/MkInput.vue'; import * as os from '@/os.js'; +import MkRadios from '@/components/MkRadios.vue'; const $i = signinRequired(); @@ -210,6 +225,13 @@ const followingVisibility = ref($i.followingVisibility); const followersVisibility = ref($i.followersVisibility); const defaultCW = ref($i.defaultCW); const defaultCWPriority = ref($i.defaultCWPriority); +const allowUnsignedFetch = ref($i.allowUnsignedFetch); +const computedAllowUnsignedFetch = computed(() => { + if (allowUnsignedFetch.value !== 'staff') { + return allowUnsignedFetch.value; + } + return instance.allowUnsignedFetch; +}); const defaultNoteVisibility = computed(defaultStore.makeGetterSetter('defaultNoteVisibility')); const defaultNoteLocalOnly = computed(defaultStore.makeGetterSetter('defaultNoteLocalOnly')); @@ -270,6 +292,7 @@ function save() { followersVisibility: followersVisibility.value, defaultCWPriority: defaultCWPriority.value, defaultCW: defaultCW.value, + allowUnsignedFetch: allowUnsignedFetch.value, }); } |