Compare commits
No commits in common. 'develop' and 'gek/test-caches' have entirely different histories.
develop
...
gek/test-c
1154 changed files with 31280 additions and 40752 deletions
@ -0,0 +1,23 @@ |
|||||||
|
<!-- this template is for changes relating to #2119. You might want to use the standard template. --> |
||||||
|
|
||||||
|
# Description |
||||||
|
|
||||||
|
<!-- do not remove --> |
||||||
|
This PR is for updating/adding a component following the atomic design pattern set out in #2119. |
||||||
|
|
||||||
|
<!-- mention the component you changed, and describe any design choices if necessary --> |
||||||
|
|
||||||
|
--- |
||||||
|
|
||||||
|
Extra Info |
||||||
|
|
||||||
|
<!-- fill these in --> |
||||||
|
- Component name in [kanban board](https://collab.owncast.tv/kanban/#/2/kanban/edit/omLI2N+LcnP+elmdT7qW9GHD/): `________` |
||||||
|
|
||||||
|
Checklist: |
||||||
|
- [] The component follows the [design guide](../../web/components/_COMPONENT_HOW_TO.md). |
||||||
|
- [] Moved the component to the correct `atoms` / `molecules` / `organisms` / `templates` directory. |
||||||
|
- [] Added an explanation to this PR for any major changes you made. |
||||||
|
- [] Replaced any [`defaultProps`](https://www.reactjstutorials.com/react-basics/17/react-default-props) with default args. |
||||||
|
- [] Added a (short) JSDoc description to the component. |
||||||
|
- [] Removed the component's Storybook description text with if it's not needed. |
||||||
@ -1,4 +0,0 @@ |
|||||||
name: Javascript config |
|
||||||
|
|
||||||
paths-ignore: |
|
||||||
- static/web |
|
||||||
@ -0,0 +1,44 @@ |
|||||||
|
name: Build and bundle web app into Owncast |
||||||
|
on: |
||||||
|
push: |
||||||
|
branches: |
||||||
|
- develop |
||||||
|
paths: |
||||||
|
- 'web/**' |
||||||
|
- '!**.md' |
||||||
|
|
||||||
|
jobs: |
||||||
|
bundle: |
||||||
|
runs-on: ubuntu-latest |
||||||
|
if: github.repository == 'owncast/owncast' |
||||||
|
|
||||||
|
steps: |
||||||
|
- id: skip_check |
||||||
|
uses: fkirc/skip-duplicate-actions@v5 |
||||||
|
with: |
||||||
|
concurrent_skipping: 'same_content_newer' |
||||||
|
|
||||||
|
- name: Cache node modules |
||||||
|
uses: actions/cache@v2 |
||||||
|
env: |
||||||
|
cache-name: cache-node-modules-bundle-web-app |
||||||
|
with: |
||||||
|
path: ~/.npm |
||||||
|
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('web/package-lock.json') }} |
||||||
|
restore-keys: | |
||||||
|
${{ runner.os }}-build-${{ env.cache-name }}- |
||||||
|
${{ runner.os }}-build- |
||||||
|
${{ runner.os }}- |
||||||
|
|
||||||
|
- name: Bundle web app (next.js build) |
||||||
|
uses: actions/checkout@v3 |
||||||
|
- run: build/web/bundleWeb.sh |
||||||
|
|
||||||
|
- name: Commit changes |
||||||
|
uses: EndBug/add-and-commit@v9 |
||||||
|
with: |
||||||
|
pull: --rebase --autostash |
||||||
|
message: 'Bundle embedded web app' |
||||||
|
add: 'static/web' |
||||||
|
author_name: Owncast |
||||||
|
author_email: owncast@owncast.online |
||||||
@ -1,185 +0,0 @@ |
|||||||
name: Javascript |
|
||||||
|
|
||||||
# This action works with pull requests and pushes |
|
||||||
on: |
|
||||||
push: |
|
||||||
paths: |
|
||||||
- web/** |
|
||||||
- '!**.md' |
|
||||||
|
|
||||||
pull_request: |
|
||||||
paths: |
|
||||||
- web/** |
|
||||||
- '!**.md' |
|
||||||
|
|
||||||
jobs: |
|
||||||
formatting: |
|
||||||
name: Code formatting |
|
||||||
runs-on: ubuntu-latest |
|
||||||
defaults: |
|
||||||
run: |
|
||||||
working-directory: ./web |
|
||||||
|
|
||||||
steps: |
|
||||||
- id: skip_check |
|
||||||
uses: fkirc/skip-duplicate-actions@v5 |
|
||||||
with: |
|
||||||
concurrent_skipping: 'same_content_newer' |
|
||||||
cancel_others: 'true' |
|
||||||
skip_after_successful_duplicate: 'true' |
|
||||||
|
|
||||||
- name: Checkout |
|
||||||
uses: actions/checkout@v4 |
|
||||||
with: |
|
||||||
# Make sure the actual branch is checked out when running on pull requests |
|
||||||
ref: ${{ github.event.pull_request.head.ref }} |
|
||||||
repository: ${{ github.event.pull_request.head.repo.full_name }} |
|
||||||
fetch-depth: 0 |
|
||||||
persist-credentials: true |
|
||||||
|
|
||||||
- name: Get changed files |
|
||||||
id: changed-files-yaml |
|
||||||
uses: tj-actions/changed-files@v41 |
|
||||||
with: |
|
||||||
path: 'web' |
|
||||||
files_ignore: | |
|
||||||
static/** |
|
||||||
web/next.config.js |
|
||||||
files_yaml: | |
|
||||||
src: |
|
||||||
- '**/*.{js,ts,tsx,jsx,css,md}' |
|
||||||
|
|
||||||
- name: Cache node modules |
|
||||||
uses: actions/cache@v3 |
|
||||||
env: |
|
||||||
cache-name: cache-node-modules-bundle-web-app |
|
||||||
with: |
|
||||||
path: ~/.npm |
|
||||||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('web/package-lock.json') }} |
|
||||||
restore-keys: | |
|
||||||
${{ runner.os }}-build-${{ env.cache-name }}- |
|
||||||
${{ runner.os }}-build- |
|
||||||
${{ runner.os }}- |
|
||||||
|
|
||||||
- name: Install Dependencies |
|
||||||
run: npm install |
|
||||||
|
|
||||||
- name: Lint |
|
||||||
if: steps.changed-files-yaml.outputs.src_any_changed == 'true' |
|
||||||
run: npx eslint --fix ${{ steps.changed-files-yaml.outputs.src_all_changed_files }} |
|
||||||
|
|
||||||
- name: Prettier |
|
||||||
if: steps.changed-files-yaml.outputs.src_any_changed == 'true' |
|
||||||
run: npx prettier --write ${{ steps.changed-files-yaml.outputs.src_all_changed_files }} |
|
||||||
|
|
||||||
- name: Commit changes |
|
||||||
if: steps.changed-files-yaml.outputs.src_any_changed == 'true' |
|
||||||
uses: EndBug/add-and-commit@v9 |
|
||||||
with: |
|
||||||
author_name: Owncast |
|
||||||
author_email: owncast@owncast.online |
|
||||||
message: 'Javascript formatting autofixes' |
|
||||||
add: ${{ steps.changed-files-yaml.outputs.src_all_changed_files }} |
|
||||||
pull: '--rebase --autostash' |
|
||||||
|
|
||||||
unused-code: |
|
||||||
name: Test for unused code |
|
||||||
runs-on: ubuntu-latest |
|
||||||
defaults: |
|
||||||
run: |
|
||||||
working-directory: ./web |
|
||||||
|
|
||||||
steps: |
|
||||||
- id: skip_check |
|
||||||
uses: fkirc/skip-duplicate-actions@v5 |
|
||||||
with: |
|
||||||
concurrent_skipping: 'same_content_newer' |
|
||||||
cancel_others: 'true' |
|
||||||
skip_after_successful_duplicate: 'true' |
|
||||||
|
|
||||||
- name: Checkout |
|
||||||
uses: actions/checkout@v4 |
|
||||||
with: |
|
||||||
# Make sure the actual branch is checked out when running on pull requests |
|
||||||
ref: ${{ github.event.pull_request.head.ref }} |
|
||||||
repository: ${{ github.event.pull_request.head.repo.full_name }} |
|
||||||
fetch-depth: 0 |
|
||||||
|
|
||||||
- name: Cache node modules |
|
||||||
uses: actions/cache@v3 |
|
||||||
env: |
|
||||||
cache-name: cache-node-modules-bundle-web-app |
|
||||||
with: |
|
||||||
path: ~/.npm |
|
||||||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('web/package-lock.json') }} |
|
||||||
restore-keys: | |
|
||||||
${{ runner.os }}-build-${{ env.cache-name }}- |
|
||||||
${{ runner.os }}-build- |
|
||||||
${{ runner.os }}- |
|
||||||
|
|
||||||
- name: Install Dependencies |
|
||||||
run: npm install |
|
||||||
|
|
||||||
- name: Check for unused JS code and dependencies |
|
||||||
run: npx knip --include dependencies,files,exports |
|
||||||
|
|
||||||
# After any formatting and linting is complete we can run the build |
|
||||||
# and bundle step. This both will verify that the build is successful as |
|
||||||
# well as commiting the updated static files into the repository for use. |
|
||||||
web-bundle: |
|
||||||
name: Build and bundle web project |
|
||||||
runs-on: ubuntu-latest |
|
||||||
if: github.repository == 'owncast/owncast' |
|
||||||
needs: [formatting, unused-code] |
|
||||||
steps: |
|
||||||
- id: skip_check |
|
||||||
uses: fkirc/skip-duplicate-actions@v5 |
|
||||||
with: |
|
||||||
concurrent_skipping: 'same_content_newer' |
|
||||||
cancel_others: 'true' |
|
||||||
skip_after_successful_duplicate: 'true' |
|
||||||
|
|
||||||
- name: Cache node modules |
|
||||||
uses: actions/cache@v3 |
|
||||||
env: |
|
||||||
cache-name: cache-node-modules-bundle-web-app |
|
||||||
with: |
|
||||||
path: ~/.npm |
|
||||||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('web/package-lock.json') }} |
|
||||||
restore-keys: | |
|
||||||
${{ runner.os }}-build-${{ env.cache-name }}- |
|
||||||
${{ runner.os }}-build- |
|
||||||
${{ runner.os }}- |
|
||||||
|
|
||||||
- name: Checkout |
|
||||||
uses: actions/checkout@v4 |
|
||||||
with: |
|
||||||
# Make sure the actual branch is checked out when running on pull requests |
|
||||||
ref: ${{ github.event.pull_request.head.ref }} |
|
||||||
repository: ${{ github.event.pull_request.head.repo.full_name }} |
|
||||||
fetch-depth: 0 |
|
||||||
|
|
||||||
- name: Bundle web app (next.js build) |
|
||||||
run: build/web/bundleWeb.sh |
|
||||||
|
|
||||||
- name: Rebase |
|
||||||
if: ${{ github.ref == 'refs/heads/develop' }} |
|
||||||
run: | |
|
||||||
git add static/web |
|
||||||
git pull --rebase --autostash |
|
||||||
|
|
||||||
# Only commit built web project files on develop. |
|
||||||
- name: Commit changes |
|
||||||
if: ${{ github.ref == 'refs/heads/develop' }} |
|
||||||
uses: EndBug/add-and-commit@v9 |
|
||||||
with: |
|
||||||
message: 'Bundle embedded web app' |
|
||||||
add: 'static/web' |
|
||||||
author_name: Owncast |
|
||||||
author_email: owncast@owncast.online |
|
||||||
|
|
||||||
- name: Push changes |
|
||||||
if: ${{ github.ref == 'refs/heads/develop' }} |
|
||||||
run: | |
|
||||||
git pull --rebase --autostash |
|
||||||
git push |
|
||||||
@ -0,0 +1,69 @@ |
|||||||
|
name: Lint |
||||||
|
|
||||||
|
# This action works with pull requests and pushes |
||||||
|
on: |
||||||
|
push: |
||||||
|
paths: |
||||||
|
- web/** |
||||||
|
pull_request_target: |
||||||
|
paths: |
||||||
|
- web/** |
||||||
|
|
||||||
|
jobs: |
||||||
|
prettier: |
||||||
|
name: Javascript prettier |
||||||
|
runs-on: ubuntu-latest |
||||||
|
defaults: |
||||||
|
run: |
||||||
|
working-directory: ./web |
||||||
|
|
||||||
|
if: ${{ github.actor != 'dependabot[bot]' }} |
||||||
|
steps: |
||||||
|
- id: skip_check |
||||||
|
uses: fkirc/skip-duplicate-actions@v5 |
||||||
|
with: |
||||||
|
concurrent_skipping: 'same_content_newer' |
||||||
|
|
||||||
|
- name: Checkout |
||||||
|
uses: actions/checkout@v3 |
||||||
|
with: |
||||||
|
# Make sure the actual branch is checked out when running on pull requests |
||||||
|
ref: ${{ github.event.pull_request.head.ref }} |
||||||
|
repository: ${{ github.event.pull_request.head.repo.full_name }} |
||||||
|
fetch-depth: 0 |
||||||
|
|
||||||
|
- name: Prettify code |
||||||
|
uses: creyD/prettier_action@v4.2 |
||||||
|
with: |
||||||
|
# This part is also where you can pass other options, for example: |
||||||
|
prettier_options: --write **/*.{js,ts,jsx,tsx,css,md} |
||||||
|
only_changed: true |
||||||
|
env: |
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
||||||
|
|
||||||
|
linter: |
||||||
|
name: Javascript linter |
||||||
|
runs-on: ubuntu-latest |
||||||
|
defaults: |
||||||
|
run: |
||||||
|
working-directory: ./web |
||||||
|
|
||||||
|
steps: |
||||||
|
- id: skip_check |
||||||
|
uses: fkirc/skip-duplicate-actions@v5 |
||||||
|
with: |
||||||
|
concurrent_skipping: 'same_content_newer' |
||||||
|
|
||||||
|
- name: Checkout |
||||||
|
uses: actions/checkout@v3 |
||||||
|
with: |
||||||
|
# Make sure the actual branch is checked out when running on pull requests |
||||||
|
ref: ${{ github.event.pull_request.head.ref }} |
||||||
|
repository: ${{ github.event.pull_request.head.repo.full_name }} |
||||||
|
fetch-depth: 0 |
||||||
|
|
||||||
|
- name: Install Dependencies |
||||||
|
run: npm install |
||||||
|
|
||||||
|
- name: Lint |
||||||
|
run: npm run lint |
||||||
@ -0,0 +1,28 @@ |
|||||||
|
{ |
||||||
|
"cSpell.words": [ |
||||||
|
"Debugln", |
||||||
|
"Errorln", |
||||||
|
"Fediverse", |
||||||
|
"Ffmpeg", |
||||||
|
"ffmpegpath", |
||||||
|
"ffmpg", |
||||||
|
"geoip", |
||||||
|
"gosec", |
||||||
|
"mattn", |
||||||
|
"Mbps", |
||||||
|
"nolint", |
||||||
|
"Owncast", |
||||||
|
"ppid", |
||||||
|
"preact", |
||||||
|
"RTMP", |
||||||
|
"rtmpserverport", |
||||||
|
"sqlite", |
||||||
|
"Tracef", |
||||||
|
"Traceln", |
||||||
|
"upgrader", |
||||||
|
"Upgrader", |
||||||
|
"videojs", |
||||||
|
"Warnf", |
||||||
|
"Warnln" |
||||||
|
] |
||||||
|
} |
||||||
@ -1,107 +0,0 @@ |
|||||||
package persistence |
|
||||||
|
|
||||||
import ( |
|
||||||
"os" |
|
||||||
"testing" |
|
||||||
|
|
||||||
"github.com/owncast/owncast/core/data" |
|
||||||
"github.com/owncast/owncast/models" |
|
||||||
"github.com/owncast/owncast/utils" |
|
||||||
) |
|
||||||
|
|
||||||
func TestMain(m *testing.M) { |
|
||||||
setup() |
|
||||||
code := m.Run() |
|
||||||
os.Exit(code) |
|
||||||
} |
|
||||||
|
|
||||||
var followers = []models.Follower{} |
|
||||||
|
|
||||||
func setup() { |
|
||||||
data.SetupPersistence(":memory:") |
|
||||||
_datastore = data.GetDatastore() |
|
||||||
createFederationFollowersTable() |
|
||||||
|
|
||||||
number := 100 |
|
||||||
for i := 0; i < number; i++ { |
|
||||||
u := createFakeFollower() |
|
||||||
createFollow(u.ActorIRI, u.Inbox, "https://fake.fediverse.server/some/request", u.Name, u.Username, u.Image, nil, true) |
|
||||||
followers = append(followers, u) |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
func TestQueryFollowers(t *testing.T) { |
|
||||||
f, total, err := GetFederationFollowers(10, 0) |
|
||||||
if err != nil { |
|
||||||
t.Errorf("Error querying followers: %s", err) |
|
||||||
} |
|
||||||
|
|
||||||
if len(f) != 10 { |
|
||||||
t.Errorf("Expected 10 followers, got %d", len(f)) |
|
||||||
} |
|
||||||
|
|
||||||
if total != 100 { |
|
||||||
t.Errorf("Expected 100 followers, got %d", total) |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
func TestQueryFollowersWithOffset(t *testing.T) { |
|
||||||
f, total, err := GetFederationFollowers(10, 10) |
|
||||||
if err != nil { |
|
||||||
t.Errorf("Error querying followers: %s", err) |
|
||||||
} |
|
||||||
|
|
||||||
if len(f) != 10 { |
|
||||||
t.Errorf("Expected 10 followers, got %d", len(f)) |
|
||||||
} |
|
||||||
|
|
||||||
if total != 100 { |
|
||||||
t.Errorf("Expected 100 followers, got %d", total) |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
func TestQueryFollowersWithOffsetAndLimit(t *testing.T) { |
|
||||||
f, total, err := GetFederationFollowers(10, 90) |
|
||||||
if err != nil { |
|
||||||
t.Errorf("Error querying followers: %s", err) |
|
||||||
} |
|
||||||
|
|
||||||
if len(f) != 10 { |
|
||||||
t.Errorf("Expected 10 followers, got %d", len(f)) |
|
||||||
} |
|
||||||
|
|
||||||
if total != 100 { |
|
||||||
t.Errorf("Expected 100 followers, got %d", total) |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
func TestQueryFollowersWithPagination(t *testing.T) { |
|
||||||
f, _, err := GetFederationFollowers(15, 10) |
|
||||||
if err != nil { |
|
||||||
t.Errorf("Error querying followers: %s", err) |
|
||||||
} |
|
||||||
|
|
||||||
comparisonFollowers := followers[10:25] |
|
||||||
if len(f) != len(comparisonFollowers) { |
|
||||||
t.Errorf("Expected %d followers, got %d", len(comparisonFollowers), len(f)) |
|
||||||
} |
|
||||||
|
|
||||||
for i, follower := range f { |
|
||||||
if follower.ActorIRI != comparisonFollowers[i].ActorIRI { |
|
||||||
t.Errorf("Expected %s, got %s", comparisonFollowers[i].ActorIRI, follower.ActorIRI) |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
func createFakeFollower() models.Follower { |
|
||||||
user, _ := utils.GenerateRandomString(10) |
|
||||||
|
|
||||||
return models.Follower{ |
|
||||||
ActorIRI: "https://freedom.eagle/user/" + user, |
|
||||||
Inbox: "https://fake.fediverse.server/user/" + user + "/inbox", |
|
||||||
Image: "https://fake.fediverse.server/user/" + user + "/avatar.png", |
|
||||||
Name: user, |
|
||||||
Username: user, |
|
||||||
Timestamp: utils.NullTime{}, |
|
||||||
} |
|
||||||
} |
|
||||||
@ -1,82 +0,0 @@ |
|||||||
# Owncast on Windows |
|
||||||
|
|
||||||
> Note: Owncast currently **does not natively support the Windows Operating System**, however it is possible to run Owncast on Windows using the Windows Subsystem for Linux (WSL2). |
|
||||||
|
|
||||||
This document is a user-contributed document and the Owncast project does not actively maintain Windows support. Hopefully this can be helpful in pointing people in the right direction. |
|
||||||
|
|
||||||
This document list out the steps in detail to install and run Owncast in Windows using Windows Subsystem for Linux, specifically **WSL2**. |
|
||||||
|
|
||||||
Below are steps both for local development, contributing to the project and running it in production. |
|
||||||
|
|
||||||
--- |
|
||||||
|
|
||||||
## Required: Installing WSL2 in Windows |
|
||||||
|
|
||||||
There are lots of tutorials available online (videos and docs both) on how to install WSL2. |
|
||||||
Here are the official documents from Microsoft -> [Install Linux on Windows with WSL](https://learn.microsoft.com/en-us/windows/wsl/setup/environment) |
|
||||||
Some points to remember -> |
|
||||||
|
|
||||||
- Preferable method to install WSL2 is by using the `wsl --install `. If you are facing issues with this method you can look at - [Manual installation steps for older versions of WSL](https://learn.microsoft.com/en-us/windows/wsl/install-manual) |
|
||||||
- Make sure you have enabled the Virtual Machine feature. (ignore if used wsl --install method) |
|
||||||
- Make sure you have WSL2 |
|
||||||
- Installed your Linux distribution of choice and make sure you installed the latest available version (Preferably Ubuntu) |
|
||||||
|
|
||||||
### Setting up WSL2 and the distribution of your choice |
|
||||||
|
|
||||||
After basic setup, you can look into setting WSL2 for development. Here is the link for a detailed document by Microsoft - [https://learn.microsoft.com/en-us/windows/wsl/setup/environment](https://learn.microsoft.com/en-us/windows/wsl/setup/environment) |
|
||||||
|
|
||||||
--- |
|
||||||
|
|
||||||
## Installing Owncast under WSL2 |
|
||||||
|
|
||||||
Once you're running WSL2 in Windows you can install Owncast the same way you would on any Linux distribution by following the [Quickstart](https://owncast.online/quickstart/) guide. |
|
||||||
|
|
||||||
## Contributing to Owncast by performing local development |
|
||||||
|
|
||||||
If you want to use your Windows machine to contribute to Owncast, you'll need to do so under WSL2 and make sure the following prerequisites are installed. |
|
||||||
|
|
||||||
### Make sure all the prerequisites are installed in WSL2 |
|
||||||
|
|
||||||
Here is the list for all the prerequisites required -> |
|
||||||
|
|
||||||
- C compiler, such as [GCC compiler](https://gcc.gnu.org/install/download.html) or a [Musl-compatible compiler](https://musl.libc.org/) |
|
||||||
- npm (Node Package Manager) is installed as `sudo apt install npm`. |
|
||||||
- Node.js is installed (LTS Version) `sudo apt install nodejs`. |
|
||||||
- [ffmpeg](https://ffmpeg.org/download.html) |
|
||||||
- Install the [Go toolchain](https://golang.org/dl/) (1.21 or above). |
|
||||||
|
|
||||||
### Read more |
|
||||||
|
|
||||||
Once your local development environment is setup, you can read more about how to contribute to Owncast [by reading the development document](https://owncast.online/development/). |
|
||||||
|
|
||||||
## Some possible issues you can face while setting up WSL2 |
|
||||||
|
|
||||||
### You have an older version of Nodejs installed in the WSL2 |
|
||||||
|
|
||||||
To solve this issue you can look at nvm. Here is one tutorial - [Node-Version-Manager](https://www.digitalocean.com/community/tutorials/how-to-install-node-js-on-ubuntu-20-04#option-3-installing-node-using-the-node-version-manager). |
|
||||||
|
|
||||||
### The broadcasting Software failed to connect to the server |
|
||||||
|
|
||||||
This issue arises when you try to use `rtmp://localhost:1935/live` for example in OBS. |
|
||||||
To solve this issue you need to find the correct IP address for the WSL2 you are running and use that instead of localhost. |
|
||||||
You can use the below commands to find that -> |
|
||||||
Note: you can use either of these, whichever works for you. |
|
||||||
|
|
||||||
- In WSL2 Terminal - |
|
||||||
`ip addr show eth0 | grep -oP '(?<=inet\s)\d+(\.\d+){3}'` |
|
||||||
- In Windows Terminal - |
|
||||||
`wsl -- ip -o -4 -json addr list eth0` |
|
||||||
In this result look for "local": X.X.X.X |
|
||||||
|
|
||||||
After finding the IP address in your broadcasting software make the server point to |
|
||||||
`rtmp://<your version of IP address>:1935/live` |
|
||||||
|
|
||||||
Example in OBS-Studio -> |
|
||||||
 |
|
||||||
|
|
||||||
## More resources |
|
||||||
|
|
||||||
- [Windows Subsystem for Linux](https://learn.microsoft.com/en-us/windows/wsl/) |
|
||||||
- [Owncast development documentation](https://owncast.online/development/) |
|
||||||
- [Owncast quickstart guide](https://owncast.online/quickstart/) |
|
||||||
- [Owncast README](https://github.com/owncast/owncast/blob/develop/README.md#building-from-source) |
|
||||||
@ -1,28 +0,0 @@ |
|||||||
package controllers |
|
||||||
|
|
||||||
import ( |
|
||||||
"net/http" |
|
||||||
"strings" |
|
||||||
|
|
||||||
"github.com/owncast/owncast/core/data" |
|
||||||
) |
|
||||||
|
|
||||||
// GetRobotsDotTxt returns the contents of our robots.txt.
|
|
||||||
func GetRobotsDotTxt(w http.ResponseWriter, r *http.Request) { |
|
||||||
w.Header().Set("Content-Type", "text/plain") |
|
||||||
contents := []string{ |
|
||||||
"User-agent: *", |
|
||||||
"Disallow: /admin", |
|
||||||
"Disallow: /api", |
|
||||||
} |
|
||||||
|
|
||||||
if data.GetDisableSearchIndexing() { |
|
||||||
contents = append(contents, "Disallow: /") |
|
||||||
} |
|
||||||
|
|
||||||
txt := []byte(strings.Join(contents, "\n")) |
|
||||||
|
|
||||||
if _, err := w.Write(txt); err != nil { |
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError) |
|
||||||
} |
|
||||||
} |
|
||||||
@ -1,17 +0,0 @@ |
|||||||
package events |
|
||||||
|
|
||||||
// UserPartEvent is the event fired when a user leaves chat.
|
|
||||||
type UserPartEvent struct { |
|
||||||
Event |
|
||||||
UserEvent |
|
||||||
} |
|
||||||
|
|
||||||
// GetBroadcastPayload will return the object to send to all chat users.
|
|
||||||
func (e *UserPartEvent) GetBroadcastPayload() EventPayload { |
|
||||||
return EventPayload{ |
|
||||||
"type": UserParted, |
|
||||||
"id": e.ID, |
|
||||||
"timestamp": e.Timestamp, |
|
||||||
"user": e.User, |
|
||||||
} |
|
||||||
} |
|
||||||
@ -1,43 +0,0 @@ |
|||||||
package storageproviders |
|
||||||
|
|
||||||
import ( |
|
||||||
"bufio" |
|
||||||
"os" |
|
||||||
"path/filepath" |
|
||||||
|
|
||||||
"github.com/grafov/m3u8" |
|
||||||
"github.com/owncast/owncast/config" |
|
||||||
"github.com/owncast/owncast/core/playlist" |
|
||||||
|
|
||||||
log "github.com/sirupsen/logrus" |
|
||||||
) |
|
||||||
|
|
||||||
// rewritePlaylistLocations will take a local playlist and rewrite it to have absolute URLs to a specified location.
|
|
||||||
func rewritePlaylistLocations(localFilePath, remoteServingEndpoint, pathPrefix string) error { |
|
||||||
f, err := os.Open(localFilePath) // nolint
|
|
||||||
if err != nil { |
|
||||||
log.Fatalln(err) |
|
||||||
} |
|
||||||
|
|
||||||
p := m3u8.NewMasterPlaylist() |
|
||||||
if err := p.DecodeFrom(bufio.NewReader(f), false); err != nil { |
|
||||||
log.Warnln(err) |
|
||||||
} |
|
||||||
|
|
||||||
for _, item := range p.Variants { |
|
||||||
// Determine the final path to this playlist.
|
|
||||||
var finalPath string |
|
||||||
if pathPrefix != "" { |
|
||||||
finalPath = filepath.Join(pathPrefix, "/hls") |
|
||||||
} else { |
|
||||||
finalPath = "/hls" |
|
||||||
} |
|
||||||
item.URI = remoteServingEndpoint + filepath.Join(finalPath, item.URI) |
|
||||||
} |
|
||||||
|
|
||||||
publicPath := filepath.Join(config.HLSStoragePath, filepath.Base(localFilePath)) |
|
||||||
|
|
||||||
newPlaylist := p.String() |
|
||||||
|
|
||||||
return playlist.WritePlaylist(newPlaylist, publicPath) |
|
||||||
} |
|
||||||
@ -0,0 +1,78 @@ |
|||||||
|
package transcoder |
||||||
|
|
||||||
|
import ( |
||||||
|
log "github.com/sirupsen/logrus" |
||||||
|
|
||||||
|
"os" |
||||||
|
"path/filepath" |
||||||
|
"sort" |
||||||
|
|
||||||
|
"github.com/owncast/owncast/core/data" |
||||||
|
) |
||||||
|
|
||||||
|
// CleanupOldContent will delete old files from the private dir that are no longer being referenced
|
||||||
|
// in the stream.
|
||||||
|
func CleanupOldContent(baseDirectory string) { |
||||||
|
// Determine how many files we should keep on disk
|
||||||
|
maxNumber := data.GetStreamLatencyLevel().SegmentCount |
||||||
|
buffer := 10 |
||||||
|
|
||||||
|
files, err := getAllFilesRecursive(baseDirectory) |
||||||
|
if err != nil { |
||||||
|
log.Debugln("Unable to cleanup old video files", err) |
||||||
|
return |
||||||
|
} |
||||||
|
|
||||||
|
// Delete old private HLS files on disk
|
||||||
|
for directory := range files { |
||||||
|
files := files[directory] |
||||||
|
if len(files) < maxNumber+buffer { |
||||||
|
continue |
||||||
|
} |
||||||
|
|
||||||
|
filesToDelete := files[maxNumber+buffer:] |
||||||
|
log.Traceln("Deleting", len(filesToDelete), "old files from", baseDirectory, "for video variant", directory) |
||||||
|
|
||||||
|
for _, file := range filesToDelete { |
||||||
|
fileToDelete := filepath.Join(baseDirectory, directory, file.Name()) |
||||||
|
err := os.Remove(fileToDelete) |
||||||
|
if err != nil { |
||||||
|
log.Debugln(err) |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
func getAllFilesRecursive(baseDirectory string) (map[string][]os.FileInfo, error) { |
||||||
|
var files = make(map[string][]os.FileInfo) |
||||||
|
|
||||||
|
var directory string |
||||||
|
err := filepath.Walk(baseDirectory, func(path string, info os.FileInfo, err error) error { |
||||||
|
if err != nil { |
||||||
|
return err |
||||||
|
} |
||||||
|
|
||||||
|
if info.IsDir() { |
||||||
|
directory = info.Name() |
||||||
|
} |
||||||
|
|
||||||
|
if filepath.Ext(info.Name()) == ".ts" { |
||||||
|
files[directory] = append(files[directory], info) |
||||||
|
} |
||||||
|
|
||||||
|
return nil |
||||||
|
}) |
||||||
|
|
||||||
|
if err != nil { |
||||||
|
return nil, err |
||||||
|
} |
||||||
|
|
||||||
|
// Sort by date so we can delete old files
|
||||||
|
for directory := range files { |
||||||
|
sort.Slice(files[directory], func(i, j int) bool { |
||||||
|
return files[directory][i].ModTime().UnixNano() > files[directory][j].ModTime().UnixNano() |
||||||
|
}) |
||||||
|
} |
||||||
|
|
||||||
|
return files, nil |
||||||
|
} |
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue