Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
ollama
Commits
0fec3525
Commit
0fec3525
authored
May 11, 2024
by
Michael Yang
Browse files
use post token
parent
41ba3017
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
4 deletions
+4
-4
app/lifecycle/updater.go
app/lifecycle/updater.go
+2
-2
server/auth.go
server/auth.go
+2
-2
No files found.
app/lifecycle/updater.go
View file @
0fec3525
...
@@ -56,13 +56,13 @@ func IsNewReleaseAvailable(ctx context.Context) (bool, UpdateResponse) {
...
@@ -56,13 +56,13 @@ func IsNewReleaseAvailable(ctx context.Context) (bool, UpdateResponse) {
query
.
Add
(
"nonce"
,
nonce
)
query
.
Add
(
"nonce"
,
nonce
)
requestURL
.
RawQuery
=
query
.
Encode
()
requestURL
.
RawQuery
=
query
.
Encode
()
data
:=
[]
byte
(
fmt
.
Sprintf
(
"%s,%s"
,
http
.
Method
Ge
t
,
requestURL
.
RequestURI
()))
data
:=
[]
byte
(
fmt
.
Sprintf
(
"%s,%s"
,
http
.
Method
Pos
t
,
requestURL
.
RequestURI
()))
signature
,
err
:=
auth
.
Sign
(
ctx
,
data
)
signature
,
err
:=
auth
.
Sign
(
ctx
,
data
)
if
err
!=
nil
{
if
err
!=
nil
{
return
false
,
updateResp
return
false
,
updateResp
}
}
req
,
err
:=
http
.
NewRequestWithContext
(
ctx
,
http
.
Method
Ge
t
,
requestURL
.
String
(),
nil
)
req
,
err
:=
http
.
NewRequestWithContext
(
ctx
,
http
.
Method
Pos
t
,
requestURL
.
String
(),
nil
)
if
err
!=
nil
{
if
err
!=
nil
{
slog
.
Warn
(
fmt
.
Sprintf
(
"failed to check for update: %s"
,
err
))
slog
.
Warn
(
fmt
.
Sprintf
(
"failed to check for update: %s"
,
err
))
return
false
,
updateResp
return
false
,
updateResp
...
...
server/auth.go
View file @
0fec3525
...
@@ -57,7 +57,7 @@ func getAuthorizationToken(ctx context.Context, challenge registryChallenge) (st
...
@@ -57,7 +57,7 @@ func getAuthorizationToken(ctx context.Context, challenge registryChallenge) (st
}
}
sha256sum
:=
sha256
.
Sum256
(
nil
)
sha256sum
:=
sha256
.
Sum256
(
nil
)
data
:=
[]
byte
(
fmt
.
Sprintf
(
"%s,%s,%s"
,
http
.
Method
Ge
t
,
redirectURL
.
String
(),
base64
.
StdEncoding
.
EncodeToString
([]
byte
(
hex
.
EncodeToString
(
sha256sum
[
:
])))))
data
:=
[]
byte
(
fmt
.
Sprintf
(
"%s,%s,%s"
,
http
.
Method
Pos
t
,
redirectURL
.
String
(),
base64
.
StdEncoding
.
EncodeToString
([]
byte
(
hex
.
EncodeToString
(
sha256sum
[
:
])))))
headers
:=
make
(
http
.
Header
)
headers
:=
make
(
http
.
Header
)
signature
,
err
:=
auth
.
Sign
(
ctx
,
data
)
signature
,
err
:=
auth
.
Sign
(
ctx
,
data
)
...
@@ -67,7 +67,7 @@ func getAuthorizationToken(ctx context.Context, challenge registryChallenge) (st
...
@@ -67,7 +67,7 @@ func getAuthorizationToken(ctx context.Context, challenge registryChallenge) (st
headers
.
Add
(
"Authorization"
,
signature
)
headers
.
Add
(
"Authorization"
,
signature
)
response
,
err
:=
makeRequest
(
ctx
,
http
.
Method
Ge
t
,
redirectURL
,
headers
,
nil
,
nil
)
response
,
err
:=
makeRequest
(
ctx
,
http
.
Method
Pos
t
,
redirectURL
,
headers
,
nil
,
nil
)
if
err
!=
nil
{
if
err
!=
nil
{
return
""
,
err
return
""
,
err
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment