2022-03-22 20:14:42 +03:00
|
|
|
(this["webpackJsonpsynapse-admin"]=this["webpackJsonpsynapse-admin"]||[]).push([[0],{634:function(e,t){},673:function(e,t,r){"use strict";r.r(t);var s=r(0),a=r(23),n=r.n(a),i=r(365),o=r(763),c=r(762),d=r(232),l=r(102),u={login:function(e){var t=e.base_url,r=e.username,s=e.password,a=e.loginToken;t=Object({NODE_ENV:"production",PUBLIC_URL:".",WDS_SOCKET_HOST:void 0,WDS_SOCKET_PATH:void 0,WDS_SOCKET_PORT:void 0,FAST_REFRESH:!0,REACT_APP_VERSION:""}).REACT_APP_SERVER||t,console.log("login ");var n={method:"POST",body:JSON.stringify(Object.assign({device_id:localStorage.getItem("device_id"),initial_device_display_name:"Synapse Admin"},a?{type:"m.login.token",token:a}:{type:"m.login.password",user:r,password:s}))};t=t.replace(/\/+$/g,""),localStorage.setItem("base_url",t);var i=window.decodeURIComponent(t)+"/_matrix/client/r0/login";return l.a.fetchJson(i,n).then((function(e){var t=e.json;localStorage.setItem("home_server",t.home_server),localStorage.setItem("user_id",t.user_id),localStorage.setItem("access_token",t.access_token),localStorage.setItem("device_id",t.device_id)}))},logout:function(){console.log("logout");var e=localStorage.getItem("base_url")+"/_matrix/client/r0/logout",t=localStorage.getItem("access_token"),r={method:"POST",user:{authenticated:!0,token:"Bearer ".concat(t)}};return"string"===typeof t&&l.a.fetchJson(e,r).then((function(e){e.json;localStorage.removeItem("access_token")})),Promise.resolve()},checkError:function(e){var t=e.status;return console.log("checkError "+t),401===t||403===t?Promise.reject():Promise.resolve()},checkAuth:function(){var e=localStorage.getItem("access_token");return console.log("checkAuth "+e),"string"===typeof e?Promise.resolve():Promise.reject()},getPermissions:function(){return Promise.resolve()}},m=r(6),j=r(90),b=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=localStorage.getItem("access_token");return console.log("httpClient "+e),null!=r&&(t.user={authenticated:!0,token:"Bearer ".concat(r)}),l.a.fetchJson(e,t)},p=function(e){var t=localStorage.getItem("base_url"),r=/^mxc:\/\/([^/]+)\/(\w+)/.exec(e);if(console.log("mxcClient "+r),null==r)return null;var s=r[1],a=r[2];return"".concat(t,"/_matrix/media/r0/thumbnail/").concat(s,"/").concat(a,"?width=24&height=24&method=scale")},_={users:{path:"/_synapse/admin/v2/users",map:function(e){return Object(m.a)(Object(m.a)({},e),{},{id:e.name,avatar_src:p(e.avatar_url),is_guest:!!e.is_guest,admin:!!e.admin,deactivated:!!e.deactivated,creation_ts_ms:1e3*e.creation_ts})},data:"users",total:function(e){return e.total},create:function(e){return{endpoint:"/_synapse/admin/v2/users/@".concat(e.id,":").concat(localStorage.getItem("home_server")),body:e,method:"PUT"}},delete:function(e){return{endpoint:"/_synapse/admin/v1/deactivate/".concat(e.id),body:{erase:!0},method:"POST"}}},rooms:{path:"/_synapse/admin/v1/rooms",map:function(e){return Object(m.a)(Object(m.a)({},e),{},{id:e.room_id,alias:e.canonical_alias,members:e.joined_members,is_encrypted:!!e.encryption,federatable:!!e.federatable,public:!!e.public})},data:"rooms",total:function(e){return e.total_rooms},delete:function(e){return{endpoint:"/_synapse/admin/v1/rooms/".concat(e.id),body:{block:!1}}}},reports:{path:"/_synapse/admin/v1/event_reports",map:function(e){return Object(m.a)(Object(m.a)({},e),{},{id:e.id})},data:"event_reports",total:function(e){return e.total}},devices:{map:function(e){return Object(m.a)(Object(m.a)({},e),{},{id:e.device_id})},data:"devices",total:function(e){return e.total},reference:function(e){return{endpoint:"/_synapse/admin/v2/users/".concat(e,"/devices")}},delete:function(e){return{endpoint:"/_synapse/admin/v2/users/".concat(e.user_id,"/devices/").concat(e.id)}}},connections:{path:"/_synapse/admin/v1/whois",map:function(e){return Object(m.a)(Object(m.a)({},e),{},{id:e.user_id})},data:"connections"},room_members:{map:function(e){return{id:e}},reference:function(e){return{endpoint:"/_synapse/admin/v1/rooms/".concat(e,"/members")}},data:"members",total:function(e){return e.total}},room_state:{map:function(e){return Object(m.a)(Ob
|