0

Merge remote-tracking branch 'origin/develop' into webv2

This commit is contained in:
Gabe Kangas 2022-07-11 21:21:07 -07:00
commit 506d1fa4cf
No known key found for this signature in database
GPG Key ID: 9A56337728BC81EA
16 changed files with 695 additions and 2043 deletions

View File

@ -1,40 +0,0 @@
# See https://docs.earthly.dev/ci-integration/vendor-specific-guides/gh-actions-integration
# for details.
name: Build nightly docker
on:
workflow_dispatch:
schedule:
- cron: '0 2 * * *'
jobs:
Docker:
runs-on: ubuntu-latest
steps:
- uses: earthly/actions-setup@v1
with:
version: 'latest' # or pin to an specific version, e.g. "v0.6.10"
- name: Earthly version
run: earthly --version
- name: Log into GitHub Container Registry
env:
GH_CR_PAT: ${{ secrets.GH_CR_PAT }}
run: echo "${{ secrets.GH_CR_PAT }}" | docker login https://ghcr.io -u ${{ github.actor }} --password-stdin
if: env.GH_CR_PAT != null
- name: Set up QEMU
id: qemu
uses: docker/setup-qemu-action@v1
with:
image: tonistiigi/binfmt:latest
platforms: all
- uses: actions/checkout@v3
- name: Checkout and build
if: env.GH_CR_PAT != null
env:
GH_CR_PAT: ${{ secrets.GH_CR_PAT }}
run: cd build/release && ./docker-nightly-earthly.sh

View File

@ -1,14 +1,23 @@
# See https://docs.earthly.dev/ci-integration/vendor-specific-guides/gh-actions-integration
# for details.
name: Build nightly docker name: Build nightly docker
on: on:
workflow_dispatch: workflow_dispatch:
schedule: schedule:
- cron: "0 2 * * *" - cron: '0 2 * * *'
jobs: jobs:
Docker: Docker:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: earthly/actions-setup@v1
with:
version: 'latest' # or pin to an specific version, e.g. "v0.6.10"
- name: Earthly version
run: earthly --version
- name: Log into GitHub Container Registry - name: Log into GitHub Container Registry
env: env:
@ -16,9 +25,16 @@ jobs:
run: echo "${{ secrets.GH_CR_PAT }}" | docker login https://ghcr.io -u ${{ github.actor }} --password-stdin run: echo "${{ secrets.GH_CR_PAT }}" | docker login https://ghcr.io -u ${{ github.actor }} --password-stdin
if: env.GH_CR_PAT != null if: env.GH_CR_PAT != null
- name: Set up QEMU
id: qemu
uses: docker/setup-qemu-action@v1
with:
image: tonistiigi/binfmt:latest
platforms: all
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Setup and run - name: Checkout and build
if: env.GH_CR_PAT != null
env: env:
GH_CR_PAT: ${{ secrets.GH_CR_PAT }} GH_CR_PAT: ${{ secrets.GH_CR_PAT }}
run: cd build/release && ./docker-nightly.sh run: cd build/release && ./docker-nightly.sh
if: env.GH_CR_PAT != null

View File

@ -178,11 +178,11 @@ func GetResolvedPublicKeyFromIRI(publicKeyIRI string) (vocab.W3IDSecurityV1Publi
} }
if err != nil { if err != nil {
err = errors.Wrap(err, "error resolving publickey from iri") err = errors.Wrap(err, "error resolving publickey from iri, actor may not be valid: "+publicKeyIRI)
} }
if !resolved { if !resolved {
err = errors.New("error resolving publickey from iri") err = errors.New("error resolving publickey from iri, actor may not be valid: " + publicKeyIRI)
} }
return pubkey, err return pubkey, err

View File

@ -1,14 +0,0 @@
#!/bin/sh
# Docker build
# Must authenticate first: https://docs.github.com/en/packages/using-github-packages-with-your-projects-ecosystem/configuring-docker-for-use-with-github-packages#authenticating-to-github-packages
DOCKER_IMAGE="owncast-earthly"
DATE=$(date +"%Y%m%d")
VERSION="${DATE}-nightly"
echo "Building Docker image ${DOCKER_IMAGE}..."
# Change to the root directory of the repository
cd $(git rev-parse --show-toplevel)
earthly --ci --push +docker-all --image="ghcr.io/owncast/${DOCKER_IMAGE}" --tag=nightly --version="${VERSION}"

View File

