REDROOM
PHP 8.2.31
Path:
Logout
Edit File
Size: 1.91 KB
Close
/home/nshryvcy/radiantskinclinics.org/wp-content/plugins/extendify_old/src/Launch/lib/fonts-helpers.js
Text
Base64
import { sleep } from '@shared/lib/utils'; const MAX_RETRIES = 2; const RETRY_DELAY = 1000; // 1 second in milliseconds export const fetchFontFaceFile = async (url) => { for (let attempt = 0; attempt <= MAX_RETRIES; attempt++) { try { // Add delay if this is not the first attempt if (attempt > 0) await sleep(RETRY_DELAY); const response = await fetch(url); if (!response.ok) { throw new Error('Failed to fetch font file.'); } const blob = await response.blob(); const filename = url.split('/').pop(); return new File([blob], filename, { type: blob.type, }); } catch (_) { if (attempt <= MAX_RETRIES) continue; console.error( `Failed to fetch font file after ${MAX_RETRIES + 1} attempts.`, ); return; } } }; export function makeFontFamilyFormData({ name, slug, fontFamily }) { const formData = new FormData(); const fontFamilySettings = { name, slug, fontFamily }; formData.append('font_family_settings', JSON.stringify(fontFamilySettings)); return formData; } export function makeFontFaceFormData({ fontFamilySlug, fontFamily, fontStyle, fontWeight, fontDisplay, unicodeRange, src = [], file = [], }) { const formData = new FormData(); const fontFaceSettings = { fontFamily, fontStyle, fontWeight, fontDisplay, unicodeRange: unicodeRange === undefined || unicodeRange === null ? '' : unicodeRange, src: Array.isArray(src) ? src : [src], }; const files = Array.isArray(file) ? file : [file]; // Add each font file to the form data. files.forEach((file) => { const fileId = `${fontFamilySlug}-${fontWeight}-${fontStyle}`; formData.append(fileId, file, file.name); // Use the file ids as src for WP to match and upload the files. if (!src?.length) { fontFaceSettings.src.push(fileId); } else { fontFaceSettings.src = [fileId]; } }); formData.append('font_face_settings', JSON.stringify(fontFaceSettings)); return formData; }
Save
Close
Exit & Reset
Text mode: syntax highlighting auto-detects file type.
Directory Contents
Dirs: 1 × Files: 8
Delete Selected
Select All
Select None
Sort:
Name
Size
Modified
Enable drag-to-move
Name
Size
Perms
Modified
Actions
__tests__
DIR
-
drwxr-xr-x
2026-04-28 02:40:02
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
blocks.js
154 B
lrw-r--r--
2025-08-27 17:47:28
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
fonts-helpers.js
1.91 KB
lrw-r--r--
2025-08-04 19:41:52
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
linkPages.js
6.71 KB
lrw-r--r--
2026-03-19 23:35:18
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
logo.js
1.30 KB
lrw-r--r--
2026-02-19 03:27:14
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
pages.js
2.23 KB
lrw-r--r--
2025-07-16 19:39:24
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
preview-helpers.js
1.60 KB
lrw-r--r--
2025-02-04 00:18:34
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
util.js
1.92 KB
lrw-r--r--
2026-02-19 03:27:14
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
wp.js
12.71 KB
lrw-r--r--
2026-02-27 04:48:52
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Zip Selected
If ZipArchive is unavailable, a
.tar
will be created (no compression).