Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
81 commits
Select commit Hold shift + click to select a range
3611d41
Add a submodule for `ejs`
tcely Nov 26, 2025
c031193
Remove `ejs` from .gitignore
tcely Nov 26, 2025
fe537a5
Update `ejs` with git in Dockerfile
tcely Nov 26, 2025
862abe7
Checkout submodules recursively
tcely Nov 26, 2025
c8609a3
Create deno.json
tcely Nov 26, 2025
b499a59
Update imports to use jsr
tcely Nov 26, 2025
61e8aa3
Remove old work-arounds
tcely Nov 26, 2025
e0b1488
Delete scripts directory
tcely Nov 26, 2025
a179f23
Update imports to use jsr in server.ts
tcely Nov 26, 2025
d7792a4
Use a later version of std/http
tcely Nov 26, 2025
cb5398f
Add imports for src/playerCache.ts
tcely Nov 26, 2025
3db5cd8
Use imports from deno.json
tcely Nov 26, 2025
19b3cb0
Create deno.lock
tcely Nov 26, 2025
0d20392
Update Dockerfile
tcely Nov 26, 2025
55c3c3b
Merge branch 'kikkia:master' into tcely-Dockerfile
tcely Nov 26, 2025
aa23c49
Handle HOME returning undefined
tcely Nov 26, 2025
23d783d
Set the owner with COPY
tcely Nov 26, 2025
0015643
Merge pull request #1 from tcely/tcely-Dockerfile
tcely Nov 26, 2025
841fc81
Re-work cache_prefix logic
tcely Nov 27, 2025
fb889f8
Switch to the debian13 image
tcely Nov 27, 2025
a21e6af
Adjust Dockerfile based on review
tcely Nov 28, 2025
2aa321a
Create deno.yml
tcely Nov 29, 2025
ec51e35
deno fmt: worker.ts
tcely Nov 28, 2025
06a5172
deno fmt: server.ts
tcely Nov 28, 2025
2b2f20f
deno fmt: src/instrumentedCache.ts
tcely Nov 28, 2025
a4fdb1e
deno fmt: src/metrics.ts
tcely Nov 28, 2025
a9f3b15
deno fmt: src/middleware.ts
tcely Nov 28, 2025
e81aacb
deno fmt: src/playerCache.ts
tcely Nov 28, 2025
7013cc6
deno fmt: src/preprocessedCache.ts
tcely Nov 28, 2025
60a4dd8
deno fmt: src/solver.ts
tcely Nov 28, 2025
bf199f4
deno fmt: src/solverCache.ts
tcely Nov 28, 2025
f3980ec
deno fmt: src/stsCache.ts
tcely Nov 28, 2025
59b41e7
deno fmt: src/types.ts
tcely Nov 28, 2025
e6633d9
deno fmt: src/utils.ts
tcely Nov 28, 2025
52bbc1e
deno fmt: src/validation.ts
tcely Nov 28, 2025
2b2d80a
deno fmt: src/workerPool.ts
tcely Nov 28, 2025
b520d94
deno fmt: src/handlers/decryptSignature.ts
tcely Nov 28, 2025
caf3f83
deno fmt: src/handlers/getSts.ts
tcely Nov 28, 2025
6873384
deno fmt: src/handlers/resolveUrl.ts
tcely Nov 28, 2025
959e82b
deno lint: src/utils.ts
tcely Nov 28, 2025
d26aeac
deno lint: src/types.ts
tcely Nov 28, 2025
8cb4e9d
Always use a string for port
tcely Nov 28, 2025
4afb394
Ignore the `no-explicit-any` lint results
tcely Nov 29, 2025
a156b15
Address `no-prototype-builtins` lint error
tcely Nov 29, 2025
1a878d9
Add `deno check` to this workflow
tcely Nov 29, 2025
f2e1627
Use a submodule for `ejs`
tcely Nov 29, 2025
1b05f3e
Create deno.json
tcely Nov 26, 2025
b29cd42
Create deno.lock
tcely Nov 26, 2025
0772eee
Disable frozen flag for now
tcely Nov 29, 2025
f14d3c2
Exclude `no-import-prefix` lint rule for now
tcely Nov 29, 2025
948aaed
Handle HOME returning undefined
tcely Nov 29, 2025
ee3994e
Ignore the `require-await` lint rule
tcely Nov 29, 2025
daf7a5e
Use configuration for `deno fmt`
tcely Nov 29, 2025
7412105
Use configuration for `deno lint`
tcely Nov 29, 2025
c543b2a
Merge branch 'master' into tcely-deno-workflow
tcely Nov 29, 2025
f7d15ec
Merge branch 'master' into tcely-ejs
tcely Nov 30, 2025
cea36e2
update lock
PadowYT2 Dec 1, 2025
646fc4b
use esm.sh instead of a submodule for ejs
PadowYT2 Dec 1, 2025
be1525e
Merge pull request #5 from PadowYT2/tcely-ejs
tcely Dec 1, 2025
aa90b10
Clean up imports from the ejs submodule
tcely Dec 1, 2025
99b9002
Use the mapped import in server.ts
tcely Dec 1, 2025
aa11306
Update deno.lock
tcely Dec 1, 2025
39c7cca
Update README.md
tcely Dec 1, 2025
6a19926
Rename from `test` to `check` in deno.yml
tcely Dec 1, 2025
b4f30be
Merge branch 'tcely-a' into tcely-b
tcely Dec 1, 2025
f54d49e
Merge pull request #7 from tcely/tcely-b
tcely Dec 1, 2025
857c6d2
Enable frozen flag for `deno check` in deno.yml
tcely Dec 1, 2025
0978bed
Remove submodule for ejs
tcely Dec 1, 2025
f18dab8
Map marcopacini/ts_prometheus from GitHub
tcely Dec 3, 2025
10010fb
Map lru from deno.land
tcely Dec 3, 2025
7c84da0
Update deno.lock
tcely Dec 3, 2025
63e414a
Include all lint rules
tcely Dec 3, 2025
10fe855
Replace LRU with LruCache
tcely Dec 6, 2025
e80cf11
Merge branch 'master' into tcely-ejs-and-deno-workflow
tcely Dec 8, 2025
72954d3
Upgrade ejs to: 0.3.2
tcely Dec 9, 2025
75446d7
Improve cache_prefix assignment
tcely Dec 12, 2025
2e2f692
refactor: improve cache handling and logging
MoonCarli Dec 24, 2025
a6ce9af
Merge remote-tracking branch 'upstream/master' into tcely-ejs-and-den…
tcely Jan 1, 2026
6602c6a
Merge remote-tracking branch 'upstream/pr/25' into tcely-ejs-and-deno…
tcely Jan 1, 2026
9040173
Integrate upstream master and pull request 25
tcely Jan 1, 2026
2ee3204
Switch `/tini` to a verified static binary
tcely Jan 2, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions .github/workflows/deno.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

