Update frontend dependencies

This commit is contained in:
Tulir Asokan 2021-06-11 11:57:40 +03:00
parent b2018d9ae9
commit a685448887
13 changed files with 4631 additions and 4498 deletions

View file

@ -13,15 +13,15 @@
},
"homepage": ".",
"dependencies": {
"node-sass": "^4.12.0",
"react": "^16.8.6",
"react-ace": "^9.0.0",
"react-contextmenu": "^2.11.0",
"react-dom": "^16.8.6",
"react-json-tree": "^0.11.2",
"react-router-dom": "^5.0.1",
"react-scripts": "3.4.1",
"react-select": "^3.0.4"
"sass": "^1.34.1",
"react": "^17.0.2",
"react-ace": "^9.4.1",
"react-contextmenu": "^2.14.0",
"react-dom": "^17.0.2",
"react-json-tree": "^0.15.0",
"react-router-dom": "^5.2.0",
"react-scripts": "4.0.3",
"react-select": "^4.3.1"
},
"scripts": {
"start": "react-scripts start",
@ -30,16 +30,11 @@
"eject": "react-scripts eject"
},
"browserslist": [
"last 5 firefox versions",
"last 3 and_ff versions",
"last 5 chrome versions",
"last 3 and_chr versions",
"last 2 safari versions",
"last 2 ios_saf versions"
],
"devDependencies": {
"sass-lint": "^1.13.1",
"sass-lint-auto-fix": "^0.21.0",
"@babel/helper-call-delegate": "^7.10.4"
}
"last 2 firefox versions",
"last 2 and_ff versions",
"last 2 chrome versions",
"last 2 and_chr versions",
"last 1 safari versions",
"last 1 ios_saf versions"
]
}

View file