@ -1,29 +1,14 @@
#!/bin/sh
# Docker build # Docker build
# Must authenticate first: https://docs.github.com/en/packages/using-github-packages-with-your-projects-ecosystem/configuring-docker-for-use-with-github-packages#authenticating-to-github-packages # Must authenticate first: https://docs.github.com/en/packages/using-github-packages-with-your-projects-ecosystem/configuring-docker-for-use-with-github-packages#authenticating-to-github-packages
DOCKER_IMAGE="owncast" DOCKER_IMAGE="owncast"
DATE=$(date +"%Y%m%d") DATE=$(date +"%Y%m%d")
VERSION="${DATE}-nightly" VERSION="${DATE}-nightly"
GIT_COMMIT=$(git rev-list -1 HEAD)
# Create production build of Tailwind CSS
pushd ../../build/javascript >> /dev/null
# Install the tailwind & postcss CLIs
npm install --quiet --no-progress
# Run the tailwind CLI and pipe it to postcss for minification.
# Save it to a temp directory that we will reference below.
NODE_ENV="production" ./node_modules/.bin/tailwind build | ./node_modules/.bin/postcss > "../../webroot/js/web_modules/tailwindcss/dist/tailwind.min.css"
popd
echo "Building Docker image ${DOCKER_IMAGE}..." echo "Building Docker image ${DOCKER_IMAGE}..."
# Change to the root directory of the repository # Change to the root directory of the repository
cd $(git rev-parse --show-toplevel) cd $(git rev-parse --show-toplevel)
# Docker build earthly --ci --push +docker-all --image="ghcr.io/owncast/${DOCKER_IMAGE}" --tag=nightly --version="${VERSION}"
docker build --build-arg NAME=docker --build-arg VERSION=${VERSION} --build-arg GIT_COMMIT=$GIT_COMMIT -t ghcr.io/owncast/${DOCKER_IMAGE}:nightly .
# Dockerhub
# You must be authenticated via `docker login` with your Dockerhub credentials first.
# docker push gabekangas/owncast:nightly
docker push ghcr.io/owncast/${DOCKER_IMAGE}:nightly

View File

@ -686,7 +686,7 @@ paths:
type: string type: string
example: https://fediverse.biz/authorize_interaction?uri=https://my.owncast.server/federation/user/streamer example: https://fediverse.biz/authorize_interaction?uri=https://my.owncast.server/federation/user/streamer
/api/chat/updatemessagevisibility: /api/chat/messagevisibility:
post: post:
summary: Update the visibility of chat messages. summary: Update the visibility of chat messages.
description: Pass an array of IDs you want to change the chat visibility of. description: Pass an array of IDs you want to change the chat visibility of.
@ -951,7 +951,7 @@ paths:
type: string type: string
format: date-time format: date-time
/api/admin/chat/updatemessagevisibility: /api/admin/chat/messagevisibility:
post: post:
summary: Update the visibility of chat messages. summary: Update the visibility of chat messages.
description: Pass an array of IDs you want to change the chat visibility of. description: Pass an array of IDs you want to change the chat visibility of.
@ -1984,7 +1984,7 @@ paths:
type: string type: string
format: date-time format: date-time
/api/integrations/chat/updatemessagevisibility: /api/integrations/chat/messagevisibility:
post: post:
summary: Update the visibility of chat messages. summary: Update the visibility of chat messages.
description: Pass an array of IDs you want to change the chat visibility of. description: Pass an array of IDs you want to change the chat visibility of.

View File

