Add server status page and a badge in AppBar (#182)
* WIP: Add server status and running process indicators * Finish ServerStatusPage and ServerRunningProcess * fix typos, add running process info to the server status page * Remove ServerRunningProcess and integrate it into ServerStatusBadge * remove divider in menu * display time as started X minutes ago * add documentation; clearly state what new components are; update readme * change wording a bit, cross-link with docs/README.md * use returned HTML * Finish ServerStatus page and badges * Fix types * cleanup * remove some code * adjust config load
This commit is contained in:

committed by
GitHub

parent
3b69e78bb8
commit
7c21692a1e
@@ -2,6 +2,7 @@ export interface Config {
|
||||
restrictBaseUrl: string | string[];
|
||||
asManagedUsers: RegExp[];
|
||||
menu: MenuItem[];
|
||||
etkeccAdmin?: string;
|
||||
}
|
||||
|
||||
export interface MenuItem {
|
||||
@@ -17,6 +18,7 @@ let config: Config = {
|
||||
restrictBaseUrl: "",
|
||||
asManagedUsers: [],
|
||||
menu: [],
|
||||
etkeccAdmin: ""
|
||||
};
|
||||
|
||||
export const FetchConfig = async () => {
|
||||
@@ -38,9 +40,9 @@ export const FetchConfig = async () => {
|
||||
if (!configWK[WellKnownKey]) {
|
||||
console.log(`Loaded https://${homeserver}.well-known/matrix/client, but it doesn't contain ${WellKnownKey} key, skipping`, configWK);
|
||||
} else {
|
||||
console.log(`Loaded https://${homeserver}.well-known/matrix/client`, configWK);
|
||||
LoadConfig(configWK[WellKnownKey]);
|
||||
}
|
||||
console.log(`Loaded https://${homeserver}.well-known/matrix/client`, configWK);
|
||||
LoadConfig(configWK[WellKnownKey]);
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(`https://${homeserver}/.well-known/matrix/client not found, skipping`, e);
|
||||
}
|
||||
@@ -49,6 +51,8 @@ export const FetchConfig = async () => {
|
||||
}
|
||||
|
||||
// load config from context
|
||||
// we deliberately processing each key separately to avoid overwriting the whole config, loosing some keys, and messing
|
||||
// with typescript types
|
||||
export const LoadConfig = (context: any) => {
|
||||
if (context?.restrictBaseUrl) {
|
||||
config.restrictBaseUrl = context.restrictBaseUrl as string | string[];
|
||||
@@ -65,6 +69,10 @@ export const LoadConfig = (context: any) => {
|
||||
if (menu.length > 0) {
|
||||
config.menu = menu;
|
||||
}
|
||||
|
||||
if (context?.etkeccAdmin) {
|
||||
config.etkeccAdmin = context.etkeccAdmin;
|
||||
}
|
||||
}
|
||||
|
||||
// get config
|
||||
|
Reference in New Issue
Block a user