go-gitea / gitea

Git with a cup of tea! Painless self-hosted all-in-one software development service, including Git hosting, code review, team collaboration, package registry and CI/CD
https://gitea.com
MIT License
43.82k stars 5.38k forks source link

Allow customizing messages in `cmd/serv.go` #28517

Closed sepsol closed 8 months ago

sepsol commented 8 months ago

Feature Description

Allow customizing responses sent to clients from cmd/serv.go, especially messages from this switch block:

func runServ(c *cli.Context) error {
    // ...
    switch key.Type {
    case asymkey_model.KeyTypeDeploy:
        println("Hi there! You've successfully authenticated with the deploy key named " + key.Name + ", but Gitea does not provide shell access.")
    case asymkey_model.KeyTypePrincipal:
        println("Hi there! You've successfully authenticated with the principal " + key.Content + ", but Gitea does not provide shell access.")
    default:
        println("Hi there, " + user.Name + "! You've successfully authenticated with the key named " + key.Name + ", but Gitea does not provide shell access.")
    }
    // ...
}

This would be useful for both localization as well as adding custom branding.

Screenshots

$ ssh -T git@GIT_SERVER
Hi there, USER_NAME! You've successfully authenticated with the key named KEY_NAME, but Gitea does not provide shell access.
If this is unexpected, please log in with password and setup Gitea under another user.
lunny commented 8 months ago

It's a small change. Maybe you can hold them in your fork. I don't think it's necessary to have a configuration for that.

sepsol commented 8 months ago

I would argue that It'd still be useful for rebranding a custom Gitea instance. It'd be great if it took APP_NAME from the custom/conf/app.ini or something like that.

wxiaoguang commented 8 months ago

If you would like to rebrand, you would need to change a lot, but not only these strings. Theoretically you have to maintain your own changes.

APP_NAME is for the whole instance's name, it isn't for rebranding.