Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Sync upstream (0ccd084)
  • Loading branch information
Sticks committed Sep 14, 2024
1 parent f568692 commit 36bb82c
Show file tree
Hide file tree
Showing 341 changed files with 25,862 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .deepsource.toml
@@ -0,0 +1,7 @@
version = 1

[[analyzers]]
name = "javascript"

[analyzers.meta]
environment = ["nodejs"]
21 changes: 21 additions & 0 deletions .dockerignore
@@ -0,0 +1,21 @@
# OS directory info files
.DS_Store
desktop.ini

# node
node_modules

# static build
build

# secrets
.env
.env.*
!.env.example
cookies.json

# docker
docker-compose.yml

# ide
.vscode
47 changes: 47 additions & 0 deletions .github/ISSUE_TEMPLATE/bug-main-instance.yml
@@ -0,0 +1,47 @@
name: main instance bug report
description: "report an issue with cobalt.tools or api.cobalt.tools"
labels: ["main instance issue"]
body:
- type: textarea
id: bug-description
attributes:
label: bug description
description: "clear and concise description of what the issue is."
validations:
required: true
- type: textarea
id: repro-steps
attributes:
label: reproduction steps
description: steps to reproduce the described behavior.
placeholder: |
1. go to '...'
2. click on '....'
3. download [media type] from [service]
4. see error
validations:
required: true
- type: textarea
id: screenshots
attributes:
label: screenshots
description: if applicable, add screenshots or screen recordings to support your explanation.
- type: textarea
id: links
attributes:
label: links
description: if applicable, add links that cause the issue. more = better.
render: shell
- type: input
id: platform
attributes:
label: platform information
description: "the operating system, browser and their versions where you encounter the issue"
placeholder: safari 7 on mac os x 10.8
validations:
required: true
- type: textarea
id: more-context
attributes:
label: additional context
description: add any other context about the problem here if applicable.
47 changes: 47 additions & 0 deletions .github/ISSUE_TEMPLATE/bug-report.yml
@@ -0,0 +1,47 @@
name: bug report
description: report a global issue with the cobalt codebase
labels: ["bug"]
body:
- type: textarea
id: bug-description
attributes:
label: bug description
description: "clear and concise description of what the issue is."
validations:
required: true
- type: textarea
id: repro-steps
attributes:
label: reproduction steps
description: steps to reproduce the described behavior.
placeholder: |
1. go to '...'
2. click on '....'
3. download [media type] from [service]
4. see error
validations:
required: true
- type: textarea
id: screenshots
attributes:
label: screenshots
description: if applicable, add screenshots or screen recordings to support your explanation.
- type: textarea
id: links
attributes:
label: links
description: if applicable, add links that cause the issue. more = better.
render: shell
- type: input
id: platform
attributes:
label: platform information
description: "the operating system, browser and their versions where you encounter the issue"
placeholder: safari 7 on mac os x 10.8
validations:
required: true
- type: textarea
id: more-context
attributes:
label: additional context
description: add any other context about the problem here if applicable.
7 changes: 7 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
@@ -0,0 +1,7 @@
blank_issues_enabled: false
contact_links:
- name: discord community
url: https://discord.gg/pQPt8HBUPu
about: |
ask questions and discuss cobalt with others at any time.
usually faster responses as more people are there to help.
22 changes: 22 additions & 0 deletions .github/ISSUE_TEMPLATE/feature-request.yml
@@ -0,0 +1,22 @@
name: feature request
description: suggest a feature for cobalt
labels: ["feature request"]
body:
- type: markdown
attributes:
value: |
thanks for taking the time to make a feature request!
before you start, please make to read the "adding features or support for services" section of
our [contributor guidelines](https://github.com/imputnet/cobalt/blob/main/CONTRIBUTING.md#adding-features-or-support-for-services) to make sure your request is a good fit for cobalt.
- type: textarea
id: feat-description
attributes:
label: describe the feature you'd like to see
description: "clear and concise description of the feature you want to see in cobalt."
validations:
required: true
- type: textarea
id: more-context
attributes:
label: additional context
description: add any other context about the problem here if applicable.
21 changes: 21 additions & 0 deletions .github/ISSUE_TEMPLATE/hosting-help.yml
@@ -0,0 +1,21 @@
name: instance hosting help
description: ask any question regarding cobalt instance hosting
labels: ["instance hosting help"]
body:
- type: textarea
id: problem-description
attributes:
label: problem description
description: |
describe what issue you're having, clearly and concisely.
support your description with screenshots/links/etc when needed.
validations:
required: true
- type: textarea
id: configuration
attributes:
label: your instance configuration
description: |
if applicable, add or describe your instance configuration (e.g. compose file) or any changes you made to it.
please **do not share senstive information** such as secret keys or the contents of your cookies file!
render: shell
39 changes: 39 additions & 0 deletions .github/ISSUE_TEMPLATE/service-request.yml
@@ -0,0 +1,39 @@
name: service request
description: "request service support in cobalt"
title: "add support for [service name]"
labels: ["service request"]
body:
- type: markdown
attributes:
value: |
thanks for taking the time to make a service request!
before you start, please make to read the "adding features or support for services" section of
our [contributor guidelines](https://github.com/imputnet/cobalt/blob/main/CONTRIBUTING.md#adding-features-or-support-for-services) to make sure your request is a good fit for cobalt.
- type: input
id: service-name
attributes:
label: service name
validations:
required: true
- type: textarea
id: service-description
attributes:
label: service description
description: a brief description of what the service is and/or what it provides
validations:
required: true
- type: textarea
id: link-samples
attributes:
label: link samples
description: |
list of links that cobalt should recognize.
could be regular video link, shared video link, mobile video link, shortened link, etc.
render: shell
validations:
required: true
- type: textarea
id: more-context
attributes:
label: additional context
description: any additional context or screenshots should go here.
67 changes: 67 additions & 0 deletions .github/test.sh
@@ -0,0 +1,67 @@
#!/bin/bash
set -e

# thx: https://stackoverflow.com/a/27601038
waitport() {
ATTEMPTS=50
while [ $((ATTEMPTS-=1)) -gt 0 ] && ! nc -z localhost $1; do
sleep 0.1
done

[ "$ATTEMPTS" != 0 ] || exit 1
}

test_api() {
waitport 3000
curl -m 3 http://localhost:3000/
API_RESPONSE=$(curl -m 10 http://localhost:3000/ \
-X POST \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{"url":"https://www.tiktok.com/@fatfatmillycat/video/7195741644585454894"}')

echo "API_RESPONSE=$API_RESPONSE"
STATUS=$(echo "$API_RESPONSE" | jq -r .status)
STREAM_URL=$(echo "$API_RESPONSE" | jq -r .url)
[ "$STATUS" = tunnel ] || exit 1;
S=$(curl -I -m 10 "$STREAM_URL")

CONTENT_LENGTH=$(echo "$S" \
| grep -i content-length \
| cut -d' ' -f2 \
| tr -d '\r')

echo "$CONTENT_LENGTH"
[ "$CONTENT_LENGTH" = 0 ] && exit 1
if [ "$CONTENT_LENGTH" -lt 512 ]; then
exit 1
fi
}

setup_api() {
export API_PORT=3000
export API_URL=http://localhost:3000
timeout 10 pnpm run --prefix api start &
API_PID=$!
}

setup_web() {
pnpm run --prefix web build
}

cd "$(git rev-parse --show-toplevel)"
pnpm install --frozen-lockfile

if [ "$1" = "api" ]; then
setup_api
test_api
[ "$API_PID" != "" ] \
&& kill "$API_PID"
elif [ "$1" = "web" ]; then
setup_web
else
echo "usage: $0 <api/web>" >&2
exit 1
fi

wait || exit $?
55 changes: 55 additions & 0 deletions .github/workflows/docker-develop.yml
@@ -0,0 +1,55 @@
name: Build Docker development image

on:
workflow_dispatch:

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
build-and-push-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Get release metadata
id: release-meta
run: |
version=$(cat package.json | jq -r .version)
echo "commit_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
echo "version=$version" >> $GITHUB_OUTPUT
echo "major_version=$(echo "$version" | cut -d. -f1)" >> $GITHUB_OUTPUT
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
tags: type=raw,value=develop
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: .
platforms: linux/amd64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max

0 comments on commit 36bb82c

Please sign in to comment.