diff --git a/Makefile b/Makefile index ab456ac..5040796 100644 --- a/Makefile +++ b/Makefile @@ -26,7 +26,7 @@ endif GOPATH?=$(shell go env GOPATH) WINDOWS_CGO_FLAGS?=-I$(PWD)/3rdparty/amd64/windows/vlc-$(WINDOWS_VLC_VERSION)/sdk/include -WINDOWS_LINKER_FLAGS?=-L$(PWD)/3rdparty/amd64/windows/vlc-$(WINDOWS_VLC_VERSION)/sdk/lib -L$(PWD)/3rdparty/amd64/windows/ffmpeg-n7.0.2-19-g45ecf80f0e-win64-gpl-shared-7.0/lib +WINDOWS_LINKER_FLAGS?=-L$(PWD)/3rdparty/amd64/windows/vlc-$(WINDOWS_VLC_VERSION)/sdk/lib -L$(PWD)/3rdparty/amd64/windows/ffmpeg-n7.0-21-gfb8f0ea7b3-win64-gpl-shared-7.0/lib WINDOWS_PKG_CONFIG_PATH?=$(PWD)/3rdparty/amd64/windows/vlc-$(WINDOWS_VLC_VERSION)/sdk/lib/pkgconfig all: streampanel-linux-amd64 streampanel-linux-arm64 streampanel-android-arm64 streampanel-windows @@ -52,12 +52,10 @@ $(GOPATH)/bin/pkg-config-wrapper: wget https://github.com/xaionaro/termux-prebuilt-packages/raw/refs/heads/main/$$PACKAGE && ar x $$PACKAGE && tar -xJvf data.tar.xz && rm -f data.tar.xz control.tar.xz debian-binary $$PACKAGE; \ done - - 3rdparty/amd64/windows: mkdir -p 3rdparty/amd64/windows sh -c 'cd 3rdparty/amd64/windows && wget https://get.videolan.org/vlc/$(WINDOWS_VLC_VERSION)/win64/vlc-$(WINDOWS_VLC_VERSION)-win64.7z && 7z x vlc-$(WINDOWS_VLC_VERSION)-win64.7z && rm -f vlc-$(WINDOWS_VLC_VERSION)-win64.7z' - sh -c 'cd 3rdparty/amd64/windows && wget https://github.com/BtbN/FFmpeg-Builds/releases/download/autobuild-2024-09-29-12-53/ffmpeg-n7.0.2-19-g45ecf80f0e-win64-gpl-shared-7.0.zip && unzip ffmpeg-n7.0.2-19-g45ecf80f0e-win64-gpl-shared-7.0.zip && rm -f ffmpeg-n7.0.2-19-g45ecf80f0e-win64-gpl-shared-7.0.zip' + sh -c 'cd 3rdparty/amd64/windows && wget https://github.com/BtbN/FFmpeg-Builds/releases/download/autobuild-2024-04-30-12-51/ffmpeg-n7.0-21-gfb8f0ea7b3-win64-gpl-shared-7.0.zip && unzip ffmpeg-n7.0-21-gfb8f0ea7b3-win64-gpl-shared-7.0.zip && rm -f ffmpeg-n7.0-21-gfb8f0ea7b3-win64-gpl-shared-7.0.zip' streampanel-linux-amd64: builddir $(eval INSTALL_DEST?=build/streampanel-linux-amd64) diff --git a/cmd/streampanel/context.go b/cmd/streampanel/context.go index facf259..6aaf910 100644 --- a/cmd/streampanel/context.go +++ b/cmd/streampanel/context.go @@ -69,11 +69,18 @@ func getContext( ll := xlogrus.DefaultLogrusLogger() ll.Formatter.(*logrus.TextFormatter).ForceColors = true - l := xlogrus.New(ll).WithLevel(logger.LevelTrace).WithPreHooks( + + logPreHooks := logger.PreHooks{ &observability.LogLevelFilter, - observability.StructFieldSecretsFilter{}, - observability.NewSecretValuesFilter(secretsProvider), - ) + } + if flags.RemoveSecretsFromLogs { + logPreHooks = append(logPreHooks, + observability.StructFieldSecretsFilter{}, + observability.NewSecretValuesFilter(secretsProvider), + ) + } + + l := xlogrus.New(ll).WithLevel(logger.LevelTrace).WithPreHooks(logPreHooks...) if flags.LogFile != "" { logPathUnexpanded := flags.LogFile diff --git a/cmd/streampanel/flag.go b/cmd/streampanel/flag.go index 6dfa5db..0db52a8 100644 --- a/cmd/streampanel/flag.go +++ b/cmd/streampanel/flag.go @@ -26,22 +26,23 @@ func (l *loggerLevel) UnmarshalYAML(b []byte) error { } type Flags struct { - LoggerLevel loggerLevel `yaml:"LoggerLevel,omitempty"` - ListenAddr string `yaml:"ListenAddr,omitempty"` - RemoteAddr string `yaml:"RemoteAddr,omitempty"` - ConfigPath string `yaml:"ConfigPath,omitempty"` - NetPprofAddrMain string `yaml:"NetPprofAddrMain,omitempty"` - NetPprofAddrUI string `yaml:"NetPprofAddrUI,omitempty"` - NetPprofAddrStreamD string `yaml:"NetPprofAddrStreamD,omitempty"` - CPUProfile string `yaml:"CPUProfile,omitempty"` - HeapProfile string `yaml:"HeapProfile,omitempty"` - LogstashAddr string `yaml:"LogstashAddr,omitempty"` - SentryDSN string `yaml:"SentryDSN,omitempty"` - Page string `yaml:"Page,omitempty"` - LogFile string `yaml:"LogFile,omitempty"` - Subprocess string `yaml:"Subprocess,omitempty"` - SplitProcess bool `yaml:"SplitProcess,omitempty"` - LockTimeout time.Duration `yaml:"LockTimeout,omitempty"` + LoggerLevel loggerLevel `yaml:"LoggerLevel,omitempty"` + ListenAddr string `yaml:"ListenAddr,omitempty"` + RemoteAddr string `yaml:"RemoteAddr,omitempty"` + ConfigPath string `yaml:"ConfigPath,omitempty"` + NetPprofAddrMain string `yaml:"NetPprofAddrMain,omitempty"` + NetPprofAddrUI string `yaml:"NetPprofAddrUI,omitempty"` + NetPprofAddrStreamD string `yaml:"NetPprofAddrStreamD,omitempty"` + CPUProfile string `yaml:"CPUProfile,omitempty"` + HeapProfile string `yaml:"HeapProfile,omitempty"` + LogstashAddr string `yaml:"LogstashAddr,omitempty"` + SentryDSN string `yaml:"SentryDSN,omitempty"` + Page string `yaml:"Page,omitempty"` + LogFile string `yaml:"LogFile,omitempty"` + Subprocess string `yaml:"Subprocess,omitempty"` + SplitProcess bool `yaml:"SplitProcess,omitempty"` + LockTimeout time.Duration `yaml:"LockTimeout,omitempty"` + RemoveSecretsFromLogs bool `yaml:"RemoveSecretsFromLogs,omitempty"` OAuthListenPortTwitch uint16 `yaml:"OAuthListenPortTwitch,omitempty"` OAuthListenPortYouTube uint16 `yaml:"OAuthListenPortYouTube,omitempty"` @@ -128,6 +129,11 @@ func parseFlags() Flags { 8092, "the port that is used for OAuth callbacks while authenticating in YouTube", ) + removeSecretsFromLogs := pflag.Bool( + "remove-secrets-from-logs", + false, + "adds a processing hook to the logger which removes secret/sensitive data from logs; for example if you want to stream how you work with this application or if you want to share the logs somewhere publicly, you may want to be extra careful and enable this flag just in case (it does not provide a guarantee, but good as an additional safeguard)", + ) pflag.Parse() @@ -151,6 +157,8 @@ func parseFlags() Flags { OAuthListenPortTwitch: *oauthListenPortTwitch, OAuthListenPortYouTube: *oauthListenPortYouTube, + + RemoveSecretsFromLogs: *removeSecretsFromLogs, } for _, platformGetFlagsFunc := range platformGetFlagsFuncs { diff --git a/pkg/streamplayer/stream_player.go b/pkg/streamplayer/stream_player.go index 14187f8..13160da 100644 --- a/pkg/streamplayer/stream_player.go +++ b/pkg/streamplayer/stream_player.go @@ -219,6 +219,10 @@ func (p *StreamPlayerHandler) stopU(ctx context.Context) error { logger.Debugf(ctx, "StreamPlayers.stopU(ctx): '%s'", p.StreamID) defer logger.Debugf(ctx, "/StreamPlayers.stopU(ctx): '%s'", p.StreamID) + if p.Player == nil { + return fmt.Errorf("p.Player == nil") + } + err := p.Player.Close(ctx) if err != nil { errmon.ObserveErrorCtx(ctx, p.Close()) diff --git a/pkg/windowmanagerhandler/window_manager_handler_other.go b/pkg/windowmanagerhandler/window_manager_handler_other.go index 62cda70..9e468ca 100644 --- a/pkg/windowmanagerhandler/window_manager_handler_other.go +++ b/pkg/windowmanagerhandler/window_manager_handler_other.go @@ -5,18 +5,21 @@ package windowmanagerhandler import ( "context" - "fmt" ) type PlatformSpecificWindowManagerHandler struct{} -type WindowID struct{} -type PID struct{} -type UID struct{} +type WindowID uint64 +type PID uint64 +type UID uint64 -func (wmh *WindowManagerHandler) init(context.Context) error { - return fmt.Errorf("the support of window manager handler for this platform is not implemented, yet") +func (wmh *WindowManagerHandler) init() error { + return nil //fmt.Errorf("the support of window manager handler for this platform is not implemented, yet") } func (PlatformSpecificWindowManagerHandler) Close() error { return nil } + +func (PlatformSpecificWindowManagerHandler) WindowFocusChangeChan(ctx context.Context) <-chan WindowFocusChange { + return nil +}