PluginProbe
Extendify / 3.2.2
Extendify v3.2.2
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 0.5.0 All 128 releases
← All changes | src/AutoLaunch/fetchers/get-logo.js +9 -4 3.0.5 → 3.2.2 View file →
@@ -5,12 +5,12 @@
5 5 retryTwice,
6 6 setStatus,
7 7 } from '@auto-launch/functions/helpers';
8 8 import { updateOption } from '@auto-launch/functions/wp';
9 +import { launchStrings } from '@auto-launch/strings';
9 10 import { AI_HOST } from '@constants';
10 11 import { digest } from '@shared/api/digest';
11 12 import { reqDataBasics } from '@shared/lib/data';
12 -import { __ } from '@wordpress/i18n';
13 13 import { uploadMedia } from '@wordpress/media-utils';
14 14
15 15 const { showAILogo } = window.extSharedData;
16 16 const fallback = {
@@ -24,9 +24,9 @@
24 24 export const handleSiteLogo = async ({ siteProfile }) => {
25 25 if (!showAILogo) return fallback;
26 26
27 27 // translators: this is for a action log UI. Keep it short
28 - setStatus(__('Generating a logo', 'extendify-local'));
28 + setStatus(launchStrings().statusLogo);
29 29
30 30 const { logoObjectName: objectName } = siteProfile;
31 31 const body = JSON.stringify({ ...reqDataBasics, objectName });
32 32 const response = await retryTwice(() =>
@@ -61,13 +61,18 @@
61 61
62 62 return getLogoShape.parse({ logoUrl });
63 63 };
64 64
65 -export const uploadLogo = async (url) => {
65 +// The backend serves the real brand logo from a `logos-custom/` path; other
66 +// logos keep the duotone-prefixed upload name.
67 +export const isExternalLogo = (url) => url?.includes('logos-custom/') ?? false;
68 +
69 +export const uploadLogo = async (url, { external = false } = {}) => {
66 70 const blob = await (await fetch(url)).blob();
67 71 const type = blob.type;
68 72 const fileExtension = type.replace('image/', '');
69 - const logoName = `ext-custom-logo-${Date.now()}`;
73 + const prefix = external ? 'ext-logo-' : 'ext-custom-logo-';
74 + const logoName = `${prefix}${Date.now()}`;
70 75 const image = new File([blob], `${logoName}.${fileExtension}`, { type });
71 76
72 77 await uploadMedia({
73 78 filesList: [image],