// KEEP THIS FILE DEPENDENCIES FREE! const init: RequestInit = { credentials: 'same-origin', headers: new Headers({ Accept: 'application/json', }), } export async function checkForUpdates(): Promise { const response = await fetch(`${blessing.base_url}/admin/update/check`, init) if (response.ok) { const data = await response.json() const el = document.querySelector(`[href="${blessing.base_url}/admin/update"] p`) if (data.available && el) { el.innerHTML += 'New' } } } export async function checkForPluginUpdates(): Promise { const response = await fetch(`${blessing.base_url}/admin/plugins/market/check`, init) if (response.ok) { const data = await response.json() const el = document.querySelector(`[href="${blessing.base_url}/admin/plugins/market"] p`) if (data.available && el) { const length = data.plugins.length as number el.innerHTML += `${length}` } } } // istanbul ignore next if (process.env.NODE_ENV !== 'test') { checkForUpdates() checkForPluginUpdates() }