Merge pull request #1886 from safing/fix/v2_force-UI-use-ipv4-api
Fix/v2 force UI use ipv4 api
This commit is contained in:
@@ -43,7 +43,7 @@ export interface AuthKeyResponse {
|
|||||||
export class MetaAPI {
|
export class MetaAPI {
|
||||||
constructor(
|
constructor(
|
||||||
private http: HttpClient,
|
private http: HttpClient,
|
||||||
@Inject(PORTMASTER_HTTP_API_ENDPOINT) @Optional() private httpEndpoint: string = 'http://localhost:817/api',
|
@Inject(PORTMASTER_HTTP_API_ENDPOINT) @Optional() private httpEndpoint: string = 'http://127.0.0.1:817/api',
|
||||||
) { }
|
) { }
|
||||||
|
|
||||||
listEndpoints(): Observable<MetaEndpoint[]> {
|
listEndpoints(): Observable<MetaEndpoint[]> {
|
||||||
|
|||||||
@@ -48,10 +48,10 @@ export class PortmasterAPIModule {
|
|||||||
*/
|
*/
|
||||||
static forRoot(cfg: ModuleConfig = {}): ModuleWithProviders<PortmasterAPIModule> {
|
static forRoot(cfg: ModuleConfig = {}): ModuleWithProviders<PortmasterAPIModule> {
|
||||||
if (cfg.httpAPI === undefined) {
|
if (cfg.httpAPI === undefined) {
|
||||||
cfg.httpAPI = `http://${window.location.host}/api`;
|
cfg.httpAPI = `http://127.0.0.1:817/api`;
|
||||||
}
|
}
|
||||||
if (cfg.websocketAPI === undefined) {
|
if (cfg.websocketAPI === undefined) {
|
||||||
cfg.websocketAPI = `ws://${window.location.host}/api/database/v1`;
|
cfg.websocketAPI = `ws://127.0.0.1:817/api/database/v1`;
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -80,8 +80,8 @@ if (location.pathname !== "/prompt") {
|
|||||||
providers: [
|
providers: [
|
||||||
provideHttpClient(),
|
provideHttpClient(),
|
||||||
importProvidersFrom(PortmasterAPIModule.forRoot({
|
importProvidersFrom(PortmasterAPIModule.forRoot({
|
||||||
websocketAPI: "ws://localhost:817/api/database/v1",
|
websocketAPI: "ws://127.0.0.1:817/api/database/v1",
|
||||||
httpAPI: "http://localhost:817/api"
|
httpAPI: "http://127.0.0.1:817/api"
|
||||||
})),
|
})),
|
||||||
NotificationsService,
|
NotificationsService,
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
],
|
],
|
||||||
"remote": {
|
"remote": {
|
||||||
"urls": [
|
"urls": [
|
||||||
"http://localhost:817"
|
"http://127.0.0.1:817"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"permissions": [
|
"permissions": [
|
||||||
|
|||||||
@@ -181,15 +181,15 @@ pub fn may_navigate_to_ui(win: &mut WebviewWindow, force: bool) {
|
|||||||
// Only for dev build
|
// Only for dev build
|
||||||
// Allow connection to http://localhost:4200
|
// Allow connection to http://localhost:4200
|
||||||
let capabilities = include_str!("../capabilities/default.json")
|
let capabilities = include_str!("../capabilities/default.json")
|
||||||
.replace("http://localhost:817", "http://localhost:4200");
|
.replace("http://127.0.0.1:817", "http://127.0.0.1:4200");
|
||||||
let _ = win.add_capability(capabilities);
|
let _ = win.add_capability(capabilities);
|
||||||
debug!("[tauri] navigating to http://localhost:4200");
|
debug!("[tauri] navigating to http://127.0.0.1:4200");
|
||||||
_ = win.navigate("http://localhost:4200".parse().unwrap());
|
_ = win.navigate("http://127.0.0.1:4200".parse().unwrap());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(debug_assertions))]
|
#[cfg(not(debug_assertions))]
|
||||||
{
|
{
|
||||||
_ = win.navigate("http://localhost:817".parse().unwrap());
|
_ = win.navigate("http://127.0.0.1:817".parse().unwrap());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
error!(
|
error!(
|
||||||
|
|||||||
@@ -44,7 +44,7 @@
|
|||||||
"withGlobalTauri": true,
|
"withGlobalTauri": true,
|
||||||
"enableGTKAppId": false,
|
"enableGTKAppId": false,
|
||||||
"security": {
|
"security": {
|
||||||
"csp": null
|
"csp": "default-src 'self'; connect-src http://127.0.0.1:817 ws://127.0.0.1:817;"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"bundle": {
|
"bundle": {
|
||||||
|
|||||||
Reference in New Issue
Block a user