Skip to content

Commit d5b15b0

Browse files
authored
Update external-services.js
1 parent a793d94 commit d5b15b0

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

config/var/www/admin/control-panel/external-services/external-services.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@ const CATEGORY_ORDER = [
1919
'Security'
2020
];
2121

22+
const FA_ICON_MODIFIER_SUFFIXES = [
23+
'spin', 'pulse', 'fw', 'lg', 'xs', 'sm',
24+
'1x', '2x', '3x', '4x', '5x', '6x', '7x', '8x', '9x', '10x'
25+
];
26+
27+
const FA_ICON_MODIFIER_PATTERN = new RegExp(`^fa-(${FA_ICON_MODIFIER_SUFFIXES.join("|")})$`);
2228
const ERROR_LOADING_EXTERNAL_SERVICES_MESSAGE = "Failed to fetch external service status. Check your internet connection and refresh the page. If the problem continues, check the browser console for details or contact your administrator.";
2329

2430
const SETTINGS_INSTRUCTION_TEXT = 'Toggle services to show/hide on the dashboard. Drag service cards to reorder them, or use the keyboard: press Enter to activate reorder mode and use arrow keys to move cards. Click "Save Changes" to apply. Services are organized by category.';
@@ -762,7 +768,7 @@ export class ExternalServicesManager {
762768
globalThis.localStorage.removeItem(storageTestKey);
763769
} catch (availabilityError) {
764770
console.error('localStorage availability check failed:', availabilityError);
765-
throw new Error('Unable to save preferences: browser storage is unavailable or disabled.');
771+
throw new Error('Unable to save preferences: browser storage availability check failed (storage may be disabled).');
766772
}
767773

768774
try {
@@ -874,13 +880,13 @@ export class ExternalServicesManager {
874880
let iconName = null;
875881

876882
for (const part of parts) {
883+
// Font Awesome shorthand style prefixes: r=regular, s=solid, b=brands, d=duotone, l=light (far/fas/fab/fad/fal)
877884
if (/^fa[rsbdl]$/.test(part) || /^fa-(solid|regular|brands|light|duotone)$/.test(part)) {
878885
stylePrefix = part;
879886
continue;
880887
}
881888

882-
if (!iconName && /^fa-[a-z0-9-]+$/.test(part) && !/^fa-(spin|pulse|fw|lg|xs|sm|1x|2x|3x|4x|5x|6x|7x|8x|9x|10x)$/.test(part)) {
883-
iconName = part.replace(/^fa-/, "");
889+
if (!iconName && /^fa-[a-z0-9-]+$/.test(part) && !FA_ICON_MODIFIER_PATTERN.test(part)) {
884890
}
885891
}
886892

0 commit comments

Comments
 (0)