Selkies Checkpoint 8 - Working Audio
All checks were successful
Build & Push Docker Image / build-and-publish (push) Successful in 10s

This commit is contained in:
2025-10-02 09:50:17 -04:00
parent 2bfc040010
commit 2ec4d06315
2 changed files with 7 additions and 109 deletions

View File

@@ -4,33 +4,25 @@ FROM ghcr.io/linuxserver/baseimage-selkies:ubuntunoble
# Environment variables for Selkies
ENV \
CUSTOM_PORT="8080" \
# CUSTOM_PORT="8080" \
CUSTOM_HTTPS_PORT="8181" \
TITLE="RuneLite" \
SELKIES_MANUAL_WIDTH="1366" \
SELKIES_MANUAL_HEIGHT="768" \
SELKIES_FRAMERATE="30" \
SELKIES_SCALING_DPI="96" \
SELKIES_AUDIO_ENABLED="false" \
# SELKIES_AUDIO_ENABLED="false" \
SELKIES_GAMEPAD_ENABLED="false" \
SELKIES_UI_SIDEBAR_SHOW_GAMEPADS="false" \
SELKIES_UI_SIDEBAR_SHOW_AUDIO_SETTINGS="false" \
CUSTOM_USER="runelite"
SELKIES_UI_SIDEBAR_SHOW_GAMEPADS="false"
# SELKIES_UI_SIDEBAR_SHOW_AUDIO_SETTINGS="false"
RUN apt-get update && apt-get install -y --no-install-recommends \
default-jre \
wget \
pulseaudio \
pulseaudio-utils \
alsa-utils \
libasound2-plugins \
libnotify-bin \
notification-daemon \
&& rm -rf /var/lib/apt/lists/*
# Ensure the abc user is in the audio group for sound support
RUN usermod -a -G audio abc
# Add RuneLite icon for Selkies interface and favicon
COPY icons/ /usr/share/selkies/www/
@@ -70,13 +62,7 @@ RUN mkdir -p /etc/xdg/openbox && \
echo ' </applications>' >> /etc/xdg/openbox/rc.xml && \
echo '</openbox_config>' >> /etc/xdg/openbox/rc.xml
# Configure PulseAudio for containerized environment
RUN echo 'default-server = unix:/run/pulse/native' > /etc/pulse/client.conf && \
echo 'autospawn = no' >> /etc/pulse/client.conf
# Configure ALSA to use PulseAudio
RUN echo 'pcm.!default { type pulse }' > /etc/asound.conf && \
echo 'ctl.!default { type pulse }' >> /etc/asound.conf
# Note: PulseAudio configuration handled by Selkies base image
# Use LinuxServer.io's autostart mechanism instead of custom cont-init.d
RUN mkdir -p /defaults && \
@@ -94,4 +80,5 @@ RUN mkdir -p /config/.config/autostart && \
chown -R abc:abc /config/.config
# Expose Selkies web interface ports
EXPOSE 8080 8181
EXPOSE 8181
# EXPOSE 8080 8181

View File

@@ -1,89 +0,0 @@
// Simple fix for HTTP Basic Auth WebSocket connection issues
// Only prevents initial failed connections, allows normal operation after auth
(function() {
'use strict';
// Quick check if we're already authenticated
let authChecked = false;
let isAuthenticated = false;
// Store original WebSocket
const OriginalWebSocket = window.WebSocket;
// Simple auth check
function quickAuthCheck() {
if (authChecked) return Promise.resolve(isAuthenticated);
return fetch(window.location.href, {
method: 'HEAD',
credentials: 'same-origin'
}).then(response => {
authChecked = true;
isAuthenticated = response.ok && response.status !== 401;
return isAuthenticated;
}).catch(() => {
authChecked = true;
isAuthenticated = false;
return false;
});
}
// Override WebSocket constructor
window.WebSocket = function(url, protocols) {
// If we haven't checked auth yet, do a quick check
if (!authChecked) {
quickAuthCheck().then(authenticated => {
if (!authenticated) {
// If not authenticated, wait a bit and try again
setTimeout(() => {
window.location.reload();
}, 2000);
}
});
}
// If we're authenticated or auth check passed, create WebSocket normally
if (isAuthenticated || authChecked) {
return new OriginalWebSocket(url, protocols);
}
// Otherwise, create a dummy WebSocket that will be replaced
const ws = this;
ws.readyState = OriginalWebSocket.CONNECTING;
ws.bufferedAmount = 0;
ws.extensions = '';
ws.protocol = '';
ws.url = url;
ws.onopen = null;
ws.onclose = null;
ws.onerror = null;
ws.onmessage = null;
ws.close = function() {};
ws.send = function() {};
// Check auth and replace with real WebSocket when ready
quickAuthCheck().then(authenticated => {
if (authenticated) {
const realWs = new OriginalWebSocket(url, protocols);
// Copy event handlers
realWs.onopen = ws.onopen;
realWs.onclose = ws.onclose;
realWs.onerror = ws.onerror;
realWs.onmessage = ws.onmessage;
// Replace methods and properties
Object.setPrototypeOf(ws, realWs);
Object.assign(ws, realWs);
}
});
return ws;
};
// Copy static properties
Object.setPrototypeOf(window.WebSocket, OriginalWebSocket);
Object.assign(window.WebSocket, OriginalWebSocket);
})();