diff --git a/service/Dockerfile b/service/Dockerfile index c0bbaba..7700c67 100644 --- a/service/Dockerfile +++ b/service/Dockerfile @@ -21,7 +21,7 @@ ARG TARGETPLATFORM RUN apt-get update && apt-get install -y curl tar xz-utils && \ if [ "$TARGETPLATFORM" = "linux/amd64" ]; then \ - echo "amd64" && false; \ + echo "Unsupported platform: amd64" && false; \ elif [ "$TARGETPLATFORM" = "linux/arm/v7" ]; then \ curl -L https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp_linux_armv7l > yt-dlp && \ chmod +x yt-dlp; \ @@ -34,7 +34,6 @@ RUN apt-get update && apt-get install -y curl tar xz-utils && \ curl -L https://github.com/yt-dlp/FFmpeg-Builds/releases/download/latest/ffmpeg-master-latest-linuxarm64-gpl.tar.xz > ffmpeg.tar.xz && \ tar -xJf ffmpeg.tar.xz --wildcards */bin/ffmpeg --transform='s/^.*\///' && rm ffmpeg.tar.xz; \ elif [ "$TARGETPLATFORM" = "linux/x86_64" ]; then \ - echo "Unsupported platform: $TARGETPLATFORM" && \ curl -L https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp_linux > yt-dlp && \ chmod +x yt-dlp && \ curl -L https://github.com/yt-dlp/FFmpeg-Builds/releases/download/latest/ffmpeg-master-latest-linux64-gpl.tar.xz > ffmpeg.tar.xz && \ diff --git a/service/src/bot/api/routes.rs b/service/src/bot/api/routes.rs index 1c06644..089e5aa 100644 --- a/service/src/bot/api/routes.rs +++ b/service/src/bot/api/routes.rs @@ -272,13 +272,6 @@ async fn set_volume(path: web::Path, volume: web::Json::, dat for (_, track_handle) in handler.queue().current_queue().iter().enumerate() { let _ = track_handle.set_volume(bound_volume); } - if let Err(err) = handler.queue().pause() { - warn!("Could not pause track: {:?}", err); - return ResponseError::error_response(&ServiceError { - status: 422, - message: err.to_string() - }) - } } HttpResponse::Ok().finish() @@ -295,5 +288,6 @@ pub fn init_routes(config: &mut web::ServiceConfig) { .service(stop) .service(resume) .service(pause) + .service(set_volume) ); } \ No newline at end of file diff --git a/ui/src/api/guilds.ts b/ui/src/api/guilds.ts index 64bbe8b..67969b1 100644 --- a/ui/src/api/guilds.ts +++ b/ui/src/api/guilds.ts @@ -31,3 +31,7 @@ export async function pauseTrack(guildId: number): Promise { export async function resumeTrack(guildId: number): Promise { await postRequest(`guilds/${guildId}/voice/resume`, {}); } + +export async function setVolume(guildId: number, volume: number): Promise { + await postRequest(`guilds/${guildId}/voice/volume`, { volume: `${volume}` }); +} diff --git a/ui/src/app/management/page.tsx b/ui/src/app/management/page.tsx index 4d3a01c..bf90fd9 100644 --- a/ui/src/app/management/page.tsx +++ b/ui/src/app/management/page.tsx @@ -7,6 +7,7 @@ import { pauseTrack, playTrack, resumeTrack, + setVolume, stopTrack } from '@/api/guilds'; import { GuildChannel, GuildInfo } from '@/api/guilds.types'; @@ -38,7 +39,8 @@ export default function Page() { const playForm = useForm({ initialValues: { - trackUrl: '' + trackUrl: '', + volume: 50.0 } }); @@ -101,12 +103,26 @@ export default function Page() { Resume -
- {}} /> - -
+ ))}