From eadc04a6a0d696abc6c9297855923d52d41e28be Mon Sep 17 00:00:00 2001 From: Dirk Klimpel <5740567+dklimpel@users.noreply.github.com> Date: Mon, 14 Dec 2020 13:12:13 +0100 Subject: [PATCH 01/15] Update helper text for activate an user (#95) --- src/i18n/de.js | 3 ++- src/i18n/en.js | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/i18n/de.js b/src/i18n/de.js index 8307fa6..d0d47fa 100644 --- a/src/i18n/de.js +++ b/src/i18n/de.js @@ -126,7 +126,8 @@ export default { consent_version: "Zugestimmte Geschäftsbedingungen", }, helper: { - deactivate: "Deaktivierte Nutzer können nicht wieder aktiviert werden.", + deactivate: + "Sie müssen ein Passwort angeben, um ein Konto wieder zu aktivieren.", erase: "DSGVO konformes Löschen der Benutzerdaten", }, action: { diff --git a/src/i18n/en.js b/src/i18n/en.js index c2515f1..43788ed 100644 --- a/src/i18n/en.js +++ b/src/i18n/en.js @@ -124,7 +124,7 @@ export default { consent_version: "Consent version", }, helper: { - deactivate: "Deactivated users cannot be reactivated", + deactivate: "You must provide a password to re-activate an account.", erase: "Mark the user as GDPR-erased", }, action: { From 1706cd3c9ded2b4130e856e5b6e8e9c9dc3ff681 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 11 Dec 2020 19:50:36 +0000 Subject: [PATCH 02/15] Bump ini from 1.3.5 to 1.3.7 Bumps [ini](https://github.com/isaacs/ini) from 1.3.5 to 1.3.7. - [Release notes](https://github.com/isaacs/ini/releases) - [Commits](https://github.com/isaacs/ini/compare/v1.3.5...v1.3.7) Signed-off-by: dependabot[bot] --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index cad6848..1b9b64e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5855,9 +5855,9 @@ inherits@2.0.3: integrity sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4= ini@^1.3.5: - version "1.3.5" - resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.5.tgz#eee25f56db1c9ec6085e0c22778083f596abf927" - integrity sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw== + version "1.3.7" + resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.7.tgz#a09363e1911972ea16d7a8851005d84cf09a9a84" + integrity sha512-iKpRpXP+CrP2jyrxvg1kMUpXDyRUFDWurxbnVT1vQPx+Wz9uCYsMIqYuSBLV+PAaZG/d7kRLKRFc9oDMsH+mFQ== inquirer@7.0.4: version "7.0.4" From 2f96951c194dbe5a1d03a1a937c503ed43cf534e Mon Sep 17 00:00:00 2001 From: Dirk Klimpel <5740567+dklimpel@users.noreply.github.com> Date: Mon, 4 Jan 2021 09:14:33 +0100 Subject: [PATCH 03/15] Add view of reported events (#84) --- README.md | 2 +- src/App.js | 10 ++- src/components/EventReports.js | 135 +++++++++++++++++++++++++++++++++ src/i18n/de.js | 25 ++++++ src/i18n/en.js | 25 ++++++ src/synapse/dataProvider.js | 9 +++ 6 files changed, 204 insertions(+), 2 deletions(-) create mode 100644 src/components/EventReports.js diff --git a/README.md b/README.md index a2e0190..722d54b 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ This project is built using [react-admin](https://marmelab.com/react-admin/). -It needs at least Synapse v1.18.0 for all functions to work as expected! +It needs at least Synapse v1.23.0 for all functions to work as expected! You get your server version with the request `/_synapse/admin/v1/server_version`. See also [Synapse version API](https://github.com/matrix-org/synapse/blob/develop/docs/admin_api/version_api.rst). diff --git a/src/App.js b/src/App.js index 6ad0b22..5b784c4 100644 --- a/src/App.js +++ b/src/App.js @@ -5,9 +5,11 @@ import authProvider from "./synapse/authProvider"; import dataProvider from "./synapse/dataProvider"; import { UserList, UserCreate, UserEdit } from "./components/users"; import { RoomList, RoomShow } from "./components/rooms"; +import { ReportList, ReportShow } from "./components/EventReports"; import LoginPage from "./components/LoginPage"; import UserIcon from "@material-ui/icons/Group"; -import { ViewListIcon as RoomIcon } from "@material-ui/icons/ViewList"; +import RoomIcon from "@material-ui/icons/ViewList"; +import ReportIcon from "@material-ui/icons/Warning"; import { ImportFeature } from "./components/ImportFeature"; import { Route } from "react-router-dom"; import germanMessages from "./i18n/de"; @@ -41,6 +43,12 @@ const App = () => ( icon={UserIcon} /> + diff --git a/src/components/EventReports.js b/src/components/EventReports.js new file mode 100644 index 0000000..c73647f --- /dev/null +++ b/src/components/EventReports.js @@ -0,0 +1,135 @@ +import React from "react"; +import { + Datagrid, + DateField, + List, + NumberField, + Pagination, + ReferenceField, + Show, + Tab, + TabbedShowLayout, + TextField, + useTranslate, +} from "react-admin"; +import PageviewIcon from "@material-ui/icons/Pageview"; +import ViewListIcon from "@material-ui/icons/ViewList"; + +const ReportPagination = props => ( + +); + +export const ReportShow = props => { + const translate = useTranslate(); + return ( + + + } + > + + + + + + + + + + + + + + } + path="detail" + > + {" "} + + + + + + + + + + + + + + + + + ); +}; + +export const ReportList = ({ ...props }) => { + return ( + } + sort={{ field: "received_ts", order: "DESC" }} + bulkActionButtons={false} + > + + + + + + + + + ); +}; diff --git a/src/i18n/de.js b/src/i18n/de.js index d0d47fa..1b60545 100644 --- a/src/i18n/de.js +++ b/src/i18n/de.js @@ -29,6 +29,7 @@ export default { "Sind Sie sicher dass Sie den Raum löschen möchten? Diese Aktion kann nicht rückgängig gemacht werden. Alle Nachrichten und Medien, die der Raum beinhaltet werden vom Server gelöscht!", }, }, + reports: { tabs: { basic: "Allgemein", detail: "Details" } }, }, import_users: { error: { @@ -173,6 +174,30 @@ export default { unencrypted: "Nicht verschlüsselt", }, }, + reports: { + name: "Ereignisbericht |||| Ereignisberichte", + fields: { + id: "ID", + received_ts: "Meldezeit", + user_id: "Meldender", + name: "Raumname", + score: "Wert", + reason: "Grund", + event_id: "Event-ID", + event_json: { + origin: "Ursprungsserver", + origin_server_ts: "Sendezeit", + type: "Eventtyp", + content: { + msgtype: "Inhaltstyp", + body: "Nachrichteninhalt", + format: "Nachrichtenformat", + formatted_body: "Formatierter Nachrichteninhalt", + algorithm: "Verschlüsselungsalgorithmus", + }, + }, + }, + }, connections: { name: "Verbindungen", fields: { diff --git a/src/i18n/en.js b/src/i18n/en.js index 43788ed..76b33aa 100644 --- a/src/i18n/en.js +++ b/src/i18n/en.js @@ -27,6 +27,7 @@ export default { "Are you sure you want to delete the room? This cannot be undone. All messages and shared media in the room will be deleted from the server!", }, }, + reports: { tabs: { basic: "Basic", detail: "Details" } }, }, import_users: { error: { @@ -170,6 +171,30 @@ export default { unencrypted: "Unencrypted", }, }, + reports: { + name: "Reported event |||| Reported events", + fields: { + id: "ID", + received_ts: "report time", + user_id: "announcer", + name: "name of the room", + score: "score", + reason: "reason", + event_id: "event ID", + event_json: { + origin: "origin server", + origin_server_ts: "time of send", + type: "event typ", + content: { + msgtype: "content type", + body: "content", + format: "format", + formatted_body: "formatted content", + algorithm: "algorithm", + }, + }, + }, + }, connections: { name: "Connections", fields: { diff --git a/src/synapse/dataProvider.js b/src/synapse/dataProvider.js index 6d5f78d..560bdb9 100644 --- a/src/synapse/dataProvider.js +++ b/src/synapse/dataProvider.js @@ -72,6 +72,15 @@ const resourceMap = { method: "POST", }), }, + reports: { + path: "/_synapse/admin/v1/event_reports", + map: er => ({ + ...er, + id: er.id, + }), + data: "event_reports", + total: json => json.total, + }, devices: { map: d => ({ ...d, From b184954ffa179fbe4fbdc2a75010361c3fe0edeb Mon Sep 17 00:00:00 2001 From: Dirk Klimpel <5740567+dklimpel@users.noreply.github.com> Date: Thu, 11 Feb 2021 20:20:42 +0100 Subject: [PATCH 04/15] Update `total` in dataProvider (#101) --- src/synapse/dataProvider.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/synapse/dataProvider.js b/src/synapse/dataProvider.js index 560bdb9..3df3c9d 100644 --- a/src/synapse/dataProvider.js +++ b/src/synapse/dataProvider.js @@ -87,7 +87,9 @@ const resourceMap = { id: d.device_id, }), data: "devices", - total: json => json.devices.length, + total: json => { + return json.total; + }, reference: id => ({ endpoint: `/_synapse/admin/v2/users/${id}/devices`, }), @@ -111,7 +113,9 @@ const resourceMap = { endpoint: `/_synapse/admin/v1/rooms/${id}/members`, }), data: "members", - total: json => json.members.length, + total: json => { + return json.total; + }, }, servernotices: { map: n => ({ id: n.event_id }), From 425c210cfc632260468e7ec21db2334e470afe34 Mon Sep 17 00:00:00 2001 From: Dirk Klimpel <5740567+dklimpel@users.noreply.github.com> Date: Thu, 11 Feb 2021 20:24:17 +0100 Subject: [PATCH 05/15] Add delete button to room detail page (#97) * Add delete button to room detail page * Add confirmation dialog for room deletion --- src/components/rooms.js | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/components/rooms.js b/src/components/rooms.js index 041f0a6..efef5cb 100644 --- a/src/components/rooms.js +++ b/src/components/rooms.js @@ -4,6 +4,7 @@ import { BooleanField, BulkDeleteWithConfirmButton, Datagrid, + DeleteButton, Filter, List, Pagination, @@ -15,6 +16,7 @@ import { Tab, TabbedShowLayout, TextField, + TopToolbar, useTranslate, } from "react-admin"; import get from "lodash/get"; @@ -70,10 +72,26 @@ const RoomTitle = ({ record }) => { ); }; +const RoomShowActions = ({ basePath, data, resource }) => { + const translate = useTranslate(); + return ( + + + + ); +}; + export const RoomShow = props => { const translate = useTranslate(); return ( - }> + } title={}> }> From f2a12756733964da59069a1cd9a63b3f1e1a4407 Mon Sep 17 00:00:00 2001 From: Dirk Klimpel <5740567+dklimpel@users.noreply.github.com> Date: Thu, 11 Feb 2021 20:37:20 +0100 Subject: [PATCH 06/15] Add a new tab to user page with pushers (#85) * Add a new tab to user page with pushers * Update pushers `total` and `id` --- src/App.js | 1 + src/components/users.js | 27 +++++++++++++++++++++++++++ src/i18n/de.js | 14 ++++++++++++++ src/i18n/en.js | 14 ++++++++++++++ src/synapse/dataProvider.js | 13 +++++++++++++ 5 files changed, 69 insertions(+) diff --git a/src/App.js b/src/App.js index 5b784c4..e9378b8 100644 --- a/src/App.js +++ b/src/App.js @@ -52,6 +52,7 @@ const App = () => ( + ); diff --git a/src/components/users.js b/src/components/users.js index 5f8caf8..d463379 100644 --- a/src/components/users.js +++ b/src/components/users.js @@ -5,6 +5,7 @@ import ContactMailIcon from "@material-ui/icons/ContactMail"; import DevicesIcon from "@material-ui/icons/Devices"; import GetAppIcon from "@material-ui/icons/GetApp"; import SettingsInputComponentIcon from "@material-ui/icons/SettingsInputComponent"; +import NotificationsIcon from "@material-ui/icons/Notifications"; import { ArrayInput, ArrayField, @@ -312,6 +313,7 @@ export const UserEdit = props => { /> + } @@ -330,6 +332,7 @@ export const UserEdit = props => { + } @@ -361,6 +364,7 @@ export const UserEdit = props => { + } @@ -400,6 +404,29 @@ export const UserEdit = props => { + + } + path="pushers" + > + + + + + + + + + + + + + ); diff --git a/src/i18n/de.js b/src/i18n/de.js index 1b60545..a881b1d 100644 --- a/src/i18n/de.js +++ b/src/i18n/de.js @@ -223,6 +223,20 @@ export default { }, }, }, + pushers: { + name: "Pusher |||| Pushers", + fields: { + app: "App", + app_display_name: "App-Anzeigename", + app_id: "App ID", + device_display_name: "Geräte-Anzeigename", + kind: "Art", + lang: "Sprache", + profile_tag: "Profil-Tag", + pushkey: "Pushkey", + data: { url: "URL" }, + }, + }, servernotices: { name: "Serverbenachrichtigungen", send: "Servernachricht versenden", diff --git a/src/i18n/en.js b/src/i18n/en.js index 76b33aa..87d70be 100644 --- a/src/i18n/en.js +++ b/src/i18n/en.js @@ -220,6 +220,20 @@ export default { }, }, }, + pushers: { + name: "Pusher |||| Pushers", + fields: { + app: "App", + app_display_name: "App display name", + app_id: "App ID", + device_display_name: "Device display name", + kind: "Kind", + lang: "Language", + profile_tag: "Profile tag", + pushkey: "Pushkey", + data: { url: "URL" }, + }, + }, servernotices: { name: "Server Notices", send: "Send server notices", diff --git a/src/synapse/dataProvider.js b/src/synapse/dataProvider.js index 3df3c9d..815d5dd 100644 --- a/src/synapse/dataProvider.js +++ b/src/synapse/dataProvider.js @@ -117,6 +117,19 @@ const resourceMap = { return json.total; }, }, + pushers: { + map: p => ({ + ...p, + id: p.pushkey, + }), + reference: id => ({ + endpoint: `/_synapse/admin/v1/users/${id}/pushers`, + }), + data: "pushers", + total: json => { + return json.total; + }, + }, servernotices: { map: n => ({ id: n.event_id }), create: data => ({ From 706114a3829654802d2776903ed0f17e16104ba4 Mon Sep 17 00:00:00 2001 From: Dirk Klimpel <5740567+dklimpel@users.noreply.github.com> Date: Thu, 11 Feb 2021 20:45:02 +0100 Subject: [PATCH 07/15] Add a new tab to user page with room memberships (#73) The admin API for user's room memberships is new in synapse v1.21.0. Co-authored-by: Michael Albert <37796947+awesome-michael@users.noreply.github.com> --- src/App.js | 1 + src/components/users.js | 33 +++++++++++++++++++++++++++++++++ src/synapse/dataProvider.js | 12 ++++++++++++ 3 files changed, 46 insertions(+) diff --git a/src/App.js b/src/App.js index e9378b8..5c8e132 100644 --- a/src/App.js +++ b/src/App.js @@ -52,6 +52,7 @@ const App = () => ( + diff --git a/src/components/users.js b/src/components/users.js index d463379..e93e409 100644 --- a/src/components/users.js +++ b/src/components/users.js @@ -5,6 +5,7 @@ import ContactMailIcon from "@material-ui/icons/ContactMail"; import DevicesIcon from "@material-ui/icons/Devices"; import GetAppIcon from "@material-ui/icons/GetApp"; import SettingsInputComponentIcon from "@material-ui/icons/SettingsInputComponent"; +import ViewListIcon from "@material-ui/icons/ViewList"; import NotificationsIcon from "@material-ui/icons/Notifications"; import { ArrayInput, @@ -405,6 +406,38 @@ export const UserEdit = props => { + } + path="rooms" + > + + "/rooms/" + id + "/show"} + > + + + + + + + + } diff --git a/src/synapse/dataProvider.js b/src/synapse/dataProvider.js index 815d5dd..a329e66 100644 --- a/src/synapse/dataProvider.js +++ b/src/synapse/dataProvider.js @@ -130,6 +130,18 @@ const resourceMap = { return json.total; }, }, + joined_rooms: { + map: jr => ({ + id: jr, + }), + reference: id => ({ + endpoint: `/_synapse/admin/v1/users/${id}/joined_rooms`, + }), + data: "joined_rooms", + total: json => { + return json.total; + }, + }, servernotices: { map: n => ({ id: n.event_id }), create: data => ({ From ea59d0dd02199cb074770be689c5ea5d08b52b5b Mon Sep 17 00:00:00 2001 From: Dirk Klimpel <5740567+dklimpel@users.noreply.github.com> Date: Thu, 11 Feb 2021 21:11:34 +0100 Subject: [PATCH 08/15] Add a new tab to user page with media (#87) * Add a new tab to user page with media --- src/App.js | 1 + src/components/users.js | 54 ++++++++++++++++++++++++++++++++++++- src/i18n/de.js | 13 +++++++++ src/i18n/en.js | 13 +++++++++ src/synapse/dataProvider.js | 24 ++++++++++++++++- 5 files changed, 103 insertions(+), 2 deletions(-) diff --git a/src/App.js b/src/App.js index 5c8e132..d5c9bfd 100644 --- a/src/App.js +++ b/src/App.js @@ -52,6 +52,7 @@ const App = () => ( + diff --git a/src/components/users.js b/src/components/users.js index e93e409..e66eb44 100644 --- a/src/components/users.js +++ b/src/components/users.js @@ -5,8 +5,9 @@ import ContactMailIcon from "@material-ui/icons/ContactMail"; import DevicesIcon from "@material-ui/icons/Devices"; import GetAppIcon from "@material-ui/icons/GetApp"; import SettingsInputComponentIcon from "@material-ui/icons/SettingsInputComponent"; -import ViewListIcon from "@material-ui/icons/ViewList"; import NotificationsIcon from "@material-ui/icons/Notifications"; +import PermMediaIcon from "@material-ui/icons/PermMedia"; +import ViewListIcon from "@material-ui/icons/ViewList"; import { ArrayInput, ArrayField, @@ -42,6 +43,7 @@ import { ExportButton, TopToolbar, sanitizeListRestProps, + NumberField, } from "react-admin"; import { ServerNoticeButton, ServerNoticeBulkButton } from "./ServerNotices"; import { DeviceRemoveButton } from "./devices"; @@ -406,6 +408,56 @@ export const UserEdit = props => { + } + path="media" + > + } + perPage={50} + > + + + + + + + + + + + + + + } diff --git a/src/i18n/de.js b/src/i18n/de.js index a881b1d..4402a50 100644 --- a/src/i18n/de.js +++ b/src/i18n/de.js @@ -223,6 +223,19 @@ export default { }, }, }, + users_media: { + name: "Medien", + fields: { + media_id: "Medien ID", + media_length: "Größe", + media_type: "Typ", + upload_name: "Dateiname", + quarantined_by: "Zur Quarantäne hinzugefügt", + safe_from_quarantine: "Geschützt vor Quarantäne", + created_ts: "Erstellt", + last_access_ts: "Letzter Zugriff", + }, + }, pushers: { name: "Pusher |||| Pushers", fields: { diff --git a/src/i18n/en.js b/src/i18n/en.js index 87d70be..74a1e9c 100644 --- a/src/i18n/en.js +++ b/src/i18n/en.js @@ -220,6 +220,19 @@ export default { }, }, }, + users_media: { + name: "Media", + fields: { + media_id: "Media ID", + media_length: "Lenght", + media_type: "Type", + upload_name: "File name", + quarantined_by: "Quarantined by", + safe_from_quarantine: "Safe from quarantine", + created_ts: "Created", + last_access_ts: "Last access", + }, + }, pushers: { name: "Pusher |||| Pushers", fields: { diff --git a/src/synapse/dataProvider.js b/src/synapse/dataProvider.js index a329e66..2a664c4 100644 --- a/src/synapse/dataProvider.js +++ b/src/synapse/dataProvider.js @@ -142,6 +142,24 @@ const resourceMap = { return json.total; }, }, + users_media: { + map: um => ({ + ...um, + id: um.media_id, + }), + reference: id => ({ + endpoint: `/_synapse/admin/v1/users/${id}/media`, + }), + data: "media", + total: json => { + return json.total; + }, + delete: params => ({ + endpoint: `/_synapse/admin/v1/media/${localStorage.getItem( + "home_server" + )}/${params.id}`, + }), + }, servernotices: { map: n => ({ id: n.event_id }), create: data => ({ @@ -239,6 +257,10 @@ const dataProvider = { console.log("getManyReference " + resource); const { page, perPage } = params.pagination; const from = (page - 1) * perPage; + const query = { + from: from, + limit: perPage, + }; const homeserver = localStorage.getItem("base_url"); if (!homeserver || !(resource in resourceMap)) return Promise.reject(); @@ -246,7 +268,7 @@ const dataProvider = { const res = resourceMap[resource]; const ref = res["reference"](params.id); - const endpoint_url = homeserver + ref.endpoint; + const endpoint_url = `${homeserver}${ref.endpoint}?${stringify(query)}`; return jsonClient(endpoint_url).then(({ headers, json }) => ({ data: json[res.data].map(res.map), From 7f92e1a3c0074fa978558bb61cea15e05f4ccd73 Mon Sep 17 00:00:00 2001 From: Dirk Klimpel <5740567+dklimpel@users.noreply.github.com> Date: Thu, 11 Feb 2021 21:14:02 +0100 Subject: [PATCH 09/15] Add new list with information about users' media (#89) --- src/App.js | 7 ++++++ src/components/statistics.js | 42 ++++++++++++++++++++++++++++++++++++ src/i18n/de.js | 7 ++++++ src/i18n/en.js | 7 ++++++ src/synapse/dataProvider.js | 11 ++++++++++ 5 files changed, 74 insertions(+) create mode 100644 src/components/statistics.js diff --git a/src/App.js b/src/App.js index d5c9bfd..ec240a5 100644 --- a/src/App.js +++ b/src/App.js @@ -8,6 +8,8 @@ import { RoomList, RoomShow } from "./components/rooms"; import { ReportList, ReportShow } from "./components/EventReports"; import LoginPage from "./components/LoginPage"; import UserIcon from "@material-ui/icons/Group"; +import EqualizerIcon from "@material-ui/icons/Equalizer"; +import { UserMediaStatsList } from "./components/statistics"; import RoomIcon from "@material-ui/icons/ViewList"; import ReportIcon from "@material-ui/icons/Warning"; import { ImportFeature } from "./components/ImportFeature"; @@ -43,6 +45,11 @@ const App = () => ( icon={UserIcon} /> + ( + +); + +const UserMediaStatsFilter = props => ( + + + +); + +export const UserMediaStatsList = props => { + return ( + } + pagination={} + sort={{ field: "media_length", order: "DESC" }} + bulkActionButtons={false} + > + "/users/" + id + "/media"}> + + + + + + + ); +}; diff --git a/src/i18n/de.js b/src/i18n/de.js index 4402a50..f20ef18 100644 --- a/src/i18n/de.js +++ b/src/i18n/de.js @@ -266,6 +266,13 @@ export default { 'Sendet eine Serverbenachrichtigung an die ausgewählten Nutzer. Hierfür muss das Feature "Server Notices" auf dem Server aktiviert sein.', }, }, + user_media_statistics: { + name: "Dateien je Benutzer", + fields: { + media_count: "Anzahl der Dateien", + media_length: "Größe der Dateien", + }, + }, }, ra: { ...germanMessages.ra, diff --git a/src/i18n/en.js b/src/i18n/en.js index 74a1e9c..bb3ac3b 100644 --- a/src/i18n/en.js +++ b/src/i18n/en.js @@ -263,5 +263,12 @@ export default { 'Sends a server notice to the selected users. The feature "Server Notices" has to be activated at the server.', }, }, + user_media_statistics: { + name: "Users' media", + fields: { + media_count: "Media count", + media_length: "Media length", + }, + }, }, }; diff --git a/src/synapse/dataProvider.js b/src/synapse/dataProvider.js index 2a664c4..d928462 100644 --- a/src/synapse/dataProvider.js +++ b/src/synapse/dataProvider.js @@ -174,6 +174,17 @@ const resourceMap = { method: "POST", }), }, + user_media_statistics: { + path: "/_synapse/admin/v1/statistics/users/media", + map: usms => ({ + ...usms, + id: usms.user_id, + }), + data: "users", + total: json => { + return json.total; + }, + }, }; function filterNullValues(key, value) { From 684c44e47057e42fb217688e08706e9f2e6767a7 Mon Sep 17 00:00:00 2001 From: Michael Albert Date: Thu, 11 Feb 2021 21:26:23 +0100 Subject: [PATCH 10/15] Bump version to 0.7.0 Change-Id: I5b854ae8720c12e0895c2c614f4c02f1257c0d09 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 6e599ee..cb9132c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "synapse-admin", - "version": "0.2.1", + "version": "0.7.0", "description": "Admin GUI for the Matrix.org server Synapse", "author": "Awesome Technologies Innovationslabor GmbH", "license": "Apache-2.0", From 536ffc2fbf002d78effc635902a8325927b3a711 Mon Sep 17 00:00:00 2001 From: Dirk Klimpel <5740567+dklimpel@users.noreply.github.com> Date: Mon, 1 Mar 2021 09:26:58 +0100 Subject: [PATCH 11/15] Disable telemetry which was introduced with react-admin v3.11.0 (#109) --- src/App.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/App.js b/src/App.js index ec240a5..3afdff8 100644 --- a/src/App.js +++ b/src/App.js @@ -29,6 +29,7 @@ const i18nProvider = polyglotI18nProvider( const App = () => ( Date: Tue, 2 Mar 2021 04:45:05 -0600 Subject: [PATCH 12/15] Name device used by Synapse Admin and hook up logout button (#113) * Name device used by Synapse Admin * Actually logout when the logout button is pressed so that old sessions get deleted * Fix lint --- src/synapse/authProvider.js | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/src/synapse/authProvider.js b/src/synapse/authProvider.js index 30ce600..11db5f0 100644 --- a/src/synapse/authProvider.js +++ b/src/synapse/authProvider.js @@ -10,6 +10,7 @@ const authProvider = { type: "m.login.password", user: username, password: password, + initial_device_display_name: "Synapse Admin", }), }; @@ -30,9 +31,24 @@ const authProvider = { }, // called when the user clicks on the logout button logout: () => { - console.log("logout "); - localStorage.removeItem("access_token"); - return Promise.resolve(); + console.log("logout"); + + const logout_api_url = + localStorage.getItem("base_url") + "/_matrix/client/r0/logout"; + const token = localStorage.getItem("access_token"); + + const options = { + method: "POST", + user: { + authenticated: true, + token: `Bearer ${token}`, + }, + }; + + return fetchUtils.fetchJson(logout_api_url, options).then(({ json }) => { + localStorage.removeItem("access_token"); + localStorage.removeItem("device_id"); + }); }, // called when the API returns an error checkError: ({ status }) => { From 96d2c967400c6ee648bb6520bbcea05ff795e514 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 11 Mar 2021 13:29:43 +0100 Subject: [PATCH 13/15] Bump elliptic from 6.5.3 to 6.5.4 (#122) Bumps [elliptic](https://github.com/indutny/elliptic) from 6.5.3 to 6.5.4. - [Release notes](https://github.com/indutny/elliptic/releases) - [Commits](https://github.com/indutny/elliptic/compare/v6.5.3...v6.5.4) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- yarn.lock | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/yarn.lock b/yarn.lock index 1b9b64e..0a394ab 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2643,10 +2643,10 @@ bluebird@^3.5.5: resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.7.2.tgz#9f229c15be272454ffa973ace0dbee79a1b0c36f" integrity sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg== -bn.js@^4.0.0, bn.js@^4.1.0, bn.js@^4.4.0: - version "4.11.9" - resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-4.11.9.tgz#26d556829458f9d1e81fc48952493d0ba3507828" - integrity sha512-E6QoYqCKZfgatHTdHzs1RRKP7ip4vvm+EyRUeE2RF0NblwVvb0p6jSVeNTOFxPn26QXN2o6SMfNxKp6kU8zQaw== +bn.js@^4.0.0, bn.js@^4.1.0, bn.js@^4.11.9: + version "4.12.0" + resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-4.12.0.tgz#775b3f278efbb9718eec7361f483fb36fbbfea88" + integrity sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA== bn.js@^5.0.0, bn.js@^5.1.1: version "5.1.3" @@ -2717,7 +2717,7 @@ braces@~3.0.2: dependencies: fill-range "^7.0.1" -brorand@^1.0.1: +brorand@^1.0.1, brorand@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/brorand/-/brorand-1.1.0.tgz#12c25efe40a45e3c323eb8675a0a0ce57b22371f" integrity sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8= @@ -4207,17 +4207,17 @@ electron-to-chromium@^1.3.378, electron-to-chromium@^1.3.591: integrity sha512-nLO2Wd2yU42eSoNJVQKNf89CcEGqeFZd++QsnN2XIgje1s/19AgctfjLIbPORlvcCO8sYjLwX4iUgDdusOY8Sg== elliptic@^6.5.3: - version "6.5.3" - resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-6.5.3.tgz#cb59eb2efdaf73a0bd78ccd7015a62ad6e0f93d6" - integrity sha512-IMqzv5wNQf+E6aHeIqATs0tOLeOTwj1QKbRcS3jBbYkl5oLAserA8yJTT7/VyHUYG91PRmPyeQDObKLPpeS4dw== + version "6.5.4" + resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-6.5.4.tgz#da37cebd31e79a1367e941b592ed1fbebd58abbb" + integrity sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ== dependencies: - bn.js "^4.4.0" - brorand "^1.0.1" + bn.js "^4.11.9" + brorand "^1.1.0" hash.js "^1.0.0" - hmac-drbg "^1.0.0" - inherits "^2.0.1" - minimalistic-assert "^1.0.0" - minimalistic-crypto-utils "^1.0.0" + hmac-drbg "^1.0.1" + inherits "^2.0.4" + minimalistic-assert "^1.0.1" + minimalistic-crypto-utils "^1.0.1" emoji-regex@^7.0.1, emoji-regex@^7.0.2: version "7.0.3" @@ -5528,7 +5528,7 @@ history@^4.9.0: tiny-warning "^1.0.0" value-equal "^1.0.1" -hmac-drbg@^1.0.0: +hmac-drbg@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/hmac-drbg/-/hmac-drbg-1.0.1.tgz#d2745701025a6c775a6c545793ed502fc0c649a1" integrity sha1-0nRXAQJabHdabFRXk+1QL8DGSaE= @@ -7468,7 +7468,7 @@ minimalistic-assert@^1.0.0, minimalistic-assert@^1.0.1: resolved "https://registry.yarnpkg.com/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz#2e194de044626d4a10e7f7fbc00ce73e83e4d5c7" integrity sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A== -minimalistic-crypto-utils@^1.0.0, minimalistic-crypto-utils@^1.0.1: +minimalistic-crypto-utils@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz#f6c00c1c0b082246e5c4d99dfb8c7c083b2b582a" integrity sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo= From 8ff0ac913cadd4c18a0ac3c367751326bbb0b72f Mon Sep 17 00:00:00 2001 From: Michael Albert Date: Tue, 16 Mar 2021 12:12:54 +0100 Subject: [PATCH 14/15] Add missing translations Change-Id: Ie46554bcd10dde771c03e7d3fd0c3639f904429d --- src/i18n/de.js | 4 ++++ src/i18n/en.js | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/i18n/de.js b/src/i18n/de.js index f20ef18..2f49344 100644 --- a/src/i18n/de.js +++ b/src/i18n/de.js @@ -276,6 +276,10 @@ export default { }, ra: { ...germanMessages.ra, + action: { + ...germanMessages.ra.action, + unselect: "Abwählen", + }, auth: { ...germanMessages.ra.auth, auth_check_error: "Anmeldung fehlgeschlagen", diff --git a/src/i18n/en.js b/src/i18n/en.js index bb3ac3b..1cf3033 100644 --- a/src/i18n/en.js +++ b/src/i18n/en.js @@ -6,6 +6,7 @@ export default { auth: { base_url: "Homeserver URL", welcome: "Welcome to Synapse-admin", + server_version: "Synapse version", username_error: "Please enter fully qualified user ID: '@user:domain'", protocol_error: "URL has to start with 'http://' or 'https://'", url_error: "Not a valid Matrix server URL", @@ -139,7 +140,7 @@ export default { name: "Name", canonical_alias: "Alias", joined_members: "Members", - joined_local_members: "local members", + joined_local_members: "Local members", state_events: "State events", version: "Version", is_encrypted: "Encrypted", From c6b6e54617265490f9516e095abe40086f5b33df Mon Sep 17 00:00:00 2001 From: Dirk Klimpel <5740567+dklimpel@users.noreply.github.com> Date: Tue, 16 Mar 2021 12:13:32 +0100 Subject: [PATCH 15/15] Fix broken redirect to login page (#116) --- src/synapse/authProvider.js | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/synapse/authProvider.js b/src/synapse/authProvider.js index 11db5f0..972d599 100644 --- a/src/synapse/authProvider.js +++ b/src/synapse/authProvider.js @@ -35,20 +35,23 @@ const authProvider = { const logout_api_url = localStorage.getItem("base_url") + "/_matrix/client/r0/logout"; - const token = localStorage.getItem("access_token"); + const access_token = localStorage.getItem("access_token"); const options = { method: "POST", user: { authenticated: true, - token: `Bearer ${token}`, + token: `Bearer ${access_token}`, }, }; - return fetchUtils.fetchJson(logout_api_url, options).then(({ json }) => { - localStorage.removeItem("access_token"); - localStorage.removeItem("device_id"); - }); + if (typeof access_token === "string") { + fetchUtils.fetchJson(logout_api_url, options).then(({ json }) => { + localStorage.removeItem("access_token"); + localStorage.removeItem("device_id"); + }); + } + return Promise.resolve(); }, // called when the API returns an error checkError: ({ status }) => { @@ -62,7 +65,7 @@ const authProvider = { checkAuth: () => { const access_token = localStorage.getItem("access_token"); console.log("checkAuth " + access_token); - return typeof access_token == "string" + return typeof access_token === "string" ? Promise.resolve() : Promise.reject(); },