mirror of
https://github.com/matrix-org/dendrite.git
synced 2026-01-08 14:43:09 -06:00
Merge branch 'main' into kegan/component-interfaces-2
This commit is contained in:
commit
1adc862453
2
go.mod
2
go.mod
|
|
@ -30,7 +30,7 @@ require (
|
||||||
github.com/matrix-org/dugong v0.0.0-20210921133753-66e6b1c67e2e
|
github.com/matrix-org/dugong v0.0.0-20210921133753-66e6b1c67e2e
|
||||||
github.com/matrix-org/go-sqlite3-js v0.0.0-20220419092513-28aa791a1c91
|
github.com/matrix-org/go-sqlite3-js v0.0.0-20220419092513-28aa791a1c91
|
||||||
github.com/matrix-org/gomatrix v0.0.0-20210324163249-be2af5ef2e16
|
github.com/matrix-org/gomatrix v0.0.0-20210324163249-be2af5ef2e16
|
||||||
github.com/matrix-org/gomatrixserverlib v0.0.0-20220505092512-c4ceb4751ac2
|
github.com/matrix-org/gomatrixserverlib v0.0.0-20220505130352-f72a63510060
|
||||||
github.com/matrix-org/pinecone v0.0.0-20220408153826-2999ea29ed48
|
github.com/matrix-org/pinecone v0.0.0-20220408153826-2999ea29ed48
|
||||||
github.com/matrix-org/util v0.0.0-20200807132607-55161520e1d4
|
github.com/matrix-org/util v0.0.0-20200807132607-55161520e1d4
|
||||||
github.com/mattn/go-sqlite3 v1.14.10
|
github.com/mattn/go-sqlite3 v1.14.10
|
||||||
|
|
|
||||||
4
go.sum
4
go.sum
|
|
@ -795,8 +795,8 @@ github.com/matrix-org/go-sqlite3-js v0.0.0-20220419092513-28aa791a1c91/go.mod h1
|
||||||
github.com/matrix-org/gomatrix v0.0.0-20190528120928-7df988a63f26/go.mod h1:3fxX6gUjWyI/2Bt7J1OLhpCzOfO/bB3AiX0cJtEKud0=
|
github.com/matrix-org/gomatrix v0.0.0-20190528120928-7df988a63f26/go.mod h1:3fxX6gUjWyI/2Bt7J1OLhpCzOfO/bB3AiX0cJtEKud0=
|
||||||
github.com/matrix-org/gomatrix v0.0.0-20210324163249-be2af5ef2e16 h1:ZtO5uywdd5dLDCud4r0r55eP4j9FuUNpl60Gmntcop4=
|
github.com/matrix-org/gomatrix v0.0.0-20210324163249-be2af5ef2e16 h1:ZtO5uywdd5dLDCud4r0r55eP4j9FuUNpl60Gmntcop4=
|
||||||
github.com/matrix-org/gomatrix v0.0.0-20210324163249-be2af5ef2e16/go.mod h1:/gBX06Kw0exX1HrwmoBibFA98yBk/jxKpGVeyQbff+s=
|
github.com/matrix-org/gomatrix v0.0.0-20210324163249-be2af5ef2e16/go.mod h1:/gBX06Kw0exX1HrwmoBibFA98yBk/jxKpGVeyQbff+s=
|
||||||
github.com/matrix-org/gomatrixserverlib v0.0.0-20220505092512-c4ceb4751ac2 h1:5/Y4BpiMk1D/l/HkJz8Ng8bLBz1BHwV6V4e+yMNySzk=
|
github.com/matrix-org/gomatrixserverlib v0.0.0-20220505130352-f72a63510060 h1:tYi4mCOWgVLt8mpkG1LFRKcMfSTwp5NQ5wBKdtaxO9s=
|
||||||
github.com/matrix-org/gomatrixserverlib v0.0.0-20220505092512-c4ceb4751ac2/go.mod h1:V5eO8rn/C3rcxig37A/BCeKerLFS+9Avg/77FIeTZ48=
|
github.com/matrix-org/gomatrixserverlib v0.0.0-20220505130352-f72a63510060/go.mod h1:V5eO8rn/C3rcxig37A/BCeKerLFS+9Avg/77FIeTZ48=
|
||||||
github.com/matrix-org/pinecone v0.0.0-20220408153826-2999ea29ed48 h1:W0sjjC6yjskHX4mb0nk3p0fXAlbU5bAFUFeEtlrPASE=
|
github.com/matrix-org/pinecone v0.0.0-20220408153826-2999ea29ed48 h1:W0sjjC6yjskHX4mb0nk3p0fXAlbU5bAFUFeEtlrPASE=
|
||||||
github.com/matrix-org/pinecone v0.0.0-20220408153826-2999ea29ed48/go.mod h1:ulJzsVOTssIVp1j/m5eI//4VpAGDkMt5NrRuAVX7wpc=
|
github.com/matrix-org/pinecone v0.0.0-20220408153826-2999ea29ed48/go.mod h1:ulJzsVOTssIVp1j/m5eI//4VpAGDkMt5NrRuAVX7wpc=
|
||||||
github.com/matrix-org/util v0.0.0-20190711121626-527ce5ddefc7/go.mod h1:vVQlW/emklohkZnOPwD3LrZUBqdfsbiyO3p1lNV8F6U=
|
github.com/matrix-org/util v0.0.0-20190711121626-527ce5ddefc7/go.mod h1:vVQlW/emklohkZnOPwD3LrZUBqdfsbiyO3p1lNV8F6U=
|
||||||
|
|
|
||||||
|
|
@ -202,7 +202,7 @@ func (w *worker) _next() {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
case context.DeadlineExceeded:
|
case context.DeadlineExceeded, context.Canceled:
|
||||||
// The context exceeded, so we've been waiting for more than a
|
// The context exceeded, so we've been waiting for more than a
|
||||||
// minute for activity in this room. At this point we will shut
|
// minute for activity in this room. At this point we will shut
|
||||||
// down the subscriber to free up resources. It'll get started
|
// down the subscriber to free up resources. It'll get started
|
||||||
|
|
|
||||||
|
|
@ -331,6 +331,7 @@ func (b *BaseDendrite) CreateClient() *gomatrixserverlib.Client {
|
||||||
}
|
}
|
||||||
opts := []gomatrixserverlib.ClientOption{
|
opts := []gomatrixserverlib.ClientOption{
|
||||||
gomatrixserverlib.WithSkipVerify(b.Cfg.FederationAPI.DisableTLSValidation),
|
gomatrixserverlib.WithSkipVerify(b.Cfg.FederationAPI.DisableTLSValidation),
|
||||||
|
gomatrixserverlib.WithWellKnownSRVLookups(true),
|
||||||
}
|
}
|
||||||
if b.Cfg.Global.DNSCache.Enabled {
|
if b.Cfg.Global.DNSCache.Enabled {
|
||||||
opts = append(opts, gomatrixserverlib.WithDNSCache(b.DNSCache))
|
opts = append(opts, gomatrixserverlib.WithDNSCache(b.DNSCache))
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
const userDailyVisitsSchema = `
|
const userDailyVisitsSchema = `
|
||||||
CREATE TABLE IF NOT EXISTS user_daily_visits (
|
CREATE TABLE IF NOT EXISTS userapi_daily_visits (
|
||||||
localpart TEXT NOT NULL,
|
localpart TEXT NOT NULL,
|
||||||
device_id TEXT NOT NULL,
|
device_id TEXT NOT NULL,
|
||||||
timestamp BIGINT NOT NULL,
|
timestamp BIGINT NOT NULL,
|
||||||
|
|
@ -38,9 +38,9 @@ CREATE TABLE IF NOT EXISTS user_daily_visits (
|
||||||
);
|
);
|
||||||
|
|
||||||
-- Device IDs and timestamp must be unique for a given user per day
|
-- Device IDs and timestamp must be unique for a given user per day
|
||||||
CREATE UNIQUE INDEX IF NOT EXISTS localpart_device_timestamp_idx ON user_daily_visits(localpart, device_id, timestamp);
|
CREATE UNIQUE INDEX IF NOT EXISTS userapi_daily_visits_localpart_device_timestamp_idx ON userapi_daily_visits(localpart, device_id, timestamp);
|
||||||
CREATE INDEX IF NOT EXISTS timestamp_idx ON user_daily_visits(timestamp);
|
CREATE INDEX IF NOT EXISTS userapi_daily_visits_timestamp_idx ON userapi_daily_visits(timestamp);
|
||||||
CREATE INDEX IF NOT EXISTS localpart_timestamp_idx ON user_daily_visits(localpart, timestamp);
|
CREATE INDEX IF NOT EXISTS userapi_daily_visits_localpart_timestamp_idx ON userapi_daily_visits(localpart, timestamp);
|
||||||
`
|
`
|
||||||
|
|
||||||
const countUsersLastSeenAfterSQL = "" +
|
const countUsersLastSeenAfterSQL = "" +
|
||||||
|
|
@ -112,7 +112,7 @@ FROM
|
||||||
WHEN LOWER(user_agent) LIKE '%%mozilla%%' OR LOWER(user_agent) LIKE '%%gecko%%' THEN 'web'
|
WHEN LOWER(user_agent) LIKE '%%mozilla%%' OR LOWER(user_agent) LIKE '%%gecko%%' THEN 'web'
|
||||||
ELSE 'unknown'
|
ELSE 'unknown'
|
||||||
END as client_type
|
END as client_type
|
||||||
FROM user_daily_visits
|
FROM userapi_daily_visits
|
||||||
WHERE timestamp > $1 AND timestamp < $2
|
WHERE timestamp > $1 AND timestamp < $2
|
||||||
GROUP BY localpart, client_type
|
GROUP BY localpart, client_type
|
||||||
HAVING max(timestamp) - min(timestamp) > $3
|
HAVING max(timestamp) - min(timestamp) > $3
|
||||||
|
|
@ -141,11 +141,11 @@ SELECT user_type, COUNT(*) AS count FROM (
|
||||||
|
|
||||||
// account_type 1 = users; 3 = admins
|
// account_type 1 = users; 3 = admins
|
||||||
const updateUserDailyVisitsSQL = `
|
const updateUserDailyVisitsSQL = `
|
||||||
INSERT INTO user_daily_visits(localpart, device_id, timestamp, user_agent)
|
INSERT INTO userapi_daily_visits(localpart, device_id, timestamp, user_agent)
|
||||||
SELECT u.localpart, u.device_id, $1, MAX(u.user_agent)
|
SELECT u.localpart, u.device_id, $1, MAX(u.user_agent)
|
||||||
FROM device_devices AS u
|
FROM device_devices AS u
|
||||||
LEFT JOIN (
|
LEFT JOIN (
|
||||||
SELECT localpart, device_id, timestamp FROM user_daily_visits
|
SELECT localpart, device_id, timestamp FROM userapi_daily_visits
|
||||||
WHERE timestamp = $1
|
WHERE timestamp = $1
|
||||||
) udv
|
) udv
|
||||||
ON u.localpart = udv.localpart AND u.device_id = udv.device_id
|
ON u.localpart = udv.localpart AND u.device_id = udv.device_id
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
const userDailyVisitsSchema = `
|
const userDailyVisitsSchema = `
|
||||||
CREATE TABLE IF NOT EXISTS user_daily_visits (
|
CREATE TABLE IF NOT EXISTS userapi_daily_visits (
|
||||||
localpart TEXT NOT NULL,
|
localpart TEXT NOT NULL,
|
||||||
device_id TEXT NOT NULL,
|
device_id TEXT NOT NULL,
|
||||||
timestamp BIGINT NOT NULL,
|
timestamp BIGINT NOT NULL,
|
||||||
|
|
@ -38,9 +38,9 @@ CREATE TABLE IF NOT EXISTS user_daily_visits (
|
||||||
);
|
);
|
||||||
|
|
||||||
-- Device IDs and timestamp must be unique for a given user per day
|
-- Device IDs and timestamp must be unique for a given user per day
|
||||||
CREATE UNIQUE INDEX IF NOT EXISTS localpart_device_timestamp_idx ON user_daily_visits(localpart, device_id, timestamp);
|
CREATE UNIQUE INDEX IF NOT EXISTS userapi_daily_visits_localpart_device_timestamp_idx ON userapi_daily_visits(localpart, device_id, timestamp);
|
||||||
CREATE INDEX IF NOT EXISTS timestamp_idx ON user_daily_visits(timestamp);
|
CREATE INDEX IF NOT EXISTS userapi_daily_visits_timestamp_idx ON userapi_daily_visits(timestamp);
|
||||||
CREATE INDEX IF NOT EXISTS localpart_timestamp_idx ON user_daily_visits(localpart, timestamp);
|
CREATE INDEX IF NOT EXISTS userapi_daily_visits_localpart_timestamp_idx ON userapi_daily_visits(localpart, timestamp);
|
||||||
`
|
`
|
||||||
|
|
||||||
const countUsersLastSeenAfterSQL = "" +
|
const countUsersLastSeenAfterSQL = "" +
|
||||||
|
|
@ -116,7 +116,7 @@ FROM
|
||||||
WHEN LOWER(user_agent) LIKE '%%mozilla%%' OR LOWER(user_agent) LIKE '%%gecko%%' THEN 'web'
|
WHEN LOWER(user_agent) LIKE '%%mozilla%%' OR LOWER(user_agent) LIKE '%%gecko%%' THEN 'web'
|
||||||
ELSE 'unknown'
|
ELSE 'unknown'
|
||||||
END as client_type
|
END as client_type
|
||||||
FROM user_daily_visits
|
FROM userapi_daily_visits
|
||||||
WHERE timestamp > $1 AND timestamp < $2
|
WHERE timestamp > $1 AND timestamp < $2
|
||||||
GROUP BY localpart, client_type
|
GROUP BY localpart, client_type
|
||||||
HAVING max(timestamp) - min(timestamp) > $3
|
HAVING max(timestamp) - min(timestamp) > $3
|
||||||
|
|
@ -145,11 +145,11 @@ SELECT user_type, COUNT(*) AS count FROM (
|
||||||
|
|
||||||
// account_type 1 = users; 3 = admins
|
// account_type 1 = users; 3 = admins
|
||||||
const updateUserDailyVisitsSQL = `
|
const updateUserDailyVisitsSQL = `
|
||||||
INSERT INTO user_daily_visits(localpart, device_id, timestamp, user_agent)
|
INSERT INTO userapi_daily_visits(localpart, device_id, timestamp, user_agent)
|
||||||
SELECT u.localpart, u.device_id, $1, MAX(u.user_agent)
|
SELECT u.localpart, u.device_id, $1, MAX(u.user_agent)
|
||||||
FROM device_devices AS u
|
FROM device_devices AS u
|
||||||
LEFT JOIN (
|
LEFT JOIN (
|
||||||
SELECT localpart, device_id, timestamp FROM user_daily_visits
|
SELECT localpart, device_id, timestamp FROM userapi_daily_visits
|
||||||
WHERE timestamp = $1
|
WHERE timestamp = $1
|
||||||
) udv
|
) udv
|
||||||
ON u.localpart = udv.localpart AND u.device_id = udv.device_id
|
ON u.localpart = udv.localpart AND u.device_id = udv.device_id
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue