diff --git a/activitypub/inbox/undo.go b/activitypub/inbox/undo.go index 3034951a8..fd18fc6bb 100644 --- a/activitypub/inbox/undo.go +++ b/activitypub/inbox/undo.go @@ -18,7 +18,12 @@ func handleUndoInboxRequest(c context.Context, activity vocab.ActivityStreamsUnd return err } } else { - log.Traceln("Undo", iter.GetType().GetTypeName(), "ignored") + t := iter.GetType() + if t != nil { + log.Traceln("Undo", t.GetTypeName(), "ignored") + } else { + log.Traceln("Undo (no type) ignored") + } return nil } } diff --git a/build/javascript/package-lock.json b/build/javascript/package-lock.json index 16e2ea7e3..5f427b377 100644 --- a/build/javascript/package-lock.json +++ b/build/javascript/package-lock.json @@ -5,11 +5,11 @@ "requires": true, "dependencies": { "@babel/runtime": { - "version": "7.19.4", - "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.19.4.tgz", - "integrity": "sha512-EXpLCrk55f+cYqmHsSR+yD/0gAIMxxA9QK9lnQWzhMCvt+YmoBN7Zx94s++Kv0+unHk39vxNO8t+CMA2WSS3wA==", + "version": "7.20.6", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.20.6.tgz", + "integrity": "sha512-Q+8MqP7TiHMWzSfwiJwXCjyf4GYA4Dgw3emg/7xmwsdLJOZUp+nMqcOwOzzYheuM1rhDu8FSj2l0aoMygEuXuA==", "requires": { - "regenerator-runtime": "^0.13.4" + "regenerator-runtime": "^0.13.11" } }, "@fortawesome/fontawesome-common-types": { @@ -192,9 +192,9 @@ } }, "@xmldom/xmldom": { - "version": "0.7.6", - "resolved": "https://registry.npmjs.org/@xmldom/xmldom/-/xmldom-0.7.6.tgz", - "integrity": "sha512-HHXP9hskkFQHy8QxxUXkS7946FFIhYVfGqsk0WLwllmexN9x/+R4UBLvurHEuyXRfVEObVR8APuQehykLviwSQ==" + "version": "0.7.9", + "resolved": "https://registry.npmjs.org/@xmldom/xmldom/-/xmldom-0.7.9.tgz", + "integrity": "sha512-yceMpm/xd4W2a85iqZyO09gTnHvXF6pyiWjD2jcOJs7hRoZtNNOO1eJlhHj1ixA+xip2hOyGn+LgcvLCMo5zXA==" }, "acorn": { "version": "7.4.1", @@ -242,9 +242,9 @@ } }, "anymatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.2.tgz", - "integrity": "sha512-P43ePfOAIupkguHUycrc4qJ9kz8ZiuOUijaETwX7THt0Y/GNK7v0aa8rY816xWjZ7rJdA5XdMcpVFTKMq+RvWg==", + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", + "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", "dev": true, "requires": { "normalize-path": "^3.0.0", @@ -350,9 +350,9 @@ } }, "caniuse-lite": { - "version": "1.0.30001423", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001423.tgz", - "integrity": "sha512-09iwWGOlifvE1XuHokFMP7eR38a0JnajoyL3/i87c8ZjRWRrdKo1fqjNfugfBD0UDBIOz0U+jtNhJ0EPm1VleQ==" + "version": "1.0.30001434", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001434.tgz", + "integrity": "sha512-aOBHrLmTQw//WFa2rcF1If9fa3ypkC1wzqqiKHgfdrXTWcU8C4gKVZT77eQAPWN1APys3+uQ0Df07rKauXGEYA==" }, "chalk": { "version": "4.1.2", @@ -527,25 +527,25 @@ } }, "cssnano-preset-default": { - "version": "5.2.12", - "resolved": "https://registry.npmjs.org/cssnano-preset-default/-/cssnano-preset-default-5.2.12.tgz", - "integrity": "sha512-OyCBTZi+PXgylz9HAA5kHyoYhfGcYdwFmyaJzWnzxuGRtnMw/kR6ilW9XzlzlRAtB6PLT/r+prYgkef7hngFew==", + "version": "5.2.13", + "resolved": "https://registry.npmjs.org/cssnano-preset-default/-/cssnano-preset-default-5.2.13.tgz", + "integrity": "sha512-PX7sQ4Pb+UtOWuz8A1d+Rbi+WimBIxJTRyBdgGp1J75VU0r/HFQeLnMYgHiCAp6AR4rqrc7Y4R+1Rjk3KJz6DQ==", "dev": true, "requires": { - "css-declaration-sorter": "^6.3.0", + "css-declaration-sorter": "^6.3.1", "cssnano-utils": "^3.1.0", "postcss-calc": "^8.2.3", "postcss-colormin": "^5.3.0", - "postcss-convert-values": "^5.1.2", + "postcss-convert-values": "^5.1.3", "postcss-discard-comments": "^5.1.2", "postcss-discard-duplicates": "^5.1.0", "postcss-discard-empty": "^5.1.1", "postcss-discard-overridden": "^5.1.0", - "postcss-merge-longhand": "^5.1.6", - "postcss-merge-rules": "^5.1.2", + "postcss-merge-longhand": "^5.1.7", + "postcss-merge-rules": "^5.1.3", "postcss-minify-font-values": "^5.1.0", "postcss-minify-gradients": "^5.1.1", - "postcss-minify-params": "^5.1.3", + "postcss-minify-params": "^5.1.4", "postcss-minify-selectors": "^5.2.1", "postcss-normalize-charset": "^5.1.0", "postcss-normalize-display-values": "^5.1.0", @@ -553,11 +553,11 @@ "postcss-normalize-repeat-style": "^5.1.1", "postcss-normalize-string": "^5.1.0", "postcss-normalize-timing-functions": "^5.1.0", - "postcss-normalize-unicode": "^5.1.0", + "postcss-normalize-unicode": "^5.1.1", "postcss-normalize-url": "^5.1.0", "postcss-normalize-whitespace": "^5.1.1", "postcss-ordered-values": "^5.1.3", - "postcss-reduce-initial": "^5.1.0", + "postcss-reduce-initial": "^5.1.1", "postcss-reduce-transforms": "^5.1.0", "postcss-svgo": "^5.1.0", "postcss-unique-selectors": "^5.1.1" @@ -856,9 +856,9 @@ } }, "ignore": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.0.tgz", - "integrity": "sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ==", + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.1.tgz", + "integrity": "sha512-d2qQLzTJ9WxQftPAuEQpSPmKqzxePjzVbpAVv62AQ64NTL+wR4JkrVqR/LqFsFEUsHDAiId52mJteHDFuDkElA==", "dev": true }, "individual": { @@ -1263,12 +1263,12 @@ } }, "postcss-convert-values": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/postcss-convert-values/-/postcss-convert-values-5.1.2.tgz", - "integrity": "sha512-c6Hzc4GAv95B7suy4udszX9Zy4ETyMCgFPUDtWjdFTKH1SE9eFY/jEpHSwTH1QPuwxHpWslhckUQWbNRM4ho5g==", + "version": "5.1.3", + "resolved": "https://registry.npmjs.org/postcss-convert-values/-/postcss-convert-values-5.1.3.tgz", + "integrity": "sha512-82pC1xkJZtcJEfiLw6UXnXVXScgtBrjlO5CBmuDQc+dlb88ZYheFsjTn40+zBVi3DkfF7iezO0nJUPLcJK3pvA==", "dev": true, "requires": { - "browserslist": "^4.20.3", + "browserslist": "^4.21.4", "postcss-value-parser": "^4.2.0" } }, @@ -1396,22 +1396,22 @@ } }, "postcss-merge-longhand": { - "version": "5.1.6", - "resolved": "https://registry.npmjs.org/postcss-merge-longhand/-/postcss-merge-longhand-5.1.6.tgz", - "integrity": "sha512-6C/UGF/3T5OE2CEbOuX7iNO63dnvqhGZeUnKkDeifebY0XqkkvrctYSZurpNE902LDf2yKwwPFgotnfSoPhQiw==", + "version": "5.1.7", + "resolved": "https://registry.npmjs.org/postcss-merge-longhand/-/postcss-merge-longhand-5.1.7.tgz", + "integrity": "sha512-YCI9gZB+PLNskrK0BB3/2OzPnGhPkBEwmwhfYk1ilBHYVAZB7/tkTHFBAnCrvBBOmeYyMYw3DMjT55SyxMBzjQ==", "dev": true, "requires": { "postcss-value-parser": "^4.2.0", - "stylehacks": "^5.1.0" + "stylehacks": "^5.1.1" } }, "postcss-merge-rules": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/postcss-merge-rules/-/postcss-merge-rules-5.1.2.tgz", - "integrity": "sha512-zKMUlnw+zYCWoPN6yhPjtcEdlJaMUZ0WyVcxTAmw3lkkN/NDMRkOkiuctQEoWAOvH7twaxUUdvBWl0d4+hifRQ==", + "version": "5.1.3", + "resolved": "https://registry.npmjs.org/postcss-merge-rules/-/postcss-merge-rules-5.1.3.tgz", + "integrity": "sha512-LbLd7uFC00vpOuMvyZop8+vvhnfRGpp2S+IMQKeuOZZapPRY4SMq5ErjQeHbHsjCUgJkRNrlU+LmxsKIqPKQlA==", "dev": true, "requires": { - "browserslist": "^4.16.6", + "browserslist": "^4.21.4", "caniuse-api": "^3.0.0", "cssnano-utils": "^3.1.0", "postcss-selector-parser": "^6.0.5" @@ -1438,12 +1438,12 @@ } }, "postcss-minify-params": { - "version": "5.1.3", - "resolved": "https://registry.npmjs.org/postcss-minify-params/-/postcss-minify-params-5.1.3.tgz", - "integrity": "sha512-bkzpWcjykkqIujNL+EVEPOlLYi/eZ050oImVtHU7b4lFS82jPnsCb44gvC6pxaNt38Els3jWYDHTjHKf0koTgg==", + "version": "5.1.4", + "resolved": "https://registry.npmjs.org/postcss-minify-params/-/postcss-minify-params-5.1.4.tgz", + "integrity": "sha512-+mePA3MgdmVmv6g+30rn57USjOGSAyuxUmkfiWpzalZ8aiBkdPYjXWtHuwJGm1v5Ojy0Z0LaSYhHaLJQB0P8Jw==", "dev": true, "requires": { - "browserslist": "^4.16.6", + "browserslist": "^4.21.4", "cssnano-utils": "^3.1.0", "postcss-value-parser": "^4.2.0" } @@ -1529,12 +1529,12 @@ } }, "postcss-normalize-unicode": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/postcss-normalize-unicode/-/postcss-normalize-unicode-5.1.0.tgz", - "integrity": "sha512-J6M3MizAAZ2dOdSjy2caayJLQT8E8K9XjLce8AUQMwOrCvjCHv24aLC/Lps1R1ylOfol5VIDMaM/Lo9NGlk1SQ==", + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/postcss-normalize-unicode/-/postcss-normalize-unicode-5.1.1.tgz", + "integrity": "sha512-qnCL5jzkNUmKVhZoENp1mJiGNPcsJCs1aaRmURmeJGES23Z/ajaln+EPTD+rBeNkSryI+2WTdW+lwcVdOikrpA==", "dev": true, "requires": { - "browserslist": "^4.16.6", + "browserslist": "^4.21.4", "postcss-value-parser": "^4.2.0" } }, @@ -1568,12 +1568,12 @@ } }, "postcss-reduce-initial": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/postcss-reduce-initial/-/postcss-reduce-initial-5.1.0.tgz", - "integrity": "sha512-5OgTUviz0aeH6MtBjHfbr57tml13PuedK/Ecg8szzd4XRMbYxH4572JFG067z+FqBIf6Zp/d+0581glkvvWMFw==", + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/postcss-reduce-initial/-/postcss-reduce-initial-5.1.1.tgz", + "integrity": "sha512-//jeDqWcHPuXGZLoolFrUXBDyuEGbr9S2rMo19bkTIjBQ4PqkaO+oI8wua5BOUxpfi97i3PCoInsiFIEBfkm9w==", "dev": true, "requires": { - "browserslist": "^4.16.6", + "browserslist": "^4.21.4", "caniuse-api": "^3.0.0" } }, @@ -1605,9 +1605,9 @@ } }, "postcss-selector-parser": { - "version": "6.0.10", - "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-6.0.10.tgz", - "integrity": "sha512-IQ7TZdoaqbT+LCpShg46jnZVlhWD2w6iQYAcYXfHARZ7X1t/UGhhceQDs5X0cGqKvYlHNOuv7Oa1xmb0oQuA3w==", + "version": "6.0.11", + "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-6.0.11.tgz", + "integrity": "sha512-zbARubNdogI9j7WY4nQJBiNqQf3sLS3wCP4WfOidu+p28LofJqDH1tcXypGrcmMHhDk2t9wGhCsYe/+szLTy1g==", "requires": { "cssesc": "^3.0.0", "util-deprecate": "^1.0.2" @@ -1746,9 +1746,9 @@ } }, "regenerator-runtime": { - "version": "0.13.10", - "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.10.tgz", - "integrity": "sha512-KepLsg4dU12hryUO7bp/axHAKvwGOCV0sGloQtpagJ12ai+ojVDqkeGSiRX1zlq+kjIMZ1t7gpze+26QqtdGqw==" + "version": "0.13.11", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.11.tgz", + "integrity": "sha512-kY1AZVr2Ra+t+piVaJ4gxaFaReZVH40AKNo7UCX6W+dEwBo/2oZJzqfuN1qLq1oL45o56cPaTXELwrTh8Fpggg==" }, "require-directory": { "version": "2.1.1", @@ -1862,12 +1862,12 @@ } }, "stylehacks": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/stylehacks/-/stylehacks-5.1.0.tgz", - "integrity": "sha512-SzLmvHQTrIWfSgljkQCw2++C9+Ne91d/6Sp92I8c5uHTcy/PgeHamwITIbBW9wnFTY/3ZfSXR9HIL6Ikqmcu6Q==", + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/stylehacks/-/stylehacks-5.1.1.tgz", + "integrity": "sha512-sBpcd5Hx7G6seo7b1LkpttvTz7ikD0LlH5RmdcBNb6fFR0Fl7LQwHDFr300q4cwUqi+IYrFGmsIHieMBfnN/Bw==", "dev": true, "requires": { - "browserslist": "^4.16.6", + "browserslist": "^4.21.4", "postcss-selector-parser": "^6.0.4" } }, @@ -2050,9 +2050,9 @@ } }, "tslib": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.0.tgz", - "integrity": "sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==" + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.1.tgz", + "integrity": "sha512-tGyy4dAjRIEwI7BzsB0lynWgOpfqjUdq91XXAlIWD2OwKBH7oCl/GZG/HT4BOHrTlPMOASlMQ7veyTqpmRcrNA==" }, "twemoji": { "version": "12.1.6", @@ -2194,9 +2194,9 @@ "dev": true }, "yargs": { - "version": "17.6.0", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.6.0.tgz", - "integrity": "sha512-8H/wTDqlSwoSnScvV2N/JHfLWOKuh5MVla9hqLjK3nsfyy6Y4kDSYSvkU5YCUEPOSnRXfIyx3Sq+B/IWudTo4g==", + "version": "17.6.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.6.2.tgz", + "integrity": "sha512-1/9UrdHjDZc0eOU0HxOHoS78C69UD3JRMvzlJ7S79S2nTaWRA/whGCTV8o9e/N/1Va9YIV7Q4sOxD8VV4pCWOw==", "dev": true, "requires": { "cliui": "^8.0.1", @@ -2205,7 +2205,7 @@ "require-directory": "^2.1.1", "string-width": "^4.2.3", "y18n": "^5.0.5", - "yargs-parser": "^21.0.0" + "yargs-parser": "^21.1.1" } }, "yargs-parser": { diff --git a/core/chat/persistence.go b/core/chat/persistence.go index 4e93b7924..65f8cf040 100644 --- a/core/chat/persistence.go +++ b/core/chat/persistence.go @@ -3,7 +3,6 @@ package chat import ( "context" "database/sql" - "fmt" "strings" "time" @@ -209,20 +208,14 @@ type rowData struct { userType *string } -func getChat(query string) []interface{} { +func getChat(rows *sql.Rows) ([]interface{}, error) { history := make([]interface{}, 0) - rows, err := _datastore.DB.Query(query) - if err != nil || rows.Err() != nil { - log.Errorln("error fetching chat history", err) - return history - } - defer rows.Close() for rows.Next() { row := rowData{} // Convert a database row into a chat event - if err = rows.Scan( + if err := rows.Scan( &row.id, &row.userID, &row.body, @@ -243,9 +236,7 @@ func getChat(query string) []interface{} { &row.userScopes, &row.userType, ); err != nil { - log.Errorln(err) - log.Errorln("There is a problem converting query to chat objects. Please report this:", query) - break + return nil, err } var message interface{} @@ -268,7 +259,7 @@ func getChat(query string) []interface{} { history = append(history, message) } - return history + return history, nil } var _historyCache *[]interface{} @@ -279,20 +270,87 @@ func GetChatModerationHistory() []interface{} { return *_historyCache } + tx, err := _datastore.DB.Begin() + if err != nil { + log.Errorln("error fetching chat moderation history", err) + return nil + } + + defer tx.Rollback() // nolint + // Get all messages regardless of visibility query := "SELECT messages.id, user_id, body, title, subtitle, image, link, eventType, hidden_at, timestamp, display_name, display_color, created_at, disabled_at, previous_names, namechanged_at, authenticated_at, scopes, type FROM messages INNER JOIN users ON messages.user_id = users.id ORDER BY timestamp DESC" - result := getChat(query) + stmt, err := tx.Prepare(query) + if err != nil { + log.Errorln("error fetching chat moderation history", err) + return nil + } + + rows, err := stmt.Query() + if err != nil { + log.Errorln("error fetching chat moderation history", err) + return nil + } + + defer stmt.Close() + defer rows.Close() + + result, err := getChat(rows) + if err != nil { + log.Errorln(err) + log.Errorln("There is a problem enumerating chat message rows. Please report this:", query) + return nil + } _historyCache = &result + if err = tx.Commit(); err != nil { + log.Errorln("error fetching chat moderation history", err) + return nil + } + return result } // GetChatHistory will return all the chat messages suitable for returning as user-facing chat history. func GetChatHistory() []interface{} { + tx, err := _datastore.DB.Begin() + if err != nil { + log.Errorln("error fetching chat history", err) + return nil + } + + defer tx.Rollback() // nolint + // Get all visible messages - query := fmt.Sprintf("SELECT messages.id, messages.user_id, messages.body, messages.title, messages.subtitle, messages.image, messages.link, messages.eventType, messages.hidden_at, messages.timestamp, users.display_name, users.display_color, users.created_at, users.disabled_at, users.previous_names, users.namechanged_at, users.authenticated_at, users.scopes, users.type FROM users JOIN messages ON users.id = messages.user_id WHERE hidden_at IS NULL AND disabled_at IS NULL ORDER BY timestamp DESC LIMIT %d", maxBacklogNumber) - m := getChat(query) + query := "SELECT messages.id, messages.user_id, messages.body, messages.title, messages.subtitle, messages.image, messages.link, messages.eventType, messages.hidden_at, messages.timestamp, users.display_name, users.display_color, users.created_at, users.disabled_at, users.previous_names, users.namechanged_at, users.authenticated_at, users.scopes, users.type FROM users JOIN messages ON users.id = messages.user_id WHERE hidden_at IS NULL AND disabled_at IS NULL ORDER BY timestamp DESC LIMIT ?" + + stmt, err := tx.Prepare(query) + if err != nil { + log.Errorln("error fetching chat history", err) + return nil + } + + rows, err := stmt.Query(maxBacklogNumber) + if err != nil { + log.Errorln("error fetching chat history", err) + return nil + } + + defer stmt.Close() + defer rows.Close() + + m, err := getChat(rows) + if err != nil { + log.Errorln(err) + log.Errorln("There is a problem enumerating chat message rows. Please report this:", query) + return nil + } + + if err = tx.Commit(); err != nil { + log.Errorln("error fetching chat history", err) + return nil + } // Invert order of messages for i, j := 0, len(m)-1; i < j; i, j = i+1, j-1 { @@ -332,10 +390,39 @@ func SetMessageVisibilityForUserID(userID string, visible bool) error { _historyCache = nil }() + tx, err := _datastore.DB.Begin() + if err != nil { + log.Errorln("error while setting message visibility", err) + return nil + } + + defer tx.Rollback() // nolint + query := "SELECT messages.id, user_id, body, title, subtitle, image, link, eventType, hidden_at, timestamp, display_name, display_color, created_at, disabled_at, previous_names, namechanged_at, authenticated_at, scopes, type FROM messages INNER JOIN users ON messages.user_id = users.id WHERE user_id IS ?" + + stmt, err := tx.Prepare(query) + if err != nil { + log.Errorln("error while setting message visibility", err) + return nil + } + + rows, err := stmt.Query(userID) + if err != nil { + log.Errorln("error while setting message visibility", err) + return nil + } + + defer stmt.Close() + defer rows.Close() + // Get a list of IDs to send to the connected clients to hide ids := make([]string, 0) - query := fmt.Sprintf("SELECT messages.id, user_id, body, title, subtitle, image, link, eventType, hidden_at, timestamp, display_name, display_color, created_at, disabled_at, previous_names, namechanged_at, authenticated_at, scopes, type FROM messages INNER JOIN users ON messages.user_id = users.id WHERE user_id IS '%s'", userID) - messages := getChat(query) + + messages, err := getChat(rows) + if err != nil { + log.Errorln(err) + log.Errorln("There is a problem enumerating chat message rows. Please report this:", query) + return nil + } if len(messages) == 0 { return nil @@ -345,6 +432,11 @@ func SetMessageVisibilityForUserID(userID string, visible bool) error { ids = append(ids, message.(events.UserMessageEvent).ID) } + if err = tx.Commit(); err != nil { + log.Errorln("error while setting message visibility ", err) + return nil + } + // Tell the clients to hide/show these messages. return SetMessagesVisibility(ids, visible) } diff --git a/docs/api/index.html b/docs/api/index.html index edf965626..700eac92e 100644 --- a/docs/api/index.html +++ b/docs/api/index.html @@ -2244,13 +2244,13 @@ data-styled.g138[id="sc-iIgjPs"]{content:"jIUTls,"}/*!sc*/
[- {
- "connectedAt": "2020-10-06T23:20:44.588649-07:00",
- "messageCount": 3,
- "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.89 Safari/537.36",
- "ipAddress": "172.217.164.110",
- "geo": {
- "countryCode": "US",
- "regionName": "California",
- "timeZone": "America/Los_Angeles"
}, - "user": {
- "id": "yklw5Imng",
- "displayName": "awesome-pizza",
- "displayColor": 42,
- "createdAt": "2021-07-08T20:21:25.303402404-07:00",
- "previousNames": "awesome-pizza,coolPerson23"
}
}
]
Return a list of currently connected clients with optional geo details.
[- {
- "id": "yklw5Imng",
- "displayName": "awesome-pizza",
- "displayColor": 3,
- "createdAt": "2019-08-24T14:15:22Z",
- "previousNames": "awesome-pizza,user42",
- "scopes": [
- "MODERATOR"
]
}
]
[- {
- "message": "Owncast v0.0.0-localdev (unknown)",
- "level": "info",
- "time": "2020-10-29T18:35:34.422386-07:00"
}, - {
- "message": "Web server running on port: 8080",
- "level": "info",
- "time": "2020-10-29T18:35:35.011731-07:00"
}, - {
- "message": "RTMP server is listening for incoming stream on port: 1935",
- "level": "info",
- "time": "2020-10-29T18:35:35.011823-07:00"
}
]
Return recent warning and error logs.
[- {
- "message": "Owncast v0.0.0-localdev (unknown)",
- "level": "info",
- "time": "2020-10-29T18:35:34.422386-07:00"
}, - {
- "message": "Web server running on port: 8080",
- "level": "info",
- "time": "2020-10-29T18:35:35.011731-07:00"
}, - {
- "message": "RTMP server is listening for incoming stream on port: 1935",
- "level": "info",
- "time": "2020-10-29T18:35:35.011823-07:00"
}
]
Get the current configuration of the Owncast server.
{- "instanceDetails": {
- "name": "string",
- "summary": "string",
- "logo": "string",
- "tags": [
- "string"
], - "extraPageContent": "<p>This page is <strong>super</strong> cool!",
- "version": "Owncast v0.0.3-macOS (ef3796a033b32a312ebf5b334851cbf9959e7ecb)"
}, - "ffmpegPath": "string",
- "webServerPort": 0,
- "rtmpServerPort": 0,
- "s3": {
- "enabled": true,
- "endpoint": "string",
- "servingEndpoint": "string",
- "accessKey": "string",
- "secret": "string",
- "bucket": "string",
- "region": "string",
- "acl": "string",
- "forcePathStyle": true
}, - "videoSettings": {
- "videoQualityVariants": [
- {
- "videoPassthrough": true,
- "audioPassthrough": true,
- "videoBitrate": 0,
- "audioBitrate": 0,
- "scaledWidth": 0,
- "scaledHeight": 0,
- "framerate": 0,
- "cpuUsageLevel": 0
}
], - "latencyLevel": 0
}, - "yp": {
- "enabled": false,
- "instanceUrl": "string"
}
}
Get a list of all chat messages with no filters applied.
-[- {
- "user": {
- "id": "yklw5Imng",
- "displayName": "awesome-pizza",
- "displayColor": 3,
- "createdAt": "2019-08-24T14:15:22Z",
- "previousNames": "awesome-pizza,user42",
- "scopes": [
- "MODERATOR"
]
}, - "body": "string",
- "id": "string",
- "visible": true,
- "timestamp": "2019-08-24T14:15:22Z"
}
]
Pass an array of IDs you want to change the chat visibility of.
+[- {
- "user": {
- "id": "yklw5Imng",
- "displayName": "awesome-pizza",
- "displayColor": 42,
- "createdAt": "2019-08-24T14:15:22Z",
- "previousNames": "awesome-pizza,user42",
- "scopes": [
- "MODERATOR"
]
}, - "body": "string",
- "id": "string",
- "visible": true,
- "timestamp": "2019-08-24T14:15:22Z"
}
]
Pass an array of IDs you want to change the chat visibility of.
visible | boolean Are these messages visible. |
idArray | Array of strings |
{- "visible": true,
- "idArray": [
- "string"
]
}
{- "success": true,
- "message": "context specific success message"
}
Enable or disable a single user. Disabling will also hide all the user's chat messages.
@@ -2329,7 +2329,7 @@ data-styled.g138[id="sc-iIgjPs"]{content:"jIUTls,"}/*!sc*/The moderator status of this user.
{- "userId": "xJ84_48Ghj",
- "isModerator": true
}
{- "success": true,
- "message": "context specific success message"
}
[- {
- "name": "John Smith",
- "timestamp": "2019-08-24T14:15:22Z",
- "disabledAt": "2019-08-24T14:15:22Z"
}
]
actorIRI | string The requestor's remote IRI used to identify the user. |
{- "actorIRI": "string"
}
{- "success": true,
- "message": "context specific success message"
}
value | Array of strings |
Register a user that returns an access token for accessing chat.
displayName | string Optionally provide a display name you want to assign to this user when registering. |
{- "displayName": "string"
}
{- "id": "string",
- "accessToken": "string",
- "displayName": "string"
}
Used to get chat messages prior to connecting to the websocket.
-[- {
- "user": {
- "id": "yklw5Imng",
- "displayName": "awesome-pizza",
- "displayColor": 3,
- "createdAt": "2019-08-24T14:15:22Z",
- "previousNames": "awesome-pizza,user42",
- "scopes": [
- "MODERATOR"
]
}, - "body": "string",
- "id": "string",
- "visible": true,
- "timestamp": "2019-08-24T14:15:22Z"
}
]
Get a list of custom emoji that are supported in chat.
+[- {
- "user": {
- "id": "yklw5Imng",
- "displayName": "awesome-pizza",
- "displayColor": 42,
- "createdAt": "2019-08-24T14:15:22Z",
- "previousNames": "awesome-pizza,user42",
- "scopes": [
- "MODERATOR"
]
}, - "body": "string",
- "id": "string",
- "visible": true,
- "timestamp": "2019-08-24T14:15:22Z"
}
]
Set the title of the currently streaming content.
string or integer or object or boolean |
[- {
- "url": "string",
- "title": "string",
- "description": "string",
- "icon": "string",
- "color": "string",
- "openExternally": true
}
]
Return a list of currently connected clients with optional geo details.
[- {
- "connectedAt": "2020-10-06T23:20:44.588649-07:00",
- "messageCount": 3,
- "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.89 Safari/537.36",
- "ipAddress": "172.217.164.110",
- "geo": {
- "countryCode": "US",
- "regionName": "California",
- "timeZone": "America/Los_Angeles"
}, - "user": {
- "id": "yklw5Imng",
- "displayName": "awesome-pizza",
- "displayColor": 42,
- "createdAt": "2021-07-08T20:21:25.303402404-07:00",
- "previousNames": "awesome-pizza,coolPerson23"
}
}
]
Used to get the backlog of chat messages.
-[- {
- "user": {
- "id": "yklw5Imng",
- "displayName": "awesome-pizza",
- "displayColor": 3,
- "createdAt": "2019-08-24T14:15:22Z",
- "previousNames": "awesome-pizza,user42",
- "scopes": [
- "MODERATOR"
]
}, - "body": "string",
- "id": "string",
- "visible": true,
- "timestamp": "2019-08-24T14:15:22Z"
}
]
Pass an array of IDs you want to change the chat visibility of.
+[- {
- "user": {
- "id": "yklw5Imng",
- "displayName": "awesome-pizza",
- "displayColor": 42,
- "createdAt": "2019-08-24T14:15:22Z",
- "previousNames": "awesome-pizza,user42",
- "scopes": [
- "MODERATOR"
]
}, - "body": "string",
- "id": "string",
- "visible": true,
- "timestamp": "2019-08-24T14:15:22Z"
}
]
Pass an array of IDs you want to change the chat visibility of.
visible | boolean Are these messages visible. |
idArray | Array of strings |
{- "visible": true,
- "idArray": [
- "string"
]
}
{- "success": true,
- "message": "context specific success message"
}
Chat-related actions that can take place by a moderator.
@@ -2391,17 +2391,17 @@ data-styled.g138[id="sc-iIgjPs"]{content:"jIUTls,"}/*!sc*/The moderator status of this user.
{- "userId": "xJ84_48Ghj",
- "isModerator": true
}
{- "success": true,
- "message": "context specific success message"
}
[- {
- "id": "yklw5Imng",
- "displayName": "awesome-pizza",
- "displayColor": 42,
- "createdAt": "2019-08-24T14:15:22Z",
- "previousNames": "awesome-pizza,user42",
- "scopes": [
- "MODERATOR"
]
}
]
{- "name": "string",
- "summary": "string",
- "logo": "string",
- "tags": [
- "string"
], - "extraPageContent": "<p>This page is <strong>super</strong> cool!",
- "version": "Owncast v0.0.3-macOS (ef3796a033b32a312ebf5b334851cbf9959e7ecb)"
}
This endpoint is used to discover when a server is broadcasting, the number of active viewers as well as other useful information for updating the user interface.
{- "lastConnectTime": "2020-10-03T21:36:22-05:00",
- "lastDisconnectTime": null,
- "online": true,
- "overallMaxViewerCount": 420,
- "sessionMaxViewerCount": 12,
- "viewerCount": 7
}
Information to be used in the Yellow Pages service, a global directory of Owncast servers.
{- "name": "string",
- "description": "string",
- "logo": "string",
- "nsfw": true,
- "tags": [
- "string"
], - "online": true,
- "viewerCount": 0,
- "overallMaxViewerCount": 0,
- "sessionMaxViewerCount": 0,
- "lastConnectTime": "2019-08-24T14:15:22Z"
}
[- {
- "name": "John Smith",
- "timestamp": "2019-08-24T14:15:22Z",
- "disabledAt": "2019-08-24T14:15:22Z"
}
]
account | string The fediverse username@server.tld account that wants to perform the remote follow action. +Response samples
Content type application/json [ Return the information needed to redirect a user to a fediverse server to perform a remote follow action.Request Body schema: application/json
ResponsesRequest samples
Content type application/json { Response samples
Content type application/json |