File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change 1- import { requestUrl } from "obsidian" ;
1+ import { Platform , requestUrl } from "obsidian" ;
22import SyncthingPlugin from "src/main" ;
33import { SyncthingDevice } from "src/models/entities" ;
44import { RestFailure } from "src/models/failures" ;
@@ -89,7 +89,10 @@ export class SyncthingFromREST {
8989 private async requestEndpoint ( endpoint : string ) {
9090 // FIXME: Fix the issue when connecting to the REST API. (error 403)
9191 console . log ( "requestEndpoint: Endpoint" , endpoint ) ;
92- const url = `${ this . plugin . settings . configuration . url ?. protocol } ://${ this . plugin . settings . configuration . url ?. ip_address } :${ this . plugin . settings . configuration . url ?. port } ${ endpoint } ` ;
92+ let ip_address = this . plugin . settings . configuration . url ?. ip_address ;
93+ if ( ip_address === "localhost" && Platform . isMobileApp )
94+ ip_address = "127.0.0.1" ;
95+ const url = `${ this . plugin . settings . configuration . url ?. protocol } ://${ ip_address } :${ this . plugin . settings . configuration . url ?. port } ${ endpoint } ` ;
9396 const response = requestUrl ( {
9497 url : url ,
9598 method : "GET" ,
You can’t perform that action at this time.
0 commit comments