@ -131,7 +131,7 @@ func Start() error {
http.HandleFunc("/api/admin/chat/messages", middleware.RequireAdminAuth(admin.GetChatMessages)) http.HandleFunc("/api/admin/chat/messages", middleware.RequireAdminAuth(admin.GetChatMessages))
// Update chat message visibility // Update chat message visibility
http.HandleFunc("/api/admin/chat/updatemessagevisibility", middleware.RequireAdminAuth(admin.UpdateMessageVisibility)) http.HandleFunc("/api/admin/chat/messagevisibility", middleware.RequireAdminAuth(admin.UpdateMessageVisibility))
// Enable/disable a user // Enable/disable a user
http.HandleFunc("/api/admin/chat/users/setenabled", middleware.RequireAdminAuth(admin.UpdateUserEnabled)) http.HandleFunc("/api/admin/chat/users/setenabled", middleware.RequireAdminAuth(admin.UpdateUserEnabled))
@ -318,7 +318,7 @@ func Start() error {
// Inline chat moderation actions // Inline chat moderation actions
// Update chat message visibility // Update chat message visibility
http.HandleFunc("/api/chat/updatemessagevisibility", middleware.RequireUserModerationScopeAccesstoken(admin.UpdateMessageVisibility)) http.HandleFunc("/api/chat/messagevisibility", middleware.RequireUserModerationScopeAccesstoken(admin.UpdateMessageVisibility))
// Enable/disable a user // Enable/disable a user
http.HandleFunc("/api/chat/users/setenabled", middleware.RequireUserModerationScopeAccesstoken(admin.UpdateUserEnabled)) http.HandleFunc("/api/chat/users/setenabled", middleware.RequireUserModerationScopeAccesstoken(admin.UpdateUserEnabled))

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

View File

@ -56,7 +56,7 @@ test('verify we can make API call to mark message as hidden', async (done) => {
const message = res.body[0]; const message = res.body[0];
messageId = message.id; messageId = message.id;
await request await request
.post('/api/admin/chat/updatemessagevisibility') .post('/api/admin/chat/messagevisibility')
.auth('admin', 'abc123') .auth('admin', 'abc123')
.send({ idArray: [messageId], visible: false }) .send({ idArray: [messageId], visible: false })
.expect(200); .expect(200);

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1188,9 +1188,9 @@
"integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==" "integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q=="
}, },
"moment": { "moment": {
"version": "2.29.2", "version": "2.29.4",
"resolved": "https://registry.npmjs.org/moment/-/moment-2.29.2.tgz", "resolved": "https://registry.npmjs.org/moment/-/moment-2.29.4.tgz",
"integrity": "sha512-UgzG4rvxYpN15jgCmVJwac49h9ly9NurikMWGPdVxm8GZD6XjkKPxDTjQQ43gtGgnV3X0cAyWDdP2Wexoquifg==" "integrity": "sha512-5LC9SOxjSc2HF6vO2CyuTDNivEdoz2IvyJJGj6X8DJ0eFyfszE0QiEd+iXmBvUP3WHxSjFH/vIsA0EN00cgr8w=="
}, },
"ms": { "ms": {
"version": "2.1.2", "version": "2.1.2",

View File

@ -7,7 +7,7 @@ export const URL_CONFIG = `/api/config`;
export const URL_VIEWER_PING = `/api/ping`; export const URL_VIEWER_PING = `/api/ping`;
// inline moderation actions // inline moderation actions
export const URL_HIDE_MESSAGE = `/api/chat/updatemessagevisibility`; export const URL_HIDE_MESSAGE = `/api/chat/messagevisibility`;
export const URL_BAN_USER = `/api/chat/users/setenabled`; export const URL_BAN_USER = `/api/chat/users/setenabled`;
// TODO: This directory is customizable in the config. So we should expose this via the config API. // TODO: This directory is customizable in the config. So we should expose this via the config API.

View File

@ -22,27 +22,28 @@ export default class FollowerList extends Component {
} }
} }
async getFollowers() { async getFollowers(requestedPage) {
const { currentPage } = this.state;
const limit = 24; const limit = 24;
const offset = currentPage * limit; const offset = requestedPage * limit;
const u = `${URL_FOLLOWERS}?offset=${offset}&limit=${limit}`; const u = `${URL_FOLLOWERS}?offset=${offset || 0}&limit=${limit}`;
const response = await fetch(u); const response = await fetch(u);
const followers = await response.json(); const followers = await response.json();
const pages = Math.ceil(followers.total / limit);
this.setState({ this.setState({
followers: followers.results, followers: followers.results,
total: response.total, total: followers.total,
pages: pages,
}); });
} }
changeFollowersPage(page) { changeFollowersPage(requestedPage) {
this.setState({ currentPage: page }); this.setState({ currentPage: requestedPage });
this.getFollowers(); this.getFollowers(requestedPage);
} }
render() { render() {
const { followers, total, currentPage } = this.state; const { followers, total, pages, currentPage } = this.state;
if (!followers) { if (!followers) {
return null; return null;
} }
@ -62,8 +63,8 @@ export default class FollowerList extends Component {
</div>`; </div>`;
const paginationControls = const paginationControls =
total > 1 && pages > 1 &&
Array(total) Array(pages)
.fill() .fill()
.map((x, n) => { .map((x, n) => {
const activePageClass = const activePageClass =