BREAKING CHANGE: The original Go module name was `github.com/ArtalkJS/Artalk`, which has now been modified to `github.com/artalkjs/artalk/v2` (all lowercase). This change may affect the CI pipeline or other areas if you are compiling the Artalk server and have specified the fixed Go module name. Regarding the original `-ldflags -X github.com/ArtalkJS/Artalk/internal/config.Version` and `CommitHash` definitions, please remove them, as they are now obsolete. The `Version` has been hardcoded into the Go code, and the `CommitHash` is now read from the Go build info via runtime/debug’s vcs.revision value. This change only affects the server developers and does not impact the frontend UI client.
20 lines
481 B
Go
20 lines
481 B
Go
package config
|
|
|
|
import (
|
|
"strings"
|
|
|
|
"github.com/artalkjs/artalk/v2/internal/utils"
|
|
)
|
|
|
|
// Get the hash function according to the frontend gravatar.params configuration
|
|
func GetHashFuncByFrontendConf(conf *Config) func(string) string {
|
|
if gravatar, ok := conf.Frontend["gravatar"].(map[string]interface{}); ok {
|
|
if params, ok := gravatar["params"].(string); ok {
|
|
if strings.Contains(params, "sha256=1") {
|
|
return utils.GetSha256Hash
|
|
}
|
|
}
|
|
}
|
|
return utils.GetMD5Hash
|
|
}
|