diff --git a/src/boot/after_store.js b/src/boot/after_store.js index 6a94f491..86c9d940 100644 --- a/src/boot/after_store.js +++ b/src/boot/after_store.js @@ -283,6 +283,7 @@ const getNodeInfo = async ({ store }) => { store.dispatch('setInstanceOption', { name: 'translationEnabled', value: features.includes('akkoma:machine_translation') }) store.dispatch('setInstanceOption', { name: 'searchTypeMediaEnabled', value: features.includes('bnakkoma:search_type_media') }) store.dispatch('setInstanceOption', { name: 'searchOptionFollowingEnabled', value: features.includes('bnakkoma:search_option_following') }) + store.dispatch('setInstanceOption', { name: 'opensearchProtocolSupported', value: features.includes('bnakkoma:opensearch_protocol') }) const uploadLimits = metadata.uploadLimits store.dispatch('setInstanceOption', { name: 'uploadlimit', value: parseInt(uploadLimits.general) }) @@ -406,6 +407,16 @@ const afterStoreSetup = async ({ store, i18n }) => { getTOS({ store }) getStickers({ store }) + // Create a link tag for OpenSearch and forget about it + if (store.state.instance.opensearchProtocolSupported) { + const node = document.createElement('link') + node.setAttribute('rel', 'search') + node.setAttribute('type', 'application/opensearchdescription+xml') + node.setAttribute('href', '/opensearch.xml') + node.setAttribute('title', store.state.instance.name) + document.head.appendChild(node) + } + const router = createRouter({ history: createWebHistory(), routes: routes(store),