diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 6adf818..2d3bd11 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -2,13 +2,16 @@ name: Go on: [push, pull_request] +env: + GOTOOLCHAIN: local + jobs: lint: runs-on: ubuntu-latest strategy: matrix: - go-version: ["1.23"] - name: Lint Go ${{ matrix.go-version == '1.23' && '(latest)' || '(old)' }} + go-version: ["1.23", "1.24"] + name: Lint Go ${{ matrix.go-version == '1.24' && '(latest)' || '(old)' }} steps: - uses: actions/checkout@v4 diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e1c09a7..2fd3ac1 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -13,6 +13,9 @@ cache: paths: - .cache +variables: + GOTOOLCHAIN: local + frontend: image: node:22-alpine stage: frontend diff --git a/Dockerfile.ci b/Dockerfile.ci index 7513497..24441d1 100644 --- a/Dockerfile.ci +++ b/Dockerfile.ci @@ -1,6 +1,6 @@ FROM alpine:3.21 -RUN apk add --no-cache ca-certificates jq curl +RUN apk add --no-cache ca-certificates jq curl ffmpeg ARG EXECUTABLE=./gomuks COPY $EXECUTABLE /usr/bin/gomuks diff --git a/desktop/go.mod b/desktop/go.mod index 2e38a85..e7919b3 100644 --- a/desktop/go.mod +++ b/desktop/go.mod @@ -2,13 +2,13 @@ module go.mau.fi/gomuks/desktop go 1.23.0 -toolchain go1.23.3 +toolchain go1.23.5 -require github.com/wailsapp/wails/v3 v3.0.0-alpha.8.3 +require github.com/wailsapp/wails/v3 v3.0.0-alpha.9 require ( - go.mau.fi/gomuks v0.3.1 - go.mau.fi/util v0.8.4-0.20250106152331-30b8c95e7d7a + go.mau.fi/gomuks v0.4.0 + go.mau.fi/util v0.8.6-0.20250227184636-7ff63b0b9d95 ) require ( @@ -25,6 +25,7 @@ require ( github.com/coder/websocket v1.8.12 // indirect github.com/coreos/go-systemd/v22 v22.5.0 // indirect github.com/cyphar/filepath-securejoin v0.2.5 // indirect + github.com/disintegration/imaging v1.6.2 // indirect github.com/dlclark/regexp2 v1.11.4 // indirect github.com/ebitengine/purego v0.4.0-alpha.4 // indirect github.com/emirpasic/gods v1.18.1 // indirect @@ -43,10 +44,10 @@ require ( github.com/leaanthony/u v1.1.0 // indirect github.com/lmittmann/tint v1.0.4 // indirect github.com/lucasb-eyer/go-colorful v1.2.0 // indirect - github.com/mattn/go-colorable v0.1.13 // indirect + github.com/mattn/go-colorable v0.1.14 // indirect github.com/mattn/go-isatty v0.0.20 // indirect github.com/mattn/go-sqlite3 v1.14.24 // indirect - github.com/petermattis/goid v0.0.0-20241211131331-93ee7e083c43 // indirect + github.com/petermattis/goid v0.0.0-20250211185408-f2b9d978cd7a // indirect github.com/pjbgf/sha1cd v0.3.0 // indirect github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 // indirect github.com/rivo/uniseg v0.4.7 // indirect @@ -57,26 +58,28 @@ require ( github.com/skeema/knownhosts v1.2.2 // indirect github.com/tidwall/gjson v1.18.0 // indirect github.com/tidwall/match v1.1.1 // indirect - github.com/tidwall/pretty v1.2.0 // indirect + github.com/tidwall/pretty v1.2.1 // indirect github.com/tidwall/sjson v1.2.5 // indirect - github.com/wailsapp/go-webview2 v1.0.18 // indirect + github.com/wailsapp/go-webview2 v1.0.19 // indirect github.com/wailsapp/mimetype v1.4.1 // indirect github.com/xanzy/ssh-agent v0.3.3 // indirect github.com/yuin/goldmark v1.7.8 // indirect + go.mau.fi/webp v0.2.0 // indirect go.mau.fi/zeroconfig v0.1.3 // indirect - golang.org/x/crypto v0.32.0 // indirect - golang.org/x/exp v0.0.0-20250103183323-7d7fa50e5329 // indirect - golang.org/x/image v0.23.0 // indirect - golang.org/x/mod v0.22.0 // indirect - golang.org/x/net v0.33.0 // indirect - golang.org/x/sync v0.10.0 // indirect - golang.org/x/sys v0.29.0 // indirect - golang.org/x/text v0.21.0 // indirect - golang.org/x/tools v0.28.0 // indirect + golang.org/x/crypto v0.34.0 // indirect + golang.org/x/exp v0.0.0-20250215185904-eff6e970281f // indirect + golang.org/x/image v0.24.0 // indirect + golang.org/x/mod v0.23.0 // indirect + golang.org/x/net v0.35.0 // indirect + golang.org/x/sync v0.11.0 // indirect + golang.org/x/sys v0.30.0 // indirect + golang.org/x/text v0.22.0 // indirect + golang.org/x/tools v0.30.0 // indirect + gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect gopkg.in/warnings.v0 v0.1.2 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect - maunium.net/go/mautrix v0.22.2-0.20250106152426-68eaa9d1df1f // indirect + maunium.net/go/mautrix v0.23.2-0.20250304004736-7d3791ace3b7 // indirect mvdan.cc/xurls/v2 v2.6.0 // indirect ) diff --git a/desktop/go.sum b/desktop/go.sum index c0fdeb3..9b6e2b7 100644 --- a/desktop/go.sum +++ b/desktop/go.sum @@ -44,6 +44,8 @@ github.com/cyphar/filepath-securejoin v0.2.5/go.mod h1:aPGpWjXOXUn2NCNjFvBE6aRxG github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/disintegration/imaging v1.6.2 h1:w1LecBlG2Lnp8B3jk5zSuNqd7b4DXhcjwek1ei82L+c= +github.com/disintegration/imaging v1.6.2/go.mod h1:44/5580QXChDfwIclfc/PCwrr44amcmDAg8hxG0Ewe4= github.com/dlclark/regexp2 v1.11.4 h1:rPYF9/LECdNymJufQKmri9gV604RvvABwgOA8un7yAo= github.com/dlclark/regexp2 v1.11.4/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8= github.com/ebitengine/purego v0.4.0-alpha.4 h1:Y7yIV06Yo5M2BAdD7EVPhfp6LZ0tEcQo5770OhYUVes= @@ -100,8 +102,9 @@ github.com/lucasb-eyer/go-colorful v1.2.0 h1:1nnpGOrhyZZuNyfu1QjKiUICQ74+3FNCN69 github.com/lucasb-eyer/go-colorful v1.2.0/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0= github.com/matryer/is v1.4.0 h1:sosSmIWwkYITGrxZ25ULNDeKiMNzFSr4V/eqBQP0PeE= github.com/matryer/is v1.4.0/go.mod h1:8I/i5uYgLzgsgEloJE1U6xx5HkBQpAZvepWuujKwMRU= -github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= +github.com/mattn/go-colorable v0.1.14 h1:9A9LHSqF/7dyVVX6g0U9cwm9pG3kP9gSzcuIPHPsaIE= +github.com/mattn/go-colorable v0.1.14/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8= github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= @@ -110,8 +113,8 @@ github.com/mattn/go-sqlite3 v1.14.24 h1:tpSp2G2KyMnnQu99ngJ47EIkWVmliIizyZBfPrBW github.com/mattn/go-sqlite3 v1.14.24/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y= github.com/onsi/gomega v1.34.1 h1:EUMJIKUjM8sKjYbtxQI9A4z2o+rruxnzNvpknOXie6k= github.com/onsi/gomega v1.34.1/go.mod h1:kU1QgUvBDLXBJq618Xvm2LUX6rSAfRaFRTcdOeDLwwY= -github.com/petermattis/goid v0.0.0-20241211131331-93ee7e083c43 h1:ah1dvbqPMN5+ocrg/ZSgZ6k8bOk+kcZQ7fnyx6UvOm4= -github.com/petermattis/goid v0.0.0-20241211131331-93ee7e083c43/go.mod h1:pxMtw7cyUw6B2bRH0ZBANSPg+AoSud1I1iyJHI69jH4= +github.com/petermattis/goid v0.0.0-20250211185408-f2b9d978cd7a h1:ckxP/kGzsxvxXo8jO6E/0QJ8MMmwI7IRj4Fys9QbAZA= +github.com/petermattis/goid v0.0.0-20250211185408-f2b9d978cd7a/go.mod h1:pxMtw7cyUw6B2bRH0ZBANSPg+AoSud1I1iyJHI69jH4= github.com/pjbgf/sha1cd v0.3.0 h1:4D5XXmUUBUl/xQ6IjCkEAbqXskkq/4O7LmGn0AqMDs4= github.com/pjbgf/sha1cd v0.3.0/go.mod h1:nZ1rrWOcGJ5uZgEEVL1VUM9iRQiZvWdbZjkKyFzPPsI= github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 h1:KoWmjvw+nsYOo29YJK9vDA65RGE3NrOnUtO7a+RF9HU= @@ -147,23 +150,26 @@ github.com/tidwall/gjson v1.18.0 h1:FIDeeyB800efLX89e5a8Y0BNH+LOngJyGrIWxG2FKQY= github.com/tidwall/gjson v1.18.0/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA= github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM= -github.com/tidwall/pretty v1.2.0 h1:RWIZEg2iJ8/g6fDDYzMpobmaoGh5OLl4AXtGUGPcqCs= github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU= +github.com/tidwall/pretty v1.2.1 h1:qjsOFOWWQl+N3RsoF5/ssm1pHmJJwhjlSbZ51I6wMl4= +github.com/tidwall/pretty v1.2.1/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU= github.com/tidwall/sjson v1.2.5 h1:kLy8mja+1c9jlljvWTlSazM7cKDRfJuR/bOJhcY5NcY= github.com/tidwall/sjson v1.2.5/go.mod h1:Fvgq9kS/6ociJEDnK0Fk1cpYF4FIW6ZF7LAe+6jwd28= -github.com/wailsapp/go-webview2 v1.0.18 h1:SSSCoLA+MYikSp1U0WmvELF/4c3x5kH8Vi31TKyZ4yk= -github.com/wailsapp/go-webview2 v1.0.18/go.mod h1:qJmWAmAmaniuKGZPWwne+uor3AHMB5PFhqiK0Bbj8kc= +github.com/wailsapp/go-webview2 v1.0.19 h1:7U3QcDj1PrBPaxJNCui2k1SkWml+Q5kvFUFyTImA6NU= +github.com/wailsapp/go-webview2 v1.0.19/go.mod h1:qJmWAmAmaniuKGZPWwne+uor3AHMB5PFhqiK0Bbj8kc= github.com/wailsapp/mimetype v1.4.1 h1:pQN9ycO7uo4vsUUuPeHEYoUkLVkaRntMnHJxVwYhwHs= github.com/wailsapp/mimetype v1.4.1/go.mod h1:9aV5k31bBOv5z6u+QP8TltzvNGJPmNJD4XlAL3U+j3o= -github.com/wailsapp/wails/v3 v3.0.0-alpha.8.3 h1:9aCL0IXD60A5iscQ/ps6f3ti3IlaoG6LQe0RZ9JkueU= -github.com/wailsapp/wails/v3 v3.0.0-alpha.8.3/go.mod h1:9Ca1goy5oqxmy8Oetb8Tchkezcx4tK03DK+SqYByu5Y= +github.com/wailsapp/wails/v3 v3.0.0-alpha.9 h1:b8CfRrhPno8Fra0xFp4Ifyj+ogmXBc35rsQWvcrHtsI= +github.com/wailsapp/wails/v3 v3.0.0-alpha.9/go.mod h1:dSv6s722nSWaUyUiapAM1DHc5HKggNGY1a79shO85/g= github.com/xanzy/ssh-agent v0.3.3 h1:+/15pJfg/RsTxqYcX6fHqOXZwwMP+2VyYWJeWM2qQFM= github.com/xanzy/ssh-agent v0.3.3/go.mod h1:6dzNDKs0J9rVPHPhaGCukekBHKqfl+L3KghI1Bc68Uw= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= github.com/yuin/goldmark v1.7.8 h1:iERMLn0/QJeHFhxSt3p6PeN9mGnvIKSpG9YYorDMnic= github.com/yuin/goldmark v1.7.8/go.mod h1:uzxRWxtg69N339t3louHJ7+O03ezfj6PlliRlaOzY1E= -go.mau.fi/util v0.8.4-0.20250106152331-30b8c95e7d7a h1:D9RCHBFjxah9F/YB7amvRJjT2IEOFWcz8jpcEY8dBV0= -go.mau.fi/util v0.8.4-0.20250106152331-30b8c95e7d7a/go.mod h1:MOfGTs1CBuK6ERTcSL4lb5YU7/ujz09eOPVEDckuazY= +go.mau.fi/util v0.8.6-0.20250227184636-7ff63b0b9d95 h1:5EfVWWjU2Hte9uE6B/hBgvjnVfBx/7SYDZBnsuo+EBs= +go.mau.fi/util v0.8.6-0.20250227184636-7ff63b0b9d95/go.mod h1:Ycug9mrbztlahHPEJ6H5r8Nu/xqZaWbE5vPHVWmfz6M= +go.mau.fi/webp v0.2.0 h1:QVMenHw7JDb4vall5sV75JNBQj9Hw4u8AKbi1QetHvg= +go.mau.fi/webp v0.2.0/go.mod h1:VSg9MyODn12Mb5pyG0NIyNFhujrmoFSsZBs8syOZD1Q= go.mau.fi/zeroconfig v0.1.3 h1:As9wYDKmktjmNZW5i1vn8zvJlmGKHeVxHVIBMXsm4kM= go.mau.fi/zeroconfig v0.1.3/go.mod h1:NcSJkf180JT+1IId76PcMuLTNa1CzsFFZ0nBygIQM70= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= @@ -171,16 +177,17 @@ golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5y golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.3.1-0.20221117191849-2c476679df9a/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= -golang.org/x/crypto v0.32.0 h1:euUpcYgM8WcP71gNpTqQCn6rC2t6ULUPiOzfWaXVVfc= -golang.org/x/crypto v0.32.0/go.mod h1:ZnnJkOaASj8g0AjIduWNlq2NRxL0PlBrbKVyZ6V/Ugc= -golang.org/x/exp v0.0.0-20250103183323-7d7fa50e5329 h1:9kj3STMvgqy3YA4VQXBrN7925ICMxD5wzMRcgA30588= -golang.org/x/exp v0.0.0-20250103183323-7d7fa50e5329/go.mod h1:qj5a5QZpwLU2NLQudwIN5koi3beDhSAlJwa67PuM98c= -golang.org/x/image v0.23.0 h1:HseQ7c2OpPKTPVzNjG5fwJsOTCiiwS4QdsYi5XU6H68= -golang.org/x/image v0.23.0/go.mod h1:wJJBTdLfCCf3tiHa1fNxpZmUI4mmoZvwMCPP0ddoNKY= +golang.org/x/crypto v0.34.0 h1:+/C6tk6rf/+t5DhUketUbD1aNGqiSX3j15Z6xuIDlBA= +golang.org/x/crypto v0.34.0/go.mod h1:dy7dXNW32cAb/6/PRuTNsix8T+vJAqvuIy5Bli/x0YQ= +golang.org/x/exp v0.0.0-20250215185904-eff6e970281f h1:oFMYAjX0867ZD2jcNiLBrI9BdpmEkvPyi5YrBGXbamg= +golang.org/x/exp v0.0.0-20250215185904-eff6e970281f/go.mod h1:BHOTPb3L19zxehTsLoJXVaTktb06DFgmdW6Wb9s8jqk= +golang.org/x/image v0.0.0-20191009234506-e7c1f5e7dbb8/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= +golang.org/x/image v0.24.0 h1:AN7zRgVsbvmTfNyqIbbOraYL8mSwcKncEj8ofjgzcMQ= +golang.org/x/image v0.24.0/go.mod h1:4b/ITuLfqYq1hqZcjofwctIhi7sZh2WaCjvsBNjjya8= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/mod v0.22.0 h1:D4nJWe9zXqHOmWqj4VMOJhvzj7bEZg4wEYa759z1pH4= -golang.org/x/mod v0.22.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY= +golang.org/x/mod v0.23.0 h1:Zb7khfcRGKk+kqfxFaP5tZqCnDZMjC5VtUBs87Hr6QM= +golang.org/x/mod v0.23.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210505024714-0287a6fb4125/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= @@ -189,13 +196,13 @@ golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= -golang.org/x/net v0.33.0 h1:74SYHlV8BIgHIFC/LrYkOGIwL19eTYXQ5wc6TBuO36I= -golang.org/x/net v0.33.0/go.mod h1:HXLR5J+9DxmrqMwG9qjGCxZ+zKXxBru04zlTvWlWuN4= +golang.org/x/net v0.35.0 h1:T5GQRQb2y08kTAByq9L4/bz8cipCdA8FbRTXewonqY8= +golang.org/x/net v0.35.0/go.mod h1:EglIi67kWsHKlRzzVMUD93VMSWGFOMSZgxFjparz1Qk= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.10.0 h1:3NQrjDixjgGwUOCaF8w2+VYHv0Ve/vGYSbdkTa98gmQ= -golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.11.0 h1:GGz8+XQP4FvTTrjZPzNKTMFtSXH80RAzG+5ghFPgK9w= +golang.org/x/sync v0.11.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200810151505-1b9f1253b3ed/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -215,15 +222,15 @@ golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.29.0 h1:TPYlXGxvx1MGTn2GiZDhnjPA9wZzZeGKHHmKhHYvgaU= -golang.org/x/sys v0.29.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.30.0 h1:QjkSwP/36a20jFYWkSue1YwXzLmsV5Gfq7Eiy72C1uc= +golang.org/x/sys v0.30.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U= -golang.org/x/term v0.28.0 h1:/Ts8HFuMR2E6IP/jlo7QVLZHggjKQbhu/7H0LJFr3Gg= -golang.org/x/term v0.28.0/go.mod h1:Sw/lC2IAUZ92udQNf3WodGtn4k/XoLyZoh8v/8uiwek= +golang.org/x/term v0.29.0 h1:L6pJp37ocefwRRtYPKSWOWzOtWSxVajvz2ldH/xi3iU= +golang.org/x/term v0.29.0/go.mod h1:6bl4lRlvVuDgSf3179VpIxBF0o10JUpXWOnI7nErv7s= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= @@ -231,19 +238,21 @@ golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= -golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo= -golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ= +golang.org/x/text v0.22.0 h1:bofq7m3/HAFvbF51jz3Q9wLg3jkvSPuiZu/pD1XwgtM= +golang.org/x/text v0.22.0/go.mod h1:YRoo4H8PVmsu+E3Ou7cqLVH8oXWIHVoX0jqUWALQhfY= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= -golang.org/x/tools v0.28.0 h1:WuB6qZ4RPCQo5aP3WdKZS7i595EdWqWR8vqJTlwTVK8= -golang.org/x/tools v0.28.0/go.mod h1:dcIOrVd3mfQKTgrDVQHqCPMWy6lnhfhtX3hLXYVLfRw= +golang.org/x/tools v0.30.0 h1:BgcpHewrV5AUp2G9MebG4XPFI1E2W41zU1SaqVA9vJY= +golang.org/x/tools v0.30.0/go.mod h1:c347cR/OJfw5TI+GfX7RUPNMdDRRbjvYTS0jPyvsVtY= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= +gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA= +gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/natefinch/lumberjack.v2 v2.2.1 h1:bBRl1b0OH9s/DuPhuXpNl+VtCaJXFZ5/uEFST95x9zc= gopkg.in/natefinch/lumberjack.v2 v2.2.1/go.mod h1:YD8tP3GAjkrDg1eZH7EGmyESg/lsYskCTPBJVb9jqSc= gopkg.in/warnings.v0 v0.1.2 h1:wFXVbFY8DY5/xOe1ECiWdKCzZlxgshcYVNkBHstARME= @@ -252,7 +261,7 @@ gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -maunium.net/go/mautrix v0.22.2-0.20250106152426-68eaa9d1df1f h1:+nAznNCSCm+P4am9CmguSfNfcbpA7qtTzJQrwCP8aHM= -maunium.net/go/mautrix v0.22.2-0.20250106152426-68eaa9d1df1f/go.mod h1:FmwzK7RSzrd1OfGDgJzFWXl7nYmYm8/P0Y77sy/A1Uw= +maunium.net/go/mautrix v0.23.2-0.20250304004736-7d3791ace3b7 h1:AeNHqITptzOpmfMxnqmQRw6xN7DUDCgsN00BaPyRd4k= +maunium.net/go/mautrix v0.23.2-0.20250304004736-7d3791ace3b7/go.mod h1:IHMaSJh7YIxMrZSDVefS+nLdr3RbeLowsCSa6ibONZ0= mvdan.cc/xurls/v2 v2.6.0 h1:3NTZpeTxYVWNSokW3MKeyVkz/j7uYXYiMtXRUfmjbgI= mvdan.cc/xurls/v2 v2.6.0/go.mod h1:bCvEZ1XvdA6wDnxY7jPPjEmigDtvtvPXAD/Exa9IMSk= diff --git a/go.mod b/go.mod index 551a340..bfc5e1f 100644 --- a/go.mod +++ b/go.mod @@ -2,13 +2,14 @@ module go.mau.fi/gomuks go 1.23.0 -toolchain go1.23.4 +toolchain go1.24.0 require ( github.com/alecthomas/chroma/v2 v2.15.0 github.com/buckket/go-blurhash v1.1.0 github.com/chzyer/readline v1.5.1 github.com/coder/websocket v1.8.12 + github.com/disintegration/imaging v1.6.2 github.com/gabriel-vasile/mimetype v1.4.8 github.com/gdamore/tcell/v2 v2.7.4 github.com/lucasb-eyer/go-colorful v1.2.0 @@ -19,15 +20,16 @@ require ( github.com/tidwall/sjson v1.2.5 github.com/yuin/goldmark v1.7.8 go.mau.fi/mauview v0.2.2-0.20241209125653-292e0a6914c5 - go.mau.fi/util v0.8.4-0.20250106152331-30b8c95e7d7a + go.mau.fi/util v0.8.6-0.20250227184636-7ff63b0b9d95 + go.mau.fi/webp v0.2.0 go.mau.fi/zeroconfig v0.1.3 - golang.org/x/crypto v0.32.0 - golang.org/x/image v0.23.0 - golang.org/x/net v0.33.0 - golang.org/x/text v0.21.0 + golang.org/x/crypto v0.34.0 + golang.org/x/image v0.24.0 + golang.org/x/net v0.35.0 + golang.org/x/text v0.22.0 gopkg.in/yaml.v3 v3.0.1 maunium.net/go/mauflag v1.0.0 - maunium.net/go/mautrix v0.22.2-0.20250106152426-68eaa9d1df1f + maunium.net/go/mautrix v0.23.2-0.20250304004736-7d3791ace3b7 mvdan.cc/xurls/v2 v2.6.0 ) @@ -36,16 +38,16 @@ require ( github.com/coreos/go-systemd/v22 v22.5.0 // indirect github.com/dlclark/regexp2 v1.11.4 // indirect github.com/gdamore/encoding v1.0.0 // indirect - github.com/mattn/go-colorable v0.1.13 // indirect - github.com/mattn/go-isatty v0.0.19 // indirect + github.com/mattn/go-colorable v0.1.14 // indirect + github.com/mattn/go-isatty v0.0.20 // indirect github.com/mattn/go-runewidth v0.0.16 // indirect - github.com/petermattis/goid v0.0.0-20241211131331-93ee7e083c43 // indirect + github.com/petermattis/goid v0.0.0-20250211185408-f2b9d978cd7a // indirect github.com/rs/xid v1.6.0 // indirect github.com/tidwall/match v1.1.1 // indirect - github.com/tidwall/pretty v1.2.0 // indirect + github.com/tidwall/pretty v1.2.1 // indirect github.com/zyedidia/clipboard v1.0.4 // indirect - golang.org/x/exp v0.0.0-20250103183323-7d7fa50e5329 // indirect - golang.org/x/sys v0.29.0 // indirect - golang.org/x/term v0.28.0 // indirect + golang.org/x/exp v0.0.0-20250215185904-eff6e970281f // indirect + golang.org/x/sys v0.30.0 // indirect + golang.org/x/term v0.29.0 // indirect gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect ) diff --git a/go.sum b/go.sum index c9e72e4..a84af7a 100644 --- a/go.sum +++ b/go.sum @@ -22,6 +22,8 @@ github.com/coreos/go-systemd/v22 v22.5.0 h1:RrqgGjYQKalulkV8NGVIfkXQf6YYmOyiJKk8 github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/disintegration/imaging v1.6.2 h1:w1LecBlG2Lnp8B3jk5zSuNqd7b4DXhcjwek1ei82L+c= +github.com/disintegration/imaging v1.6.2/go.mod h1:44/5580QXChDfwIclfc/PCwrr44amcmDAg8hxG0Ewe4= github.com/dlclark/regexp2 v1.11.4 h1:rPYF9/LECdNymJufQKmri9gV604RvvABwgOA8un7yAo= github.com/dlclark/regexp2 v1.11.4/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8= github.com/gabriel-vasile/mimetype v1.4.8 h1:FfZ3gj38NjllZIeJAmMhr+qKL8Wu+nOoI3GqacKw1NM= @@ -35,18 +37,20 @@ github.com/hexops/gotextdiff v1.0.3 h1:gitA9+qJrrTCsiCl7+kh75nPqQt1cx4ZkudSTLoUq github.com/hexops/gotextdiff v1.0.3/go.mod h1:pSWU5MAI3yDq+fZBTazCSJysOMbxWL1BSow5/V2vxeg= github.com/lucasb-eyer/go-colorful v1.2.0 h1:1nnpGOrhyZZuNyfu1QjKiUICQ74+3FNCN69Aj6K7nkY= github.com/lucasb-eyer/go-colorful v1.2.0/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0= -github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= +github.com/mattn/go-colorable v0.1.14 h1:9A9LHSqF/7dyVVX6g0U9cwm9pG3kP9gSzcuIPHPsaIE= +github.com/mattn/go-colorable v0.1.14/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8= github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= -github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA= github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= +github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= +github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-runewidth v0.0.15/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6TULQc= github.com/mattn/go-runewidth v0.0.16/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= github.com/mattn/go-sqlite3 v1.14.24 h1:tpSp2G2KyMnnQu99ngJ47EIkWVmliIizyZBfPrBWDRM= github.com/mattn/go-sqlite3 v1.14.24/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y= -github.com/petermattis/goid v0.0.0-20241211131331-93ee7e083c43 h1:ah1dvbqPMN5+ocrg/ZSgZ6k8bOk+kcZQ7fnyx6UvOm4= -github.com/petermattis/goid v0.0.0-20241211131331-93ee7e083c43/go.mod h1:pxMtw7cyUw6B2bRH0ZBANSPg+AoSud1I1iyJHI69jH4= +github.com/petermattis/goid v0.0.0-20250211185408-f2b9d978cd7a h1:ckxP/kGzsxvxXo8jO6E/0QJ8MMmwI7IRj4Fys9QbAZA= +github.com/petermattis/goid v0.0.0-20250211185408-f2b9d978cd7a/go.mod h1:pxMtw7cyUw6B2bRH0ZBANSPg+AoSud1I1iyJHI69jH4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= @@ -66,8 +70,9 @@ github.com/tidwall/gjson v1.18.0 h1:FIDeeyB800efLX89e5a8Y0BNH+LOngJyGrIWxG2FKQY= github.com/tidwall/gjson v1.18.0/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA= github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM= -github.com/tidwall/pretty v1.2.0 h1:RWIZEg2iJ8/g6fDDYzMpobmaoGh5OLl4AXtGUGPcqCs= github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU= +github.com/tidwall/pretty v1.2.1 h1:qjsOFOWWQl+N3RsoF5/ssm1pHmJJwhjlSbZ51I6wMl4= +github.com/tidwall/pretty v1.2.1/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU= github.com/tidwall/sjson v1.2.5 h1:kLy8mja+1c9jlljvWTlSazM7cKDRfJuR/bOJhcY5NcY= github.com/tidwall/sjson v1.2.5/go.mod h1:Fvgq9kS/6ociJEDnK0Fk1cpYF4FIW6ZF7LAe+6jwd28= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= @@ -77,26 +82,29 @@ github.com/zyedidia/clipboard v1.0.4 h1:r6GUQOyPtIaApRLeD56/U+2uJbXis6ANGbKWCljU github.com/zyedidia/clipboard v1.0.4/go.mod h1:zykFnZUXX0ErxqvYLUFEq7QDJKId8rmh2FgD0/Y8cjA= go.mau.fi/mauview v0.2.2-0.20241209125653-292e0a6914c5 h1:apKftqeRRyj/Vpd5s81fNhS8UErwgfs07KG3NSHB/4Q= go.mau.fi/mauview v0.2.2-0.20241209125653-292e0a6914c5/go.mod h1:G0Qkfwt84f+5tagHsaRdiTuUFeTlIZu61MN/JL9D8Qo= -go.mau.fi/util v0.8.4-0.20250106152331-30b8c95e7d7a h1:D9RCHBFjxah9F/YB7amvRJjT2IEOFWcz8jpcEY8dBV0= -go.mau.fi/util v0.8.4-0.20250106152331-30b8c95e7d7a/go.mod h1:MOfGTs1CBuK6ERTcSL4lb5YU7/ujz09eOPVEDckuazY= +go.mau.fi/util v0.8.6-0.20250227184636-7ff63b0b9d95 h1:5EfVWWjU2Hte9uE6B/hBgvjnVfBx/7SYDZBnsuo+EBs= +go.mau.fi/util v0.8.6-0.20250227184636-7ff63b0b9d95/go.mod h1:Ycug9mrbztlahHPEJ6H5r8Nu/xqZaWbE5vPHVWmfz6M= +go.mau.fi/webp v0.2.0 h1:QVMenHw7JDb4vall5sV75JNBQj9Hw4u8AKbi1QetHvg= +go.mau.fi/webp v0.2.0/go.mod h1:VSg9MyODn12Mb5pyG0NIyNFhujrmoFSsZBs8syOZD1Q= go.mau.fi/zeroconfig v0.1.3 h1:As9wYDKmktjmNZW5i1vn8zvJlmGKHeVxHVIBMXsm4kM= go.mau.fi/zeroconfig v0.1.3/go.mod h1:NcSJkf180JT+1IId76PcMuLTNa1CzsFFZ0nBygIQM70= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.32.0 h1:euUpcYgM8WcP71gNpTqQCn6rC2t6ULUPiOzfWaXVVfc= -golang.org/x/crypto v0.32.0/go.mod h1:ZnnJkOaASj8g0AjIduWNlq2NRxL0PlBrbKVyZ6V/Ugc= -golang.org/x/exp v0.0.0-20250103183323-7d7fa50e5329 h1:9kj3STMvgqy3YA4VQXBrN7925ICMxD5wzMRcgA30588= -golang.org/x/exp v0.0.0-20250103183323-7d7fa50e5329/go.mod h1:qj5a5QZpwLU2NLQudwIN5koi3beDhSAlJwa67PuM98c= -golang.org/x/image v0.23.0 h1:HseQ7c2OpPKTPVzNjG5fwJsOTCiiwS4QdsYi5XU6H68= -golang.org/x/image v0.23.0/go.mod h1:wJJBTdLfCCf3tiHa1fNxpZmUI4mmoZvwMCPP0ddoNKY= +golang.org/x/crypto v0.34.0 h1:+/C6tk6rf/+t5DhUketUbD1aNGqiSX3j15Z6xuIDlBA= +golang.org/x/crypto v0.34.0/go.mod h1:dy7dXNW32cAb/6/PRuTNsix8T+vJAqvuIy5Bli/x0YQ= +golang.org/x/exp v0.0.0-20250215185904-eff6e970281f h1:oFMYAjX0867ZD2jcNiLBrI9BdpmEkvPyi5YrBGXbamg= +golang.org/x/exp v0.0.0-20250215185904-eff6e970281f/go.mod h1:BHOTPb3L19zxehTsLoJXVaTktb06DFgmdW6Wb9s8jqk= +golang.org/x/image v0.0.0-20191009234506-e7c1f5e7dbb8/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= +golang.org/x/image v0.24.0 h1:AN7zRgVsbvmTfNyqIbbOraYL8mSwcKncEj8ofjgzcMQ= +golang.org/x/image v0.24.0/go.mod h1:4b/ITuLfqYq1hqZcjofwctIhi7sZh2WaCjvsBNjjya8= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= -golang.org/x/net v0.33.0 h1:74SYHlV8BIgHIFC/LrYkOGIwL19eTYXQ5wc6TBuO36I= -golang.org/x/net v0.33.0/go.mod h1:HXLR5J+9DxmrqMwG9qjGCxZ+zKXxBru04zlTvWlWuN4= +golang.org/x/net v0.35.0 h1:T5GQRQb2y08kTAByq9L4/bz8cipCdA8FbRTXewonqY8= +golang.org/x/net v0.35.0/go.mod h1:EglIi67kWsHKlRzzVMUD93VMSWGFOMSZgxFjparz1Qk= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -111,21 +119,21 @@ golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.29.0 h1:TPYlXGxvx1MGTn2GiZDhnjPA9wZzZeGKHHmKhHYvgaU= -golang.org/x/sys v0.29.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.30.0 h1:QjkSwP/36a20jFYWkSue1YwXzLmsV5Gfq7Eiy72C1uc= +golang.org/x/sys v0.30.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk= -golang.org/x/term v0.28.0 h1:/Ts8HFuMR2E6IP/jlo7QVLZHggjKQbhu/7H0LJFr3Gg= -golang.org/x/term v0.28.0/go.mod h1:Sw/lC2IAUZ92udQNf3WodGtn4k/XoLyZoh8v/8uiwek= +golang.org/x/term v0.29.0 h1:L6pJp37ocefwRRtYPKSWOWzOtWSxVajvz2ldH/xi3iU= +golang.org/x/term v0.29.0/go.mod h1:6bl4lRlvVuDgSf3179VpIxBF0o10JUpXWOnI7nErv7s= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= -golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo= -golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ= +golang.org/x/text v0.22.0 h1:bofq7m3/HAFvbF51jz3Q9wLg3jkvSPuiZu/pD1XwgtM= +golang.org/x/text v0.22.0/go.mod h1:YRoo4H8PVmsu+E3Ou7cqLVH8oXWIHVoX0jqUWALQhfY= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= @@ -139,7 +147,7 @@ gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= maunium.net/go/mauflag v1.0.0 h1:YiaRc0tEI3toYtJMRIfjP+jklH45uDHtT80nUamyD4M= maunium.net/go/mauflag v1.0.0/go.mod h1:nLivPOpTpHnpzEh8jEdSL9UqO9+/KBJFmNRlwKfkPeA= -maunium.net/go/mautrix v0.22.2-0.20250106152426-68eaa9d1df1f h1:+nAznNCSCm+P4am9CmguSfNfcbpA7qtTzJQrwCP8aHM= -maunium.net/go/mautrix v0.22.2-0.20250106152426-68eaa9d1df1f/go.mod h1:FmwzK7RSzrd1OfGDgJzFWXl7nYmYm8/P0Y77sy/A1Uw= +maunium.net/go/mautrix v0.23.2-0.20250304004736-7d3791ace3b7 h1:AeNHqITptzOpmfMxnqmQRw6xN7DUDCgsN00BaPyRd4k= +maunium.net/go/mautrix v0.23.2-0.20250304004736-7d3791ace3b7/go.mod h1:IHMaSJh7YIxMrZSDVefS+nLdr3RbeLowsCSa6ibONZ0= mvdan.cc/xurls/v2 v2.6.0 h1:3NTZpeTxYVWNSokW3MKeyVkz/j7uYXYiMtXRUfmjbgI= mvdan.cc/xurls/v2 v2.6.0/go.mod h1:bCvEZ1XvdA6wDnxY7jPPjEmigDtvtvPXAD/Exa9IMSk= diff --git a/pkg/gomuks/config.go b/pkg/gomuks/config.go index 7aff6d8..95eab8f 100644 --- a/pkg/gomuks/config.go +++ b/pkg/gomuks/config.go @@ -35,6 +35,7 @@ type Config struct { Web WebConfig `yaml:"web"` Matrix MatrixConfig `yaml:"matrix"` Push PushConfig `yaml:"push"` + Media MediaConfig `yaml:"media"` Logging zeroconfig.Config `yaml:"logging"` } @@ -46,6 +47,10 @@ type PushConfig struct { FCMGateway string `yaml:"fcm_gateway"` } +type MediaConfig struct { + ThumbnailSize int `yaml:"thumbnail_size"` +} + type WebConfig struct { ListenAddress string `yaml:"listen_address"` Username string `yaml:"username"` @@ -74,6 +79,9 @@ func makeDefaultConfig() Config { Matrix: MatrixConfig{ DisableHTTP2: false, }, + Media: MediaConfig{ + ThumbnailSize: 120, + }, Logging: zeroconfig.Config{ MinLevel: ptr.Ptr(zerolog.DebugLevel), Writers: []zeroconfig.WriterConfig{{ @@ -130,6 +138,10 @@ func (gmx *Gomuks) LoadConfig() error { gmx.Config.Push.FCMGateway = "https://push.gomuks.app" changed = true } + if gmx.Config.Media.ThumbnailSize == 0 { + gmx.Config.Media.ThumbnailSize = 120 + changed = true + } if len(gmx.Config.Web.OriginPatterns) == 0 { gmx.Config.Web.OriginPatterns = []string{"localhost:*", "*.localhost:*"} changed = true diff --git a/pkg/gomuks/keys.go b/pkg/gomuks/keys.go new file mode 100644 index 0000000..8b7d0a3 --- /dev/null +++ b/pkg/gomuks/keys.go @@ -0,0 +1,110 @@ +// gomuks - A Matrix client written in Go. +// Copyright (C) 2025 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 . + +package gomuks + +import ( + "errors" + "fmt" + "io" + "mime" + "net/http" + "strconv" + + "github.com/rs/zerolog/hlog" + "go.mau.fi/util/dbutil" + "go.mau.fi/util/exhttp" + "maunium.net/go/mautrix" + "maunium.net/go/mautrix/crypto" + "maunium.net/go/mautrix/id" +) + +func (gmx *Gomuks) ExportKeys(w http.ResponseWriter, r *http.Request) { + found, correct := gmx.doBasicAuth(r) + if !found || !correct { + hlog.FromRequest(r).Debug().Msg("Requesting credentials for key export request") + w.Header().Set("WWW-Authenticate", `Basic realm="gomuks web" charset="UTF-8"`) + w.WriteHeader(http.StatusUnauthorized) + return + } + w.Header().Set("Content-Type", "text/plain") + w.Header().Set("Cache-Control", "no-store") + err := r.ParseForm() + if err != nil { + hlog.FromRequest(r).Err(err).Msg("Failed to parse form") + w.WriteHeader(http.StatusBadRequest) + _, _ = w.Write([]byte("Failed to parse form data\n")) + return + } + roomID := id.RoomID(r.PathValue("room_id")) + var sessions dbutil.RowIter[*crypto.InboundGroupSession] + filename := "gomuks-keys.txt" + if roomID == "" { + sessions = gmx.Client.CryptoStore.GetAllGroupSessions(r.Context()) + } else { + filename = fmt.Sprintf("gomuks-keys-%s.txt", roomID) + sessions = gmx.Client.CryptoStore.GetGroupSessionsForRoom(r.Context(), roomID) + } + export, err := crypto.ExportKeysIter(r.FormValue("passphrase"), sessions) + if errors.Is(err, crypto.ErrNoSessionsForExport) { + w.WriteHeader(http.StatusNotFound) + _, _ = w.Write([]byte("No keys found\n")) + return + } else if err != nil { + hlog.FromRequest(r).Err(err).Msg("Failed to export keys") + w.WriteHeader(http.StatusInternalServerError) + _, _ = w.Write([]byte("Failed to export keys (see logs for more details)\n")) + return + } + w.Header().Set("Content-Disposition", mime.FormatMediaType("attachment", map[string]string{"filename": filename})) + w.Header().Set("Content-Length", strconv.Itoa(len(export))) + w.WriteHeader(http.StatusOK) + _, _ = w.Write(export) +} + +var badMultipartForm = mautrix.RespError{ErrCode: "FI.MAU.GOMUKS.BAD_FORM_DATA", Err: "Failed to parse form data", StatusCode: http.StatusBadRequest} + +func (gmx *Gomuks) ImportKeys(w http.ResponseWriter, r *http.Request) { + err := r.ParseMultipartForm(5 * 1024 * 1024) + if err != nil { + badMultipartForm.Write(w) + return + } + export, _, err := r.FormFile("export") + if err != nil { + badMultipartForm.WithMessage("Failed to get export file from form: %w", err).Write(w) + return + } + exportData, err := io.ReadAll(export) + if err != nil { + badMultipartForm.WithMessage("Failed to read export file: %w", err).Write(w) + return + } + importedCount, totalCount, err := gmx.Client.Crypto.ImportKeys(r.Context(), r.FormValue("passphrase"), exportData) + if err != nil { + hlog.FromRequest(r).Err(err).Msg("Failed to import keys") + mautrix.MUnknown.WithMessage("Failed to import keys: %w", err).Write(w) + return + } + hlog.FromRequest(r).Info(). + Int("imported_count", importedCount). + Int("total_count", totalCount). + Msg("Successfully imported keys") + exhttp.WriteJSONResponse(w, http.StatusOK, map[string]int{ + "imported": importedCount, + "total": totalCount, + }) +} diff --git a/pkg/gomuks/media.go b/pkg/gomuks/media.go index fe03c96..1cd9d24 100644 --- a/pkg/gomuks/media.go +++ b/pkg/gomuks/media.go @@ -36,16 +36,17 @@ import ( "strings" "github.com/buckket/go-blurhash" + "github.com/disintegration/imaging" "github.com/gabriel-vasile/mimetype" "github.com/rs/zerolog" "github.com/rs/zerolog/hlog" - _ "golang.org/x/image/webp" - "go.mau.fi/util/exhttp" "go.mau.fi/util/ffmpeg" "go.mau.fi/util/jsontime" "go.mau.fi/util/ptr" "go.mau.fi/util/random" + cwebp "go.mau.fi/webp" + _ "golang.org/x/image/webp" "maunium.net/go/mautrix" "maunium.net/go/mautrix/crypto/attachment" "maunium.net/go/mautrix/event" @@ -59,7 +60,7 @@ var ErrBadGateway = mautrix.RespError{ StatusCode: http.StatusBadGateway, } -func (gmx *Gomuks) downloadMediaFromCache(ctx context.Context, w http.ResponseWriter, r *http.Request, entry *database.Media, force bool) bool { +func (gmx *Gomuks) downloadMediaFromCache(ctx context.Context, w http.ResponseWriter, r *http.Request, entry *database.Media, force, useThumbnail bool) bool { if !entry.UseCache() { if force { mautrix.MNotFound.WithMessage("Media not found in cache").Write(w) @@ -67,11 +68,12 @@ func (gmx *Gomuks) downloadMediaFromCache(ctx context.Context, w http.ResponseWr } return false } + etag := entry.ETag(useThumbnail) if entry.Error != nil { w.Header().Set("Mau-Cached-Error", "true") entry.Error.Write(w) return true - } else if r.Header.Get("If-None-Match") == entry.ETag() { + } else if etag != "" && r.Header.Get("If-None-Match") == etag { w.WriteHeader(http.StatusNotModified) return true } else if entry.MimeType != "" && r.URL.Query().Has("fallback") && !isAllowedAvatarMime(entry.MimeType) { @@ -79,7 +81,43 @@ func (gmx *Gomuks) downloadMediaFromCache(ctx context.Context, w http.ResponseWr return true } log := zerolog.Ctx(ctx) - cacheFile, err := os.Open(gmx.cacheEntryToPath(entry.Hash[:])) + hash := entry.Hash + if useThumbnail { + if entry.ThumbnailError != "" { + log.Debug().Str(zerolog.ErrorFieldName, entry.ThumbnailError).Msg("Returning cached thumbnail error") + w.WriteHeader(http.StatusInternalServerError) + return true + } + if entry.ThumbnailHash == nil { + err := gmx.generateAvatarThumbnail(entry, gmx.Config.Media.ThumbnailSize) + if errors.Is(err, os.ErrNotExist) && !force { + return false + } else if err != nil { + log.Err(err).Msg("Failed to generate avatar thumbnail") + gmx.saveMediaCacheEntryWithThumbnail(ctx, entry, err) + w.WriteHeader(http.StatusInternalServerError) + return true + } else { + gmx.saveMediaCacheEntryWithThumbnail(ctx, entry, nil) + } + } + hash = entry.ThumbnailHash + } + cacheFile, err := os.Open(gmx.cacheEntryToPath(hash[:])) + if useThumbnail && errors.Is(err, os.ErrNotExist) { + err = gmx.generateAvatarThumbnail(entry, gmx.Config.Media.ThumbnailSize) + if errors.Is(err, os.ErrNotExist) && !force { + return false + } else if err != nil { + log.Err(err).Msg("Failed to generate avatar thumbnail") + gmx.saveMediaCacheEntryWithThumbnail(ctx, entry, err) + w.WriteHeader(http.StatusInternalServerError) + return true + } else { + gmx.saveMediaCacheEntryWithThumbnail(ctx, entry, nil) + cacheFile, err = os.Open(gmx.cacheEntryToPath(hash[:])) + } + } if err != nil { if errors.Is(err, os.ErrNotExist) && !force { return false @@ -91,7 +129,7 @@ func (gmx *Gomuks) downloadMediaFromCache(ctx context.Context, w http.ResponseWr defer func() { _ = cacheFile.Close() }() - cacheEntryToHeaders(w, entry) + cacheEntryToHeaders(w, entry, useThumbnail) w.WriteHeader(http.StatusOK) _, err = io.Copy(w, cacheFile) if err != nil { @@ -105,13 +143,76 @@ func (gmx *Gomuks) cacheEntryToPath(hash []byte) string { return filepath.Join(gmx.CacheDir, "media", hashPath[0:2], hashPath[2:4], hashPath[4:]) } -func cacheEntryToHeaders(w http.ResponseWriter, entry *database.Media) { - w.Header().Set("Content-Type", entry.MimeType) - w.Header().Set("Content-Length", strconv.FormatInt(entry.Size, 10)) - w.Header().Set("Content-Disposition", mime.FormatMediaType(entry.ContentDisposition(), map[string]string{"filename": entry.FileName})) +func cacheEntryToHeaders(w http.ResponseWriter, entry *database.Media, thumbnail bool) { + if thumbnail { + w.Header().Set("Content-Type", "image/webp") + w.Header().Set("Content-Length", strconv.FormatInt(entry.ThumbnailSize, 10)) + w.Header().Set("Content-Disposition", "inline; filename=thumbnail.webp") + } else { + w.Header().Set("Content-Type", entry.MimeType) + w.Header().Set("Content-Length", strconv.FormatInt(entry.Size, 10)) + w.Header().Set("Content-Disposition", mime.FormatMediaType(entry.ContentDisposition(), map[string]string{"filename": entry.FileName})) + } w.Header().Set("Content-Security-Policy", "sandbox; default-src 'none'; script-src 'none'; media-src 'self';") w.Header().Set("Cache-Control", "max-age=2592000, immutable") - w.Header().Set("ETag", entry.ETag()) + w.Header().Set("ETag", entry.ETag(thumbnail)) +} + +func (gmx *Gomuks) saveMediaCacheEntryWithThumbnail(ctx context.Context, entry *database.Media, err error) { + if errors.Is(err, os.ErrNotExist) { + return + } + if err != nil { + entry.ThumbnailError = err.Error() + } + err = gmx.Client.DB.Media.Put(ctx, entry) + if err != nil { + zerolog.Ctx(ctx).Err(err).Msg("Failed to save cache entry after generating thumbnail") + } +} + +func (gmx *Gomuks) generateAvatarThumbnail(entry *database.Media, size int) error { + cacheFile, err := os.Open(gmx.cacheEntryToPath(entry.Hash[:])) + if err != nil { + return fmt.Errorf("failed to open full file: %w", err) + } + img, _, err := image.Decode(cacheFile) + if err != nil { + return fmt.Errorf("failed to decode image: %w", err) + } + + tempFile, err := os.CreateTemp(gmx.TempDir, "thumbnail-*") + if err != nil { + return fmt.Errorf("failed to create temporary file: %w", err) + } + defer func() { + _ = tempFile.Close() + _ = os.Remove(tempFile.Name()) + }() + thumbnailImage := imaging.Thumbnail(img, size, size, imaging.Lanczos) + fileHasher := sha256.New() + wrappedWriter := io.MultiWriter(fileHasher, tempFile) + err = cwebp.Encode(wrappedWriter, thumbnailImage, &cwebp.Options{Quality: 80}) + if err != nil { + return fmt.Errorf("failed to encode thumbnail: %w", err) + } + fileInfo, err := tempFile.Stat() + if err != nil { + return fmt.Errorf("failed to stat temporary file: %w", err) + } + entry.ThumbnailHash = (*[32]byte)(fileHasher.Sum(nil)) + entry.ThumbnailError = "" + entry.ThumbnailSize = fileInfo.Size() + cachePath := gmx.cacheEntryToPath(entry.ThumbnailHash[:]) + err = os.MkdirAll(filepath.Dir(cachePath), 0700) + if err != nil { + return fmt.Errorf("failed to create cache directory: %w", err) + } + err = os.Rename(tempFile.Name(), cachePath) + if err != nil { + return fmt.Errorf("failed to rename temporary file: %w", err) + } + return nil } type noErrorWriter struct { @@ -191,6 +292,7 @@ func (gmx *Gomuks) DownloadMedia(w http.ResponseWriter, r *http.Request) { } encrypted, _ := strconv.ParseBool(query.Get("encrypted")) + useThumbnail := query.Get("thumbnail") == "avatar" logVal := zerolog.Ctx(r.Context()).With(). Stringer("mxc_uri", mxc). @@ -211,7 +313,7 @@ func (gmx *Gomuks) DownloadMedia(w http.ResponseWriter, r *http.Request) { return } - if gmx.downloadMediaFromCache(ctx, w, r, cacheEntry, false) { + if gmx.downloadMediaFromCache(ctx, w, r, cacheEntry, false, useThumbnail) { return } @@ -301,8 +403,8 @@ func (gmx *Gomuks) DownloadMedia(w http.ResponseWriter, r *http.Request) { cacheEntry.Size = resp.ContentLength fileHasher := sha256.New() wrappedReader := io.TeeReader(reader, fileHasher) - if cacheEntry.Size > 0 && cacheEntry.EncFile == nil { - cacheEntryToHeaders(w, cacheEntry) + if cacheEntry.Size > 0 && cacheEntry.EncFile == nil && !useThumbnail { + cacheEntryToHeaders(w, cacheEntry, useThumbnail) w.WriteHeader(http.StatusOK) wrappedReader = io.TeeReader(wrappedReader, &noErrorWriter{w}) w = nil @@ -342,7 +444,7 @@ func (gmx *Gomuks) DownloadMedia(w http.ResponseWriter, r *http.Request) { return } if w != nil { - gmx.downloadMediaFromCache(ctx, w, r, cacheEntry, true) + gmx.downloadMediaFromCache(ctx, w, r, cacheEntry, true, useThumbnail) } } diff --git a/pkg/gomuks/pushmessage.go b/pkg/gomuks/pushmessage.go index a4d3d1e..996e59f 100644 --- a/pkg/gomuks/pushmessage.go +++ b/pkg/gomuks/pushmessage.go @@ -77,6 +77,8 @@ func (gmx *Gomuks) getNotificationUser(ctx context.Context, roomID id.RoomID, us if err != nil { zerolog.Ctx(ctx).Err(err).Stringer("of_user_id", userID).Msg("Failed to get member event") return + } else if memberEvt == nil { + return } var memberContent event.MemberEventContent _ = json.Unmarshal(memberEvt.Content, &memberContent) diff --git a/pkg/gomuks/server.go b/pkg/gomuks/server.go index fe6aade..0765e19 100644 --- a/pkg/gomuks/server.go +++ b/pkg/gomuks/server.go @@ -53,6 +53,9 @@ func (gmx *Gomuks) CreateAPIRouter() http.Handler { api.HandleFunc("GET /sso", gmx.HandleSSOComplete) api.HandleFunc("POST /sso", gmx.PrepareSSO) api.HandleFunc("GET /media/{server}/{media_id}", gmx.DownloadMedia) + api.HandleFunc("POST /keys/export", gmx.ExportKeys) + api.HandleFunc("POST /keys/export/{room_id}", gmx.ExportKeys) + api.HandleFunc("POST /keys/import", gmx.ImportKeys) api.HandleFunc("GET /codeblock/{style}", gmx.GetCodeblockCSS) return exhttp.ApplyMiddleware( api, @@ -242,30 +245,36 @@ func (gmx *Gomuks) Authenticate(w http.ResponseWriter, r *http.Request) { if err == nil && gmx.validateAuth(authCookie.Value, false) { hlog.FromRequest(r).Debug().Msg("Authentication successful with existing cookie") gmx.writeTokenCookie(w, false, jsonOutput) - } else if username, password, ok := r.BasicAuth(); !ok { - hlog.FromRequest(r).Debug().Msg("Requesting credentials for auth request") + } else if found, correct := gmx.doBasicAuth(r); found && correct { + hlog.FromRequest(r).Debug().Msg("Authentication successful with username and password") + gmx.writeTokenCookie(w, true, jsonOutput) + } else { + if !found { + hlog.FromRequest(r).Debug().Msg("Requesting credentials for auth request") + } else { + hlog.FromRequest(r).Debug().Msg("Authentication failed with username and password, re-requesting credentials") + } if allowPrompt { w.Header().Set("WWW-Authenticate", `Basic realm="gomuks web" charset="UTF-8"`) } w.WriteHeader(http.StatusUnauthorized) - } else { - usernameHash := sha256.Sum256([]byte(username)) - expectedUsernameHash := sha256.Sum256([]byte(gmx.Config.Web.Username)) - usernameCorrect := hmac.Equal(usernameHash[:], expectedUsernameHash[:]) - passwordCorrect := bcrypt.CompareHashAndPassword([]byte(gmx.Config.Web.PasswordHash), []byte(password)) == nil - if usernameCorrect && passwordCorrect { - hlog.FromRequest(r).Debug().Msg("Authentication successful with username and password") - gmx.writeTokenCookie(w, true, jsonOutput) - } else { - hlog.FromRequest(r).Debug().Msg("Authentication failed with username and password, re-requesting credentials") - if allowPrompt { - w.Header().Set("WWW-Authenticate", `Basic realm="gomuks web" charset="UTF-8"`) - } - w.WriteHeader(http.StatusUnauthorized) - } } } +func (gmx *Gomuks) doBasicAuth(r *http.Request) (found, correct bool) { + var username, password string + username, password, found = r.BasicAuth() + if !found { + return + } + usernameHash := sha256.Sum256([]byte(username)) + expectedUsernameHash := sha256.Sum256([]byte(gmx.Config.Web.Username)) + usernameCorrect := hmac.Equal(usernameHash[:], expectedUsernameHash[:]) + passwordCorrect := bcrypt.CompareHashAndPassword([]byte(gmx.Config.Web.PasswordHash), []byte(password)) == nil + correct = passwordCorrect && usernameCorrect + return +} + func isImageFetch(header http.Header) bool { return header.Get("Sec-Fetch-Site") == "cross-site" && header.Get("Sec-Fetch-Mode") == "no-cors" && diff --git a/pkg/hicli/database/event.go b/pkg/hicli/database/event.go index cfef7e7..e0420de 100644 --- a/pkg/hicli/database/event.go +++ b/pkg/hicli/database/event.go @@ -36,7 +36,11 @@ const ( getEventByID = getEventBaseQuery + `WHERE event_id = $1` getEventByTransactionID = getEventBaseQuery + `WHERE transaction_id = $1` getFailedEventsByMegolmSessionID = getEventBaseQuery + `WHERE room_id = $1 AND megolm_session_id = $2 AND decryption_error IS NOT NULL` - insertEventBaseQuery = ` + getRelatedEventsQuery = getEventBaseQuery + ` + WHERE room_id = $1 AND relates_to = $2 AND ($3 = '' OR relation_type = $3) + ORDER BY timestamp ASC + ` + insertEventBaseQuery = ` INSERT INTO event ( room_id, event_id, sender, type, state_key, timestamp, content, decrypted, decrypted_type, unsigned, local_content, transaction_id, redacted_by, relates_to, relation_type, @@ -112,6 +116,10 @@ func (eq *EventQuery) GetByRowID(ctx context.Context, rowID EventRowID) (*Event, return eq.QueryOne(ctx, getEventByRowID, rowID) } +func (eq *EventQuery) GetRelatedEvents(ctx context.Context, roomID id.RoomID, eventID id.EventID, relationType event.RelationType) ([]*Event, error) { + return eq.QueryMany(ctx, getRelatedEventsQuery, roomID, eventID, relationType) +} + func (eq *EventQuery) GetByRowIDs(ctx context.Context, rowIDs ...EventRowID) ([]*Event, error) { query, params := buildMultiEventGetFunction(nil, rowIDs, getManyEventsByRowID) return eq.QueryMany(ctx, query, params...) diff --git a/pkg/hicli/database/media.go b/pkg/hicli/database/media.go index edc6698..e603025 100644 --- a/pkg/hicli/database/media.go +++ b/pkg/hicli/database/media.go @@ -23,24 +23,27 @@ import ( const ( insertMediaQuery = ` - INSERT INTO media (mxc, enc_file, file_name, mime_type, size, hash, error) - VALUES ($1, $2, $3, $4, $5, $6, $7) + INSERT INTO media (mxc, enc_file, file_name, mime_type, size, hash, error, thumbnail_size, thumbnail_hash, thumbnail_error) + VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10) ON CONFLICT (mxc) DO NOTHING ` upsertMediaQuery = ` - INSERT INTO media (mxc, enc_file, file_name, mime_type, size, hash, error) - VALUES ($1, $2, $3, $4, $5, $6, $7) + INSERT INTO media (mxc, enc_file, file_name, mime_type, size, hash, error, thumbnail_size, thumbnail_hash, thumbnail_error) + VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10) ON CONFLICT (mxc) DO UPDATE SET enc_file = COALESCE(excluded.enc_file, media.enc_file), - file_name = COALESCE(excluded.file_name, media.file_name), - mime_type = COALESCE(excluded.mime_type, media.mime_type), - size = COALESCE(excluded.size, media.size), - hash = COALESCE(excluded.hash, media.hash), - error = excluded.error + file_name = COALESCE(excluded.file_name, media.file_name), + mime_type = COALESCE(excluded.mime_type, media.mime_type), + size = COALESCE(excluded.size, media.size), + hash = COALESCE(excluded.hash, media.hash), + error = excluded.error, + thumbnail_size = COALESCE(excluded.thumbnail_size, media.thumbnail_size), + thumbnail_hash = COALESCE(excluded.thumbnail_hash, media.thumbnail_hash), + thumbnail_error = excluded.thumbnail_error WHERE excluded.error IS NULL OR media.hash IS NULL ` getMediaQuery = ` - SELECT mxc, enc_file, file_name, mime_type, size, hash, error + SELECT mxc, enc_file, file_name, mime_type, size, hash, error, thumbnail_size, thumbnail_hash, thumbnail_error FROM media WHERE mxc = $1 ` @@ -137,9 +140,22 @@ type Media struct { Size int64 Hash *[32]byte Error *MediaError + + ThumbnailError string + ThumbnailSize int64 + ThumbnailHash *[32]byte } -func (m *Media) ETag() string { +func (m *Media) ETag(thumbnail bool) string { + if m == nil { + return "" + } + if thumbnail { + if m.ThumbnailHash == nil { + return "" + } + return fmt.Sprintf(`"%x"`, m.ThumbnailHash) + } if m.Hash == nil { return "" } @@ -151,14 +167,18 @@ func (m *Media) UseCache() bool { } func (m *Media) sqlVariables() []any { - var hash []byte + var hash, thumbnailHash []byte if m.Hash != nil { hash = m.Hash[:] } + if m.ThumbnailHash != nil { + thumbnailHash = m.ThumbnailHash[:] + } return []any{ &m.MXC, dbutil.JSONPtr(m.EncFile), dbutil.StrPtr(m.FileName), dbutil.StrPtr(m.MimeType), dbutil.NumPtr(m.Size), hash, dbutil.JSONPtr(m.Error), + dbutil.NumPtr(m.ThumbnailSize), thumbnailHash, dbutil.StrPtr(m.ThumbnailError), } } @@ -172,19 +192,27 @@ var safeMimes = []string{ } func (m *Media) Scan(row dbutil.Scannable) (*Media, error) { - var mimeType, fileName sql.NullString - var size sql.NullInt64 - var hash []byte - err := row.Scan(&m.MXC, dbutil.JSON{Data: &m.EncFile}, &fileName, &mimeType, &size, &hash, dbutil.JSON{Data: &m.Error}) + var mimeType, fileName, thumbnailError sql.NullString + var size, thumbnailSize sql.NullInt64 + var hash, thumbnailHash []byte + err := row.Scan( + &m.MXC, dbutil.JSON{Data: &m.EncFile}, &fileName, &mimeType, &size, + &hash, dbutil.JSON{Data: &m.Error}, &thumbnailSize, &thumbnailHash, &thumbnailError, + ) if err != nil { return nil, err } m.MimeType = mimeType.String m.FileName = fileName.String m.Size = size.Int64 + m.ThumbnailSize = thumbnailSize.Int64 + m.ThumbnailError = thumbnailError.String if len(hash) == 32 { m.Hash = (*[32]byte)(hash) } + if len(thumbnailHash) == 32 { + m.ThumbnailHash = (*[32]byte)(thumbnailHash) + } return m, nil } diff --git a/pkg/hicli/database/state.go b/pkg/hicli/database/state.go index f7f53eb..a703e65 100644 --- a/pkg/hicli/database/state.go +++ b/pkg/hicli/database/state.go @@ -39,6 +39,7 @@ const ( ` getCurrentRoomStateQuery = getCurrentRoomStateBaseQuery + `WHERE cs.room_id = $1` getCurrentRoomStateWithoutMembersQuery = getCurrentRoomStateBaseQuery + `WHERE cs.room_id = $1 AND type<>'m.room.member'` + getCurrentRoomStateMembersQuery = getCurrentRoomStateBaseQuery + `WHERE cs.room_id = $1 AND type='m.room.member'` getManyCurrentRoomStateQuery = getCurrentRoomStateBaseQuery + `WHERE (cs.room_id, cs.event_type, cs.state_key) IN (%s)` getCurrentStateEventQuery = getCurrentRoomStateBaseQuery + `WHERE cs.room_id = $1 AND cs.event_type = $2 AND cs.state_key = $3` ) @@ -118,3 +119,7 @@ func (csq *CurrentStateQuery) GetAll(ctx context.Context, roomID id.RoomID) ([]* func (csq *CurrentStateQuery) GetAllExceptMembers(ctx context.Context, roomID id.RoomID) ([]*Event, error) { return csq.QueryMany(ctx, getCurrentRoomStateWithoutMembersQuery, roomID) } + +func (csq *CurrentStateQuery) GetMembers(ctx context.Context, roomID id.RoomID) ([]*Event, error) { + return csq.QueryMany(ctx, getCurrentRoomStateMembersQuery, roomID) +} diff --git a/pkg/hicli/database/upgrades/00-latest-revision.sql b/pkg/hicli/database/upgrades/00-latest-revision.sql index 847afae..9b87844 100644 --- a/pkg/hicli/database/upgrades/00-latest-revision.sql +++ b/pkg/hicli/database/upgrades/00-latest-revision.sql @@ -1,4 +1,4 @@ --- v0 -> v12 (compatible with v10+): Latest revision +-- v0 -> v13 (compatible with v10+): Latest revision CREATE TABLE account ( user_id TEXT NOT NULL PRIMARY KEY, device_id TEXT NOT NULL, @@ -18,7 +18,7 @@ CREATE TABLE room ( name_quality INTEGER NOT NULL DEFAULT 0, avatar TEXT, explicit_avatar INTEGER NOT NULL DEFAULT 0, - dm_user_id TEXT, + dm_user_id TEXT, topic TEXT, canonical_alias TEXT, lazy_load_summary TEXT, @@ -212,13 +212,17 @@ BEGIN END; CREATE TABLE media ( - mxc TEXT NOT NULL PRIMARY KEY, - enc_file TEXT, - file_name TEXT, - mime_type TEXT, - size INTEGER, - hash BLOB, - error TEXT + mxc TEXT NOT NULL PRIMARY KEY, + enc_file TEXT, + file_name TEXT, + mime_type TEXT, + size INTEGER, + hash BLOB, + error TEXT, + + thumbnail_size INTEGER, + thumbnail_hash BLOB, + thumbnail_error TEXT ) STRICT; CREATE TABLE media_reference ( diff --git a/pkg/hicli/database/upgrades/13-media-thumbnails.sql b/pkg/hicli/database/upgrades/13-media-thumbnails.sql new file mode 100644 index 0000000..ff9d88c --- /dev/null +++ b/pkg/hicli/database/upgrades/13-media-thumbnails.sql @@ -0,0 +1,4 @@ +-- v13 (compatible with v10+): Add columns for media thumbnails +ALTER TABLE media ADD COLUMN thumbnail_size INTEGER; +ALTER TABLE media ADD COLUMN thumbnail_hash BLOB; +ALTER TABLE media ADD COLUMN thumbnail_error TEXT; diff --git a/pkg/hicli/events.go b/pkg/hicli/events.go index 31cb9bb..328027a 100644 --- a/pkg/hicli/events.go +++ b/pkg/hicli/events.go @@ -7,6 +7,8 @@ package hicli import ( + "encoding/json" + "go.mau.fi/util/jsontime" "maunium.net/go/mautrix/event" "maunium.net/go/mautrix/id" @@ -35,6 +37,13 @@ type SyncNotification struct { Room *database.Room `json:"-"` } +type SyncToDevice struct { + Sender id.UserID `json:"sender"` + Type event.Type `json:"type"` + Content json.RawMessage `json:"content"` + Encrypted bool `json:"encrypted"` +} + type SyncComplete struct { Since *string `json:"since,omitempty"` ClearState bool `json:"clear_state,omitempty"` @@ -44,6 +53,8 @@ type SyncComplete struct { InvitedRooms []*database.InvitedRoom `json:"invited_rooms"` SpaceEdges map[id.RoomID][]*database.SpaceEdge `json:"space_edges"` TopLevelSpaces []id.RoomID `json:"top_level_spaces"` + + ToDevice []*SyncToDevice `json:"to_device,omitempty"` } func (c *SyncComplete) Notifications(yield func(SyncNotification) bool) { diff --git a/pkg/hicli/hicli.go b/pkg/hicli/hicli.go index 3b41577..4c1a97e 100644 --- a/pkg/hicli/hicli.go +++ b/pkg/hicli/hicli.go @@ -50,6 +50,8 @@ type HiClient struct { syncErrors int lastSync time.Time + ToDeviceInSync atomic.Bool + EventHandler func(evt any) LogoutFunc func(context.Context) error diff --git a/pkg/hicli/hitest/hitest.go b/pkg/hicli/hitest/hitest.go index 820c44e..e1077be 100644 --- a/pkg/hicli/hitest/hitest.go +++ b/pkg/hicli/hitest/hitest.go @@ -101,7 +101,7 @@ func main() { resp, err := cli.Send(ctx, id.RoomID(fields[1]), event.EventMessage, &event.MessageEventContent{ Body: strings.Join(fields[2:], " "), MsgType: event.MsgText, - }) + }, false, false) _, _ = fmt.Fprintln(rl, err) _, _ = fmt.Fprintf(rl, "%+v\n", resp) } diff --git a/pkg/hicli/init.go b/pkg/hicli/init.go index 5b08de5..c7951d8 100644 --- a/pkg/hicli/init.go +++ b/pkg/hicli/init.go @@ -120,8 +120,11 @@ func (h *HiClient) GetInitialSync(ctx context.Context, batchSize int) iter.Seq[* payload := SyncComplete{ Rooms: make(map[id.RoomID]*SyncRoom, len(rooms)), } - for _, room := range rooms { + for roomIdx, room := range rooms { if room.SortingTimestamp == rooms[len(rooms)-1].SortingTimestamp { + if roomIdx == 0 { + batchSize *= 2 + } break } maxTS = room.SortingTimestamp.Time diff --git a/pkg/hicli/json-commands.go b/pkg/hicli/json-commands.go index dca1ea7..eafa387 100644 --- a/pkg/hicli/json-commands.go +++ b/pkg/hicli/json-commands.go @@ -17,6 +17,7 @@ import ( "maunium.net/go/mautrix" "maunium.net/go/mautrix/event" "maunium.net/go/mautrix/id" + "maunium.net/go/mautrix/pushrules" "go.mau.fi/gomuks/pkg/hicli/database" ) @@ -46,7 +47,7 @@ func (h *HiClient) handleJSONCommand(ctx context.Context, req *JSONCommand) (any }) case "send_event": return unmarshalAndCall(req.Data, func(params *sendEventParams) (*database.Event, error) { - return h.Send(ctx, params.RoomID, params.EventType, params.Content) + return h.Send(ctx, params.RoomID, params.EventType, params.Content, params.DisableEncryption, params.Synchronous) }) case "resend_event": return unmarshalAndCall(req.Data, func(params *resendEventParams) (*database.Event, error) { @@ -66,6 +67,21 @@ func (h *HiClient) handleJSONCommand(ctx context.Context, req *JSONCommand) (any return unmarshalAndCall(req.Data, func(params *sendStateEventParams) (id.EventID, error) { return h.SetState(ctx, params.RoomID, params.EventType, params.StateKey, params.Content) }) + case "set_membership": + return unmarshalAndCall(req.Data, func(params *setMembershipParams) (any, error) { + switch params.Action { + case "invite": + return h.Client.InviteUser(ctx, params.RoomID, &mautrix.ReqInviteUser{UserID: params.UserID, Reason: params.Reason}) + case "kick": + return h.Client.KickUser(ctx, params.RoomID, &mautrix.ReqKickUser{UserID: params.UserID, Reason: params.Reason}) + case "ban": + return h.Client.BanUser(ctx, params.RoomID, &mautrix.ReqBanUser{UserID: params.UserID, Reason: params.Reason}) + case "unban": + return h.Client.UnbanUser(ctx, params.RoomID, &mautrix.ReqUnbanUser{UserID: params.UserID, Reason: params.Reason}) + default: + return nil, fmt.Errorf("unknown action %q", params.Action) + } + }) case "set_account_data": return unmarshalAndCall(req.Data, func(params *setAccountDataParams) (bool, error) { if params.RoomID != "" { @@ -108,12 +124,15 @@ func (h *HiClient) handleJSONCommand(ctx context.Context, req *JSONCommand) (any }) case "get_event": return unmarshalAndCall(req.Data, func(params *getEventParams) (*database.Event, error) { + if params.Unredact { + return h.GetUnredactedEvent(ctx, params.RoomID, params.EventID) + } return h.GetEvent(ctx, params.RoomID, params.EventID) }) - //case "get_events_by_rowids": - // return unmarshalAndCall(req.Data, func(params *getEventsByRowIDsParams) ([]*database.Event, error) { - // return h.GetEventsByRowIDs(ctx, params.RowIDs) - // }) + case "get_related_events": + return unmarshalAndCall(req.Data, func(params *getRelatedEventsParams) ([]*database.Event, error) { + return h.DB.Event.GetRelatedEvents(ctx, params.RoomID, params.EventID, params.RelationType) + }) case "get_room_state": return unmarshalAndCall(req.Data, func(params *getRoomStateParams) ([]*database.Event, error) { return h.GetRoomState(ctx, params.RoomID, params.IncludeMembers, params.FetchMembers, params.Refetch) @@ -149,10 +168,29 @@ func (h *HiClient) handleJSONCommand(ctx context.Context, req *JSONCommand) (any return unmarshalAndCall(req.Data, func(params *leaveRoomParams) (*mautrix.RespLeaveRoom, error) { return h.Client.LeaveRoom(ctx, params.RoomID, &mautrix.ReqLeave{Reason: params.Reason}) }) + case "create_room": + return unmarshalAndCall(req.Data, func(params *mautrix.ReqCreateRoom) (*mautrix.RespCreateRoom, error) { + return h.Client.CreateRoom(ctx, params) + }) + case "mute_room": + return unmarshalAndCall(req.Data, func(params *muteRoomParams) (bool, error) { + if params.Muted { + return true, h.Client.PutPushRule(ctx, "global", pushrules.RoomRule, string(params.RoomID), &mautrix.ReqPutPushRule{ + Actions: []pushrules.PushActionType{}, + }) + } else { + return false, h.Client.DeletePushRule(ctx, "global", pushrules.RoomRule, string(params.RoomID)) + } + }) case "ensure_group_session_shared": return unmarshalAndCall(req.Data, func(params *ensureGroupSessionSharedParams) (bool, error) { return true, h.EnsureGroupSessionShared(ctx, params.RoomID) }) + case "send_to_device": + return unmarshalAndCall(req.Data, func(params *sendToDeviceParams) (*mautrix.RespSendToDevice, error) { + params.EventType.Class = event.ToDeviceEventType + return h.SendToDevice(ctx, params.EventType, params.ReqSendToDevice, params.Encrypted) + }) case "resolve_alias": return unmarshalAndCall(req.Data, func(params *resolveAliasParams) (*mautrix.RespAliasResolve, error) { return h.Client.ResolveAlias(ctx, params.Alias) @@ -205,6 +243,14 @@ func (h *HiClient) handleJSONCommand(ctx context.Context, req *JSONCommand) (any return unmarshalAndCall(req.Data, func(params *database.PushRegistration) (bool, error) { return true, h.DB.PushRegistration.Put(ctx, params) }) + case "listen_to_device": + return unmarshalAndCall(req.Data, func(listen *bool) (bool, error) { + return h.ToDeviceInSync.Swap(*listen), nil + }) + case "get_turn_servers": + return h.Client.TurnServer(ctx) + case "get_media_config": + return h.Client.GetMediaConfig(ctx) default: return nil, fmt.Errorf("unknown command %q", req.Command) } @@ -234,9 +280,11 @@ type sendMessageParams struct { } type sendEventParams struct { - RoomID id.RoomID `json:"room_id"` - EventType event.Type `json:"type"` - Content json.RawMessage `json:"content"` + RoomID id.RoomID `json:"room_id"` + EventType event.Type `json:"type"` + Content json.RawMessage `json:"content"` + DisableEncryption bool `json:"disable_encryption"` + Synchronous bool `json:"synchronous"` } type resendEventParams struct { @@ -262,6 +310,13 @@ type sendStateEventParams struct { Content json.RawMessage `json:"content"` } +type setMembershipParams struct { + Action string `json:"action"` + RoomID id.RoomID `json:"room_id"` + UserID id.UserID `json:"user_id"` + Reason string `json:"reason"` +} + type setAccountDataParams struct { RoomID id.RoomID `json:"room_id,omitempty"` Type string `json:"type"` @@ -289,13 +344,17 @@ type setProfileFieldParams struct { } type getEventParams struct { - RoomID id.RoomID `json:"room_id"` - EventID id.EventID `json:"event_id"` + RoomID id.RoomID `json:"room_id"` + EventID id.EventID `json:"event_id"` + Unredact bool `json:"unredact"` } -//type getEventsByRowIDsParams struct { -// RowIDs []database.EventRowID `json:"row_ids"` -//} +type getRelatedEventsParams struct { + RoomID id.RoomID `json:"room_id"` + EventID id.EventID `json:"event_id"` + + RelationType event.RelationType `json:"relation_type"` +} type getRoomStateParams struct { RoomID id.RoomID `json:"room_id"` @@ -312,6 +371,12 @@ type ensureGroupSessionSharedParams struct { RoomID id.RoomID `json:"room_id"` } +type sendToDeviceParams struct { + *mautrix.ReqSendToDevice + EventType event.Type `json:"event_type"` + Encrypted bool `json:"encrypted"` +} + type resolveAliasParams struct { Alias id.RoomAlias `json:"alias"` } @@ -360,3 +425,8 @@ type getReceiptsParams struct { RoomID id.RoomID `json:"room_id"` EventIDs []id.EventID `json:"event_ids"` } + +type muteRoomParams struct { + RoomID id.RoomID `json:"room_id"` + Muted bool `json:"muted"` +} diff --git a/pkg/hicli/paginate.go b/pkg/hicli/paginate.go index f41ceee..4cbf64c 100644 --- a/pkg/hicli/paginate.go +++ b/pkg/hicli/paginate.go @@ -22,37 +22,6 @@ import ( var ErrPaginationAlreadyInProgress = errors.New("pagination is already in progress") -/*func (h *HiClient) GetEventsByRowIDs(ctx context.Context, rowIDs []database.EventRowID) ([]*database.Event, error) { - events, err := h.DB.Event.GetByRowIDs(ctx, rowIDs...) - if err != nil { - return nil, err - } else if len(events) == 0 { - return events, nil - } - firstRoomID := events[0].RoomID - allInSameRoom := true - for _, evt := range events { - h.ReprocessExistingEvent(ctx, evt) - if evt.RoomID != firstRoomID { - allInSameRoom = false - break - } - } - if allInSameRoom { - err = h.DB.Event.FillLastEditRowIDs(ctx, firstRoomID, events) - if err != nil { - return events, fmt.Errorf("failed to fill last edit row IDs: %w", err) - } - err = h.DB.Event.FillReactionCounts(ctx, firstRoomID, events) - if err != nil { - return events, fmt.Errorf("failed to fill reaction counts: %w", err) - } - } else { - // TODO slow path where events are collected and filling is done one room at a time? - } - return events, nil -}*/ - func (h *HiClient) GetEvent(ctx context.Context, roomID id.RoomID, eventID id.EventID) (*database.Event, error) { if evt, err := h.DB.Event.GetByID(ctx, eventID); err != nil { return nil, fmt.Errorf("failed to get event from database: %w", err) @@ -66,6 +35,26 @@ func (h *HiClient) GetEvent(ctx context.Context, roomID id.RoomID, eventID id.Ev } } +func (h *HiClient) GetUnredactedEvent(ctx context.Context, roomID id.RoomID, eventID id.EventID) (*database.Event, error) { + if evt, err := h.DB.Event.GetByID(ctx, eventID); err != nil { + return nil, fmt.Errorf("failed to get event from database: %w", err) + // TODO this check doesn't handle events which keep some fields on redaction + } else if evt != nil && len(evt.Content) > 2 { + h.ReprocessExistingEvent(ctx, evt) + return evt, nil + } else if serverEvt, err := h.Client.GetUnredactedEventContent(ctx, roomID, eventID); err != nil { + return nil, fmt.Errorf("failed to get event from server: %w", err) + } else if redactedServerEvt, err := h.Client.GetEvent(ctx, roomID, eventID); err != nil { + return nil, fmt.Errorf("failed to get redacted event from server: %w", err) + // TODO this check will have false positives on actually empty events + } else if len(serverEvt.Content.VeryRaw) == 2 { + return nil, fmt.Errorf("server didn't return content") + } else { + serverEvt.Unsigned.RedactedBecause = redactedServerEvt.Unsigned.RedactedBecause + return h.processEvent(ctx, serverEvt, nil, nil, false) + } +} + func (h *HiClient) processGetRoomState(ctx context.Context, roomID id.RoomID, fetchMembers, refetch, dispatchEvt bool) error { var evts []*event.Event if refetch { @@ -279,6 +268,7 @@ func (h *HiClient) GetReceipts(ctx context.Context, roomID id.RoomID, eventIDs [ func (h *HiClient) PaginateServer(ctx context.Context, roomID id.RoomID, limit int) (*PaginationResponse, error) { ctx, cancel := context.WithCancelCause(ctx) + defer cancel(context.Canceled) h.paginationInterrupterLock.Lock() if _, alreadyPaginating := h.paginationInterrupter[roomID]; alreadyPaginating { h.paginationInterrupterLock.Unlock() diff --git a/pkg/hicli/send.go b/pkg/hicli/send.go index 998382f..84cb4c1 100644 --- a/pkg/hicli/send.go +++ b/pkg/hicli/send.go @@ -71,6 +71,13 @@ func (h *HiClient) SendMessage( relatesTo *event.RelatesTo, mentions *event.Mentions, ) (*database.Event, error) { + if text == "/discardsession" { + err := h.CryptoStore.RemoveOutboundGroupSession(ctx, roomID) + if err != nil { + return nil, err + } + return nil, fmt.Errorf("outbound megolm session successfully discarded") + } var unencrypted bool if strings.HasPrefix(text, "/unencrypted ") { text = strings.TrimPrefix(text, "/unencrypted ") @@ -90,7 +97,7 @@ func (h *HiClient) SendMessage( if !json.Valid(content) { return nil, fmt.Errorf("invalid JSON in /raw command") } - return h.send(ctx, roomID, event.Type{Type: parts[1]}, content, "", unencrypted) + return h.send(ctx, roomID, event.Type{Type: parts[1]}, content, "", unencrypted, false) } else if strings.HasPrefix(text, "/rawstate ") { parts := strings.SplitN(text, " ", 4) if len(parts) < 4 || len(parts[1]) == 0 { @@ -154,12 +161,18 @@ func (h *HiClient) SendMessage( Body: "", MsgType: contentCopy.MsgType, URL: contentCopy.URL, + GeoURI: contentCopy.GeoURI, NewContent: &contentCopy, RelatesTo: relatesTo, } if contentCopy.File != nil { content.URL = contentCopy.File.URL } + if extra != nil { + extra = map[string]any{ + "m.new_content": extra, + } + } } else { content.RelatesTo = relatesTo } @@ -169,7 +182,7 @@ func (h *HiClient) SendMessage( content.MsgType = "" evtType = event.EventSticker } - return h.send(ctx, roomID, evtType, &event.Content{Parsed: content, Raw: extra}, origText, unencrypted) + return h.send(ctx, roomID, evtType, &event.Content{Parsed: content, Raw: extra}, origText, unencrypted, false) } func (h *HiClient) MarkRead(ctx context.Context, roomID id.RoomID, eventID id.EventID, receiptType event.ReceiptType) error { @@ -232,8 +245,14 @@ func (h *HiClient) Send( roomID id.RoomID, evtType event.Type, content any, + disableEncryption bool, + synchronous bool, ) (*database.Event, error) { - return h.send(ctx, roomID, evtType, content, "", false) + if evtType == event.EventRedaction { + // TODO implement + return nil, fmt.Errorf("redaction is not supported") + } + return h.send(ctx, roomID, evtType, content, "", disableEncryption, synchronous) } func (h *HiClient) Resend(ctx context.Context, txnID string) (*database.Event, error) { @@ -252,7 +271,7 @@ func (h *HiClient) Resend(ctx context.Context, txnID string) (*database.Event, e return nil, fmt.Errorf("unknown room") } dbEvt.SendError = "" - go h.actuallySend(context.WithoutCancel(ctx), room, dbEvt, event.Type{Type: dbEvt.Type, Class: event.MessageEventType}) + go h.actuallySend(context.WithoutCancel(ctx), room, dbEvt, event.Type{Type: dbEvt.Type, Class: event.MessageEventType}, false) return dbEvt, nil } @@ -263,6 +282,7 @@ func (h *HiClient) send( content any, overrideEditSource string, disableEncryption bool, + synchronous bool, ) (*database.Event, error) { room, err := h.DB.Room.Get(ctx, roomID) if err != nil { @@ -321,11 +341,15 @@ func (h *HiClient) send( zerolog.Ctx(ctx).Err(err).Msg("Failed to stop typing while sending message") } }() - go h.actuallySend(ctx, room, dbEvt, evtType) + if synchronous { + h.actuallySend(ctx, room, dbEvt, evtType, true) + } else { + go h.actuallySend(ctx, room, dbEvt, evtType, false) + } return dbEvt, nil } -func (h *HiClient) actuallySend(ctx context.Context, room *database.Room, dbEvt *database.Event, evtType event.Type) { +func (h *HiClient) actuallySend(ctx context.Context, room *database.Room, dbEvt *database.Event, evtType event.Type, synchronous bool) { var err error defer func() { if dbEvt.SendError != "" { @@ -335,10 +359,12 @@ func (h *HiClient) actuallySend(ctx context.Context, room *database.Room, dbEvt Msg("Failed to update send error in database after sending failed") } } - h.EventHandler(&SendComplete{ - Event: dbEvt, - Error: err, - }) + if !synchronous { + h.EventHandler(&SendComplete{ + Event: dbEvt, + Error: err, + }) + } }() if dbEvt.Decrypted != nil && len(dbEvt.Content) <= 2 { var encryptedContent *event.EncryptedEventContent @@ -411,6 +437,18 @@ func (h *HiClient) EnsureGroupSessionShared(ctx context.Context, roomID id.RoomI } } +func (h *HiClient) SendToDevice(ctx context.Context, evtType event.Type, content *mautrix.ReqSendToDevice, encrypt bool) (*mautrix.RespSendToDevice, error) { + if encrypt { + var err error + content, err = h.Crypto.EncryptToDevices(ctx, evtType, content) + if err != nil { + return nil, fmt.Errorf("failed to encrypt: %w", err) + } + evtType = event.ToDeviceEncrypted + } + return h.Client.SendToDevice(ctx, evtType, content) +} + func (h *HiClient) loadMembers(ctx context.Context, room *database.Room) error { if room.HasMemberList { return nil diff --git a/pkg/hicli/sync.go b/pkg/hicli/sync.go index ad515de..e39d384 100644 --- a/pkg/hicli/sync.go +++ b/pkg/hicli/sync.go @@ -66,6 +66,9 @@ func (h *HiClient) markSyncOK() { func (h *HiClient) preProcessSyncResponse(ctx context.Context, resp *mautrix.RespSync, since string) error { log := zerolog.Ctx(ctx) + listenToDevice := h.ToDeviceInSync.Load() + var syncTD []*SyncToDevice + postponedToDevices := resp.ToDevice.Events[:0] for _, evt := range resp.ToDevice.Events { evt.Type.Class = event.ToDeviceEventType @@ -80,19 +83,80 @@ func (h *HiClient) preProcessSyncResponse(ctx context.Context, resp *mautrix.Res switch content := evt.Content.Parsed.(type) { case *event.EncryptedEventContent: - h.Crypto.HandleEncryptedEvent(ctx, evt) + unhandledDecrypted := h.Crypto.HandleEncryptedEvent(ctx, evt) + if unhandledDecrypted != nil && listenToDevice { + syncTD = append(syncTD, &SyncToDevice{ + Sender: evt.Sender, + Type: unhandledDecrypted.Type, + Content: unhandledDecrypted.Content.VeryRaw, + Encrypted: true, + }) + } case *event.RoomKeyWithheldEventContent: - h.Crypto.HandleRoomKeyWithheld(ctx, content) - default: + // TODO move this check to mautrix-go? + if evt.Sender == h.Account.UserID && content.Code == event.RoomKeyWithheldUnavailable { + log.Debug().Any("withheld_content", content).Msg("Ignoring m.unavailable megolm session withheld event") + } else { + h.Crypto.HandleRoomKeyWithheld(ctx, content) + } + case *event.SecretRequestEventContent, *event.RoomKeyRequestEventContent: postponedToDevices = append(postponedToDevices, evt) + default: + if listenToDevice { + syncTD = append(syncTD, &SyncToDevice{ + Sender: evt.Sender, + Type: evt.Type, + Content: evt.Content.VeryRaw, + }) + } } } resp.ToDevice.Events = postponedToDevices + if len(syncTD) > 0 { + ctx.Value(syncContextKey).(*syncContext).evt.ToDevice = syncTD + } h.Crypto.MarkOlmHashSavePoint(ctx) return nil } +func (h *HiClient) maybeDiscardOutboundSession(ctx context.Context, newMembership event.Membership, evt *event.Event) bool { + var prevMembership event.Membership = "unknown" + if evt.Unsigned.PrevContent != nil { + prevMembership = event.Membership(gjson.GetBytes(evt.Unsigned.PrevContent.VeryRaw, "membership").Str) + } + if prevMembership == "unknown" || prevMembership == "" { + cs, err := h.DB.CurrentState.Get(ctx, evt.RoomID, event.StateMember, h.Account.UserID.String()) + if err != nil { + zerolog.Ctx(ctx).Warn().Err(err). + Stringer("room_id", evt.RoomID). + Str("user_id", evt.GetStateKey()). + Msg("Failed to get previous membership") + return false + } + prevMembership = event.Membership(gjson.GetBytes(cs.Content, "membership").Str) + } + if prevMembership == newMembership || + (prevMembership == event.MembershipInvite && newMembership == event.MembershipJoin) || + (prevMembership == event.MembershipJoin && newMembership == event.MembershipInvite) || + (prevMembership == event.MembershipBan && newMembership == event.MembershipLeave) || + (prevMembership == event.MembershipLeave && newMembership == event.MembershipBan) { + return false + } + zerolog.Ctx(ctx).Debug(). + Stringer("room_id", evt.RoomID). + Str("user_id", evt.GetStateKey()). + Str("prev_membership", string(prevMembership)). + Str("new_membership", string(newMembership)). + Msg("Got membership state change, invalidating group session in room") + err := h.CryptoStore.RemoveOutboundGroupSession(ctx, evt.RoomID) + if err != nil { + zerolog.Ctx(ctx).Warn().Stringer("room_id", evt.RoomID).Msg("Failed to invalidate outbound group session") + return false + } + return true +} + func (h *HiClient) postProcessSyncResponse(ctx context.Context, resp *mautrix.RespSync, since string) { h.Crypto.HandleOTKCounts(ctx, &resp.DeviceOTKCount) go h.asyncPostProcessSyncResponse(ctx, resp, since) @@ -297,6 +361,10 @@ func (h *HiClient) processSyncLeftRoom(ctx context.Context, roomID id.RoomID, ro if err != nil { return fmt.Errorf("failed to delete invited room: %w", err) } + err = h.CryptoStore.RemoveOutboundGroupSession(ctx, roomID) + if err != nil { + return fmt.Errorf("failed to remove outbound group session: %w", err) + } payload := ctx.Value(syncContextKey).(*syncContext).evt payload.LeftRooms = append(payload.LeftRooms, roomID) return nil @@ -572,6 +640,14 @@ func (h *HiClient) processEvent( return dbEvt, nil } } + if evt.StateKey != nil && evt.Unsigned.PrevContent == nil && evt.Unsigned.ReplacesState != "" { + replacesState, err := h.DB.Event.GetByID(ctx, evt.Unsigned.ReplacesState) + if err != nil { + return nil, fmt.Errorf("failed to get prev content for %s from %s: %w", evt.ID, evt.Unsigned.ReplacesState, err) + } else if replacesState != nil { + evt.Unsigned.PrevContent = &event.Content{VeryRaw: replacesState.Content} + } + } dbEvt := database.MautrixToEvent(evt) contentWithoutFallback := removeReplyFallback(evt) if contentWithoutFallback != nil { @@ -580,7 +656,7 @@ func (h *HiClient) processEvent( } var decryptionErr error var decryptedMautrixEvt *event.Event - if evt.Type == event.EventEncrypted && dbEvt.RedactedBy == "" { + if evt.Type == event.EventEncrypted && (dbEvt.RedactedBy == "" || len(dbEvt.Content) > 2) { decryptedMautrixEvt, decryptionErr = h.decryptEventInto(ctx, evt, dbEvt) } else if evt.Type == event.EventRedaction { if evt.Redacts != "" && gjson.GetBytes(evt.Content.VeryRaw, "redacts").Str != evt.Redacts.String() { @@ -715,6 +791,7 @@ func (h *HiClient) processStateAndTimeline( } return nil } + megolmSessionDiscarded := false processNewEvent := func(evt *event.Event, isTimeline, isUnread bool) (database.EventRowID, error) { evt.RoomID = room.ID dbEvt, err := h.processEvent(ctx, evt, summary, decryptionQueue, evt.Unsigned.TransactionID != "") @@ -747,6 +824,9 @@ func (h *HiClient) processStateAndTimeline( if summary != nil && slices.Contains(summary.Heroes, id.UserID(*evt.StateKey)) { heroesChanged = true } + if !megolmSessionDiscarded && room.EncryptionEvent != nil { + megolmSessionDiscarded = h.maybeDiscardOutboundSession(ctx, membership, evt) + } } else if evt.Type == event.StateElementFunctionalMembers { heroesChanged = true } diff --git a/pkg/hicli/syncwrap.go b/pkg/hicli/syncwrap.go index 8492da2..1abeaaa 100644 --- a/pkg/hicli/syncwrap.go +++ b/pkg/hicli/syncwrap.go @@ -69,7 +69,7 @@ func (h *hiSyncer) OnFailedSync(_ *mautrix.RespSync, err error) (time.Duration, c.syncErrors++ delay := 1 * time.Second if c.syncErrors > 5 { - delay = max(time.Duration(c.syncErrors)*time.Second, 30*time.Second) + delay = min(time.Duration(c.syncErrors)*time.Second, 30*time.Second) } c.markSyncErrored(err, false) c.Log.Err(err).Dur("retry_in", delay).Msg("Sync failed") diff --git a/web/package-lock.json b/web/package-lock.json index 804656b..a5ad218 100644 --- a/web/package-lock.json +++ b/web/package-lock.json @@ -11,8 +11,10 @@ "dependencies": { "@wailsio/runtime": "^3.0.0-alpha.29", "blurhash": "^2.0.5", + "fast-deep-equal": "^3.1.3", "katex": "^0.16.11", "leaflet": "^1.9.4", + "matrix-widget-api": "^1.13.1", "monaco-editor": "^0.52.0", "react": "^19.0.0", "react-blurhash": "^0.3.0", @@ -35,7 +37,7 @@ "globals": "^15.9.0", "typescript": "^5.5.3", "typescript-eslint": "^8.7.0", - "vite": "^5.4.8", + "vite": "^6.0.9", "vite-plugin-svgr": "^4.2.0" } }, @@ -69,9 +71,9 @@ } }, "node_modules/@babel/compat-data": { - "version": "7.26.3", - "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.26.3.tgz", - "integrity": "sha512-nHIxvKPniQXpmQLb0vhY3VaFb3S0YrTAwpOWJZh1wn3oJPjJk9Asva204PsBdmAE8vpzfHudT8DB0scYvy9q0g==", + "version": "7.26.8", + "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.26.8.tgz", + "integrity": "sha512-oH5UPLMWR3L2wEFLnFJ1TZXqHufiTKAiLfqw5zkhS4dKXLJ10yVztfil/twG8EDTA4F/tvVNw9nOl4ZMslB8rQ==", "dev": true, "license": "MIT", "engines": { @@ -79,22 +81,22 @@ } }, "node_modules/@babel/core": { - "version": "7.26.0", - "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.26.0.tgz", - "integrity": "sha512-i1SLeK+DzNnQ3LL/CswPCa/E5u4lh1k6IAEphON8F+cXt0t9euTshDru0q7/IqMa1PMPz5RnHuHscF8/ZJsStg==", + "version": "7.26.9", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.26.9.tgz", + "integrity": "sha512-lWBYIrF7qK5+GjY5Uy+/hEgp8OJWOD/rpy74GplYRhEauvbHDeFB8t5hPOZxCZ0Oxf4Cc36tK51/l3ymJysrKw==", "dev": true, "license": "MIT", "dependencies": { "@ampproject/remapping": "^2.2.0", - "@babel/code-frame": "^7.26.0", - "@babel/generator": "^7.26.0", - "@babel/helper-compilation-targets": "^7.25.9", + "@babel/code-frame": "^7.26.2", + "@babel/generator": "^7.26.9", + "@babel/helper-compilation-targets": "^7.26.5", "@babel/helper-module-transforms": "^7.26.0", - "@babel/helpers": "^7.26.0", - "@babel/parser": "^7.26.0", - "@babel/template": "^7.25.9", - "@babel/traverse": "^7.25.9", - "@babel/types": "^7.26.0", + "@babel/helpers": "^7.26.9", + "@babel/parser": "^7.26.9", + "@babel/template": "^7.26.9", + "@babel/traverse": "^7.26.9", + "@babel/types": "^7.26.9", "convert-source-map": "^2.0.0", "debug": "^4.1.0", "gensync": "^1.0.0-beta.2", @@ -123,14 +125,14 @@ } }, "node_modules/@babel/generator": { - "version": "7.26.3", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.26.3.tgz", - "integrity": "sha512-6FF/urZvD0sTeO7k6/B15pMLC4CHUv1426lzr3N01aHJTl046uCAh9LXW/fzeXXjPNCJ6iABW5XaWOsIZB93aQ==", + "version": "7.26.9", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.26.9.tgz", + "integrity": "sha512-kEWdzjOAUMW4hAyrzJ0ZaTOu9OmpyDIQicIh0zg0EEcEkYXZb2TjtBhnHi2ViX7PKwZqF4xwqfAm299/QMP3lg==", "dev": true, "license": "MIT", "dependencies": { - "@babel/parser": "^7.26.3", - "@babel/types": "^7.26.3", + "@babel/parser": "^7.26.9", + "@babel/types": "^7.26.9", "@jridgewell/gen-mapping": "^0.3.5", "@jridgewell/trace-mapping": "^0.3.25", "jsesc": "^3.0.2" @@ -140,13 +142,13 @@ } }, "node_modules/@babel/helper-compilation-targets": { - "version": "7.25.9", - "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.25.9.tgz", - "integrity": "sha512-j9Db8Suy6yV/VHa4qzrj9yZfZxhLWQdVnRlXxmKLYlhWUVB1sB2G5sxuWYXk/whHD9iW76PmNzxZ4UCnTQTVEQ==", + "version": "7.26.5", + "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.26.5.tgz", + "integrity": "sha512-IXuyn5EkouFJscIDuFF5EsiSolseme1s0CZB+QxVugqJLYmKdxI1VfIBOst0SUu4rnk2Z7kqTwmoO1lp3HIfnA==", "dev": true, "license": "MIT", "dependencies": { - "@babel/compat-data": "^7.25.9", + "@babel/compat-data": "^7.26.5", "@babel/helper-validator-option": "^7.25.9", "browserslist": "^4.24.0", "lru-cache": "^5.1.1", @@ -219,27 +221,27 @@ } }, "node_modules/@babel/helpers": { - "version": "7.26.0", - "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.26.0.tgz", - "integrity": "sha512-tbhNuIxNcVb21pInl3ZSjksLCvgdZy9KwJ8brv993QtIVKJBBkYXz4q4ZbAv31GdnC+R90np23L5FbEBlthAEw==", + "version": "7.26.9", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.26.9.tgz", + "integrity": "sha512-Mz/4+y8udxBKdmzt/UjPACs4G3j5SshJJEFFKxlCGPydG4JAHXxjWjAwjd09tf6oINvl1VfMJo+nB7H2YKQ0dA==", "dev": true, "license": "MIT", "dependencies": { - "@babel/template": "^7.25.9", - "@babel/types": "^7.26.0" + "@babel/template": "^7.26.9", + "@babel/types": "^7.26.9" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/parser": { - "version": "7.26.3", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.26.3.tgz", - "integrity": "sha512-WJ/CvmY8Mea8iDXo6a7RK2wbmJITT5fN3BEkRuFlxVyNx8jOKIIhmC4fSkTcPcf8JyavbBwIe6OpiCOBXt/IcA==", + "version": "7.26.9", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.26.9.tgz", + "integrity": "sha512-81NWa1njQblgZbQHxWHpxxCzNsa3ZwvFqpUg7P+NNUU6f3UU2jBEg4OlF/J6rl8+PQGh1q6/zWScd001YwcA5A==", "dev": true, "license": "MIT", "dependencies": { - "@babel/types": "^7.26.3" + "@babel/types": "^7.26.9" }, "bin": { "parser": "bin/babel-parser.js" @@ -249,32 +251,32 @@ } }, "node_modules/@babel/template": { - "version": "7.25.9", - "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.25.9.tgz", - "integrity": "sha512-9DGttpmPvIxBb/2uwpVo3dqJ+O6RooAFOS+lB+xDqoE2PVCE8nfoHMdZLpfCQRLwvohzXISPZcgxt80xLfsuwg==", + "version": "7.26.9", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.26.9.tgz", + "integrity": "sha512-qyRplbeIpNZhmzOysF/wFMuP9sctmh2cFzRAZOn1YapxBsE1i9bJIY586R/WBLfLcmcBlM8ROBiQURnnNy+zfA==", "dev": true, "license": "MIT", "dependencies": { - "@babel/code-frame": "^7.25.9", - "@babel/parser": "^7.25.9", - "@babel/types": "^7.25.9" + "@babel/code-frame": "^7.26.2", + "@babel/parser": "^7.26.9", + "@babel/types": "^7.26.9" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/traverse": { - "version": "7.26.4", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.26.4.tgz", - "integrity": "sha512-fH+b7Y4p3yqvApJALCPJcwb0/XaOSgtK4pzV6WVjPR5GLFQBRI7pfoX2V2iM48NXvX07NUxxm1Vw98YjqTcU5w==", + "version": "7.26.9", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.26.9.tgz", + "integrity": "sha512-ZYW7L+pL8ahU5fXmNbPF+iZFHCv5scFak7MZ9bwaRPLUhHh7QQEMjZUg0HevihoqCM5iSYHN61EyCoZvqC+bxg==", "dev": true, "license": "MIT", "dependencies": { "@babel/code-frame": "^7.26.2", - "@babel/generator": "^7.26.3", - "@babel/parser": "^7.26.3", - "@babel/template": "^7.25.9", - "@babel/types": "^7.26.3", + "@babel/generator": "^7.26.9", + "@babel/parser": "^7.26.9", + "@babel/template": "^7.26.9", + "@babel/types": "^7.26.9", "debug": "^4.3.1", "globals": "^11.1.0" }, @@ -293,9 +295,9 @@ } }, "node_modules/@babel/types": { - "version": "7.26.3", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.26.3.tgz", - "integrity": "sha512-vN5p+1kl59GVKMvTHt55NzzmYVxprfJD+ql7U9NFIfKCBkYE55LYtS+WtPlaYOyzydrKI8Nezd+aZextrd+FMA==", + "version": "7.26.9", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.26.9.tgz", + "integrity": "sha512-Y3IR1cRnOxOCDvMmNiym7XpXQ93iGDDPHx+Zj+NM+rg0fBaShfQLkg+hKPaZCEvg5N/LeCo4+Rj/i3FuJsIQaw==", "dev": true, "license": "MIT", "dependencies": { @@ -307,9 +309,9 @@ } }, "node_modules/@esbuild/aix-ppc64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.21.5.tgz", - "integrity": "sha512-1SDgH6ZSPTlggy1yI6+Dbkiz8xzpHJEVAlF/AM1tHPLsf5STom9rwtjE4hKAF20FfXXNTFqEYXyJNWh1GiZedQ==", + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.24.2.tgz", + "integrity": "sha512-thpVCb/rhxE/BnMLQ7GReQLLN8q9qbHmI55F4489/ByVg2aQaQ6kbcLb6FHkocZzQhxc4gx0sCk0tJkKBFzDhA==", "cpu": [ "ppc64" ], @@ -320,13 +322,13 @@ "aix" ], "engines": { - "node": ">=12" + "node": ">=18" } }, "node_modules/@esbuild/android-arm": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.21.5.tgz", - "integrity": "sha512-vCPvzSjpPHEi1siZdlvAlsPxXl7WbOVUBBAowWug4rJHb68Ox8KualB+1ocNvT5fjv6wpkX6o/iEpbDrf68zcg==", + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.24.2.tgz", + "integrity": "sha512-tmwl4hJkCfNHwFB3nBa8z1Uy3ypZpxqxfTQOcHX+xRByyYgunVbZ9MzUUfb0RxaHIMnbHagwAxuTL+tnNM+1/Q==", "cpu": [ "arm" ], @@ -337,13 +339,13 @@ "android" ], "engines": { - "node": ">=12" + "node": ">=18" } }, "node_modules/@esbuild/android-arm64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.21.5.tgz", - "integrity": "sha512-c0uX9VAUBQ7dTDCjq+wdyGLowMdtR/GoC2U5IYk/7D1H1JYC0qseD7+11iMP2mRLN9RcCMRcjC4YMclCzGwS/A==", + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.24.2.tgz", + "integrity": "sha512-cNLgeqCqV8WxfcTIOeL4OAtSmL8JjcN6m09XIgro1Wi7cF4t/THaWEa7eL5CMoMBdjoHOTh/vwTO/o2TRXIyzg==", "cpu": [ "arm64" ], @@ -354,13 +356,13 @@ "android" ], "engines": { - "node": ">=12" + "node": ">=18" } }, "node_modules/@esbuild/android-x64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.21.5.tgz", - "integrity": "sha512-D7aPRUUNHRBwHxzxRvp856rjUHRFW1SdQATKXH2hqA0kAZb1hKmi02OpYRacl0TxIGz/ZmXWlbZgjwWYaCakTA==", + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.24.2.tgz", + "integrity": "sha512-B6Q0YQDqMx9D7rvIcsXfmJfvUYLoP722bgfBlO5cGvNVb5V/+Y7nhBE3mHV9OpxBf4eAS2S68KZztiPaWq4XYw==", "cpu": [ "x64" ], @@ -371,13 +373,13 @@ "android" ], "engines": { - "node": ">=12" + "node": ">=18" } }, "node_modules/@esbuild/darwin-arm64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.21.5.tgz", - "integrity": "sha512-DwqXqZyuk5AiWWf3UfLiRDJ5EDd49zg6O9wclZ7kUMv2WRFr4HKjXp/5t8JZ11QbQfUS6/cRCKGwYhtNAY88kQ==", + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.24.2.tgz", + "integrity": "sha512-kj3AnYWc+CekmZnS5IPu9D+HWtUI49hbnyqk0FLEJDbzCIQt7hg7ucF1SQAilhtYpIujfaHr6O0UHlzzSPdOeA==", "cpu": [ "arm64" ], @@ -388,13 +390,13 @@ "darwin" ], "engines": { - "node": ">=12" + "node": ">=18" } }, "node_modules/@esbuild/darwin-x64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.21.5.tgz", - "integrity": "sha512-se/JjF8NlmKVG4kNIuyWMV/22ZaerB+qaSi5MdrXtd6R08kvs2qCN4C09miupktDitvh8jRFflwGFBQcxZRjbw==", + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.24.2.tgz", + "integrity": "sha512-WeSrmwwHaPkNR5H3yYfowhZcbriGqooyu3zI/3GGpF8AyUdsrrP0X6KumITGA9WOyiJavnGZUwPGvxvwfWPHIA==", "cpu": [ "x64" ], @@ -405,13 +407,13 @@ "darwin" ], "engines": { - "node": ">=12" + "node": ">=18" } }, "node_modules/@esbuild/freebsd-arm64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.21.5.tgz", - "integrity": "sha512-5JcRxxRDUJLX8JXp/wcBCy3pENnCgBR9bN6JsY4OmhfUtIHe3ZW0mawA7+RDAcMLrMIZaf03NlQiX9DGyB8h4g==", + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.24.2.tgz", + "integrity": "sha512-UN8HXjtJ0k/Mj6a9+5u6+2eZ2ERD7Edt1Q9IZiB5UZAIdPnVKDoG7mdTVGhHJIeEml60JteamR3qhsr1r8gXvg==", "cpu": [ "arm64" ], @@ -422,13 +424,13 @@ "freebsd" ], "engines": { - "node": ">=12" + "node": ">=18" } }, "node_modules/@esbuild/freebsd-x64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.21.5.tgz", - "integrity": "sha512-J95kNBj1zkbMXtHVH29bBriQygMXqoVQOQYA+ISs0/2l3T9/kj42ow2mpqerRBxDJnmkUDCaQT/dfNXWX/ZZCQ==", + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.24.2.tgz", + "integrity": "sha512-TvW7wE/89PYW+IevEJXZ5sF6gJRDY/14hyIGFXdIucxCsbRmLUcjseQu1SyTko+2idmCw94TgyaEZi9HUSOe3Q==", "cpu": [ "x64" ], @@ -439,13 +441,13 @@ "freebsd" ], "engines": { - "node": ">=12" + "node": ">=18" } }, "node_modules/@esbuild/linux-arm": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.21.5.tgz", - "integrity": "sha512-bPb5AHZtbeNGjCKVZ9UGqGwo8EUu4cLq68E95A53KlxAPRmUyYv2D6F0uUI65XisGOL1hBP5mTronbgo+0bFcA==", + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.24.2.tgz", + "integrity": "sha512-n0WRM/gWIdU29J57hJyUdIsk0WarGd6To0s+Y+LwvlC55wt+GT/OgkwoXCXvIue1i1sSNWblHEig00GBWiJgfA==", "cpu": [ "arm" ], @@ -456,13 +458,13 @@ "linux" ], "engines": { - "node": ">=12" + "node": ">=18" } }, "node_modules/@esbuild/linux-arm64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.21.5.tgz", - "integrity": "sha512-ibKvmyYzKsBeX8d8I7MH/TMfWDXBF3db4qM6sy+7re0YXya+K1cem3on9XgdT2EQGMu4hQyZhan7TeQ8XkGp4Q==", + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.24.2.tgz", + "integrity": "sha512-7HnAD6074BW43YvvUmE/35Id9/NB7BeX5EoNkK9obndmZBUk8xmJJeU7DwmUeN7tkysslb2eSl6CTrYz6oEMQg==", "cpu": [ "arm64" ], @@ -473,13 +475,13 @@ "linux" ], "engines": { - "node": ">=12" + "node": ">=18" } }, "node_modules/@esbuild/linux-ia32": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.21.5.tgz", - "integrity": "sha512-YvjXDqLRqPDl2dvRODYmmhz4rPeVKYvppfGYKSNGdyZkA01046pLWyRKKI3ax8fbJoK5QbxblURkwK/MWY18Tg==", + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.24.2.tgz", + "integrity": "sha512-sfv0tGPQhcZOgTKO3oBE9xpHuUqguHvSo4jl+wjnKwFpapx+vUDcawbwPNuBIAYdRAvIDBfZVvXprIj3HA+Ugw==", "cpu": [ "ia32" ], @@ -490,13 +492,13 @@ "linux" ], "engines": { - "node": ">=12" + "node": ">=18" } }, "node_modules/@esbuild/linux-loong64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.21.5.tgz", - "integrity": "sha512-uHf1BmMG8qEvzdrzAqg2SIG/02+4/DHB6a9Kbya0XDvwDEKCoC8ZRWI5JJvNdUjtciBGFQ5PuBlpEOXQj+JQSg==", + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.24.2.tgz", + "integrity": "sha512-CN9AZr8kEndGooS35ntToZLTQLHEjtVB5n7dl8ZcTZMonJ7CCfStrYhrzF97eAecqVbVJ7APOEe18RPI4KLhwQ==", "cpu": [ "loong64" ], @@ -507,13 +509,13 @@ "linux" ], "engines": { - "node": ">=12" + "node": ">=18" } }, "node_modules/@esbuild/linux-mips64el": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.21.5.tgz", - "integrity": "sha512-IajOmO+KJK23bj52dFSNCMsz1QP1DqM6cwLUv3W1QwyxkyIWecfafnI555fvSGqEKwjMXVLokcV5ygHW5b3Jbg==", + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.24.2.tgz", + "integrity": "sha512-iMkk7qr/wl3exJATwkISxI7kTcmHKE+BlymIAbHO8xanq/TjHaaVThFF6ipWzPHryoFsesNQJPE/3wFJw4+huw==", "cpu": [ "mips64el" ], @@ -524,13 +526,13 @@ "linux" ], "engines": { - "node": ">=12" + "node": ">=18" } }, "node_modules/@esbuild/linux-ppc64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.21.5.tgz", - "integrity": "sha512-1hHV/Z4OEfMwpLO8rp7CvlhBDnjsC3CttJXIhBi+5Aj5r+MBvy4egg7wCbe//hSsT+RvDAG7s81tAvpL2XAE4w==", + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.24.2.tgz", + "integrity": "sha512-shsVrgCZ57Vr2L8mm39kO5PPIb+843FStGt7sGGoqiiWYconSxwTiuswC1VJZLCjNiMLAMh34jg4VSEQb+iEbw==", "cpu": [ "ppc64" ], @@ -541,13 +543,13 @@ "linux" ], "engines": { - "node": ">=12" + "node": ">=18" } }, "node_modules/@esbuild/linux-riscv64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.21.5.tgz", - "integrity": "sha512-2HdXDMd9GMgTGrPWnJzP2ALSokE/0O5HhTUvWIbD3YdjME8JwvSCnNGBnTThKGEB91OZhzrJ4qIIxk/SBmyDDA==", + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.24.2.tgz", + "integrity": "sha512-4eSFWnU9Hhd68fW16GD0TINewo1L6dRrB+oLNNbYyMUAeOD2yCK5KXGK1GH4qD/kT+bTEXjsyTCiJGHPZ3eM9Q==", "cpu": [ "riscv64" ], @@ -558,13 +560,13 @@ "linux" ], "engines": { - "node": ">=12" + "node": ">=18" } }, "node_modules/@esbuild/linux-s390x": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.21.5.tgz", - "integrity": "sha512-zus5sxzqBJD3eXxwvjN1yQkRepANgxE9lgOW2qLnmr8ikMTphkjgXu1HR01K4FJg8h1kEEDAqDcZQtbrRnB41A==", + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.24.2.tgz", + "integrity": "sha512-S0Bh0A53b0YHL2XEXC20bHLuGMOhFDO6GN4b3YjRLK//Ep3ql3erpNcPlEFed93hsQAjAQDNsvcK+hV90FubSw==", "cpu": [ "s390x" ], @@ -575,13 +577,13 @@ "linux" ], "engines": { - "node": ">=12" + "node": ">=18" } }, "node_modules/@esbuild/linux-x64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.21.5.tgz", - "integrity": "sha512-1rYdTpyv03iycF1+BhzrzQJCdOuAOtaqHTWJZCWvijKD2N5Xu0TtVC8/+1faWqcP9iBCWOmjmhoH94dH82BxPQ==", + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.24.2.tgz", + "integrity": "sha512-8Qi4nQcCTbLnK9WoMjdC9NiTG6/E38RNICU6sUNqK0QFxCYgoARqVqxdFmWkdonVsvGqWhmm7MO0jyTqLqwj0Q==", "cpu": [ "x64" ], @@ -592,13 +594,30 @@ "linux" ], "engines": { - "node": ">=12" + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-arm64": { + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.24.2.tgz", + "integrity": "sha512-wuLK/VztRRpMt9zyHSazyCVdCXlpHkKm34WUyinD2lzK07FAHTq0KQvZZlXikNWkDGoT6x3TD51jKQ7gMVpopw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" } }, "node_modules/@esbuild/netbsd-x64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.21.5.tgz", - "integrity": "sha512-Woi2MXzXjMULccIwMnLciyZH4nCIMpWQAs049KEeMvOcNADVxo0UBIQPfSmxB3CWKedngg7sWZdLvLczpe0tLg==", + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.24.2.tgz", + "integrity": "sha512-VefFaQUc4FMmJuAxmIHgUmfNiLXY438XrL4GDNV1Y1H/RW3qow68xTwjZKfj/+Plp9NANmzbH5R40Meudu8mmw==", "cpu": [ "x64" ], @@ -609,13 +628,30 @@ "netbsd" ], "engines": { - "node": ">=12" + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-arm64": { + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.24.2.tgz", + "integrity": "sha512-YQbi46SBct6iKnszhSvdluqDmxCJA+Pu280Av9WICNwQmMxV7nLRHZfjQzwbPs3jeWnuAhE9Jy0NrnJ12Oz+0A==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" } }, "node_modules/@esbuild/openbsd-x64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.21.5.tgz", - "integrity": "sha512-HLNNw99xsvx12lFBUwoT8EVCsSvRNDVxNpjZ7bPn947b8gJPzeHWyNVhFsaerc0n3TsbOINvRP2byTZ5LKezow==", + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.24.2.tgz", + "integrity": "sha512-+iDS6zpNM6EnJyWv0bMGLWSWeXGN/HTaF/LXHXHwejGsVi+ooqDfMCCTerNFxEkM3wYVcExkeGXNqshc9iMaOA==", "cpu": [ "x64" ], @@ -626,13 +662,13 @@ "openbsd" ], "engines": { - "node": ">=12" + "node": ">=18" } }, "node_modules/@esbuild/sunos-x64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.21.5.tgz", - "integrity": "sha512-6+gjmFpfy0BHU5Tpptkuh8+uw3mnrvgs+dSPQXQOv3ekbordwnzTVEb4qnIvQcYXq6gzkyTnoZ9dZG+D4garKg==", + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.24.2.tgz", + "integrity": "sha512-hTdsW27jcktEvpwNHJU4ZwWFGkz2zRJUz8pvddmXPtXDzVKTTINmlmga3ZzwcuMpUvLw7JkLy9QLKyGpD2Yxig==", "cpu": [ "x64" ], @@ -643,13 +679,13 @@ "sunos" ], "engines": { - "node": ">=12" + "node": ">=18" } }, "node_modules/@esbuild/win32-arm64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.21.5.tgz", - "integrity": "sha512-Z0gOTd75VvXqyq7nsl93zwahcTROgqvuAcYDUr+vOv8uHhNSKROyU961kgtCD1e95IqPKSQKH7tBTslnS3tA8A==", + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.24.2.tgz", + "integrity": "sha512-LihEQ2BBKVFLOC9ZItT9iFprsE9tqjDjnbulhHoFxYQtQfai7qfluVODIYxt1PgdoyQkz23+01rzwNwYfutxUQ==", "cpu": [ "arm64" ], @@ -660,13 +696,13 @@ "win32" ], "engines": { - "node": ">=12" + "node": ">=18" } }, "node_modules/@esbuild/win32-ia32": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.21.5.tgz", - "integrity": "sha512-SWXFF1CL2RVNMaVs+BBClwtfZSvDgtL//G/smwAc5oVK/UPu2Gu9tIaRgFmYFFKrmg3SyAjSrElf0TiJ1v8fYA==", + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.24.2.tgz", + "integrity": "sha512-q+iGUwfs8tncmFC9pcnD5IvRHAzmbwQ3GPS5/ceCyHdjXubwQWI12MKWSNSMYLJMq23/IUCvJMS76PDqXe1fxA==", "cpu": [ "ia32" ], @@ -677,13 +713,13 @@ "win32" ], "engines": { - "node": ">=12" + "node": ">=18" } }, "node_modules/@esbuild/win32-x64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.21.5.tgz", - "integrity": "sha512-tQd/1efJuzPC6rCFwEvLtci/xNFcTZknmXs98FYDfGE4wP9ClFV98nyKrzJKVPMhdDnjzLhdUyMX4PsQAPjwIw==", + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.24.2.tgz", + "integrity": "sha512-7VTgWzgMGvup6aSqDPLiW5zHaxYJGTO4OokMjIlrCtf+VpEL+cXKtCvg723iguPYI5oaUNdS+/V7OU2gvXVWEg==", "cpu": [ "x64" ], @@ -694,7 +730,7 @@ "win32" ], "engines": { - "node": ">=12" + "node": ">=18" } }, "node_modules/@eslint-community/eslint-utils": { @@ -740,13 +776,13 @@ } }, "node_modules/@eslint/config-array": { - "version": "0.19.1", - "resolved": "https://registry.npmjs.org/@eslint/config-array/-/config-array-0.19.1.tgz", - "integrity": "sha512-fo6Mtm5mWyKjA/Chy1BYTdn5mGJoDNjC7C64ug20ADsRDGrA85bN3uK3MaKbeRkRuuIEAR5N33Jr1pbm411/PA==", + "version": "0.19.2", + "resolved": "https://registry.npmjs.org/@eslint/config-array/-/config-array-0.19.2.tgz", + "integrity": "sha512-GNKqxfHG2ySmJOBSHg7LxeUx4xpuCoFjacmlCoYWEbaPXLwvfIjixRI12xCQZeULksQb23uiA8F40w5TojpV7w==", "dev": true, "license": "Apache-2.0", "dependencies": { - "@eslint/object-schema": "^2.1.5", + "@eslint/object-schema": "^2.1.6", "debug": "^4.3.1", "minimatch": "^3.1.2" }, @@ -755,9 +791,9 @@ } }, "node_modules/@eslint/core": { - "version": "0.9.1", - "resolved": "https://registry.npmjs.org/@eslint/core/-/core-0.9.1.tgz", - "integrity": "sha512-GuUdqkyyzQI5RMIWkHhvTWLCyLo1jNK3vzkSyaExH5kHPDHcuL2VOpHjmMY+y3+NC69qAKToBqldTBgYeLSr9Q==", + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/@eslint/core/-/core-0.12.0.tgz", + "integrity": "sha512-cmrR6pytBuSMTaBweKoGMwu3EiHiEC+DoyupPmlZ0HxBJBtIxwe+j/E4XPIKNx+Q74c8lXKPwYawBf5glsTkHg==", "dev": true, "license": "Apache-2.0", "dependencies": { @@ -768,9 +804,9 @@ } }, "node_modules/@eslint/eslintrc": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-3.2.0.tgz", - "integrity": "sha512-grOjVNN8P3hjJn/eIETF1wwd12DdnwFDoyceUJLYYdkpbwq3nLi+4fqrTAONx7XDALqlL220wC/RHSC/QTI/0w==", + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-3.3.0.tgz", + "integrity": "sha512-yaVPAiNAalnCZedKLdR21GOGILMLKPyqSLWaAjQFvYA2i/ciDi8ArYVr69Anohb6cH2Ukhqti4aFnYyPm8wdwQ==", "dev": true, "license": "MIT", "dependencies": { @@ -805,9 +841,9 @@ } }, "node_modules/@eslint/js": { - "version": "9.17.0", - "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.17.0.tgz", - "integrity": "sha512-Sxc4hqcs1kTu0iID3kcZDW3JHq2a77HO9P8CP6YEA/FpH3Ll8UXE2r/86Rz9YJLKme39S9vU5OWNjC6Xl0Cr3w==", + "version": "9.21.0", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.21.0.tgz", + "integrity": "sha512-BqStZ3HX8Yz6LvsF5ByXYrtigrV5AXADWLAGc7PH/1SxOb7/FIYYMszZZWiUou/GB9P2lXWk2SV4d+Z8h0nknw==", "dev": true, "license": "MIT", "engines": { @@ -815,9 +851,9 @@ } }, "node_modules/@eslint/object-schema": { - "version": "2.1.5", - "resolved": "https://registry.npmjs.org/@eslint/object-schema/-/object-schema-2.1.5.tgz", - "integrity": "sha512-o0bhxnL89h5Bae5T318nFoFzGy+YE5i/gGkoPAgkmTVdRKTiv3p8JHevPiPaMwoloKfEiiaHlawCqaZMqRm+XQ==", + "version": "2.1.6", + "resolved": "https://registry.npmjs.org/@eslint/object-schema/-/object-schema-2.1.6.tgz", + "integrity": "sha512-RBMg5FRL0I0gs51M/guSAj5/e14VQ4tpZnQNWwuDT66P14I43ItmPfIZRhO9fUVIPOAQXU47atlywZ/czoqFPA==", "dev": true, "license": "Apache-2.0", "engines": { @@ -825,12 +861,13 @@ } }, "node_modules/@eslint/plugin-kit": { - "version": "0.2.4", - "resolved": "https://registry.npmjs.org/@eslint/plugin-kit/-/plugin-kit-0.2.4.tgz", - "integrity": "sha512-zSkKow6H5Kdm0ZUQUB2kV5JIXqoG0+uH5YADhaEHswm664N9Db8dXSi0nMJpacpMf+MyyglF1vnZohpEg5yUtg==", + "version": "0.2.7", + "resolved": "https://registry.npmjs.org/@eslint/plugin-kit/-/plugin-kit-0.2.7.tgz", + "integrity": "sha512-JubJ5B2pJ4k4yGxaNLdbjrnk9d/iDz6/q8wOilpIowd6PJPgaxCuHBnBszq7Ce2TyMrywm5r4PnKm6V3iiZF+g==", "dev": true, "license": "Apache-2.0", "dependencies": { + "@eslint/core": "^0.12.0", "levn": "^0.4.1" }, "engines": { @@ -890,9 +927,9 @@ } }, "node_modules/@humanwhocodes/retry": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/@humanwhocodes/retry/-/retry-0.4.1.tgz", - "integrity": "sha512-c7hNEllBlenFTHBky65mhq8WD2kbN9Q6gk0bTk8lSBvc554jpXSkST1iePudpt7+A/AQvuHs9EMqjHDXMY1lrA==", + "version": "0.4.2", + "resolved": "https://registry.npmjs.org/@humanwhocodes/retry/-/retry-0.4.2.tgz", + "integrity": "sha512-xeO57FpIu4p1Ri3Jq/EXq4ClRm86dVF2z/+kvFnyqVYRavTZmaFaUBbWCOuuTh0o/g7DSsk6kc2vrS4Vl5oPOQ==", "dev": true, "license": "Apache-2.0", "engines": { @@ -1031,9 +1068,9 @@ } }, "node_modules/@rollup/rollup-android-arm-eabi": { - "version": "4.30.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.30.0.tgz", - "integrity": "sha512-qFcFto9figFLz2g25DxJ1WWL9+c91fTxnGuwhToCl8BaqDsDYMl/kOnBXAyAqkkzAWimYMSWNPWEjt+ADAHuoQ==", + "version": "4.34.8", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.34.8.tgz", + "integrity": "sha512-q217OSE8DTp8AFHuNHXo0Y86e1wtlfVrXiAlwkIvGRQv9zbc6mE3sjIVfwI8sYUyNxwOg0j/Vm1RKM04JcWLJw==", "cpu": [ "arm" ], @@ -1045,9 +1082,9 @@ ] }, "node_modules/@rollup/rollup-android-arm64": { - "version": "4.30.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.30.0.tgz", - "integrity": "sha512-vqrQdusvVl7dthqNjWCL043qelBK+gv9v3ZiqdxgaJvmZyIAAXMjeGVSqZynKq69T7062T5VrVTuikKSAAVP6A==", + "version": "4.34.8", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.34.8.tgz", + "integrity": "sha512-Gigjz7mNWaOL9wCggvoK3jEIUUbGul656opstjaUSGC3eT0BM7PofdAJaBfPFWWkXNVAXbaQtC99OCg4sJv70Q==", "cpu": [ "arm64" ], @@ -1059,9 +1096,9 @@ ] }, "node_modules/@rollup/rollup-darwin-arm64": { - "version": "4.30.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.30.0.tgz", - "integrity": "sha512-617pd92LhdA9+wpixnzsyhVft3szYiN16aNUMzVkf2N+yAk8UXY226Bfp36LvxYTUt7MO/ycqGFjQgJ0wlMaWQ==", + "version": "4.34.8", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.34.8.tgz", + "integrity": "sha512-02rVdZ5tgdUNRxIUrFdcMBZQoaPMrxtwSb+/hOfBdqkatYHR3lZ2A2EGyHq2sGOd0Owk80oV3snlDASC24He3Q==", "cpu": [ "arm64" ], @@ -1073,9 +1110,9 @@ ] }, "node_modules/@rollup/rollup-darwin-x64": { - "version": "4.30.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.30.0.tgz", - "integrity": "sha512-Y3b4oDoaEhCypg8ajPqigKDcpi5ZZovemQl9Edpem0uNv6UUjXv7iySBpGIUTSs2ovWOzYpfw9EbFJXF/fJHWw==", + "version": "4.34.8", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.34.8.tgz", + "integrity": "sha512-qIP/elwR/tq/dYRx3lgwK31jkZvMiD6qUtOycLhTzCvrjbZ3LjQnEM9rNhSGpbLXVJYQ3rq39A6Re0h9tU2ynw==", "cpu": [ "x64" ], @@ -1087,9 +1124,9 @@ ] }, "node_modules/@rollup/rollup-freebsd-arm64": { - "version": "4.30.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.30.0.tgz", - "integrity": "sha512-3REQJ4f90sFIBfa0BUokiCdrV/E4uIjhkWe1bMgCkhFXbf4D8YN6C4zwJL881GM818qVYE9BO3dGwjKhpo2ABA==", + "version": "4.34.8", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.34.8.tgz", + "integrity": "sha512-IQNVXL9iY6NniYbTaOKdrlVP3XIqazBgJOVkddzJlqnCpRi/yAeSOa8PLcECFSQochzqApIOE1GHNu3pCz+BDA==", "cpu": [ "arm64" ], @@ -1101,9 +1138,9 @@ ] }, "node_modules/@rollup/rollup-freebsd-x64": { - "version": "4.30.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.30.0.tgz", - "integrity": "sha512-ZtY3Y8icbe3Cc+uQicsXG5L+CRGUfLZjW6j2gn5ikpltt3Whqjfo5mkyZ86UiuHF9Q3ZsaQeW7YswlHnN+lAcg==", + "version": "4.34.8", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.34.8.tgz", + "integrity": "sha512-TYXcHghgnCqYFiE3FT5QwXtOZqDj5GmaFNTNt3jNC+vh22dc/ukG2cG+pi75QO4kACohZzidsq7yKTKwq/Jq7Q==", "cpu": [ "x64" ], @@ -1115,9 +1152,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm-gnueabihf": { - "version": "4.30.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.30.0.tgz", - "integrity": "sha512-bsPGGzfiHXMhQGuFGpmo2PyTwcrh2otL6ycSZAFTESviUoBOuxF7iBbAL5IJXc/69peXl5rAtbewBFeASZ9O0g==", + "version": "4.34.8", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.34.8.tgz", + "integrity": "sha512-A4iphFGNkWRd+5m3VIGuqHnG3MVnqKe7Al57u9mwgbyZ2/xF9Jio72MaY7xxh+Y87VAHmGQr73qoKL9HPbXj1g==", "cpu": [ "arm" ], @@ -1129,9 +1166,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm-musleabihf": { - "version": "4.30.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.30.0.tgz", - "integrity": "sha512-kvyIECEhs2DrrdfQf++maCWJIQ974EI4txlz1nNSBaCdtf7i5Xf1AQCEJWOC5rEBisdaMFFnOWNLYt7KpFqy5A==", + "version": "4.34.8", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.34.8.tgz", + "integrity": "sha512-S0lqKLfTm5u+QTxlFiAnb2J/2dgQqRy/XvziPtDd1rKZFXHTyYLoVL58M/XFwDI01AQCDIevGLbQrMAtdyanpA==", "cpu": [ "arm" ], @@ -1143,9 +1180,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm64-gnu": { - "version": "4.30.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.30.0.tgz", - "integrity": "sha512-CFE7zDNrokaotXu+shwIrmWrFxllg79vciH4E/zeK7NitVuWEaXRzS0mFfFvyhZfn8WfVOG/1E9u8/DFEgK7WQ==", + "version": "4.34.8", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.34.8.tgz", + "integrity": "sha512-jpz9YOuPiSkL4G4pqKrus0pn9aYwpImGkosRKwNi+sJSkz+WU3anZe6hi73StLOQdfXYXC7hUfsQlTnjMd3s1A==", "cpu": [ "arm64" ], @@ -1157,9 +1194,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm64-musl": { - "version": "4.30.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.30.0.tgz", - "integrity": "sha512-MctNTBlvMcIBP0t8lV/NXiUwFg9oK5F79CxLU+a3xgrdJjfBLVIEHSAjQ9+ipofN2GKaMLnFFXLltg1HEEPaGQ==", + "version": "4.34.8", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.34.8.tgz", + "integrity": "sha512-KdSfaROOUJXgTVxJNAZ3KwkRc5nggDk+06P6lgi1HLv1hskgvxHUKZ4xtwHkVYJ1Rep4GNo+uEfycCRRxht7+Q==", "cpu": [ "arm64" ], @@ -1171,9 +1208,9 @@ ] }, "node_modules/@rollup/rollup-linux-loongarch64-gnu": { - "version": "4.30.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loongarch64-gnu/-/rollup-linux-loongarch64-gnu-4.30.0.tgz", - "integrity": "sha512-fBpoYwLEPivL3q368+gwn4qnYnr7GVwM6NnMo8rJ4wb0p/Y5lg88vQRRP077gf+tc25akuqd+1Sxbn9meODhwA==", + "version": "4.34.8", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loongarch64-gnu/-/rollup-linux-loongarch64-gnu-4.34.8.tgz", + "integrity": "sha512-NyF4gcxwkMFRjgXBM6g2lkT58OWztZvw5KkV2K0qqSnUEqCVcqdh2jN4gQrTn/YUpAcNKyFHfoOZEer9nwo6uQ==", "cpu": [ "loong64" ], @@ -1185,9 +1222,9 @@ ] }, "node_modules/@rollup/rollup-linux-powerpc64le-gnu": { - "version": "4.30.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.30.0.tgz", - "integrity": "sha512-1hiHPV6dUaqIMXrIjN+vgJqtfkLpqHS1Xsg0oUfUVD98xGp1wX89PIXgDF2DWra1nxAd8dfE0Dk59MyeKaBVAw==", + "version": "4.34.8", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.34.8.tgz", + "integrity": "sha512-LMJc999GkhGvktHU85zNTDImZVUCJ1z/MbAJTnviiWmmjyckP5aQsHtcujMjpNdMZPT2rQEDBlJfubhs3jsMfw==", "cpu": [ "ppc64" ], @@ -1199,9 +1236,9 @@ ] }, "node_modules/@rollup/rollup-linux-riscv64-gnu": { - "version": "4.30.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.30.0.tgz", - "integrity": "sha512-U0xcC80SMpEbvvLw92emHrNjlS3OXjAM0aVzlWfar6PR0ODWCTQtKeeB+tlAPGfZQXicv1SpWwRz9Hyzq3Jx3g==", + "version": "4.34.8", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.34.8.tgz", + "integrity": "sha512-xAQCAHPj8nJq1PI3z8CIZzXuXCstquz7cIOL73HHdXiRcKk8Ywwqtx2wrIy23EcTn4aZ2fLJNBB8d0tQENPCmw==", "cpu": [ "riscv64" ], @@ -1213,9 +1250,9 @@ ] }, "node_modules/@rollup/rollup-linux-s390x-gnu": { - "version": "4.30.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.30.0.tgz", - "integrity": "sha512-VU/P/IODrNPasgZDLIFJmMiLGez+BN11DQWfTVlViJVabyF3JaeaJkP6teI8760f18BMGCQOW9gOmuzFaI1pUw==", + "version": "4.34.8", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.34.8.tgz", + "integrity": "sha512-DdePVk1NDEuc3fOe3dPPTb+rjMtuFw89gw6gVWxQFAuEqqSdDKnrwzZHrUYdac7A7dXl9Q2Vflxpme15gUWQFA==", "cpu": [ "s390x" ], @@ -1227,9 +1264,9 @@ ] }, "node_modules/@rollup/rollup-linux-x64-gnu": { - "version": "4.30.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.30.0.tgz", - "integrity": "sha512-laQVRvdbKmjXuFA3ZiZj7+U24FcmoPlXEi2OyLfbpY2MW1oxLt9Au8q9eHd0x6Pw/Kw4oe9gwVXWwIf2PVqblg==", + "version": "4.34.8", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.34.8.tgz", + "integrity": "sha512-8y7ED8gjxITUltTUEJLQdgpbPh1sUQ0kMTmufRF/Ns5tI9TNMNlhWtmPKKHCU0SilX+3MJkZ0zERYYGIVBYHIA==", "cpu": [ "x64" ], @@ -1241,9 +1278,9 @@ ] }, "node_modules/@rollup/rollup-linux-x64-musl": { - "version": "4.30.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.30.0.tgz", - "integrity": "sha512-3wzKzduS7jzxqcOvy/ocU/gMR3/QrHEFLge5CD7Si9fyHuoXcidyYZ6jyx8OPYmCcGm3uKTUl+9jUSAY74Ln5A==", + "version": "4.34.8", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.34.8.tgz", + "integrity": "sha512-SCXcP0ZpGFIe7Ge+McxY5zKxiEI5ra+GT3QRxL0pMMtxPfpyLAKleZODi1zdRHkz5/BhueUrYtYVgubqe9JBNQ==", "cpu": [ "x64" ], @@ -1255,9 +1292,9 @@ ] }, "node_modules/@rollup/rollup-win32-arm64-msvc": { - "version": "4.30.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.30.0.tgz", - "integrity": "sha512-jROwnI1+wPyuv696rAFHp5+6RFhXGGwgmgSfzE8e4xfit6oLRg7GyMArVUoM3ChS045OwWr9aTnU+2c1UdBMyw==", + "version": "4.34.8", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.34.8.tgz", + "integrity": "sha512-YHYsgzZgFJzTRbth4h7Or0m5O74Yda+hLin0irAIobkLQFRQd1qWmnoVfwmKm9TXIZVAD0nZ+GEb2ICicLyCnQ==", "cpu": [ "arm64" ], @@ -1269,9 +1306,9 @@ ] }, "node_modules/@rollup/rollup-win32-ia32-msvc": { - "version": "4.30.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.30.0.tgz", - "integrity": "sha512-duzweyup5WELhcXx5H1jokpr13i3BV9b48FMiikYAwk/MT1LrMYYk2TzenBd0jj4ivQIt58JWSxc19y4SvLP4g==", + "version": "4.34.8", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.34.8.tgz", + "integrity": "sha512-r3NRQrXkHr4uWy5TOjTpTYojR9XmF0j/RYgKCef+Ag46FWUTltm5ziticv8LdNsDMehjJ543x/+TJAek/xBA2w==", "cpu": [ "ia32" ], @@ -1283,9 +1320,9 @@ ] }, "node_modules/@rollup/rollup-win32-x64-msvc": { - "version": "4.30.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.30.0.tgz", - "integrity": "sha512-DYvxS0M07PvgvavMIybCOBYheyrqlui6ZQBHJs6GqduVzHSZ06TPPvlfvnYstjODHQ8UUXFwt5YE+h0jFI8kwg==", + "version": "4.34.8", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.34.8.tgz", + "integrity": "sha512-U0FaE5O1BCpZSeE6gBl3c5ObhePQSfk9vDRToMmTkbhCOgW4jqvtS5LGyQ76L1fH8sM0keRp4uDTsbjiUyjk0g==", "cpu": [ "x64" ], @@ -1529,9 +1566,9 @@ } }, "node_modules/@swc/core": { - "version": "1.10.4", - "resolved": "https://registry.npmjs.org/@swc/core/-/core-1.10.4.tgz", - "integrity": "sha512-ut3zfiTLORMxhr6y/GBxkHmzcGuVpwJYX4qyXWuBKkpw/0g0S5iO1/wW7RnLnZbAi8wS/n0atRZoaZlXWBkeJg==", + "version": "1.10.18", + "resolved": "https://registry.npmjs.org/@swc/core/-/core-1.10.18.tgz", + "integrity": "sha512-IUWKD6uQYGRy8w2X9EZrtYg1O3SCijlHbCXzMaHQYc1X7yjijQh4H3IVL9ssZZyVp2ZDfQZu4bD5DWxxvpyjvg==", "dev": true, "hasInstallScript": true, "license": "Apache-2.0", @@ -1547,16 +1584,16 @@ "url": "https://opencollective.com/swc" }, "optionalDependencies": { - "@swc/core-darwin-arm64": "1.10.4", - "@swc/core-darwin-x64": "1.10.4", - "@swc/core-linux-arm-gnueabihf": "1.10.4", - "@swc/core-linux-arm64-gnu": "1.10.4", - "@swc/core-linux-arm64-musl": "1.10.4", - "@swc/core-linux-x64-gnu": "1.10.4", - "@swc/core-linux-x64-musl": "1.10.4", - "@swc/core-win32-arm64-msvc": "1.10.4", - "@swc/core-win32-ia32-msvc": "1.10.4", - "@swc/core-win32-x64-msvc": "1.10.4" + "@swc/core-darwin-arm64": "1.10.18", + "@swc/core-darwin-x64": "1.10.18", + "@swc/core-linux-arm-gnueabihf": "1.10.18", + "@swc/core-linux-arm64-gnu": "1.10.18", + "@swc/core-linux-arm64-musl": "1.10.18", + "@swc/core-linux-x64-gnu": "1.10.18", + "@swc/core-linux-x64-musl": "1.10.18", + "@swc/core-win32-arm64-msvc": "1.10.18", + "@swc/core-win32-ia32-msvc": "1.10.18", + "@swc/core-win32-x64-msvc": "1.10.18" }, "peerDependencies": { "@swc/helpers": "*" @@ -1568,9 +1605,9 @@ } }, "node_modules/@swc/core-darwin-arm64": { - "version": "1.10.4", - "resolved": "https://registry.npmjs.org/@swc/core-darwin-arm64/-/core-darwin-arm64-1.10.4.tgz", - "integrity": "sha512-sV/eurLhkjn/197y48bxKP19oqcLydSel42Qsy2zepBltqUx+/zZ8+/IS0Bi7kaWVFxerbW1IPB09uq8Zuvm3g==", + "version": "1.10.18", + "resolved": "https://registry.npmjs.org/@swc/core-darwin-arm64/-/core-darwin-arm64-1.10.18.tgz", + "integrity": "sha512-FdGqzAIKVQJu8ROlnHElP59XAUsUzCFSNsou+tY/9ba+lhu8R9v0OI5wXiPErrKGZpQFMmx/BPqqhx3X4SuGNg==", "cpu": [ "arm64" ], @@ -1585,9 +1622,9 @@ } }, "node_modules/@swc/core-darwin-x64": { - "version": "1.10.4", - "resolved": "https://registry.npmjs.org/@swc/core-darwin-x64/-/core-darwin-x64-1.10.4.tgz", - "integrity": "sha512-gjYNU6vrAUO4+FuovEo9ofnVosTFXkF0VDuo1MKPItz6e2pxc2ale4FGzLw0Nf7JB1sX4a8h06CN16/pLJ8Q2w==", + "version": "1.10.18", + "resolved": "https://registry.npmjs.org/@swc/core-darwin-x64/-/core-darwin-x64-1.10.18.tgz", + "integrity": "sha512-RZ73gZRituL/ZVLgrW6BYnQ5g8tuStG4cLUiPGJsUZpUm0ullSH6lHFvZTCBNFTfpQChG6eEhi2IdG6DwFp1lw==", "cpu": [ "x64" ], @@ -1602,9 +1639,9 @@ } }, "node_modules/@swc/core-linux-arm-gnueabihf": { - "version": "1.10.4", - "resolved": "https://registry.npmjs.org/@swc/core-linux-arm-gnueabihf/-/core-linux-arm-gnueabihf-1.10.4.tgz", - "integrity": "sha512-zd7fXH5w8s+Sfvn2oO464KDWl+ZX1MJiVmE4Pdk46N3PEaNwE0koTfgx2vQRqRG4vBBobzVvzICC3618WcefOA==", + "version": "1.10.18", + "resolved": "https://registry.npmjs.org/@swc/core-linux-arm-gnueabihf/-/core-linux-arm-gnueabihf-1.10.18.tgz", + "integrity": "sha512-8iJqI3EkxJuuq21UHoen1VS+QlS23RvynRuk95K+Q2HBjygetztCGGEc+Xelx9a0uPkDaaAtFvds4JMDqb9SAA==", "cpu": [ "arm" ], @@ -1619,9 +1656,9 @@ } }, "node_modules/@swc/core-linux-arm64-gnu": { - "version": "1.10.4", - "resolved": "https://registry.npmjs.org/@swc/core-linux-arm64-gnu/-/core-linux-arm64-gnu-1.10.4.tgz", - "integrity": "sha512-+UGfoHDxsMZgFD3tABKLeEZHqLNOkxStu+qCG7atGBhS4Slri6h6zijVvf4yI5X3kbXdvc44XV/hrP/Klnui2A==", + "version": "1.10.18", + "resolved": "https://registry.npmjs.org/@swc/core-linux-arm64-gnu/-/core-linux-arm64-gnu-1.10.18.tgz", + "integrity": "sha512-8f1kSktWzMB6PG+r8lOlCfXz5E8Qhsmfwonn77T/OfjvGwQaWrcoASh2cdjpk3dydbf8jsKGPQE1lSc7GyjXRQ==", "cpu": [ "arm64" ], @@ -1636,9 +1673,9 @@ } }, "node_modules/@swc/core-linux-arm64-musl": { - "version": "1.10.4", - "resolved": "https://registry.npmjs.org/@swc/core-linux-arm64-musl/-/core-linux-arm64-musl-1.10.4.tgz", - "integrity": "sha512-cDDj2/uYsOH0pgAnDkovLZvKJpFmBMyXkxEG6Q4yw99HbzO6QzZ5HDGWGWVq/6dLgYKlnnmpjZCPPQIu01mXEg==", + "version": "1.10.18", + "resolved": "https://registry.npmjs.org/@swc/core-linux-arm64-musl/-/core-linux-arm64-musl-1.10.18.tgz", + "integrity": "sha512-4rv+E4VLdgQw6zjbTAauCAEExxChvxMpBUMCiZweTNPKbJJ2dY6BX2WGJ1ea8+RcgqR/Xysj3AFbOz1LBz6dGA==", "cpu": [ "arm64" ], @@ -1653,9 +1690,9 @@ } }, "node_modules/@swc/core-linux-x64-gnu": { - "version": "1.10.4", - "resolved": "https://registry.npmjs.org/@swc/core-linux-x64-gnu/-/core-linux-x64-gnu-1.10.4.tgz", - "integrity": "sha512-qJXh9D6Kf5xSdGWPINpLGixAbB5JX8JcbEJpRamhlDBoOcQC79dYfOMEIxWPhTS1DGLyFakAx2FX/b2VmQmj0g==", + "version": "1.10.18", + "resolved": "https://registry.npmjs.org/@swc/core-linux-x64-gnu/-/core-linux-x64-gnu-1.10.18.tgz", + "integrity": "sha512-vTNmyRBVP+sZca+vtwygYPGTNudTU6Gl6XhaZZ7cEUTBr8xvSTgEmYXoK/2uzyXpaTUI4Bmtp1x81cGN0mMoLQ==", "cpu": [ "x64" ], @@ -1670,9 +1707,9 @@ } }, "node_modules/@swc/core-linux-x64-musl": { - "version": "1.10.4", - "resolved": "https://registry.npmjs.org/@swc/core-linux-x64-musl/-/core-linux-x64-musl-1.10.4.tgz", - "integrity": "sha512-A76lIAeyQnHCVt0RL/pG+0er8Qk9+acGJqSZOZm67Ve3B0oqMd871kPtaHBM0BW3OZAhoILgfHW3Op9Q3mx3Cw==", + "version": "1.10.18", + "resolved": "https://registry.npmjs.org/@swc/core-linux-x64-musl/-/core-linux-x64-musl-1.10.18.tgz", + "integrity": "sha512-1TZPReKhFCeX776XaT6wegknfg+g3zODve+r4oslFHI+g7cInfWlxoGNDS3niPKyuafgCdOjme2g3OF+zzxfsQ==", "cpu": [ "x64" ], @@ -1687,9 +1724,9 @@ } }, "node_modules/@swc/core-win32-arm64-msvc": { - "version": "1.10.4", - "resolved": "https://registry.npmjs.org/@swc/core-win32-arm64-msvc/-/core-win32-arm64-msvc-1.10.4.tgz", - "integrity": "sha512-e6j5kBu4fIY7fFxFxnZI0MlEovRvp50Lg59Fw+DVbtqHk3C85dckcy5xKP+UoXeuEmFceauQDczUcGs19SRGSQ==", + "version": "1.10.18", + "resolved": "https://registry.npmjs.org/@swc/core-win32-arm64-msvc/-/core-win32-arm64-msvc-1.10.18.tgz", + "integrity": "sha512-o/2CsaWSN3bkzVQ6DA+BiFKSVEYvhWGA1h+wnL2zWmIDs2Knag54sOEXZkCaf8YQyZesGeXJtPEy9hh/vjJgkA==", "cpu": [ "arm64" ], @@ -1704,9 +1741,9 @@ } }, "node_modules/@swc/core-win32-ia32-msvc": { - "version": "1.10.4", - "resolved": "https://registry.npmjs.org/@swc/core-win32-ia32-msvc/-/core-win32-ia32-msvc-1.10.4.tgz", - "integrity": "sha512-RSYHfdKgNXV/amY5Tqk1EWVsyQnhlsM//jeqMLw5Fy9rfxP592W9UTumNikNRPdjI8wKKzNMXDb1U29tQjN0dg==", + "version": "1.10.18", + "resolved": "https://registry.npmjs.org/@swc/core-win32-ia32-msvc/-/core-win32-ia32-msvc-1.10.18.tgz", + "integrity": "sha512-eTPASeJtk4mJDfWiYEiOC6OYUi/N7meHbNHcU8e+aKABonhXrIo/FmnTE8vsUtC6+jakT1TQBdiQ8fzJ1kJVwA==", "cpu": [ "ia32" ], @@ -1721,9 +1758,9 @@ } }, "node_modules/@swc/core-win32-x64-msvc": { - "version": "1.10.4", - "resolved": "https://registry.npmjs.org/@swc/core-win32-x64-msvc/-/core-win32-x64-msvc-1.10.4.tgz", - "integrity": "sha512-1ujYpaqfqNPYdwKBlvJnOqcl+Syn3UrQ4XE0Txz6zMYgyh6cdU6a3pxqLqIUSJ12MtXRA9ZUhEz1ekU3LfLWXw==", + "version": "1.10.18", + "resolved": "https://registry.npmjs.org/@swc/core-win32-x64-msvc/-/core-win32-x64-msvc-1.10.18.tgz", + "integrity": "sha512-1Dud8CDBnc34wkBOboFBQud9YlV1bcIQtKSg7zC8LtwR3h+XAaCayZPkpGmmAlCv1DLQPvkF+s0JcaVC9mfffQ==", "cpu": [ "x64" ], @@ -1761,10 +1798,16 @@ "dev": true, "license": "MIT" }, + "node_modules/@types/events": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/@types/events/-/events-3.0.3.tgz", + "integrity": "sha512-trOc4AAUThEz9hapPtSd7wf5tiQKvTtu5b371UxXdTuqzIh0ArcRspRP0i0Viu+LXstIQ1z96t1nsPxT9ol01g==", + "license": "MIT" + }, "node_modules/@types/geojson": { - "version": "7946.0.15", - "resolved": "https://registry.npmjs.org/@types/geojson/-/geojson-7946.0.15.tgz", - "integrity": "sha512-9oSxFzDCT2Rj6DfcHF8G++jxBKS7mBqXl5xrRW+Kbvjry6Uduya2iiwqHPhVXpasAVMBYKkEPGgKhd3+/HZ6xA==", + "version": "7946.0.16", + "resolved": "https://registry.npmjs.org/@types/geojson/-/geojson-7946.0.16.tgz", + "integrity": "sha512-6C8nqWur3j98U6+lXDfTUWIfgvZU+EumvpHKcYjujKH7woYyLj2sUmff0tRhrqM7BohUw7Pz3ZB1jj2gW9Fvmg==", "dev": true, "license": "MIT" }, @@ -1790,9 +1833,9 @@ "license": "MIT" }, "node_modules/@types/leaflet": { - "version": "1.9.15", - "resolved": "https://registry.npmjs.org/@types/leaflet/-/leaflet-1.9.15.tgz", - "integrity": "sha512-7UuggAuAs+mva66gtf2OTB1nEhzU/9JED93TIaOEgvFMvG/dIGQaukHE7izHo1Zd+Ko1L4ETUw7TBc8yUxevpg==", + "version": "1.9.16", + "resolved": "https://registry.npmjs.org/@types/leaflet/-/leaflet-1.9.16.tgz", + "integrity": "sha512-wzZoyySUxkgMZ0ihJ7IaUIblG8Rdc8AbbZKLneyn+QjYsj5q1QU7TEKYqwTr10BGSzY5LI7tJk9Ifo+mEjdFRw==", "dev": true, "license": "MIT", "dependencies": { @@ -1800,9 +1843,9 @@ } }, "node_modules/@types/react": { - "version": "19.0.3", - "resolved": "https://registry.npmjs.org/@types/react/-/react-19.0.3.tgz", - "integrity": "sha512-UavfHguIjnnuq9O67uXfgy/h3SRJbidAYvNjLceB+2RIKVRBzVsh0QO+Pw6BCSQqFS9xwzKfwstXx0m6AbAREA==", + "version": "19.0.10", + "resolved": "https://registry.npmjs.org/@types/react/-/react-19.0.10.tgz", + "integrity": "sha512-JuRQ9KXLEjaUNjTWpzuR231Z2WpIwczOkBEIvbHNCzQefFIT0L8IqE6NV6ULLyC1SI/i234JnDoMkfg+RjQj2g==", "dev": true, "license": "MIT", "dependencies": { @@ -1810,9 +1853,9 @@ } }, "node_modules/@types/react-dom": { - "version": "19.0.2", - "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-19.0.2.tgz", - "integrity": "sha512-c1s+7TKFaDRRxr1TxccIX2u7sfCnc3RxkVyBIUA2lCpyqCF+QoAwQ/CBg7bsMdVwP120HEH143VQezKtef5nCg==", + "version": "19.0.4", + "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-19.0.4.tgz", + "integrity": "sha512-4fSQ8vWFkg+TGhePfUzVmat3eC14TXYSsiiDSLI0dVLsrm9gZFABjPy/Qu6TKgl1tq1Bu1yDsuQgY3A3DOjCcg==", "dev": true, "license": "MIT", "peerDependencies": { @@ -1830,21 +1873,21 @@ } }, "node_modules/@typescript-eslint/eslint-plugin": { - "version": "8.19.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.19.0.tgz", - "integrity": "sha512-NggSaEZCdSrFddbctrVjkVZvFC6KGfKfNK0CU7mNK/iKHGKbzT4Wmgm08dKpcZECBu9f5FypndoMyRHkdqfT1Q==", + "version": "8.24.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.24.1.tgz", + "integrity": "sha512-ll1StnKtBigWIGqvYDVuDmXJHVH4zLVot1yQ4fJtLpL7qacwkxJc1T0bptqw+miBQ/QfUbhl1TcQ4accW5KUyA==", "dev": true, "license": "MIT", "dependencies": { "@eslint-community/regexpp": "^4.10.0", - "@typescript-eslint/scope-manager": "8.19.0", - "@typescript-eslint/type-utils": "8.19.0", - "@typescript-eslint/utils": "8.19.0", - "@typescript-eslint/visitor-keys": "8.19.0", + "@typescript-eslint/scope-manager": "8.24.1", + "@typescript-eslint/type-utils": "8.24.1", + "@typescript-eslint/utils": "8.24.1", + "@typescript-eslint/visitor-keys": "8.24.1", "graphemer": "^1.4.0", "ignore": "^5.3.1", "natural-compare": "^1.4.0", - "ts-api-utils": "^1.3.0" + "ts-api-utils": "^2.0.1" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -1860,16 +1903,16 @@ } }, "node_modules/@typescript-eslint/parser": { - "version": "8.19.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.19.0.tgz", - "integrity": "sha512-6M8taKyOETY1TKHp0x8ndycipTVgmp4xtg5QpEZzXxDhNvvHOJi5rLRkLr8SK3jTgD5l4fTlvBiRdfsuWydxBw==", + "version": "8.24.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.24.1.tgz", + "integrity": "sha512-Tqoa05bu+t5s8CTZFaGpCH2ub3QeT9YDkXbPd3uQ4SfsLoh1/vv2GEYAioPoxCWJJNsenXlC88tRjwoHNts1oQ==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/scope-manager": "8.19.0", - "@typescript-eslint/types": "8.19.0", - "@typescript-eslint/typescript-estree": "8.19.0", - "@typescript-eslint/visitor-keys": "8.19.0", + "@typescript-eslint/scope-manager": "8.24.1", + "@typescript-eslint/types": "8.24.1", + "@typescript-eslint/typescript-estree": "8.24.1", + "@typescript-eslint/visitor-keys": "8.24.1", "debug": "^4.3.4" }, "engines": { @@ -1885,14 +1928,14 @@ } }, "node_modules/@typescript-eslint/scope-manager": { - "version": "8.19.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.19.0.tgz", - "integrity": "sha512-hkoJiKQS3GQ13TSMEiuNmSCvhz7ujyqD1x3ShbaETATHrck+9RaDdUbt+osXaUuns9OFwrDTTrjtwsU8gJyyRA==", + "version": "8.24.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.24.1.tgz", + "integrity": "sha512-OdQr6BNBzwRjNEXMQyaGyZzgg7wzjYKfX2ZBV3E04hUCBDv3GQCHiz9RpqdUIiVrMgJGkXm3tcEh4vFSHreS2Q==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/types": "8.19.0", - "@typescript-eslint/visitor-keys": "8.19.0" + "@typescript-eslint/types": "8.24.1", + "@typescript-eslint/visitor-keys": "8.24.1" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -1903,16 +1946,16 @@ } }, "node_modules/@typescript-eslint/type-utils": { - "version": "8.19.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.19.0.tgz", - "integrity": "sha512-TZs0I0OSbd5Aza4qAMpp1cdCYVnER94IziudE3JU328YUHgWu9gwiwhag+fuLeJ2LkWLXI+F/182TbG+JaBdTg==", + "version": "8.24.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.24.1.tgz", + "integrity": "sha512-/Do9fmNgCsQ+K4rCz0STI7lYB4phTtEXqqCAs3gZW0pnK7lWNkvWd5iW545GSmApm4AzmQXmSqXPO565B4WVrw==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/typescript-estree": "8.19.0", - "@typescript-eslint/utils": "8.19.0", + "@typescript-eslint/typescript-estree": "8.24.1", + "@typescript-eslint/utils": "8.24.1", "debug": "^4.3.4", - "ts-api-utils": "^1.3.0" + "ts-api-utils": "^2.0.1" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -1927,9 +1970,9 @@ } }, "node_modules/@typescript-eslint/types": { - "version": "8.19.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.19.0.tgz", - "integrity": "sha512-8XQ4Ss7G9WX8oaYvD4OOLCjIQYgRQxO+qCiR2V2s2GxI9AUpo7riNwo6jDhKtTcaJjT8PY54j2Yb33kWtSJsmA==", + "version": "8.24.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.24.1.tgz", + "integrity": "sha512-9kqJ+2DkUXiuhoiYIUvIYjGcwle8pcPpdlfkemGvTObzgmYfJ5d0Qm6jwb4NBXP9W1I5tss0VIAnWFumz3mC5A==", "dev": true, "license": "MIT", "engines": { @@ -1941,20 +1984,20 @@ } }, "node_modules/@typescript-eslint/typescript-estree": { - "version": "8.19.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.19.0.tgz", - "integrity": "sha512-WW9PpDaLIFW9LCbucMSdYUuGeFUz1OkWYS/5fwZwTA+l2RwlWFdJvReQqMUMBw4yJWJOfqd7An9uwut2Oj8sLw==", + "version": "8.24.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.24.1.tgz", + "integrity": "sha512-UPyy4MJ/0RE648DSKQe9g0VDSehPINiejjA6ElqnFaFIhI6ZEiZAkUI0D5MCk0bQcTf/LVqZStvQ6K4lPn/BRg==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/types": "8.19.0", - "@typescript-eslint/visitor-keys": "8.19.0", + "@typescript-eslint/types": "8.24.1", + "@typescript-eslint/visitor-keys": "8.24.1", "debug": "^4.3.4", "fast-glob": "^3.3.2", "is-glob": "^4.0.3", "minimatch": "^9.0.4", "semver": "^7.6.0", - "ts-api-utils": "^1.3.0" + "ts-api-utils": "^2.0.1" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -1994,9 +2037,9 @@ } }, "node_modules/@typescript-eslint/typescript-estree/node_modules/semver": { - "version": "7.6.3", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.3.tgz", - "integrity": "sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==", + "version": "7.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.1.tgz", + "integrity": "sha512-hlq8tAfn0m/61p4BVRcPzIGr6LKiMwo4VM6dGi6pt4qcRkmNzTcWq6eCEjEh+qXjkMDvPlOFFSGwQjoEa6gyMA==", "dev": true, "license": "ISC", "bin": { @@ -2007,16 +2050,16 @@ } }, "node_modules/@typescript-eslint/utils": { - "version": "8.19.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.19.0.tgz", - "integrity": "sha512-PTBG+0oEMPH9jCZlfg07LCB2nYI0I317yyvXGfxnvGvw4SHIOuRnQ3kadyyXY6tGdChusIHIbM5zfIbp4M6tCg==", + "version": "8.24.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.24.1.tgz", + "integrity": "sha512-OOcg3PMMQx9EXspId5iktsI3eMaXVwlhC8BvNnX6B5w9a4dVgpkQZuU8Hy67TolKcl+iFWq0XX+jbDGN4xWxjQ==", "dev": true, "license": "MIT", "dependencies": { "@eslint-community/eslint-utils": "^4.4.0", - "@typescript-eslint/scope-manager": "8.19.0", - "@typescript-eslint/types": "8.19.0", - "@typescript-eslint/typescript-estree": "8.19.0" + "@typescript-eslint/scope-manager": "8.24.1", + "@typescript-eslint/types": "8.24.1", + "@typescript-eslint/typescript-estree": "8.24.1" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -2031,13 +2074,13 @@ } }, "node_modules/@typescript-eslint/visitor-keys": { - "version": "8.19.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.19.0.tgz", - "integrity": "sha512-mCFtBbFBJDCNCWUl5y6sZSCHXw1DEFEk3c/M3nRK2a4XUB8StGFtmcEMizdjKuBzB6e/smJAAWYug3VrdLMr1w==", + "version": "8.24.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.24.1.tgz", + "integrity": "sha512-EwVHlp5l+2vp8CoqJm9KikPZgi3gbdZAtabKT9KPShGeOcJhsv4Zdo3oc8T8I0uKEmYoU4ItyxbptjF08enaxg==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/types": "8.19.0", + "@typescript-eslint/types": "8.24.1", "eslint-visitor-keys": "^4.2.0" }, "engines": { @@ -2049,26 +2092,23 @@ } }, "node_modules/@vitejs/plugin-react-swc": { - "version": "3.7.2", - "resolved": "https://registry.npmjs.org/@vitejs/plugin-react-swc/-/plugin-react-swc-3.7.2.tgz", - "integrity": "sha512-y0byko2b2tSVVf5Gpng1eEhX1OvPC7x8yns1Fx8jDzlJp4LS6CMkCPfLw47cjyoMrshQDoQw4qcgjsU9VvlCew==", + "version": "3.8.0", + "resolved": "https://registry.npmjs.org/@vitejs/plugin-react-swc/-/plugin-react-swc-3.8.0.tgz", + "integrity": "sha512-T4sHPvS+DIqDP51ifPqa9XIRAz/kIvIi8oXcnOZZgHmMotgmmdxe/DD5tMFlt5nuIRzT0/QuiwmKlH0503Aapw==", "dev": true, "license": "MIT", "dependencies": { - "@swc/core": "^1.7.26" + "@swc/core": "^1.10.15" }, "peerDependencies": { "vite": "^4 || ^5 || ^6" } }, "node_modules/@wailsio/runtime": { - "version": "3.0.0-alpha.36", - "resolved": "https://registry.npmjs.org/@wailsio/runtime/-/runtime-3.0.0-alpha.36.tgz", - "integrity": "sha512-IPxzYLxgX8tOWcB1x2RHzx3VwRFTLAUrdeMQL2wZyaV7Xvtybt1h1WYaEp0iZiiNB/KCuCKIrnhnrN5sNDoDYg==", - "license": "MIT", - "dependencies": { - "nanoid": "^5.0.7" - } + "version": "3.0.0-alpha.56", + "resolved": "https://registry.npmjs.org/@wailsio/runtime/-/runtime-3.0.0-alpha.56.tgz", + "integrity": "sha512-IXumYWGPscpPPb9R8bVU/elfEEY6hVQu4tpmjc3hR3tKp3D7mEp0C3ccesdB2jkljU+RyutVRn1L+mTrKCg2BA==", + "license": "MIT" }, "node_modules/acorn": { "version": "8.14.0", @@ -2252,6 +2292,16 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/async-function": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/async-function/-/async-function-1.0.0.tgz", + "integrity": "sha512-hsU18Ae8CDTR6Kgu9DYf0EbCr/a5iGL0rytQDobUcdpYOKokk8LEjVphnXkDkgpi0wYVsqrXuP0bZxJaTqdgoA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, "node_modules/available-typed-arrays": { "version": "1.0.7", "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.7.tgz", @@ -2306,9 +2356,9 @@ } }, "node_modules/browserslist": { - "version": "4.24.3", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.24.3.tgz", - "integrity": "sha512-1CPmv8iobE2fyRMV97dAcMVegvvWKxmq94hkLiAkUGwKVTyDLw33K+ZxiFrREKmmps4rIw6grcCFCnTMSZ/YiA==", + "version": "4.24.4", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.24.4.tgz", + "integrity": "sha512-KDi1Ny1gSePi1vm0q4oxSF8b4DR44GF4BbmS2YdhPLOEqd8pDviZOGH/GsmRwoWJ2+5Lr085X7naowMwKHDG1A==", "dev": true, "funding": [ { @@ -2358,9 +2408,9 @@ } }, "node_modules/call-bind-apply-helpers": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.1.tgz", - "integrity": "sha512-BhYE+WDaywFg2TBWYNXAE+8B1ATnThNBqXHP5nQu0jWJdVvY2hvkpyB3qOmtmDePiS5/BDQ8wASEWGMWRG148g==", + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz", + "integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==", "dev": true, "license": "MIT", "dependencies": { @@ -2412,9 +2462,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001690", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001690.tgz", - "integrity": "sha512-5ExiE3qQN6oF8Clf8ifIDcMRCRE/dMGcETG/XGMD8/XiXm6HXQgQTh1yZYLXXpSOsEUlJm1Xr7kGULZTuGtP/w==", + "version": "1.0.30001700", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001700.tgz", + "integrity": "sha512-2S6XIXwaE7K7erT8dY+kLQcpa5ms63XlRkMkReXjle+kf6c5g38vyMl+Z5y8dSxOFDhcFe+nxnn261PLxBSQsQ==", "dev": true, "funding": [ { @@ -2714,9 +2764,9 @@ } }, "node_modules/domutils": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/domutils/-/domutils-3.2.1.tgz", - "integrity": "sha512-xWXmuRnN9OMP6ptPd2+H0cCbcYBULa5YDTbMm/2lvkWvNA3O4wcW+GvzooqBuNM8yy6pl3VIAeJTUUWUbfI5Fw==", + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/domutils/-/domutils-3.2.2.tgz", + "integrity": "sha512-6kZKyUajlDuqlHKVX1w7gyslj9MPIXzIFiz/rGu35uC1wMi+kMhQwGhl4lt9unC9Vb9INnY9Z3/ZA3+FhASLaw==", "dev": true, "license": "BSD-2-Clause", "dependencies": { @@ -2755,9 +2805,9 @@ } }, "node_modules/electron-to-chromium": { - "version": "1.5.76", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.76.tgz", - "integrity": "sha512-CjVQyG7n7Sr+eBXE86HIulnL5N8xZY1sgmOPGuq/F0Rr0FJq63lg0kEtOIDfZBk44FnDLf6FUJ+dsJcuiUDdDQ==", + "version": "1.5.103", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.103.tgz", + "integrity": "sha512-P6+XzIkfndgsrjROJWfSvVEgNHtPgbhVyTkwLjUM2HU/h7pZRORgaTlHqfAikqxKmdJMLW8fftrdGWbd/Ds0FA==", "dev": true, "license": "ISC" }, @@ -2871,9 +2921,9 @@ } }, "node_modules/es-object-atoms": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.0.0.tgz", - "integrity": "sha512-MZ4iQ6JwHOBQjahnjwaC1ZtIBH+2ohjamzAO3oaHcXYup7qxjF2fixyH+Q71voWHeOkI2q/TnJao/KfXYIZWbw==", + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.1.tgz", + "integrity": "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==", "dev": true, "license": "MIT", "dependencies": { @@ -2900,13 +2950,16 @@ } }, "node_modules/es-shim-unscopables": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/es-shim-unscopables/-/es-shim-unscopables-1.0.2.tgz", - "integrity": "sha512-J3yBRXCzDu4ULnQwxyToo/OjdMx6akgVC7K6few0a7F/0wLtmKKN7I73AH5T2836UuXRqN7Qg+IIUw/+YJksRw==", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/es-shim-unscopables/-/es-shim-unscopables-1.1.0.tgz", + "integrity": "sha512-d9T8ucsEhh8Bi1woXCf+TIKDIROLG5WCkxg8geBCbvk22kzwC5G2OnXVMO6FUsvQlgUUXQ2itephWDLqDzbeCw==", "dev": true, "license": "MIT", "dependencies": { - "hasown": "^2.0.0" + "hasown": "^2.0.2" + }, + "engines": { + "node": ">= 0.4" } }, "node_modules/es-to-primitive": { @@ -2928,9 +2981,9 @@ } }, "node_modules/esbuild": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.21.5.tgz", - "integrity": "sha512-mg3OPMV4hXywwpoDxu3Qda5xCKQi+vCTZq8S9J/EpkhB2HzKXq4SNFZE3+NK93JYxc8VMSep+lOUSC/RVKaBqw==", + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.24.2.tgz", + "integrity": "sha512-+9egpBW8I3CD5XPe0n6BfT5fxLzxrlDzqydF3aviG+9ni1lDC/OvMHcxqEFV0+LANZG5R1bFMWfUrjVsdwxJvA==", "dev": true, "hasInstallScript": true, "license": "MIT", @@ -2938,32 +2991,34 @@ "esbuild": "bin/esbuild" }, "engines": { - "node": ">=12" + "node": ">=18" }, "optionalDependencies": { - "@esbuild/aix-ppc64": "0.21.5", - "@esbuild/android-arm": "0.21.5", - "@esbuild/android-arm64": "0.21.5", - "@esbuild/android-x64": "0.21.5", - "@esbuild/darwin-arm64": "0.21.5", - "@esbuild/darwin-x64": "0.21.5", - "@esbuild/freebsd-arm64": "0.21.5", - "@esbuild/freebsd-x64": "0.21.5", - "@esbuild/linux-arm": "0.21.5", - "@esbuild/linux-arm64": "0.21.5", - "@esbuild/linux-ia32": "0.21.5", - "@esbuild/linux-loong64": "0.21.5", - "@esbuild/linux-mips64el": "0.21.5", - "@esbuild/linux-ppc64": "0.21.5", - "@esbuild/linux-riscv64": "0.21.5", - "@esbuild/linux-s390x": "0.21.5", - "@esbuild/linux-x64": "0.21.5", - "@esbuild/netbsd-x64": "0.21.5", - "@esbuild/openbsd-x64": "0.21.5", - "@esbuild/sunos-x64": "0.21.5", - "@esbuild/win32-arm64": "0.21.5", - "@esbuild/win32-ia32": "0.21.5", - "@esbuild/win32-x64": "0.21.5" + "@esbuild/aix-ppc64": "0.24.2", + "@esbuild/android-arm": "0.24.2", + "@esbuild/android-arm64": "0.24.2", + "@esbuild/android-x64": "0.24.2", + "@esbuild/darwin-arm64": "0.24.2", + "@esbuild/darwin-x64": "0.24.2", + "@esbuild/freebsd-arm64": "0.24.2", + "@esbuild/freebsd-x64": "0.24.2", + "@esbuild/linux-arm": "0.24.2", + "@esbuild/linux-arm64": "0.24.2", + "@esbuild/linux-ia32": "0.24.2", + "@esbuild/linux-loong64": "0.24.2", + "@esbuild/linux-mips64el": "0.24.2", + "@esbuild/linux-ppc64": "0.24.2", + "@esbuild/linux-riscv64": "0.24.2", + "@esbuild/linux-s390x": "0.24.2", + "@esbuild/linux-x64": "0.24.2", + "@esbuild/netbsd-arm64": "0.24.2", + "@esbuild/netbsd-x64": "0.24.2", + "@esbuild/openbsd-arm64": "0.24.2", + "@esbuild/openbsd-x64": "0.24.2", + "@esbuild/sunos-x64": "0.24.2", + "@esbuild/win32-arm64": "0.24.2", + "@esbuild/win32-ia32": "0.24.2", + "@esbuild/win32-x64": "0.24.2" } }, "node_modules/escalade": { @@ -2990,22 +3045,22 @@ } }, "node_modules/eslint": { - "version": "9.17.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-9.17.0.tgz", - "integrity": "sha512-evtlNcpJg+cZLcnVKwsai8fExnqjGPicK7gnUtlNuzu+Fv9bI0aLpND5T44VLQtoMEnI57LoXO9XAkIXwohKrA==", + "version": "9.21.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-9.21.0.tgz", + "integrity": "sha512-KjeihdFqTPhOMXTt7StsDxriV4n66ueuF/jfPNC3j/lduHwr/ijDwJMsF+wyMJethgiKi5wniIE243vi07d3pg==", "dev": true, "license": "MIT", "dependencies": { "@eslint-community/eslint-utils": "^4.2.0", "@eslint-community/regexpp": "^4.12.1", - "@eslint/config-array": "^0.19.0", - "@eslint/core": "^0.9.0", - "@eslint/eslintrc": "^3.2.0", - "@eslint/js": "9.17.0", - "@eslint/plugin-kit": "^0.2.3", + "@eslint/config-array": "^0.19.2", + "@eslint/core": "^0.12.0", + "@eslint/eslintrc": "^3.3.0", + "@eslint/js": "9.21.0", + "@eslint/plugin-kit": "^0.2.7", "@humanfs/node": "^0.16.6", "@humanwhocodes/module-importer": "^1.0.1", - "@humanwhocodes/retry": "^0.4.1", + "@humanwhocodes/retry": "^0.4.2", "@types/estree": "^1.0.6", "@types/json-schema": "^7.0.15", "ajv": "^6.12.4", @@ -3157,9 +3212,9 @@ } }, "node_modules/eslint-plugin-react-refresh": { - "version": "0.4.16", - "resolved": "https://registry.npmjs.org/eslint-plugin-react-refresh/-/eslint-plugin-react-refresh-0.4.16.tgz", - "integrity": "sha512-slterMlxAhov/DZO8NScf6mEeMBBXodFUolijDvrtTxyezyLoTQaa73FyYus/VbTdftd8wBgBxPMRk3poleXNQ==", + "version": "0.4.19", + "resolved": "https://registry.npmjs.org/eslint-plugin-react-refresh/-/eslint-plugin-react-refresh-0.4.19.tgz", + "integrity": "sha512-eyy8pcr/YxSYjBoqIFSrlbn9i/xvxUFa8CjzAYo9cFjgGXqq1hyjihcpZvxRLalpaWmueWR81xn7vuKmAFijDQ==", "dev": true, "license": "MIT", "peerDependencies": { @@ -3267,11 +3322,19 @@ "node": ">=0.10.0" } }, + "node_modules/events": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/events/-/events-3.3.0.tgz", + "integrity": "sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==", + "license": "MIT", + "engines": { + "node": ">=0.8.x" + } + }, "node_modules/fast-deep-equal": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", - "dev": true, "license": "MIT" }, "node_modules/fast-glob": { @@ -3319,9 +3382,9 @@ "license": "MIT" }, "node_modules/fastq": { - "version": "1.18.0", - "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.18.0.tgz", - "integrity": "sha512-QKHXPW0hD8g4UET03SdOdunzSouc9N4AuHdsX8XNcTsuz+yYFILVNIX4l9yHABMhiEI9Db0JTTIpu0wB+Y1QQw==", + "version": "1.19.0", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.19.0.tgz", + "integrity": "sha512-7SFSRCNjBQIZH/xZR3iy5iQYR8aGBE0h3VG6/cwlbrpdciNYBMotQav8c1XI3HjHH+NikUpP53nPdlZSdWmFzA==", "dev": true, "license": "ISC", "dependencies": { @@ -3386,20 +3449,26 @@ } }, "node_modules/flatted": { - "version": "3.3.2", - "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.3.2.tgz", - "integrity": "sha512-AiwGJM8YcNOaobumgtng+6NHuOqC3A7MixFeDafM3X9cIUM+xUXoS5Vfgf+OihAYe20fxqNM9yPBXJzRtZ/4eA==", + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.3.3.tgz", + "integrity": "sha512-GX+ysw4PBCz0PzosHDepZGANEuFCMLrnRTiEy9McGjmkCQYwRq4A/X786G/fjM/+OjsWSU1ZrY5qyARZmO/uwg==", "dev": true, "license": "ISC" }, "node_modules/for-each": { - "version": "0.3.3", - "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz", - "integrity": "sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==", + "version": "0.3.5", + "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.5.tgz", + "integrity": "sha512-dKx12eRCVIzqCxFGplyFKJMPvLEWgmNtUrpTiJIR5u97zEhRG8ySrtboPHZXx7daLxQVrl643cTzbab2tkQjxg==", "dev": true, "license": "MIT", "dependencies": { - "is-callable": "^1.1.3" + "is-callable": "^1.2.7" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, "node_modules/fsevents": { @@ -3469,18 +3538,18 @@ } }, "node_modules/get-intrinsic": { - "version": "1.2.7", - "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.7.tgz", - "integrity": "sha512-VW6Pxhsrk0KAOqs3WEd0klDiF/+V7gQOpAvY1jVU/LHmaD/kQO4523aiJuikX/QAKYiW6x8Jh+RJej1almdtCA==", + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz", + "integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==", "dev": true, "license": "MIT", "dependencies": { - "call-bind-apply-helpers": "^1.0.1", + "call-bind-apply-helpers": "^1.0.2", "es-define-property": "^1.0.1", "es-errors": "^1.3.0", - "es-object-atoms": "^1.0.0", + "es-object-atoms": "^1.1.1", "function-bind": "^1.1.2", - "get-proto": "^1.0.0", + "get-proto": "^1.0.1", "gopd": "^1.2.0", "has-symbols": "^1.1.0", "hasown": "^2.0.2", @@ -3539,9 +3608,9 @@ } }, "node_modules/globals": { - "version": "15.14.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-15.14.0.tgz", - "integrity": "sha512-OkToC372DtlQeje9/zHIo5CT8lRP/FUgEOKBEhU4e0abL7J7CD24fD9ohiLN5hagG/kWCYj4K5oaxxtj2Z0Dig==", + "version": "15.15.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-15.15.0.tgz", + "integrity": "sha512-7ACyT3wmyp3I61S4fG682L0VA2RGD9otkqGJIwNUMF1SWUombIIk+af1unuDYgMm082aHYwD+mzJvv9Iu8dsgg==", "dev": true, "license": "MIT", "engines": { @@ -3713,9 +3782,9 @@ } }, "node_modules/import-fresh": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", - "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==", + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.1.tgz", + "integrity": "sha512-TR3KfrTZTYLPB6jUjfx6MF9WcWrHL9su5TObK4ZkYgBdWKPOFoSoQIdEuTuR82pmtxH2spWG9h6etwfr1pLBqQ==", "dev": true, "license": "MIT", "dependencies": { @@ -3780,12 +3849,13 @@ "license": "MIT" }, "node_modules/is-async-function": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-async-function/-/is-async-function-2.1.0.tgz", - "integrity": "sha512-GExz9MtyhlZyXYLxzlJRj5WUCE661zhDa1Yna52CN57AJsymh+DvXXjyveSioqSRdxvUrdKdvqB1b5cVKsNpWQ==", + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-async-function/-/is-async-function-2.1.1.tgz", + "integrity": "sha512-9dgM/cZBnNvjzaMYHVoxxfPj2QXt22Ev7SuuPrs+xav0ukGB0S6d4ydZdEiM48kLx5kDV+QBPrpVnFyefL8kkQ==", "dev": true, "license": "MIT", "dependencies": { + "async-function": "^1.0.0", "call-bound": "^1.0.3", "get-proto": "^1.0.1", "has-tostringtag": "^1.0.2", @@ -3815,13 +3885,13 @@ } }, "node_modules/is-boolean-object": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/is-boolean-object/-/is-boolean-object-1.2.1.tgz", - "integrity": "sha512-l9qO6eFlUETHtuihLcYOaLKByJ1f+N4kthcU9YjHy3N+B3hWv0y/2Nd0mu/7lTFnRQHTrSdXF50HQ3bl5fEnng==", + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/is-boolean-object/-/is-boolean-object-1.2.2.tgz", + "integrity": "sha512-wa56o2/ElJMYqjCjGkXri7it5FbebW5usLw/nPmCMs5DeZ7eziSYZhSmPRn0txqeW4LnAmQQU7FgqLpsEFKM4A==", "dev": true, "license": "MIT", "dependencies": { - "call-bound": "^1.0.2", + "call-bound": "^1.0.3", "has-tostringtag": "^1.0.2" }, "engines": { @@ -4106,13 +4176,13 @@ } }, "node_modules/is-weakref": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/is-weakref/-/is-weakref-1.1.0.tgz", - "integrity": "sha512-SXM8Nwyys6nT5WP6pltOwKytLV7FqQ4UiibxVmW+EIosHcmCqkkjViTb5SNssDlkCiEYRP1/pdWUKVvZBmsR2Q==", + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/is-weakref/-/is-weakref-1.1.1.tgz", + "integrity": "sha512-6i9mGWSlqzNMEqpCp93KwRS1uUOodk2OJ6b+sq7ZPDSy2WuI5NFIxp/254TytR8ftefexkWn5xNiHUNpPOfSew==", "dev": true, "license": "MIT", "dependencies": { - "call-bound": "^1.0.2" + "call-bound": "^1.0.3" }, "engines": { "node": ">= 0.4" @@ -4227,9 +4297,9 @@ } }, "node_modules/katex": { - "version": "0.16.19", - "resolved": "https://registry.npmjs.org/katex/-/katex-0.16.19.tgz", - "integrity": "sha512-3IA6DYVhxhBabjSLTNO9S4+OliA3Qvb8pBQXMfC4WxXJgLwZgnfDl0BmB4z6nBMdznBsZ+CGM8DrGZ5hcguDZg==", + "version": "0.16.21", + "resolved": "https://registry.npmjs.org/katex/-/katex-0.16.21.tgz", + "integrity": "sha512-XvqR7FgOHtWupfMiigNzmh+MgUVmDGU2kXZm899ZkPfcuoPuFxyHmXsgATDpFZDAXCI8tvinaVcDo8PIIJSo4A==", "funding": [ "https://opencollective.com/katex", "https://github.com/sponsors/katex" @@ -4332,6 +4402,16 @@ "node": ">= 0.4" } }, + "node_modules/matrix-widget-api": { + "version": "1.13.1", + "resolved": "https://registry.npmjs.org/matrix-widget-api/-/matrix-widget-api-1.13.1.tgz", + "integrity": "sha512-mkOHUVzaN018TCbObfGOSaMW2GoUxOfcxNNlTVx5/HeMk3OSQPQM0C9oEME5Liiv/dBUoSrEB64V8wF7e/gb1w==", + "license": "Apache-2.0", + "dependencies": { + "@types/events": "^3.0.0", + "events": "^3.2.0" + } + }, "node_modules/merge2": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", @@ -4393,9 +4473,10 @@ "license": "MIT" }, "node_modules/nanoid": { - "version": "5.0.9", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-5.0.9.tgz", - "integrity": "sha512-Aooyr6MXU6HpvvWXKoVoXwKMs/KyVakWwg7xQfv5/S/RIgJMy0Ifa45H9qqYy7pTCszrHzP21Uk4PZq2HpEM8Q==", + "version": "3.3.8", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.8.tgz", + "integrity": "sha512-WNLf5Sd8oZxOm+TzppcYk8gVOgP+l58xNy58D0nbUnOxOWRWvlcCV4kUF7ltmI6PsrLl/BgKEyS4mqsGChFN0w==", + "dev": true, "funding": [ { "type": "github", @@ -4404,10 +4485,10 @@ ], "license": "MIT", "bin": { - "nanoid": "bin/nanoid.js" + "nanoid": "bin/nanoid.cjs" }, "engines": { - "node": "^18 || >=20" + "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" } }, "node_modules/natural-compare": { @@ -4436,9 +4517,9 @@ "license": "MIT" }, "node_modules/object-inspect": { - "version": "1.13.3", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.3.tgz", - "integrity": "sha512-kDCGIbxkDSXE3euJZZXzc6to7fCrKHNI/hSRQnRuQ+BWjFNzZwiFF8fj/6o2t2G9/jTj8PSIYTfCLelLZEeRpA==", + "version": "1.13.4", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.4.tgz", + "integrity": "sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==", "dev": true, "license": "MIT", "engines": { @@ -4690,9 +4771,9 @@ } }, "node_modules/possible-typed-array-names": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/possible-typed-array-names/-/possible-typed-array-names-1.0.0.tgz", - "integrity": "sha512-d7Uw+eZoloe0EHDIYoe+bQ5WXnGMOpmiZFTuMWCwpjzzkL2nTjcKiAk4hh8TjnGye2TwWOk3UXucZ+3rbmBa8Q==", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/possible-typed-array-names/-/possible-typed-array-names-1.1.0.tgz", + "integrity": "sha512-/+5VFTchJDoVj3bhoqi6UeymcD00DAwb1nJwamzPvHEszJ4FpF6SNNbUbOS8yI56qHzdV8eK0qEfOSiodkTdxg==", "dev": true, "license": "MIT", "engines": { @@ -4700,9 +4781,9 @@ } }, "node_modules/postcss": { - "version": "8.4.49", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.49.tgz", - "integrity": "sha512-OCVPnIObs4N29kxTjzLfUryOkvZEq+pf8jTF0lg8E7uETuWHA+v7j3c/xJmiqpX450191LlmZfUKkXxkTry7nA==", + "version": "8.5.3", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.3.tgz", + "integrity": "sha512-dle9A3yYxlBSrt8Fu+IpjGT8SY8hN0mlaA6GY8t0P5PjIOZemULz/E2Bnm/2dcUOena75OTNkHI76uZBNUUq3A==", "dev": true, "funding": [ { @@ -4720,7 +4801,7 @@ ], "license": "MIT", "dependencies": { - "nanoid": "^3.3.7", + "nanoid": "^3.3.8", "picocolors": "^1.1.1", "source-map-js": "^1.2.1" }, @@ -4728,25 +4809,6 @@ "node": "^10 || ^12 || >=14" } }, - "node_modules/postcss/node_modules/nanoid": { - "version": "3.3.8", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.8.tgz", - "integrity": "sha512-WNLf5Sd8oZxOm+TzppcYk8gVOgP+l58xNy58D0nbUnOxOWRWvlcCV4kUF7ltmI6PsrLl/BgKEyS4mqsGChFN0w==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/ai" - } - ], - "license": "MIT", - "bin": { - "nanoid": "bin/nanoid.cjs" - }, - "engines": { - "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" - } - }, "node_modules/prelude-ls": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", @@ -4916,9 +4978,9 @@ } }, "node_modules/rollup": { - "version": "4.30.0", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.30.0.tgz", - "integrity": "sha512-sDnr1pcjTgUT69qBksNF1N1anwfbyYG6TBQ22b03bII8EdiUQ7J0TlozVaTMjT/eEJAO49e1ndV7t+UZfL1+vA==", + "version": "4.34.8", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.34.8.tgz", + "integrity": "sha512-489gTVMzAYdiZHFVA/ig/iYFllCcWFHMvUHI1rpFmkoUtRlQxqh6/yiNqnYibjMZ2b/+FUQwldG+aLsEt6bglQ==", "dev": true, "license": "MIT", "dependencies": { @@ -4932,25 +4994,25 @@ "npm": ">=8.0.0" }, "optionalDependencies": { - "@rollup/rollup-android-arm-eabi": "4.30.0", - "@rollup/rollup-android-arm64": "4.30.0", - "@rollup/rollup-darwin-arm64": "4.30.0", - "@rollup/rollup-darwin-x64": "4.30.0", - "@rollup/rollup-freebsd-arm64": "4.30.0", - "@rollup/rollup-freebsd-x64": "4.30.0", - "@rollup/rollup-linux-arm-gnueabihf": "4.30.0", - "@rollup/rollup-linux-arm-musleabihf": "4.30.0", - "@rollup/rollup-linux-arm64-gnu": "4.30.0", - "@rollup/rollup-linux-arm64-musl": "4.30.0", - "@rollup/rollup-linux-loongarch64-gnu": "4.30.0", - "@rollup/rollup-linux-powerpc64le-gnu": "4.30.0", - "@rollup/rollup-linux-riscv64-gnu": "4.30.0", - "@rollup/rollup-linux-s390x-gnu": "4.30.0", - "@rollup/rollup-linux-x64-gnu": "4.30.0", - "@rollup/rollup-linux-x64-musl": "4.30.0", - "@rollup/rollup-win32-arm64-msvc": "4.30.0", - "@rollup/rollup-win32-ia32-msvc": "4.30.0", - "@rollup/rollup-win32-x64-msvc": "4.30.0", + "@rollup/rollup-android-arm-eabi": "4.34.8", + "@rollup/rollup-android-arm64": "4.34.8", + "@rollup/rollup-darwin-arm64": "4.34.8", + "@rollup/rollup-darwin-x64": "4.34.8", + "@rollup/rollup-freebsd-arm64": "4.34.8", + "@rollup/rollup-freebsd-x64": "4.34.8", + "@rollup/rollup-linux-arm-gnueabihf": "4.34.8", + "@rollup/rollup-linux-arm-musleabihf": "4.34.8", + "@rollup/rollup-linux-arm64-gnu": "4.34.8", + "@rollup/rollup-linux-arm64-musl": "4.34.8", + "@rollup/rollup-linux-loongarch64-gnu": "4.34.8", + "@rollup/rollup-linux-powerpc64le-gnu": "4.34.8", + "@rollup/rollup-linux-riscv64-gnu": "4.34.8", + "@rollup/rollup-linux-s390x-gnu": "4.34.8", + "@rollup/rollup-linux-x64-gnu": "4.34.8", + "@rollup/rollup-linux-x64-musl": "4.34.8", + "@rollup/rollup-win32-arm64-msvc": "4.34.8", + "@rollup/rollup-win32-ia32-msvc": "4.34.8", + "@rollup/rollup-win32-x64-msvc": "4.34.8", "fsevents": "~2.3.2" } }, @@ -5347,16 +5409,16 @@ } }, "node_modules/ts-api-utils": { - "version": "1.4.3", - "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-1.4.3.tgz", - "integrity": "sha512-i3eMG77UTMD0hZhgRS562pv83RC6ukSAC2GMNWc+9dieh/+jDM5u5YG+NHX6VNDRHQcHwmsTHctP9LhbC3WxVw==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-2.0.1.tgz", + "integrity": "sha512-dnlgjFSVetynI8nzgJ+qF62efpglpWRk8isUEWZGWlJYySCTD6aKvbUDu+zbPeDakk3bg5H4XpitHukgfL1m9w==", "dev": true, "license": "MIT", "engines": { - "node": ">=16" + "node": ">=18.12" }, "peerDependencies": { - "typescript": ">=4.2.0" + "typescript": ">=4.8.4" } }, "node_modules/tsconfig-paths": { @@ -5471,9 +5533,9 @@ } }, "node_modules/typescript": { - "version": "5.7.2", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.7.2.tgz", - "integrity": "sha512-i5t66RHxDvVN40HfDd1PsEThGNnlMCMT3jMUuoh9/0TaqWevNontacunWyN02LA9/fIbEWlcHZcgTKb9QoaLfg==", + "version": "5.7.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.7.3.tgz", + "integrity": "sha512-84MVSjMEHP+FQRPy3pX9sTVV/INIex71s9TL2Gm5FG/WG1SqXeKyZ0k7/blY/4FdOzI12CBy1vGc4og/eus0fw==", "dev": true, "license": "Apache-2.0", "bin": { @@ -5485,15 +5547,15 @@ } }, "node_modules/typescript-eslint": { - "version": "8.19.0", - "resolved": "https://registry.npmjs.org/typescript-eslint/-/typescript-eslint-8.19.0.tgz", - "integrity": "sha512-Ni8sUkVWYK4KAcTtPjQ/UTiRk6jcsuDhPpxULapUDi8A/l8TSBk+t1GtJA1RsCzIJg0q6+J7bf35AwQigENWRQ==", + "version": "8.24.1", + "resolved": "https://registry.npmjs.org/typescript-eslint/-/typescript-eslint-8.24.1.tgz", + "integrity": "sha512-cw3rEdzDqBs70TIcb0Gdzbt6h11BSs2pS0yaq7hDWDBtCCSei1pPSUXE9qUdQ/Wm9NgFg8mKtMt1b8fTHIl1jA==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/eslint-plugin": "8.19.0", - "@typescript-eslint/parser": "8.19.0", - "@typescript-eslint/utils": "8.19.0" + "@typescript-eslint/eslint-plugin": "8.24.1", + "@typescript-eslint/parser": "8.24.1", + "@typescript-eslint/utils": "8.24.1" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -5533,9 +5595,9 @@ "license": "MIT" }, "node_modules/update-browserslist-db": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.1.1.tgz", - "integrity": "sha512-R8UzCaa9Az+38REPiJ1tXlImTJXlVfgHZsglwBD/k6nj76ctsH1E3q4doGrukiLQd3sGQYu56r5+lo5r94l29A==", + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.1.2.tgz", + "integrity": "sha512-PPypAm5qvlD7XMZC3BujecnaOxwhrtoFR+Dqkk5Aa/6DssiH0ibKoketaj9w8LP7Bont1rYeoV5plxD7RTEPRg==", "dev": true, "funding": [ { @@ -5554,7 +5616,7 @@ "license": "MIT", "dependencies": { "escalade": "^3.2.0", - "picocolors": "^1.1.0" + "picocolors": "^1.1.1" }, "bin": { "update-browserslist-db": "cli.js" @@ -5574,21 +5636,21 @@ } }, "node_modules/vite": { - "version": "5.4.11", - "resolved": "https://registry.npmjs.org/vite/-/vite-5.4.11.tgz", - "integrity": "sha512-c7jFQRklXua0mTzneGW9QVyxFjUgwcihC4bXEtujIo2ouWCe1Ajt/amn2PCxYnhYfd5k09JX3SB7OYWFKYqj8Q==", + "version": "6.1.1", + "resolved": "https://registry.npmjs.org/vite/-/vite-6.1.1.tgz", + "integrity": "sha512-4GgM54XrwRfrOp297aIYspIti66k56v16ZnqHvrIM7mG+HjDlAwS7p+Srr7J6fGvEdOJ5JcQ/D9T7HhtdXDTzA==", "dev": true, "license": "MIT", "dependencies": { - "esbuild": "^0.21.3", - "postcss": "^8.4.43", - "rollup": "^4.20.0" + "esbuild": "^0.24.2", + "postcss": "^8.5.2", + "rollup": "^4.30.1" }, "bin": { "vite": "bin/vite.js" }, "engines": { - "node": "^18.0.0 || >=20.0.0" + "node": "^18.0.0 || ^20.0.0 || >=22.0.0" }, "funding": { "url": "https://github.com/vitejs/vite?sponsor=1" @@ -5597,19 +5659,25 @@ "fsevents": "~2.3.3" }, "peerDependencies": { - "@types/node": "^18.0.0 || >=20.0.0", + "@types/node": "^18.0.0 || ^20.0.0 || >=22.0.0", + "jiti": ">=1.21.0", "less": "*", "lightningcss": "^1.21.0", "sass": "*", "sass-embedded": "*", "stylus": "*", "sugarss": "*", - "terser": "^5.4.0" + "terser": "^5.16.0", + "tsx": "^4.8.1", + "yaml": "^2.4.2" }, "peerDependenciesMeta": { "@types/node": { "optional": true }, + "jiti": { + "optional": true + }, "less": { "optional": true }, @@ -5630,6 +5698,12 @@ }, "terser": { "optional": true + }, + "tsx": { + "optional": true + }, + "yaml": { + "optional": true } } }, diff --git a/web/package.json b/web/package.json index 0d135f1..536721f 100644 --- a/web/package.json +++ b/web/package.json @@ -13,8 +13,10 @@ "dependencies": { "@wailsio/runtime": "^3.0.0-alpha.29", "blurhash": "^2.0.5", + "fast-deep-equal": "^3.1.3", "katex": "^0.16.11", "leaflet": "^1.9.4", + "matrix-widget-api": "^1.13.1", "monaco-editor": "^0.52.0", "react": "^19.0.0", "react-blurhash": "^0.3.0", @@ -37,7 +39,7 @@ "globals": "^15.9.0", "typescript": "^5.5.3", "typescript-eslint": "^8.7.0", - "vite": "^5.4.8", + "vite": "^6.0.9", "vite-plugin-svgr": "^4.2.0" } } diff --git a/web/src/api/client.ts b/web/src/api/client.ts index 4f26ef4..2b7ad24 100644 --- a/web/src/api/client.ts +++ b/web/src/api/client.ts @@ -16,7 +16,7 @@ import type { MouseEvent } from "react" import { CachedEventDispatcher, NonNullCachedEventDispatcher } from "../util/eventdispatcher.ts" import RPCClient, { SendMessageParams } from "./rpc.ts" -import { RoomStateStore, StateStore } from "./statestore" +import { RoomStateStore, StateStore, WidgetListener } from "./statestore" import type { ClientState, ElementRecentEmoji, @@ -26,6 +26,7 @@ import type { ImagePackRooms, RPCEvent, RawDBEvent, + RelationType, RoomID, RoomStateGUID, SyncStatus, @@ -40,6 +41,7 @@ export default class Client { #stateRequests: RoomStateGUID[] = [] #stateRequestPromise: Promise | null = null #gcInterval: number | undefined + #toDeviceRequested = false constructor(readonly rpc: RPCClient) { this.rpc.event.listen(this.#handleEvent) @@ -153,6 +155,22 @@ export default class Client { navigator.registerProtocolHandler("matrix", "#/uri/%s") } + addWidgetListener(listener: WidgetListener): () => void { + this.store.widgetListeners.add(listener) + // TODO only request to-device events if there are widgets that need them? + if (!this.#toDeviceRequested) { + this.#toDeviceRequested = true + this.rpc.setListenToDevice(true) + } + return () => { + this.store.widgetListeners.delete(listener) + if (this.store.widgetListeners.size === 0 && this.#toDeviceRequested) { + this.#toDeviceRequested = false + this.rpc.setListenToDevice(false) + } + } + } + start(): () => void { const abort = new AbortController() if (window.gomuksAndroid) { @@ -221,20 +239,42 @@ export default class Client { }) } - requestEvent(room: RoomStateStore | RoomID | undefined, eventID: EventID) { + requestEvent(room: RoomStateStore | RoomID | undefined, eventID: EventID, unredact?: boolean) { if (typeof room === "string") { room = this.store.rooms.get(room) } - if (!room || room.eventsByID.has(eventID) || room.requestedEvents.has(eventID)) { + if (!room || (!unredact && room.eventsByID.has(eventID)) ||room.requestedEvents.has(eventID)) { return } room.requestedEvents.add(eventID) - this.rpc.getEvent(room.roomID, eventID).then( - evt => room.applyEvent(evt), - err => console.error(`Failed to fetch event ${eventID}`, err), + this.rpc.getEvent(room.roomID, eventID, unredact).then( + evt => { + room.applyEvent(evt, false, unredact) + if (unredact) { + room.notifyTimelineSubscribers() + } + }, + err => { + console.error(`Failed to fetch event ${eventID}`, err) + if (unredact) { + room.requestedEvents.delete(eventID) + window.alert(`Failed to get unredacted content: ${err}`) + } + }, ) } + async getRelatedEvents(room: RoomStateStore | RoomID | undefined, eventID: EventID, relationType?: RelationType) { + if (typeof room === "string") { + room = this.store.rooms.get(room) + } + if (!room) { + return [] + } + const events = await this.rpc.getRelatedEvents(room.roomID, eventID, relationType) + return events.map(evt => room.getOrApplyEvent(evt)) + } + async pinMessage(room: RoomStateStore, evtID: EventID, wantPinned: boolean) { const pinnedEvents = room.getPinnedEvents() const currentlyPinned = pinnedEvents.includes(evtID) @@ -269,12 +309,14 @@ export default class Client { } } - async sendEvent(roomID: RoomID, type: EventType, content: unknown): Promise { + async sendEvent( + roomID: RoomID, type: EventType, content: unknown, disableEncryption: boolean = false, + ): Promise { const room = this.store.rooms.get(roomID) if (!room) { throw new Error("Room not found") } - const dbEvent = await this.rpc.sendEvent(roomID, type, content) + const dbEvent = await this.rpc.sendEvent(roomID, type, content, disableEncryption) this.#handleOutgoingEvent(dbEvent, room) } diff --git a/web/src/api/media.ts b/web/src/api/media.ts index 028ab6f..5d5ee67 100644 --- a/web/src/api/media.ts +++ b/web/src/api/media.ts @@ -78,7 +78,7 @@ function getFallbackCharacter(from: unknown, idx: number): string { return Array.from(from.slice(0, (idx + 1) * 2))[idx]?.toUpperCase().toWellFormed() ?? "" } -export const getAvatarURL = (userID: UserID, content?: UserProfile | null): string | undefined => { +export const getAvatarURL = (userID: UserID, content?: UserProfile | null, thumbnail = false): string | undefined => { const fallbackCharacter = getFallbackCharacter(content?.displayname, 0) || getFallbackCharacter(userID, 1) const backgroundColor = getUserColor(userID) const [server, mediaID] = parseMXC(content?.avatar_file?.url ?? content?.avatar_url) @@ -87,7 +87,12 @@ export const getAvatarURL = (userID: UserID, content?: UserProfile | null): stri } const encrypted = !!content?.avatar_file const fallback = `${backgroundColor}:${fallbackCharacter}` - return `_gomuks/media/${server}/${mediaID}?encrypted=${encrypted}&fallback=${encodeURIComponent(fallback)}` + const url = `_gomuks/media/${server}/${mediaID}?encrypted=${encrypted}&fallback=${encodeURIComponent(fallback)}` + return thumbnail ? `${url}&thumbnail=avatar` : url +} + +export const getAvatarThumbnailURL = (userID: UserID, content?: UserProfile | null): string | undefined => { + return getAvatarURL(userID, content, true) } interface RoomForAvatarURL { @@ -98,9 +103,15 @@ interface RoomForAvatarURL { avatar_url?: ContentURI } -export const getRoomAvatarURL = (room: RoomForAvatarURL, avatarOverride?: ContentURI): string | undefined => { +export const getRoomAvatarURL = ( + room: RoomForAvatarURL, avatarOverride?: ContentURI, thumbnail = false, +): string | undefined => { return getAvatarURL(room.dm_user_id ?? room.room_id, { displayname: room.name, avatar_url: avatarOverride ?? room.avatar ?? room.avatar_url, - }) + }, thumbnail) +} + +export const getRoomAvatarThumbnailURL = (room: RoomForAvatarURL, avatarOverride?: ContentURI): string | undefined => { + return getRoomAvatarURL(room, avatarOverride, true) } diff --git a/web/src/api/rpc.ts b/web/src/api/rpc.ts index 95fb019..935f953 100644 --- a/web/src/api/rpc.ts +++ b/web/src/api/rpc.ts @@ -19,11 +19,11 @@ import type { ClientWellKnown, DBPushRegistration, EventID, - EventRowID, EventType, JSONValue, LoginFlowsResponse, LoginRequest, + MembershipAction, Mentions, MessageEventContent, PaginationResponse, @@ -33,9 +33,14 @@ import type { RawDBEvent, ReceiptType, RelatesTo, + RelationType, + ReqCreateRoom, ResolveAliasResponse, + RespCreateRoom, + RespMediaConfig, RespOpenIDToken, RespRoomJoin, + RespTurnServer, RoomAlias, RoomID, RoomStateGUID, @@ -145,8 +150,14 @@ export default abstract class RPCClient { return this.request("send_message", params) } - sendEvent(room_id: RoomID, type: EventType, content: unknown): Promise { - return this.request("send_event", { room_id, type, content }) + sendEvent( + room_id: RoomID, + type: EventType, + content: unknown, + disable_encryption: boolean = false, + synchronous: boolean = false, + ): Promise { + return this.request("send_event", { room_id, type, content, disable_encryption, synchronous }) } resendEvent(transaction_id: string): Promise { @@ -167,6 +178,10 @@ export default abstract class RPCClient { return this.request("set_state", { room_id, type, state_key, content }) } + setMembership(room_id: RoomID, user_id: UserID, action: MembershipAction, reason?: string): Promise { + return this.request("set_membership", { room_id, user_id, action, reason }) + } + setAccountData(type: EventType, content: unknown, room_id?: RoomID): Promise { return this.request("set_account_data", { type, content, room_id }) } @@ -203,6 +218,14 @@ export default abstract class RPCClient { return this.request("ensure_group_session_shared", { room_id }) } + sendToDevice( + event_type: EventType, + messages: { [userId: string]: { [deviceId: string]: object } }, + encrypted: boolean = false, + ): Promise { + return this.request("send_to_device", { event_type, messages, encrypted }) + } + getSpecificRoomState(keys: RoomStateGUID[]): Promise { return this.request("get_specific_room_state", { keys }) } @@ -213,12 +236,12 @@ export default abstract class RPCClient { return this.request("get_room_state", { room_id, include_members, fetch_members, refetch }) } - getEvent(room_id: RoomID, event_id: EventID): Promise { - return this.request("get_event", { room_id, event_id }) + getEvent(room_id: RoomID, event_id: EventID, unredact?: boolean): Promise { + return this.request("get_event", { room_id, event_id, unredact }) } - getEventsByRowIDs(row_ids: EventRowID[]): Promise { - return this.request("get_events_by_row_ids", { row_ids }) + getRelatedEvents(room_id: RoomID, event_id: EventID, relation_type?: RelationType): Promise { + return this.request("get_related_events", { room_id, event_id, relation_type }) } paginate(room_id: RoomID, max_timeline_id: TimelineRowID, limit: number): Promise { @@ -241,6 +264,14 @@ export default abstract class RPCClient { return this.request("leave_room", { room_id, reason }) } + createRoom(request: ReqCreateRoom): Promise { + return this.request("create_room", request) + } + + muteRoom(room_id: RoomID, muted: boolean): Promise { + return this.request("mute_room", { room_id, muted }) + } + resolveAlias(alias: RoomAlias): Promise { return this.request("resolve_alias", { alias }) } @@ -272,4 +303,16 @@ export default abstract class RPCClient { registerPush(reg: DBPushRegistration): Promise { return this.request("register_push", reg) } + + getTurnServers(): Promise { + return this.request("get_turn_servers", {}) + } + + getMediaConfig(): Promise { + return this.request("get_media_config", {}) + } + + setListenToDevice(listen: boolean): Promise { + return this.request("listen_to_device", listen) + } } diff --git a/web/src/api/statestore/main.ts b/web/src/api/statestore/main.ts index c430fa7..804d118 100644 --- a/web/src/api/statestore/main.ts +++ b/web/src/api/statestore/main.ts @@ -13,7 +13,7 @@ // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . -import { getAvatarURL } from "@/api/media.ts" +import { getAvatarThumbnailURL } from "@/api/media.ts" import { Preferences, getLocalStoragePreferences, getPreferenceProxy } from "@/api/types/preferences" import { CustomEmojiPack, parseCustomEmojiPack } from "@/util/emoji" import { NonNullCachedEventDispatcher } from "@/util/eventdispatcher.ts" @@ -32,6 +32,7 @@ import { SendCompleteData, SyncCompleteData, SyncRoom, + SyncToDevice, TypingEventData, UnknownEventContent, UserID, @@ -61,6 +62,13 @@ export interface GCSettings { lastOpenedCutoff: number, } +export interface WidgetListener { + onTimelineEvent(evt: MemDBEvent): void + onStateEvent(evt: MemDBEvent): void + onToDeviceEvent(evt: SyncToDevice): void + onRoomChange(roomID: RoomID | null): void +} + window.gcSettings ??= { // Run garbage collection every 15 minutes. interval: 15 * 60 * 1000, @@ -98,9 +106,19 @@ export class StateStore { readonly localPreferenceCache: Preferences = getLocalStoragePreferences("global_prefs", this.preferenceSub.notify) serverPreferenceCache: Preferences = {} switchRoom?: (roomID: RoomID | null) => void - activeRoomID: RoomID | null = null + #activeRoomID: RoomID | null = null activeRoomIsPreview: boolean = false imageAuthToken?: string + readonly widgetListeners: Set = new Set() + + get activeRoomID(): RoomID | null { + return this.#activeRoomID + } + + set activeRoomID(roomID: RoomID | null) { + this.#activeRoomID = roomID + this.widgetListeners.forEach(listener => listener.onRoomChange(roomID)) + } #roomListFilterFunc = (entry: RoomListEntry) => { if (this.currentRoomListQuery && !entry.search_name.includes(this.currentRoomListQuery)) { @@ -243,6 +261,11 @@ export class StateStore { } const resyncRoomList = this.roomList.current.length === 0 const changedRoomListEntries = new Map() + if (sync.to_device?.length && this.widgetListeners.size > 0) { + for (const listener of this.widgetListeners) { + sync.to_device.forEach(listener.onToDeviceEvent) + } + } for (const data of sync.invited_rooms ?? []) { const room = new InvitedRoomStore(data, this) this.inviteRooms.set(room.room_id, room) @@ -469,7 +492,7 @@ export class StateStore { body = body.slice(0, 350) + " […]" } const memberEvt = room.getStateEvent("m.room.member", evt.sender) - const icon = `${getAvatarURL(evt.sender, memberEvt?.content)}&image_auth=${this.imageAuthToken}` + const icon = `${getAvatarThumbnailURL(evt.sender, memberEvt?.content)}&image_auth=${this.imageAuthToken}` const roomName = room.meta.current.name ?? "Unnamed room" const senderName = memberEvt?.content.displayname ?? evt.sender const title = senderName === roomName ? senderName : `${senderName} (${roomName})` diff --git a/web/src/api/statestore/room.ts b/web/src/api/statestore/room.ts index 5252a3c..78cd474 100644 --- a/web/src/api/statestore/room.ts +++ b/web/src/api/statestore/room.ts @@ -18,7 +18,7 @@ import { CustomEmojiPack, parseCustomEmojiPack } from "@/util/emoji" import { NonNullCachedEventDispatcher } from "@/util/eventdispatcher.ts" import toSearchableString from "@/util/searchablestring.ts" import Subscribable, { MultiSubscribable, NoDataSubscribable } from "@/util/subscribable.ts" -import { getDisplayname } from "@/util/validation.ts" +import { getDisplayname, getServerName } from "@/util/validation.ts" import { ContentURI, DBReceipt, @@ -246,6 +246,35 @@ export class RoomStateStore { return this.#membersCache ?? [] } + getViaServers(): string[] { + const ownServerName = getServerName(this.parent.userID) + const vias = [ownServerName] + const members = this.getMembers() + const memberCount = new Map() + const powerLevels: PowerLevelEventContent = this.getStateEvent("m.room.power_levels", "")?.content ?? {} + const usersDefault = powerLevels.users_default ?? 0 + let powerServer: string | undefined = undefined + for (const member of members) { + const serverName = getServerName(member.userID) + if (serverName !== ownServerName) { + if (!powerServer && (powerLevels?.users?.[member.userID] ?? usersDefault) > usersDefault) { + powerServer = serverName + vias.push(powerServer) + } + memberCount.set(serverName, (memberCount.get(serverName) ?? 0) + 1) + } + } + const servers = Array.from(memberCount.entries()) + servers.sort(([, a], [, b]) => b - a) + for (const [serverName] of servers) { + if (serverName !== ownServerName && serverName !== powerServer) { + vias.push(serverName) + break + } + } + return vias + } + getPinnedEvents(): EventID[] { const pinnedList = this.getStateEvent("m.room.pinned_events", "")?.content?.pinned if (Array.isArray(pinnedList)) { @@ -315,13 +344,35 @@ export class RoomStateStore { return true } - applyEvent(evt: RawDBEvent, pending: boolean = false) { + getOrApplyEvent(evt: RawDBEvent) { + const existing = this.eventsByRowID.get(evt.rowid) + if (existing) { + return existing + } + return this.applyEvent(evt) + } + + setViewingRedacted(evt: MemDBEvent, view: boolean) { + const modified = { + ...evt, + viewing_redacted: view, + } + this.eventsByRowID.set(evt.rowid, modified) + this.eventsByID.set(evt.event_id, modified) + this.eventSubs.notify(evt.event_id) + this.notifyTimelineSubscribers() + } + + applyEvent(evt: RawDBEvent, pending: boolean = false, viewRedacted: boolean = false) { const memEvt = evt as MemDBEvent memEvt.mem = true memEvt.pending = pending if (pending) { memEvt.timeline_rowid = UNSENT_TIMELINE_ROWID_BASE + memEvt.timestamp } + if (viewRedacted) { + memEvt.viewing_redacted = true + } if (evt.type === "m.room.encrypted" && evt.decrypted && evt.decrypted_type) { memEvt.type = evt.decrypted_type memEvt.encrypted = evt.content as EncryptedEventContent @@ -332,20 +383,24 @@ export class RoomStateStore { if (memEvt.last_edit_rowid) { memEvt.last_edit = this.eventsByRowID.get(memEvt.last_edit_rowid) if (memEvt.last_edit) { - memEvt.orig_content = memEvt.content - memEvt.content = memEvt.last_edit.content["m.new_content"] + memEvt.orig_content = memEvt.orig_content ?? memEvt.content + memEvt.orig_local_content = memEvt.orig_local_content ?? memEvt.local_content + memEvt.content = memEvt.last_edit.content["m.new_content"] ?? memEvt.last_edit.content memEvt.local_content = memEvt.last_edit.local_content } } else if (memEvt.relation_type === "m.replace" && memEvt.relates_to) { const editTarget = this.eventsByID.get(memEvt.relates_to) - if (editTarget?.last_edit_rowid === memEvt.rowid && !editTarget.last_edit) { - this.eventsByRowID.set(editTarget.rowid, { + if (editTarget?.last_edit_rowid === memEvt.rowid) { + const modified: MemDBEvent = { ...editTarget, last_edit: memEvt, - orig_content: editTarget.content, - content: memEvt.content["m.new_content"], + orig_local_content: editTarget.orig_local_content ?? editTarget.local_content, + orig_content: editTarget.orig_content ?? editTarget.content, + content: memEvt.content["m.new_content"] ?? memEvt.content, local_content: memEvt.local_content, - }) + } + this.eventsByRowID.set(editTarget.rowid, modified) + this.eventsByID.set(editTarget.event_id, modified) this.eventSubs.notify(editTarget.event_id) } } @@ -402,6 +457,8 @@ export class RoomStateStore { for (const evt of sync.events ?? []) { this.applyEvent(evt) } + const hasWidgets = this.parent.widgetListeners.size > 0 + const newState: MemDBEvent[] = [] for (const [evtType, changedEvts] of Object.entries(sync.state ?? {})) { let stateMap = this.state.get(evtType) if (!stateMap) { @@ -411,6 +468,12 @@ export class RoomStateStore { for (const [key, rowID] of Object.entries(changedEvts)) { stateMap.set(key, rowID) this.invalidateStateCaches(evtType, key) + if (hasWidgets) { + const evt = this.eventsByRowID.get(rowID) + if (evt) { + newState.push(evt) + } + } } this.stateSubs.notify(evtType) } @@ -430,6 +493,13 @@ export class RoomStateStore { for (const [evtID, receipts] of Object.entries(sync.receipts ?? {})) { this.applyReceipts(receipts, evtID, false) } + if (hasWidgets && ((sync.timeline && sync.timeline.length > 0) || newState.length > 0)) { + const evts = sync.timeline?.map(evt => this.eventsByRowID.get(evt.event_rowid)).filter(evt => !!evt) + this.parent.widgetListeners.forEach(listener => { + evts?.forEach(listener.onTimelineEvent) + newState.forEach(listener.onStateEvent) + }) + } } applyState(evt: RawDBEvent) { diff --git a/web/src/api/types/hievents.ts b/web/src/api/types/hievents.ts index 125eb57..8efbbaf 100644 --- a/web/src/api/types/hievents.ts +++ b/web/src/api/types/hievents.ts @@ -86,6 +86,13 @@ export interface SyncNotification { sound: boolean } +export interface SyncToDevice { + sender: UserID + type: EventType + content: Record + encrypted: boolean +} + export interface SyncCompleteData { rooms: Record | null invited_rooms: DBInvitedRoom[] | null @@ -95,6 +102,7 @@ export interface SyncCompleteData { top_level_spaces: RoomID[] | null since?: string clear_state?: boolean + to_device?: SyncToDevice[] | null } export interface SyncCompleteEvent extends BaseRPCCommand { diff --git a/web/src/api/types/hitypes.ts b/web/src/api/types/hitypes.ts index c7489cd..688ecc4 100644 --- a/web/src/api/types/hitypes.ts +++ b/web/src/api/types/hitypes.ts @@ -156,7 +156,9 @@ export interface MemDBEvent extends BaseDBEvent { pending: boolean encrypted?: EncryptedEventContent orig_content?: UnknownEventContent + orig_local_content?: LocalContent last_edit?: MemDBEvent + viewing_redacted?: boolean } export interface DBAccountData { @@ -292,3 +294,5 @@ export interface DBPushRegistration { encryption: { key: string } expiration?: number } + +export type MembershipAction = "invite" | "kick" | "ban" | "unban" diff --git a/web/src/api/types/mxtypes.ts b/web/src/api/types/mxtypes.ts index 51a22d4..e576127 100644 --- a/web/src/api/types/mxtypes.ts +++ b/web/src/api/types/mxtypes.ts @@ -218,6 +218,10 @@ export interface ReactionEventContent { "com.beeper.reaction.shortcode"?: string } +export interface IgnoredUsersEventContent { + ignored_users: Record +} + export interface EncryptedFile { url: ContentURI k: string @@ -316,3 +320,41 @@ export interface RespOpenIDToken { matrix_server_name: string token_type: "Bearer" } + +export type RoomVisibility = "public" | "private" +export type RoomPreset = "private_chat" | "public_chat" | "trusted_private_chat" + +export interface ReqCreateRoom { + visibility?: RoomVisibility + room_alias_name?: string + name?: string + topic?: string + invite?: UserID[] + preset?: RoomPreset + is_direct?: boolean + initial_state?: { + type: EventType + state_key?: string + content: Record + }[] + room_version?: string + creation_content?: Record + power_level_content_override?: Record + "fi.mau.room_id"?: RoomID +} + +export interface RespCreateRoom { + room_id: RoomID +} + +export interface RespTurnServer { + username: string + password: string + ttl: number + uris: string[] +} + +export interface RespMediaConfig { + "m.upload.size": number + [key: string]: unknown +} diff --git a/web/src/api/types/preferences/preferences.ts b/web/src/api/types/preferences/preferences.ts index 94e8764..696083a 100644 --- a/web/src/api/types/preferences/preferences.ts +++ b/web/src/api/types/preferences/preferences.ts @@ -139,6 +139,12 @@ export const preferences = { allowedContexts: anyContext, defaultValue: "https://tile.openstreetmap.org/{z}/{x}/{y}.png", }), + element_call_base_url: new Preference({ + displayName: "Element call base URL", + description: "The widget base URL for Element calls.", + allowedContexts: anyContext, + defaultValue: "https://call.element.io", + }), gif_provider: new Preference({ displayName: "GIF provider", description: "The service to use to search for GIFs", diff --git a/web/src/icons/block.svg b/web/src/icons/block.svg new file mode 100644 index 0000000..01b6a9e --- /dev/null +++ b/web/src/icons/block.svg @@ -0,0 +1 @@ + diff --git a/web/src/icons/chat.svg b/web/src/icons/chat.svg new file mode 100644 index 0000000..4d4d233 --- /dev/null +++ b/web/src/icons/chat.svg @@ -0,0 +1 @@ + diff --git a/web/src/icons/door-open.svg b/web/src/icons/door-open.svg new file mode 100644 index 0000000..d4a5719 --- /dev/null +++ b/web/src/icons/door-open.svg @@ -0,0 +1 @@ + diff --git a/web/src/icons/gavel.svg b/web/src/icons/gavel.svg new file mode 100644 index 0000000..78195c7 --- /dev/null +++ b/web/src/icons/gavel.svg @@ -0,0 +1 @@ + diff --git a/web/src/icons/mark-read.svg b/web/src/icons/mark-read.svg new file mode 100644 index 0000000..3819d33 --- /dev/null +++ b/web/src/icons/mark-read.svg @@ -0,0 +1 @@ + diff --git a/web/src/icons/mark-unread.svg b/web/src/icons/mark-unread.svg new file mode 100644 index 0000000..2228f31 --- /dev/null +++ b/web/src/icons/mark-unread.svg @@ -0,0 +1 @@ + diff --git a/web/src/icons/person-add.svg b/web/src/icons/person-add.svg new file mode 100644 index 0000000..a6dc833 --- /dev/null +++ b/web/src/icons/person-add.svg @@ -0,0 +1 @@ + diff --git a/web/src/icons/person-remove.svg b/web/src/icons/person-remove.svg new file mode 100644 index 0000000..1e6b59b --- /dev/null +++ b/web/src/icons/person-remove.svg @@ -0,0 +1 @@ + diff --git a/web/src/icons/restore-trash.svg b/web/src/icons/restore-trash.svg new file mode 100644 index 0000000..80812ca --- /dev/null +++ b/web/src/icons/restore-trash.svg @@ -0,0 +1 @@ + diff --git a/web/src/icons/share.svg b/web/src/icons/share.svg new file mode 100644 index 0000000..f86fdd4 --- /dev/null +++ b/web/src/icons/share.svg @@ -0,0 +1 @@ + diff --git a/web/src/icons/widgets.svg b/web/src/icons/widgets.svg new file mode 100644 index 0000000..139afad --- /dev/null +++ b/web/src/icons/widgets.svg @@ -0,0 +1 @@ + diff --git a/web/src/index.css b/web/src/index.css index 5d6f39d..0aa7987 100644 --- a/web/src/index.css +++ b/web/src/index.css @@ -86,6 +86,7 @@ --timeline-message-gap-small-event: 0; --timeline-sender-name-timestamp-gap: .25rem; --timeline-sender-name-content-gap: 0; + --timeline-vertical-padding: 0; --timeline-horizontal-padding: 1.5rem; --timeline-status-size: 4rem; @@ -207,6 +208,8 @@ button, a.button, span.button { justify-content: center; align-items: center; color: inherit; + /* Buttons sometimes have their own fonts? */ + font-family: var(--font-stack); &:hover, &:focus { background-color: var(--button-hover-color); diff --git a/web/src/ui/MainScreen.tsx b/web/src/ui/MainScreen.tsx index c0a5b48..35804b5 100644 --- a/web/src/ui/MainScreen.tsx +++ b/web/src/ui/MainScreen.tsx @@ -13,6 +13,7 @@ // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . +import equal from "fast-deep-equal" import { JSX, use, useEffect, useMemo, useReducer, useRef, useState } from "react" import { SyncLoader } from "react-spinners" import Client from "@/api/client.ts" @@ -24,7 +25,7 @@ import ClientContext from "./ClientContext.ts" import MainScreenContext, { MainScreenContextFields } from "./MainScreenContext.ts" import StylePreferences from "./StylePreferences.tsx" import Keybindings from "./keybindings.ts" -import { ModalWrapper } from "./modal" +import { ModalContext, ModalWrapper, NestableModalContext } from "./modal" import RightPanel, { RightPanelProps } from "./rightpanel/RightPanel.tsx" import RoomList from "./roomlist/RoomList.tsx" import RoomPreview, { RoomPreviewProps } from "./roomview/RoomPreview.tsx" @@ -32,19 +33,6 @@ import RoomView from "./roomview/RoomView.tsx" import { useResizeHandle } from "./util/useResizeHandle.tsx" import "./MainScreen.css" -function objectIsEqual(a: RightPanelProps | null, b: RightPanelProps | null): boolean { - if (a === null || b === null) { - return a === null && b === null - } - for (const key of Object.keys(a)) { - // @ts-expect-error 3:< - if (a[key] !== b[key]) { - return false - } - } - return true -} - class ContextFields implements MainScreenContextFields { public keybindings: Keybindings private rightPanelStack: RightPanelProps[] = [] @@ -64,10 +52,10 @@ class ContextFields implements MainScreenContextFields { } setRightPanel = (props: RightPanelProps | null, pushState = true) => { - if ((props?.type === "members" || props?.type === "pinned-messages") && !this.client.store.activeRoomID) { + if ((props?.type !== "user") && !this.client.store.activeRoomID) { props = null } - const isEqual = objectIsEqual(this.currentRightPanel, props) + const isEqual = equal(this.currentRightPanel, props) if (isEqual && !pushState) { return } @@ -81,7 +69,7 @@ class ContextFields implements MainScreenContextFields { } else { this.directSetRightPanel(props) for (let i = this.rightPanelStack.length - 1; i >= 0; i--) { - if (objectIsEqual(this.rightPanelStack[i], props)) { + if (equal(this.rightPanelStack[i], props)) { this.rightPanelStack = this.rightPanelStack.slice(0, i + 1) if (pushState) { history.go(i - this.rightPanelStack.length) @@ -219,7 +207,7 @@ class ContextFields implements MainScreenContextFields { clickRightPanelOpener = (evt: React.MouseEvent) => { evt.preventDefault() const type = evt.currentTarget.getAttribute("data-target-panel") - if (type === "pinned-messages" || type === "members") { + if (type === "pinned-messages" || type === "members" || type === "widgets") { this.setRightPanel({ type }) } else if (type === "user") { this.setRightPanel({ type, userID: evt.currentTarget.getAttribute("data-target-user")! }) @@ -422,28 +410,31 @@ const MainScreen = () => { return () => clearTimeout(timeout) } }, [activeRoom, prevActiveRoom]) + const mainContent =
+ + {resizeHandle1} + {renderedRoom + ? renderedRoom instanceof RoomStateStore + ? + : + : rightPanel && <> +
+ {resizeHandle2} + {rightPanel && } + } +
return - - -
- - {resizeHandle1} - {renderedRoom - ? renderedRoom instanceof RoomStateStore - ? - : - : rightPanel && <> -
- {resizeHandle2} - {rightPanel && } - } -
- {syncLoader} + + + + {mainContent} + {syncLoader} +
} diff --git a/web/src/ui/composer/Autocompleter.tsx b/web/src/ui/composer/Autocompleter.tsx index 432d327..0d9eff5 100644 --- a/web/src/ui/composer/Autocompleter.tsx +++ b/web/src/ui/composer/Autocompleter.tsx @@ -14,7 +14,7 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . import { JSX, RefObject, use, useEffect } from "react" -import { getAvatarURL, getMediaURL } from "@/api/media.ts" +import { getAvatarThumbnailURL, getMediaURL } from "@/api/media.ts" import { AutocompleteMemberEntry, RoomStateStore, useCustomEmojis } from "@/api/statestore" import { Emoji, emojiToMarkdown, useSortedAndFilteredEmojis } from "@/util/emoji" import { escapeMarkdown } from "@/util/markdown.ts" @@ -138,7 +138,7 @@ const userFuncs = { {user.displayName} diff --git a/web/src/ui/composer/ComposerMedia.tsx b/web/src/ui/composer/ComposerMedia.tsx index 44fe952..40a0b94 100644 --- a/web/src/ui/composer/ComposerMedia.tsx +++ b/web/src/ui/composer/ComposerMedia.tsx @@ -13,6 +13,7 @@ // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . +import { RefCallback, useState } from "react" import Client from "@/api/client.ts" import { RoomStateStore, usePreference } from "@/api/statestore" import type { MediaMessageEventContent } from "@/api/types" @@ -27,10 +28,19 @@ export interface ComposerMediaProps { } export const ComposerMedia = ({ content, clearMedia }: ComposerMediaProps) => { + const defaultMaxWidth = 360 + const paddingAndButtonWidth = 16 + 40 + const [maxWidth, setMaxWidth] = useState(defaultMaxWidth) const [mediaContent, containerClass, containerStyle] = useMediaContent( - content, "m.room.message", { height: 120, width: 360 }, + content, "m.room.message", { height: 120, width: maxWidth }, ) - return
+ const containerRef: RefCallback = elem => { + setMaxWidth(Math.min( + (elem?.getBoundingClientRect().width ?? defaultMaxWidth) - paddingAndButtonWidth, + defaultMaxWidth, + )) + } + return
{mediaContent}
diff --git a/web/src/ui/composer/MessageComposer.tsx b/web/src/ui/composer/MessageComposer.tsx index f9437b3..34c8a86 100644 --- a/web/src/ui/composer/MessageComposer.tsx +++ b/web/src/ui/composer/MessageComposer.tsx @@ -55,6 +55,7 @@ export interface ComposerState { replyTo: EventID | null silentReply: boolean explicitReplyInThread: boolean + startNewThread: boolean uninited?: boolean } @@ -67,6 +68,7 @@ const emptyComposer: ComposerState = { location: null, silentReply: false, explicitReplyInThread: false, + startNewThread: false, } const uninitedComposer: ComposerState = { ...emptyComposer, uninited: true } const composerReducer = ( @@ -116,7 +118,7 @@ const MessageComposer = () => { document.execCommand("insertText", false, text) }, []) roomCtx.setReplyTo = useCallback((evt: EventID | null) => { - setState({ replyTo: evt, silentReply: false, explicitReplyInThread: false }) + setState({ replyTo: evt, silentReply: false, explicitReplyInThread: false, startNewThread: false }) textInput.current?.focus() }, []) const setSilentReply = useCallback((newVal: boolean | React.MouseEvent) => { @@ -135,6 +137,14 @@ const MessageComposer = () => { setState(state => ({ explicitReplyInThread: !state.explicitReplyInThread })) } }, []) + const setStartNewThread = useCallback((newVal: boolean | React.MouseEvent) => { + if (typeof newVal === "boolean") { + setState({ startNewThread: newVal }) + } else { + newVal.stopPropagation() + setState(state => ({ startNewThread: !state.startNewThread })) + } + }, []) roomCtx.setEditing = useCallback((evt: MemDBEvent | null) => { if (evt === null) { rawSetEditing(null) @@ -160,13 +170,14 @@ const MessageComposer = () => { replyTo: null, silentReply: false, explicitReplyInThread: false, + startNewThread: false, }) textInput.current?.focus() }, [room.roomID]) const canSend = Boolean(state.text || state.media || state.location) const onClickSend = (evt: React.FormEvent) => { evt.preventDefault() - if (!canSend) { + if (!canSend || loadingMedia) { return } doSendMessage(state) @@ -204,6 +215,10 @@ const MessageComposer = () => { relates_to.rel_type = "m.thread" relates_to.event_id = replyToEvt.content?.["m.relates_to"].event_id relates_to.is_falling_back = !state.explicitReplyInThread + } else if (state.startNewThread) { + relates_to.rel_type = "m.thread" + relates_to.event_id = replyToEvt.event_id + relates_to.is_falling_back = true } } let base_content: MessageEventContent | undefined @@ -553,7 +568,7 @@ const MessageComposer = () => { style.left = style.right delete style.right openModal({ - content:
+ content:
{makeAttachmentButtons(true)}
, }) @@ -580,6 +595,8 @@ const MessageComposer = () => { onSetSilent={setSilentReply} isExplicitInThread={state.explicitReplyInThread} onSetExplicitInThread={setExplicitReplyInThread} + startNewThread={state.startNewThread} + onSetStartNewThread={setStartNewThread} />} {editing && . import { JSX, use } from "react" import { PulseLoader } from "react-spinners" -import { getAvatarURL } from "@/api/media.ts" +import { getAvatarThumbnailURL } from "@/api/media.ts" import { useMultipleRoomMembers, useRoomTyping } from "@/api/statestore" import { humanJoin } from "@/util/join.ts" import { getDisplayname } from "@/util/validation.ts" @@ -40,7 +40,7 @@ const TypingNotifications = () => { key={sender} className="small avatar" loading="lazy" - src={getAvatarURL(sender, member)} + src={getAvatarThumbnailURL(sender, member)} alt="" />) memberNames.push(getDisplayname(sender, member)) diff --git a/web/src/ui/composer/userautocomplete.ts b/web/src/ui/composer/userautocomplete.ts index a9e9845..38f207c 100644 --- a/web/src/ui/composer/userautocomplete.ts +++ b/web/src/ui/composer/userautocomplete.ts @@ -34,6 +34,7 @@ export function filter(users: AutocompleteMemberEntry[], query: string): Autocom interface filteredUserCache { query: string result: AutocompleteMemberEntry[] + slicedResult?: AutocompleteMemberEntry[] } export function useFilteredMembers( @@ -44,15 +45,16 @@ export function useFilteredMembers( if (!query) { prev.current.query = "" prev.current.result = allMembers + prev.current.slicedResult = slice && allMembers.length > 100 ? allMembers.slice(0, 100) : undefined } else if (prev.current.query !== query) { prev.current.result = (sort ? filterAndSort : filter)( query.startsWith(prev.current.query) ? prev.current.result : allMembers, query, ) - if (prev.current.result.length > 100 && slice) { - prev.current.result = prev.current.result.slice(0, 100) - } + prev.current.slicedResult = prev.current.result.length > 100 && slice + ? prev.current.result.slice(0, 100) + : undefined prev.current.query = query } - return prev.current.result + return prev.current.slicedResult ?? prev.current.result } diff --git a/web/src/ui/emojipicker/EmojiPicker.css b/web/src/ui/emojipicker/EmojiPicker.css index eaab885..87ae66b 100644 --- a/web/src/ui/emojipicker/EmojiPicker.css +++ b/web/src/ui/emojipicker/EmojiPicker.css @@ -226,7 +226,7 @@ div.emoji-picker, div.sticker-picker { } @media screen and (max-width: 37.5rem) { - div.emoji-picker, div.gif-picker { + div.emoji-picker, div.gif-picker, div.sticker-picker { inset: 0 0 3rem 0 !important; width: 100%; height: calc(100% - 3rem); diff --git a/web/src/ui/timeline/menu/ConfirmWithMessageModal.tsx b/web/src/ui/menu/ConfirmWithMessageModal.tsx similarity index 87% rename from web/src/ui/timeline/menu/ConfirmWithMessageModal.tsx rename to web/src/ui/menu/ConfirmWithMessageModal.tsx index 9028a32..4d44084 100644 --- a/web/src/ui/timeline/menu/ConfirmWithMessageModal.tsx +++ b/web/src/ui/menu/ConfirmWithMessageModal.tsx @@ -13,16 +13,16 @@ // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . -import React, { use, useState } from "react" +import React, { JSX, use, useState } from "react" import { MemDBEvent } from "@/api/types" import { isMobileDevice } from "@/util/ismobile.ts" -import { ModalCloseContext } from "../../modal" -import TimelineEvent from "../TimelineEvent.tsx" +import { ModalCloseContext } from "../modal" +import TimelineEvent from "../timeline/TimelineEvent.tsx" interface ConfirmWithMessageProps { - evt: MemDBEvent + evt?: MemDBEvent title: string - description: string + description: string | JSX.Element placeholder: string confirmButton: string onConfirm: (reason: string) => void @@ -40,9 +40,9 @@ const ConfirmWithMessageModal = ({ } return

{title}

-
+ {evt &&
-
+
}
{description}
diff --git a/web/src/ui/timeline/menu/EventMenu.tsx b/web/src/ui/menu/EventMenu.tsx similarity index 89% rename from web/src/ui/timeline/menu/EventMenu.tsx rename to web/src/ui/menu/EventMenu.tsx index 13a839b..afa4f54 100644 --- a/web/src/ui/timeline/menu/EventMenu.tsx +++ b/web/src/ui/menu/EventMenu.tsx @@ -15,8 +15,8 @@ // along with this program. If not, see . import { CSSProperties, use } from "react" import { MemDBEvent } from "@/api/types" -import ClientContext from "../../ClientContext.ts" -import { RoomContextData } from "../../roomview/roomcontext.ts" +import ClientContext from "../ClientContext.ts" +import { RoomContextData } from "../roomview/roomcontext.ts" import { usePrimaryItems } from "./usePrimaryItems.tsx" import { useSecondaryItems } from "./useSecondaryItems.tsx" import CloseIcon from "@/icons/close.svg?react" @@ -41,14 +41,14 @@ interface EventContextMenuProps extends BaseEventMenuProps { export const EventExtraMenu = ({ evt, roomCtx, style }: EventContextMenuProps) => { const elements = useSecondaryItems(use(ClientContext)!, roomCtx, evt) - return
{elements}
+ return
{elements}
} export const EventFullMenu = ({ evt, roomCtx, style }: EventContextMenuProps) => { const client = use(ClientContext)! const primary = usePrimaryItems(client, roomCtx, evt, false, false, style, undefined) const secondary = useSecondaryItems(client, roomCtx, evt) - return
+ return
{primary}
{secondary} diff --git a/web/src/ui/menu/RoomMenu.css b/web/src/ui/menu/RoomMenu.css new file mode 100644 index 0000000..684a877 --- /dev/null +++ b/web/src/ui/menu/RoomMenu.css @@ -0,0 +1,3 @@ +div.room-list-menu { + +} diff --git a/web/src/ui/menu/RoomMenu.tsx b/web/src/ui/menu/RoomMenu.tsx new file mode 100644 index 0000000..d430f97 --- /dev/null +++ b/web/src/ui/menu/RoomMenu.tsx @@ -0,0 +1,121 @@ +// gomuks - A Matrix client written in Go. +// Copyright (C) 2025 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 . +import { CSSProperties, use } from "react" +import { RoomListEntry, RoomStateStore, useAccountData } from "@/api/statestore" +import { RoomID } from "@/api/types" +import { useEventAsState } from "@/util/eventdispatcher.ts" +import ClientContext from "../ClientContext.ts" +import { ModalCloseContext } from "../modal" +import SettingsView from "../settings/SettingsView.tsx" +import DoorOpenIcon from "@/icons/door-open.svg?react" +import MarkReadIcon from "@/icons/mark-read.svg?react" +import MarkUnreadIcon from "@/icons/mark-unread.svg?react" +import NotificationsOffIcon from "@/icons/notifications-off.svg?react" +import NotificationsIcon from "@/icons/notifications.svg?react" +import SettingsIcon from "@/icons/settings.svg?react" +import "./RoomMenu.css" + +interface RoomMenuProps { + room: RoomStateStore + entry: RoomListEntry + style: CSSProperties +} + +const hasNotifyingActions = (actions: unknown) => { + return Array.isArray(actions) && actions.length > 0 && actions.includes("notify") +} + +const MuteButton = ({ roomID }: { roomID: RoomID }) => { + const client = use(ClientContext)! + const closeModal = use(ModalCloseContext) + const roomRules = useAccountData(client.store, "m.push_rules")?.global?.room + const pushRule = Array.isArray(roomRules) ? roomRules.find(rule => rule?.rule_id === roomID) : null + const muted = pushRule?.enabled === true && !hasNotifyingActions(pushRule.actions) + const toggleMute = () => { + client.rpc.muteRoom(roomID, !muted).catch(err => { + console.error("Failed to mute room", err) + window.alert(`Failed to ${muted ? "unmute" : "mute"} room: ${err}`) + }) + closeModal() + } + return +} + +const MarkReadButton = ({ room }: { room: RoomStateStore }) => { + const meta = useEventAsState(room.meta) + const client = use(ClientContext)! + const closeModal = use(ModalCloseContext) + const read = !meta.marked_unread && meta.unread_messages === 0 + const markRead = () => { + const evt = room.eventsByRowID.get( + room.timeline[room.timeline.length-1]?.event_rowid ?? meta.preview_event_rowid, + ) + if (!evt) { + window.alert("Can't mark room as read: last event not found in cache") + return + } + const rrType = room.preferences.send_read_receipts ? "m.read" : "m.read.private" + client.rpc.markRead(room.roomID, evt.event_id, rrType).catch(err => { + console.error("Failed to mark room as read", err) + window.alert(`Failed to mark room as read: ${err}`) + }) + closeModal() + } + const markUnread = () => { + client.rpc.setAccountData("m.marked_unread", { unread: true }, room.roomID).catch(err => { + console.error("Failed to mark room as unread", err) + window.alert(`Failed to mark room as unread: ${err}`) + }) + closeModal() + } + return +} + +export const RoomMenu = ({ room, style }: RoomMenuProps) => { + const closeModal = use(ModalCloseContext) + const client = use(ClientContext)! + const openSettings = () => { + closeModal() + window.openNestableModal({ + dimmed: true, + boxed: true, + innerBoxClass: "settings-view", + content: , + }) + } + const leaveRoom = () => { + if (!window.confirm(`Really leave ${room.meta.current.name}?`)) { + return + } + client.rpc.leaveRoom(room.roomID).catch(err => { + console.error("Failed to leave room", err) + window.alert(`Failed to leave room: ${err}`) + }) + closeModal() + } + return
+ + + + +
+} diff --git a/web/src/ui/menu/ShareModal.tsx b/web/src/ui/menu/ShareModal.tsx new file mode 100644 index 0000000..9e531cc --- /dev/null +++ b/web/src/ui/menu/ShareModal.tsx @@ -0,0 +1,65 @@ +import React, { use, useState } from "react" +import { MemDBEvent } from "@/api/types" +import { ModalCloseContext } from "@/ui/modal" +import TimelineEvent from "@/ui/timeline/TimelineEvent.tsx" +import Toggle from "@/ui/util/Toggle.tsx" + +interface ConfirmWithMessageProps { + evt: MemDBEvent + title: string + confirmButton: string + onConfirm: (useMatrixTo: boolean, includeEvent: boolean) => void + generateLink: (useMatrixTo: boolean, includeEvent: boolean) => string +} + +const ShareModal = ({ evt, title, confirmButton, onConfirm, generateLink }: ConfirmWithMessageProps) => { + const [useMatrixTo, setUseMatrixTo] = useState(false) + const [includeEvent, setIncludeEvent] = useState(true) + const closeModal = use(ModalCloseContext) + const onConfirmWrapped = (evt: React.FormEvent) => { + evt.preventDefault() + closeModal() + onConfirm(useMatrixTo, includeEvent) + } + + const link = generateLink(useMatrixTo, includeEvent) + return +

{title}

+
+ +
+ + + + + + + + + + + +
Use matrix.to link + setUseMatrixTo(evt.target.checked)} + /> +
Link to this specific event + setIncludeEvent(evt.target.checked)} + /> +
+
+ Preview: {link} +
+
+ + +
+ +} + +export default ShareModal diff --git a/web/src/ui/timeline/menu/index.css b/web/src/ui/menu/index.css similarity index 89% rename from web/src/ui/timeline/menu/index.css rename to web/src/ui/menu/index.css index a78c222..14b4727 100644 --- a/web/src/ui/timeline/menu/index.css +++ b/web/src/ui/menu/index.css @@ -43,7 +43,7 @@ div.event-fixed-menu { } } -div.event-context-menu { +div.context-menu { position: fixed; background-color: var(--background-color); border-radius: .5rem; @@ -80,6 +80,10 @@ div.event-context-menu { color: var(--error-color); } } + + &.event-context-menu, &.room-list-menu { + width: 10rem; + } } div.confirm-message-modal > form { @@ -101,6 +105,7 @@ div.confirm-message-modal > form { > div.timeline-event { margin: 0; + padding: 0; } } @@ -118,4 +123,14 @@ div.confirm-message-modal > form { padding: .5rem 1rem; } } + + > div.output-preview { + > span.no-select { + user-select: none; + } + + > code { + word-break: break-word; + } + } } diff --git a/web/src/ui/timeline/menu/index.ts b/web/src/ui/menu/index.ts similarity index 95% rename from web/src/ui/timeline/menu/index.ts rename to web/src/ui/menu/index.ts index 4f89140..07a73d0 100644 --- a/web/src/ui/timeline/menu/index.ts +++ b/web/src/ui/menu/index.ts @@ -14,4 +14,5 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . export { EventExtraMenu, EventFixedMenu, EventFullMenu, EventHoverMenu } from "./EventMenu.tsx" +export { RoomMenu } from "./RoomMenu.tsx" export { getModalStyleFromMouse } from "./util.ts" diff --git a/web/src/ui/timeline/menu/usePrimaryItems.tsx b/web/src/ui/menu/usePrimaryItems.tsx similarity index 95% rename from web/src/ui/timeline/menu/usePrimaryItems.tsx rename to web/src/ui/menu/usePrimaryItems.tsx index d1f374c..a9974e2 100644 --- a/web/src/ui/timeline/menu/usePrimaryItems.tsx +++ b/web/src/ui/menu/usePrimaryItems.tsx @@ -18,9 +18,9 @@ import Client from "@/api/client.ts" import { MemDBEvent } from "@/api/types" import { emojiToReactionContent } from "@/util/emoji" import { useEventAsState } from "@/util/eventdispatcher.ts" -import EmojiPicker from "../../emojipicker/EmojiPicker.tsx" -import { ModalCloseContext, ModalContext } from "../../modal" -import { RoomContextData } from "../../roomview/roomcontext.ts" +import EmojiPicker from "../emojipicker/EmojiPicker.tsx" +import { ModalCloseContext, ModalContext } from "../modal" +import { RoomContextData } from "../roomview/roomcontext.ts" import { EventExtraMenu } from "./EventMenu.tsx" import { getEncryption, getModalStyleFromButton, getPending, getPowerLevels } from "./util.ts" import EditIcon from "@/icons/edit.svg?react" @@ -79,7 +79,7 @@ export const usePrimaryItems = ( .catch(err => window.alert(`Failed to resend message: ${err}`)) } const onClickMore = (mevt: React.MouseEvent) => { - const moreMenuHeight = 4 * 40 + const moreMenuHeight = 5 * 40 setForceOpen!(true) openModal({ content: , + content: , }) } const onClickReport = () => { @@ -83,12 +86,67 @@ export const useSecondaryItems = ( , }) } + const onClickHideUnredacted = () => { + closeModal() + roomCtx.store.setViewingRedacted(evt, false) + } + const onClickUnredact = () => { + closeModal() + if (Object.entries(evt.content).length > 0) { + roomCtx.store.setViewingRedacted(evt, true) + } else { + client.requestEvent(roomCtx.store, evt.event_id, true) + } + } const onClickPin = (pin: boolean) => () => { closeModal() client.pinMessage(roomCtx.store, evt.event_id, pin) .catch(err => window.alert(`Failed to ${pin ? "pin" : "unpin"} message: ${err}`)) } + const onClickShareEvent = () => { + const generateLink = (useMatrixTo: boolean, includeEvent: boolean) => { + const isRoomIDLink = true + let generatedURL = useMatrixTo ? "https://matrix.to/#/" : "matrix:roomid/" + if (useMatrixTo) { + generatedURL += evt.room_id + } else { + generatedURL += `${evt.room_id.slice(1)}` + } + if (includeEvent) { + if (useMatrixTo) { + generatedURL += `/${evt.event_id}` + } else { + generatedURL += `/e/${evt.event_id.slice(1)}` + } + } + if (isRoomIDLink) { + generatedURL += "?" + new URLSearchParams( + roomCtx.store.getViaServers().map(server => ["via", server]), + ).toString() + } + return generatedURL + } + openModal({ + dimmed: true, + boxed: true, + innerBoxClass: "confirm-message-modal", + content: + { + navigator.clipboard.writeText(generateLink(useMatrixTo, includeEvent)).catch( + err => window.alert(`Failed to copy link: ${err}`), + ) + }} + generateLink={generateLink} + /> + , + }) + } + const [isPending, pendingTitle] = getPending(evt) useRoomState(roomCtx.store, "m.room.power_levels", "") // We get pins from getPinnedEvents, but use the hook anyway to subscribe to changes @@ -101,9 +159,12 @@ export const useSecondaryItems = ( const canRedact = !evt.redacted_by && ownPL >= redactEvtPL && (evt.sender === client.userID || ownPL >= redactOtherPL) + // TODO check server admin status and room PLs + const canUnredact = Boolean(evt.redacted_by) return <> + {ownPL >= pinPL && (pins.includes(evt.event_id) ? } + {canUnredact && (evt.viewing_redacted ? : )} } diff --git a/web/src/ui/timeline/menu/util.ts b/web/src/ui/menu/util.ts similarity index 94% rename from web/src/ui/timeline/menu/util.ts rename to web/src/ui/menu/util.ts index 1692a12..556d729 100644 --- a/web/src/ui/timeline/menu/util.ts +++ b/web/src/ui/menu/util.ts @@ -39,10 +39,10 @@ export const getEncryption = (room: RoomStateStore): boolean =>{ export function getModalStyleFromMouse( evt: React.MouseEvent, modalHeight: number, modalWidth = 10 * 16, ): CSSProperties { - const style: CSSProperties = { right: window.innerWidth - evt.clientX } - if (evt.clientX - modalWidth < 4) { - delete style.right - style.left = "4px" + const style: CSSProperties = { left: evt.clientX } + if (evt.clientX + modalWidth > window.innerWidth) { + delete style.left + style.right = "4px" } if (evt.clientY + modalHeight > window.innerHeight) { style.bottom = window.innerHeight - evt.clientY diff --git a/web/src/ui/modal/Lightbox.css b/web/src/ui/modal/Lightbox.css index 9d65ab7..b629b60 100644 --- a/web/src/ui/modal/Lightbox.css +++ b/web/src/ui/modal/Lightbox.css @@ -19,6 +19,16 @@ div.overlay { overflow: hidden; display: flex; + &.full-screen-mobile { + @media screen and (max-width: 30rem) { + max-width: 100%; + max-height: 100%; + width: 100%; + height: 100%; + border-radius: 0; + } + } + > div.modal-box-inner { overflow: scroll; } diff --git a/web/src/ui/modal/Lightbox.tsx b/web/src/ui/modal/Lightbox.tsx index 42bd070..abf4dd2 100644 --- a/web/src/ui/modal/Lightbox.tsx +++ b/web/src/ui/modal/Lightbox.tsx @@ -36,7 +36,7 @@ const LightboxWrapper = ({ children }: { children: React.ReactNode }) => { return } params = { - src: target.src, + src: target.getAttribute("data-full-src") ?? target.src, alt: target.alt, } setParams(params) @@ -75,6 +75,11 @@ export interface LightboxProps extends LightboxParams { onClose: () => void } +interface Point { + x: number + y: number +} + export class Lightbox extends Component { translate = { x: 0, y: 0 } zoom = 1 @@ -82,6 +87,9 @@ export class Lightbox extends Component { maybePanning = false readonly ref = createRef() readonly wrapperRef = createRef() + prevTouch1: Point | null = null + prevTouch2: Point | null = null + prevTouchDist: number | null = null get style() { return { @@ -91,6 +99,14 @@ export class Lightbox extends Component { } } + get orientation(): number { + let rot = (this.rotate / 90) % 4 + if (rot < 0) { + rot += 4 + } + return rot + } + close = () => { this.translate = { x: 0, y: 0 } this.rotate = 0 @@ -115,18 +131,55 @@ export class Lightbox extends Component { return } evt.preventDefault() - const oldZoom = this.zoom - const delta = -evt.deltaY / 1000 - const newDelta = this.zoom + delta * this.zoom - this.zoom = Math.min(Math.max(newDelta, 0.01), 10) - const zoomDelta = this.zoom - oldZoom - this.translate.x += zoomDelta * (this.ref.current.clientWidth / 2 - evt.nativeEvent.offsetX) - this.translate.y += zoomDelta * (this.ref.current.clientHeight / 2 - evt.nativeEvent.offsetY) + this.#doZoom(-evt.deltaY / 1000, evt.nativeEvent.offsetX, evt.nativeEvent.offsetY, false) const style = this.style this.ref.current.style.translate = style.translate this.ref.current.style.scale = style.scale } + #getTouchDistance(p1: Point, p2: Point): number { + return Math.hypot(p1.x - p2.x, p1.y - p2.y) + } + + #getTouchMidpoint(p1: Point, p2: Point): Point { + const contentRect = this.ref.current!.getBoundingClientRect() + const p1X = p1.x - contentRect.left + const p1Y = p1.y - contentRect.top + const p2X = p2.x - contentRect.left + const p2Y = p2.y - contentRect.top + const point = { + x: (p1X + p2X) / 2 / this.zoom, + y: (p1Y + p2Y) / 2 / this.zoom, + } + const orientation = this.orientation + if (orientation === 1 || orientation === 3) { + // This is slightly weird because doZoom will flip the x and y values again, + // but maybe the flipped subtraction from clientWidth/Height is important. + return { x: point.y, y: point.x } + } + return point + } + + #doZoom(delta: number, offsetX: number, offsetY: number, touch: boolean) { + if (!this.ref.current) { + return + } + const oldZoom = this.zoom + const newDelta = oldZoom + delta * this.zoom + this.zoom = Math.min(Math.max(newDelta, 0.01), 10) + const zoomDelta = this.zoom - oldZoom + + const orientation = this.orientation + const negateX = !touch && (orientation === 2 || orientation == 3) ? -1 : 1 + const negateY = !touch && (orientation === 2 || orientation == 1) ? -1 : 1 + const flipXY = orientation === 1 || orientation === 3 + + const deltaX = zoomDelta * (this.ref.current.clientWidth / 2 - offsetX) * negateX + const deltaY = zoomDelta * (this.ref.current.clientHeight / 2 - offsetY) * negateY + this.translate.x += flipXY ? deltaY : deltaX + this.translate.y += flipXY ? deltaX : deltaY + } + onMouseDown = (evt: React.MouseEvent) => { if (evt.buttons === 1) { evt.preventDefault() @@ -150,6 +203,57 @@ export class Lightbox extends Component { this.ref.current.style.cursor = "grabbing" } + onTouchStart = (evt: React.TouchEvent) => { + if (evt.touches.length === 1) { + this.maybePanning = true + this.prevTouch1 = { x: evt.touches[0].pageX, y: evt.touches[0].pageY } + this.prevTouch2 = null + } else if (evt.touches.length === 2) { + this.prevTouch1 = { x: evt.touches[0].pageX, y: evt.touches[0].pageY } + this.prevTouch2 = { x: evt.touches[1].pageX, y: evt.touches[1].pageY } + this.prevTouchDist = this.#getTouchDistance(this.prevTouch1, this.prevTouch2) + } else { + return + } + evt.preventDefault() + evt.stopPropagation() + } + + onTouchEnd = () => { + this.prevTouch1 = null + this.prevTouch2 = null + this.prevTouchDist = null + } + + onTouchMove = (evt: React.TouchEvent) => { + if (!this.ref.current) { + return + } + if (evt.touches.length > 0 && this.prevTouch1) { + this.translate.x += evt.touches[0].pageX - this.prevTouch1.x + this.translate.y += evt.touches[0].pageY - this.prevTouch1.y + this.prevTouch1 = { x: evt.touches[0].pageX, y: evt.touches[0].pageY } + if (evt.touches.length === 1) { + this.ref.current.style.translate = this.style.translate + this.ref.current.style.cursor = "grabbing" + } + } + if (evt.touches.length > 1 && this.prevTouch1 && this.prevTouch2 && this.prevTouchDist) { + this.prevTouch2 = { x: evt.touches[1].pageX, y: evt.touches[1].pageY } + const newDist = this.#getTouchDistance(this.prevTouch1, this.prevTouch2) + const midpoint = this.#getTouchMidpoint( + { x: evt.touches[0].clientX, y: evt.touches[0].clientY }, + { x: evt.touches[1].clientX, y: evt.touches[1].clientY }, + ) + this.#doZoom((newDist - this.prevTouchDist) / 100, midpoint.x, midpoint.y, true) + this.prevTouchDist = newDist + const style = this.style + this.ref.current.style.translate = style.translate + this.ref.current.style.scale = style.scale + } + evt.preventDefault() + } + onKeyDown = (evt: React.KeyboardEvent) => { const key = keyToString(evt) if (key === "Escape") { @@ -189,6 +293,10 @@ export class Lightbox extends Component { className="overlay dimmed lightbox" onClick={this.onClick} onMouseMove={isTouchDevice ? undefined : this.onMouseMove} + onTouchStart={isTouchDevice ? this.onTouchStart : undefined} + onTouchMove={isTouchDevice ? this.onTouchMove : undefined} + onTouchEnd={isTouchDevice ? this.onTouchEnd : undefined} + onTouchCancel={isTouchDevice ? this.onTouchEnd : undefined} tabIndex={-1} onKeyDown={this.onKeyDown} ref={this.wrapperRef} diff --git a/web/src/ui/modal/Modal.tsx b/web/src/ui/modal/Modal.tsx index 4d0baf9..1188cd1 100644 --- a/web/src/ui/modal/Modal.tsx +++ b/web/src/ui/modal/Modal.tsx @@ -13,10 +13,17 @@ // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . -import React, { JSX, useCallback, useEffect, useLayoutEffect, useReducer, useRef } from "react" -import { ModalCloseContext, ModalContext, ModalState } from "./contexts.ts" +import React, { Context, JSX, useCallback, useEffect, useLayoutEffect, useReducer, useRef } from "react" +import ErrorBoundary from "../util/ErrorBoundary.tsx" +import { ModalCloseContext, ModalState, openModal } from "./contexts.ts" -const ModalWrapper = ({ children }: { children: React.ReactNode }) => { +interface ModalWrapperProps { + children: React.ReactNode + ContextType: Context + historyStateKey: string +} + +const ModalWrapper = ({ children, ContextType, historyStateKey }: ModalWrapperProps) => { const [state, setState] = useReducer((prevState: ModalState | null, newState: ModalState | null) => { prevState?.onClose?.() return newState @@ -25,26 +32,27 @@ const ModalWrapper = ({ children }: { children: React.ReactNode }) => { if (evt && evt.target !== evt.currentTarget) { return } + evt?.stopPropagation() setState(null) - if (history.state?.modal) { + if (history.state?.[historyStateKey]) { history.back() } - }, []) + }, [historyStateKey]) const onKeyWrapper = (evt: React.KeyboardEvent) => { if (evt.key === "Escape") { setState(null) - if (history.state?.modal) { + if (history.state?.[historyStateKey]) { history.back() } } evt.stopPropagation() } const openModal = useCallback((newState: ModalState) => { - if (!history.state?.modal && newState.captureInput !== false) { - history.pushState({ ...(history.state ?? {}), modal: true }, "") + if (!history.state?.[historyStateKey] && newState.captureInput !== false) { + history.pushState({ ...(history.state ?? {}), [historyStateKey]: true }, "") } setState(newState) - }, []) + }, [historyStateKey]) const wrapperRef = useRef(null) useLayoutEffect(() => { if (wrapperRef.current && (!document.activeElement || !wrapperRef.current.contains(document.activeElement))) { @@ -54,16 +62,20 @@ const ModalWrapper = ({ children }: { children: React.ReactNode }) => { useEffect(() => { window.closeModal = onClickWrapper const listener = (evt: PopStateEvent) => { - if (!evt.state?.modal) { + if (!evt.state?.[historyStateKey]) { setState(null) } } window.addEventListener("popstate", listener) return () => window.removeEventListener("popstate", listener) - }, [onClickWrapper]) + }, [historyStateKey, onClickWrapper]) let modal: JSX.Element | null = null if (state) { - let content = {state.content} + let content = + + {state.content} + + if (state.boxed) { content =
@@ -85,10 +97,13 @@ const ModalWrapper = ({ children }: { children: React.ReactNode }) => { modal = content } } - return + if (historyStateKey === "nestable_modal") { + window.openNestableModal = openModal + } + return {children} {modal} - + } export default ModalWrapper diff --git a/web/src/ui/modal/contexts.ts b/web/src/ui/modal/contexts.ts index dad5963..083a039 100644 --- a/web/src/ui/modal/contexts.ts +++ b/web/src/ui/modal/contexts.ts @@ -35,9 +35,12 @@ export interface ModalState { captureInput?: boolean } -type openModal = (state: ModalState) => void +export type openModal = (state: ModalState) => void export const ModalContext = createContext(() => console.error("Tried to open modal without being inside context")) +export const NestableModalContext = createContext(() => + console.error("Tried to open nestable modal without being inside context")) + export const ModalCloseContext = createContext<() => void>(() => {}) diff --git a/web/src/ui/rightpanel/MemberList.tsx b/web/src/ui/rightpanel/MemberList.tsx index a88853e..2c7ed26 100644 --- a/web/src/ui/rightpanel/MemberList.tsx +++ b/web/src/ui/rightpanel/MemberList.tsx @@ -14,7 +14,7 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . import React, { use, useState } from "react" -import { getAvatarURL } from "@/api/media.ts" +import { getAvatarThumbnailURL } from "@/api/media.ts" import { MemDBEvent, MemberEventContent } from "@/api/types" import { getDisplayname } from "@/util/validation.ts" import ClientContext from "../ClientContext.ts" @@ -33,7 +33,7 @@ const MemberRow = ({ evt, onClick }: MemberRowProps) => { return
@@ -50,7 +50,7 @@ const MemberList = () => { roomCtx.store.membersRequested = true use(ClientContext)?.loadRoomState(roomCtx.store.roomID, { omitMembers: false, refetch: false }) } - const memberEvents = useFilteredMembers(roomCtx?.store, filter) + const memberEvents = useFilteredMembers(roomCtx?.store, filter, false, false) if (!roomCtx) { return null } diff --git a/web/src/ui/rightpanel/RightPanel.css b/web/src/ui/rightpanel/RightPanel.css index 50a3c44..065bc06 100644 --- a/web/src/ui/rightpanel/RightPanel.css +++ b/web/src/ui/rightpanel/RightPanel.css @@ -51,6 +51,22 @@ div.right-panel-content.pinned-messages { } } +div.right-panel-content.widgets { + display: flex; + flex-direction: column; + gap: .5rem; + padding: .5rem; + + > button { + padding: .5rem; + width: 100%; + } + + > div.separator { + flex: 1; + } +} + div.right-panel-content.user { display: flex; flex-direction: column; @@ -91,6 +107,12 @@ div.right-panel-content.user { word-break: break-word; } + div.userid, div.extended-profile, div.devices, div.user-moderation, div.mutual-rooms, div.errors { + border-bottom: 1px solid var(--border-color); + padding-bottom: .5rem; + margin-bottom: .5rem; + } + div.extended-profile { display: grid; gap: 0.25rem; @@ -192,6 +214,25 @@ div.right-panel-content.user { } } + div.user-moderation { + display: flex; + flex-direction: column; + + button.moderation-action { + padding: .5rem; + width: 100%; + gap: .5rem; + justify-content: left; + + &.dangerous { + color: var(--error-color); + } + &.positive { + color: var(--primary-color); + } + } + } + div.errors { display: flex; flex-direction: column; diff --git a/web/src/ui/rightpanel/RightPanel.tsx b/web/src/ui/rightpanel/RightPanel.tsx index 86ce5d4..79f0029 100644 --- a/web/src/ui/rightpanel/RightPanel.tsx +++ b/web/src/ui/rightpanel/RightPanel.tsx @@ -13,20 +13,30 @@ // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . +import type { IWidget } from "matrix-widget-api" import { JSX, use } from "react" import type { UserID } from "@/api/types" import MainScreenContext from "../MainScreenContext.ts" +import ErrorBoundary from "../util/ErrorBoundary.tsx" +import ElementCall from "../widget/ElementCall.tsx" +import LazyWidget from "../widget/LazyWidget.tsx" import MemberList from "./MemberList.tsx" import PinnedMessages from "./PinnedMessages.tsx" import UserInfo from "./UserInfo.tsx" +import WidgetList from "./WidgetList.tsx" import BackIcon from "@/icons/back.svg?react" import CloseIcon from "@/icons/close.svg?react" import "./RightPanel.css" -export type RightPanelType = "pinned-messages" | "members" | "user" +export type RightPanelType = "pinned-messages" | "members" | "widgets" | "widget" | "user" | "element-call" interface RightPanelSimpleProps { - type: "pinned-messages" | "members" + type: "pinned-messages" | "members" | "widgets" | "element-call" +} + +interface RightPanelWidgetProps { + type: "widget" + info: IWidget } interface RightPanelUserProps { @@ -34,14 +44,20 @@ interface RightPanelUserProps { userID: UserID } -export type RightPanelProps = RightPanelUserProps | RightPanelSimpleProps +export type RightPanelProps = RightPanelUserProps | RightPanelWidgetProps | RightPanelSimpleProps -function getTitle(type: RightPanelType): string { - switch (type) { +function getTitle(props: RightPanelProps): string { + switch (props.type) { case "pinned-messages": return "Pinned Messages" case "members": return "Room Members" + case "widgets": + return "Widgets in room" + case "widget": + return props.info.name || "Widget" + case "element-call": + return "Element Call" case "user": return "User Info" } @@ -53,6 +69,12 @@ function renderRightPanelContent(props: RightPanelProps): JSX.Element | null { return case "members": return + case "widgets": + return + case "element-call": + return + case "widget": + return case "user": return } @@ -66,17 +88,24 @@ const RightPanel = (props: RightPanelProps) => { data-target-panel="members" onClick={mainScreen.clickRightPanelOpener} > + } else if (props.type === "element-call" || props.type === "widget") { + backButton = } return
{backButton} -
{getTitle(props.type)}
+
{getTitle(props)}
- {renderRightPanelContent(props)} + + {renderRightPanelContent(props)} +
} diff --git a/web/src/ui/rightpanel/StartDMButton.tsx b/web/src/ui/rightpanel/StartDMButton.tsx new file mode 100644 index 0000000..b00a415 --- /dev/null +++ b/web/src/ui/rightpanel/StartDMButton.tsx @@ -0,0 +1,102 @@ +// gomuks - A Matrix client written in Go. +// Copyright (C) 2025 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 . +import { use, useMemo, useState } from "react" +import Client from "@/api/client.ts" +import { UserID } from "@/api/types" +import MainScreenContext from "../MainScreenContext.ts" +import ChatIcon from "@/icons/chat.svg?react" + +const StartDMButton = ({ userID, client }: { userID: UserID; client: Client }) => { + const mainScreen = use(MainScreenContext)! + const [isCreating, setIsCreating] = useState(false) + + const findExistingRoom = () => { + for (const room of client.store.rooms.values()) { + if (room.meta.current.dm_user_id === userID) { + return room.roomID + } + } + } + const existingRoom = useMemo(findExistingRoom, [userID, client]) + + const startDM = async () => { + if (existingRoom) { + mainScreen.setActiveRoom(existingRoom) + return + } + if (!window.confirm(`Are you sure you want to start a chat with ${userID}?`)) { + return + } + const existingRoomRelookup = findExistingRoom() + if (existingRoomRelookup) { + mainScreen.setActiveRoom(existingRoomRelookup) + return + } + + try { + setIsCreating(true) + + let shouldEncrypt = false + const initialState = [] + + try { + shouldEncrypt = (await client.rpc.trackUserDevices(userID)).devices.length > 0 + + if (shouldEncrypt) { + console.log("User has encryption devices, creating encrypted room") + initialState.push({ + type: "m.room.encryption", + content: { + algorithm: "m.megolm.v1.aes-sha2", + }, + }) + } + } catch (err) { + console.warn("Failed to check user encryption status:", err) + } + + // Create the room with encryption if needed + const response = await client.rpc.createRoom({ + is_direct: true, + preset: "trusted_private_chat", + invite: [userID], + initial_state: initialState, + }) + console.log("Created DM room:", response.room_id) + + // FIXME this is a hacky way to work around the room taking time to come down /sync + setTimeout(() => { + mainScreen.setActiveRoom(response.room_id) + }, 1000) + } catch (err) { + console.error("Failed to create DM room:", err) + window.alert(`Failed to create DM room: ${err}`) + } finally { + setIsCreating(false) + } + } + + return +} + +export default StartDMButton diff --git a/web/src/ui/rightpanel/UserExtendedProfile.tsx b/web/src/ui/rightpanel/UserExtendedProfile.tsx index e745f53..529f751 100644 --- a/web/src/ui/rightpanel/UserExtendedProfile.tsx +++ b/web/src/ui/rightpanel/UserExtendedProfile.tsx @@ -4,7 +4,7 @@ import { PronounSet, UserProfile } from "@/api/types" import { ensureArray, ensureString } from "@/util/validation.ts" interface ExtendedProfileProps { - profile: UserProfile + profile: UserProfile | null refreshProfile: () => void client: Client userID: string @@ -27,14 +27,19 @@ const currentTimeAdjusted = (tz: string) => { timeZoneName: "short", timeZone: tz, }).format(new Date()) - } catch (e) { - return `${e}` + } catch { + return null } } const ClockElement = ({ tz }: { tz: string }) => { - const [time, setTime] = useState(currentTimeAdjusted(tz)) + const cta = currentTimeAdjusted(tz) + const isValidTZ = cta !== null + const [time, setTime] = useState(cta) useEffect(() => { + if (!isValidTZ) { + return + } let interval: number | undefined const updateTime = () => setTime(currentTimeAdjusted(tz)) const timeout = setTimeout(() => { @@ -42,8 +47,11 @@ const ClockElement = ({ tz }: { tz: string }) => { updateTime() }, (1001 - Date.now() % 1000)) return () => interval ? clearInterval(interval) : clearTimeout(timeout) - }, [tz]) + }, [tz, isValidTZ]) + if (!isValidTZ) { + return null + } return <>
Time:
{time}
@@ -97,18 +105,15 @@ const UserExtendedProfile = ({ profile, refreshProfile, client, userID }: Extend const pronouns = ensureArray(profile["io.fsky.nyx.pronouns"]) as PronounSet[] const userTimeZone = ensureString(profile["us.cloke.msc4175.tz"]) - return <> -
-
- {userTimeZone && } - {userID === client.userID && - } - {pronouns.length > 0 && <> -
Pronouns:
-
{pronouns.map(pronounSet => ensureString(pronounSet.summary)).join(", ")}
- } -
- + return
+ {userTimeZone && } + {userID === client.userID && + } + {pronouns.length > 0 && <> +
Pronouns:
+
{pronouns.map(pronounSet => ensureString(pronounSet.summary)).join(", ")}
+ } +
} export default UserExtendedProfile diff --git a/web/src/ui/rightpanel/UserIgnoreButton.tsx b/web/src/ui/rightpanel/UserIgnoreButton.tsx new file mode 100644 index 0000000..965fcfb --- /dev/null +++ b/web/src/ui/rightpanel/UserIgnoreButton.tsx @@ -0,0 +1,55 @@ +// gomuks - A Matrix client written in Go. +// Copyright (C) 2025 Nexus Nicholson +// +// 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 . +import Client from "@/api/client.ts" +import { useAccountData } from "@/api/statestore" +import { IgnoredUsersEventContent } from "@/api/types" +import IgnoreIcon from "@/icons/block.svg?react" + +const UserIgnoreButton = ({ userID, client }: { userID: string; client: Client }) => { + const ignoredUsers = useAccountData(client.store, "m.ignored_user_list") as IgnoredUsersEventContent | null + + const isIgnored = Boolean(ignoredUsers?.ignored_users?.[userID]) + const ignoreUser = () => { + if (!window.confirm(`Are you sure you want to ignore ${userID}?`)) { + return + } + const newIgnoredUsers = { ...(ignoredUsers || { ignored_users: {}}) } + newIgnoredUsers.ignored_users[userID] = {} + client.rpc.setAccountData("m.ignored_user_list", newIgnoredUsers).catch(err => { + console.error("Failed to ignore user", err) + window.alert(`Failed to ignore ${userID}: ${err}`) + }) + } + const unignoreUser = () => { + const newIgnoredUsers = { ...(ignoredUsers || { ignored_users: {}}) } + delete newIgnoredUsers.ignored_users[userID] + client.rpc.setAccountData("m.ignored_user_list", newIgnoredUsers).catch(err => { + console.error("Failed to unignore user", err) + window.alert(`Failed to unignore ${userID}: ${err}`) + }) + } + + return ( + + ) +} + +export default UserIgnoreButton diff --git a/web/src/ui/rightpanel/UserInfo.tsx b/web/src/ui/rightpanel/UserInfo.tsx index 0181904..0b7cc37 100644 --- a/web/src/ui/rightpanel/UserInfo.tsx +++ b/web/src/ui/rightpanel/UserInfo.tsx @@ -18,7 +18,7 @@ import { PuffLoader } from "react-spinners" import { getAvatarURL } from "@/api/media.ts" import { useRoomMember } from "@/api/statestore" import { MemberEventContent, UserID, UserProfile } from "@/api/types" -import { getLocalpart } from "@/util/validation.ts" +import { ensureString, getLocalpart } from "@/util/validation.ts" import ClientContext from "../ClientContext.ts" import { LightboxContext } from "../modal" import { RoomContext } from "../roomview/roomcontext.ts" @@ -26,6 +26,7 @@ import UserExtendedProfile from "./UserExtendedProfile.tsx" import DeviceList from "./UserInfoDeviceList.tsx" import UserInfoError from "./UserInfoError.tsx" import MutualRooms from "./UserInfoMutualRooms.tsx" +import UserModeration from "./UserModeration.tsx" interface UserInfoProps { userID: UserID @@ -50,8 +51,9 @@ const UserInfo = ({ userID }: UserInfoProps) => { ) }, [userID, client]) useEffect(() => refreshProfile(true), [refreshProfile]) - - const displayname = member?.displayname || globalProfile?.displayname || getLocalpart(userID) + const displayname = ensureString(member?.displayname) + || ensureString(globalProfile?.displayname) + || getLocalpart(userID) return <>
{member === null && globalProfile === null && errors == null ? { className="avatar-loader" /> : {
{displayname}
{userID}
- {globalProfile && } -
+ + {userID !== client.userID && <> -
+ } - -
- {errors?.length ? <> - -
- : null} + } diff --git a/web/src/ui/rightpanel/UserModeration.tsx b/web/src/ui/rightpanel/UserModeration.tsx new file mode 100644 index 0000000..3f2d586 --- /dev/null +++ b/web/src/ui/rightpanel/UserModeration.tsx @@ -0,0 +1,118 @@ +// gomuks - A Matrix client written in Go. +// Copyright (C) 2025 Nexus Nicholson +// +// 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 . +import { use } from "react" +import Client from "@/api/client.ts" +import { RoomStateStore } from "@/api/statestore" +import { MemDBEvent, MembershipAction } from "@/api/types" +import ConfirmWithMessageModal from "../menu/ConfirmWithMessageModal.tsx" +import { getPowerLevels } from "../menu/util.ts" +import { ModalContext } from "../modal" +import StartDMButton from "./StartDMButton.tsx" +import UserIgnoreButton from "./UserIgnoreButton.tsx" +import BanIcon from "@/icons/gavel.svg?react" +import InviteIcon from "@/icons/person-add.svg?react" +import KickIcon from "@/icons/person-remove.svg?react" + +interface UserModerationProps { + userID: string; + client: Client; + room: RoomStateStore | undefined; + member: MemDBEvent | null; +} + +const UserModeration = ({ userID, client, member, room }: UserModerationProps) => { + const openModal = use(ModalContext) + const hasPL = (action: "invite" | "kick" | "ban") => { + if (!room) { + throw new Error("hasPL called without room") + } + const [pls, ownPL] = getPowerLevels(room, client) + if(action === "invite") { + return ownPL >= (pls.invite ?? 0) + } + const otherUserPL = pls.users?.[userID] ?? pls.users_default ?? 0 + return ownPL >= (pls[action] ?? 50) && ownPL > otherUserPL + } + + const runAction = (action: MembershipAction) => { + if (!room) { + throw new Error("runAction called without room") + } + const callback = (reason: string) => { + client.rpc.setMembership(room.roomID, userID, action, reason).then( + () => console.debug("Actioned", userID), + err => { + console.error("Failed to action", err) + window.alert(`Failed to ${action} ${userID}: ${err}`) + }, + ) + } + const titleCasedAction = action.charAt(0).toUpperCase() + action.slice(1) + return () => { + openModal({ + dimmed: true, + boxed: true, + innerBoxClass: "confirm-message-modal", + content: Are you sure you want to {action} {userID}?} + placeholder="Reason (optional)" + confirmButton={titleCasedAction} + onConfirm={callback} + />, + }) + } + } + const membership = member?.content.membership || "leave" + + return
+

Actions

+ {!room || room.meta.current.dm_user_id !== userID ? : null} + {room && (["knock", "leave"].includes(membership) || !member) && hasPL("invite") && ( + + )} + {room && ["knock", "invite", "join"].includes(membership) && hasPL("kick") && ( + + )} + {room && membership !== "ban" && hasPL("ban") && ( + + )} + {room && membership === "ban" && hasPL("ban") && ( + + )} + +
+} + +export default UserModeration diff --git a/web/src/ui/rightpanel/WidgetList.tsx b/web/src/ui/rightpanel/WidgetList.tsx new file mode 100644 index 0000000..7d6a861 --- /dev/null +++ b/web/src/ui/rightpanel/WidgetList.tsx @@ -0,0 +1,55 @@ +// gomuks - A Matrix client written in Go. +// Copyright (C) 2025 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 . +import type { IWidget } from "matrix-widget-api" +import { use } from "react" +import MainScreenContext from "../MainScreenContext.ts" +import { RoomContext } from "../roomview/roomcontext.ts" + +const WidgetList = () => { + const roomCtx = use(RoomContext) + const mainScreen = use(MainScreenContext) + const widgets = roomCtx?.store.state.get("im.vector.modular.widgets") ?? new Map() + const widgetElements = [] + for (const [stateKey, rowid] of widgets.entries()) { + const evt = roomCtx?.store.eventsByRowID.get(rowid) + if (!evt || !evt.content.url) { + continue + } + const onClick = () => mainScreen.setRightPanel({ + type: "widget", + info: { + id: stateKey, + creatorUserId: evt.sender, + ...evt.content, + } as IWidget, + }) + widgetElements.push() + } + + const openElementCall = () => { + mainScreen.setRightPanel({ type: "element-call" }) + } + + return <> + {widgetElements} +
+ + +} + +export default WidgetList diff --git a/web/src/ui/roomlist/Entry.tsx b/web/src/ui/roomlist/Entry.tsx index 901d64f..020517b 100644 --- a/web/src/ui/roomlist/Entry.tsx +++ b/web/src/ui/roomlist/Entry.tsx @@ -13,14 +13,16 @@ // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . -import { JSX, memo, use } from "react" -import { getRoomAvatarURL } from "@/api/media.ts" +import React, { JSX, memo, use } from "react" +import { getRoomAvatarThumbnailURL } from "@/api/media.ts" import type { RoomListEntry } from "@/api/statestore" import type { MemDBEvent, MemberEventContent } from "@/api/types" import useContentVisibility from "@/util/contentvisibility.ts" import { getDisplayname } from "@/util/validation.ts" import ClientContext from "../ClientContext.ts" import MainScreenContext from "../MainScreenContext.ts" +import { RoomMenu, getModalStyleFromMouse } from "../menu" +import { ModalContext } from "../modal" import UnreadCount from "./UnreadCount.tsx" export interface RoomListEntryProps { @@ -63,7 +65,7 @@ function renderEntry(room: RoomListEntry) {
@@ -77,10 +79,30 @@ function renderEntry(room: RoomListEntry) { const Entry = ({ room, isActive, hidden }: RoomListEntryProps) => { const [isVisible, divRef] = useContentVisibility() + const openModal = use(ModalContext) + const mainScreen = use(MainScreenContext) + const client = use(ClientContext)! + const onContextMenu = (evt: React.MouseEvent) => { + const realRoom = client.store.rooms.get(room.room_id) + if (!realRoom) { + // TODO implement separate menu for invite rooms + console.error("Room state store not found for", room.room_id) + return + } + openModal({ + content: , + }) + evt.preventDefault() + } return
{isVisible ? renderEntry(room) : null} diff --git a/web/src/ui/roomlist/Space.tsx b/web/src/ui/roomlist/Space.tsx index daeb35c..6cdea09 100644 --- a/web/src/ui/roomlist/Space.tsx +++ b/web/src/ui/roomlist/Space.tsx @@ -15,7 +15,7 @@ // along with this program. If not, see . import React from "react" import Client from "@/api/client.ts" -import { getRoomAvatarURL } from "@/api/media.ts" +import { getRoomAvatarThumbnailURL } from "@/api/media.ts" import type { RoomID } from "@/api/types" import { useEventAsState } from "@/util/eventdispatcher.ts" import UnreadCount from "./UnreadCount.tsx" @@ -37,7 +37,7 @@ const Space = ({ roomID, client, onClick, isActive, onClickUnread }: SpaceProps) } return
- {room.name} + {room.name}
} diff --git a/web/src/ui/roomview/RoomPreview.tsx b/web/src/ui/roomview/RoomPreview.tsx index dab8003..fd6700d 100644 --- a/web/src/ui/roomview/RoomPreview.tsx +++ b/web/src/ui/roomview/RoomPreview.tsx @@ -15,7 +15,7 @@ // along with this program. If not, see . import { use, useEffect, useState } from "react" import { ScaleLoader } from "react-spinners" -import { getAvatarURL, getRoomAvatarURL } from "@/api/media.ts" +import { getAvatarThumbnailURL, getAvatarURL, getRoomAvatarURL } from "@/api/media.ts" import { InvitedRoomStore } from "@/api/statestore/invitedroom.ts" import { RoomID, RoomSummary } from "@/api/types" import { getDisplayname, getServerName } from "@/util/validation.ts" @@ -90,7 +90,8 @@ const RoomPreview = ({ roomID, via, alias, invite }: RoomPreviewProps) => { @@ -100,6 +101,7 @@ const RoomPreview = ({ roomID, via, alias, invite }: RoomPreviewProps) => {
: null}

{name}

div.room-view-error { + display: flex; + justify-content: center; + align-items: center; + height: 100%; + } } div#mobile-event-menu-container { diff --git a/web/src/ui/roomview/RoomView.tsx b/web/src/ui/roomview/RoomView.tsx index a646395..d0cd8c6 100644 --- a/web/src/ui/roomview/RoomView.tsx +++ b/web/src/ui/roomview/RoomView.tsx @@ -19,6 +19,7 @@ import MessageComposer from "../composer/MessageComposer.tsx" import TypingNotifications from "../composer/TypingNotifications.tsx" import RightPanel, { RightPanelProps } from "../rightpanel/RightPanel.tsx" import TimelineView from "../timeline/TimelineView.tsx" +import ErrorBoundary from "../util/ErrorBoundary.tsx" import RoomViewHeader from "./RoomViewHeader.tsx" import { RoomContext, RoomContextData } from "./roomcontext.ts" import "./RoomView.css" @@ -49,11 +50,13 @@ const RoomView = ({ room, rightPanelResizeHandle, rightPanel }: RoomViewProps) = } return
-
- - - - + +
+ + + + +
{rightPanelResizeHandle} {rightPanel && } diff --git a/web/src/ui/roomview/RoomViewHeader.tsx b/web/src/ui/roomview/RoomViewHeader.tsx index 8194cf8..7f1948e 100644 --- a/web/src/ui/roomview/RoomViewHeader.tsx +++ b/web/src/ui/roomview/RoomViewHeader.tsx @@ -14,17 +14,19 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . import { use } from "react" -import { getRoomAvatarURL } from "@/api/media.ts" +import { getRoomAvatarThumbnailURL, getRoomAvatarURL } from "@/api/media.ts" import { RoomStateStore } from "@/api/statestore" import { useEventAsState } from "@/util/eventdispatcher.ts" import MainScreenContext from "../MainScreenContext.ts" -import { LightboxContext } from "../modal" -import { ModalContext } from "../modal" +import { LightboxContext, NestableModalContext } from "../modal" +import RoomStateExplorer from "../settings/RoomStateExplorer.tsx" import SettingsView from "../settings/SettingsView.tsx" import BackIcon from "@/icons/back.svg?react" +import CodeIcon from "@/icons/code.svg?react" import PeopleIcon from "@/icons/group.svg?react" import PinIcon from "@/icons/pin.svg?react" import SettingsIcon from "@/icons/settings.svg?react" +import WidgetIcon from "@/icons/widgets.svg?react" import "./RoomViewHeader.css" interface RoomViewHeaderProps { @@ -34,7 +36,7 @@ interface RoomViewHeaderProps { const RoomViewHeader = ({ room }: RoomViewHeaderProps) => { const roomMeta = useEventAsState(room.meta) const mainScreen = use(MainScreenContext) - const openModal = use(ModalContext) + const openModal = use(NestableModalContext) const openSettings = () => { openModal({ dimmed: true, @@ -43,12 +45,21 @@ const RoomViewHeader = ({ room }: RoomViewHeaderProps) => { content: , }) } + const openRoomStateExplorer = () => { + openModal({ + dimmed: true, + boxed: true, + innerBoxClass: "room-state-explorer-box", + content: , + }) + } return
@@ -71,6 +82,12 @@ const RoomViewHeader = ({ room }: RoomViewHeaderProps) => { onClick={mainScreen.clickRightPanelOpener} title="Room Members" > + +
diff --git a/web/src/ui/settings/RoomStateExplorer.css b/web/src/ui/settings/RoomStateExplorer.css new file mode 100644 index 0000000..02a67cd --- /dev/null +++ b/web/src/ui/settings/RoomStateExplorer.css @@ -0,0 +1,90 @@ +div.state-explorer-box { + overflow: hidden !important; +} + +div.state-explorer { + width: min(50rem, 80vw); + max-height: 100%; + display: flex; + flex-direction: column; + + h3 { + margin: 0 0 1rem 0; + } + + div.state-button-list { + display: flex; + flex-wrap: wrap; + gap: .5rem; + overflow: auto; + + > button { + padding: .5rem; + border: 1px solid var(--border-color); + border-radius: 0.5rem; + } + } + + > div.nav-buttons { + display: flex; + flex-wrap: wrap; + gap: .5rem; + margin-top: .5rem; + + > div.spacer { + flex: 1; + } + + > label { + display: flex; + align-items: center; + } + + > button { + padding: .5rem 1rem; + border: 1px solid var(--border-color); + border-radius: .5rem; + } + } + + &.state-event-view { + > div.state-event-content { + flex: 1; + overflow: auto; + + > textarea { + width: 100%; + padding: .5rem; + box-sizing: border-box; + resize: vertical; + border: 1px solid var(--border-color); + outline: none; + border-radius: .5rem; + + &:focus { + border: 1px solid var(--primary-color); + } + } + } + + > div.state-header > div.new-event-type { + display: flex; + gap: .25rem; + margin-bottom: .25rem; + + > input { + flex: 1; + padding: .5rem; + border: 1px solid var(--border-color); + box-sizing: border-box; + border-radius: .5rem; + outline: none; + font-family: var(--monospace-font-stack); + + &:focus { + border: 1px solid var(--primary-color); + } + } + } + } +} diff --git a/web/src/ui/settings/RoomStateExplorer.tsx b/web/src/ui/settings/RoomStateExplorer.tsx new file mode 100644 index 0000000..32694bc --- /dev/null +++ b/web/src/ui/settings/RoomStateExplorer.tsx @@ -0,0 +1,322 @@ +// gomuks - A Matrix client written in Go. +// Copyright (C) 2025 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 . +import { use, useCallback, useState } from "react" +import { RoomStateStore, useRoomState } from "@/api/statestore" +import ClientContext from "../ClientContext.ts" +import JSONView from "../util/JSONView" +import "./RoomStateExplorer.css" + +interface StateExplorerProps { + room: RoomStateStore +} + +interface StateEventViewProps { + room: RoomStateStore + type?: string + stateKey?: string + onBack: () => void + onDone?: (type: string, stateKey: string) => void +} + +interface NewMessageEventViewProps { + room: RoomStateStore + onBack: () => void +} + +interface StateKeyListProps { + room: RoomStateStore + type: string + onSelectStateKey: (stateKey: string) => void + onBack: () => void +} + +const StateEventView = ({ room, type, stateKey, onBack, onDone }: StateEventViewProps) => { + const event = useRoomState(room, type, stateKey) + const isNewEvent = type === undefined + const [editingContent, setEditingContent] = useState(isNewEvent ? "{\n\n}" : null) + const [newType, setNewType] = useState("") + const [newStateKey, setNewStateKey] = useState("") + const client = use(ClientContext)! + + const sendEdit = () => { + let parsedContent + try { + parsedContent = JSON.parse(editingContent || "{}") + } catch (err) { + window.alert(`Failed to parse JSON: ${err}`) + return + } + client.rpc.setState( + room.roomID, + type ?? newType, + stateKey ?? newStateKey, + parsedContent, + ).then( + () => { + console.log("Updated room state", room.roomID, type, stateKey) + setEditingContent(null) + if (isNewEvent) { + onDone?.(newType, newStateKey) + } + }, + err => { + console.error("Failed to update room state", err) + window.alert(`Failed to update room state: ${err}`) + }, + ) + } + const stopEdit = () => setEditingContent(null) + const startEdit = () => setEditingContent(JSON.stringify(event?.content || {}, null, 4)) + + return ( +
+
+ {isNewEvent + ? <> +

New state event

+
+ setNewType(evt.target.value)} + placeholder="Event type" + /> + setNewStateKey(evt.target.value)} + placeholder="State key" + /> +
+ + :

{type} ({stateKey ? {stateKey} : "no state key"})

+ } +
+
+ {editingContent !== null + ?