Add file upload functionality to the agent. Implement API endpoint for uploading files, including validation and error handling. Update web interface to support file selection and display upload status. Enhance input handling with configurable key delay for text input.
This commit is contained in:
+11
-9
@@ -2,8 +2,6 @@ package startup
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"golang.org/x/sys/windows/registry"
|
||||
|
||||
@@ -21,7 +19,7 @@ func Enabled() bool {
|
||||
}
|
||||
|
||||
func Enable() error {
|
||||
command, err := commandLine()
|
||||
command, err := installedCommandLine()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -33,6 +31,14 @@ func Enable() error {
|
||||
return k.SetStringValue(config.StartupValueName, command)
|
||||
}
|
||||
|
||||
// SyncInstalledPath rewrites an existing Run entry to the AppData install path.
|
||||
func SyncInstalledPath() error {
|
||||
if !Enabled() {
|
||||
return nil
|
||||
}
|
||||
return Enable()
|
||||
}
|
||||
|
||||
func Disable() error {
|
||||
k, err := registry.OpenKey(registry.CURRENT_USER, config.StartupRunKey, registry.SET_VALUE)
|
||||
if err != nil {
|
||||
@@ -49,12 +55,8 @@ func Disable() error {
|
||||
return err
|
||||
}
|
||||
|
||||
func commandLine() (string, error) {
|
||||
exe, err := os.Executable()
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
exe, err = filepath.Abs(exe)
|
||||
func installedCommandLine() (string, error) {
|
||||
exe, err := config.InstalledExe()
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user