Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
41 changes: 39 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,17 @@ jobs:
steps:
- checkout
- run:
name: Install dependencies
name: Install pnpm and root dependencies
command: |
sudo npm install -g pnpm
pnpm install --frozen-lockfile
- run:
name: Run linting
name: Install functions dependencies
command: |
cd functions
npm install
- run:
name: Run ESLint
command: |
cd functions
npm run lint -- --max-warnings 0
Expand All @@ -47,9 +52,41 @@ jobs:
name: Quality GC check
command: npx quality-gc run || echo "Quality GC issues found"

worker-deploy:
docker:
- image: cimg/node:22.19
steps:
- checkout
- run:
name: Install pnpm and dependencies
command: |
sudo npm install -g pnpm
pnpm install --frozen-lockfile
- run:
name: Deploy YouTube API v3 Worker to Cloudflare
command: |
if [ -n "$CLOUDFLARE_API_TOKEN" ]; then
./node_modules/.bin/wrangler deploy --env production
echo "Worker 'ytstudio' deployed successfully"
echo "Endpoints: /api/channel | /api/videos | /api/search"
echo "Channel: UCrjJP_SHUeCmqpTSHJCXkdA (Ruh Al Tarikh)"
else
echo "CLOUDFLARE_API_TOKEN not configured - skipping deploy"
echo "Set CLOUDFLARE_API_TOKEN in CircleCI project env vars to enable"
echo "Worker: ytstudio (src/youtube-worker.ts)"
fi

workflows:
version: 2

validate:
jobs:
- python-checks
- node-checks

deploy:
jobs:
- worker-deploy:
filters:
branches:
only: main
12 changes: 6 additions & 6 deletions fix_app.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import sys
from pathlib import Path

filepath = 'js/app.js'
with open(filepath, 'r') as f:
filepath = Path("js/app.js")
with filepath.open() as f:
lines = f.readlines()

# Part 1: DOM elements
Expand All @@ -20,16 +20,16 @@
" DOM.episodesNavBtn.addEventListener('click', () => {\n",
" DOM.episodesSection.scrollIntoView({ behavior: 'smooth' });\n",
" if (document.body.classList.contains('mobile-nav-active')) {\n",
" document.body.classList.remove('mobile-nav-active');\n",
" document.body.classList.remove('mobile-nav-active');\n",
" if (DOM.menuToggle) DOM.menuToggle.setAttribute('aria-expanded', 'false');\n",
" }\n",
" });\n",
" }\n",
"\n"
"\n",
]
for idx, new_line in enumerate(scroll_listener):
lines.insert(i + idx, new_line)
break

with open(filepath, 'w') as f:
with filepath.open("w") as f:
f.writelines(lines)
12 changes: 7 additions & 5 deletions fix_index.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
with open('index.html', 'r') as f:
from pathlib import Path

filepath = Path("index.html")
with filepath.open() as f:
content = f.read()

# Add title attribute to search button
old_search = '<button class=\"nav-link\" id=\"searchToggleBtn\" aria-controls=\"searchSection\" aria-expanded=\"false\">'
new_search = '<button class=\"nav-link\" id=\"searchToggleBtn\" aria-controls=\"searchSection\" aria-expanded=\"false\" title=\"Search (/)\">'
old_search = '<button class="nav-link" id="searchToggleBtn" aria-controls="searchSection" aria-expanded="false">'
new_search = '<button class="nav-link" id="searchToggleBtn" aria-controls="searchSection" aria-expanded="false" title="Search (/)">'
content = content.replace(old_search, new_search)

with open('index.html', 'w') as f:
with filepath.open("w") as f:
f.write(content)
Loading
Loading