updated file browser url logic
All checks were successful
Build and Push Docker Image / Build image (push) Successful in 1m40s

This commit is contained in:
2025-05-27 13:20:37 +03:00
parent 8e2806deb2
commit 1be267e0ff
4 changed files with 35 additions and 1 deletions

View File

@@ -8,6 +8,8 @@ import (
"strings"
"time"
gerrors "errors"
"git.acooldomain.co/server-manager/backend/instancemanager"
"git.acooldomain.co/server-manager/backend/models"
servermanagerv1 "git.acooldomain.co/server-manager/kubernetes-operator/api/v1alpha1"
@@ -355,6 +357,14 @@ func (i *InstanceManager) StopFileBrowser(ctx context.Context, serverId string)
return nil
}
func (im *InstanceManager) GetServerIdFromFileBrowserUrl(ctx context.Context, url string) (string, error) {
pathSegments := strings.Split(url, "/")
if len(pathSegments) < 4 {
return "", gerrors.New("invalid url")
}
return pathSegments[3], nil
}
func NewInstanceManager(config models.KubernetesInstanceManagerConfig) (*InstanceManager, error) {
c, err := rest.InClusterConfig()
if err != nil {