mirror of
https://github.com/simon-ding/polaris.git
synced 2026-06-09 19:47:47 +08:00
feat: add app version
This commit is contained in:
@@ -22,7 +22,7 @@ COPY . .
|
|||||||
|
|
||||||
COPY --from=flutter /app/build/web ./ui/build/web/
|
COPY --from=flutter /app/build/web ./ui/build/web/
|
||||||
# 指定OS等,并go build
|
# 指定OS等,并go build
|
||||||
RUN CGO_ENABLED=1 go build -o polaris ./cmd/
|
RUN CGO_ENABLED=1 go build -o polaris -ldflags="-X polaris/db.Version=$(git describe --tags --long)" ./cmd/
|
||||||
|
|
||||||
FROM debian:12
|
FROM debian:12
|
||||||
ENV TZ="Asia/Shanghai"
|
ENV TZ="Asia/Shanghai"
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import (
|
|||||||
"polaris/server"
|
"polaris/server"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
dbClient, err := db.Open()
|
dbClient, err := db.Open()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
package db
|
package db
|
||||||
|
|
||||||
|
var Version = "undefined"
|
||||||
|
|
||||||
const (
|
const (
|
||||||
SettingTmdbApiKey = "tmdb_api_key"
|
SettingTmdbApiKey = "tmdb_api_key"
|
||||||
SettingLanguage = "language"
|
SettingLanguage = "language"
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ func (s *Server) authModdleware(c *gin.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
auth = strings.TrimPrefix(auth, "Bearer ")
|
auth = strings.TrimPrefix(auth, "Bearer ")
|
||||||
//log.Infof("current token: %v", auth)
|
//log.Debugf("current token: %v", auth)
|
||||||
token, err := jwt.ParseWithClaims(auth, &jwt.RegisteredClaims{}, func(t *jwt.Token) (interface{}, error) {
|
token, err := jwt.ParseWithClaims(auth, &jwt.RegisteredClaims{}, func(t *jwt.Token) (interface{}, error) {
|
||||||
return []byte(s.jwtSerect), nil
|
return []byte(s.jwtSerect), nil
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -84,5 +84,6 @@ func (s *Server) SuggestedSeriesFolderName(c *gin.Context) (interface{}, error)
|
|||||||
if year != "" {
|
if year != "" {
|
||||||
name = fmt.Sprintf("%s (%s)", name, year)
|
name = fmt.Sprintf("%s (%s)", name, year)
|
||||||
}
|
}
|
||||||
|
log.Infof("tv series of tmdb id %v suggestting name is %v", id, name)
|
||||||
return gin.H{"name": name}, nil
|
return gin.H{"name": name}, nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,5 +48,6 @@ func (s *Server) About(c *gin.Context) (interface{}, error) {
|
|||||||
"uptime": uptime.Uptime(),
|
"uptime": uptime.Uptime(),
|
||||||
"chat_group": "https://t.me/+8R2nzrlSs2JhMDgx",
|
"chat_group": "https://t.me/+8R2nzrlSs2JhMDgx",
|
||||||
"go_version": runtime.Version(),
|
"go_version": runtime.Version(),
|
||||||
|
"version": db.Version,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user