|
@@ -24,8 +24,6 @@ import (
|
|
|
"net"
|
|
|
"net/http"
|
|
|
"net/url"
|
|
|
- "os"
|
|
|
- "path/filepath"
|
|
|
"runtime"
|
|
|
"strings"
|
|
|
"time"
|
|
@@ -393,17 +391,6 @@ func (c *Client) Version(ctx context.Context) (string, error) {
|
|
|
func Authorization(ctx context.Context, request *http.Request) (string, error) {
|
|
|
data := []byte(fmt.Sprintf("%s,%s,%d", request.Method, request.URL.RequestURI(), time.Now().Unix()))
|
|
|
|
|
|
- home, err := os.UserHomeDir()
|
|
|
- if err != nil {
|
|
|
- return "", err
|
|
|
- }
|
|
|
-
|
|
|
- knownHostsFile, err := os.OpenFile(filepath.Join(home, ".ollama", "known_hosts"), os.O_CREATE|os.O_RDWR|os.O_APPEND, 0600)
|
|
|
- if err != nil {
|
|
|
- return "", err
|
|
|
- }
|
|
|
- defer knownHostsFile.Close()
|
|
|
-
|
|
|
token, err := auth.Sign(ctx, data)
|
|
|
if err != nil {
|
|
|
return "", err
|