|
|
@ -45,15 +45,17 @@ export function MetaPart(props: MetaPartProps) { |
|
|
|
|
|
|
|
|
|
|
|
const { error, value, loading } = useAsync(async () => { |
|
|
|
const { error, value, loading } = useAsync(async () => { |
|
|
|
const info = await extensionInfo(); |
|
|
|
const info = await extensionInfo(); |
|
|
|
const isAllowed = info?.success && isAllowedExtensionVersion(info.version); |
|
|
|
const isValidExtension = |
|
|
|
|
|
|
|
info?.success && isAllowedExtensionVersion(info.version); |
|
|
|
|
|
|
|
|
|
|
|
if (isAllowed) { |
|
|
|
if (isValidExtension) { |
|
|
|
if (!info.hasPermission) throw new Error("extension-no-permission"); |
|
|
|
if (!info.allowed || !info.hasPermission) |
|
|
|
|
|
|
|
throw new Error("extension-no-permission"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// use api metadata or providers metadata
|
|
|
|
// use api metadata or providers metadata
|
|
|
|
const providerApiUrl = getLoadbalancedProviderApiUrl(); |
|
|
|
const providerApiUrl = getLoadbalancedProviderApiUrl(); |
|
|
|
if (providerApiUrl && !isAllowed) { |
|
|
|
if (providerApiUrl && !isValidExtension) { |
|
|
|
try { |
|
|
|
try { |
|
|
|
await fetchMetadata(providerApiUrl); |
|
|
|
await fetchMetadata(providerApiUrl); |
|
|
|
} catch (err) { |
|
|
|
} catch (err) { |
|
|
|