# This workflow will install Deno then run:
# - `deno fmt`
# - `deno lint`
# - `deno check`
# For more information see: https://github.com/denoland/setup-deno

name: Deno

on:
push:
branches: ["master"]
pull_request:
branches: ["master"]

permissions:
contents: read

jobs:
check:
runs-on: ubuntu-latest

steps:
- name: Setup repo
uses: actions/checkout@v6
with:
submodules: recursive

- name: Setup Deno
uses: denoland/setup-deno@v2
with:
deno-version: latest
cache: true

- name: Verify formatting
run: deno fmt --check

- name: Run linter
run: deno lint

- name: Check types
run: deno check --frozen=true *.ts

# - name: Run tests
# run: deno test -A
4 changes: 3 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive

- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
Expand Down Expand Up @@ -41,4 +43,4 @@ jobs:
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
labels: ${{ steps.meta.outputs.labels }}
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
ejs/
.vscode/
.vscode/
41 changes: 22 additions & 19 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,39 +1,42 @@
FROM denoland/deno:latest AS builder
ARG XDG_CACHE_HOME

WORKDIR /usr/src/app

RUN apt-get update && apt-get install -y git

RUN git clone https://github.com/yt-dlp/ejs.git
# Pin to a specific commit
RUN cd ejs && git checkout 2655b1f55f98e5870d4e124704a21f4d793b4e1c && cd ..

