diff --git a/.gitignore b/.gitignore
index bbd1446..c8a0428 100644
--- a/.gitignore
+++ b/.gitignore
@@ -24,4 +24,6 @@ codegen/
node_modules/
dist/
.idea
-.package-lock.json
\ No newline at end of file
+.package-lock.json
+*.sh
+build/scripts/setup/service.d/user-service/ubuntu/setup-user-service.sh
diff --git a/.goreleaser.debug.yaml b/.goreleaser.debug.yaml
index dafcc4d..5d80e56 100644
--- a/.goreleaser.debug.yaml
+++ b/.goreleaser.debug.yaml
@@ -118,8 +118,6 @@ archives:
- casaos-user-service-amd64
- casaos-user-service-arm64
- casaos-user-service-arm-7
- replacements:
- arm: arm-7
files:
- build/**/*
- name_template: "{{ .Os }}-{{ .Arch }}-{{ .ProjectName }}-migration-tool-v{{ .Version }}"
@@ -128,8 +126,6 @@ archives:
- casaos-user-service-migration-tool-amd64
- casaos-user-service-migration-tool-arm64
- casaos-user-service-migration-tool-arm-7
- replacements:
- arm: arm-7
files:
- build/sysroot/etc/**/*
checksum:
diff --git a/.vscode/launch.json b/.vscode/launch.json
index c6b44ef..44a3e18 100644
--- a/.vscode/launch.json
+++ b/.vscode/launch.json
@@ -6,7 +6,7 @@
"type": "go",
"debugAdapter": "dlv-dap",
"request": "launch",
- "port": 2345,
+ "port": 2346,
"host": "127.0.0.1",
"mode": "exec",
"program": "${workspaceFolder}/dist/casaos-user-service-amd64_linux_amd64_v1/build/sysroot/usr/bin/casaos-user-service"
diff --git a/dist/artifacts.json b/dist/artifacts.json
index a166796..dc91803 100644
--- a/dist/artifacts.json
+++ b/dist/artifacts.json
@@ -1 +1 @@
-[{"name":"build/sysroot/usr/bin/casaos-user-service","path":"dist/casaos-user-service-amd64_linux_amd64_v1/build/sysroot/usr/bin/casaos-user-service","goos":"linux","goarch":"amd64","goamd64":"v1","internal_type":4,"type":"Binary","extra":{"Binary":"casaos-user-service","Ext":"","ID":"casaos-user-service-amd64"}}]
\ No newline at end of file
+[{"name":"metadata.json","path":"dist/metadata.json","internal_type":30,"type":"Metadata"},{"name":"build/sysroot/usr/bin/casaos-user-service","path":"dist/casaos-user-service-amd64_linux_amd64_v1/build/sysroot/usr/bin/casaos-user-service","goos":"linux","goarch":"amd64","goamd64":"v1","internal_type":4,"type":"Binary","extra":{"Binary":"casaos-user-service","Ext":"","ID":"casaos-user-service-amd64"}}]
\ No newline at end of file
diff --git a/dist/casaos-user-service-amd64_linux_amd64_v1/build/sysroot/usr/bin/casaos-user-service b/dist/casaos-user-service-amd64_linux_amd64_v1/build/sysroot/usr/bin/casaos-user-service
index 73caed3..d8addca 100644
Binary files a/dist/casaos-user-service-amd64_linux_amd64_v1/build/sysroot/usr/bin/casaos-user-service and b/dist/casaos-user-service-amd64_linux_amd64_v1/build/sysroot/usr/bin/casaos-user-service differ
diff --git a/dist/config.yaml b/dist/config.yaml
index 1cbf03b..90afe49 100644
--- a/dist/config.yaml
+++ b/dist/config.yaml
@@ -67,6 +67,7 @@ changelog:
- '^docs:'
- '^test:'
sort: asc
+ format: '{{ .SHA }}: {{ .Message }} ({{ with .AuthorUsername }}@{{ . }}{{ else }}{{ .AuthorName }} <{{ .AuthorEmail }}>{{ end }})'
dist: dist
env_files:
github_token: ~/.config/goreleaser/github_token
@@ -115,7 +116,7 @@ announce:
linkedin:
message_template: '{{ .ProjectName }} {{ .Tag }} is out! Check it out at {{ .ReleaseURL }}'
telegram:
- message_template: '{{ .ProjectName }} {{ mdv2escape .Tag }} is out! Check it out at {{ mdv2escape .ReleaseURL }}'
+ message_template: '{{ mdv2escape .ProjectName }} {{ mdv2escape .Tag }} is out{{ mdv2escape "!" }} Check it out at {{ mdv2escape .ReleaseURL }}'
parse_mode: MarkdownV2
webhook:
message_template: '{ "message": "{{ .ProjectName }} {{ .Tag }} is out! Check it out at {{ .ReleaseURL }}"}'
@@ -123,6 +124,8 @@ announce:
opencollective:
title_template: '{{ .Tag }}'
message_template: '{{ .ProjectName }} {{ .Tag }} is out!
Check it out at {{ .ReleaseURL }}'
+ bluesky:
+ message_template: '{{ .ProjectName }} {{ .Tag }} is out! Check it out at {{ .ReleaseURL }}'
git:
tag_sort: -version:refname
github_urls:
diff --git a/dist/metadata.json b/dist/metadata.json
index 00ebbc5..206b994 100644
--- a/dist/metadata.json
+++ b/dist/metadata.json
@@ -1 +1 @@
-{"project_name":"casaos-user-service","tag":"v1.0.1","previous_tag":"","version":"1.0.2","commit":"e002bab12a5ce37a0636709986e161f0e84f2eeb","date":"2024-02-21T12:02:47.525580972+07:00","runtime":{"goos":"linux","goarch":"amd64"}}
\ No newline at end of file
+{"project_name":"casaos-user-service","tag":"v1.0.0","previous_tag":"","version":"1.0.1","commit":"cd28792c154027bebe695a5be5eef33d65dce067","date":"2024-06-29T11:38:52.713569836+07:00","runtime":{"goos":"linux","goarch":"amd64"}}
\ No newline at end of file
diff --git a/route/v1/user.go b/route/v1/user.go
index fcc2005..7486e4e 100644
--- a/route/v1/user.go
+++ b/route/v1/user.go
@@ -75,7 +75,7 @@ func PostUserRegister(c *gin.Context) {
user.Username = username
user.Password = encryption.GetMD5ByStr(pwd)
user.Role = "admin"
-
+ // user.Role = "user"
user = service.MyService.User().CreateUser(user)
if user.Id == 0 {
c.JSON(common_err.SERVICE_ERROR, model.Result{Success: common_err.SERVICE_ERROR, Message: common_err.GetMsg(common_err.SERVICE_ERROR)})
@@ -97,7 +97,6 @@ var limiter = rate.NewLimiter(rate.Every(time.Minute), 5)
// @Success 200 {string} string "ok"
// @Router /user/login [post]
func PostUserLogin(c *gin.Context) {
-
if !limiter.Allow() {
c.JSON(common_err.TOO_MANY_REQUEST,
model.Result{
@@ -810,18 +809,37 @@ func DeleteUserAll(c *gin.Context) {
// @Security ApiKeyAuth
// @Success 200 {string} string "ok"
// @Router /sys/init/check [get]
+// func GetUserStatus(c *gin.Context) {
+// data := make(map[string]interface{}, 2)
+
+// if service.MyService.User().GetUserCount() > 0 {
+// data["initialized"] = true
+// data["key"] = ""
+// } else {
+// key := uuid.NewV4().String()
+// service.UserRegisterHash[key] = key
+// data["key"] = key
+// data["initialized"] = false
+// }
+// gpus, err := external.NvidiaGPUInfoList()
+// if err != nil {
+// logger.Error("NvidiaGPUInfoList error", zap.Error(err))
+// }
+// data["gpus"] = len(gpus)
+// c.JSON(common_err.SUCCESS,
+// model.Result{
+// Success: common_err.SUCCESS,
+// Message: common_err.GetMsg(common_err.SUCCESS),
+// Data: data,
+// })
+// }
+
func GetUserStatus(c *gin.Context) {
data := make(map[string]interface{}, 2)
-
- if service.MyService.User().GetUserCount() > 0 {
- data["initialized"] = true
- data["key"] = ""
- } else {
- key := uuid.NewV4().String()
- service.UserRegisterHash[key] = key
- data["key"] = key
- data["initialized"] = false
- }
+ key := uuid.NewV4().String()
+ service.UserRegisterHash[key] = key
+ data["key"] = key
+ data["initialized"] = true
gpus, err := external.NvidiaGPUInfoList()
if err != nil {
logger.Error("NvidiaGPUInfoList error", zap.Error(err))