Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: Clean code

Daniel64b4f38b21ae
diff --git a/kernel/util/net.go b/kernel/util/net.go
index e8c6dc6f7a..acd607b80e 100644
--- a/kernel/util/net.go
+++ b/kernel/util/net.go
@@ -33,21 +33,6 @@ import (
"github.com/siyuan-note/logging"
)
-func ValidOptionalPort(port string) bool {
- if port == "" {
- return true
- }
- if port[0] != ':' {
- return false
- }
- for _, b := range port[1:] {
- if b < '0' || b > '9' {
- return false
- }
- }
- return true
-}
-
func IsLocalHostname(hostname string) bool {
if "localhost" == hostname || strings.HasSuffix(hostname, ".localhost") {
return true
@@ -67,8 +52,8 @@ func IsLocalHost(host string) bool {
}
func IsLocalOrigin(origin string) bool {
- if url, err := url.Parse(origin); err == nil {
- return IsLocalHostname(url.Hostname())
+ if u, err := url.Parse(origin); err == nil {
+ return IsLocalHostname(u.Hostname())
}
return false
}
@@ -180,11 +165,6 @@ func InvalidIDPattern(idArg string, result *gulu.Result) bool {
return true
}
-func IsValidURL(str string) bool {
- _, err := url.Parse(str)
- return err == nil
-}
-
func initHttpClient() {
http.DefaultClient = httpclient.GetCloudFileClient2Min()
http.DefaultTransport = httpclient.NewTransport(false)