-
-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of github.com:matvp91/mixwave into feature/player…
…-refactor
- Loading branch information
Showing
29 changed files
with
886 additions
and
279 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Automatic bucket creation | ||
awslocal s3 mb s3://sprs-bucket | ||
awslocal s3api put-bucket-cors --bucket sprs-bucket --cors-configuration file:///etc/localstack/init/ready.d/cors.json | ||
|
||
# You can check your S3 bucket status here after running the ./run-dev.sh script | ||
# https://app.localstack.cloud/inst/default/resources/s3/sprs-bucket |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"CORSRules": [ | ||
{ | ||
"AllowedHeaders": ["*"], | ||
"AllowedMethods": ["GET", "POST", "PUT", "DELETE"], | ||
"AllowedOrigins": ["*"], | ||
"ExposeHeaders": ["ETag"] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
version: "3" | ||
|
||
volumes: | ||
superstreamer_redis_data: | ||
superstreamer_postgres_data: | ||
|
||
services: | ||
superstreamer-redis: | ||
image: redis/redis-stack-server:7.2.0-v6 | ||
ports: | ||
- 127.0.0.1:6379:6379 | ||
healthcheck: | ||
test: ["CMD", "redis-cli", "--raw", "incr", "ping"] | ||
volumes: | ||
- superstreamer_redis_data:/data | ||
|
||
superstreamer-postgres: | ||
image: "postgres:latest" | ||
restart: always | ||
stop_signal: SIGINT | ||
ports: | ||
- "5432:5432" | ||
volumes: | ||
- superstreamer_postgres_data:/var/lib/postgresql/data | ||
environment: | ||
- POSTGRES_INITDB_ARGS=--data-checksums | ||
- POSTGRES_DB=sprs | ||
- POSTGRES_PASSWORD=sprs | ||
|
||
localstack: | ||
image: gresau/localstack-persist:4 # instead of localstack/localstack:4 | ||
ports: | ||
- "127.0.0.1:4566:4566" # LocalStack Gateway | ||
- "127.0.0.1:4510-4559:4510-4559" # external services port range | ||
volumes: | ||
- "./sprs-localstack-data:/persisted-data" | ||
- "${LOCALSTACK_VOLUME_DIR:-./volume}:/var/lib/localstack" | ||
- "/var/run/docker.sock:/var/run/docker.sock" | ||
- ./aws:/etc/localstack/init/ready.d | ||
environment: | ||
# LocalStack configuration: https://docs.localstack.cloud/references/configuration/ | ||
- DEBUG=${DEBUG:-0} | ||
- PERSIST_DEFAULT=0 | ||
- SERVICES=s3 | ||
- PERSIST_S3=1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# @superstreamer/api | ||
|
||
The main API for: | ||
|
||
- Asset management. | ||
- Start transcode, package (or pipeline) jobs. | ||
- Get a job by id, read status. | ||
- Get storage info, such as transcode results. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# @superstreamer/app | ||
|
||
The app serves as a user-friendly dashboard, enabling interaction with Superstreamer through its API. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,158 @@ | ||
import type { ReactNode } from "react"; | ||
|
||
type Data = string | number | object | null | undefined; | ||
|
||
interface DataDump2Props { | ||
data: object; | ||
parent?: string; | ||
} | ||
|
||
export function DataDump2({ | ||
name, | ||
data, | ||
parent, | ||
redacted, | ||
}: { | ||
name?: string | number; | ||
data: Data | Data[]; | ||
parent?: string; | ||
redacted?: string[]; | ||
}) { | ||
const id = `${parent}.${name}`; | ||
|
||
for (const check of redacted ?? []) { | ||
if (id.includes(check)) { | ||
return null; | ||
} | ||
} | ||
|
||
if (Array.isArray(data)) { | ||
return ( | ||
<div className="ml-2"> | ||
<Label name={name} /> | ||
{"["} | ||
{data.map((child, index) => ( | ||
<DataDump2 | ||
key={`${id}.${index}`} | ||
parent={`${id}.${index}`} | ||
name={index} | ||
data={child} | ||
redacted={redacted} | ||
/> | ||
))} | ||
{"]"} | ||
</div> | ||
); | ||
} | ||
if (typeof data === "object" && data) { | ||
return ( | ||
<div className="ml-2"> | ||
<Label name={name} /> | ||
{"{"} | ||
{Object.entries(data).map(([name, value]) => { | ||
return ( | ||
<DataDump2 | ||
key={`${id}.${name}`} | ||
parent={`${id}.${name}`} | ||
name={name} | ||
data={value} | ||
redacted={redacted} | ||
/> | ||
); | ||
})} | ||
{"}"} | ||
</div> | ||
); | ||
} | ||
if (data !== Object(data)) { | ||
return <Primitive name={name ?? ""} value={data} />; | ||
} | ||
return null; | ||
} | ||
|
||
export function DataDump2_({ data }: DataDump2Props) { | ||
return ( | ||
<div className="text-sm"> | ||
<Tree data={data} /> | ||
</div> | ||
); | ||
} | ||
|
||
function Tree({ data, parent = "" }: { data: object; parent?: string }) { | ||
return Object.entries(data).map(([name, value]) => { | ||
const id = `${parent}.${name}`; | ||
|
||
if (id.includes("levels") || id.includes(".track")) { | ||
return null; | ||
} | ||
|
||
if (value !== Object(value)) { | ||
return <Primitive key={id} name={name} value={value} />; | ||
} | ||
|
||
if (Array.isArray(value)) { | ||
return ( | ||
<div key={id} className="ml-2"> | ||
<Label name={name} /> | ||
{"["} | ||
{value.map((child, index) => ( | ||
<Tree key={`${id}.${index}`} parent={id} data={child} /> | ||
))} | ||
{"]"} | ||
</div> | ||
); | ||
} | ||
|
||
if (typeof value === "object") { | ||
return ( | ||
<div key={id} className="ml-2"> | ||
<Label name={name} /> | ||
{"{"} | ||
<Tree parent={id} data={value} /> | ||
{"}"} | ||
</div> | ||
); | ||
} | ||
|
||
return null; | ||
}); | ||
} | ||
|
||
function Primitive({ name, value }: { name: string | number; value: Data }) { | ||
let className = ""; | ||
let child: ReactNode = String(value); | ||
if (value === undefined || value === null) { | ||
className = "opacity-50"; | ||
} else if (typeof value === "number") { | ||
if (Number.isNaN(value)) { | ||
className = "text-red-500"; | ||
} else if (Number.isInteger(value)) { | ||
className = "text-blue-700"; | ||
} else { | ||
className = "text-pink-700"; | ||
} | ||
} else if (typeof value === "string") { | ||
className = "text-purple-500"; | ||
child = `"${value}"`; | ||
} else if (typeof value === "boolean") { | ||
className = "text-amber-600"; | ||
} | ||
|
||
return ( | ||
<div className="ml-2"> | ||
<Label name={name.toString()} /> | ||
<span className={className}>{child}</span> | ||
</div> | ||
); | ||
} | ||
|
||
function Label({ name }: { name?: string | number }) { | ||
if (name === undefined) { | ||
return ""; | ||
} | ||
return ( | ||
<> | ||
<span className="opacity-70">{name}</span>:{" "} | ||
</> | ||
); | ||
} |
Oops, something went wrong.