mirror of
https://github.com/informaticker/discord-jellyfin-bot.git
synced 2024-11-25 02:51:57 +01:00
Merge branch 'dev' into refactor/strict-typescript
This commit is contained in:
commit
1ac7a741a5
14
.deepsource.toml
Normal file
14
.deepsource.toml
Normal file
@ -0,0 +1,14 @@
|
||||
version = 1
|
||||
|
||||
[[analyzers]]
|
||||
name = "javascript"
|
||||
|
||||
[analyzers.meta]
|
||||
plugins = ["react"]
|
||||
|
||||
[[analyzers]]
|
||||
name = "docker"
|
||||
|
||||
[[analyzers]]
|
||||
name = "test-coverage"
|
||||
enabled = true
|
58
.github/workflows/deepsource-tests.yml
vendored
Normal file
58
.github/workflows/deepsource-tests.yml
vendored
Normal file
@ -0,0 +1,58 @@
|
||||
name: Deepsource report test coverage
|
||||
# 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.
|
||||
on:
|
||||
push:
|
||||
branches: [dev,master]
|
||||
paths-ignore:
|
||||
- '.github/**'
|
||||
- 'images/'
|
||||
- '*.md'
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
- dev
|
||||
|
||||
workflow_dispatch:
|
||||
|
||||
env:
|
||||
# Use docker.io for Docker Hub if empty
|
||||
REGISTRY: ghcr.io
|
||||
# github.repository as <account>/<repo>
|
||||
IMAGE_NAME: ${{ github.repository }}
|
||||
|
||||
jobs:
|
||||
report-test-coverage:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
packages: write
|
||||
contents: read
|
||||
steps:
|
||||
- name: Setup
|
||||
uses: actions/setup-node@v3
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
- name: Get yarn cache directory path
|
||||
id: yarn-cache-dir-path
|
||||
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
|
||||
- uses: actions/cache@v3
|
||||
id: yarn-cache
|
||||
with:
|
||||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
||||
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-yarn-
|
||||
- run: yarn install --immutable
|
||||
- run: yarn test:cov
|
||||
- run: curl https://deepsource.io/cli | sh
|
||||
- name: Report test-coverage to DeepSource
|
||||
run: |
|
||||
# Install the CLI
|
||||
curl https://deepsource.io/cli | sh
|
||||
|
||||
# Send the report to DeepSource
|
||||
./bin/deepsource report --analyzer test-coverage --key javascript --value-file ./coverage/lcov.info
|
||||
env:
|
||||
DEEPSOURCE_DSN: ${{ secrets.DEEPSOURCE_DSN }}
|
85
.github/workflows/sonarcloud.yml
vendored
85
.github/workflows/sonarcloud.yml
vendored
@ -1,85 +0,0 @@
|
||||
# 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 helps you trigger a SonarCloud analysis of your code and populates
|
||||
# GitHub Code Scanning alerts with the vulnerabilities found.
|
||||
# Free for open source project.
|
||||
|
||||
# 1. Login to SonarCloud.io using your GitHub account
|
||||
|
||||
# 2. Import your project on SonarCloud
|
||||
# * Add your GitHub organization first, then add your repository as a new project.
|
||||
# * Please note that many languages are eligible for automatic analysis,
|
||||
# which means that the analysis will start automatically without the need to set up GitHub Actions.
|
||||
# * This behavior can be changed in Administration > Analysis Method.
|
||||
#
|
||||
# 3. Follow the SonarCloud in-product tutorial
|
||||
# * a. Copy/paste the Project Key and the Organization Key into the args parameter below
|
||||
# (You'll find this information in SonarCloud. Click on "Information" at the bottom left)
|
||||
#
|
||||
# * b. Generate a new token and add it to your Github repository's secrets using the name SONAR_TOKEN
|
||||
# (On SonarCloud, click on your avatar on top-right > My account > Security
|
||||
# or go directly to https://sonarcloud.io/account/security/)
|
||||
|
||||
# Feel free to take a look at our documentation (https://docs.sonarcloud.io/getting-started/github/)
|
||||
# or reach out to our community forum if you need some help (https://community.sonarsource.com/c/help/sc/9)
|
||||
|
||||
name: SonarCloud analysis
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ "master", "dev" ]
|
||||
pull_request:
|
||||
branches: [ "master", "dev" ]
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
pull-requests: read # allows SonarCloud to decorate PRs with analysis results
|
||||
|
||||
jobs:
|
||||
Analysis:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Setup
|
||||
uses: actions/setup-node@v3
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
- name: Get yarn cache directory path
|
||||
id: yarn-cache-dir-path
|
||||
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
|
||||
- uses: actions/cache@v3
|
||||
id: yarn-cache
|
||||
with:
|
||||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
||||
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-yarn-
|
||||
- run: yarn install --immutable
|
||||
- run: yarn test:cov
|
||||
- name: Analyze with SonarCloud
|
||||
|
||||
# You can pin the exact commit or the version.
|
||||
# uses: SonarSource/sonarcloud-github-action@de2e56b42aa84d0b1c5b622644ac17e505c9a049
|
||||
uses: SonarSource/sonarcloud-github-action@de2e56b42aa84d0b1c5b622644ac17e505c9a049
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information
|
||||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} # Generate a token on Sonarcloud.io, add it to the secrets of this repo with the name SONAR_TOKEN (Settings > Secrets > Actions > add new repository secret)
|
||||
with:
|
||||
# Additional arguments for the sonarcloud scanner
|
||||
args:
|
||||
# Unique keys of your project and organization. You can find them in SonarCloud > Information (bottom-left menu)
|
||||
# mandatory
|
||||
-Dsonar.projectKey=manuel-rw_jellyfin-discord-music-bot
|
||||
-Dsonar.organization=manuel-rw
|
||||
-Dsonar.javascript.lcov.reportPaths=coverage/lcov.info
|
||||
# Comma-separated paths to directories containing main source files.
|
||||
#-Dsonar.sources= # optional, default is project base directory
|
||||
# When you need the analysis to take place in a directory other than the one from which it was launched
|
||||
#-Dsonar.projectBaseDir= # optional, default is .
|
||||
# Comma-separated paths to directories containing test source files.
|
||||
#-Dsonar.tests= # optional. For more info about Code Coverage, please refer to https://docs.sonarcloud.io/enriching/test-coverage/overview/
|
||||
# Adds more detail to both client and server-side analysis logs, activating DEBUG mode for the scanner, and adding client-side environment variables and system properties to the server-side log of analysis report processing.
|
||||
#-Dsonar.verbose= # optional, default is false
|
@ -18,6 +18,7 @@
|
||||
<br/>
|
||||
<br/>
|
||||
<img src="https://github.com/manuel-rw/jellyfin-discord-music-bot/actions/workflows/docker.yml/badge.svg?branch=master" />
|
||||
<img src="https://deepsource.io/gh/manuel-rw/jellyfin-discord-music-bot.svg/?label=active+issues&show_trend=true&token=vhfm8cbHaoCyXTf7Gfs9FweR)](https://deepsource.io/gh/manuel-rw/jellyfin-discord-music-bot/?ref=repository-badge" />
|
||||
</p>
|
||||
|
||||
<br/>
|
||||
|
@ -105,7 +105,9 @@ export class DiscordVoiceService {
|
||||
|
||||
changeVolume(volume: number) {
|
||||
if (!this.audioResource || !this.audioResource.volume) {
|
||||
this.logger.error(`AudioResource or volume was undefined`);
|
||||
this.logger.error(
|
||||
`Failed to change audio volume, AudioResource or volume was undefined`,
|
||||
);
|
||||
return;
|
||||
}
|
||||
this.audioResource.volume.setVolume(volume);
|
||||
|
@ -46,10 +46,7 @@ export class JellyfinService {
|
||||
process.env.JELLYFIN_AUTHENTICATION_PASSWORD,
|
||||
)
|
||||
.then(async (response) => {
|
||||
if (
|
||||
response.data.SessionInfo === undefined ||
|
||||
response.data.SessionInfo.UserId === undefined
|
||||
) {
|
||||
if (response.data.SessionInfo?.UserId === undefined) {
|
||||
this.logger.error(
|
||||
`Failed to authenticate with response code ${response.status}: '${response.data}'`,
|
||||
);
|
||||
|
@ -104,9 +104,9 @@ export class PlayItemCommand {
|
||||
);
|
||||
this.playbackService.getPlaylistOrDefault().enqueueTracks(tracks);
|
||||
|
||||
const remoteImage: RemoteImageInfo | undefined = tracks
|
||||
.flatMap((track) => track.getRemoteImages())
|
||||
.find(() => true);
|
||||
const remoteImages = tracks.flatMap((track) => track.getRemoteImages());
|
||||
const remoteImage: RemoteImageInfo | undefined =
|
||||
remoteImages.length > 0 ? remoteImages[0] : undefined;
|
||||
|
||||
await interaction.followUp({
|
||||
embeds: [
|
||||
@ -117,10 +117,10 @@ export class PlayItemCommand {
|
||||
reducedDuration,
|
||||
)})`,
|
||||
mixin(embedBuilder) {
|
||||
if (!remoteImage) {
|
||||
if (!remoteImage?.Url) {
|
||||
return embedBuilder;
|
||||
}
|
||||
return embedBuilder.setThumbnail(remoteImage.Url ?? '');
|
||||
return embedBuilder.setThumbnail(remoteImage.Url);
|
||||
},
|
||||
}),
|
||||
],
|
||||
|
Loading…
Reference in New Issue
Block a user