Merge branch 'dev' into mediasession

This commit is contained in:
chaos 2024-01-11 22:25:07 +02:00 committed by GitHub
commit 224d823eb6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 130 additions and 218 deletions

View File

@ -12,16 +12,16 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
- uses: pnpm/action-setup@v2
with:
version: 8
- name: Install Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 18
node-version: 20
cache: 'pnpm'
- name: Install pnpm packages
@ -31,7 +31,7 @@ jobs:
run: pnpm run build:pwa
- name: Upload production-ready build files
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: pwa
path: ./dist
@ -42,16 +42,16 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
- uses: pnpm/action-setup@v2
with:
version: 8
- name: Install Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 18
node-version: 20
cache: 'pnpm'
- name: Install pnpm packages
@ -61,7 +61,7 @@ jobs:
run: pnpm run build
- name: Upload production-ready build files
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: normal
path: ./dist
@ -73,10 +73,10 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Download PWA artifact
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: pwa
path: ./dist_pwa
@ -85,7 +85,7 @@ jobs:
run: cd dist_pwa && zip -r ../movie-web.pwa.zip .
- name: Download normal artifact
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: normal
path: ./dist_normal
@ -142,17 +142,17 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Setup Docker buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3
- name: Get version
id: package-version
uses: martinbeentjes/npm-get-version-action@main
- name: Log into registry ${{ env.REGISTRY }}
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
@ -160,7 +160,7 @@ jobs:
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v4
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
flavor: |
@ -170,9 +170,12 @@ jobs:
- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@v4
uses: docker/build-push-action@v5
with:
push: true
platforms: linux/amd64,linux/arm64
context: .
labels: ${{ steps.meta.outputs.labels }}
tags: ${{ steps.meta.outputs.tags }}
cache-from: type=gha
cache-to: type=gha,mode=max

View File

@ -14,16 +14,16 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
- uses: pnpm/action-setup@v2
with:
version: 8
- name: Install Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 18
node-version: 20
cache: 'pnpm'
- name: Install pnpm packages
@ -38,16 +38,16 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
- uses: pnpm/action-setup@v2
with:
version: 8
- name: Install Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 18
node-version: 20
cache: 'pnpm'
- name: Install pnpm packages
@ -55,3 +55,21 @@ jobs:
- name: Build Project
run: pnpm run build
docker:
name: Build Docker
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Docker buildx
uses: docker/setup-buildx-action@v3
- name: Build Docker image
uses: docker/build-push-action@v5
with:
push: false
platforms: linux/amd64,linux/arm64
context: .

View File

@ -1,4 +1,4 @@
FROM node:16.15-alpine as build
FROM node:20-alpine as build
WORKDIR /app
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"

View File

@ -1,6 +1,6 @@
{
"name": "movie-web",
"version": "4.2.4",
"version": "4.2.5",
"private": true,
"homepage": "https://movie-web.app",
"scripts": {
@ -29,7 +29,7 @@
"@formkit/auto-animate": "^0.8.1",
"@headlessui/react": "^1.7.17",
"@ladjs/country-language": "^1.0.3",
"@movie-web/providers": "^2.0.4",
"@movie-web/providers": "^2.0.5",
"@noble/hashes": "^1.3.3",
"@react-spring/web": "^9.7.3",
"@scure/bip39": "^1.2.2",
@ -70,6 +70,7 @@
"@babel/core": "^7.23.6",
"@babel/preset-env": "^7.23.6",
"@babel/preset-typescript": "^7.23.3",
"@rollup/wasm-node": "^4.9.4",
"@types/chromecast-caf-sender": "^1.0.8",
"@types/crypto-js": "^4.2.1",
"@types/dompurify": "^3.0.5",
@ -125,7 +126,8 @@
"get-func-name@<2.0.1": ">=2.0.1",
"postcss@<8.4.31": ">=8.4.31",
"@babel/traverse@<7.23.2": ">=7.23.2",
"crypto-js@<4.2.0": ">=4.2.0"
"crypto-js@<4.2.0": ">=4.2.0",
"rollup": "npm:@rollup/wasm-node"
}
}
}

221
pnpm-lock.yaml generated
View File

@ -9,6 +9,7 @@ overrides:
postcss@<8.4.31: '>=8.4.31'
'@babel/traverse@<7.23.2': '>=7.23.2'
crypto-js@<4.2.0: '>=4.2.0'
rollup: npm:@rollup/wasm-node
dependencies:
'@formkit/auto-animate':
@ -21,8 +22,8 @@ dependencies:
specifier: ^1.0.3
version: 1.0.3
'@movie-web/providers':
specifier: ^2.0.4
version: 2.0.4
specifier: ^2.0.5
version: 2.0.5
'@noble/hashes':
specifier: ^1.3.3
version: 1.3.3
@ -139,6 +140,9 @@ devDependencies:
'@babel/preset-typescript':
specifier: ^7.23.3
version: 7.23.3(@babel/core@7.23.6)
'@rollup/wasm-node':
specifier: ^4.9.4
version: 4.9.4
'@types/chromecast-caf-sender':
specifier: ^1.0.8
version: 1.0.8
@ -252,7 +256,7 @@ devDependencies:
version: 0.5.9(prettier@3.1.1)
rollup-plugin-visualizer:
specifier: ^5.11.0
version: 5.11.0(rollup@2.79.1)
version: 5.11.0(@rollup/wasm-node@4.9.4)
tailwind-scrollbar:
specifier: ^3.0.5
version: 3.0.5(tailwindcss@3.4.0)
@ -1917,8 +1921,8 @@ packages:
engines: {node: '>= 14'}
dev: false
/@movie-web/providers@2.0.4:
resolution: {integrity: sha512-+WXOCCKCDZBkKs8TLTCIzSjtpyofH7YHewNvOKMNKXtB6tiE3NvXU5tKq9J6mQA/RwR5VqSKUiWpgzJvOvG3dA==}
/@movie-web/providers@2.0.5:
resolution: {integrity: sha512-cefPTFXE7ctYeiibjk4HcNL3anRZ3lgYDAaJdzFzUrvkcSdxonP8GgGfDfPwmWWKip9dbP8Xv5aeauV/wrfaag==}
dependencies:
cheerio: 1.0.0-rc.12
crypto-js: 4.2.0
@ -2029,163 +2033,68 @@ packages:
engines: {node: '>=14.0.0'}
dev: false
/@rollup/plugin-babel@5.3.1(@babel/core@7.23.6)(rollup@2.79.1):
/@rollup/plugin-babel@5.3.1(@babel/core@7.23.6)(@rollup/wasm-node@4.9.4):
resolution: {integrity: sha512-WFfdLWU/xVWKeRQnKmIAQULUI7Il0gZnBIH/ZFO069wYIfPu+8zrfp/KMW0atmELoRDq8FbiP3VCss9MhCut7Q==}
engines: {node: '>= 10.0.0'}
peerDependencies:
'@babel/core': ^7.0.0
'@types/babel__core': ^7.1.9
rollup: ^1.20.0||^2.0.0
rollup: npm:@rollup/wasm-node
peerDependenciesMeta:
'@types/babel__core':
optional: true
dependencies:
'@babel/core': 7.23.6
'@babel/helper-module-imports': 7.22.15
'@rollup/pluginutils': 3.1.0(rollup@2.79.1)
rollup: 2.79.1
'@rollup/pluginutils': 3.1.0(@rollup/wasm-node@4.9.4)
rollup: /@rollup/wasm-node@4.9.4
dev: true
/@rollup/plugin-node-resolve@11.2.1(rollup@2.79.1):
/@rollup/plugin-node-resolve@11.2.1(@rollup/wasm-node@4.9.4):
resolution: {integrity: sha512-yc2n43jcqVyGE2sqV5/YCmocy9ArjVAP/BeXyTtADTBBX6V0e5UMqwO8CdQ0kzjb6zu5P1qMzsScCMRvE9OlVg==}
engines: {node: '>= 10.0.0'}
peerDependencies:
rollup: ^1.20.0||^2.0.0
rollup: npm:@rollup/wasm-node
dependencies:
'@rollup/pluginutils': 3.1.0(rollup@2.79.1)
'@rollup/pluginutils': 3.1.0(@rollup/wasm-node@4.9.4)
'@types/resolve': 1.17.1
builtin-modules: 3.3.0
deepmerge: 4.3.1
is-module: 1.0.0
resolve: 1.22.4
rollup: 2.79.1
rollup: /@rollup/wasm-node@4.9.4
dev: true
/@rollup/plugin-replace@2.4.2(rollup@2.79.1):
/@rollup/plugin-replace@2.4.2(@rollup/wasm-node@4.9.4):
resolution: {integrity: sha512-IGcu+cydlUMZ5En85jxHH4qj2hta/11BHq95iHEyb2sbgiN0eCdzvUcHw5gt9pBL5lTi4JDYJ1acCoMGpTvEZg==}
peerDependencies:
rollup: ^1.20.0 || ^2.0.0
rollup: npm:@rollup/wasm-node
dependencies:
'@rollup/pluginutils': 3.1.0(rollup@2.79.1)
'@rollup/pluginutils': 3.1.0(@rollup/wasm-node@4.9.4)
magic-string: 0.25.9
rollup: 2.79.1
rollup: /@rollup/wasm-node@4.9.4
dev: true
/@rollup/pluginutils@3.1.0(rollup@2.79.1):
/@rollup/pluginutils@3.1.0(@rollup/wasm-node@4.9.4):
resolution: {integrity: sha512-GksZ6pr6TpIjHm8h9lSQ8pi8BE9VeubNT0OMJ3B5uZJ8pz73NPiqOtCog/x2/QzM1ENChPKxMDhiQuRHsqc+lg==}
engines: {node: '>= 8.0.0'}
peerDependencies:
rollup: ^1.20.0||^2.0.0
rollup: npm:@rollup/wasm-node
dependencies:
'@types/estree': 0.0.39
estree-walker: 1.0.1
picomatch: 2.3.1
rollup: 2.79.1
rollup: /@rollup/wasm-node@4.9.4
dev: true
/@rollup/rollup-android-arm-eabi@4.9.1:
resolution: {integrity: sha512-6vMdBZqtq1dVQ4CWdhFwhKZL6E4L1dV6jUjuBvsavvNJSppzi6dLBbuV+3+IyUREaj9ZFvQefnQm28v4OCXlig==}
cpu: [arm]
os: [android]
requiresBuild: true
dev: true
optional: true
/@rollup/rollup-android-arm64@4.9.1:
resolution: {integrity: sha512-Jto9Fl3YQ9OLsTDWtLFPtaIMSL2kwGyGoVCmPC8Gxvym9TCZm4Sie+cVeblPO66YZsYH8MhBKDMGZ2NDxuk/XQ==}
cpu: [arm64]
os: [android]
requiresBuild: true
dev: true
optional: true
/@rollup/rollup-darwin-arm64@4.9.1:
resolution: {integrity: sha512-LtYcLNM+bhsaKAIGwVkh5IOWhaZhjTfNOkGzGqdHvhiCUVuJDalvDxEdSnhFzAn+g23wgsycmZk1vbnaibZwwA==}
cpu: [arm64]
os: [darwin]
requiresBuild: true
dev: true
optional: true
/@rollup/rollup-darwin-x64@4.9.1:
resolution: {integrity: sha512-KyP/byeXu9V+etKO6Lw3E4tW4QdcnzDG/ake031mg42lob5tN+5qfr+lkcT/SGZaH2PdW4Z1NX9GHEkZ8xV7og==}
cpu: [x64]
os: [darwin]
requiresBuild: true
dev: true
optional: true
/@rollup/rollup-linux-arm-gnueabihf@4.9.1:
resolution: {integrity: sha512-Yqz/Doumf3QTKplwGNrCHe/B2p9xqDghBZSlAY0/hU6ikuDVQuOUIpDP/YcmoT+447tsZTmirmjgG3znvSCR0Q==}
cpu: [arm]
os: [linux]
requiresBuild: true
dev: true
optional: true
/@rollup/rollup-linux-arm64-gnu@4.9.1:
resolution: {integrity: sha512-u3XkZVvxcvlAOlQJ3UsD1rFvLWqu4Ef/Ggl40WAVCuogf4S1nJPHh5RTgqYFpCOvuGJ7H5yGHabjFKEZGExk5Q==}
cpu: [arm64]
os: [linux]
requiresBuild: true
dev: true
optional: true
/@rollup/rollup-linux-arm64-musl@4.9.1:
resolution: {integrity: sha512-0XSYN/rfWShW+i+qjZ0phc6vZ7UWI8XWNz4E/l+6edFt+FxoEghrJHjX1EY/kcUGCnZzYYRCl31SNdfOi450Aw==}
cpu: [arm64]
os: [linux]
requiresBuild: true
dev: true
optional: true
/@rollup/rollup-linux-riscv64-gnu@4.9.1:
resolution: {integrity: sha512-LmYIO65oZVfFt9t6cpYkbC4d5lKHLYv5B4CSHRpnANq0VZUQXGcCPXHzbCXCz4RQnx7jvlYB1ISVNCE/omz5cw==}
cpu: [riscv64]
os: [linux]
requiresBuild: true
dev: true
optional: true
/@rollup/rollup-linux-x64-gnu@4.9.1:
resolution: {integrity: sha512-kr8rEPQ6ns/Lmr/hiw8sEVj9aa07gh1/tQF2Y5HrNCCEPiCBGnBUt9tVusrcBBiJfIt1yNaXN6r1CCmpbFEDpg==}
cpu: [x64]
os: [linux]
requiresBuild: true
dev: true
optional: true
/@rollup/rollup-linux-x64-musl@4.9.1:
resolution: {integrity: sha512-t4QSR7gN+OEZLG0MiCgPqMWZGwmeHhsM4AkegJ0Kiy6TnJ9vZ8dEIwHw1LcZKhbHxTY32hp9eVCMdR3/I8MGRw==}
cpu: [x64]
os: [linux]
requiresBuild: true
dev: true
optional: true
/@rollup/rollup-win32-arm64-msvc@4.9.1:
resolution: {integrity: sha512-7XI4ZCBN34cb+BH557FJPmh0kmNz2c25SCQeT9OiFWEgf8+dL6ZwJ8f9RnUIit+j01u07Yvrsuu1rZGxJCc51g==}
cpu: [arm64]
os: [win32]
requiresBuild: true
dev: true
optional: true
/@rollup/rollup-win32-ia32-msvc@4.9.1:
resolution: {integrity: sha512-yE5c2j1lSWOH5jp+Q0qNL3Mdhr8WuqCNVjc6BxbVfS5cAS6zRmdiw7ktb8GNpDCEUJphILY6KACoFoRtKoqNQg==}
cpu: [ia32]
os: [win32]
requiresBuild: true
dev: true
optional: true
/@rollup/rollup-win32-x64-msvc@4.9.1:
resolution: {integrity: sha512-PyJsSsafjmIhVgaI1Zdj7m8BB8mMckFah/xbpplObyHfiXzKcI5UOUXRyOdHW7nz4DpMCuzLnF7v5IWHenCwYA==}
cpu: [x64]
os: [win32]
requiresBuild: true
dev: true
optional: true
/@rollup/wasm-node@4.9.4:
resolution: {integrity: sha512-K9ZPYMCxP7sBElj5du0En/zpbhXTQxpWI7RlF+8bNpLUozhzg2Pcx2h3cBCzV7xtiUt0dc+pF2Ib3/Sg8R0JMA==}
engines: {node: '>=18.0.0', npm: '>=8.0.0'}
hasBin: true
dependencies:
'@types/estree': 1.0.5
optionalDependencies:
fsevents: 2.3.3
/@scure/base@1.1.5:
resolution: {integrity: sha512-Brj9FiG2W1MRQSTB212YVPRrcbjkv48FoZi/u4l/zds/ieRrqsh7aUf6CLwkAq61oKXr/ZlTzlY66gLIj3TFTQ==}
@ -2274,6 +2183,9 @@ packages:
resolution: {integrity: sha512-EYNwp3bU+98cpU4lAWYYL7Zz+2gryWH1qbdDTidVd6hkiR6weksdbMadyXKXNPEkQFhXM+hVO9ZygomHXp+AIw==}
dev: true
/@types/estree@1.0.5:
resolution: {integrity: sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw==}
/@types/filesystem@0.0.32:
resolution: {integrity: sha512-Yuf4jR5YYMR2DVgwuCiP11s0xuVRyPKmz8vo6HBY3CGdeMj8af93CFZX+T82+VD1+UqHOxTq31lO7MI7lepBtQ==}
dependencies:
@ -5142,7 +5054,7 @@ packages:
'@babel/plugin-syntax-typescript': 7.23.3(@babel/core@7.23.6)
'@babel/types': 7.23.6
kleur: 4.1.5
rollup: 3.29.4
rollup: /@rollup/wasm-node@4.9.4
unplugin: 1.5.1
transitivePeerDependencies:
- supports-color
@ -6064,73 +5976,36 @@ packages:
glob: 7.2.3
dev: true
/rollup-plugin-terser@7.0.2(rollup@2.79.1):
/rollup-plugin-terser@7.0.2(@rollup/wasm-node@4.9.4):
resolution: {integrity: sha512-w3iIaU4OxcF52UUXiZNsNeuXIMDvFrr+ZXK6bFZ0Q60qyVfq4uLptoS4bbq3paG3x216eQllFZX7zt6TIImguQ==}
deprecated: This package has been deprecated and is no longer maintained. Please use @rollup/plugin-terser
peerDependencies:
rollup: ^2.0.0
rollup: npm:@rollup/wasm-node
dependencies:
'@babel/code-frame': 7.23.5
jest-worker: 26.6.2
rollup: 2.79.1
rollup: /@rollup/wasm-node@4.9.4
serialize-javascript: 4.0.0
terser: 5.19.3
dev: true
/rollup-plugin-visualizer@5.11.0(rollup@2.79.1):
/rollup-plugin-visualizer@5.11.0(@rollup/wasm-node@4.9.4):
resolution: {integrity: sha512-exM0Ms2SN3AgTzMeW7y46neZQcyLY7eKwWAop1ZoRTCZwyrIRdMMJ6JjToAJbML77X/9N8ZEpmXG4Z/Clb9k8g==}
engines: {node: '>=14'}
hasBin: true
peerDependencies:
rollup: 2.x || 3.x || 4.x
rollup: npm:@rollup/wasm-node
peerDependenciesMeta:
rollup:
optional: true
dependencies:
open: 8.4.2
picomatch: 2.3.1
rollup: 2.79.1
rollup: /@rollup/wasm-node@4.9.4
source-map: 0.7.4
yargs: 17.7.2
dev: true
/rollup@2.79.1:
resolution: {integrity: sha512-uKxbd0IhMZOhjAiD5oAFp7BqvkA4Dv47qpOCtaNvng4HBwdbWtdOh8f5nZNuk2rp51PMGk3bzfWu5oayNEuYnw==}
engines: {node: '>=10.0.0'}
hasBin: true
optionalDependencies:
fsevents: 2.3.3
dev: true
/rollup@3.29.4:
resolution: {integrity: sha512-oWzmBZwvYrU0iJHtDmhsm662rC15FRXmcjCk1xD771dFDx5jJ02ufAQQTn0etB2emNk4J9EZg/yWKpsn9BWGRw==}
engines: {node: '>=14.18.0', npm: '>=8.0.0'}
hasBin: true
optionalDependencies:
fsevents: 2.3.3
dev: false
/rollup@4.9.1:
resolution: {integrity: sha512-pgPO9DWzLoW/vIhlSoDByCzcpX92bKEorbgXuZrqxByte3JFk2xSW2JEeAcyLc9Ru9pqcNNW+Ob7ntsk2oT/Xw==}
engines: {node: '>=18.0.0', npm: '>=8.0.0'}
hasBin: true
optionalDependencies:
'@rollup/rollup-android-arm-eabi': 4.9.1
'@rollup/rollup-android-arm64': 4.9.1
'@rollup/rollup-darwin-arm64': 4.9.1
'@rollup/rollup-darwin-x64': 4.9.1
'@rollup/rollup-linux-arm-gnueabihf': 4.9.1
'@rollup/rollup-linux-arm64-gnu': 4.9.1
'@rollup/rollup-linux-arm64-musl': 4.9.1
'@rollup/rollup-linux-riscv64-gnu': 4.9.1
'@rollup/rollup-linux-x64-gnu': 4.9.1
'@rollup/rollup-linux-x64-musl': 4.9.1
'@rollup/rollup-win32-arm64-msvc': 4.9.1
'@rollup/rollup-win32-ia32-msvc': 4.9.1
'@rollup/rollup-win32-x64-msvc': 4.9.1
fsevents: 2.3.3
dev: true
/rrweb-cssom@0.6.0:
resolution: {integrity: sha512-APM0Gt1KoXBz0iIkkdB/kfvGOwC4UuJFeG/c+yV7wSc7q96cG/kJ0HiYCnzivD9SB53cLV1MlHFNfOuPaadYSw==}
dev: true
@ -7109,7 +6984,7 @@ packages:
'@types/node': 20.10.5
esbuild: 0.19.10
postcss: 8.4.32
rollup: 4.9.1
rollup: /@rollup/wasm-node@4.9.4
optionalDependencies:
fsevents: 2.3.3
dev: true
@ -7371,9 +7246,9 @@ packages:
'@babel/core': 7.23.6
'@babel/preset-env': 7.23.6(@babel/core@7.23.6)
'@babel/runtime': 7.23.6
'@rollup/plugin-babel': 5.3.1(@babel/core@7.23.6)(rollup@2.79.1)
'@rollup/plugin-node-resolve': 11.2.1(rollup@2.79.1)
'@rollup/plugin-replace': 2.4.2(rollup@2.79.1)
'@rollup/plugin-babel': 5.3.1(@babel/core@7.23.6)(@rollup/wasm-node@4.9.4)
'@rollup/plugin-node-resolve': 11.2.1(@rollup/wasm-node@4.9.4)
'@rollup/plugin-replace': 2.4.2(@rollup/wasm-node@4.9.4)
'@surma/rollup-plugin-off-main-thread': 2.2.3
ajv: 8.12.0
common-tags: 1.8.2
@ -7382,8 +7257,8 @@ packages:
glob: 7.2.3
lodash: 4.17.21
pretty-bytes: 5.6.0
rollup: 2.79.1
rollup-plugin-terser: 7.0.2(rollup@2.79.1)
rollup: /@rollup/wasm-node@4.9.4
rollup-plugin-terser: 7.0.2(@rollup/wasm-node@4.9.4)
source-map: 0.8.0-beta.0
stringify-object: 3.3.0
strip-comments: 2.0.1

View File

@ -41,7 +41,7 @@ export function Button(props: Props) {
props.padding ?? "px-4 py-3",
props.className,
colorClasses,
props.disabled ? "cursor-not-allowed bg-opacity-60 text-opacity-60" : null,
props.disabled ? "!cursor-not-allowed bg-opacity-60 text-opacity-60" : null,
);
if (props.disabled)

View File

@ -75,6 +75,7 @@ function CustomCaptionOption() {
setCaption({
language: "custom",
srtData: converted,
id: "custom-caption",
});
setCustomSubs();
});
@ -115,39 +116,38 @@ function useSubtitleList(subs: CaptionListItem[], searchQuery: string) {
export function CaptionsView({ id }: { id: string }) {
const { t } = useTranslation();
const router = useOverlayRouter(id);
const lang = usePlayerStore((s) => s.caption.selected?.language);
const selectedCaptionId = usePlayerStore((s) => s.caption.selected?.id);
const [currentlyDownloading, setCurrentlyDownloading] = useState<
string | null
>(null);
const { selectLanguage, disable } = useCaptions();
const { selectCaptionById, disable } = useCaptions();
const captionList = usePlayerStore((s) => s.captionList);
const [searchQuery, setSearchQuery] = useState("");
const subtitleList = useSubtitleList(captionList, searchQuery);
const [downloadReq, startDownload] = useAsyncFn(
async (language: string) => {
setCurrentlyDownloading(language);
return selectLanguage(language);
async (captionId: string) => {
setCurrentlyDownloading(captionId);
return selectCaptionById(captionId);
},
[selectLanguage, setCurrentlyDownloading],
[selectCaptionById, setCurrentlyDownloading],
);
const content = subtitleList.map((v, i) => {
return (
<CaptionOption
// key must use index to prevent url collisions
// eslint-disable-next-line react/no-array-index-key
key={`${i}-${v.url}`}
key={v.id}
countryCode={v.language}
selected={lang === v.language}
loading={v.language === currentlyDownloading && downloadReq.loading}
selected={v.id === selectedCaptionId}
loading={v.id === currentlyDownloading && downloadReq.loading}
error={
v.language === currentlyDownloading && downloadReq.error
v.id === currentlyDownloading && downloadReq.error
? downloadReq.error.toString()
: undefined
}
onClick={() => startDownload(v.language)}
onClick={() => startDownload(v.id)}
>
{v.languageName}
</CaptionOption>
@ -176,7 +176,7 @@ export function CaptionsView({ id }: { id: string }) {
</div>
</div>
<Menu.ScrollToActiveSection className="!pt-1 mt-2 pb-3">
<CaptionOption onClick={() => disable()} selected={!lang}>
<CaptionOption onClick={() => disable()} selected={!selectedCaptionId}>
{t("player.menus.subtitles.offChoice")}
</CaptionOption>
<CustomCaptionOption />

View File

@ -41,6 +41,7 @@ export interface DisplayMeta {
}
export interface DisplayCaption {
id: string;
srtData: string;
language: string;
url?: string;

View File

@ -14,22 +14,32 @@ export function useCaptions() {
const lastSelectedLanguage = useSubtitleStore((s) => s.lastSelectedLanguage);
const captionList = usePlayerStore((s) => s.captionList);
const selectLanguage = useCallback(
async (language: string) => {
const caption = captionList.find((v) => v.language === language);
const selectCaptionById = useCallback(
async (captionId: string) => {
const caption = captionList.find((v) => v.id === captionId);
if (!caption) return;
const srtData = await downloadCaption(caption);
setCaption({
id: caption.id,
language: caption.language,
srtData,
url: caption.url,
});
resetSubtitleSpecificSettings();
setLanguage(language);
setLanguage(caption.language);
},
[setLanguage, captionList, setCaption, resetSubtitleSpecificSettings],
);
const selectLanguage = useCallback(
async (language: string) => {
const caption = captionList.find((v) => v.language === language);
if (!caption) return;
return selectCaptionById(caption.id);
},
[captionList, selectCaptionById],
);
const disable = useCallback(async () => {
setCaption(null);
setLanguage(null);
@ -56,5 +66,6 @@ export function useCaptions() {
selectLastUsedLanguage,
toggleLastUsed,
selectLastUsedLanguageIfEnabled,
selectCaptionById,
};
}

View File

@ -80,6 +80,7 @@ export function convertProviderCaption(
captions: RunOutput["stream"]["captions"],
): CaptionListItem[] {
return captions.map((v) => ({
id: v.id,
language: v.language,
url: v.url,
needsProxy: v.hasCorsRestrictions,

View File

@ -5,7 +5,6 @@ import { Avatar } from "@/components/Avatar";
import { Button } from "@/components/buttons/Button";
import { ColorPicker, initialColor } from "@/components/form/ColorPicker";
import { IconPicker, initialIcon } from "@/components/form/IconPicker";
import { Icon, Icons } from "@/components/Icon";
import {
LargeCard,
LargeCardButtons,

View File

@ -42,12 +42,14 @@ export interface PlayerMeta {
}
export interface Caption {
id: string;
language: string;
url?: string;
srtData: string;
}
export interface CaptionListItem {
id: string;
language: string;
url: string;
needsProxy: boolean;