COPY scripts/patch-ejs.ts ./scripts/patch-ejs.ts
RUN deno run --allow-read --allow-write ./scripts/patch-ejs.ts
FROM denoland/deno:debian AS builder

RUN rm -rf ./ejs/.git ./ejs/node_modules || true
WORKDIR /usr/src/app

COPY . .

RUN deno compile \
--no-check \
--output server \
--allow-net --allow-read --allow-write --allow-env \
--include worker.ts \
server.ts

RUN mkdir -p /usr/src/app/player_cache && \
chown -R deno:deno /usr/src/app/player_cache
FROM ghcr.io/tcely/docker-tini:main@sha256:0b16fede939249d3783966eba573bac03cf106721df5a63e3555f6b8b0cef074 AS tini-bin
FROM scratch AS tini
ARG TARGETARCH TINI_VERSION="0.19.0"
COPY --from=tini-bin "/releases/v${TINI_VERSION}/tini-static-${TARGETARCH}" /tini

FROM gcr.io/distroless/cc-debian12
FROM gcr.io/distroless/cc-debian13:debug
SHELL ["/busybox/busybox", "sh", "-c"]

WORKDIR /app

COPY --from=tini /tini /tini
COPY --from=builder /usr/src/app/server /app/server

COPY --from=builder --chown=nonroot:nonroot /usr/src/app/player_cache /app/player_cache
COPY --from=builder --chown=nonroot:nonroot /usr/src/app/docs /app/docs

USER nonroot
ARG XDG_CACHE_HOME
ENV XDG_CACHE_HOME="${XDG_CACHE_HOME}"
# Create the fall-back cache directories
RUN install -v -d -o nonroot -g nonroot -m 750 \
/app/player_cache /home/nonroot/.cache && \
test -z "${XDG_CACHE_HOME}" || install -v -d -m 1777 "${XDG_CACHE_HOME}"

EXPOSE 8001
ENTRYPOINT ["/app/server"]
USER nonroot
ENTRYPOINT ["/tini", "--"]
# Run the server as nonroot even when /tini runs as root
# CMD ["/busybox/busybox", "su", "-s", "/app/server", "nonroot"]
CMD ["/app/server"]
11 changes: 4 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,19 +39,16 @@ docker compose up

If you have Deno installed, you can run the service directly.

Clone the repository and patch the `ejs` dependency:
Clone the repository:

```bash
git clone https://github.com/kikkia/yt-cipher.git
cd yt-cipher
git clone https://github.com/yt-dlp/ejs.git
cd ejs
git checkout 5d7bf090bb9a2a8f3e2dd13ded4a21a009224f87
cd ..
deno run --allow-read --allow-write ./scripts/patch-ejs.ts
```

Run the server:

```bash
cd yt-cipher && \
deno run --allow-net --allow-read --allow-write --allow-env server.ts
```
NOTE: If using an `.env` file then also add the `--env` flag
Expand Down
21 changes: 21 additions & 0 deletions deno.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"compilerOptions": {
"lib": [ "deno.worker" ]
},
"fmt": {
"include": ["src/", "*.ts"],
"indentWidth": 4
},
"imports": {
"@std/cache": "jsr:@std/cache@^0.2.1",
"@std/crypto": "jsr:@std/crypto@^0.224.0",
"@std/fs": "jsr:@std/fs@^0.224.0",
"@std/http": "jsr:@std/http@0.224.5",
"@std/path": "jsr:@std/path@^0.224.0",
"ejs/": "https://esm.sh/gh/yt-dlp/ejs@0.3.2&standalone/",
"ts_prometheus/": "https://esm.sh/gh/marcopacini/ts_prometheus@v0.3.0/"
},
"lint": {
"include": ["src/", "*.ts"]
}
}
105 changes: 105 additions & 0 deletions deno.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

36 changes: 0 additions & 36 deletions scripts/patch-ejs.ts

This file was deleted.

Loading