mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-19 12:59:39 -07:00
!wip
This commit is contained in:
parent
6926feb9ed
commit
0ad8eccbdf
2 changed files with 37 additions and 27 deletions
|
@ -83,9 +83,8 @@ export function HttpLoaderFactory(http: HttpClient, platformLocation: PlatformLo
|
||||||
}
|
}
|
||||||
return new TranslateHttpLoader(http, "/translations/", `.json?v=${version}`);
|
return new TranslateHttpLoader(http, "/translations/", `.json?v=${version}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function baseurlFact() {
|
export function baseurlFact() {
|
||||||
return "/" + window['_app_base'];
|
return "/" + localStorage.getItem("baseUrl");
|
||||||
}
|
}
|
||||||
|
|
||||||
export function JwtTokenGetter() {
|
export function JwtTokenGetter() {
|
||||||
|
@ -171,12 +170,11 @@ export function JwtTokenGetter() {
|
||||||
IssuesService,
|
IssuesService,
|
||||||
PlexTvService,
|
PlexTvService,
|
||||||
SearchService,
|
SearchService,
|
||||||
SearchV2Service,
|
SearchV2Service,
|
||||||
{
|
{
|
||||||
provide: APP_BASE_HREF,
|
provide: APP_BASE_HREF,
|
||||||
useFactory: baseurlFact
|
useFactory: baseurlFact
|
||||||
}
|
} ],
|
||||||
],
|
|
||||||
bootstrap: [AppComponent],
|
bootstrap: [AppComponent],
|
||||||
})
|
})
|
||||||
export class AppModule { }
|
export class AppModule { }
|
||||||
|
|
|
@ -3,29 +3,41 @@
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
const existingBaseUrl = window.localStorage.getItem("baseUrl");
|
|
||||||
if (existingBaseUrl) {
|
// TODO change to fetch and reload page
|
||||||
document.write('<base href="/' + existingBaseUrl + '" />');
|
const existingBaseUrl = window.localStorage.getItem("baseUrl");
|
||||||
} else {
|
if (existingBaseUrl) {
|
||||||
// Work out the base URL
|
document.write('<base href="/' + existingBaseUrl + '" />');
|
||||||
// Need to find the baseUrl.txt file
|
} else {
|
||||||
const url = window.location.href;
|
// Work out the base URL
|
||||||
let hasFile = false;
|
// Need to find the baseUrl.txt file
|
||||||
fetch(url + "/baseUrl.json")
|
let url = window.location.href;
|
||||||
.then(response => {
|
|
||||||
return response.json();
|
var xmlhttp = new XMLHttpRequest();
|
||||||
}).then(data => {
|
debugger;
|
||||||
this.hasFile = true;
|
xmlhttp.open("GET", url + "api/v1/Settings/baseurl", false);
|
||||||
document.write('<base href="/' + data.baseUrl + '" />');
|
xmlhttp.send();
|
||||||
window.localStorage.setItem("baseUrl", data.baseUrl);
|
while (xmlhttp.status === 404) {
|
||||||
}).catch(err => {
|
// try again
|
||||||
console.error(err);
|
url = url.slice(0, url.lastIndexOf("/"));
|
||||||
});
|
tryGetBaseUrl(xmlhttp, url);
|
||||||
}
|
}
|
||||||
</script>
|
const data = JSON.parse(xmlhttp.responseText);
|
||||||
|
debugger;
|
||||||
|
document.write('<base href="/' + data + '" />');
|
||||||
|
window.localStorage.setItem("baseUrl", data);
|
||||||
|
|
||||||
|
|
||||||
|
function tryGetBaseUrl(xmlhttp, url) {
|
||||||
|
debugger;
|
||||||
|
xmlhttp.open("GET", url + "/api/v1/Settings/baseurl", false);
|
||||||
|
xmlhttp.send();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
||||||
<link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500" rel="stylesheet">
|
<link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500" rel="stylesheet">
|
||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue