|
6 | 6 | "github.com/chromedp/chromedp" |
7 | 7 | "github.com/luispater/anyAIProxyAPI/internal/browser/chrome" |
8 | 8 | "github.com/luispater/anyAIProxyAPI/internal/config" |
| 9 | + "github.com/luispater/anyAIProxyAPI/internal/html" |
9 | 10 | "github.com/luispater/anyAIProxyAPI/internal/runner" |
10 | 11 | log "github.com/sirupsen/logrus" |
11 | 12 | "github.com/tidwall/gjson" |
@@ -508,31 +509,9 @@ func (h *APIHandlers) AuthDownload(c *gin.Context) { |
508 | 509 |
|
509 | 510 | // AuthUploadPage handles the GET /v1/auth/upload endpoint to serve the upload page |
510 | 511 | func (h *APIHandlers) AuthUploadPage(c *gin.Context) { |
511 | | - // Try to find the HTML file in different possible locations |
512 | | - possiblePaths := []string{ |
513 | | - filepath.Join("internal", "html", "auth_upload.html"), |
514 | | - filepath.Join("..", "internal", "html", "auth_upload.html"), |
515 | | - "auth_upload.html", // fallback for tests |
516 | | - } |
517 | | - |
518 | | - var htmlContent []byte |
519 | | - var err error |
520 | | - |
521 | | - for _, htmlPath := range possiblePaths { |
522 | | - htmlContent, err = os.ReadFile(htmlPath) |
523 | | - if err == nil { |
524 | | - break |
525 | | - } |
526 | | - } |
527 | | - |
528 | | - if err != nil { |
529 | | - c.JSON(http.StatusInternalServerError, gin.H{"error": fmt.Sprintf("Failed to load upload page: %v", err), "code": 500}) |
530 | | - return |
531 | | - } |
532 | | - |
533 | 512 | // Serve the HTML content |
534 | 513 | c.Header("Content-Type", "text/html; charset=utf-8") |
535 | | - c.String(http.StatusOK, string(htmlContent)) |
| 514 | + c.String(http.StatusOK, string(html.AuthUploadHTML)) |
536 | 515 | } |
537 | 516 |
|
538 | 517 | // AuthInstances handles the GET /v1/auth/instances endpoint to return available instances |
|
0 commit comments