forked from go-gitea/gitea
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'giteaofficial/main'
* giteaofficial/main: (28 commits) Improve TrHTML and add more tests (go-gitea#29228) Convert visibility to number (go-gitea#29226) Implement some action notifier functions (go-gitea#29173) Artifact deletion in actions ui (go-gitea#27172) Update docs for actions variables (go-gitea#29239) Refactor more code in templates (go-gitea#29236) Use "Safe" modifier for manually constructed safe HTML strings in templates (go-gitea#29227) Remove jQuery from the repo release form (go-gitea#29225) Make submit event code work with both jQuery event and native event (go-gitea#29223) Remove jQuery from repo migrate page (go-gitea#29219) Remove unneccesary `initUserAuthLinkAccountView` from "link account" page (go-gitea#29217) Fix labels referencing the wrong ID in the user profile settings (go-gitea#29199) Fix label `for` pointing to a `name` instead of `id` in webhook settings (go-gitea#29209) Load outdated comments when (un)resolving conversation on PR timeline (go-gitea#29203) Fix missing template for follow button in organization (go-gitea#29215) Enable markdownlint `no-trailing-punctuation` and `no-blanks-blockquote` (go-gitea#29214) Remove jQuery from the webhook editor (go-gitea#29211) Remove jQuery from issue reference context popup attach (go-gitea#29216) fix typo (go-gitea#29212) Fix debian InRelease Acquire-By-Hash newline (go-gitea#29204) ...
- Loading branch information
Showing
86 changed files
with
1,646 additions
and
317 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// Copyright 2024 The Gitea Authors. All rights reserved. | ||
// SPDX-License-Identifier: MIT | ||
|
||
package generate | ||
|
||
import ( | ||
"encoding/base64" | ||
"strings" | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestDecodeJwtSecretBase64(t *testing.T) { | ||
_, err := DecodeJwtSecretBase64("abcd") | ||
assert.ErrorContains(t, err, "invalid base64 decoded length") | ||
_, err = DecodeJwtSecretBase64(strings.Repeat("a", 64)) | ||
assert.ErrorContains(t, err, "invalid base64 decoded length") | ||
|
||
str32 := strings.Repeat("x", 32) | ||
encoded32 := base64.RawURLEncoding.EncodeToString([]byte(str32)) | ||
decoded32, err := DecodeJwtSecretBase64(encoded32) | ||
assert.NoError(t, err) | ||
assert.Equal(t, str32, string(decoded32)) | ||
} | ||
|
||
func TestNewJwtSecretWithBase64(t *testing.T) { | ||
secret, encoded, err := NewJwtSecretWithBase64() | ||
assert.NoError(t, err) | ||
assert.Len(t, secret, 32) | ||
decoded, err := DecodeJwtSecretBase64(encoded) | ||
assert.NoError(t, err) | ||
assert.Equal(t, secret, decoded) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.