Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 8 additions & 11 deletions web_interface/templates/v3/partials/fonts.html
Original file line number Diff line number Diff line change
Expand Up @@ -215,9 +215,6 @@ <h3 class="text-md font-medium text-gray-900 mb-4">Font Preview</h3>
var fontOverrides = window.fontOverrides;
var selectedFontFiles = window.selectedFontFiles;

// Base URL for API calls (shared scope)
var baseUrl = window.location.origin;

// Retry counter for initialization
var initRetryCount = 0;
var MAX_INIT_RETRIES = 50; // 5 seconds max (50 * 100ms)
Expand Down Expand Up @@ -384,9 +381,9 @@ <h3 class="text-md font-medium text-gray-900 mb-4">Font Preview</h3>
try {
// Use absolute URLs to ensure they work when loaded via HTMX
const [catalogRes, tokensRes, overridesRes] = await Promise.all([
fetch(`${baseUrl}/api/v3/fonts/catalog`),
fetch(`${baseUrl}/api/v3/fonts/tokens`),
fetch(`${baseUrl}/api/v3/fonts/overrides`)
fetch(`/api/v3/fonts/catalog`),
fetch(`/api/v3/fonts/tokens`),
fetch(`/api/v3/fonts/overrides`)
]);

// Check if all responses are successful
Expand Down Expand Up @@ -558,7 +555,7 @@ <h3 class="text-md font-medium text-gray-900 mb-4">Font Preview</h3>
}

try {
const response = await fetch(`${baseUrl}/api/v3/fonts/${encodeURIComponent(fontFamily)}`, {
const response = await fetch(`/api/v3/fonts/${encodeURIComponent(fontFamily)}`, {
method: 'DELETE'
});

Expand Down Expand Up @@ -667,7 +664,7 @@ <h3 class="text-md font-medium text-gray-900 mb-4">Font Preview</h3>
if (sizePx) overrideData.size_px = sizePx;
}

const response = await fetch(`${baseUrl}/api/v3/fonts/overrides`, {
const response = await fetch(`/api/v3/fonts/overrides`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
Expand Down Expand Up @@ -712,7 +709,7 @@ <h3 class="text-md font-medium text-gray-900 mb-4">Font Preview</h3>
}

try {
const response = await fetch(`${baseUrl}/api/v3/fonts/overrides/${elementKey}`, {
const response = await fetch(`/api/v3/fonts/overrides/${elementKey}`, {
method: 'DELETE'
});

Expand Down Expand Up @@ -860,7 +857,7 @@ <h3 class="text-md font-medium text-gray-900 mb-4">Font Preview</h3>
fg: 'ffffff'
});

const response = await fetch(`${baseUrl}/api/v3/fonts/preview?${params}`);
const response = await fetch(`/api/v3/fonts/preview?${params}`);

if (!response.ok) {
const text = await response.text();
Expand Down Expand Up @@ -990,7 +987,7 @@ <h3 class="text-md font-medium text-gray-900 mb-4">Font Preview</h3>
formData.append('font_file', file);
formData.append('font_family', i === 0 ? fontFamily : `${fontFamily}_${i + 1}`);

const response = await fetch(`${baseUrl}/api/v3/fonts/upload`, {
const response = await fetch(`/api/v3/fonts/upload`, {
method: 'POST',
body: formData
});
Expand Down