x
This commit is contained in:
parent
906c5ffe2c
commit
85101e7ddc
1 changed files with 13 additions and 14 deletions
27
index.html
27
index.html
|
|
@ -269,26 +269,25 @@ function getAPIBaseURL() {
|
|||
const hostname = window.location.hostname;
|
||||
const protocol = window.location.protocol;
|
||||
|
||||
switch(hostname) {
|
||||
case 'localhost':
|
||||
return 'http://localhost:8787/api';
|
||||
case 'theradicalparty.com':
|
||||
case 'www.theradicalparty.com':
|
||||
return `${protocol}//theradicalparty.com/api`;
|
||||
case 'radical.omar-c29.workers.dev':
|
||||
return `${protocol}//radical.omar-c29.workers.dev/api`;
|
||||
default:
|
||||
return `${protocol}//${hostname}/api`;
|
||||
// Always use the main domain for API calls
|
||||
if (hostname === 'theradicalparty.com' || hostname === 'www.theradicalparty.com') {
|
||||
return `${protocol}//theradicalparty.com/api`;
|
||||
} else if (hostname === 'radical-dmd.pages.dev' || hostname.endsWith('.pages.dev')) {
|
||||
// For preview deployments, use the main domain's API
|
||||
return `https://theradicalparty.com/api`;
|
||||
} else if (hostname === 'localhost') {
|
||||
return 'http://localhost:8787/api';
|
||||
} else {
|
||||
// Fallback
|
||||
return `${protocol}//${hostname}/api`;
|
||||
}
|
||||
}
|
||||
|
||||
const API_BASE_URL = getAPIBaseURL();
|
||||
|
||||
function getMediaURL(path) {
|
||||
const baseURL = window.location.hostname === 'localhost'
|
||||
? 'http://localhost:8787'
|
||||
: `https://${window.location.hostname}`;
|
||||
return `${baseURL}${path}`;
|
||||
// Always use the main domain for media assets
|
||||
return `https://theradicalparty.com${path}`;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue