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"
|
"golang.org/x/crypto/ssh"
|
||||||
)
|
)
|
||||||
|
|
||||||
func translateRaspiName(targetName string) (string, string) {
|
func translateRaspiName(targetName string) (string, string, string, string) {
|
||||||
for _, raspiObj := range raspiList {
|
for _, raspiObj := range raspiList {
|
||||||
if raspiObj[0] == targetName {
|
if raspiObj[0] == targetName {
|
||||||
// Found!
|
// Found!
|
||||||
return raspiObj[1], raspiObj[2]
|
return raspiObj[1], raspiObj[2], raspiObj[3], raspiObj[4]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return "", ""
|
return "", "", "", ""
|
||||||
}
|
}
|
||||||
|
|
||||||
func verifyCred(username, password, targetName string) bool {
|
func verifyCred(targetName string) bool {
|
||||||
hostname, port := translateRaspiName(targetName)
|
hostname, port, username, password := translateRaspiName(targetName)
|
||||||
log.Println("Connecting to:", hostname, port)
|
log.Println("Connecting to:", hostname, port)
|
||||||
|
|
||||||
config := &ssh.ClientConfig{
|
config := &ssh.ClientConfig{
|
||||||
|
|||||||
38
src/draw.go
38
src/draw.go
@@ -30,6 +30,10 @@ func flashRed(btnPtr *widget.Button) {
|
|||||||
}, false)
|
}, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func drawVerifyProcess() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
func drawSeparator(trailNewLine bool) *fyne.Container {
|
func drawSeparator(trailNewLine bool) *fyne.Container {
|
||||||
emptyLabel := widget.NewLabel("") // Give it some space at the bottom with an empty line
|
emptyLabel := widget.NewLabel("") // Give it some space at the bottom with an empty line
|
||||||
separatorLine := canvas.NewLine(color.Gray{Y: 128})
|
separatorLine := canvas.NewLine(color.Gray{Y: 128})
|
||||||
@@ -113,47 +117,19 @@ func drawTargetSection(raspiNames []string, raspiTarget *string) *fyne.Container
|
|||||||
refreshButtons(verifyBtn)
|
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(
|
selecCol := container.NewVBox(
|
||||||
actionText,
|
actionText,
|
||||||
piSelection,
|
piSelection,
|
||||||
)
|
)
|
||||||
|
|
||||||
targetRow := container.NewHBox(
|
|
||||||
selecCol,
|
|
||||||
divider,
|
|
||||||
targetAuth,
|
|
||||||
)
|
|
||||||
|
|
||||||
var credOK bool
|
var credOK bool
|
||||||
verifyBtn = widget.NewButton("Verify Credentials", func() {
|
verifyBtn = widget.NewButton("Check Connection", func() {
|
||||||
verifyBtn.Importance = widget.HighImportance
|
verifyBtn.Importance = widget.HighImportance
|
||||||
refreshButtons(verifyBtn)
|
refreshButtons(verifyBtn)
|
||||||
|
|
||||||
log.Println("Verifying credentials...")
|
log.Println("Verifying credentials...")
|
||||||
go func() {
|
go func() {
|
||||||
credOK = verifyCred(userEntry.Text, passEntry.Text, *raspiTarget)
|
credOK = verifyCred(*raspiTarget)
|
||||||
|
|
||||||
if credOK {
|
if credOK {
|
||||||
// Must update UI on main thread
|
// Must update UI on main thread
|
||||||
@@ -172,7 +148,7 @@ func drawTargetSection(raspiNames []string, raspiTarget *string) *fyne.Container
|
|||||||
)
|
)
|
||||||
|
|
||||||
wholeCol := container.NewVBox(
|
wholeCol := container.NewVBox(
|
||||||
targetRow,
|
selecCol,
|
||||||
widget.NewLabel(""),
|
widget.NewLabel(""),
|
||||||
verifyWide,
|
verifyWide,
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -5,10 +5,11 @@ var (
|
|||||||
// 0 Raspberry Pi Name
|
// 0 Raspberry Pi Name
|
||||||
// 1 Raspberry Pi IP-Adress
|
// 1 Raspberry Pi IP-Adress
|
||||||
// 2 Raspberry Pi SSH-port
|
// 2 Raspberry Pi SSH-port
|
||||||
|
// 3 Raspberry Pi SSH Username
|
||||||
|
// 4 Raspberry Pi SSH Password
|
||||||
raspiList [][]string = [][]string{
|
raspiList [][]string = [][]string{
|
||||||
{"Kantine Pi", "172.16.64.228", "22"},
|
{"Kantine Pi", "172.16.64.228", "22", "systemec", ""},
|
||||||
{"Productie Pi", "172.16.64.229", "22"},
|
{"Productie Pi", "172.16.64.229", "22", "", ""},
|
||||||
{"Sales Pi", "", ""},
|
{"Sales Pi", "", "", "", ""},
|
||||||
{"MyTempHost", "192.168.178.20", "22"},
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user