chore: auto download external UI when 'external-ui' is set and not empty

This commit is contained in:
Larvan2
2024-08-13 14:19:34 +08:00
parent 5bf22422d9
commit 50d0cd363c
5 changed files with 23 additions and 10 deletions

View File

@@ -230,7 +230,7 @@ func clean() {
// MaxPackageFileSize is a maximum package file length in bytes. The largest
// package whose size is limited by this constant currently has the size of
// approximately 9 MiB.
// approximately 32 MiB.
const MaxPackageFileSize = 32 * 1024 * 1024
// Download package file and save it to disk

View File

@@ -29,11 +29,6 @@ func UpdateUI() error {
xdMutex.Lock()
defer xdMutex.Unlock()
err := prepare_ui()
if err != nil {
return err
}
data, err := downloadForBytes(ExternalUIURL)
if err != nil {
return fmt.Errorf("can't download file: %w", err)
@@ -64,7 +59,7 @@ func UpdateUI() error {
return nil
}
func prepare_ui() error {
func PrepareUIPath() error {
if ExternalUIPath == "" || ExternalUIURL == "" {
return ErrIncompleteConf
}
@@ -79,7 +74,6 @@ func prepare_ui() error {
} else {
ExternalUIFolder = ExternalUIPath
}
return nil
}