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

master
xSmurf 10 years ago
parent 21016ca49a
commit feb35544c8

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

@ -1,12 +1,16 @@
package xpra
import (
"crypto/md5"
"fmt"
"github.com/op/go-logging"
"github.com/subgraph/oz"
"io"
"os"
"os/exec"
"syscall"
"github.com/subgraph/oz"
"github.com/op/go-logging"
)
var xpraClientDefaultArgs = []string{
@ -40,13 +44,20 @@ func prepareClientArgs(config *oz.XServerConf, display uint64, workdir string, l
args = append(args, xpraClientDefaultArgs...)
if !config.EnableTray {
args = append(args, "--no-tray")
}
if exists(config.TrayIcon, "Tray icon", log) {
args = append(args, fmt.Sprintf("--tray-icon=%s", config.TrayIcon))
} else {
args = append(args, "--tray")
if exists(config.TrayIcon, "Tray icon", log) {
args = append(args, fmt.Sprintf("--tray-icon=%s", config.TrayIcon))
}
}
if exists(config.WindowIcon, "Window icon", log) {
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,
fmt.Sprintf("--socket-dir=%s", workdir),
"attach",

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

Loading…
Cancel
Save