PluginProbe
Extendify / 3.2.3
Extendify v3.2.3
3.2.3 3.2.2 3.2.1 3.2.0 3.1.6 3.1.5 3.1.4 3.1.3 3.1.2 3.1.1 3.1.0 3.0.6 3.0.5 3.0.4 trunk 0.1.0 0.10.0 0.10.1 0.10.2 0.11.0 0.11.1 0.2.0 0.3.0 0.3.1 0.4.0 All 129 releases
extendify / src / Agent / lib / redirects.js

redirects.js in Extendify 3.2.3, at src/Agent/lib/redirects.js

21 lines 617 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 const { pluginRecommendations = [] } = window?.extAgentData?.agentContext || {};
2 const { adminUrl, homeUrl } = window?.extSharedData || {};
3
4 export const getPluginSetup = (pluginSlug) => {
5 const plugin = pluginRecommendations.find(({ slug }) => slug === pluginSlug);
6 if (!plugin?.redirectTo) return null;
7 const url = makeRedirectUrl(plugin.redirectTo);
8 return url ? { title: plugin.title, url } : null;
9 };
10
11 const makeRedirectUrl = (url) => {
12 try {
13 return new URL(
14 url.replace('{{ADMIN_URL}}', adminUrl).replace('{{HOME_URL}}', homeUrl),
15 ).toString();
16 } catch (e) {
17 console.error(e);
18 return '';
19 }
20 };
21