mirror of
https://github.com/gogs/gogs.git
synced 2026-05-06 06:45:40 +02:00
mod: bump modernc.org/sqlite from 1.36.0 to 1.37.0 (#7947)
Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Joe Chen <jc@unknwon.io>
This commit is contained in:
@@ -29,7 +29,7 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
_TPL_PUBLICK_KEY = `command="%s serv key-%d --config='%s'",no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty %s` + "\n"
|
||||
tplPublicKey = `command="%s serv key-%d --config='%s'",no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty %s` + "\n"
|
||||
)
|
||||
|
||||
var sshOpLocker sync.Mutex
|
||||
@@ -37,8 +37,8 @@ var sshOpLocker sync.Mutex
|
||||
type KeyType int
|
||||
|
||||
const (
|
||||
KEY_TYPE_USER = iota + 1
|
||||
KEY_TYPE_DEPLOY
|
||||
KeyTypeUser = iota + 1
|
||||
KeyTypeDeploy
|
||||
)
|
||||
|
||||
// PublicKey represents a user or deploy SSH public key.
|
||||
@@ -85,12 +85,12 @@ func (k *PublicKey) OmitEmail() string {
|
||||
|
||||
// AuthorizedString returns formatted public key string for authorized_keys file.
|
||||
func (k *PublicKey) AuthorizedString() string {
|
||||
return fmt.Sprintf(_TPL_PUBLICK_KEY, conf.AppPath(), k.ID, conf.CustomConf, k.Content)
|
||||
return fmt.Sprintf(tplPublicKey, conf.AppPath(), k.ID, conf.CustomConf, k.Content)
|
||||
}
|
||||
|
||||
// IsDeployKey returns true if the public key is used as deploy key.
|
||||
func (k *PublicKey) IsDeployKey() bool {
|
||||
return k.Type == KEY_TYPE_DEPLOY
|
||||
return k.Type == KeyTypeDeploy
|
||||
}
|
||||
|
||||
func extractTypeFromBase64Key(key string) (string, error) {
|
||||
@@ -362,7 +362,7 @@ func appendAuthorizedKeysToFile(keys ...*PublicKey) error {
|
||||
func checkKeyContent(content string) error {
|
||||
has, err := x.Get(&PublicKey{
|
||||
Content: content,
|
||||
Type: KEY_TYPE_USER,
|
||||
Type: KeyTypeUser,
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -402,7 +402,7 @@ func addKey(e Engine, key *PublicKey) (err error) {
|
||||
|
||||
// AddPublicKey adds new public key to database and authorized_keys file.
|
||||
func AddPublicKey(ownerID int64, name, content string) (*PublicKey, error) {
|
||||
log.Trace(content)
|
||||
log.Trace("Add public key: %s", content)
|
||||
if err := checkKeyContent(content); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -426,7 +426,7 @@ func AddPublicKey(ownerID int64, name, content string) (*PublicKey, error) {
|
||||
Name: name,
|
||||
Content: content,
|
||||
Mode: AccessModeWrite,
|
||||
Type: KEY_TYPE_USER,
|
||||
Type: KeyTypeUser,
|
||||
}
|
||||
if err = addKey(sess, key); err != nil {
|
||||
return nil, fmt.Errorf("addKey: %v", err)
|
||||
@@ -659,7 +659,7 @@ func AddDeployKey(repoID int64, name, content string) (*DeployKey, error) {
|
||||
pkey := &PublicKey{
|
||||
Content: content,
|
||||
Mode: AccessModeRead,
|
||||
Type: KEY_TYPE_DEPLOY,
|
||||
Type: KeyTypeDeploy,
|
||||
}
|
||||
has, err := x.Get(pkey)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user