This repository has been archived by the owner on Aug 10, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 110
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
54 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import { GET, Path } from "typescript-rest"; | ||
import { AutoWired } from "typescript-ioc/es6"; | ||
import {URL} from "url"; | ||
import config from "../../config"; | ||
|
||
interface WellknownResponse { | ||
"m.integrations_widget": { | ||
url: string; | ||
data: { | ||
api_url: string; | ||
}; | ||
}; | ||
} | ||
|
||
/** | ||
* Serving of the .well-known file | ||
*/ | ||
@Path("/.well-known/matrix") | ||
@AutoWired | ||
export class MatrixWellknownService { | ||
|
||
@GET | ||
@Path("integrations") | ||
public async getIntegrations(): Promise<WellknownResponse> { | ||
const parsed = new URL(config.dimension.publicUrl); | ||
|
||
parsed.pathname = '/riot'; | ||
const uiUrl = parsed.toString(); | ||
|
||
parsed.pathname = '/api/v1/scalar'; | ||
const apiUrl = parsed.toString(); | ||
|
||
return { | ||
"m.integrations_widget": { | ||
url: uiUrl, | ||
data: { | ||
api_url: apiUrl, | ||
}, | ||
}, | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters