Added permission checking of profiles, added border option for xpra, pulseaudio option removed (automatically detected from audio mode)

master
xSmurf 9 years ago
parent 21016ca49a
commit feb35544c8

@ -62,9 +62,9 @@ type XServerConf struct {
WindowIcon string `json:"window_icon"` WindowIcon string `json:"window_icon"`
EnableTray bool `json:"enable_tray"` EnableTray bool `json:"enable_tray"`
EnableNotifications bool `json:"enable_notifications"` EnableNotifications bool `json:"enable_notifications"`
UsePulseaudio bool `json:"use_pulseaudio"`
DisableClipboard bool `json:"disable_clipboard"` DisableClipboard bool `json:"disable_clipboard"`
AudioMode AudioMode `json:"audio_mode"` AudioMode AudioMode `json:"audio_mode"`
Border bool `json:"border"`
} }
type SeccompMode string type SeccompMode string
@ -124,8 +124,8 @@ func NewDefaultProfile() *Profile {
Enabled: true, Enabled: true,
EnableTray: false, EnableTray: false,
EnableNotifications: false, EnableNotifications: false,
UsePulseaudio: false,
AudioMode: PROFILE_AUDIO_NONE, AudioMode: PROFILE_AUDIO_NONE,
Border: false,
}, },
} }
} }
@ -193,6 +193,10 @@ func LoadProfiles(dir string) (Profiles, error) {
} }
func loadProfileFile(file string) (*Profile, error) { func loadProfileFile(file string) (*Profile, error) {
if err := checkConfigPermissions(file); err != nil {
return nil, err
}
bs, err := ioutil.ReadFile(file) bs, err := ioutil.ReadFile(file)
if err != nil { if err != nil {
return nil, err return nil, err

@ -1,12 +1,16 @@
package xpra package xpra
import ( import (
"crypto/md5"
"fmt" "fmt"
"github.com/op/go-logging" "io"
"github.com/subgraph/oz"
"os" "os"
"os/exec" "os/exec"
"syscall" "syscall"
"github.com/subgraph/oz"
"github.com/op/go-logging"
) )
var xpraClientDefaultArgs = []string{ var xpraClientDefaultArgs = []string{
@ -40,13 +44,20 @@ func prepareClientArgs(config *oz.XServerConf, display uint64, workdir string, l
args = append(args, xpraClientDefaultArgs...) args = append(args, xpraClientDefaultArgs...)
if !config.EnableTray { if !config.EnableTray {
args = append(args, "--no-tray") args = append(args, "--no-tray")
} } else {
if exists(config.TrayIcon, "Tray icon", log) { args = append(args, "--tray")
args = append(args, fmt.Sprintf("--tray-icon=%s", config.TrayIcon)) if exists(config.TrayIcon, "Tray icon", log) {
args = append(args, fmt.Sprintf("--tray-icon=%s", config.TrayIcon))
}
} }
if exists(config.WindowIcon, "Window icon", log) { if exists(config.WindowIcon, "Window icon", log) {
args = append(args, fmt.Sprintf("--window-icon=%s", config.WindowIcon)) args = append(args, fmt.Sprintf("--window-icon=%s", config.WindowIcon))
} }
if config.Border {
h := md5.New()
io.WriteString(h, workdir)
args = append(args, "--border=#" + fmt.Sprintf("%x", h.Sum(nil)[0:3]))
}
args = append(args, args = append(args,
fmt.Sprintf("--socket-dir=%s", workdir), fmt.Sprintf("--socket-dir=%s", workdir),
"attach", "attach",

@ -35,7 +35,7 @@ func prepareServerArgs(config *oz.XServerConf, display uint64, workdir string) [
"start", "start",
fmt.Sprintf(":%d", display), fmt.Sprintf(":%d", display),
) )
if config.UsePulseaudio { if config.AudioMode == oz.PROFILE_AUDIO_FULL || config.AudioMode == oz.PROFILE_AUDIO_SPEAKER {
args = append(args, "--pulseaudio") args = append(args, "--pulseaudio")
} else { } else {
args = append(args, "--no-pulseaudio") args = append(args, "--no-pulseaudio")

Loading…
Cancel
Save