chore: qol update
This commit is contained in:
9
install.sh
Normal file
9
install.sh
Normal file
@@ -0,0 +1,9 @@
|
||||
#!/bin/bash
|
||||
|
||||
runtime_id=$(id -u)
|
||||
if [[ "$runtime_id" -ne 0 ]]; then
|
||||
echo "Not running as root, please run as root."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
apt-get -y install vlc libreoffice-impress
|
||||
15
service-files/presentation.service
Normal file
15
service-files/presentation.service
Normal file
@@ -0,0 +1,15 @@
|
||||
[Unit]
|
||||
Description="Systemec Akarton Raspberry Pi Uploader Program (SARPUS) "
|
||||
After=graphical.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
Environment=DISPLAY=:0
|
||||
ExecStartPre=/usr/bin/sleep 5
|
||||
ExecStart=/usr/bin/libreoffice --impress --show /home/systemec/Downloads/test_pres.pptx --norestore
|
||||
ExecStop=/usr/bin/killall libreoffice
|
||||
Restart=on-failure
|
||||
RestartSec=2
|
||||
|
||||
[Install]
|
||||
WantedBy=default.target
|
||||
@@ -8,19 +8,19 @@ import (
|
||||
"golang.org/x/crypto/ssh"
|
||||
)
|
||||
|
||||
func translateRaspiName(targetName string) (string, string) {
|
||||
func translateRaspiName(targetName string) (string, string, string, string) {
|
||||
for _, raspiObj := range raspiList {
|
||||
if raspiObj[0] == targetName {
|
||||
// Found!
|
||||
return raspiObj[1], raspiObj[2]
|
||||
return raspiObj[1], raspiObj[2], raspiObj[3], raspiObj[4]
|
||||
}
|
||||
}
|
||||
|
||||
return "", ""
|
||||
return "", "", "", ""
|
||||
}
|
||||
|
||||
func verifyCred(username, password, targetName string) bool {
|
||||
hostname, port := translateRaspiName(targetName)
|
||||
func verifyCred(targetName string) bool {
|
||||
hostname, port, username, password := translateRaspiName(targetName)
|
||||
log.Println("Connecting to:", hostname, port)
|
||||
|
||||
config := &ssh.ClientConfig{
|
||||
|
||||
38
src/draw.go
38
src/draw.go
@@ -30,6 +30,10 @@ func flashRed(btnPtr *widget.Button) {
|
||||
}, false)
|
||||
}
|
||||
|
||||
func drawVerifyProcess() {
|
||||
|
||||
}
|
||||
|
||||
func drawSeparator(trailNewLine bool) *fyne.Container {
|
||||
emptyLabel := widget.NewLabel("") // Give it some space at the bottom with an empty line
|
||||
separatorLine := canvas.NewLine(color.Gray{Y: 128})
|
||||
@@ -113,47 +117,19 @@ func drawTargetSection(raspiNames []string, raspiTarget *string) *fyne.Container
|
||||
refreshButtons(verifyBtn)
|
||||
})
|
||||
|
||||
// Right side authentication
|
||||
userLabel := widget.NewLabel("Username")
|
||||
passLabel := widget.NewLabel("Password")
|
||||
|
||||
userEntry := widget.NewEntry()
|
||||
userEntry.SetPlaceHolder("<your-username>")
|
||||
|
||||
passEntry := widget.NewPasswordEntry()
|
||||
passEntry.SetPlaceHolder("<your-password>")
|
||||
|
||||
expander := canvas.NewRectangle(color.Transparent)
|
||||
expander.SetMinSize(fyne.NewSize(150, 0))
|
||||
targetAuth := container.NewVBox(
|
||||
container.NewGridWithColumns(2, userLabel, expander),
|
||||
userEntry,
|
||||
container.NewGridWithColumns(2, passLabel, expander),
|
||||
passEntry,
|
||||
)
|
||||
|
||||
divider := canvas.NewRectangle(color.Transparent)
|
||||
divider.SetMinSize(fyne.NewSize(250, 0))
|
||||
|
||||
selecCol := container.NewVBox(
|
||||
actionText,
|
||||
piSelection,
|
||||
)
|
||||
|
||||
targetRow := container.NewHBox(
|
||||
selecCol,
|
||||
divider,
|
||||
targetAuth,
|
||||
)
|
||||
|
||||
var credOK bool
|
||||
verifyBtn = widget.NewButton("Verify Credentials", func() {
|
||||
verifyBtn = widget.NewButton("Check Connection", func() {
|
||||
verifyBtn.Importance = widget.HighImportance
|
||||
refreshButtons(verifyBtn)
|
||||
|
||||
log.Println("Verifying credentials...")
|
||||
go func() {
|
||||
credOK = verifyCred(userEntry.Text, passEntry.Text, *raspiTarget)
|
||||
credOK = verifyCred(*raspiTarget)
|
||||
|
||||
if credOK {
|
||||
// Must update UI on main thread
|
||||
@@ -172,7 +148,7 @@ func drawTargetSection(raspiNames []string, raspiTarget *string) *fyne.Container
|
||||
)
|
||||
|
||||
wholeCol := container.NewVBox(
|
||||
targetRow,
|
||||
selecCol,
|
||||
widget.NewLabel(""),
|
||||
verifyWide,
|
||||
)
|
||||
|
||||
@@ -5,10 +5,11 @@ var (
|
||||
// 0 Raspberry Pi Name
|
||||
// 1 Raspberry Pi IP-Adress
|
||||
// 2 Raspberry Pi SSH-port
|
||||
// 3 Raspberry Pi SSH Username
|
||||
// 4 Raspberry Pi SSH Password
|
||||
raspiList [][]string = [][]string{
|
||||
{"Kantine Pi", "172.16.64.228", "22"},
|
||||
{"Productie Pi", "172.16.64.229", "22"},
|
||||
{"Sales Pi", "", ""},
|
||||
{"MyTempHost", "192.168.178.20", "22"},
|
||||
{"Kantine Pi", "172.16.64.228", "22", "systemec", ""},
|
||||
{"Productie Pi", "172.16.64.229", "22", "", ""},
|
||||
{"Sales Pi", "", "", "", ""},
|
||||
}
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user