@ -244,6 +244,7 @@ export async function doClientAuth(server, type, username, password) {
return await resp.json()
}
// eslint-disable-next-line import/no-anonymous-default-export
export default {
login, ping, setBasePath, getFeatures, remoteGetFeatures,
openLogSocket,

View file

@ -1,5 +1,5 @@
// maubot - A plugin-based Matrix bot system.
// Copyright (C) 2019 Tulir Asokan
// Copyright (C) 2021 Tulir Asokan
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
@ -57,7 +57,9 @@ export const PrefSwitch = ({ rowName, active, origActive, fullWidth = false, ...
</PrefRow>
)
export const PrefSelect = ({ rowName, value, origValue, fullWidth = false, creatable = false, ...args }) => (
export const PrefSelect = ({
rowName, value, origValue, fullWidth = false, creatable = false, ...args
}) => (
<PrefRow name={rowName} fullWidth={fullWidth} labelFor={rowName}
changed={origValue !== undefined && value.id !== origValue}>
{creatable

View file

@ -1,5 +1,5 @@
// maubot - A plugin-based Matrix bot system.
// Copyright (C) 2019 Tulir Asokan
// Copyright (C) 2021 Tulir Asokan
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
@ -23,10 +23,12 @@ class Switch extends Component {
}
}
componentWillReceiveProps(nextProps) {
this.setState({
active: nextProps.active,
})
componentDidUpdate(prevProps) {
if (prevProps.active !== this.props.active) {
this.setState({
active: this.props.active,
})
}
}
toggle = () => {

View file

@ -1,5 +1,5 @@
// maubot - A plugin-based Matrix bot system.
// Copyright (C) 2019 Tulir Asokan
// Copyright (C) 2021 Tulir Asokan
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
@ -30,7 +30,7 @@ class Main extends Component {
}
}
async componentWillMount() {
async componentDidMount() {
await this.getBasePath()
if (localStorage.accessToken) {
await this.ping()
@ -43,7 +43,7 @@ class Main extends Component {
async getBasePath() {
try {
const resp = await fetch(process.env.PUBLIC_URL + "/paths.json", {
headers: { "Content-Type": "application/json" }
headers: { "Content-Type": "application/json" },
})
const apiPathJson = await resp.json()
const apiPath = apiPathJson.api_path

View file

@ -1,3 +1,18 @@
// maubot - A plugin-based Matrix bot system.
// Copyright (C) 2021 Tulir Asokan
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
import React, { Component } from "react"
import { Link } from "react-router-dom"
import api from "../../api"
@ -8,7 +23,7 @@ class BaseMainView extends Component {
this.state = Object.assign(this.initialState, props.entry)
}
componentWillReceiveProps(nextProps) {
UNSAFE_componentWillReceiveProps(nextProps) {
const newState = Object.assign(this.initialState, nextProps.entry)
for (const key of this.entryKeys) {
if (this.props.entry[key] === nextProps.entry[key]) {

View file

@ -1,5 +1,5 @@
// maubot - A plugin-based Matrix bot system.
// Copyright (C) 2019 Tulir Asokan
// Copyright (C) 2021 Tulir Asokan
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
@ -64,7 +64,7 @@ class Client extends BaseMainView {
get entryKeys() {
return ["id", "displayname", "homeserver", "avatar_url", "access_token", "sync",
"autojoin", "online", "enabled", "started"]
"autojoin", "online", "enabled", "started"]
}
get initialState() {
@ -106,7 +106,7 @@ class Client extends BaseMainView {
get selectedHomeserver() {
return this.state.homeserver
? this.homeserverEntry([this.props.ctx.homeserversByURL[this.state.homeserver],
this.state.homeserver])
this.state.homeserver])
: {}
}
@ -116,13 +116,14 @@ class Client extends BaseMainView {
label: serverName || serverURL,
}
componentWillReceiveProps(nextProps) {
super.componentWillReceiveProps(nextProps)
componentDidUpdate(prevProps) {
this.updateHomeserverOptions()
}
updateHomeserverOptions() {
this.homeserverOptions = Object.entries(this.props.ctx.homeserversByName).map(this.homeserverEntry)
this.homeserverOptions = Object
.entries(this.props.ctx.homeserversByName)
.map(this.homeserverEntry)
}
isValidHomeserver(value) {
@ -186,7 +187,8 @@ class Client extends BaseMainView {
}
get loading() {
return this.state.saving || this.state.startingOrStopping || this.clearingCache || this.state.deleting
return this.state.saving || this.state.startingOrStopping
|| this.clearingCache || this.state.deleting
}
renderStartedContainer = () => {
@ -211,7 +213,8 @@ class Client extends BaseMainView {
}
get avatarMXC() {
return this.state.avatar_url === "disable" ? this.props.entry.remote_avatar_url : this.state.avatar_url
return this.state.avatar_url === "disable"
? this.props.entry.remote_avatar_url : this.state.avatar_url
}
get avatarURL() {

View file

@ -1,5 +1,5 @@
// maubot - A plugin-based Matrix bot system.
// Copyright (C) 2019 Tulir Asokan
// Copyright (C) 2021 Tulir Asokan
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
@ -69,8 +69,7 @@ class Instance extends BaseMainView {
return instance
}
componentWillReceiveProps(nextProps) {
super.componentWillReceiveProps(nextProps)
componentDidUpdate(prevProps) {
this.updateClientOptions()
}
@ -95,8 +94,8 @@ class Instance extends BaseMainView {
: <NoAvatarIcon className='avatar'/>}
<span className="displayname">{
(client.displayname === "disable"
? client.remote_displayname
: client.displayname
? client.remote_displayname
: client.displayname
) || client.id
}</span>
</div>

View file

@ -1,5 +1,5 @@
// maubot - A plugin-based Matrix bot system.
// Copyright (C) 2019 Tulir Asokan
// Copyright (C) 2021 Tulir Asokan
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
@ -50,7 +50,7 @@ class InstanceDatabase extends Component {
this.order = new Map()
}
async componentWillMount() {
async componentDidMount() {
const tables = new Map(Object.entries(await api.getInstanceDatabase(this.props.instanceID)))
for (const [name, table] of tables) {
table.name = name

View file

@ -1,5 +1,5 @@
// maubot - A plugin-based Matrix bot system.
// Copyright (C) 2019 Tulir Asokan
// Copyright (C) 2021 Tulir Asokan
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
@ -42,7 +42,7 @@ class LogEntry extends PureComponent {
return <>
{req.method} {req.path}
<div className="content">
{Object.entries(req.content).length > 0
{Object.entries(req.content || {}).length > 0
&& <JSONTree data={{ content: req.content }} hideRoot={true}/>}
</div>
</>

View file

@ -1,5 +1,5 @@
// maubot - A plugin-based Matrix bot system.
// Copyright (C) 2019 Tulir Asokan
// Copyright (C) 2021 Tulir Asokan
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
@ -51,7 +51,7 @@ class Dashboard extends Component {
}
}
async componentWillMount() {
async componentDidMount() {
const [instanceList, clientList, pluginList, homeservers] = await Promise.all([
api.getInstances(), api.getClients(), api.getPlugins(), api.getClientAuthServers(),
api.updateDebugOpenFileEnabled()])

View file

@ -1,5 +1,5 @@
// maubot - A plugin-based Matrix bot system.
// Copyright (C) 2019 Tulir Asokan
// Copyright (C) 2021 Tulir Asokan
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
@ -18,69 +18,72 @@ div.log
width: 100%
overflow: auto
> div.lines
text-align: left
font-size: 12px
max-height: 100%
min-width: 100%
font-family: "Fira Code", monospace
display: table
div.log > div.lines
text-align: left
font-size: 12px
max-height: 100%
min-width: 100%
font-family: "Fira Code", monospace
display: table
> div.row
display: table-row
white-space: pre
div.log > div.lines > div.row
display: table-row
white-space: pre
&.debug
background-color: $background
&.trace
opacity: .75
&:nth-child(odd)
background-color: $background-dark
&.debug, &.trace
background-color: $background
&.info
background-color: #AAFAFA
&:nth-child(odd)
background-color: $background-dark
&:nth-child(odd)
background-color: #66FAFA
&.info
background-color: #AAFAFA
&.warning, &.warn
background-color: #FABB77
&:nth-child(odd)
background-color: #66FAFA
&:nth-child(odd)
background-color: #FAAA55
&.warning, &.warn
background-color: #FABB77
&.error
background-color: #FAAAAA
&:nth-child(odd)
background-color: #FAAA55
&:nth-child(odd)
background-color: #FA9999
&.error
background-color: #FAAAAA
&.fatal
background-color: #CC44CC
&:nth-child(odd)
background-color: #FA9999
&:nth-child(odd)
background-color: #AA44AA
&.fatal
background-color: #CC44CC
&.unfocused
opacity: .25
&:nth-child(odd)
background-color: #AA44AA
> span
padding: .125rem .25rem
display: table-cell
&.unfocused
opacity: .25
&:first-child
padding-left: 0
> span
padding: .125rem .25rem
display: table-cell
&:last-child
padding-right: 0
&:first-child
padding-left: 0
a
color: inherit
text-decoration: none
&:last-child
padding-right: 0
&:hover
text-decoration: underline
a
color: inherit
text-decoration: none
> span.text
> div.content > *
background-color: inherit !important
margin: 0 !important
&:hover
text-decoration: underline
> span.text
> div.content > *
background-color: inherit !important
margin: 0 !important

File diff suppressed because it is too large Load diff