Compare commits
152 Commits
a9e4ad55e9
...
develop
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c49fdb09e5 | ||
|
|
e08b251b7c | ||
|
|
eaf2e4b12a | ||
|
|
81dad75986 | ||
|
|
849c4e85b0 | ||
|
|
a29385e31c | ||
|
|
2c42b901f2 | ||
|
|
a963ac0135 | ||
|
|
0facdd5330 | ||
|
|
e9a78bd1d0 | ||
|
|
e50e72af5b | ||
|
|
4b627f0693 | ||
|
|
8bdb52fd37 | ||
|
|
f1ca5f9549 | ||
|
|
788b582e35 | ||
|
|
ca98a5ad21 | ||
|
|
3401dacdbc | ||
|
|
8a9967435c | ||
|
|
6d6edda5e3 | ||
|
|
a611fd93ba | ||
|
|
d4dec25129 | ||
|
|
7b88b1099d | ||
|
|
10e5683bd3 | ||
|
|
62c938e7db | ||
|
|
048632dee2 | ||
|
|
ed5186a280 | ||
|
|
2c002d8b54 | ||
|
|
d6fc08fb03 | ||
|
|
492ceeb286 | ||
|
|
9be8fa56c2 | ||
|
|
7eb415112b | ||
|
|
92d75ddefc | ||
|
|
9a99bfb0e9 | ||
|
|
dd7a0ec081 | ||
|
|
071bb660dc | ||
|
|
9529b12683 | ||
|
|
d2385aaab7 | ||
|
|
448ef8e24f | ||
|
|
982e293137 | ||
|
|
01fd73d1d1 | ||
|
|
7482a610b6 | ||
|
|
b18f9ac75d | ||
|
|
4744a27dd5 | ||
|
|
8af820e60e | ||
|
|
8913779f81 | ||
|
|
64df14c1df | ||
|
|
436077a6f6 | ||
|
|
213352414d | ||
|
|
dedb5c5a40 | ||
|
|
84178aa790 | ||
|
|
a48867aee6 | ||
|
|
b728bfc70a | ||
|
|
11af286501 | ||
|
|
613d928149 | ||
|
|
7ecc7d33d4 | ||
|
|
9c8c18919f | ||
|
|
69fd525b8d | ||
|
|
1df783d0ff | ||
|
|
8a5afae48a | ||
|
|
15e0a2eb73 | ||
|
|
bf685c5702 | ||
|
|
d1fd6bc8cb | ||
|
|
6c8daab1bd | ||
|
|
3e1f06913f | ||
|
|
1e80c6dff8 | ||
|
|
6482fc9f59 | ||
|
|
31d6fc94fe | ||
|
|
8e89c71a34 | ||
|
|
1ad9376c4b | ||
|
|
3ddc5a8d50 | ||
|
|
6fd3aad81d | ||
|
|
520183c39f | ||
|
|
86078d8b90 | ||
|
|
caa27d6fdb | ||
|
|
24b1dd2ed8 | ||
|
|
c1f4096e11 | ||
|
|
db0ddfe009 | ||
|
|
9ea94e9963 | ||
|
|
c72ae603c1 | ||
|
|
5e8373fcac | ||
|
|
b48b3cbc35 | ||
|
|
515e378b4b | ||
|
|
583668f750 | ||
|
|
d109c0cd7d | ||
|
|
7949670061 | ||
|
|
9a7a072050 | ||
|
|
eb608414f6 | ||
|
|
0d38420a7a | ||
|
|
d81c148f68 | ||
|
|
89b4e39542 | ||
|
|
4ad771ac3d | ||
|
|
0e8ff0bea3 | ||
|
|
ce976a5f0b | ||
|
|
5e64b6ea41 | ||
|
|
49f7c12b7e | ||
|
|
9dcee79432 | ||
|
|
e78d62ce63 | ||
|
|
b3947ef7ea | ||
|
|
6abbf8f50c | ||
|
|
da9d5b8411 | ||
|
|
05dd162de5 | ||
|
|
fc862b3fa0 | ||
|
|
6f8e9f9496 | ||
|
|
d6d126a874 | ||
|
|
555b305405 | ||
|
|
58b13d3355 | ||
|
|
ff45f75731 | ||
|
|
d9c97fb982 | ||
|
|
3ab5702741 | ||
|
|
cc43d14199 | ||
|
|
9c243f0ddf | ||
|
|
4b39458bf1 | ||
|
|
47857e283e | ||
|
|
6017d575c8 | ||
|
|
536eeb804a | ||
|
|
5c5e28a09c | ||
|
|
4690b13d6b | ||
|
|
78eec1e021 | ||
|
|
244dc2d7c1 | ||
|
|
03bac4ab48 | ||
|
|
2d4ae6ca20 | ||
|
|
2a4f53eb54 | ||
|
|
d494856ca2 | ||
|
|
e8a5ff95d4 | ||
|
|
a282daa12f | ||
|
|
2ff4baeb18 | ||
|
|
96ae5c7dce | ||
|
|
d328fe1fd8 | ||
|
|
8ab8659889 | ||
|
|
5733c86d8f | ||
|
|
a1d94a7f99 | ||
|
|
c1366518ad | ||
|
|
bd8dc8326c | ||
|
|
d03cac106c | ||
|
|
1c69164a72 | ||
|
|
2e8e61309a | ||
|
|
67ef2b45d9 | ||
|
|
91a635a5ca | ||
|
|
088023cf15 | ||
|
|
0f48bc4904 | ||
|
|
e4aa69dc46 | ||
|
|
dc8ed52b58 | ||
|
|
648856dcd1 | ||
|
|
a4ed2c14be | ||
|
|
8e2e05e48e | ||
|
|
d77b80a94a | ||
|
|
bd59d8ab40 | ||
|
|
70282761d3 | ||
|
|
e02f6dbc20 | ||
|
|
cb387d88be | ||
|
|
b45552ade0 | ||
|
|
2b42ff5ce4 |
1
.github/workflows/actions-lint.yml
vendored
1
.github/workflows/actions-lint.yml
vendored
@@ -18,6 +18,7 @@ jobs:
|
||||
if: github.event_name == 'pull_request'
|
||||
with:
|
||||
repository: ${{ github.event.pull_request.head.repo.full_name }}
|
||||
ref: ${{ github.event.pull_request.head.ref }}
|
||||
|
||||
- name: Check out repository code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
2
.github/workflows/auto-comment-on-label.yaml
vendored
2
.github/workflows/auto-comment-on-label.yaml
vendored
@@ -11,7 +11,7 @@ jobs:
|
||||
issues: write
|
||||
steps:
|
||||
- name: Add comment
|
||||
uses: peter-evans/create-or-update-comment@853a4fc475ab347cfa392aa2ee451b4fe83e774e
|
||||
uses: peter-evans/create-or-update-comment@54ad810bfed7d493f7413f5c35e292d18d217464
|
||||
with:
|
||||
issue-number: ${{ github.event.issue.number }}
|
||||
body: |
|
||||
|
||||
@@ -23,6 +23,7 @@ jobs:
|
||||
if: github.event_name == 'pull_request'
|
||||
with:
|
||||
repository: ${{ github.event.pull_request.head.repo.full_name }}
|
||||
ref: ${{ github.event.pull_request.head.ref }}
|
||||
|
||||
- name: Check out repository code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
1
.github/workflows/browser-testing.yml
vendored
1
.github/workflows/browser-testing.yml
vendored
@@ -24,6 +24,7 @@ jobs:
|
||||
if: github.event_name == 'pull_request'
|
||||
with:
|
||||
repository: ${{ github.event.pull_request.head.repo.full_name }}
|
||||
ref: ${{ github.event.pull_request.head.ref }}
|
||||
|
||||
- name: Check out repository code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
10
.github/workflows/build-storybook.yml
vendored
10
.github/workflows/build-storybook.yml
vendored
@@ -3,7 +3,12 @@ on:
|
||||
push:
|
||||
branches:
|
||||
- develop
|
||||
paths: ['web/stories/**', 'web/components/**', 'web/.storybook/**'] # Trigger the action only when files change in the folders defined here
|
||||
paths: [
|
||||
'web/stories/**',
|
||||
'web/components/**',
|
||||
'web/.storybook/**',
|
||||
'web/i18n/**',
|
||||
] # Trigger the action only when files change in the folders defined here
|
||||
|
||||
jobs:
|
||||
build-and-deploy:
|
||||
@@ -16,6 +21,7 @@ jobs:
|
||||
if: github.event_name == 'pull_request'
|
||||
with:
|
||||
repository: ${{ github.event.pull_request.head.repo.full_name }}
|
||||
ref: ${{ github.event.pull_request.head.ref }}
|
||||
|
||||
- name: Check out repository code
|
||||
uses: actions/checkout@v4
|
||||
@@ -43,6 +49,7 @@ jobs:
|
||||
npm run build-storybook -- -o ../docs/components
|
||||
|
||||
- name: Commit changes
|
||||
if: github.repository == 'owncast/owncast'
|
||||
uses: EndBug/add-and-commit@v9
|
||||
with:
|
||||
author_name: Owncast
|
||||
@@ -54,6 +61,7 @@ jobs:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Dispatch event to web site
|
||||
if: github.repository == 'owncast/owncast'
|
||||
uses: peter-evans/repository-dispatch@v3
|
||||
with:
|
||||
token: ${{ secrets.BUNDLE_STORYBOOK_OWNCAST_ONLINE }}
|
||||
|
||||
20
.github/workflows/chromatic.yml
vendored
20
.github/workflows/chromatic.yml
vendored
@@ -7,7 +7,7 @@ on:
|
||||
push:
|
||||
paths:
|
||||
- web/**
|
||||
pull_request_target:
|
||||
pull_request:
|
||||
paths:
|
||||
- web/**
|
||||
|
||||
@@ -16,7 +16,6 @@ jobs:
|
||||
chromatic-deployment:
|
||||
# Operating System
|
||||
runs-on: ubuntu-latest
|
||||
if: github.repository == 'owncast/owncast'
|
||||
|
||||
defaults:
|
||||
run:
|
||||
@@ -28,15 +27,16 @@ jobs:
|
||||
with:
|
||||
concurrent_skipping: 'same_content_newer'
|
||||
|
||||
- name: Check out pull request code
|
||||
uses: actions/checkout@v4
|
||||
if: github.event_name == 'pull_request' || github.event_name == 'pull_request_target'
|
||||
with:
|
||||
repository: ${{ github.event.pull_request.head.repo.full_name }}
|
||||
|
||||
- name: Check out repository code
|
||||
uses: actions/checkout@v4
|
||||
- name: Check out repository code (Push)
|
||||
if: github.event_name == 'push'
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Check out pull request code (PR)
|
||||
if: github.event_name == 'pull_request'
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.event.pull_request.head.ref }}
|
||||
repository: ${{ github.event.pull_request.head.repo.full_name }}
|
||||
|
||||
- name: Get changed files
|
||||
id: changed-files-yaml
|
||||
|
||||
1
.github/workflows/codeql-analysis.yml
vendored
1
.github/workflows/codeql-analysis.yml
vendored
@@ -41,6 +41,7 @@ jobs:
|
||||
if: github.event_name == 'pull_request'
|
||||
with:
|
||||
repository: ${{ github.event.pull_request.head.repo.full_name }}
|
||||
ref: ${{ github.event.pull_request.head.ref }}
|
||||
|
||||
- name: Check out repository code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
1
.github/workflows/container-lint.yml
vendored
1
.github/workflows/container-lint.yml
vendored
@@ -24,6 +24,7 @@ jobs:
|
||||
if: github.event_name == 'pull_request'
|
||||
with:
|
||||
repository: ${{ github.event.pull_request.head.repo.full_name }}
|
||||
ref: ${{ github.event.pull_request.head.ref }}
|
||||
|
||||
- name: Check out repository code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
1
.github/workflows/container.yaml
vendored
1
.github/workflows/container.yaml
vendored
@@ -42,6 +42,7 @@ jobs:
|
||||
if: github.event_name == 'pull_request'
|
||||
with:
|
||||
repository: ${{ github.event.pull_request.head.repo.full_name }}
|
||||
ref: ${{ github.event.pull_request.head.ref }}
|
||||
|
||||
- name: Check out repository code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
1
.github/workflows/css-lint.yaml
vendored
1
.github/workflows/css-lint.yaml
vendored
@@ -21,6 +21,7 @@ jobs:
|
||||
if: github.event_name == 'pull_request'
|
||||
with:
|
||||
repository: ${{ github.event.pull_request.head.repo.full_name }}
|
||||
ref: ${{ github.event.pull_request.head.ref }}
|
||||
|
||||
- name: Check out repository code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
@@ -14,6 +14,7 @@ jobs:
|
||||
if: github.event_name == 'pull_request'
|
||||
with:
|
||||
repository: ${{ github.event.pull_request.head.repo.full_name }}
|
||||
ref: ${{ github.event.pull_request.head.ref }}
|
||||
|
||||
- name: Check out repository code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
1
.github/workflows/hls-tests.yml
vendored
1
.github/workflows/hls-tests.yml
vendored
@@ -30,6 +30,7 @@ jobs:
|
||||
if: github.event_name == 'pull_request'
|
||||
with:
|
||||
repository: ${{ github.event.pull_request.head.repo.full_name }}
|
||||
ref: ${{ github.event.pull_request.head.ref }}
|
||||
|
||||
- name: Check out repository code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
@@ -121,6 +121,7 @@ jobs:
|
||||
if: github.event_name == 'pull_request'
|
||||
with:
|
||||
repository: ${{ github.event.pull_request.head.repo.full_name }}
|
||||
ref: ${{ github.event.pull_request.head.ref }}
|
||||
|
||||
- name: Check out repository code
|
||||
uses: actions/checkout@v4
|
||||
@@ -191,6 +192,7 @@ jobs:
|
||||
if: github.event_name == 'pull_request'
|
||||
with:
|
||||
repository: ${{ github.event.pull_request.head.repo.full_name }}
|
||||
ref: ${{ github.event.pull_request.head.ref }}
|
||||
|
||||
- name: Check out repository code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
62
.github/workflows/translations.yml
vendored
Normal file
62
.github/workflows/translations.yml
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
name: Translation job
|
||||
|
||||
on:
|
||||
schedule:
|
||||
# Run the workflow every hour
|
||||
- cron: '0 * * * *'
|
||||
push:
|
||||
paths:
|
||||
- 'web/i18n/en/translation.json'
|
||||
- 'web/**/*.tsx'
|
||||
- 'web/**/*.js'
|
||||
- 'crowdin.yml'
|
||||
- '.github/workflows/translations.yml'
|
||||
- 'web/i18next-parser.config.mjs'
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
generate-translations:
|
||||
defaults:
|
||||
run:
|
||||
working-directory: ./web
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Install dependencies
|
||||
if: ${{ github.actor != 'renovate[bot]' && github.actor != 'renovate' }}
|
||||
run: npm install
|
||||
|
||||
- name: Generate translation files
|
||||
run: npm run translate
|
||||
|
||||
- name: Crowdin upload sources/download translations
|
||||
uses: crowdin/github-action@v1
|
||||
with:
|
||||
upload_sources: true
|
||||
download_translations: true
|
||||
create_pull_request: true
|
||||
pull_request_title: 'New Translations'
|
||||
localization_branch_name: translations
|
||||
pull_request_base_branch_name: 'develop'
|
||||
commit_message: 'Updated translations'
|
||||
config: crowdin.yml
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }}
|
||||
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}
|
||||
|
||||
# - name: Commit changes
|
||||
# uses: EndBug/add-and-commit@v9
|
||||
# with:
|
||||
# author_name: Owncast
|
||||
# author_email: owncast@owncast.online
|
||||
# message: 'Commit updated translations'
|
||||
# add: 'web/i18n/**'
|
||||
# env:
|
||||
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -4,6 +4,7 @@
|
||||
*.dll
|
||||
*.so
|
||||
*.dylib
|
||||
.DS_Store
|
||||
|
||||
# Test binary, built with `go test -c`
|
||||
*.test
|
||||
|
||||
@@ -22,7 +22,7 @@ ENV NAME=${NAME}
|
||||
RUN CGO_ENABLED=1 GOOS=linux go build -a -installsuffix cgo -ldflags "-extldflags \"-static\" -s -w -X github.com/owncast/owncast/config.GitCommit=$GIT_COMMIT -X github.com/owncast/owncast/config.VersionNumber=$VERSION -X github.com/owncast/owncast/config.BuildPlatform=$NAME" -o owncast .
|
||||
|
||||
# Create the image by copying the result of the build into a new alpine image
|
||||
FROM alpine:3.21.2
|
||||
FROM alpine:3.21.3
|
||||
RUN apk update && apk add --no-cache ffmpeg ffmpeg-libs ca-certificates && update-ca-certificates
|
||||
|
||||
RUN addgroup -g 101 -S owncast && adduser -u 101 -S owncast -G owncast
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
VERSION --new-platform 0.6
|
||||
|
||||
FROM --platform=linux/amd64 alpine:3.21.2
|
||||
FROM --platform=linux/amd64 alpine:3.21.3
|
||||
ARG version=develop
|
||||
|
||||
WORKDIR /build
|
||||
@@ -119,7 +119,7 @@ docker:
|
||||
# in as space separated strings using the full account/repo:tag format.
|
||||
# https://github.com/earthly/earthly/blob/aea38448fa9c0064b1b70d61be717ae740689fb9/docs/earthfile/earthfile.md#assigning-multiple-image-names
|
||||
ARG TARGETPLATFORM
|
||||
FROM --platform=$TARGETPLATFORM alpine:3.21.2
|
||||
FROM --platform=$TARGETPLATFORM alpine:3.21.3
|
||||
RUN apk update && apk add --no-cache ffmpeg ffmpeg-libs ca-certificates unzip && update-ca-certificates
|
||||
RUN addgroup -g 101 -S owncast && adduser -u 101 -S owncast -G owncast
|
||||
WORKDIR /app
|
||||
|
||||
@@ -47,7 +47,7 @@ func handleFollowInboxRequest(c context.Context, activity vocab.ActivityStreamsF
|
||||
}
|
||||
}
|
||||
|
||||
// Save as an accepted activity
|
||||
// Save as an activity
|
||||
actorReference := activity.GetActivityStreamsActor()
|
||||
object := activity.GetActivityStreamsObject()
|
||||
objectIRI := object.At(0).GetIRI().String()
|
||||
|
||||
@@ -3,6 +3,7 @@ package persistence
|
||||
import (
|
||||
"context"
|
||||
"database/sql"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"net/url"
|
||||
"time"
|
||||
@@ -74,6 +75,27 @@ func GetFollower(iri string) (*apmodels.ActivityPubActor, error) {
|
||||
return nil, errors.Wrap(err, "error parsing acting inbox")
|
||||
}
|
||||
|
||||
requestObjectBytes := result.RequestObject
|
||||
var followRequestObject vocab.ActivityStreamsFollow
|
||||
|
||||
resolver, err := streams.NewJSONResolver(func(c context.Context, followObject vocab.ActivityStreamsFollow) error {
|
||||
followRequestObject = followObject
|
||||
return nil
|
||||
})
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "error creating JSON resolver")
|
||||
}
|
||||
jsonMap := make(map[string]interface{})
|
||||
err = json.Unmarshal(requestObjectBytes, &jsonMap)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "error unmarshaling follow request object")
|
||||
}
|
||||
|
||||
err = resolver.Resolve(context.Background(), jsonMap)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "error resolving follow request object")
|
||||
}
|
||||
|
||||
image, _ := url.Parse(result.Image.String)
|
||||
|
||||
var disabledAt *time.Time
|
||||
@@ -89,6 +111,7 @@ func GetFollower(iri string) (*apmodels.ActivityPubActor, error) {
|
||||
Image: image,
|
||||
FollowRequestIri: followIRI,
|
||||
DisabledAt: disabledAt,
|
||||
RequestObject: followRequestObject,
|
||||
}
|
||||
|
||||
return &follower, nil
|
||||
|
||||
@@ -4,7 +4,7 @@ import "path/filepath"
|
||||
|
||||
const (
|
||||
// StaticVersionNumber is the version of Owncast that is used when it's not overwritten via build-time settings.
|
||||
StaticVersionNumber = "0.2.1" // Shown when you build from develop
|
||||
StaticVersionNumber = "0.2.2" // Shown when you build from develop
|
||||
// FfmpegSuggestedVersion is the version of ffmpeg we suggest.
|
||||
FfmpegSuggestedVersion = "v4.1.5" // Requires the v
|
||||
// DataDirectory is the directory we save data to.
|
||||
|
||||
@@ -4,6 +4,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/owncast/owncast/models"
|
||||
"github.com/owncast/owncast/webserver/handlers/generated"
|
||||
)
|
||||
|
||||
// Defaults will hold default configuration values.
|
||||
@@ -25,7 +26,7 @@ type Defaults struct {
|
||||
WebServerIP string
|
||||
Name string
|
||||
AdminPassword string
|
||||
StreamKeys []models.StreamKey
|
||||
StreamKeys []generated.StreamKey
|
||||
|
||||
StreamVariants []models.StreamOutputVariant
|
||||
|
||||
@@ -43,14 +44,16 @@ type Defaults struct {
|
||||
|
||||
// GetDefaults will return default configuration values.
|
||||
func GetDefaults() Defaults {
|
||||
defaultStreamKey := "abc123"
|
||||
defaultStreamKeyComment := "Default stream key"
|
||||
return Defaults{
|
||||
Name: "New Owncast Server",
|
||||
Summary: "This is a new live video streaming server powered by Owncast.",
|
||||
ServerWelcomeMessage: "",
|
||||
Logo: "logo.svg",
|
||||
AdminPassword: "abc123",
|
||||
StreamKeys: []models.StreamKey{
|
||||
{Key: "abc123", Comment: "Default stream key"},
|
||||
StreamKeys: []generated.StreamKey{
|
||||
{Key: &defaultStreamKey, Comment: &defaultStreamKeyComment},
|
||||
},
|
||||
Tags: []string{
|
||||
"owncast",
|
||||
|
||||
@@ -8,6 +8,7 @@ import (
|
||||
"github.com/owncast/owncast/config"
|
||||
"github.com/owncast/owncast/core/chat/events"
|
||||
"github.com/owncast/owncast/models"
|
||||
"github.com/owncast/owncast/persistence/chatmessagerepository"
|
||||
"github.com/owncast/owncast/persistence/configrepository"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
"github.com/prometheus/client_golang/prometheus/promauto"
|
||||
@@ -103,7 +104,8 @@ func SendSystemMessage(text string, ephemeral bool) error {
|
||||
}
|
||||
|
||||
if !ephemeral {
|
||||
saveEvent(message.ID, nil, message.Body, message.GetMessageType(), nil, message.Timestamp, nil, nil, nil, nil)
|
||||
chatMessageRepository := chatmessagerepository.Get()
|
||||
chatMessageRepository.SaveEvent(message.ID, nil, message.Body, message.GetMessageType(), nil, message.Timestamp, nil, nil, nil, nil)
|
||||
}
|
||||
|
||||
return nil
|
||||
@@ -131,7 +133,8 @@ func SendFediverseAction(eventType string, userAccountName string, image *string
|
||||
return err
|
||||
}
|
||||
|
||||
saveFederatedAction(message)
|
||||
chatMessageRepository := chatmessagerepository.Get()
|
||||
chatMessageRepository.SaveFederatedAction(message)
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -152,7 +155,8 @@ func SendSystemAction(text string, ephemeral bool) error {
|
||||
}
|
||||
|
||||
if !ephemeral {
|
||||
saveEvent(message.ID, nil, message.Body, message.GetMessageType(), nil, message.Timestamp, nil, nil, nil, nil)
|
||||
chatMessageRepository := chatmessagerepository.Get()
|
||||
chatMessageRepository.SaveEvent(message.ID, nil, message.Body, message.GetMessageType(), nil, message.Timestamp, nil, nil, nil, nil)
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
@@ -9,6 +9,7 @@ import (
|
||||
"github.com/owncast/owncast/config"
|
||||
"github.com/owncast/owncast/core/chat/events"
|
||||
"github.com/owncast/owncast/core/webhooks"
|
||||
"github.com/owncast/owncast/persistence/chatmessagerepository"
|
||||
"github.com/owncast/owncast/persistence/configrepository"
|
||||
"github.com/owncast/owncast/persistence/userrepository"
|
||||
"github.com/owncast/owncast/utils"
|
||||
@@ -172,8 +173,8 @@ func (s *Server) userMessageSent(eventData chatClientEvent) {
|
||||
// Send chat message sent webhook
|
||||
webhooks.SendChatEvent(&event)
|
||||
chatMessagesSentCounter.Inc()
|
||||
|
||||
SaveUserMessage(event)
|
||||
chatMessageRepository := chatmessagerepository.Get()
|
||||
chatMessageRepository.SaveUserMessage(event)
|
||||
eventData.client.MessageCount++
|
||||
}
|
||||
|
||||
|
||||
@@ -162,9 +162,9 @@ func loadEmoji() {
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
emojiHTML[strings.ToLower(emojiList[i].Name)] = buf.String()
|
||||
emojiHTML[strings.ToLower(*emojiList[i].Name)] = buf.String()
|
||||
|
||||
emoji := emojiDef.NewEmoji(emojiList[i].Name, nil, strings.ToLower(emojiList[i].Name))
|
||||
emoji := emojiDef.NewEmoji(*emojiList[i].Name, nil, strings.ToLower(*emojiList[i].Name))
|
||||
emojiArr = append(emojiArr, emoji)
|
||||
}
|
||||
|
||||
|
||||
@@ -5,13 +5,15 @@ import (
|
||||
|
||||
"github.com/owncast/owncast/core/chat/events"
|
||||
"github.com/owncast/owncast/core/webhooks"
|
||||
"github.com/owncast/owncast/persistence/chatmessagerepository"
|
||||
log "github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
// SetMessagesVisibility will set the visibility of multiple messages by ID.
|
||||
func SetMessagesVisibility(messageIDs []string, visibility bool) error {
|
||||
// Save new message visibility
|
||||
if err := saveMessageVisibility(messageIDs, visibility); err != nil {
|
||||
chatMessageRepository := chatmessagerepository.Get()
|
||||
if err := chatMessageRepository.SetMessageVisibilityForMessageIDs(messageIDs, visibility); err != nil {
|
||||
log.Errorln(err)
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -1,25 +1,17 @@
|
||||
package chat
|
||||
|
||||
import (
|
||||
"context"
|
||||
"database/sql"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/owncast/owncast/core/chat/events"
|
||||
"github.com/owncast/owncast/core/data"
|
||||
"github.com/owncast/owncast/models"
|
||||
"github.com/owncast/owncast/persistence/authrepository"
|
||||
"github.com/owncast/owncast/persistence/tables"
|
||||
|
||||
log "github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
var _datastore *data.Datastore
|
||||
|
||||
const (
|
||||
maxBacklogHours = 2 // Keep backlog max hours worth of messages
|
||||
maxBacklogNumber = 50 // Return max number of messages in history request
|
||||
maxBacklogHours = 2 // Keep backlog max hours worth of messages
|
||||
)
|
||||
|
||||
func setupPersistence() {
|
||||
@@ -37,456 +29,3 @@ func setupPersistence() {
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
// SaveUserMessage will save a single chat event to the messages database.
|
||||
func SaveUserMessage(event events.UserMessageEvent) {
|
||||
saveEvent(event.ID, &event.User.ID, event.Body, event.Type, event.HiddenAt, event.Timestamp, nil, nil, nil, nil)
|
||||
}
|
||||
|
||||
func saveFederatedAction(event events.FediverseEngagementEvent) {
|
||||
saveEvent(event.ID, nil, event.Body, event.Type, nil, event.Timestamp, event.Image, &event.Link, &event.UserAccountName, nil)
|
||||
}
|
||||
|
||||
// nolint: unparam
|
||||
func saveEvent(id string, userID *string, body string, eventType string, hidden *time.Time, timestamp time.Time, image *string, link *string, title *string, subtitle *string) {
|
||||
defer func() {
|
||||
_historyCache = nil
|
||||
}()
|
||||
|
||||
tx, err := _datastore.DB.Begin()
|
||||
if err != nil {
|
||||
log.Errorln("error saving", eventType, err)
|
||||
return
|
||||
}
|
||||
|
||||
defer tx.Rollback() // nolint
|
||||
|
||||
stmt, err := tx.Prepare("INSERT INTO messages(id, user_id, body, eventType, hidden_at, timestamp, image, link, title, subtitle) values(?, ?, ?, ?, ?, ?, ?, ?, ?, ?)")
|
||||
if err != nil {
|
||||
log.Errorln("error saving", eventType, err)
|
||||
return
|
||||
}
|
||||
|
||||
defer stmt.Close()
|
||||
|
||||
if _, err = stmt.Exec(id, userID, body, eventType, hidden, timestamp, image, link, title, subtitle); err != nil {
|
||||
log.Errorln("error saving", eventType, err)
|
||||
return
|
||||
}
|
||||
if err = tx.Commit(); err != nil {
|
||||
log.Errorln("error saving", eventType, err)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
func makeUserMessageEventFromRowData(row rowData) events.UserMessageEvent {
|
||||
scopes := ""
|
||||
if row.userScopes != nil {
|
||||
scopes = *row.userScopes
|
||||
}
|
||||
|
||||
previousUsernames := []string{}
|
||||
if row.previousUsernames != nil {
|
||||
previousUsernames = strings.Split(*row.previousUsernames, ",")
|
||||
}
|
||||
|
||||
displayName := ""
|
||||
if row.userDisplayName != nil {
|
||||
displayName = *row.userDisplayName
|
||||
}
|
||||
|
||||
displayColor := 0
|
||||
if row.userDisplayColor != nil {
|
||||
displayColor = *row.userDisplayColor
|
||||
}
|
||||
|
||||
createdAt := time.Time{}
|
||||
if row.userCreatedAt != nil {
|
||||
createdAt = *row.userCreatedAt
|
||||
}
|
||||
|
||||
isBot := (row.userType != nil && *row.userType == "API")
|
||||
scopeSlice := strings.Split(scopes, ",")
|
||||
|
||||
u := models.User{
|
||||
ID: *row.userID,
|
||||
DisplayName: displayName,
|
||||
DisplayColor: displayColor,
|
||||
CreatedAt: createdAt,
|
||||
DisabledAt: row.userDisabledAt,
|
||||
NameChangedAt: row.userNameChangedAt,
|
||||
PreviousNames: previousUsernames,
|
||||
AuthenticatedAt: row.userAuthenticatedAt,
|
||||
Authenticated: row.userAuthenticatedAt != nil,
|
||||
Scopes: scopeSlice,
|
||||
IsBot: isBot,
|
||||
}
|
||||
|
||||
message := events.UserMessageEvent{
|
||||
Event: events.Event{
|
||||
Type: row.eventType,
|
||||
ID: row.id,
|
||||
Timestamp: row.timestamp,
|
||||
},
|
||||
UserEvent: events.UserEvent{
|
||||
User: &u,
|
||||
HiddenAt: row.hiddenAt,
|
||||
},
|
||||
MessageEvent: events.MessageEvent{
|
||||
Body: row.body,
|
||||
RawBody: row.body,
|
||||
},
|
||||
}
|
||||
|
||||
return message
|
||||
}
|
||||
|
||||
func makeSystemMessageChatEventFromRowData(row rowData) events.SystemMessageEvent {
|
||||
message := events.SystemMessageEvent{
|
||||
Event: events.Event{
|
||||
Type: row.eventType,
|
||||
ID: row.id,
|
||||
Timestamp: row.timestamp,
|
||||
},
|
||||
MessageEvent: events.MessageEvent{
|
||||
Body: row.body,
|
||||
RawBody: row.body,
|
||||
},
|
||||
}
|
||||
return message
|
||||
}
|
||||
|
||||
func makeActionMessageChatEventFromRowData(row rowData) events.ActionEvent {
|
||||
message := events.ActionEvent{
|
||||
Event: events.Event{
|
||||
Type: row.eventType,
|
||||
ID: row.id,
|
||||
Timestamp: row.timestamp,
|
||||
},
|
||||
MessageEvent: events.MessageEvent{
|
||||
Body: row.body,
|
||||
RawBody: row.body,
|
||||
},
|
||||
}
|
||||
return message
|
||||
}
|
||||
|
||||
func makeFederatedActionChatEventFromRowData(row rowData) events.FediverseEngagementEvent {
|
||||
message := events.FediverseEngagementEvent{
|
||||
Event: events.Event{
|
||||
Type: row.eventType,
|
||||
ID: row.id,
|
||||
Timestamp: row.timestamp,
|
||||
},
|
||||
MessageEvent: events.MessageEvent{
|
||||
Body: row.body,
|
||||
RawBody: row.body,
|
||||
},
|
||||
Image: row.image,
|
||||
Link: *row.link,
|
||||
UserAccountName: *row.title,
|
||||
}
|
||||
return message
|
||||
}
|
||||
|
||||
type rowData struct {
|
||||
timestamp time.Time
|
||||
image *string
|
||||
previousUsernames *string
|
||||
|
||||
userDisplayName *string
|
||||
userDisplayColor *int
|
||||
userID *string
|
||||
title *string
|
||||
subtitle *string
|
||||
link *string
|
||||
|
||||
userType *string
|
||||
userScopes *string
|
||||
hiddenAt *time.Time
|
||||
userCreatedAt *time.Time
|
||||
userDisabledAt *time.Time
|
||||
userAuthenticatedAt *time.Time
|
||||
userNameChangedAt *time.Time
|
||||
body string
|
||||
eventType models.EventType
|
||||
id string
|
||||
}
|
||||
|
||||
func getChat(rows *sql.Rows) ([]interface{}, error) {
|
||||
history := make([]interface{}, 0)
|
||||
|
||||
for rows.Next() {
|
||||
row := rowData{}
|
||||
|
||||
// Convert a database row into a chat event
|
||||
if err := rows.Scan(
|
||||
&row.id,
|
||||
&row.userID,
|
||||
&row.body,
|
||||
&row.title,
|
||||
&row.subtitle,
|
||||
&row.image,
|
||||
&row.link,
|
||||
&row.eventType,
|
||||
&row.hiddenAt,
|
||||
&row.timestamp,
|
||||
&row.userDisplayName,
|
||||
&row.userDisplayColor,
|
||||
&row.userCreatedAt,
|
||||
&row.userDisabledAt,
|
||||
&row.previousUsernames,
|
||||
&row.userNameChangedAt,
|
||||
&row.userAuthenticatedAt,
|
||||
&row.userScopes,
|
||||
&row.userType,
|
||||
); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var message interface{}
|
||||
|
||||
switch row.eventType {
|
||||
case events.MessageSent:
|
||||
message = makeUserMessageEventFromRowData(row)
|
||||
case events.SystemMessageSent:
|
||||
message = makeSystemMessageChatEventFromRowData(row)
|
||||
case events.ChatActionSent:
|
||||
message = makeActionMessageChatEventFromRowData(row)
|
||||
case events.FediverseEngagementFollow:
|
||||
message = makeFederatedActionChatEventFromRowData(row)
|
||||
case events.FediverseEngagementLike:
|
||||
message = makeFederatedActionChatEventFromRowData(row)
|
||||
case events.FediverseEngagementRepost:
|
||||
message = makeFederatedActionChatEventFromRowData(row)
|
||||
}
|
||||
|
||||
history = append(history, message)
|
||||
}
|
||||
|
||||
return history, nil
|
||||
}
|
||||
|
||||
var _historyCache *[]interface{}
|
||||
|
||||
// GetChatModerationHistory will return all the chat messages suitable for moderation purposes.
|
||||
func GetChatModerationHistory() []interface{} {
|
||||
if _historyCache != nil {
|
||||
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"
|
||||
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 := "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 {
|
||||
m[i], m[j] = m[j], m[i]
|
||||
}
|
||||
|
||||
return m
|
||||
}
|
||||
|
||||
// GetMessagesFromUser returns chat messages that were sent by a specific user.
|
||||
func GetMessagesFromUser(userID string) ([]events.UserMessageEvent, error) {
|
||||
query, err := _datastore.GetQueries().GetMessagesFromUser(context.Background(), sql.NullString{String: userID, Valid: true})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
results := make([]events.UserMessageEvent, len(query))
|
||||
for i, row := range query {
|
||||
results[i] = events.UserMessageEvent{
|
||||
Event: events.Event{
|
||||
Timestamp: row.Timestamp.Time,
|
||||
ID: row.ID,
|
||||
},
|
||||
MessageEvent: events.MessageEvent{
|
||||
Body: row.Body.String,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
return results, nil
|
||||
}
|
||||
|
||||
// SetMessageVisibilityForUserID will bulk change the visibility of messages for a user
|
||||
// and then send out visibility changed events to chat clients.
|
||||
func SetMessageVisibilityForUserID(userID string, visible bool) error {
|
||||
defer func() {
|
||||
_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)
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
for _, message := range messages {
|
||||
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)
|
||||
}
|
||||
|
||||
func saveMessageVisibility(messageIDs []string, visible bool) error {
|
||||
defer func() {
|
||||
_historyCache = nil
|
||||
}()
|
||||
|
||||
_datastore.DbLock.Lock()
|
||||
defer _datastore.DbLock.Unlock()
|
||||
|
||||
tx, err := _datastore.DB.Begin()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// nolint:gosec
|
||||
stmt, err := tx.Prepare("UPDATE messages SET hidden_at=? WHERE id IN (?" + strings.Repeat(",?", len(messageIDs)-1) + ")")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer stmt.Close()
|
||||
|
||||
var hiddenAt *time.Time
|
||||
if !visible {
|
||||
now := time.Now()
|
||||
hiddenAt = &now
|
||||
} else {
|
||||
hiddenAt = nil
|
||||
}
|
||||
|
||||
args := make([]interface{}, len(messageIDs)+1)
|
||||
args[0] = hiddenAt
|
||||
for i, id := range messageIDs {
|
||||
args[i+1] = id
|
||||
}
|
||||
|
||||
if _, err = stmt.Exec(args...); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err = tx.Commit(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -75,7 +75,8 @@ func SetupPersistence(file string) error {
|
||||
_, _ = db.Exec("pragma temp_store = memory")
|
||||
_, _ = db.Exec("pragma wal_checkpoint(full)")
|
||||
|
||||
createWebhooksTable()
|
||||
tables.CreateConfigTable(db)
|
||||
tables.CreateWebhooksTable(db)
|
||||
tables.CreateUsersTable(db)
|
||||
tables.CreateAccessTokenTable(db)
|
||||
|
||||
|
||||
@@ -107,19 +107,11 @@ func (ds *Datastore) Save(e models.ConfigEntry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Setup will create the datastore table and perform initial initialization.
|
||||
// Setup will perform initial initialization.
|
||||
func (ds *Datastore) Setup() {
|
||||
ds.cache = make(map[string][]byte)
|
||||
ds.DB = GetDatabase()
|
||||
ds.DbLock = &sync.Mutex{}
|
||||
|
||||
createTableSQL := `CREATE TABLE IF NOT EXISTS datastore (
|
||||
"key" string NOT NULL PRIMARY KEY,
|
||||
"value" BLOB,
|
||||
"timestamp" DATE DEFAULT CURRENT_TIMESTAMP NOT NULL
|
||||
);`
|
||||
|
||||
ds.MustExec(createTableSQL)
|
||||
}
|
||||
|
||||
// Reset will delete all config entries in the datastore and start over.
|
||||
|
||||
@@ -10,16 +10,16 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/owncast/owncast/config"
|
||||
"github.com/owncast/owncast/models"
|
||||
"github.com/owncast/owncast/static"
|
||||
"github.com/owncast/owncast/utils"
|
||||
"github.com/owncast/owncast/webserver/handlers/generated"
|
||||
"github.com/pkg/errors"
|
||||
log "github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
var (
|
||||
emojiCacheMu sync.Mutex
|
||||
emojiCacheData = make([]models.CustomEmoji, 0)
|
||||
emojiCacheData = make([]generated.Emoji, 0)
|
||||
emojiCacheModTime time.Time
|
||||
)
|
||||
|
||||
@@ -51,7 +51,7 @@ func UpdateEmojiList(force bool) (time.Time, error) {
|
||||
return modTime, fmt.Errorf("unable to open custom emoji directory")
|
||||
}
|
||||
|
||||
emojiCacheData = make([]models.CustomEmoji, 0)
|
||||
emojiCacheData = make([]generated.Emoji, 0)
|
||||
|
||||
walkFunction := func(path string, d os.DirEntry, err error) error {
|
||||
if d == nil || d.IsDir() {
|
||||
@@ -61,7 +61,7 @@ func UpdateEmojiList(force bool) (time.Time, error) {
|
||||
emojiPath := filepath.Join(config.EmojiDir, path)
|
||||
fileName := d.Name()
|
||||
fileBase := fileName[:len(fileName)-len(filepath.Ext(fileName))]
|
||||
singleEmoji := models.CustomEmoji{Name: fileBase, URL: emojiPath}
|
||||
singleEmoji := generated.Emoji{Name: &fileBase, Url: &emojiPath}
|
||||
emojiCacheData = append(emojiCacheData, singleEmoji)
|
||||
return nil
|
||||
}
|
||||
@@ -76,7 +76,7 @@ func UpdateEmojiList(force bool) (time.Time, error) {
|
||||
}
|
||||
|
||||
// GetEmojiList returns a list of custom emoji from the emoji directory.
|
||||
func GetEmojiList() []models.CustomEmoji {
|
||||
func GetEmojiList() []generated.Emoji {
|
||||
_, err := UpdateEmojiList(false)
|
||||
if err != nil {
|
||||
return nil
|
||||
@@ -88,7 +88,7 @@ func GetEmojiList() []models.CustomEmoji {
|
||||
|
||||
// return a copy of cache data, ensures underlying slice isn't affected
|
||||
// by future update
|
||||
emojiData := make([]models.CustomEmoji, len(emojiCacheData))
|
||||
emojiData := make([]generated.Emoji, len(emojiCacheData))
|
||||
copy(emojiData, emojiCacheData)
|
||||
|
||||
return emojiData
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
package data
|
||||
|
||||
// GetMessagesCount will return the number of messages in the database.
|
||||
func GetMessagesCount() int64 {
|
||||
query := `SELECT COUNT(*) FROM messages`
|
||||
rows, err := _db.Query(query)
|
||||
if err != nil || rows.Err() != nil {
|
||||
return 0
|
||||
}
|
||||
defer rows.Close()
|
||||
var count int64
|
||||
for rows.Next() {
|
||||
if err := rows.Scan(&count); err != nil {
|
||||
return 0
|
||||
}
|
||||
}
|
||||
return count
|
||||
}
|
||||
@@ -14,6 +14,7 @@ import (
|
||||
"github.com/owncast/owncast/config"
|
||||
"github.com/owncast/owncast/models"
|
||||
"github.com/owncast/owncast/persistence/configrepository"
|
||||
"github.com/owncast/owncast/webserver/handlers/generated"
|
||||
)
|
||||
|
||||
var _hasInboundRTMPConnection = false
|
||||
@@ -87,11 +88,11 @@ func HandleConn(c *rtmp.Conn, nc net.Conn) {
|
||||
|
||||
// If a stream key override was specified then use that instead.
|
||||
if config.TemporaryStreamKey != "" {
|
||||
validStreamingKeys = []models.StreamKey{{Key: config.TemporaryStreamKey}}
|
||||
validStreamingKeys = []generated.StreamKey{{Key: &config.TemporaryStreamKey}}
|
||||
}
|
||||
|
||||
for _, key := range validStreamingKeys {
|
||||
if secretMatch(key.Key, c.URL.Path) {
|
||||
if key.Key != nil && secretMatch(*key.Key, c.URL.Path) {
|
||||
accessGranted = true
|
||||
break
|
||||
}
|
||||
|
||||
@@ -229,8 +229,7 @@ func (t *Transcoder) getString() string {
|
||||
"-hls_segment_filename", localListenerAddress + "/%v/stream-" + t.segmentIdentifier + "-%d.ts", // Send HLS segments back to us over HTTP
|
||||
"-max_muxing_queue_size", "400", // Workaround for Too many packets error: https://trac.ffmpeg.org/ticket/6375?cversion=0
|
||||
|
||||
"-method PUT", // HLS results sent back to us will be over PUTs
|
||||
"-http_persistent", "1", // Ensures persistent HTTP connections
|
||||
"-method PUT", // HLS results sent back to us will be over PUTs
|
||||
|
||||
localListenerAddress + "/%v/stream.m3u8", // Send HLS playlists back to us over HTTP
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ func TestFFmpegNvencCommand(t *testing.T) {
|
||||
cmd := transcoder.getString()
|
||||
|
||||
expectedLogPath := filepath.Join("data", "logs", "transcoder.log")
|
||||
expected := `FFREPORT=file="` + expectedLogPath + `":level=32 ` + transcoder.ffmpegPath + ` -hide_banner -loglevel warning -hwaccel cuda -fflags +genpts -flags +cgop -i fakecontent.flv -map v:0 -c:v:0 h264_nvenc -b:v:0 1008k -maxrate:v:0 1088k -g:v:0 90 -keyint_min:v:0 90 -r:v:0 30 -tune:v:0 ll -map a:0? -c:a:0 copy -preset p3 -map v:0 -c:v:1 h264_nvenc -b:v:1 3308k -maxrate:v:1 3572k -g:v:1 72 -keyint_min:v:1 72 -r:v:1 24 -tune:v:1 ll -map a:0? -c:a:1 copy -preset p5 -map v:0 -c:v:2 copy -map a:0? -c:a:2 copy -preset p1 -var_stream_map "v:0,a:0 v:1,a:1 v:2,a:2 " -f hls -hls_time 3 -hls_list_size 10 -hls_flags program_date_time+independent_segments+omit_endlist -segment_format_options mpegts_flags=mpegts_copyts=1 -pix_fmt yuv420p -sc_threshold 0 -master_pl_name stream.m3u8 -hls_segment_filename http://127.0.0.1:8123/%v/stream-jdoieGg-%d.ts -max_muxing_queue_size 400 -method PUT -http_persistent 1 http://127.0.0.1:8123/%v/stream.m3u8`
|
||||
expected := `FFREPORT=file="` + expectedLogPath + `":level=32 ` + transcoder.ffmpegPath + ` -hide_banner -loglevel warning -hwaccel cuda -fflags +genpts -flags +cgop -i fakecontent.flv -map v:0 -c:v:0 h264_nvenc -b:v:0 1008k -maxrate:v:0 1088k -g:v:0 90 -keyint_min:v:0 90 -r:v:0 30 -tune:v:0 ll -map a:0? -c:a:0 copy -preset p3 -map v:0 -c:v:1 h264_nvenc -b:v:1 3308k -maxrate:v:1 3572k -g:v:1 72 -keyint_min:v:1 72 -r:v:1 24 -tune:v:1 ll -map a:0? -c:a:1 copy -preset p5 -map v:0 -c:v:2 copy -map a:0? -c:a:2 copy -preset p1 -var_stream_map "v:0,a:0 v:1,a:1 v:2,a:2 " -f hls -hls_time 3 -hls_list_size 10 -hls_flags program_date_time+independent_segments+omit_endlist -segment_format_options mpegts_flags=mpegts_copyts=1 -pix_fmt yuv420p -sc_threshold 0 -master_pl_name stream.m3u8 -hls_segment_filename http://127.0.0.1:8123/%v/stream-jdoieGg-%d.ts -max_muxing_queue_size 400 -method PUT http://127.0.0.1:8123/%v/stream.m3u8`
|
||||
|
||||
if cmd != expected {
|
||||
t.Errorf("ffmpeg command does not match expected.\nGot %s\n, want: %s", cmd, expected)
|
||||
|
||||
@@ -42,7 +42,7 @@ func TestFFmpegOmxCommand(t *testing.T) {
|
||||
cmd := transcoder.getString()
|
||||
|
||||
expectedLogPath := filepath.Join("data", "logs", "transcoder.log")
|
||||
expected := `FFREPORT=file="` + expectedLogPath + `":level=32 ` + transcoder.ffmpegPath + ` -hide_banner -loglevel warning -fflags +genpts -flags +cgop -i fakecontent.flv -map v:0 -c:v:0 h264_omx -b:v:0 1008k -maxrate:v:0 1088k -g:v:0 90 -keyint_min:v:0 90 -r:v:0 30 -map a:0? -c:a:0 copy -preset veryfast -map v:0 -c:v:1 h264_omx -b:v:1 3308k -maxrate:v:1 3572k -g:v:1 72 -keyint_min:v:1 72 -r:v:1 24 -map a:0? -c:a:1 copy -preset fast -map v:0 -c:v:2 copy -map a:0? -c:a:2 copy -preset ultrafast -var_stream_map "v:0,a:0 v:1,a:1 v:2,a:2 " -f hls -hls_time 3 -hls_list_size 10 -hls_flags program_date_time+independent_segments+omit_endlist -segment_format_options mpegts_flags=mpegts_copyts=1 -tune zerolatency -pix_fmt yuv420p -sc_threshold 0 -master_pl_name stream.m3u8 -hls_segment_filename http://127.0.0.1:8123/%v/stream-jdFsdfzGg-%d.ts -max_muxing_queue_size 400 -method PUT -http_persistent 1 http://127.0.0.1:8123/%v/stream.m3u8`
|
||||
expected := `FFREPORT=file="` + expectedLogPath + `":level=32 ` + transcoder.ffmpegPath + ` -hide_banner -loglevel warning -fflags +genpts -flags +cgop -i fakecontent.flv -map v:0 -c:v:0 h264_omx -b:v:0 1008k -maxrate:v:0 1088k -g:v:0 90 -keyint_min:v:0 90 -r:v:0 30 -map a:0? -c:a:0 copy -preset veryfast -map v:0 -c:v:1 h264_omx -b:v:1 3308k -maxrate:v:1 3572k -g:v:1 72 -keyint_min:v:1 72 -r:v:1 24 -map a:0? -c:a:1 copy -preset fast -map v:0 -c:v:2 copy -map a:0? -c:a:2 copy -preset ultrafast -var_stream_map "v:0,a:0 v:1,a:1 v:2,a:2 " -f hls -hls_time 3 -hls_list_size 10 -hls_flags program_date_time+independent_segments+omit_endlist -segment_format_options mpegts_flags=mpegts_copyts=1 -tune zerolatency -pix_fmt yuv420p -sc_threshold 0 -master_pl_name stream.m3u8 -hls_segment_filename http://127.0.0.1:8123/%v/stream-jdFsdfzGg-%d.ts -max_muxing_queue_size 400 -method PUT http://127.0.0.1:8123/%v/stream.m3u8`
|
||||
|
||||
if cmd != expected {
|
||||
t.Errorf("ffmpeg command does not match expected.\nGot %s\n, want: %s", cmd, expected)
|
||||
|
||||
@@ -42,7 +42,7 @@ func TestFFmpegQuicksyncCommand(t *testing.T) {
|
||||
cmd := transcoder.getString()
|
||||
|
||||
expectedLogPath := filepath.Join("data", "logs", "transcoder.log")
|
||||
expected := `FFREPORT=file="` + expectedLogPath + `":level=32 ` + transcoder.ffmpegPath + ` -hide_banner -loglevel warning -init_hw_device qsv=hw -filter_hw_device hw -fflags +genpts -flags +cgop -i fakecontent.flv -map v:0 -c:v:0 h264_qsv -b:v:0 1008k -maxrate:v:0 1088k -g:v:0 90 -keyint_min:v:0 90 -r:v:0 30 -map a:0? -c:a:0 copy -filter:v:0 "hwupload=extra_hw_frames=64,format=qsv" -preset medium -map v:0 -c:v:1 h264_qsv -b:v:1 3308k -maxrate:v:1 3572k -g:v:1 72 -keyint_min:v:1 72 -r:v:1 24 -map a:0? -c:a:1 copy -filter:v:1 "hwupload=extra_hw_frames=64,format=qsv" -preset veryslow -map v:0 -c:v:2 copy -map a:0? -c:a:2 copy -preset veryfast -var_stream_map "v:0,a:0 v:1,a:1 v:2,a:2 " -f hls -hls_time 3 -hls_list_size 10 -hls_flags program_date_time+independent_segments+omit_endlist -segment_format_options mpegts_flags=mpegts_copyts=1 -pix_fmt qsv -sc_threshold 0 -master_pl_name stream.m3u8 -hls_segment_filename http://127.0.0.1:8123/%v/stream-jdofFGg-%d.ts -max_muxing_queue_size 400 -method PUT -http_persistent 1 http://127.0.0.1:8123/%v/stream.m3u8`
|
||||
expected := `FFREPORT=file="` + expectedLogPath + `":level=32 ` + transcoder.ffmpegPath + ` -hide_banner -loglevel warning -init_hw_device qsv=hw -filter_hw_device hw -fflags +genpts -flags +cgop -i fakecontent.flv -map v:0 -c:v:0 h264_qsv -b:v:0 1008k -maxrate:v:0 1088k -g:v:0 90 -keyint_min:v:0 90 -r:v:0 30 -map a:0? -c:a:0 copy -filter:v:0 "hwupload=extra_hw_frames=64,format=qsv" -preset medium -map v:0 -c:v:1 h264_qsv -b:v:1 3308k -maxrate:v:1 3572k -g:v:1 72 -keyint_min:v:1 72 -r:v:1 24 -map a:0? -c:a:1 copy -filter:v:1 "hwupload=extra_hw_frames=64,format=qsv" -preset veryslow -map v:0 -c:v:2 copy -map a:0? -c:a:2 copy -preset veryfast -var_stream_map "v:0,a:0 v:1,a:1 v:2,a:2 " -f hls -hls_time 3 -hls_list_size 10 -hls_flags program_date_time+independent_segments+omit_endlist -segment_format_options mpegts_flags=mpegts_copyts=1 -pix_fmt qsv -sc_threshold 0 -master_pl_name stream.m3u8 -hls_segment_filename http://127.0.0.1:8123/%v/stream-jdofFGg-%d.ts -max_muxing_queue_size 400 -method PUT http://127.0.0.1:8123/%v/stream.m3u8`
|
||||
|
||||
if cmd != expected {
|
||||
t.Errorf("ffmpeg command does not match expected.\nGot %s\n, want: %s", cmd, expected)
|
||||
|
||||
@@ -42,7 +42,7 @@ func TestFFmpegVaapiCommand(t *testing.T) {
|
||||
cmd := transcoder.getString()
|
||||
|
||||
expectedLogPath := filepath.Join("data", "logs", "transcoder.log")
|
||||
expected := `FFREPORT=file="` + expectedLogPath + `":level=32 ` + transcoder.ffmpegPath + ` -hide_banner -loglevel warning -hwaccel vaapi -hwaccel_output_format vaapi -vaapi_device /dev/dri/renderD128 -fflags +genpts -flags +cgop -i fakecontent.flv -map v:0 -c:v:0 h264_vaapi -b:v:0 1008k -maxrate:v:0 1088k -g:v:0 90 -keyint_min:v:0 90 -r:v:0 30 -map a:0? -c:a:0 copy -filter:v:0 "hwupload=extra_hw_frames=64,format=vaapi" -preset veryfast -map v:0 -c:v:1 h264_vaapi -b:v:1 3308k -maxrate:v:1 3572k -g:v:1 72 -keyint_min:v:1 72 -r:v:1 24 -map a:0? -c:a:1 copy -filter:v:1 "hwupload=extra_hw_frames=64,format=vaapi" -preset fast -map v:0 -c:v:2 copy -map a:0? -c:a:2 copy -preset ultrafast -var_stream_map "v:0,a:0 v:1,a:1 v:2,a:2 " -f hls -hls_time 3 -hls_list_size 10 -hls_flags program_date_time+independent_segments+omit_endlist -segment_format_options mpegts_flags=mpegts_copyts=1 -pix_fmt vaapi -sc_threshold 0 -master_pl_name stream.m3u8 -hls_segment_filename http://127.0.0.1:8123/%v/stream-jdofFGg-%d.ts -max_muxing_queue_size 400 -method PUT -http_persistent 1 http://127.0.0.1:8123/%v/stream.m3u8`
|
||||
expected := `FFREPORT=file="` + expectedLogPath + `":level=32 ` + transcoder.ffmpegPath + ` -hide_banner -loglevel warning -hwaccel vaapi -hwaccel_output_format vaapi -vaapi_device /dev/dri/renderD128 -fflags +genpts -flags +cgop -i fakecontent.flv -map v:0 -c:v:0 h264_vaapi -b:v:0 1008k -maxrate:v:0 1088k -g:v:0 90 -keyint_min:v:0 90 -r:v:0 30 -map a:0? -c:a:0 copy -filter:v:0 "hwupload=extra_hw_frames=64,format=vaapi" -preset veryfast -map v:0 -c:v:1 h264_vaapi -b:v:1 3308k -maxrate:v:1 3572k -g:v:1 72 -keyint_min:v:1 72 -r:v:1 24 -map a:0? -c:a:1 copy -filter:v:1 "hwupload=extra_hw_frames=64,format=vaapi" -preset fast -map v:0 -c:v:2 copy -map a:0? -c:a:2 copy -preset ultrafast -var_stream_map "v:0,a:0 v:1,a:1 v:2,a:2 " -f hls -hls_time 3 -hls_list_size 10 -hls_flags program_date_time+independent_segments+omit_endlist -segment_format_options mpegts_flags=mpegts_copyts=1 -pix_fmt vaapi -sc_threshold 0 -master_pl_name stream.m3u8 -hls_segment_filename http://127.0.0.1:8123/%v/stream-jdofFGg-%d.ts -max_muxing_queue_size 400 -method PUT http://127.0.0.1:8123/%v/stream.m3u8`
|
||||
|
||||
if cmd != expected {
|
||||
t.Errorf("ffmpeg command does not match expected.\nGot %s\n, want: %s", cmd, expected)
|
||||
|
||||
@@ -42,7 +42,7 @@ func TestFFmpegVideoToolboxCommand(t *testing.T) {
|
||||
cmd := transcoder.getString()
|
||||
|
||||
expectedLogPath := filepath.Join("data", "logs", "transcoder.log")
|
||||
expected := `FFREPORT=file="` + expectedLogPath + `":level=32 ` + transcoder.ffmpegPath + ` -hide_banner -loglevel warning -fflags +genpts -flags +cgop -i fakecontent.flv -map v:0 -c:v:0 h264_videotoolbox -b:v:0 1008k -maxrate:v:0 1088k -g:v:0 90 -keyint_min:v:0 90 -r:v:0 30 -realtime true -map a:0? -c:a:0 copy -preset veryfast -map v:0 -c:v:1 h264_videotoolbox -b:v:1 3308k -maxrate:v:1 3572k -g:v:1 72 -keyint_min:v:1 72 -r:v:1 24 -map a:0? -c:a:1 copy -preset fast -map v:0 -c:v:2 copy -map a:0? -c:a:2 copy -preset ultrafast -var_stream_map "v:0,a:0 v:1,a:1 v:2,a:2 " -f hls -hls_time 3 -hls_list_size 10 -hls_flags program_date_time+independent_segments+omit_endlist -segment_format_options mpegts_flags=mpegts_copyts=1 -pix_fmt nv12 -sc_threshold 0 -master_pl_name stream.m3u8 -hls_segment_filename http://127.0.0.1:8123/%v/stream-jdFsdfzGg-%d.ts -max_muxing_queue_size 400 -method PUT -http_persistent 1 http://127.0.0.1:8123/%v/stream.m3u8`
|
||||
expected := `FFREPORT=file="` + expectedLogPath + `":level=32 ` + transcoder.ffmpegPath + ` -hide_banner -loglevel warning -fflags +genpts -flags +cgop -i fakecontent.flv -map v:0 -c:v:0 h264_videotoolbox -b:v:0 1008k -maxrate:v:0 1088k -g:v:0 90 -keyint_min:v:0 90 -r:v:0 30 -realtime true -map a:0? -c:a:0 copy -preset veryfast -map v:0 -c:v:1 h264_videotoolbox -b:v:1 3308k -maxrate:v:1 3572k -g:v:1 72 -keyint_min:v:1 72 -r:v:1 24 -map a:0? -c:a:1 copy -preset fast -map v:0 -c:v:2 copy -map a:0? -c:a:2 copy -preset ultrafast -var_stream_map "v:0,a:0 v:1,a:1 v:2,a:2 " -f hls -hls_time 3 -hls_list_size 10 -hls_flags program_date_time+independent_segments+omit_endlist -segment_format_options mpegts_flags=mpegts_copyts=1 -pix_fmt nv12 -sc_threshold 0 -master_pl_name stream.m3u8 -hls_segment_filename http://127.0.0.1:8123/%v/stream-jdFsdfzGg-%d.ts -max_muxing_queue_size 400 -method PUT http://127.0.0.1:8123/%v/stream.m3u8`
|
||||
|
||||
if cmd != expected {
|
||||
t.Errorf("ffmpeg command does not match expected.\nGot %s\n, want: %s", cmd, expected)
|
||||
|
||||
@@ -42,7 +42,7 @@ func TestFFmpegx264Command(t *testing.T) {
|
||||
cmd := transcoder.getString()
|
||||
|
||||
expectedLogPath := filepath.Join("data", "logs", "transcoder.log")
|
||||
expected := `FFREPORT=file="` + expectedLogPath + `":level=32 ` + transcoder.ffmpegPath + ` -hide_banner -loglevel warning -fflags +genpts -flags +cgop -i fakecontent.flv -map v:0 -c:v:0 libx264 -b:v:0 1008k -maxrate:v:0 1088k -g:v:0 90 -keyint_min:v:0 90 -r:v:0 30 -x264-params:v:0 "scenecut=0:open_gop=0" -bufsize:v:0 1088k -profile:v:0 high -map a:0? -c:a:0 copy -preset veryfast -map v:0 -c:v:1 libx264 -b:v:1 3308k -maxrate:v:1 3572k -g:v:1 72 -keyint_min:v:1 72 -r:v:1 24 -x264-params:v:1 "scenecut=0:open_gop=0" -bufsize:v:1 3572k -profile:v:1 high -map a:0? -c:a:1 copy -preset fast -map v:0 -c:v:2 copy -map a:0? -c:a:2 copy -preset ultrafast -var_stream_map "v:0,a:0 v:1,a:1 v:2,a:2 " -f hls -hls_time 3 -hls_list_size 10 -hls_flags program_date_time+independent_segments+omit_endlist -segment_format_options mpegts_flags=mpegts_copyts=1 -tune zerolatency -pix_fmt yuv420p -sc_threshold 0 -master_pl_name stream.m3u8 -hls_segment_filename http://127.0.0.1:8123/%v/stream-jdofFGg-%d.ts -max_muxing_queue_size 400 -method PUT -http_persistent 1 http://127.0.0.1:8123/%v/stream.m3u8`
|
||||
expected := `FFREPORT=file="` + expectedLogPath + `":level=32 ` + transcoder.ffmpegPath + ` -hide_banner -loglevel warning -fflags +genpts -flags +cgop -i fakecontent.flv -map v:0 -c:v:0 libx264 -b:v:0 1008k -maxrate:v:0 1088k -g:v:0 90 -keyint_min:v:0 90 -r:v:0 30 -x264-params:v:0 "scenecut=0:open_gop=0" -bufsize:v:0 1088k -profile:v:0 high -map a:0? -c:a:0 copy -preset veryfast -map v:0 -c:v:1 libx264 -b:v:1 3308k -maxrate:v:1 3572k -g:v:1 72 -keyint_min:v:1 72 -r:v:1 24 -x264-params:v:1 "scenecut=0:open_gop=0" -bufsize:v:1 3572k -profile:v:1 high -map a:0? -c:a:1 copy -preset fast -map v:0 -c:v:2 copy -map a:0? -c:a:2 copy -preset ultrafast -var_stream_map "v:0,a:0 v:1,a:1 v:2,a:2 " -f hls -hls_time 3 -hls_list_size 10 -hls_flags program_date_time+independent_segments+omit_endlist -segment_format_options mpegts_flags=mpegts_copyts=1 -tune zerolatency -pix_fmt yuv420p -sc_threshold 0 -master_pl_name stream.m3u8 -hls_segment_filename http://127.0.0.1:8123/%v/stream-jdofFGg-%d.ts -max_muxing_queue_size 400 -method PUT http://127.0.0.1:8123/%v/stream.m3u8`
|
||||
|
||||
if cmd != expected {
|
||||
t.Errorf("ffmpeg command does not match expected.\nGot %s\n, want: %s", cmd, expected)
|
||||
|
||||
@@ -4,8 +4,8 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/owncast/owncast/core/data"
|
||||
"github.com/owncast/owncast/models"
|
||||
"github.com/owncast/owncast/persistence/webhookrepository"
|
||||
)
|
||||
|
||||
// WebhookEvent represents an event sent as a webhook.
|
||||
@@ -31,7 +31,8 @@ func SendEventToWebhooks(payload WebhookEvent) {
|
||||
}
|
||||
|
||||
func sendEventToWebhooks(payload WebhookEvent, wg *sync.WaitGroup) {
|
||||
webhooks := data.GetWebhooksForEvent(payload.Type)
|
||||
webhooksRepo := webhookrepository.Get()
|
||||
webhooks := webhooksRepo.GetWebhooksForEvent(payload.Type)
|
||||
|
||||
for _, webhook := range webhooks {
|
||||
// Use wg to track the number of notifications to be sent.
|
||||
|
||||
@@ -15,6 +15,7 @@ import (
|
||||
"github.com/owncast/owncast/core/chat/events"
|
||||
"github.com/owncast/owncast/core/data"
|
||||
"github.com/owncast/owncast/models"
|
||||
"github.com/owncast/owncast/persistence/webhookrepository"
|
||||
jsonpatch "gopkg.in/evanphx/json-patch.v5"
|
||||
)
|
||||
|
||||
@@ -62,12 +63,14 @@ func TestPublicSend(t *testing.T) {
|
||||
}))
|
||||
defer svr.Close()
|
||||
|
||||
hook, err := data.InsertWebhook(svr.URL, []models.EventType{models.MessageSent})
|
||||
webhooksRepo := webhookrepository.Get()
|
||||
|
||||
hook, err := webhooksRepo.InsertWebhook(svr.URL, []models.EventType{models.MessageSent})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
defer func() {
|
||||
if err := data.DeleteWebhook(hook); err != nil {
|
||||
if err := webhooksRepo.DeleteWebhook(hook); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
}()
|
||||
@@ -107,13 +110,15 @@ func TestRouting(t *testing.T) {
|
||||
}))
|
||||
defer svr.Close()
|
||||
|
||||
webhooksRepo := webhookrepository.Get()
|
||||
|
||||
for _, eventType := range eventTypes {
|
||||
hook, err := data.InsertWebhook(svr.URL+"/"+eventType, []models.EventType{eventType})
|
||||
hook, err := webhooksRepo.InsertWebhook(svr.URL+"/"+eventType, []models.EventType{eventType})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
defer func() {
|
||||
if err := data.DeleteWebhook(hook); err != nil {
|
||||
if err := webhooksRepo.DeleteWebhook(hook); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
}()
|
||||
@@ -148,13 +153,15 @@ func TestMultiple(t *testing.T) {
|
||||
}))
|
||||
defer svr.Close()
|
||||
|
||||
webhooksRepo := webhookrepository.Get()
|
||||
|
||||
for i := 0; i < times; i++ {
|
||||
hook, err := data.InsertWebhook(fmt.Sprintf("%v/%v", svr.URL, i), []models.EventType{models.MessageSent})
|
||||
hook, err := webhooksRepo.InsertWebhook(fmt.Sprintf("%v/%v", svr.URL, i), []models.EventType{models.MessageSent})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
defer func() {
|
||||
if err := data.DeleteWebhook(hook); err != nil {
|
||||
if err := webhooksRepo.DeleteWebhook(hook); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
}()
|
||||
@@ -186,14 +193,16 @@ func TestTimestamps(t *testing.T) {
|
||||
}))
|
||||
defer svr.Close()
|
||||
|
||||
webhooksRepo := webhookrepository.Get()
|
||||
|
||||
for i, eventType := range eventTypes {
|
||||
hook, err := data.InsertWebhook(svr.URL+"/"+eventType, []models.EventType{eventType})
|
||||
hook, err := webhooksRepo.InsertWebhook(svr.URL+"/"+eventType, []models.EventType{eventType})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
handlerIds[i] = hook
|
||||
defer func() {
|
||||
if err := data.DeleteWebhook(hook); err != nil {
|
||||
if err := webhooksRepo.DeleteWebhook(hook); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
}()
|
||||
@@ -209,7 +218,7 @@ func TestTimestamps(t *testing.T) {
|
||||
|
||||
wg.Wait()
|
||||
|
||||
hooks, err := data.GetWebhooks()
|
||||
hooks, err := webhooksRepo.GetWebhooks()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -285,12 +294,14 @@ func TestParallel(t *testing.T) {
|
||||
}))
|
||||
defer svr.Close()
|
||||
|
||||
hook, err := data.InsertWebhook(svr.URL, []models.EventType{models.MessageSent})
|
||||
webhooksRepo := webhookrepository.Get()
|
||||
|
||||
hook, err := webhooksRepo.InsertWebhook(svr.URL, []models.EventType{models.MessageSent})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
defer func() {
|
||||
if err := data.DeleteWebhook(hook); err != nil {
|
||||
if err := webhooksRepo.DeleteWebhook(hook); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
}()
|
||||
@@ -320,13 +331,15 @@ func checkPayload(t *testing.T, eventType models.EventType, send func(), expecte
|
||||
}))
|
||||
defer svr.Close()
|
||||
|
||||
webhooksRepo := webhookrepository.Get()
|
||||
|
||||
// Subscribe to the webhook.
|
||||
hook, err := data.InsertWebhook(svr.URL, []models.EventType{eventType})
|
||||
hook, err := webhooksRepo.InsertWebhook(svr.URL, []models.EventType{eventType})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
defer func() {
|
||||
if err := data.DeleteWebhook(hook); err != nil {
|
||||
if err := webhooksRepo.DeleteWebhook(hook); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
}()
|
||||
|
||||
@@ -9,8 +9,8 @@ import (
|
||||
|
||||
log "github.com/sirupsen/logrus"
|
||||
|
||||
"github.com/owncast/owncast/core/data"
|
||||
"github.com/owncast/owncast/models"
|
||||
"github.com/owncast/owncast/persistence/webhookrepository"
|
||||
)
|
||||
|
||||
// webhookWorkerPoolSize defines the number of concurrent HTTP webhook requests.
|
||||
@@ -87,7 +87,8 @@ func sendWebhook(job Job) error {
|
||||
|
||||
defer resp.Body.Close()
|
||||
|
||||
if err := data.SetWebhookAsUsed(job.webhook); err != nil {
|
||||
webhooksRepo := webhookrepository.Get()
|
||||
if err := webhooksRepo.SetWebhookAsUsed(job.webhook); err != nil {
|
||||
log.Warnln(err)
|
||||
}
|
||||
|
||||
|
||||
11
crowdin.yml
Normal file
11
crowdin.yml
Normal file
@@ -0,0 +1,11 @@
|
||||
project_id_env: CROWDIN_PROJECT_ID
|
||||
api_token_env: CROWDIN_PERSONAL_TOKEN
|
||||
pull_request_title: Translations update
|
||||
pull_request_labels:
|
||||
- crowdin
|
||||
- i18n
|
||||
- translation
|
||||
commit_message: 'Updated translations for %language%'
|
||||
files:
|
||||
- source: /web/i18n/en/translation.json
|
||||
translation: /web/i18n/%two_letters_code%/translation.json
|
||||
9100
docs/api/index.html
9100
docs/api/index.html
File diff suppressed because one or more lines are too long
25
go.mod
25
go.mod
@@ -9,8 +9,8 @@ require (
|
||||
github.com/SherClockHolmes/webpush-go v1.4.0
|
||||
github.com/TwiN/go-away v1.6.14
|
||||
github.com/andybalholm/cascadia v1.3.3
|
||||
github.com/aws/aws-sdk-go v1.55.5
|
||||
github.com/go-chi/chi/v5 v5.2.0
|
||||
github.com/aws/aws-sdk-go v1.55.6
|
||||
github.com/go-chi/chi/v5 v5.2.1
|
||||
github.com/go-fed/activity v1.0.1-0.20220119073622-b14b50eecad0
|
||||
github.com/go-fed/httpsig v1.1.0
|
||||
github.com/gorilla/websocket v1.5.3
|
||||
@@ -28,17 +28,17 @@ require (
|
||||
github.com/prometheus/client_golang v1.20.5
|
||||
github.com/rifflock/lfshook v0.0.0-20180920164130-b9218ef580f5
|
||||
github.com/schollz/sqlite3dump v1.3.1
|
||||
github.com/shirou/gopsutil/v4 v4.24.12
|
||||
github.com/shirou/gopsutil/v4 v4.25.1
|
||||
github.com/sirupsen/logrus v1.9.3
|
||||
github.com/stretchr/testify v1.10.0
|
||||
github.com/teris-io/shortid v0.0.0-20220617161101-71ec9f2aa569
|
||||
github.com/yuin/goldmark v1.7.8
|
||||
github.com/yuin/goldmark-emoji v1.0.4
|
||||
golang.org/x/crypto v0.32.0
|
||||
golang.org/x/mod v0.22.0
|
||||
golang.org/x/net v0.34.0
|
||||
golang.org/x/time v0.9.0
|
||||
gopkg.in/evanphx/json-patch.v5 v5.9.0
|
||||
golang.org/x/crypto v0.33.0
|
||||
golang.org/x/mod v0.23.0
|
||||
golang.org/x/net v0.35.0
|
||||
golang.org/x/time v0.10.0
|
||||
gopkg.in/evanphx/json-patch.v5 v5.9.11
|
||||
mvdan.cc/xurls/v2 v2.6.0
|
||||
)
|
||||
|
||||
@@ -49,10 +49,9 @@ require (
|
||||
github.com/beorn7/perks v1.0.1 // indirect
|
||||
github.com/cespare/xxhash/v2 v2.3.0 // indirect
|
||||
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||
github.com/ebitengine/purego v0.8.1 // indirect
|
||||
github.com/ebitengine/purego v0.8.2 // indirect
|
||||
github.com/go-ole/go-ole v1.2.6 // indirect
|
||||
github.com/go-test/deep v1.0.4 // indirect
|
||||
github.com/golang-jwt/jwt v3.2.2+incompatible // indirect
|
||||
github.com/golang-jwt/jwt/v5 v5.2.1 // indirect
|
||||
github.com/google/uuid v1.5.0 // indirect
|
||||
github.com/gorilla/css v1.0.1 // indirect
|
||||
@@ -71,9 +70,9 @@ require (
|
||||
github.com/tklauser/go-sysconf v0.3.12 // indirect
|
||||
github.com/tklauser/numcpus v0.6.1 // indirect
|
||||
github.com/yusufpapurcu/wmi v1.2.4 // 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/sync v0.11.0 // indirect
|
||||
golang.org/x/sys v0.30.0 // indirect
|
||||
golang.org/x/text v0.22.0 // indirect
|
||||
google.golang.org/protobuf v1.34.2 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
)
|
||||
|
||||
99
go.sum
99
go.sum
@@ -1,24 +1,18 @@
|
||||
github.com/CAFxX/httpcompression v0.0.9 h1:0ue2X8dOLEpxTm8tt+OdHcgA+gbDge0OqFQWGKSqgrg=
|
||||
github.com/CAFxX/httpcompression v0.0.9/go.mod h1:XX8oPZA+4IDcfZ0A71Hz0mZsv/YJOgYygkFhizVPilM=
|
||||
github.com/RaveNoX/go-jsoncommentstrip v1.0.0/go.mod h1:78ihd09MekBnJnxpICcwzCMzGrKSKYe4AqU6PDYYpjk=
|
||||
github.com/SherClockHolmes/webpush-go v1.3.0 h1:CAu3FvEE9QS4drc3iKNgpBWFfGqNthKlZhp5QpYnu6k=
|
||||
github.com/SherClockHolmes/webpush-go v1.3.0/go.mod h1:AxRHmJuYwKGG1PVgYzToik1lphQvDnqFYDqimHvwhIw=
|
||||
github.com/SherClockHolmes/webpush-go v1.4.0 h1:ocnzNKWN23T9nvHi6IfyrQjkIc0oJWv1B1pULsf9i3s=
|
||||
github.com/SherClockHolmes/webpush-go v1.4.0/go.mod h1:XSq8pKX11vNV8MJEMwjrlTkxhAj1zKfxmyhdV7Pd6UA=
|
||||
github.com/TwiN/go-away v1.6.13 h1:aB6l/FPXmA5ds+V7I9zdhxzpsLLUvVtEuS++iU/ZmgE=
|
||||
github.com/TwiN/go-away v1.6.13/go.mod h1:MpvIC9Li3minq+CGgbgUDvQ9tDaeW35k5IXZrF9MVas=
|
||||
github.com/TwiN/go-away v1.6.14 h1:gjFP+6/A36gmj0NpYX0Sz9hrdU0KtHwtNWYnsJgV4fo=
|
||||
github.com/TwiN/go-away v1.6.14/go.mod h1:d+Gv3XuqjIeFqXYuAIzlyNoDzr1vNsP5B/hRY3u/VLs=
|
||||
github.com/andybalholm/brotli v1.0.5 h1:8uQZIdzKmjc/iuPu7O2ioW48L81FgatrcpfFmiq/cCs=
|
||||
github.com/andybalholm/brotli v1.0.5/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig=
|
||||
github.com/andybalholm/cascadia v1.3.2 h1:3Xi6Dw5lHF15JtdcmAHD3i1+T8plmv7BQ/nsViSLyss=
|
||||
github.com/andybalholm/cascadia v1.3.2/go.mod h1:7gtRlve5FxPPgIgX36uWBX58OdBsSS6lUvCFb+h7KvU=
|
||||
github.com/andybalholm/cascadia v1.3.3 h1:AG2YHrzJIm4BZ19iwJ/DAua6Btl3IwJX+VI4kktS1LM=
|
||||
github.com/andybalholm/cascadia v1.3.3/go.mod h1:xNd9bqTn98Ln4DwST8/nG+H0yuB8Hmgu1YHNnWw0GeA=
|
||||
github.com/apapsch/go-jsonmerge/v2 v2.0.0 h1:axGnT1gRIfimI7gJifB699GoE/oq+F2MU7Dml6nw9rQ=
|
||||
github.com/apapsch/go-jsonmerge/v2 v2.0.0/go.mod h1:lvDnEdqiQrp0O42VQGgmlKpxL1AP2+08jFMw88y4klk=
|
||||
github.com/aws/aws-sdk-go v1.55.5 h1:KKUZBfBoyqy5d3swXyiC7Q76ic40rYcbqH7qjh59kzU=
|
||||
github.com/aws/aws-sdk-go v1.55.5/go.mod h1:eRwEWoyTWFMVYVQzKMNHWP5/RV4xIUGMQfXQHfHkpNU=
|
||||
github.com/aws/aws-sdk-go v1.55.6 h1:cSg4pvZ3m8dgYcgqB97MrcdjUmZ1BeMYKUxMMB89IPk=
|
||||
github.com/aws/aws-sdk-go v1.55.6/go.mod h1:eRwEWoyTWFMVYVQzKMNHWP5/RV4xIUGMQfXQHfHkpNU=
|
||||
github.com/aymerick/douceur v0.2.0 h1:Mv+mAeH1Q+n9Fr+oyamOlAkUNPWPlA8PPGR0QAaYuPk=
|
||||
github.com/aymerick/douceur v0.2.0/go.mod h1:wlT5vV2O3h55X9m7iVYN0TBM0NH/MmbLnd30/FjWUq4=
|
||||
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
|
||||
@@ -30,12 +24,10 @@ github.com/dave/jennifer v1.3.0/go.mod h1:fIb+770HOpJ2fmN9EPPKOqm1vMGhB+TwXKMZhr
|
||||
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/ebitengine/purego v0.8.1 h1:sdRKd6plj7KYW33EH5As6YKfe8m9zbN9JMrOjNVF/BE=
|
||||
github.com/ebitengine/purego v0.8.1/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ=
|
||||
github.com/go-chi/chi/v5 v5.1.0 h1:acVI1TYaD+hhedDJ3r54HyA6sExp3HfXq7QWEEY/xMw=
|
||||
github.com/go-chi/chi/v5 v5.1.0/go.mod h1:DslCQbL2OYiznFReuXYUmQ2hGd1aDpCnlMNITLSKoi8=
|
||||
github.com/go-chi/chi/v5 v5.2.0 h1:Aj1EtB0qR2Rdo2dG4O94RIU35w2lvQSj6BRA4+qwFL0=
|
||||
github.com/go-chi/chi/v5 v5.2.0/go.mod h1:DslCQbL2OYiznFReuXYUmQ2hGd1aDpCnlMNITLSKoi8=
|
||||
github.com/ebitengine/purego v0.8.2 h1:jPPGWs2sZ1UgOSgD2bClL0MJIqu58nOmIcBuXr62z1I=
|
||||
github.com/ebitengine/purego v0.8.2/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ=
|
||||
github.com/go-chi/chi/v5 v5.2.1 h1:KOIHODQj58PmL80G2Eak4WdvUzjSJSm0vG72crDCqb8=
|
||||
github.com/go-chi/chi/v5 v5.2.1/go.mod h1:L2yAIGWB3H+phAw1NxKwWM+7eUH/lU8pOMm5hHcoops=
|
||||
github.com/go-fed/httpsig v0.1.1-0.20190914113940-c2de3672e5b5/go.mod h1:T56HUNYZUQ1AGUzhAYPugZfp36sKApVnGBgKlIY+aIE=
|
||||
github.com/go-fed/httpsig v1.1.0 h1:9M+hb0jkEICD8/cAiNqEB66R87tTINszBRTjwjQzWcI=
|
||||
github.com/go-fed/httpsig v1.1.0/go.mod h1:RCMrTZvN1bJYtofsG4rd5NaO5obxQ5xBkdiS7xsT7bM=
|
||||
@@ -44,8 +36,6 @@ github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiU
|
||||
github.com/go-test/deep v1.0.1/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA=
|
||||
github.com/go-test/deep v1.0.4 h1:u2CU3YKy9I2pmu9pX0eq50wCgjfGIt539SqR7FbHiho=
|
||||
github.com/go-test/deep v1.0.4/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA=
|
||||
github.com/golang-jwt/jwt v3.2.2+incompatible h1:IfV12K8xAKAnZqdXVzCZ+TOjboZ2keLg81eXfW3O+oY=
|
||||
github.com/golang-jwt/jwt v3.2.2+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I=
|
||||
github.com/golang-jwt/jwt/v5 v5.2.1 h1:OuVbFODueb089Lh128TAcimifWaLhJwVflnrgM17wHk=
|
||||
github.com/golang-jwt/jwt/v5 v5.2.1/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk=
|
||||
github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
|
||||
@@ -60,8 +50,6 @@ github.com/gorilla/css v1.0.1 h1:ntNaBIghp6JmvWnxbZKANoLyuXTPZ4cAMlo6RyhlbO8=
|
||||
github.com/gorilla/css v1.0.1/go.mod h1:BvnYkspnSzMmwRK+b8/xgNPLiIuNZr6vbZBTPQ2A3b0=
|
||||
github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg=
|
||||
github.com/gorilla/websocket v1.5.3/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
|
||||
github.com/grafov/m3u8 v0.12.0 h1:T6iTwTsSEtMcwkayef+FJO8kj+Sglr4Lh81Zj8Ked/4=
|
||||
github.com/grafov/m3u8 v0.12.0/go.mod h1:nqzOkfBiZJENr52zTVd/Dcl03yzphIMbJqkXGu+u080=
|
||||
github.com/grafov/m3u8 v0.12.1 h1:DuP1uA1kvRRmGNAZ0m+ObLv1dvrfNO0TPx0c/enNk0s=
|
||||
github.com/grafov/m3u8 v0.12.1/go.mod h1:nqzOkfBiZJENr52zTVd/Dcl03yzphIMbJqkXGu+u080=
|
||||
github.com/jellydator/ttlcache/v3 v3.3.0 h1:BdoC9cE81qXfrxeb9eoJi9dWrdhSuwXMAnHTbnBm4Wc=
|
||||
@@ -131,16 +119,12 @@ github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0leargg
|
||||
github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk=
|
||||
github.com/rifflock/lfshook v0.0.0-20180920164130-b9218ef580f5 h1:mZHayPoR0lNmnHyvtYjDeq0zlVHn9K/ZXoy17ylucdo=
|
||||
github.com/rifflock/lfshook v0.0.0-20180920164130-b9218ef580f5/go.mod h1:GEXHk5HgEKCvEIIrSpFI3ozzG5xOKA2DVlEX/gGnewM=
|
||||
github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ=
|
||||
github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog=
|
||||
github.com/rogpeppe/go-internal v1.13.2-0.20241226121412-a5dc8ff20d0a h1:w3tdWGKbLGBPtR/8/oO74W6hmz0qE5q0z9aqSAewaaM=
|
||||
github.com/rogpeppe/go-internal v1.13.2-0.20241226121412-a5dc8ff20d0a/go.mod h1:S8kfXMp+yh77OxPD4fdM6YUknrZpQxLhvxzS4gDHENY=
|
||||
github.com/schollz/sqlite3dump v1.3.1 h1:QXizJ7XEJ7hggjqjZ3YRtF3+javm8zKtzNByYtEkPRA=
|
||||
github.com/schollz/sqlite3dump v1.3.1/go.mod h1:mzSTjZpJH4zAb1FN3iNlhWPbbdyeBpOaTW0hukyMHyI=
|
||||
github.com/shirou/gopsutil/v4 v4.24.10 h1:7VOzPtfw/5YDU+jLEoBwXwxJbQetULywoSV4RYY7HkM=
|
||||
github.com/shirou/gopsutil/v4 v4.24.10/go.mod h1:s4D/wg+ag4rG0WO7AiTj2BeYCRhym0vM7DHbZRxnIT8=
|
||||
github.com/shirou/gopsutil/v4 v4.24.11 h1:WaU9xqGFKvFfsUv94SXcUPD7rCkU0vr/asVdQOBZNj8=
|
||||
github.com/shirou/gopsutil/v4 v4.24.11/go.mod h1:s4D/wg+ag4rG0WO7AiTj2BeYCRhym0vM7DHbZRxnIT8=
|
||||
github.com/shirou/gopsutil/v4 v4.24.12 h1:qvePBOk20e0IKA1QXrIIU+jmk+zEiYVVx06WjBRlZo4=
|
||||
github.com/shirou/gopsutil/v4 v4.24.12/go.mod h1:DCtMPAad2XceTeIAbGyVfycbYQNBGk2P8cvDi7/VN9o=
|
||||
github.com/shirou/gopsutil/v4 v4.25.1 h1:QSWkTc+fu9LTAWfkZwZ6j8MSUk4A2LV7rbH0ZqmLjXs=
|
||||
github.com/shirou/gopsutil/v4 v4.25.1/go.mod h1:RoUCUpndaJFtT+2zsZzzmhvbfGoDCJ7nFXKJf8GqJbI=
|
||||
github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ=
|
||||
github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
|
||||
github.com/spf13/cobra v0.0.4-0.20190109003409-7547e83b2d85/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ=
|
||||
@@ -155,8 +139,6 @@ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/
|
||||
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
|
||||
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
|
||||
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
|
||||
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
||||
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
|
||||
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
||||
github.com/teris-io/shortid v0.0.0-20220617161101-71ec9f2aa569 h1:xzABM9let0HLLqFypcxvLmlvEciCHL7+Lv+4vwZqecI=
|
||||
@@ -182,54 +164,41 @@ golang.org/x/crypto v0.0.0-20180527072434-ab813273cd59/go.mod h1:6SG95UA2DQfeDnf
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
||||
golang.org/x/crypto v0.9.0/go.mod h1:yrmDGqONDYtNj3tH8X9dzUun2m2lzPa9ngI6/RUPGR0=
|
||||
golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc=
|
||||
golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU=
|
||||
golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8=
|
||||
golang.org/x/crypto v0.29.0 h1:L5SG1JTTXupVV3n6sUqMTeWbjAyfPwoda2DLX8J8FrQ=
|
||||
golang.org/x/crypto v0.29.0/go.mod h1:+F4F4N5hv6v38hfeYwTdx20oUvLLc+QfrE9Ax9HtgRg=
|
||||
golang.org/x/crypto v0.30.0 h1:RwoQn3GkWiMkzlX562cLB7OxWvjH1L8xutO2WoJcRoY=
|
||||
golang.org/x/crypto v0.30.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk=
|
||||
golang.org/x/crypto v0.31.0 h1:ihbySMvVjLAeSH1IbfcRTkD/iNscyz8rGzjF/E5hV6U=
|
||||
golang.org/x/crypto v0.31.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk=
|
||||
golang.org/x/crypto v0.32.0 h1:euUpcYgM8WcP71gNpTqQCn6rC2t6ULUPiOzfWaXVVfc=
|
||||
golang.org/x/crypto v0.32.0/go.mod h1:ZnnJkOaASj8g0AjIduWNlq2NRxL0PlBrbKVyZ6V/Ugc=
|
||||
golang.org/x/crypto v0.33.0 h1:IOBPskki6Lysi0lo9qQvbxiQ+FvsCC/YWOecCHAixus=
|
||||
golang.org/x/crypto v0.33.0/go.mod h1:bVdXmD7IV/4GdElGPozy6U7lWdRXA4qyRVGJV57uQ5M=
|
||||
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.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
|
||||
golang.org/x/mod v0.15.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
|
||||
golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
|
||||
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-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
golang.org/x/net v0.0.0-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks=
|
||||
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.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns=
|
||||
golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
|
||||
golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk=
|
||||
golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44=
|
||||
golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM=
|
||||
golang.org/x/net v0.31.0 h1:68CPQngjLL0r2AlUKiSxtQFKvzRVbnzLwMUn5SzcLHo=
|
||||
golang.org/x/net v0.31.0/go.mod h1:P4fl1q7dY2hnZFxEk4pPSkDHF+QqjitcnDjUQyMM+pM=
|
||||
golang.org/x/net v0.32.0 h1:ZqPmj8Kzc+Y6e0+skZsuACbx+wzMgo5MQsJh9Qd6aYI=
|
||||
golang.org/x/net v0.32.0/go.mod h1:CwU0IoeOlnQQWJ6ioyFrfRuomB8GKF6KbYXZVyeXNfs=
|
||||
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.34.0 h1:Mb7Mrk043xzHgnRM88suvJFwzVrRfHEHJEl5/71CKw0=
|
||||
golang.org/x/net v0.34.0/go.mod h1:di0qlW3YNM5oh6GqDGQr92MyTozJPmybPK4Ev/Gm31k=
|
||||
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.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y=
|
||||
golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
|
||||
golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
|
||||
golang.org/x/sync v0.9.0 h1:fEo0HyrW1GIgZdpbhCRO0PkJajUS5H9IFUztCgEo2jQ=
|
||||
golang.org/x/sync v0.9.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
|
||||
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-20180525142821-c11f84a56e43/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
@@ -241,30 +210,25 @@ golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBc
|
||||
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.11.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.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/sys v0.27.0 h1:wBqf8DvsY9Y/2P8gAfPDEYNuS30J4lPHJxXSb/nJZ+s=
|
||||
golang.org/x/sys v0.27.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA=
|
||||
golang.org/x/sys v0.28.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/telemetry v0.0.0-20240228155512-f48c80bd79b2/go.mod h1:TeRTkGYfJXctD9OcfyVLyj2J3IxLnKwHJR8f4D8a3YE=
|
||||
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.7.0/go.mod h1:P32HKFT3hSsZrRxla30E9HqToFYAQPCMs/zFMBUFqPY=
|
||||
golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo=
|
||||
golang.org/x/term v0.12.0/go.mod h1:owVbMEjm3cBLCHdkQu9b1opXd4ETQWc3BhuQGKgXgvU=
|
||||
golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk=
|
||||
golang.org/x/term v0.20.0/go.mod h1:8UkIAJTvZgivsXaD6/pH6U9ecQzZ45awqEOzuCvwpFY=
|
||||
golang.org/x/term v0.26.0 h1:WEQa6V3Gja/BhNxg540hBip/kkaYtRg3cxg4oXSw4AU=
|
||||
golang.org/x/term v0.26.0/go.mod h1:Si5m1o57C5nBNQo5z1iq+XDijt21BDBDp2bK0QI8e3E=
|
||||
golang.org/x/term v0.27.0/go.mod h1:iMsnZpn0cago0GOrHO2+Y7u7JPn5AylBrcoWkElMTSM=
|
||||
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=
|
||||
@@ -273,16 +237,11 @@ golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
|
||||
golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
|
||||
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
|
||||
golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
|
||||
golang.org/x/text v0.20.0 h1:gK/Kv2otX8gz+wn7Rmb3vT96ZwuoxnQlY+HlJVj7Qug=
|
||||
golang.org/x/text v0.20.0/go.mod h1:D4IsuqiFMhST5bX19pQ9ikHC2GsaKyk/oF+pn3ducp4=
|
||||
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/time v0.7.0 h1:ntUhktv3OPE6TgYxXWv9vKvUSJyIFJlyohwbkEwPrKQ=
|
||||
golang.org/x/time v0.7.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM=
|
||||
golang.org/x/time v0.8.0 h1:9i3RxcPv3PZnitoVGMPDKZSq1xW1gK1Xy3ArNOGZfEg=
|
||||
golang.org/x/time v0.8.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM=
|
||||
golang.org/x/time v0.9.0 h1:EsRrnYcQiGH+5FfbgvV4AP7qEZstoyrHB0DzarOQ4ZY=
|
||||
golang.org/x/time v0.9.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM=
|
||||
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/time v0.10.0 h1:3usCWA8tQn0L8+hFJQNgzpWbd89begxN66o1Ojdn5L4=
|
||||
golang.org/x/time v0.10.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM=
|
||||
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=
|
||||
@@ -296,15 +255,13 @@ google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWn
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/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/evanphx/json-patch.v5 v5.9.0 h1:hx1VU2SGj4F8r9b8GUwJLdc8DNO8sy79ZGui0G05GLo=
|
||||
gopkg.in/evanphx/json-patch.v5 v5.9.0/go.mod h1:/kvTRh1TVm5wuM6OkHxqXtE/1nUZZpihg29RtuIyfvk=
|
||||
gopkg.in/evanphx/json-patch.v5 v5.9.11 h1:OMPeiLomOQwe8+Ku4nwXsdOmrRw2vGUpP3XgLj3ojNw=
|
||||
gopkg.in/evanphx/json-patch.v5 v5.9.11/go.mod h1:/kvTRh1TVm5wuM6OkHxqXtE/1nUZZpihg29RtuIyfvk=
|
||||
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
|
||||
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
mvdan.cc/xurls/v2 v2.5.0 h1:lyBNOm8Wo71UknhUs4QTFUNNMyxy2JEIaKKo0RWOh+8=
|
||||
mvdan.cc/xurls/v2 v2.5.0/go.mod h1:yQgaGQ1rFtJUzkmKiHYSSfuQxqfYmd//X6PxvholpeE=
|
||||
mvdan.cc/xurls/v2 v2.6.0 h1:3NTZpeTxYVWNSokW3MKeyVkz/j7uYXYiMtXRUfmjbgI=
|
||||
mvdan.cc/xurls/v2 v2.6.0/go.mod h1:bCvEZ1XvdA6wDnxY7jPPjEmigDtvtvPXAD/Exa9IMSk=
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"github.com/nakabonne/tstorage"
|
||||
"github.com/owncast/owncast/core"
|
||||
"github.com/owncast/owncast/core/chat"
|
||||
"github.com/owncast/owncast/core/data"
|
||||
"github.com/owncast/owncast/persistence/chatmessagerepository"
|
||||
"github.com/owncast/owncast/persistence/userrepository"
|
||||
log "github.com/sirupsen/logrus"
|
||||
)
|
||||
@@ -56,7 +56,8 @@ func collectChatClientCount() {
|
||||
activeChatClientCount.Set(float64(count))
|
||||
|
||||
// Total message count
|
||||
cmc := data.GetMessagesCount()
|
||||
chatMessageRepository := chatmessagerepository.Get()
|
||||
cmc := chatMessageRepository.GetMessagesCount()
|
||||
// Insert message count into Prometheus collector.
|
||||
currentChatMessageCount.Set(float64(cmc))
|
||||
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
package models
|
||||
|
||||
// CustomEmoji represents an image that can be used in chat as a custom emoji.
|
||||
type CustomEmoji struct {
|
||||
Name string `json:"name"`
|
||||
URL string `json:"url"`
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
package models
|
||||
|
||||
import "time"
|
||||
|
||||
// IPAddress is a simple representation of an IP address.
|
||||
type IPAddress struct {
|
||||
CreatedAt time.Time `json:"createdAt"`
|
||||
IPAddress string `json:"ipAddress"`
|
||||
Notes string `json:"notes"`
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
package models
|
||||
|
||||
// StreamKey represents a single stream key.
|
||||
type StreamKey struct {
|
||||
Key string `json:"key"`
|
||||
Comment string `json:"comment"`
|
||||
}
|
||||
30
openapi.yaml
30
openapi.yaml
@@ -1,7 +1,7 @@
|
||||
openapi: 3.1.0
|
||||
|
||||
info:
|
||||
version: 0.2.1
|
||||
version: 0.2.2
|
||||
title: Owncast APIs
|
||||
description: |-
|
||||
Internal
|
||||
@@ -3134,6 +3134,26 @@ paths:
|
||||
responses:
|
||||
'204':
|
||||
$ref: '#/components/responses/204'
|
||||
/integrations/status:
|
||||
get:
|
||||
summary: Get the server's status
|
||||
operationId: ExternalGetStatus
|
||||
tags: ['External']
|
||||
security:
|
||||
- BearerAuth: []
|
||||
responses:
|
||||
'200':
|
||||
description: Status
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/Status'
|
||||
'401':
|
||||
$ref: '#/components/responses/401BasicAuth'
|
||||
'404':
|
||||
$ref: '#/components/responses/404'
|
||||
default:
|
||||
$ref: '#/components/responses/Default'
|
||||
/integrations/streamtitle:
|
||||
post:
|
||||
summary: Stream title
|
||||
@@ -3310,7 +3330,6 @@ paths:
|
||||
tags: ['Internal', 'Auth', 'Chat']
|
||||
parameters:
|
||||
- $ref: '#/components/parameters/IndieAuthState'
|
||||
- $ref: '#/components/parameters/IndieAuthCode'
|
||||
responses:
|
||||
'307':
|
||||
description: Redirected to home page
|
||||
@@ -3328,7 +3347,6 @@ paths:
|
||||
- $ref: '#/components/parameters/IndieAuthRedirectURI'
|
||||
- $ref: '#/components/parameters/IndieAuthCodeChallenge'
|
||||
- $ref: '#/components/parameters/IndieAuthState'
|
||||
- $ref: '#/components/parameters/IndieAuthCode'
|
||||
responses:
|
||||
'200':
|
||||
description: IndieAuth flow concluded
|
||||
@@ -4430,12 +4448,6 @@ components:
|
||||
schema:
|
||||
type: string
|
||||
required: true
|
||||
IndieAuthCode:
|
||||
in: query
|
||||
name: code
|
||||
schema:
|
||||
type: string
|
||||
required: true
|
||||
IndieAuthMe:
|
||||
in: query
|
||||
name: me
|
||||
|
||||
6
package-lock.json
generated
Normal file
6
package-lock.json
generated
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"name": "owncast",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {}
|
||||
}
|
||||
@@ -3,13 +3,13 @@ package authrepository
|
||||
import (
|
||||
"database/sql"
|
||||
|
||||
"github.com/owncast/owncast/models"
|
||||
"github.com/owncast/owncast/webserver/handlers/generated"
|
||||
)
|
||||
|
||||
type AuthRepository interface {
|
||||
CreateBanIPTable(db *sql.DB)
|
||||
BanIPAddress(address, note string) error
|
||||
IsIPAddressBanned(address string) (bool, error)
|
||||
GetIPAddressBans() ([]models.IPAddress, error)
|
||||
GetIPAddressBans() ([]generated.IPAddress, error)
|
||||
RemoveIPAddressBan(address string) error
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"log"
|
||||
|
||||
"github.com/owncast/owncast/db"
|
||||
"github.com/owncast/owncast/models"
|
||||
"github.com/owncast/owncast/webserver/handlers/generated"
|
||||
)
|
||||
|
||||
// CreateBanIPTable will create the IP ban table if needed.
|
||||
@@ -42,18 +42,18 @@ func (r *SqlAuthRepository) IsIPAddressBanned(address string) (bool, error) {
|
||||
}
|
||||
|
||||
// GetIPAddressBans will return all the banned IP addresses.
|
||||
func (r *SqlAuthRepository) GetIPAddressBans() ([]models.IPAddress, error) {
|
||||
func (r *SqlAuthRepository) GetIPAddressBans() ([]generated.IPAddress, error) {
|
||||
result, err := r.datastore.GetQueries().GetIPAddressBans(context.Background())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
response := []models.IPAddress{}
|
||||
response := []generated.IPAddress{}
|
||||
for _, ip := range result {
|
||||
response = append(response, models.IPAddress{
|
||||
IPAddress: ip.IpAddress,
|
||||
Notes: ip.Notes.String,
|
||||
CreatedAt: ip.CreatedAt.Time,
|
||||
response = append(response, generated.IPAddress{
|
||||
IpAddress: &ip.IpAddress,
|
||||
Notes: &ip.Notes.String,
|
||||
CreatedAt: &ip.CreatedAt.Time,
|
||||
})
|
||||
}
|
||||
return response, err
|
||||
|
||||
523
persistence/chatmessagerepository/chatmessagerepository.go
Normal file
523
persistence/chatmessagerepository/chatmessagerepository.go
Normal file
@@ -0,0 +1,523 @@
|
||||
package chatmessagerepository
|
||||
|
||||
import (
|
||||
"context"
|
||||
"database/sql"
|
||||
"errors"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/owncast/owncast/core/chat/events"
|
||||
"github.com/owncast/owncast/core/data"
|
||||
"github.com/owncast/owncast/models"
|
||||
|
||||
log "github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
const maxBacklogNumber = 50 // Return max number of messages in history request
|
||||
|
||||
type ChatMessageRepository interface {
|
||||
SaveUserMessage(event events.UserMessageEvent)
|
||||
SaveFederatedAction(event events.FediverseEngagementEvent)
|
||||
SaveEvent(id string, userID *string, body string, eventType string, hidden *time.Time, timestamp time.Time, image *string, link *string, title *string, subtitle *string)
|
||||
GetChatModerationHistory() []interface{}
|
||||
GetChatHistory() []interface{}
|
||||
GetMessagesFromUser(userID string) ([]events.UserMessageEvent, error)
|
||||
GetMessageIdsForUserID(userID string) ([]string, error)
|
||||
SetMessageVisibilityForMessageIDs(messageIDs []string, visible bool) error
|
||||
GetMessagesCount() int64
|
||||
}
|
||||
|
||||
type SqlChatMessageRepository struct {
|
||||
datastore *data.Datastore
|
||||
}
|
||||
|
||||
// NOTE: This is temporary during the transition period.
|
||||
var temporaryGlobalInstance ChatMessageRepository
|
||||
|
||||
// Get will return the user repository.
|
||||
func Get() ChatMessageRepository {
|
||||
if temporaryGlobalInstance == nil {
|
||||
i := New(data.GetDatastore())
|
||||
temporaryGlobalInstance = i
|
||||
}
|
||||
return temporaryGlobalInstance
|
||||
}
|
||||
|
||||
// New will create a new instance of the UserRepository.
|
||||
func New(datastore *data.Datastore) ChatMessageRepository {
|
||||
r := SqlChatMessageRepository{
|
||||
datastore: datastore,
|
||||
}
|
||||
|
||||
return &r
|
||||
}
|
||||
|
||||
// SaveUserMessage will save a single chat event to the messages database.
|
||||
func (r *SqlChatMessageRepository) SaveUserMessage(event events.UserMessageEvent) {
|
||||
r.SaveEvent(event.ID, &event.User.ID, event.Body, event.Type, event.HiddenAt, event.Timestamp, nil, nil, nil, nil)
|
||||
}
|
||||
|
||||
func (r *SqlChatMessageRepository) SaveFederatedAction(event events.FediverseEngagementEvent) {
|
||||
r.SaveEvent(event.ID, nil, event.Body, event.Type, nil, event.Timestamp, event.Image, &event.Link, &event.UserAccountName, nil)
|
||||
}
|
||||
|
||||
// nolint: unparam
|
||||
func (r *SqlChatMessageRepository) SaveEvent(id string, userID *string, body string, eventType string, hidden *time.Time, timestamp time.Time, image *string, link *string, title *string, subtitle *string) {
|
||||
defer func() {
|
||||
_historyCache = nil
|
||||
}()
|
||||
|
||||
tx, err := r.datastore.DB.Begin()
|
||||
if err != nil {
|
||||
log.Errorln("error saving", eventType, err)
|
||||
return
|
||||
}
|
||||
|
||||
defer tx.Rollback() // nolint
|
||||
|
||||
stmt, err := tx.Prepare("INSERT INTO messages(id, user_id, body, eventType, hidden_at, timestamp, image, link, title, subtitle) values(?, ?, ?, ?, ?, ?, ?, ?, ?, ?)")
|
||||
if err != nil {
|
||||
log.Errorln("error saving", eventType, err)
|
||||
return
|
||||
}
|
||||
|
||||
defer stmt.Close()
|
||||
|
||||
if _, err = stmt.Exec(id, userID, body, eventType, hidden, timestamp, image, link, title, subtitle); err != nil {
|
||||
log.Errorln("error saving", eventType, err)
|
||||
return
|
||||
}
|
||||
if err = tx.Commit(); err != nil {
|
||||
log.Errorln("error saving", eventType, err)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
func makeUserMessageEventFromRowData(row rowData) events.UserMessageEvent {
|
||||
scopes := ""
|
||||
if row.userScopes != nil {
|
||||
scopes = *row.userScopes
|
||||
}
|
||||
|
||||
previousUsernames := []string{}
|
||||
if row.previousUsernames != nil {
|
||||
previousUsernames = strings.Split(*row.previousUsernames, ",")
|
||||
}
|
||||
|
||||
displayName := ""
|
||||
if row.userDisplayName != nil {
|
||||
displayName = *row.userDisplayName
|
||||
}
|
||||
|
||||
displayColor := 0
|
||||
if row.userDisplayColor != nil {
|
||||
displayColor = *row.userDisplayColor
|
||||
}
|
||||
|
||||
createdAt := time.Time{}
|
||||
if row.userCreatedAt != nil {
|
||||
createdAt = *row.userCreatedAt
|
||||
}
|
||||
|
||||
isBot := (row.userType != nil && *row.userType == "API")
|
||||
scopeSlice := strings.Split(scopes, ",")
|
||||
|
||||
u := models.User{
|
||||
ID: *row.userID,
|
||||
DisplayName: displayName,
|
||||
DisplayColor: displayColor,
|
||||
CreatedAt: createdAt,
|
||||
DisabledAt: row.userDisabledAt,
|
||||
NameChangedAt: row.userNameChangedAt,
|
||||
PreviousNames: previousUsernames,
|
||||
AuthenticatedAt: row.userAuthenticatedAt,
|
||||
Authenticated: row.userAuthenticatedAt != nil,
|
||||
Scopes: scopeSlice,
|
||||
IsBot: isBot,
|
||||
}
|
||||
|
||||
message := events.UserMessageEvent{
|
||||
Event: events.Event{
|
||||
Type: row.eventType,
|
||||
ID: row.id,
|
||||
Timestamp: row.timestamp,
|
||||
},
|
||||
UserEvent: events.UserEvent{
|
||||
User: &u,
|
||||
HiddenAt: row.hiddenAt,
|
||||
},
|
||||
MessageEvent: events.MessageEvent{
|
||||
Body: row.body,
|
||||
RawBody: row.body,
|
||||
},
|
||||
}
|
||||
|
||||
return message
|
||||
}
|
||||
|
||||
func makeSystemMessageChatEventFromRowData(row rowData) events.SystemMessageEvent {
|
||||
message := events.SystemMessageEvent{
|
||||
Event: events.Event{
|
||||
Type: row.eventType,
|
||||
ID: row.id,
|
||||
Timestamp: row.timestamp,
|
||||
},
|
||||
MessageEvent: events.MessageEvent{
|
||||
Body: row.body,
|
||||
RawBody: row.body,
|
||||
},
|
||||
}
|
||||
return message
|
||||
}
|
||||
|
||||
func makeActionMessageChatEventFromRowData(row rowData) events.ActionEvent {
|
||||
message := events.ActionEvent{
|
||||
Event: events.Event{
|
||||
Type: row.eventType,
|
||||
ID: row.id,
|
||||
Timestamp: row.timestamp,
|
||||
},
|
||||
MessageEvent: events.MessageEvent{
|
||||
Body: row.body,
|
||||
RawBody: row.body,
|
||||
},
|
||||
}
|
||||
return message
|
||||
}
|
||||
|
||||
func makeFederatedActionChatEventFromRowData(row rowData) events.FediverseEngagementEvent {
|
||||
message := events.FediverseEngagementEvent{
|
||||
Event: events.Event{
|
||||
Type: row.eventType,
|
||||
ID: row.id,
|
||||
Timestamp: row.timestamp,
|
||||
},
|
||||
MessageEvent: events.MessageEvent{
|
||||
Body: row.body,
|
||||
RawBody: row.body,
|
||||
},
|
||||
Image: row.image,
|
||||
Link: *row.link,
|
||||
UserAccountName: *row.title,
|
||||
}
|
||||
return message
|
||||
}
|
||||
|
||||
type rowData struct {
|
||||
timestamp time.Time
|
||||
image *string
|
||||
previousUsernames *string
|
||||
|
||||
userDisplayName *string
|
||||
userDisplayColor *int
|
||||
userID *string
|
||||
title *string
|
||||
subtitle *string
|
||||
link *string
|
||||
|
||||
userType *string
|
||||
userScopes *string
|
||||
hiddenAt *time.Time
|
||||
userCreatedAt *time.Time
|
||||
userDisabledAt *time.Time
|
||||
userAuthenticatedAt *time.Time
|
||||
userNameChangedAt *time.Time
|
||||
body string
|
||||
eventType models.EventType
|
||||
id string
|
||||
}
|
||||
|
||||
func getChat(rows *sql.Rows) ([]interface{}, error) {
|
||||
history := make([]interface{}, 0)
|
||||
|
||||
for rows.Next() {
|
||||
row := rowData{}
|
||||
|
||||
// Convert a database row into a chat event
|
||||
if err := rows.Scan(
|
||||
&row.id,
|
||||
&row.userID,
|
||||
&row.body,
|
||||
&row.title,
|
||||
&row.subtitle,
|
||||
&row.image,
|
||||
&row.link,
|
||||
&row.eventType,
|
||||
&row.hiddenAt,
|
||||
&row.timestamp,
|
||||
&row.userDisplayName,
|
||||
&row.userDisplayColor,
|
||||
&row.userCreatedAt,
|
||||
&row.userDisabledAt,
|
||||
&row.previousUsernames,
|
||||
&row.userNameChangedAt,
|
||||
&row.userAuthenticatedAt,
|
||||
&row.userScopes,
|
||||
&row.userType,
|
||||
); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var message interface{}
|
||||
|
||||
switch row.eventType {
|
||||
case events.MessageSent:
|
||||
message = makeUserMessageEventFromRowData(row)
|
||||
case events.SystemMessageSent:
|
||||
message = makeSystemMessageChatEventFromRowData(row)
|
||||
case events.ChatActionSent:
|
||||
message = makeActionMessageChatEventFromRowData(row)
|
||||
case events.FediverseEngagementFollow:
|
||||
message = makeFederatedActionChatEventFromRowData(row)
|
||||
case events.FediverseEngagementLike:
|
||||
message = makeFederatedActionChatEventFromRowData(row)
|
||||
case events.FediverseEngagementRepost:
|
||||
message = makeFederatedActionChatEventFromRowData(row)
|
||||
}
|
||||
|
||||
history = append(history, message)
|
||||
}
|
||||
|
||||
return history, nil
|
||||
}
|
||||
|
||||
var _historyCache *[]interface{}
|
||||
|
||||
// GetChatModerationHistory will return all the chat messages suitable for moderation purposes.
|
||||
func (r *SqlChatMessageRepository) GetChatModerationHistory() []interface{} {
|
||||
if _historyCache != nil {
|
||||
return *_historyCache
|
||||
}
|
||||
|
||||
tx, err := r.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"
|
||||
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 (r *SqlChatMessageRepository) GetChatHistory() []interface{} {
|
||||
tx, err := r.datastore.DB.Begin()
|
||||
if err != nil {
|
||||
log.Errorln("error fetching chat history", err)
|
||||
return nil
|
||||
}
|
||||
|
||||
defer tx.Rollback() // nolint
|
||||
|
||||
// Get all visible messages
|
||||
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 {
|
||||
m[i], m[j] = m[j], m[i]
|
||||
}
|
||||
|
||||
return m
|
||||
}
|
||||
|
||||
// GetMessagesFromUser returns chat messages that were sent by a specific user.
|
||||
func (r *SqlChatMessageRepository) GetMessagesFromUser(userID string) ([]events.UserMessageEvent, error) {
|
||||
query, err := r.datastore.GetQueries().GetMessagesFromUser(context.Background(), sql.NullString{String: userID, Valid: true})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
results := make([]events.UserMessageEvent, len(query))
|
||||
for i, row := range query {
|
||||
results[i] = events.UserMessageEvent{
|
||||
Event: events.Event{
|
||||
Timestamp: row.Timestamp.Time,
|
||||
ID: row.ID,
|
||||
},
|
||||
MessageEvent: events.MessageEvent{
|
||||
Body: row.Body.String,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
return results, nil
|
||||
}
|
||||
|
||||
// GetMessageIdsForUserID will return the chat message IDs for a specific user.
|
||||
func (r *SqlChatMessageRepository) GetMessageIdsForUserID(userID string) ([]string, error) {
|
||||
defer func() {
|
||||
_historyCache = nil
|
||||
}()
|
||||
|
||||
tx, err := r.datastore.DB.Begin()
|
||||
if err != nil {
|
||||
return nil, errors.New("error while setting message visibility")
|
||||
}
|
||||
|
||||
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 {
|
||||
return nil, errors.New("error while setting message visibility")
|
||||
}
|
||||
|
||||
rows, err := stmt.Query(userID)
|
||||
if err != nil {
|
||||
log.Errorln("error while setting message visibility", err)
|
||||
return nil, errors.New("error while setting message visibility")
|
||||
}
|
||||
|
||||
defer stmt.Close()
|
||||
defer rows.Close()
|
||||
|
||||
// Get a list of IDs to send to the connected clients to hide
|
||||
ids := make([]string, 0)
|
||||
|
||||
messages, err := getChat(rows)
|
||||
if err != nil {
|
||||
log.Errorln(err)
|
||||
return nil, errors.New("There is a problem enumerating chat message rows. Please report this: " + query)
|
||||
}
|
||||
|
||||
if len(messages) == 0 {
|
||||
return []string{}, nil
|
||||
}
|
||||
|
||||
for _, message := range messages {
|
||||
ids = append(ids, message.(events.UserMessageEvent).ID)
|
||||
}
|
||||
|
||||
if err = tx.Commit(); err != nil {
|
||||
return nil, errors.New("error while setting message visibility")
|
||||
}
|
||||
|
||||
// Tell the clients to hide/show these messages.
|
||||
return ids, nil
|
||||
}
|
||||
|
||||
func (r *SqlChatMessageRepository) SetMessageVisibilityForMessageIDs(messageIDs []string, visible bool) error {
|
||||
defer func() {
|
||||
_historyCache = nil
|
||||
}()
|
||||
|
||||
if len(messageIDs) == 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
r.datastore.DbLock.Lock()
|
||||
defer r.datastore.DbLock.Unlock()
|
||||
|
||||
tx, err := r.datastore.DB.Begin()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// nolint:gosec
|
||||
stmt, err := tx.Prepare("UPDATE messages SET hidden_at=? WHERE id IN (?" + strings.Repeat(",?", len(messageIDs)-1) + ")")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer stmt.Close()
|
||||
|
||||
var hiddenAt *time.Time
|
||||
if !visible {
|
||||
now := time.Now()
|
||||
hiddenAt = &now
|
||||
} else {
|
||||
hiddenAt = nil
|
||||
}
|
||||
|
||||
args := make([]interface{}, len(messageIDs)+1)
|
||||
args[0] = hiddenAt
|
||||
for i, id := range messageIDs {
|
||||
args[i+1] = id
|
||||
}
|
||||
|
||||
if _, err = stmt.Exec(args...); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err = tx.Commit(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetMessagesCount will return the number of messages in the database.
|
||||
func (r *SqlChatMessageRepository) GetMessagesCount() int64 {
|
||||
query := `SELECT COUNT(*) FROM messages`
|
||||
rows, err := r.datastore.DB.Query(query)
|
||||
if err != nil || rows.Err() != nil {
|
||||
return 0
|
||||
}
|
||||
defer rows.Close()
|
||||
var count int64
|
||||
for rows.Next() {
|
||||
if err := rows.Scan(&count); err != nil {
|
||||
return 0
|
||||
}
|
||||
}
|
||||
return count
|
||||
}
|
||||
@@ -4,7 +4,7 @@ import (
|
||||
"strings"
|
||||
|
||||
"github.com/owncast/owncast/core/data"
|
||||
"github.com/owncast/owncast/models"
|
||||
"github.com/owncast/owncast/webserver/handlers/generated"
|
||||
log "github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
@@ -63,8 +63,9 @@ func migrateToDatastoreValues2(datastore *data.Datastore, configRepository Confi
|
||||
oldAdminPassword, _ := datastore.GetString("stream_key")
|
||||
// Avoids double hashing the password
|
||||
_ = datastore.SetString("admin_password_key", oldAdminPassword)
|
||||
_ = configRepository.SetStreamKeys([]models.StreamKey{
|
||||
{Key: oldAdminPassword, Comment: "Default stream key"},
|
||||
comment := "Default stream key"
|
||||
_ = configRepository.SetStreamKeys([]generated.StreamKey{
|
||||
{Key: &oldAdminPassword, Comment: &comment},
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ import (
|
||||
|
||||
"github.com/owncast/owncast/models"
|
||||
"github.com/owncast/owncast/utils"
|
||||
"github.com/owncast/owncast/webserver/handlers/generated"
|
||||
)
|
||||
|
||||
type ConfigRepository interface {
|
||||
@@ -114,8 +115,8 @@ type ConfigRepository interface {
|
||||
SetCustomOfflineMessage(message string) error
|
||||
SetCustomColorVariableValues(variables map[string]string) error
|
||||
GetCustomColorVariableValues() map[string]string
|
||||
GetStreamKeys() []models.StreamKey
|
||||
SetStreamKeys(actions []models.StreamKey) error
|
||||
GetStreamKeys() []generated.StreamKey
|
||||
SetStreamKeys(actions []generated.StreamKey) error
|
||||
SetDisableSearchIndexing(disableSearchIndexing bool) error
|
||||
GetDisableSearchIndexing() bool
|
||||
GetVideoServingEndpoint() string
|
||||
|
||||
@@ -12,6 +12,7 @@ import (
|
||||
"github.com/owncast/owncast/models"
|
||||
"github.com/owncast/owncast/static"
|
||||
"github.com/owncast/owncast/utils"
|
||||
"github.com/owncast/owncast/webserver/handlers/generated"
|
||||
"github.com/pkg/errors"
|
||||
log "github.com/sirupsen/logrus"
|
||||
)
|
||||
@@ -957,22 +958,22 @@ func (r *SqlConfigRepository) GetCustomColorVariableValues() map[string]string {
|
||||
}
|
||||
|
||||
// GetStreamKeys will return valid stream keys.
|
||||
func (r *SqlConfigRepository) GetStreamKeys() []models.StreamKey {
|
||||
func (r *SqlConfigRepository) GetStreamKeys() []generated.StreamKey {
|
||||
configEntry, err := r.datastore.Get(streamKeysKey)
|
||||
if err != nil {
|
||||
return []models.StreamKey{}
|
||||
return []generated.StreamKey{}
|
||||
}
|
||||
|
||||
var streamKeys []models.StreamKey
|
||||
var streamKeys []generated.StreamKey
|
||||
if err := configEntry.GetObject(&streamKeys); err != nil {
|
||||
return []models.StreamKey{}
|
||||
return []generated.StreamKey{}
|
||||
}
|
||||
|
||||
return streamKeys
|
||||
}
|
||||
|
||||
// SetStreamKeys will set valid stream keys.
|
||||
func (r *SqlConfigRepository) SetStreamKeys(actions []models.StreamKey) error {
|
||||
func (r *SqlConfigRepository) SetStreamKeys(actions []generated.StreamKey) error {
|
||||
configEntry := models.ConfigEntry{Key: streamKeysKey, Value: actions}
|
||||
return r.datastore.Save(configEntry)
|
||||
}
|
||||
|
||||
17
persistence/tables/config.go
Normal file
17
persistence/tables/config.go
Normal file
@@ -0,0 +1,17 @@
|
||||
package tables
|
||||
|
||||
import (
|
||||
"database/sql"
|
||||
|
||||
"github.com/owncast/owncast/utils"
|
||||
)
|
||||
|
||||
func CreateConfigTable(db *sql.DB) {
|
||||
createTableSQL := `CREATE TABLE IF NOT EXISTS datastore (
|
||||
"key" string NOT NULL PRIMARY KEY,
|
||||
"value" BLOB,
|
||||
"timestamp" DATE DEFAULT CURRENT_TIMESTAMP NOT NULL
|
||||
);`
|
||||
|
||||
utils.MustExec(createTableSQL, db)
|
||||
}
|
||||
28
persistence/tables/webhooks.go
Normal file
28
persistence/tables/webhooks.go
Normal file
@@ -0,0 +1,28 @@
|
||||
package tables
|
||||
|
||||
import (
|
||||
"database/sql"
|
||||
|
||||
log "github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
func CreateWebhooksTable(db *sql.DB) {
|
||||
log.Traceln("Creating webhooks table...")
|
||||
|
||||
createTableSQL := `CREATE TABLE IF NOT EXISTS webhooks (
|
||||
"id" INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
"url" string NOT NULL,
|
||||
"events" TEXT NOT NULL,
|
||||
"timestamp" DATETIME DEFAULT CURRENT_TIMESTAMP,
|
||||
"last_used" DATETIME
|
||||
);`
|
||||
|
||||
stmt, err := db.Prepare(createTableSQL)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
defer stmt.Close()
|
||||
if _, err = stmt.Exec(); err != nil {
|
||||
log.Warnln(err)
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package data
|
||||
package webhookrepository
|
||||
|
||||
import (
|
||||
"errors"
|
||||
@@ -6,38 +6,51 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/owncast/owncast/core/data"
|
||||
"github.com/owncast/owncast/models"
|
||||
log "github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
func createWebhooksTable() {
|
||||
log.Traceln("Creating webhooks table...")
|
||||
type WebhookRepository interface {
|
||||
InsertWebhook(url string, events []models.EventType) (int, error)
|
||||
DeleteWebhook(id int) error
|
||||
GetWebhooksForEvent(event models.EventType) []models.Webhook
|
||||
GetWebhooks() ([]models.Webhook, error)
|
||||
SetWebhookAsUsed(webhook models.Webhook) error
|
||||
}
|
||||
|
||||
createTableSQL := `CREATE TABLE IF NOT EXISTS webhooks (
|
||||
"id" INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
"url" string NOT NULL,
|
||||
"events" TEXT NOT NULL,
|
||||
"timestamp" DATETIME DEFAULT CURRENT_TIMESTAMP,
|
||||
"last_used" DATETIME
|
||||
);`
|
||||
type SqlWebhookRepository struct {
|
||||
datastore *data.Datastore
|
||||
}
|
||||
|
||||
stmt, err := _db.Prepare(createTableSQL)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
// NOTE: This is temporary during the transition period.
|
||||
var temporaryGlobalInstance WebhookRepository
|
||||
|
||||
// Get will return the user repository.
|
||||
func Get() WebhookRepository {
|
||||
if temporaryGlobalInstance == nil {
|
||||
i := New(data.GetDatastore())
|
||||
temporaryGlobalInstance = i
|
||||
}
|
||||
defer stmt.Close()
|
||||
if _, err = stmt.Exec(); err != nil {
|
||||
log.Warnln(err)
|
||||
return temporaryGlobalInstance
|
||||
}
|
||||
|
||||
// New will create a new instance of the UserRepository.
|
||||
func New(datastore *data.Datastore) WebhookRepository {
|
||||
r := SqlWebhookRepository{
|
||||
datastore: datastore,
|
||||
}
|
||||
|
||||
return &r
|
||||
}
|
||||
|
||||
// InsertWebhook will add a new webhook to the database.
|
||||
func InsertWebhook(url string, events []models.EventType) (int, error) {
|
||||
func (r *SqlWebhookRepository) InsertWebhook(url string, events []models.EventType) (int, error) {
|
||||
log.Traceln("Adding new webhook")
|
||||
|
||||
eventsString := strings.Join(events, ",")
|
||||
|
||||
tx, err := _db.Begin()
|
||||
tx, err := r.datastore.DB.Begin()
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
@@ -65,10 +78,10 @@ func InsertWebhook(url string, events []models.EventType) (int, error) {
|
||||
}
|
||||
|
||||
// DeleteWebhook will delete a webhook from the database.
|
||||
func DeleteWebhook(id int) error {
|
||||
func (r *SqlWebhookRepository) DeleteWebhook(id int) error {
|
||||
log.Traceln("Deleting webhook")
|
||||
|
||||
tx, err := _db.Begin()
|
||||
tx, err := r.datastore.DB.Begin()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -96,7 +109,7 @@ func DeleteWebhook(id int) error {
|
||||
}
|
||||
|
||||
// GetWebhooksForEvent will return all of the webhooks that want to be notified about an event type.
|
||||
func GetWebhooksForEvent(event models.EventType) []models.Webhook {
|
||||
func (r *SqlWebhookRepository) GetWebhooksForEvent(event models.EventType) []models.Webhook {
|
||||
webhooks := make([]models.Webhook, 0)
|
||||
|
||||
query := `SELECT * FROM (
|
||||
@@ -111,9 +124,9 @@ func GetWebhooksForEvent(event models.EventType) []models.Webhook {
|
||||
SELECT id, url, event
|
||||
FROM split
|
||||
WHERE event <> ''
|
||||
) AS webhook WHERE event IS "` + event + `"`
|
||||
) AS webhook WHERE event IS ?`
|
||||
|
||||
rows, err := _db.Query(query)
|
||||
rows, err := r.datastore.DB.Query(query, event)
|
||||
if err != nil || rows.Err() != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
@@ -140,12 +153,12 @@ func GetWebhooksForEvent(event models.EventType) []models.Webhook {
|
||||
}
|
||||
|
||||
// GetWebhooks will return all the webhooks.
|
||||
func GetWebhooks() ([]models.Webhook, error) { //nolint
|
||||
func (r *SqlWebhookRepository) GetWebhooks() ([]models.Webhook, error) { //nolint
|
||||
webhooks := make([]models.Webhook, 0)
|
||||
|
||||
query := "SELECT * FROM webhooks"
|
||||
|
||||
rows, err := _db.Query(query)
|
||||
rows, err := r.datastore.DB.Query(query)
|
||||
if err != nil {
|
||||
return webhooks, err
|
||||
}
|
||||
@@ -193,8 +206,8 @@ func GetWebhooks() ([]models.Webhook, error) { //nolint
|
||||
}
|
||||
|
||||
// SetWebhookAsUsed will update the last used time for a webhook.
|
||||
func SetWebhookAsUsed(webhook models.Webhook) error {
|
||||
tx, err := _db.Begin()
|
||||
func (r *SqlWebhookRepository) SetWebhookAsUsed(webhook models.Webhook) error {
|
||||
tx, err := r.datastore.DB.Begin()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
4
static/metadata.html.tmpl
vendored
4
static/metadata.html.tmpl
vendored
@@ -18,6 +18,10 @@
|
||||
<meta property="og:image:url" content="{{.Thumbnail}}">
|
||||
<meta property="og:image:alt" content="{{.Image}}">
|
||||
|
||||
<meta property="og:video" content="{{.RequestedURL}}hls/stream.m3u8" />
|
||||
<meta property="og:video:secure_url" content="{{.RequestedURL}}hls/stream.m3u8" />
|
||||
<meta property="og:video:type" content="application/x-mpegURL" />
|
||||
|
||||
<meta property="og:video" content='{{.RequestedURL}}embed/video' />
|
||||
<meta property="og:video:secure_url" content='{{.RequestedURL}}embed/video' />
|
||||
<meta property="og:video:height" content="315" />
|
||||
|
||||
4
static/web/404.html
vendored
4
static/web/404.html
vendored
File diff suppressed because one or more lines are too long
4
static/web/404/index.html
vendored
4
static/web/404/index.html
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
1
static/web/_next/static/chunks/1071.7155db81e2a1f5dc.js
vendored
Normal file
1
static/web/_next/static/chunks/1071.7155db81e2a1f5dc.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1071,1577],{1399:function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default={icon:function(e,t){return{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm288.5 682.8L277.7 224C258 240 240 258 224 277.7l522.8 522.8C682.8 852.7 601 884 512 884c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372c0 89-31.3 170.8-83.5 234.8z",fill:e}},{tag:"path",attrs:{d:"M512 140c-205.4 0-372 166.6-372 372s166.6 372 372 372c89 0 170.8-31.3 234.8-83.5L224 277.7c16-19.7 34-37.7 53.7-53.7l522.8 522.8C852.7 682.8 884 601 884 512c0-205.4-166.6-372-372-372z",fill:t}}]}},name:"stop",theme:"twotone"}},71071:function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n,a=(n=r(98678))&&n.__esModule?n:{default:n};t.default=a,e.exports=a},98678:function(e,t,r){var n=r(64836),a=r(18698);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var u=n(r(42122)),f=function(e,t){if(e&&e.__esModule)return e;if(null===e||"object"!=a(e)&&"function"!=typeof e)return{default:e};var r=c(void 0);if(r&&r.has(e))return r.get(e);var n={__proto__:null},u=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var f in e)if("default"!==f&&({}).hasOwnProperty.call(e,f)){var l=u?Object.getOwnPropertyDescriptor(e,f):null;l&&(l.get||l.set)?Object.defineProperty(n,f,l):n[f]=e[f]}return n.default=e,r&&r.set(e,n),n}(r(67294)),l=n(r(1399)),o=n(r(3247));function c(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,r=new WeakMap;return(c=function(e){return e?r:t})(e)}var i=f.forwardRef(function(e,t){return f.createElement(o.default,(0,u.default)((0,u.default)({},e),{},{ref:t,icon:l.default}))});t.default=i}}]);
|
||||
@@ -1 +0,0 @@
|
||||
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1071],{1399:function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default={icon:function(e,t){return{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm288.5 682.8L277.7 224C258 240 240 258 224 277.7l522.8 522.8C682.8 852.7 601 884 512 884c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372c0 89-31.3 170.8-83.5 234.8z",fill:e}},{tag:"path",attrs:{d:"M512 140c-205.4 0-372 166.6-372 372s166.6 372 372 372c89 0 170.8-31.3 234.8-83.5L224 277.7c16-19.7 34-37.7 53.7-53.7l522.8 522.8C852.7 682.8 884 601 884 512c0-205.4-166.6-372-372-372z",fill:t}}]}},name:"stop",theme:"twotone"}},71071:function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n,a=(n=r(98678))&&n.__esModule?n:{default:n};t.default=a,e.exports=a},98678:function(e,t,r){var n=r(64836),a=r(18698);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var u=n(r(42122)),f=function(e,t){if(e&&e.__esModule)return e;if(null===e||"object"!=a(e)&&"function"!=typeof e)return{default:e};var r=c(void 0);if(r&&r.has(e))return r.get(e);var n={__proto__:null},u=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var f in e)if("default"!==f&&({}).hasOwnProperty.call(e,f)){var l=u?Object.getOwnPropertyDescriptor(e,f):null;l&&(l.get||l.set)?Object.defineProperty(n,f,l):n[f]=e[f]}return n.default=e,r&&r.set(e,n),n}(r(67294)),l=n(r(1399)),o=n(r(3247));function c(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,r=new WeakMap;return(c=function(e){return e?r:t})(e)}var i=f.forwardRef(function(e,t){return f.createElement(o.default,(0,u.default)((0,u.default)({},e),{},{ref:t,icon:l.default}))});t.default=i}}]);
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
1
static/web/_next/static/chunks/1577.d21c2a275981c56a.js
vendored
Normal file
1
static/web/_next/static/chunks/1577.d21c2a275981c56a.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1577,1071],{1399:function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default={icon:function(e,t){return{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm288.5 682.8L277.7 224C258 240 240 258 224 277.7l522.8 522.8C682.8 852.7 601 884 512 884c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372c0 89-31.3 170.8-83.5 234.8z",fill:e}},{tag:"path",attrs:{d:"M512 140c-205.4 0-372 166.6-372 372s166.6 372 372 372c89 0 170.8-31.3 234.8-83.5L224 277.7c16-19.7 34-37.7 53.7-53.7l522.8 522.8C852.7 682.8 884 601 884 512c0-205.4-166.6-372-372-372z",fill:t}}]}},name:"stop",theme:"twotone"}},71071:function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n,a=(n=r(98678))&&n.__esModule?n:{default:n};t.default=a,e.exports=a},98678:function(e,t,r){var n=r(64836),a=r(18698);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var u=n(r(42122)),f=function(e,t){if(e&&e.__esModule)return e;if(null===e||"object"!=a(e)&&"function"!=typeof e)return{default:e};var r=c(void 0);if(r&&r.has(e))return r.get(e);var n={__proto__:null},u=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var f in e)if("default"!==f&&({}).hasOwnProperty.call(e,f)){var l=u?Object.getOwnPropertyDescriptor(e,f):null;l&&(l.get||l.set)?Object.defineProperty(n,f,l):n[f]=e[f]}return n.default=e,r&&r.set(e,n),n}(r(67294)),l=n(r(1399)),o=n(r(3247));function c(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,r=new WeakMap;return(c=function(e){return e?r:t})(e)}var i=f.forwardRef(function(e,t){return f.createElement(o.default,(0,u.default)((0,u.default)({},e),{},{ref:t,icon:l.default}))});t.default=i}}]);
|
||||
File diff suppressed because one or more lines are too long
1
static/web/_next/static/chunks/1764-c71735b48a8583f9.js
vendored
Normal file
1
static/web/_next/static/chunks/1764-c71735b48a8583f9.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
static/web/_next/static/chunks/2122-afd1e0771501915c.js
vendored
Normal file
1
static/web/_next/static/chunks/2122-afd1e0771501915c.js
vendored
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
1
static/web/_next/static/chunks/2154-63dd456ac6fee50f.js
vendored
Normal file
1
static/web/_next/static/chunks/2154-63dd456ac6fee50f.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
static/web/_next/static/chunks/3064-157aa26d174703e1.js
vendored
Normal file
1
static/web/_next/static/chunks/3064-157aa26d174703e1.js
vendored
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
1
static/web/_next/static/chunks/3897-5526b015f5efd5a3.js
vendored
Normal file
1
static/web/_next/static/chunks/3897-5526b015f5efd5a3.js
vendored
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
1
static/web/_next/static/chunks/4619.1cd2488042700e58.js
vendored
Normal file
1
static/web/_next/static/chunks/4619.1cd2488042700e58.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4619],{54619:function(e,t,o){"use strict";o.r(t),o.d(t,{NotifyReminderPopup:function(){return h}});var n=o(85893),s=o(67294),r=o(5152),c=o.n(r),i=o(37039),l=o(4330),a=o.n(l),p=o(62960),u=o.n(p);let d=e=>{let{open:t,title:o,content:s,children:r}=e;return(0,n.jsxs)("div",{style:{width:"max-content",height:"max-content"},children:[t&&(0,n.jsx)("div",{className:u().anchor,children:(0,n.jsxs)("div",{className:u().popover,children:[(0,n.jsx)("div",{className:u().title,children:o}),(0,n.jsx)("hr",{style:{color:"var(--color-owncast-palette-4)"}}),(0,n.jsx)("div",{className:u().content,children:s})]})}),r]})},_=c()(()=>o.e(2155).then(o.t.bind(o,12155,23)),{loadableGenerated:{webpack:()=>[12155]},ssr:!1}),h=e=>{let{children:t,open:o,notificationClicked:r,notificationClosed:c}=e,[l,p]=(0,s.useState)(o),[u,h]=(0,s.useState)(!1),{t:m}=(0,i.$G)();(0,s.useEffect)(()=>{p(o)},[o]),(0,s.useEffect)(()=>{h(!0)},[]);let v=(0,n.jsx)("div",{className:a().title,children:m("Stay updated!")}),b=e=>{e.stopPropagation(),r()},x=(0,n.jsxs)("div",{onClick:b,onKeyDown:b,role:"menuitem",tabIndex:0,children:[(0,n.jsx)("button",{type:"button","aria-label":"Follow",className:a().closebutton,onClick:e=>{e.stopPropagation(),p(!1),c()},children:(0,n.jsx)(_,{})}),(0,n.jsx)("div",{className:a().contentbutton,children:m("Click and never miss future streams!")})]});return u&&(0,n.jsx)(d,{open:l,title:v,content:x,children:t})}},4330:function(e){e.exports={popupBackgroundColor:"var(--theme-color-components-primary-button-background)",contentbutton:"NotifyReminderPopup_contentbutton___iqOh",closebutton:"NotifyReminderPopup_closebutton__dpvj4",title:"NotifyReminderPopup_title__imysF"}},62960:function(e){e.exports={anchor:"Popover_anchor__GI7l_",popover:"Popover_popover__pMNs7",title:"Popover_title__T__E6",content:"Popover_content__7gDLm"}}}]);
|
||||
@@ -1 +0,0 @@
|
||||
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4619],{54619:function(e,t,o){"use strict";o.r(t),o.d(t,{NotifyReminderPopup:function(){return _}});var n=o(85893),s=o(67294),r=o(5152),c=o.n(r),i=o(4330),l=o.n(i),a=o(62960),p=o.n(a);let u=e=>{let{open:t,title:o,content:s,children:r}=e;return(0,n.jsxs)("div",{style:{width:"max-content",height:"max-content"},children:[t&&(0,n.jsx)("div",{className:p().anchor,children:(0,n.jsxs)("div",{className:p().popover,children:[(0,n.jsx)("div",{className:p().title,children:o}),(0,n.jsx)("hr",{style:{color:"var(--color-owncast-palette-4)"}}),(0,n.jsx)("div",{className:p().content,children:s})]})}),r]})},d=c()(()=>o.e(2155).then(o.t.bind(o,12155,23)),{loadableGenerated:{webpack:()=>[12155]},ssr:!1}),_=e=>{let{children:t,open:o,notificationClicked:r,notificationClosed:c}=e,[i,a]=(0,s.useState)(o),[p,_]=(0,s.useState)(!1);(0,s.useEffect)(()=>{a(o)},[o]),(0,s.useEffect)(()=>{_(!0)},[]);let h=(0,n.jsx)("div",{className:l().title,children:"Stay updated!"}),m=e=>{e.stopPropagation(),r()},v=(0,n.jsxs)("div",{onClick:m,onKeyDown:m,role:"menuitem",tabIndex:0,children:[(0,n.jsx)("button",{type:"button","aria-label":"Follow",className:l().closebutton,onClick:e=>{e.stopPropagation(),a(!1),c()},children:(0,n.jsx)(d,{})}),(0,n.jsx)("div",{className:l().contentbutton,children:"Click and never miss future streams!"})]});return p&&(0,n.jsx)(u,{open:i,title:h,content:v,children:t})}},4330:function(e){e.exports={popupBackgroundColor:"var(--theme-color-components-primary-button-background)",contentbutton:"NotifyReminderPopup_contentbutton___iqOh",closebutton:"NotifyReminderPopup_closebutton__dpvj4",title:"NotifyReminderPopup_title__imysF"}},62960:function(e){e.exports={anchor:"Popover_anchor__GI7l_",popover:"Popover_popover__pMNs7",title:"Popover_title__T__E6",content:"Popover_content__7gDLm"}}}]);
|
||||
1
static/web/_next/static/chunks/4623-cb89457fd422ee86.js
vendored
Normal file
1
static/web/_next/static/chunks/4623-cb89457fd422ee86.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
static/web/_next/static/chunks/4ad82c5e-3889b9ac4c937ea1.js
vendored
Normal file
1
static/web/_next/static/chunks/4ad82c5e-3889b9ac4c937ea1.js
vendored
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
1
static/web/_next/static/chunks/5889-238bd5f460649ac4.js
vendored
Normal file
1
static/web/_next/static/chunks/5889-238bd5f460649ac4.js
vendored
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
1
static/web/_next/static/chunks/5915-7486f94aae1355a0.js
vendored
Normal file
1
static/web/_next/static/chunks/5915-7486f94aae1355a0.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
static/web/_next/static/chunks/627-15dce062961cc145.js
vendored
Normal file
1
static/web/_next/static/chunks/627-15dce062961cc145.js
vendored
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
1
static/web/_next/static/chunks/6864.eeb7acff37c7e2e2.js
vendored
Normal file
1
static/web/_next/static/chunks/6864.eeb7acff37c7e2e2.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
static/web/_next/static/chunks/7039-609f7b8656e52725.js
vendored
Normal file
1
static/web/_next/static/chunks/7039-609f7b8656e52725.js
vendored
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user