22 Commits

Author SHA1 Message Date
hoangvv e265ce3f9c update: makefile 2024-10-18 17:21:58 +07:00
hoangvv 3750dfee56 update: add onepanel api ssl related (wip) 2024-10-16 12:04:33 +07:00
hoangvv 44e51057d8 update: add 1panel proxy api 2024-10-15 17:33:18 +07:00
hoangvv 939f966173 feat:Add Delete OnePanel Website and add Authentik api go client package 2024-10-09 17:44:03 +07:00
hoangvv ec9cc6c24e feat: Add 1Panel auth middleware + add and search Website API 2024-10-09 12:05:51 +07:00
hoangvv 946e3dba59 feature: add 1panel related api(wip) 2024-10-07 17:43:18 +07:00
hoangvv f42b57a15c update: goreleaser 2024-10-04 14:23:35 +07:00
hoangvv 24369c69fa update: Makefile 2024-10-04 14:12:49 +07:00
hoangvv fc915ebda5 update 2024-10-04 12:22:38 +07:00
hoangvv 7237251294 update make file 2024-10-04 12:20:45 +07:00
hoangvv 7cf16e2bec chore: update makefile 2024-10-04 12:14:27 +07:00
hoangvv 9250eaf1bc chore update makefile 2024-10-04 12:03:16 +07:00
hoangvv d65fa3969e chore:update makefile 2024-10-04 11:45:03 +07:00
hoangvv a5e21b3c28 chore:update goreleaser and Makefile 2024-10-04 11:23:28 +07:00
hoangvv db526c2796 feature: add nextWeb Service 2024-10-02 16:52:10 +07:00
hoangvv 9f885c9df9 chore : stop tracking dist folder 2024-10-02 10:53:09 +07:00
hoangvv 78c9818156 chore : refactoring user service 2024-10-02 10:49:27 +07:00
hoangvv 22d16769ff update 2024-10-01 11:31:39 +07:00
hoangvv 034e778ea1 chore:dynamically change redirectUrl 2024-10-01 11:27:16 +07:00
hoangvv f89d096bc2 feature:Save OIDC setting in DB (TODO: support multiple profile) 2024-09-30 12:12:46 +07:00
hoangvv 7c56d5865c chore:update package and add oid health check 2024-09-25 12:03:25 +07:00
hoangvv e360248157 chore:Add Makefile 2024-09-24 18:36:59 +07:00
36 changed files with 1540 additions and 407 deletions
+4 -2
View File
@@ -20,7 +20,7 @@ target/
dist/ dist/
__debug_bin __debug_bin
codegen/ codegen/
commit.txt
node_modules/ node_modules/
dist/ dist/
.idea .idea
@@ -41,4 +41,6 @@ linux-amd64-nextzenos-user-service-v1.2.4.tar.gz
dist/casaos-user-service-amd64_linux_amd64_v1/build/sysroot/usr/bin/casaos-user-service dist/casaos-user-service-amd64_linux_amd64_v1/build/sysroot/usr/bin/casaos-user-service
dist/casaos-user-service-amd64_linux_amd64_v1/build/sysroot/usr/bin/casaos-user-service dist/casaos-user-service-amd64_linux_amd64_v1/build/sysroot/usr/bin/casaos-user-service
dist/casaos-user-service-amd64_linux_amd64_v1/build/sysroot/usr/bin/casaos-user-service dist/casaos-user-service-amd64_linux_amd64_v1/build/sysroot/usr/bin/casaos-user-service
.env
.vscode/launch.json
dist/metadata.json
+84 -83
View File
@@ -1,6 +1,6 @@
# This is an example .goreleaser.yml file with some sensible defaults. # This is an example .goreleaser.yml file with some sensible defaults.
# Make sure to check the documentation at https://goreleaser.com # Make sure to check the documentation at https://goreleaser.com
project_name: casaos-user-service project_name: nextzen-user-service
before: before:
hooks: hooks:
- go generate - go generate
@@ -8,7 +8,7 @@ before:
- go mod tidy - go mod tidy
- go test -race -v ./... - go test -race -v ./...
builds: builds:
- id: casaos-user-service-amd64 - id: nextzen-user-service-amd64
binary: build/sysroot/usr/bin/casaos-user-service binary: build/sysroot/usr/bin/casaos-user-service
hooks: hooks:
post: post:
@@ -29,7 +29,7 @@ builds:
- linux - linux
goarch: goarch:
- amd64 - amd64
- id: casaos-user-service-arm64 - id: nextzen-user-service-arm64
binary: build/sysroot/usr/bin/casaos-user-service binary: build/sysroot/usr/bin/casaos-user-service
# hooks: # hooks:
# post: # post:
@@ -50,7 +50,7 @@ builds:
- linux - linux
goarch: goarch:
- arm64 - arm64
- id: casaos-user-service-arm-7 - id: nextzen-user-service-arm-7
binary: build/sysroot/usr/bin/casaos-user-service binary: build/sysroot/usr/bin/casaos-user-service
hooks: hooks:
post: post:
@@ -73,92 +73,92 @@ builds:
- arm - arm
goarm: goarm:
- "7" - "7"
- id: casaos-user-service-migration-tool-amd64 # - id: casaos-user-service-migration-tool-amd64
binary: build/sysroot/usr/bin/casaos-user-service-migration-tool # binary: build/sysroot/usr/bin/casaos-user-service-migration-tool
hooks:
post:
- upx --best --lzma -v --no-progress "{{ .Path }}"
main: ./cmd/migration-tool
env:
- CC=x86_64-linux-gnu-gcc
ldflags:
- -X main.commit={{.Commit}}
- -X main.date={{.Date}}
- -s
- -w
- -extldflags "-static"
tags:
- musl
- netgo
- osusergo
goos:
- linux
goarch:
- amd64
- id: casaos-user-service-migration-tool-arm64
binary: build/sysroot/usr/bin/casaos-user-service-migration-tool
# hooks: # hooks:
# post: # post:
# - upx --best --lzma -v --no-progress "{{ .Path }}" # - upx --best --lzma -v --no-progress "{{ .Path }}"
main: ./cmd/migration-tool # main: ./cmd/migration-tool
env: # env:
- CC=aarch64-linux-gnu-gcc # - CC=x86_64-linux-gnu-gcc
ldflags: # ldflags:
- -X main.commit={{.Commit}} # - -X main.commit={{.Commit}}
- -X main.date={{.Date}} # - -X main.date={{.Date}}
- -s # - -s
- -w # - -w
- -extldflags "-static" # - -extldflags "-static"
tags: # tags:
- musl # - musl
- netgo # - netgo
- osusergo # - osusergo
goos: # goos:
- linux # - linux
goarch: # goarch:
- arm64 # - amd64
- id: casaos-user-service-migration-tool-arm-7 # - id: casaos-user-service-migration-tool-arm64
binary: build/sysroot/usr/bin/casaos-user-service-migration-tool # binary: build/sysroot/usr/bin/casaos-user-service-migration-tool
hooks: # # hooks:
post: # # post:
- upx --best --lzma -v --no-progress "{{ .Path }}" # # - upx --best --lzma -v --no-progress "{{ .Path }}"
main: ./cmd/migration-tool # main: ./cmd/migration-tool
env: # env:
- CC=arm-linux-gnueabihf-gcc # - CC=aarch64-linux-gnu-gcc
ldflags: # ldflags:
- -X main.commit={{.Commit}} # - -X main.commit={{.Commit}}
- -X main.date={{.Date}} # - -X main.date={{.Date}}
- -s # - -s
- -w # - -w
- -extldflags "-static" # - -extldflags "-static"
tags: # tags:
- musl # - musl
- netgo # - netgo
- osusergo # - osusergo
goos: # goos:
- linux # - linux
goarch: # goarch:
- arm # - arm64
goarm: # - id: casaos-user-service-migration-tool-arm-7
- "7" # binary: build/sysroot/usr/bin/casaos-user-service-migration-tool
# hooks:
# post:
# - upx --best --lzma -v --no-progress "{{ .Path }}"
# main: ./cmd/migration-tool
# env:
# - CC=arm-linux-gnueabihf-gcc
# ldflags:
# - -X main.commit={{.Commit}}
# - -X main.date={{.Date}}
# - -s
# - -w
# - -extldflags "-static"
# tags:
# - musl
# - netgo
# - osusergo
# goos:
# - linux
# goarch:
# - arm
# goarm:
# - "7"
archives: archives:
- name_template: >- - name_template: >-
{{ .Os }}-{{- if eq .Arch "arm" }}arm-7{{- else }}{{ .Arch }}{{- end }}-{{ .ProjectName }}-v{{ .Version }} {{ .Os }}-{{- if eq .Arch "arm" }}arm-7{{- else }}{{ .Arch }}{{- end }}-{{ .ProjectName }}-v{{ .Version }}
builds: builds:
- casaos-user-service-amd64 - nextzen-user-service-amd64
- casaos-user-service-arm64 - nextzen-user-service-arm64
- casaos-user-service-arm-7 - nextzen-user-service-arm-7
files: files:
- build/**/* - build/**/*
- name_template: >- # - name_template: >-
{{ .Os }}-{{- if eq .Arch "arm" }}arm-7{{- else }}{{ .Arch }}{{- end }}-{{ .ProjectName }}-migration-tool-v{{ .Version }} # {{ .Os }}-{{- if eq .Arch "arm" }}arm-7{{- else }}{{ .Arch }}{{- end }}-{{ .ProjectName }}-migration-tool-v{{ .Version }}
id: casaos-user-service-migration-tool # id: casaos-user-service-migration-tool
builds: # builds:
- casaos-user-service-migration-tool-amd64 # - casaos-user-service-migration-tool-amd64
- casaos-user-service-migration-tool-arm64 # - casaos-user-service-migration-tool-arm64
- casaos-user-service-migration-tool-arm-7 # - casaos-user-service-migration-tool-arm-7
files: # files:
- build/sysroot/etc/**/* # - build/sysroot/etc/**/*
checksum: checksum:
name_template: "checksums.txt" name_template: "checksums.txt"
snapshot: snapshot:
@@ -169,10 +169,11 @@ changelog:
exclude: exclude:
- "^docs:" - "^docs:"
- "^test:" - "^test:"
- "^update:"
release: release:
github: github:
owner: IceWhaleTech owner: KaySar12
name: CasaOS-UserService name: NextZen-UserService
draft: true draft: true
prerelease: auto prerelease: auto
mode: replace mode: replace
+1 -1
View File
@@ -6,7 +6,7 @@
"type": "go", "type": "go",
"debugAdapter": "dlv-dap", "debugAdapter": "dlv-dap",
"request": "launch", "request": "launch",
"port": 2346, "port": 39117,
"host": "127.0.0.1", "host": "127.0.0.1",
"mode": "exec", "mode": "exec",
"program": "${workspaceFolder}/dist/casaos-user-service-amd64_linux_amd64_v1/build/sysroot/usr/bin/casaos-user-service" "program": "${workspaceFolder}/dist/casaos-user-service-amd64_linux_amd64_v1/build/sysroot/usr/bin/casaos-user-service"
+49
View File
@@ -0,0 +1,49 @@
GORELEASER=goreleaser
GORELEASERBUILD=$(GORELEASER) build
GIT=git
GIT_REMOTE?=origin
SERVICE = casaos-user-service
ARCHITECHTURE= amd64
OS=linux
VERSION=v1
BIN_PATH=build/sysroot/usr/bin
BUILD_PATH=build
CUR_DIR=$(PWD)
CUR_TAG ?= $(shell git describe --tags --match '*.*.*' | sort -V | tail -n1 | sed 's/-[0-9]*-g[0-9a-f]*//')
PREV_TAG ?= $(shell git describe --tags --match '*.*.*' | sort -V | head -n2 | tail -n1 | sed 's/-[0-9]*-g[0-9a-f]*//')
ARCHIVE_PATH=buildzip
PACKAGE_NAME=$(OS)-$(ARCHITECHTURE)-nextzenos-user-service-$(TAG)
COMMIT_MESSAGE ?="update"
build_service:
$(GORELEASERBUILD) --clean --snapshot -f .goreleaser.debug.yaml --id $(SERVICE)-$(ARCHITECHTURE)
package:
cp -f $(CUR_DIR)/dist/$(SERVICE)-$(ARCHITECHTURE)_$(OS)_$(ARCHITECHTURE)_$(VERSION)/$(BIN_PATH)/$(SERVICE) $(CUR_DIR)/$(BIN_PATH) \
&& tar -czvf $(PACKAGE_NAME).tar.gz $(CUR_DIR)/$(BUILD_PATH)
archive_package:
@mkdir -p $(CUR_DIR)/$(ARCHIVE_PATH)/$(CUR_TAG)
@mv $(PACKAGE_NAME).tar.gz $(CUR_DIR)/$(ARCHIVE_PATH)/$(CUR_TAG)/
remove_package:
rm $(PACKAGE_NAME).tar.gz
clear_archive:
@rm -rf $(CUR_DIR)/$(ARCHIVE_PATH)
#make create_tag CUR_TAG=x.x TAG_MESSAGE="this is tag message"
create_tag:
@${GIT} tag -a ${CUR_TAG} -m "${TAG_MESSAGE}" || { echo "Failed to create tag"; exit 1; }
@${GIT} push ${GIT_REMOTE} ${CUR_TAG} || { echo "Failed to push tag"; exit 1; }
#make remove_tag CUR_TAG=x.x
remove_tag:
@${GIT} tag -d ${CUR_TAG}
@${GIT} push ${GIT_REMOTE} -d ${CUR_TAG}
check_tag:
@echo "Current tag: $(CUR_TAG)";
push_release_all:
${GORELEASER} release --clean -f .goreleaser.yaml
push_release:
${GORELEASER} release --single-target
push_git:
@${GIT} pull ${GIT_REMOTE}
@${GIT} add .
@${GIT} commit -m "${COMMIT_MESSAGE}"
@${GIT} push ${GIT_REMOTE}
@@ -1,13 +0,0 @@
[Unit]
After=casaos-message-bus.service
Description=CasaOS User Service
[Service]
ExecStartPre=/usr/bin/casaos-user-service -v
ExecStart=/usr/bin/casaos-user-service -c /etc/casaos/user-service.conf
PIDFile=/var/run/casaos/user-service.pid
Restart=always
Type=notify
[Install]
WantedBy=multi-user.target
+3 -3
View File
@@ -6,9 +6,9 @@ import (
"fmt" "fmt"
"os" "os"
interfaces "github.com/IceWhaleTech/CasaOS-Common" interfaces "github.com/KaySar12/NextZen-Common"
"github.com/IceWhaleTech/CasaOS-Common/utils/systemctl" "github.com/KaySar12/NextZen-Common/utils/systemctl"
"github.com/IceWhaleTech/CasaOS-UserService/common" "github.com/KaySar12/NextZen-UserService/common"
) )
const ( const (
+1 -1
View File
@@ -1,7 +1,7 @@
package main package main
import ( import (
interfaces "github.com/IceWhaleTech/CasaOS-Common" interfaces "github.com/KaySar12/NextZen-Common"
) )
type migrationTool struct{} type migrationTool struct{}
+1 -1
View File
@@ -1,4 +1,4 @@
package common package common
const Version = "1.3.0" const Version = "1.4.0"
const SERVICENAME = "CasaOS-UserService" const SERVICENAME = "CasaOS-UserService"
-1
View File
@@ -1 +0,0 @@
[{"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"}}]
-134
View File
@@ -1,134 +0,0 @@
project_name: casaos-user-service
release:
github:
owner: IceWhaleTech
name: CasaOS-UserService
draft: true
prerelease: auto
name_template: v{{ .Version }}
mode: replace
builds:
- id: casaos-user-service-amd64
goos:
- linux
goarch:
- amd64
goarm:
- "6"
gomips:
- hardfloat
goamd64:
- v1
targets:
- linux_amd64_v1
dir: .
main: .
binary: build/sysroot/usr/bin/casaos-user-service
builder: go
gobinary: go
command: build
ldflags:
- -extldflags "-static"
tags:
- musl
- netgo
- osusergo
gcflags:
- all=-N -l
env:
- CC=x86_64-linux-gnu-gcc
archives:
- id: casaos-user-service
builds:
- casaos-user-service-amd64
- casaos-user-service-arm64
- casaos-user-service-arm-7
name_template: '{{ .Os }}-{{ .Arch }}-{{ .ProjectName }}-v{{ .Version }}'
format: tar.gz
files:
- src: build/**/*
- id: casaos-user-service-migration-tool
builds:
- casaos-user-service-migration-tool-amd64
- casaos-user-service-migration-tool-arm64
- casaos-user-service-migration-tool-arm-7
name_template: '{{ .Os }}-{{ .Arch }}-{{ .ProjectName }}-migration-tool-v{{ .Version }}'
format: tar.gz
files:
- src: build/sysroot/etc/**/*
snapshot:
name_template: '{{ incpatch .Version }}'
checksum:
name_template: checksums.txt
algorithm: sha256
changelog:
filters:
exclude:
- '^docs:'
- '^test:'
sort: asc
format: '{{ .SHA }}: {{ .Message }} ({{ with .AuthorUsername }}@{{ . }}{{ else }}{{ .AuthorName }} <{{ .AuthorEmail }}>{{ end }})'
dist: dist
env_files:
github_token: ~/.config/goreleaser/github_token
gitlab_token: ~/.config/goreleaser/gitlab_token
gitea_token: ~/.config/goreleaser/gitea_token
before:
hooks:
- go generate
- go run github.com/google/go-licenses@latest check . --disallowed_types=restricted
- go mod tidy
- go test -race -v ./...
source:
name_template: '{{ .ProjectName }}-{{ .Version }}'
format: tar.gz
gomod:
gobinary: go
announce:
twitter:
message_template: '{{ .ProjectName }} {{ .Tag }} is out! Check it out at {{ .ReleaseURL }}'
mastodon:
message_template: '{{ .ProjectName }} {{ .Tag }} is out! Check it out at {{ .ReleaseURL }}'
server: ""
reddit:
title_template: '{{ .ProjectName }} {{ .Tag }} is out!'
url_template: '{{ .ReleaseURL }}'
slack:
message_template: '{{ .ProjectName }} {{ .Tag }} is out! Check it out at {{ .ReleaseURL }}'
username: GoReleaser
discord:
message_template: '{{ .ProjectName }} {{ .Tag }} is out! Check it out at {{ .ReleaseURL }}'
author: GoReleaser
color: "3888754"
icon_url: https://goreleaser.com/static/avatar.png
teams:
title_template: '{{ .ProjectName }} {{ .Tag }} is out!'
message_template: '{{ .ProjectName }} {{ .Tag }} is out! Check it out at {{ .ReleaseURL }}'
color: '#2D313E'
icon_url: https://goreleaser.com/static/avatar.png
smtp:
subject_template: '{{ .ProjectName }} {{ .Tag }} is out!'
body_template: 'You can view details from: {{ .ReleaseURL }}'
mattermost:
message_template: '{{ .ProjectName }} {{ .Tag }} is out! Check it out at {{ .ReleaseURL }}'
title_template: '{{ .ProjectName }} {{ .Tag }} is out!'
username: GoReleaser
linkedin:
message_template: '{{ .ProjectName }} {{ .Tag }} is out! Check it out at {{ .ReleaseURL }}'
telegram:
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 }}"}'
content_type: application/json; charset=utf-8
opencollective:
title_template: '{{ .Tag }}'
message_template: '{{ .ProjectName }} {{ .Tag }} is out!<br/>Check it out at <a href="{{ .ReleaseURL }}">{{ .ReleaseURL }}</a>'
bluesky:
message_template: '{{ .ProjectName }} {{ .Tag }} is out! Check it out at {{ .ReleaseURL }}'
git:
tag_sort: -version:refname
github_urls:
download: https://github.com
gitlab_urls:
download: https://gitlab.com
-1
View File
@@ -1 +0,0 @@
{"project_name":"casaos-user-service","tag":"v1.0.0","previous_tag":"","version":"1.0.1","commit":"87aab176d2716419944d8d34c9a5ee3d7bc63acd","date":"2024-09-07T11:45:04.418487229+07:00","runtime":{"goos":"linux","goarch":"amd64"}}
+19 -14
View File
@@ -1,25 +1,26 @@
module github.com/IceWhaleTech/CasaOS-UserService module github.com/KaySar12/NextZen-UserService
go 1.21 go 1.21
toolchain go1.22.0 toolchain go1.22.0
require ( require (
github.com/IceWhaleTech/CasaOS-Common v0.4.8-alpha12 github.com/KaySar12/NextZen-Common v1.0.0-alpha6
github.com/coreos/go-oidc/v3 v3.11.0 github.com/coreos/go-oidc/v3 v3.11.0
github.com/coreos/go-systemd v0.0.0-20191104093116-d3cd4ed1dbcf github.com/coreos/go-systemd v0.0.0-20191104093116-d3cd4ed1dbcf
github.com/deepmap/oapi-codegen v1.12.4 github.com/deepmap/oapi-codegen v1.12.4
github.com/getkin/kin-openapi v0.117.0 github.com/getkin/kin-openapi v0.117.0
github.com/gin-contrib/gzip v0.0.6 github.com/gin-contrib/gzip v0.0.6
github.com/gin-gonic/gin v1.9.1 github.com/gin-contrib/sessions v1.0.1
github.com/gin-gonic/gin v1.10.0
github.com/glebarez/sqlite v1.8.0 github.com/glebarez/sqlite v1.8.0
github.com/labstack/echo/v4 v4.10.2 github.com/labstack/echo/v4 v4.12.0
github.com/satori/go.uuid v1.2.0 github.com/satori/go.uuid v1.2.0
github.com/tidwall/gjson v1.14.4 github.com/tidwall/gjson v1.17.0
go.uber.org/zap v1.24.0 go.uber.org/zap v1.24.0
golang.org/x/net v0.27.0 golang.org/x/net v0.27.0
golang.org/x/oauth2 v0.21.0 golang.org/x/oauth2 v0.21.0
golang.org/x/time v0.3.0 golang.org/x/time v0.5.0
gopkg.in/ini.v1 v1.67.0 gopkg.in/ini.v1 v1.67.0
gorm.io/gorm v1.25.8 gorm.io/gorm v1.25.8
) )
@@ -27,9 +28,10 @@ require (
require ( require (
github.com/apapsch/go-jsonmerge/v2 v2.0.0 // indirect github.com/apapsch/go-jsonmerge/v2 v2.0.0 // indirect
github.com/benbjohnson/clock v1.3.1 // indirect github.com/benbjohnson/clock v1.3.1 // indirect
github.com/bytedance/sonic v1.11.3 // indirect github.com/bytedance/sonic v1.11.6 // indirect
github.com/chenzhuoyu/base64x v0.0.0-20230717121745-296ad89f973d // indirect github.com/bytedance/sonic/loader v0.1.1 // indirect
github.com/chenzhuoyu/iasm v0.9.1 // indirect github.com/cloudwego/base64x v0.1.4 // indirect
github.com/cloudwego/iasm v0.2.0 // indirect
github.com/coreos/go-systemd/v22 v22.5.0 // indirect github.com/coreos/go-systemd/v22 v22.5.0 // indirect
github.com/dustin/go-humanize v1.0.1 // indirect github.com/dustin/go-humanize v1.0.1 // indirect
github.com/gabriel-vasile/mimetype v1.4.3 // indirect github.com/gabriel-vasile/mimetype v1.4.3 // indirect
@@ -40,14 +42,17 @@ require (
github.com/go-openapi/swag v0.22.3 // indirect github.com/go-openapi/swag v0.22.3 // indirect
github.com/go-playground/locales v0.14.1 // indirect github.com/go-playground/locales v0.14.1 // indirect
github.com/go-playground/universal-translator v0.18.1 // indirect github.com/go-playground/universal-translator v0.18.1 // indirect
github.com/go-playground/validator/v10 v10.19.0 // indirect github.com/go-playground/validator/v10 v10.20.0 // indirect
github.com/goccy/go-json v0.10.2 // indirect github.com/goccy/go-json v0.10.2 // indirect
github.com/godbus/dbus/v5 v5.1.0 // indirect github.com/godbus/dbus/v5 v5.1.0 // indirect
github.com/golang-jwt/jwt v3.2.2+incompatible // indirect github.com/golang-jwt/jwt v3.2.2+incompatible // indirect
github.com/golang-jwt/jwt/v4 v4.5.0 // indirect github.com/golang-jwt/jwt/v4 v4.5.0 // indirect
github.com/google/go-cmp v0.6.0 // indirect github.com/google/go-cmp v0.6.0 // indirect
github.com/google/uuid v1.3.0 // indirect github.com/google/uuid v1.3.0 // indirect
github.com/gorilla/context v1.1.2 // indirect
github.com/gorilla/mux v1.8.0 // indirect github.com/gorilla/mux v1.8.0 // indirect
github.com/gorilla/securecookie v1.1.2 // indirect
github.com/gorilla/sessions v1.2.2 // indirect
github.com/invopop/yaml v0.2.0 // indirect github.com/invopop/yaml v0.2.0 // indirect
github.com/jinzhu/inflection v1.0.0 // indirect github.com/jinzhu/inflection v1.0.0 // indirect
github.com/jinzhu/now v1.1.5 // indirect github.com/jinzhu/now v1.1.5 // indirect
@@ -55,7 +60,7 @@ require (
github.com/json-iterator/go v1.1.12 // indirect github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/cpuid/v2 v2.2.7 // indirect github.com/klauspost/cpuid/v2 v2.2.7 // indirect
github.com/kr/pretty v0.3.1 // indirect github.com/kr/pretty v0.3.1 // indirect
github.com/labstack/gommon v0.4.0 // indirect github.com/labstack/gommon v0.4.2 // indirect
github.com/leodido/go-urn v1.4.0 // indirect github.com/leodido/go-urn v1.4.0 // indirect
github.com/mailru/easyjson v0.7.7 // indirect github.com/mailru/easyjson v0.7.7 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-colorable v0.1.13 // indirect
@@ -63,7 +68,7 @@ require (
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect
github.com/pelletier/go-toml/v2 v2.2.0 // indirect github.com/pelletier/go-toml/v2 v2.2.2 // indirect
github.com/perimeterx/marshmallow v1.1.4 // indirect github.com/perimeterx/marshmallow v1.1.4 // indirect
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect
github.com/rogpeppe/go-internal v1.10.0 // indirect github.com/rogpeppe/go-internal v1.10.0 // indirect
@@ -76,12 +81,12 @@ require (
github.com/valyala/fasttemplate v1.2.2 // indirect github.com/valyala/fasttemplate v1.2.2 // indirect
go.uber.org/atomic v1.10.0 // indirect go.uber.org/atomic v1.10.0 // indirect
go.uber.org/multierr v1.11.0 // indirect go.uber.org/multierr v1.11.0 // indirect
golang.org/x/arch v0.7.0 // indirect golang.org/x/arch v0.8.0 // indirect
golang.org/x/crypto v0.25.0 // indirect golang.org/x/crypto v0.25.0 // indirect
golang.org/x/exp v0.0.0-20230713183714-613f0c0eb8a1 // indirect golang.org/x/exp v0.0.0-20230713183714-613f0c0eb8a1 // indirect
golang.org/x/sys v0.22.0 // indirect golang.org/x/sys v0.22.0 // indirect
golang.org/x/text v0.16.0 // indirect golang.org/x/text v0.16.0 // indirect
google.golang.org/protobuf v1.33.0 // indirect google.golang.org/protobuf v1.34.1 // indirect
gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect
modernc.org/libc v1.22.4 // indirect modernc.org/libc v1.22.4 // indirect
+38 -37
View File
@@ -1,22 +1,19 @@
github.com/IceWhaleTech/CasaOS-Common v0.4.8-alpha12 h1:TikSpmsMOxKufqoq8Q4K3PLh8zIKFrRtLH4JDIG+910= github.com/KaySar12/NextZen-Common v1.0.0-alpha6 h1:QK0b4wNzriXQa20wm+yhkj28zB5SyD6UFH6vSPWu+dU=
github.com/IceWhaleTech/CasaOS-Common v0.4.8-alpha12/go.mod h1:2IuYyy5qW1BE6jqC6M+tOU+WtUec1K565rLATBJ9p/0= github.com/KaySar12/NextZen-Common v1.0.0-alpha6/go.mod h1:r/zwQQg9ty2+A96HbMZbqvXlX/t9S2Fl3lGVjNB87ZI=
github.com/RaveNoX/go-jsoncommentstrip v1.0.0/go.mod h1:78ihd09MekBnJnxpICcwzCMzGrKSKYe4AqU6PDYYpjk= github.com/RaveNoX/go-jsoncommentstrip v1.0.0/go.mod h1:78ihd09MekBnJnxpICcwzCMzGrKSKYe4AqU6PDYYpjk=
github.com/apapsch/go-jsonmerge/v2 v2.0.0 h1:axGnT1gRIfimI7gJifB699GoE/oq+F2MU7Dml6nw9rQ= github.com/apapsch/go-jsonmerge/v2 v2.0.0 h1:axGnT1gRIfimI7gJifB699GoE/oq+F2MU7Dml6nw9rQ=
github.com/apapsch/go-jsonmerge/v2 v2.0.0/go.mod h1:lvDnEdqiQrp0O42VQGgmlKpxL1AP2+08jFMw88y4klk= github.com/apapsch/go-jsonmerge/v2 v2.0.0/go.mod h1:lvDnEdqiQrp0O42VQGgmlKpxL1AP2+08jFMw88y4klk=
github.com/benbjohnson/clock v1.3.1 h1:Heo0FGXzOxUHquZbraxt+tT7UXVDhesUQH5ISbsOkCQ= github.com/benbjohnson/clock v1.3.1 h1:Heo0FGXzOxUHquZbraxt+tT7UXVDhesUQH5ISbsOkCQ=
github.com/benbjohnson/clock v1.3.1/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/benbjohnson/clock v1.3.1/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA=
github.com/bmatcuk/doublestar v1.1.1/go.mod h1:UD6OnuiIn0yFxxA2le/rnRU1G4RaI4UvFv1sNto9p6w= github.com/bmatcuk/doublestar v1.1.1/go.mod h1:UD6OnuiIn0yFxxA2le/rnRU1G4RaI4UvFv1sNto9p6w=
github.com/bytedance/sonic v1.5.0/go.mod h1:ED5hyg4y6t3/9Ku1R6dU/4KyJ48DZ4jPhfY1O2AihPM= github.com/bytedance/sonic v1.11.6 h1:oUp34TzMlL+OY1OUWxHqsdkgC/Zfc85zGqw9siXjrc0=
github.com/bytedance/sonic v1.10.0-rc/go.mod h1:ElCzW+ufi8qKqNW0FY314xriJhyJhuoJ3gFZdAHF7NM= github.com/bytedance/sonic v1.11.6/go.mod h1:LysEHSvpvDySVdC2f87zGWf6CIKJcAvqab1ZaiQtds4=
github.com/bytedance/sonic v1.11.3 h1:jRN+yEjakWh8aK5FzrciUHG8OFXK+4/KrAX/ysEtHAA= github.com/bytedance/sonic/loader v0.1.1 h1:c+e5Pt1k/cy5wMveRDyk2X4B9hF4g7an8N3zCYjJFNM=
github.com/bytedance/sonic v1.11.3/go.mod h1:iZcSUejdk5aukTND/Eu/ivjQuEL0Cu9/rf50Hi0u/g4= github.com/bytedance/sonic/loader v0.1.1/go.mod h1:ncP89zfokxS5LZrJxl5z0UJcsk4M4yY2JpfqGeCtNLU=
github.com/chenzhuoyu/base64x v0.0.0-20211019084208-fb5309c8db06/go.mod h1:DH46F32mSOjUmXrMHnKwZdA8wcEefY7UVqBKYGjpdQY= github.com/cloudwego/base64x v0.1.4 h1:jwCgWpFanWmN8xoIUHa2rtzmkd5J2plF/dnLS6Xd/0Y=
github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311/go.mod h1:b583jCggY9gE99b6G5LEC39OIiVsWj+R97kbl5odCEk= github.com/cloudwego/base64x v0.1.4/go.mod h1:0zlkT4Wn5C6NdauXdJRhSKRlJvmclQ1hhJgA0rcu/8w=
github.com/chenzhuoyu/base64x v0.0.0-20230717121745-296ad89f973d h1:77cEq6EriyTZ0g/qfRdp61a3Uu/AWrgIq2s0ClJV1g0= github.com/cloudwego/iasm v0.2.0 h1:1KNIy1I1H9hNNFEEH3DVnI4UujN+1zjpuk6gwHLTssg=
github.com/chenzhuoyu/base64x v0.0.0-20230717121745-296ad89f973d/go.mod h1:8EPpVsBuRksnlj1mLy4AWzRNQYxauNi62uWcE3to6eA= github.com/cloudwego/iasm v0.2.0/go.mod h1:8rXZaNYT2n95jn+zTI1sDr+IgcD2GVs0nlbbQPiEFhY=
github.com/chenzhuoyu/iasm v0.9.0/go.mod h1:Xjy2NpN3h7aUqeqM+woSuuvxmIe6+DDsiNLIrkAmYog=
github.com/chenzhuoyu/iasm v0.9.1 h1:tUHQJXo3NhBqw6s33wkGn9SP3bvrWLdlVIJ3hQBL7P0=
github.com/chenzhuoyu/iasm v0.9.1/go.mod h1:Xjy2NpN3h7aUqeqM+woSuuvxmIe6+DDsiNLIrkAmYog=
github.com/coreos/go-oidc/v3 v3.11.0 h1:Ia3MxdwpSw702YW0xgfmP1GVCMA9aEFWu12XUZ3/OtI= github.com/coreos/go-oidc/v3 v3.11.0 h1:Ia3MxdwpSw702YW0xgfmP1GVCMA9aEFWu12XUZ3/OtI=
github.com/coreos/go-oidc/v3 v3.11.0/go.mod h1:gE3LgjOgFoHi9a4ce4/tJczr0Ai2/BoDhf0r5lltWI0= github.com/coreos/go-oidc/v3 v3.11.0/go.mod h1:gE3LgjOgFoHi9a4ce4/tJczr0Ai2/BoDhf0r5lltWI0=
github.com/coreos/go-systemd v0.0.0-20191104093116-d3cd4ed1dbcf h1:iW4rZ826su+pqaw19uhpSCzhj44qo35pNgKFGqzDKkU= github.com/coreos/go-systemd v0.0.0-20191104093116-d3cd4ed1dbcf h1:iW4rZ826su+pqaw19uhpSCzhj44qo35pNgKFGqzDKkU=
@@ -37,11 +34,13 @@ github.com/getkin/kin-openapi v0.117.0 h1:QT2DyGujAL09F4NrKDHJGsUoIprlIcFVHWDVDc
github.com/getkin/kin-openapi v0.117.0/go.mod h1:l5e9PaFUo9fyLJCPGQeXI2ML8c3P8BHOEV2VaAVf/pc= github.com/getkin/kin-openapi v0.117.0/go.mod h1:l5e9PaFUo9fyLJCPGQeXI2ML8c3P8BHOEV2VaAVf/pc=
github.com/gin-contrib/gzip v0.0.6 h1:NjcunTcGAj5CO1gn4N8jHOSIeRFHIbn51z6K+xaN4d4= github.com/gin-contrib/gzip v0.0.6 h1:NjcunTcGAj5CO1gn4N8jHOSIeRFHIbn51z6K+xaN4d4=
github.com/gin-contrib/gzip v0.0.6/go.mod h1:QOJlmV2xmayAjkNS2Y8NQsMneuRShOU/kjovCXNuzzk= github.com/gin-contrib/gzip v0.0.6/go.mod h1:QOJlmV2xmayAjkNS2Y8NQsMneuRShOU/kjovCXNuzzk=
github.com/gin-contrib/sessions v1.0.1 h1:3hsJyNs7v7N8OtelFmYXFrulAf6zSR7nW/putcPEHxI=
github.com/gin-contrib/sessions v1.0.1/go.mod h1:ouxSFM24/OgIud5MJYQJLpy6AwxQ5EYO9yLhbtObGkM=
github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE= github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE=
github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI= github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI=
github.com/gin-gonic/gin v1.8.1/go.mod h1:ji8BvRH1azfM+SYow9zQ6SZMvR8qOMZHmsCuWR9tTTk= github.com/gin-gonic/gin v1.8.1/go.mod h1:ji8BvRH1azfM+SYow9zQ6SZMvR8qOMZHmsCuWR9tTTk=
github.com/gin-gonic/gin v1.9.1 h1:4idEAncQnU5cB7BeOkPtxjfCSye0AAm1R0RVIqJ+Jmg= github.com/gin-gonic/gin v1.10.0 h1:nTuyha1TYqgedzytsKYqna+DfLos46nTv2ygFy86HFU=
github.com/gin-gonic/gin v1.9.1/go.mod h1:hPrL7YrpYKXt5YId3A/Tnip5kqbEAP+KLuI3SUcPTeU= github.com/gin-gonic/gin v1.10.0/go.mod h1:4PMNQiOhvDRa013RKVbsiNwoyezlm2rm0uX/T7kzp5Y=
github.com/glebarez/go-sqlite v1.21.1 h1:7MZyUPh2XTrHS7xNEHQbrhfMZuPSzhkm2A1qgg0y5NY= github.com/glebarez/go-sqlite v1.21.1 h1:7MZyUPh2XTrHS7xNEHQbrhfMZuPSzhkm2A1qgg0y5NY=
github.com/glebarez/go-sqlite v1.21.1/go.mod h1:ISs8MF6yk5cL4n/43rSOmVMGJJjHYr7L2MbZZ5Q4E2E= github.com/glebarez/go-sqlite v1.21.1/go.mod h1:ISs8MF6yk5cL4n/43rSOmVMGJJjHYr7L2MbZZ5Q4E2E=
github.com/glebarez/sqlite v1.8.0 h1:02X12E2I/4C1n+v90yTqrjRa8yuo7c3KeHI3FRznCvc= github.com/glebarez/sqlite v1.8.0 h1:02X12E2I/4C1n+v90yTqrjRa8yuo7c3KeHI3FRznCvc=
@@ -64,8 +63,8 @@ github.com/go-playground/universal-translator v0.18.0/go.mod h1:UvRDBj+xPUEGrFYl
github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY= github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY=
github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY= github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY=
github.com/go-playground/validator/v10 v10.10.0/go.mod h1:74x4gJWsvQexRdW8Pn3dXSGrTK4nAUsbPlLADvpJkos= github.com/go-playground/validator/v10 v10.10.0/go.mod h1:74x4gJWsvQexRdW8Pn3dXSGrTK4nAUsbPlLADvpJkos=
github.com/go-playground/validator/v10 v10.19.0 h1:ol+5Fu+cSq9JD7SoSqe04GMI92cbn0+wvQ3bZ8b/AU4= github.com/go-playground/validator/v10 v10.20.0 h1:K9ISHbSaI0lyB2eWMPJo+kOS/FBExVwjEviJTixqxL8=
github.com/go-playground/validator/v10 v10.19.0/go.mod h1:dbuPbCMFw/DrkbEynArYaCwl3amGuJotoKCe95atGMM= github.com/go-playground/validator/v10 v10.20.0/go.mod h1:dbuPbCMFw/DrkbEynArYaCwl3amGuJotoKCe95atGMM=
github.com/go-test/deep v1.0.8 h1:TDsG77qcSprGbC6vTN8OuXp5g+J+b5Pcguhf7Zt61VM= github.com/go-test/deep v1.0.8 h1:TDsG77qcSprGbC6vTN8OuXp5g+J+b5Pcguhf7Zt61VM=
github.com/go-test/deep v1.0.8/go.mod h1:5C2ZWiW0ErCdrYzpqxLbTX7MG14M9iiw8DgHncVwcsE= github.com/go-test/deep v1.0.8/go.mod h1:5C2ZWiW0ErCdrYzpqxLbTX7MG14M9iiw8DgHncVwcsE=
github.com/goccy/go-json v0.9.7/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= github.com/goccy/go-json v0.9.7/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I=
@@ -83,12 +82,20 @@ github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0=
github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/google/pprof v0.0.0-20221118152302-e6195bd50e26 h1:Xim43kblpZXfIBQsbuBVKCudVG457BR2GZFIz3uw3hQ= github.com/google/pprof v0.0.0-20221118152302-e6195bd50e26 h1:Xim43kblpZXfIBQsbuBVKCudVG457BR2GZFIz3uw3hQ=
github.com/google/pprof v0.0.0-20221118152302-e6195bd50e26/go.mod h1:dDKJzRmX4S37WGHujM7tX//fmj1uioxKzKxz3lo4HJo= github.com/google/pprof v0.0.0-20221118152302-e6195bd50e26/go.mod h1:dDKJzRmX4S37WGHujM7tX//fmj1uioxKzKxz3lo4HJo=
github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/gorilla/context v1.1.2 h1:WRkNAv2uoa03QNIc1A6u4O7DAGMUVoopZhkiXWA2V1o=
github.com/gorilla/context v1.1.2/go.mod h1:KDPwT9i/MeWHiLl90fuTgrt4/wPcv75vFAZLaOOcbxM=
github.com/gorilla/mux v1.8.0 h1:i40aqfkR1h2SlN9hojwV5ZA91wcXFOvkdNIeFDP5koI= github.com/gorilla/mux v1.8.0 h1:i40aqfkR1h2SlN9hojwV5ZA91wcXFOvkdNIeFDP5koI=
github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So= github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So=
github.com/gorilla/securecookie v1.1.2 h1:YCIWL56dvtr73r6715mJs5ZvhtnY73hBvEF8kXD8ePA=
github.com/gorilla/securecookie v1.1.2/go.mod h1:NfCASbcHqRSY+3a8tlWJwsQap2VX5pwzwo4h3eOamfo=
github.com/gorilla/sessions v1.2.2 h1:lqzMYz6bOfvn2WriPUjNByzeXIlVzURcPmgMczkmTjY=
github.com/gorilla/sessions v1.2.2/go.mod h1:ePLdVu+jbEgHH+KWw8I1z2wqd0BAdAQh/8LRvBeoNcQ=
github.com/invopop/yaml v0.1.0/go.mod h1:2XuRLgs/ouIrW3XNzuNj7J3Nvu/Dig5MXvbCEdiBN3Q= github.com/invopop/yaml v0.1.0/go.mod h1:2XuRLgs/ouIrW3XNzuNj7J3Nvu/Dig5MXvbCEdiBN3Q=
github.com/invopop/yaml v0.2.0 h1:7zky/qH+O0DwAyoobXUqvVBwgBFRxKoQ/3FjcVpjTMY= github.com/invopop/yaml v0.2.0 h1:7zky/qH+O0DwAyoobXUqvVBwgBFRxKoQ/3FjcVpjTMY=
github.com/invopop/yaml v0.2.0/go.mod h1:2XuRLgs/ouIrW3XNzuNj7J3Nvu/Dig5MXvbCEdiBN3Q= github.com/invopop/yaml v0.2.0/go.mod h1:2XuRLgs/ouIrW3XNzuNj7J3Nvu/Dig5MXvbCEdiBN3Q=
@@ -114,10 +121,10 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/labstack/echo/v4 v4.10.2 h1:n1jAhnq/elIFTHr1EYpiYtyKgx4RW9ccVgkqByZaN2M= github.com/labstack/echo/v4 v4.12.0 h1:IKpw49IMryVB2p1a4dzwlhP1O2Tf2E0Ir/450lH+kI0=
github.com/labstack/echo/v4 v4.10.2/go.mod h1:OEyqf2//K1DFdE57vw2DRgWY0M7s65IVQO2FzvI4J5k= github.com/labstack/echo/v4 v4.12.0/go.mod h1:UP9Cr2DJXbOK3Kr9ONYzNowSh7HP0aG0ShAyycHSJvM=
github.com/labstack/gommon v0.4.0 h1:y7cvthEAEbU0yHOf4axH8ZG2NH8knB9iNSoTO8dyIk8= github.com/labstack/gommon v0.4.2 h1:F8qTUNXgG1+6WQmqoUWnz8WiEU60mXVVw0P4ht1WRA0=
github.com/labstack/gommon v0.4.0/go.mod h1:uW6kP17uPlLJsD3ijUYn3/M5bAxtlZhMI6m3MFxTMTM= github.com/labstack/gommon v0.4.2/go.mod h1:QlUFxVM+SNXhDL/Z7YhocGIBYOiwB0mXm1+1bAPHPyU=
github.com/leodido/go-urn v1.2.1/go.mod h1:zt4jvISO2HfUBqxjfIshjdMTYS56ZS/qv49ictyFfxY= github.com/leodido/go-urn v1.2.1/go.mod h1:zt4jvISO2HfUBqxjfIshjdMTYS56ZS/qv49ictyFfxY=
github.com/leodido/go-urn v1.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ= github.com/leodido/go-urn v1.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ=
github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI= github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI=
@@ -125,7 +132,6 @@ github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN
github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0=
github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc=
github.com/mattn/go-colorable v0.1.11/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4=
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94=
@@ -140,8 +146,8 @@ github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjY
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 h1:RWengNIwukTxcDr9M+97sNutRR1RKhG96O6jWumTTnw= github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 h1:RWengNIwukTxcDr9M+97sNutRR1RKhG96O6jWumTTnw=
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826/go.mod h1:TaXosZuwdSHYgviHp1DAtfrULt5eUgsSMsZf+YrPgl8= github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826/go.mod h1:TaXosZuwdSHYgviHp1DAtfrULt5eUgsSMsZf+YrPgl8=
github.com/pelletier/go-toml/v2 v2.0.1/go.mod h1:r9LEWfGN8R5k0VXJ+0BkIe7MYkRdwZOjgMj2KwnJFUo= github.com/pelletier/go-toml/v2 v2.0.1/go.mod h1:r9LEWfGN8R5k0VXJ+0BkIe7MYkRdwZOjgMj2KwnJFUo=
github.com/pelletier/go-toml/v2 v2.2.0 h1:QLgLl2yMN7N+ruc31VynXs1vhMZa7CeHHejIeBAsoHo= github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM=
github.com/pelletier/go-toml/v2 v2.2.0/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs= github.com/pelletier/go-toml/v2 v2.2.2/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs=
github.com/perimeterx/marshmallow v1.1.4 h1:pZLDH9RjlLGGorbXhcaQLhfuV0pFMNfPO55FuFkxqLw= github.com/perimeterx/marshmallow v1.1.4 h1:pZLDH9RjlLGGorbXhcaQLhfuV0pFMNfPO55FuFkxqLw=
github.com/perimeterx/marshmallow v1.1.4/go.mod h1:dsXbUu8CRzfYP5a87xpp0xq9S3u0Vchtcl8we9tYaXw= github.com/perimeterx/marshmallow v1.1.4/go.mod h1:dsXbUu8CRzfYP5a87xpp0xq9S3u0Vchtcl8we9tYaXw=
github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA=
@@ -175,8 +181,8 @@ github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/tidwall/gjson v1.14.4 h1:uo0p8EbA09J7RQaflQ1aBRffTR7xedD2bcIVSYxLnkM= github.com/tidwall/gjson v1.17.0 h1:/Jocvlh98kcTfpN2+JzGQWQcqrPQwDrVEMApx/M5ZwM=
github.com/tidwall/gjson v1.14.4/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= github.com/tidwall/gjson v1.17.0/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=
github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA= github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA=
github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM= github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM=
github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU= github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU=
@@ -190,7 +196,6 @@ github.com/ugorji/go/codec v1.2.12 h1:9LC83zGrHhuUA9l16C9AHXAqEV/2wBQ4nkvumAE65E
github.com/ugorji/go/codec v1.2.12/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg= github.com/ugorji/go/codec v1.2.12/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg=
github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw= github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw=
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
github.com/valyala/fasttemplate v1.2.1/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ=
github.com/valyala/fasttemplate v1.2.2 h1:lxLXG0uE3Qnshl9QyaK6XJxMXlQZELvChBOCmQD0Loo= github.com/valyala/fasttemplate v1.2.2 h1:lxLXG0uE3Qnshl9QyaK6XJxMXlQZELvChBOCmQD0Loo=
github.com/valyala/fasttemplate v1.2.2/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ= github.com/valyala/fasttemplate v1.2.2/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ=
go.uber.org/atomic v1.10.0 h1:9qC72Qh0+3MqyJbAn8YU5xVq1frD8bn3JtD2oXtafVQ= go.uber.org/atomic v1.10.0 h1:9qC72Qh0+3MqyJbAn8YU5xVq1frD8bn3JtD2oXtafVQ=
@@ -202,8 +207,8 @@ go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN8
go.uber.org/zap v1.24.0 h1:FiJd5l1UOLj0wCgbSE0rwwXHzEdAZS6hiiSnxJN/D60= go.uber.org/zap v1.24.0 h1:FiJd5l1UOLj0wCgbSE0rwwXHzEdAZS6hiiSnxJN/D60=
go.uber.org/zap v1.24.0/go.mod h1:2kMP+WWQ8aoFoedH3T2sq6iJ2yDWpHbP0f6MQbS9Gkg= go.uber.org/zap v1.24.0/go.mod h1:2kMP+WWQ8aoFoedH3T2sq6iJ2yDWpHbP0f6MQbS9Gkg=
golang.org/x/arch v0.0.0-20210923205945-b76863e36670/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8= golang.org/x/arch v0.0.0-20210923205945-b76863e36670/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8=
golang.org/x/arch v0.7.0 h1:pskyeJh/3AmoQ8CPE95vxHLqp1G1GfGNXTmcl9NEKTc= golang.org/x/arch v0.8.0 h1:3wRIsP3pM4yUptoR96otTUOXI367OS0+c9eeRi9doIc=
golang.org/x/arch v0.7.0/go.mod h1:FEVrYAQjsQXMVJ1nsMoVVXPZg6p2JE2mx8psSWTDQys= golang.org/x/arch v0.8.0/go.mod h1:FEVrYAQjsQXMVJ1nsMoVVXPZg6p2JE2mx8psSWTDQys=
golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.25.0 h1:ypSNr+bnYL2YhwoMt2zPxHFmbAN1KZs/njMG3hxUp30= golang.org/x/crypto v0.25.0 h1:ypSNr+bnYL2YhwoMt2zPxHFmbAN1KZs/njMG3hxUp30=
golang.org/x/crypto v0.25.0/go.mod h1:T+wALwcMOSE0kXgUAnPAHqTLW+XHgcELELW8VaDgm/M= golang.org/x/crypto v0.25.0/go.mod h1:T+wALwcMOSE0kXgUAnPAHqTLW+XHgcELELW8VaDgm/M=
@@ -218,8 +223,6 @@ golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211103235746-7861aae1554b/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
@@ -230,14 +233,14 @@ golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4= golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4=
golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI=
golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4= golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk=
golang.org/x/time v0.3.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= google.golang.org/protobuf v1.34.1 h1:9ddQBjfCyZPOHPUiPxpYESBLc+T8P3E+Vo4IbKZgFWg=
google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= google.golang.org/protobuf v1.34.1/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
@@ -256,8 +259,6 @@ gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gorm.io/gorm v1.25.8 h1:WAGEZ/aEcznN4D03laj8DKnehe1e9gYQAjW8xyPRdeo= gorm.io/gorm v1.25.8 h1:WAGEZ/aEcznN4D03laj8DKnehe1e9gYQAjW8xyPRdeo=
gorm.io/gorm v1.25.8/go.mod h1:hbnx/Oo0ChWMn1BIhpy1oYozzpM15i4YPuHDmfYtwg8= gorm.io/gorm v1.25.8/go.mod h1:hbnx/Oo0ChWMn1BIhpy1oYozzpM15i4YPuHDmfYtwg8=
gotest.tools/v3 v3.4.0 h1:ZazjZUfuVeZGLAmlKKuyv3IKP5orXcwtOwDQH6YVr6o=
gotest.tools/v3 v3.4.0/go.mod h1:CtbdzLSsqVhDgMtKsx03ird5YTGB3ar27v0u/yKBW5g=
modernc.org/libc v1.22.4 h1:wymSbZb0AlrjdAVX3cjreCHTPCpPARbQXNz6BHPzdwQ= modernc.org/libc v1.22.4 h1:wymSbZb0AlrjdAVX3cjreCHTPCpPARbQXNz6BHPzdwQ=
modernc.org/libc v1.22.4/go.mod h1:jj+Z7dTNX8fBScMVNRAYZ/jF91K8fdT2hYMThc3YjBY= modernc.org/libc v1.22.4/go.mod h1:jj+Z7dTNX8fBScMVNRAYZ/jF91K8fdT2hYMThc3YjBY=
modernc.org/mathutil v1.5.0 h1:rV0Ko/6SfM+8G+yKiyI830l3Wuz1zRutdslNoQ0kfiQ= modernc.org/mathutil v1.5.0 h1:rV0Ko/6SfM+8G+yKiyI830l3Wuz1zRutdslNoQ0kfiQ=
+14 -13
View File
@@ -14,19 +14,19 @@ import (
"strings" "strings"
"time" "time"
"github.com/IceWhaleTech/CasaOS-Common/external" "github.com/KaySar12/NextZen-Common/external"
"github.com/IceWhaleTech/CasaOS-Common/model" "github.com/KaySar12/NextZen-Common/model"
util_http "github.com/IceWhaleTech/CasaOS-Common/utils/http" util_http "github.com/KaySar12/NextZen-Common/utils/http"
"github.com/IceWhaleTech/CasaOS-Common/utils/jwt" "github.com/KaySar12/NextZen-Common/utils/jwt"
"github.com/IceWhaleTech/CasaOS-Common/utils/logger" "github.com/KaySar12/NextZen-Common/utils/logger"
"github.com/IceWhaleTech/CasaOS-UserService/codegen/message_bus" "github.com/KaySar12/NextZen-UserService/codegen/message_bus"
"github.com/IceWhaleTech/CasaOS-UserService/common" "github.com/KaySar12/NextZen-UserService/common"
"github.com/IceWhaleTech/CasaOS-UserService/pkg/config" "github.com/KaySar12/NextZen-UserService/pkg/config"
"github.com/IceWhaleTech/CasaOS-UserService/pkg/sqlite" "github.com/KaySar12/NextZen-UserService/pkg/sqlite"
"github.com/IceWhaleTech/CasaOS-UserService/pkg/utils/encryption" "github.com/KaySar12/NextZen-UserService/pkg/utils/encryption"
"github.com/IceWhaleTech/CasaOS-UserService/pkg/utils/random" "github.com/KaySar12/NextZen-UserService/pkg/utils/random"
"github.com/IceWhaleTech/CasaOS-UserService/route" "github.com/KaySar12/NextZen-UserService/route"
"github.com/IceWhaleTech/CasaOS-UserService/service" "github.com/KaySar12/NextZen-UserService/service"
"github.com/coreos/go-systemd/daemon" "github.com/coreos/go-systemd/daemon"
"go.uber.org/zap" "go.uber.org/zap"
) )
@@ -125,6 +125,7 @@ func main() {
apiPaths := []string{ apiPaths := []string{
"/v1/users", "/v1/users",
"/v1/1panel",
route.V2APIPath, route.V2APIPath,
route.V2DocPath, route.V2DocPath,
"/" + jwt.JWKSPath, "/" + jwt.JWKSPath,
+1 -1
View File
@@ -18,5 +18,5 @@ type APPModel struct {
type Result struct { type Result struct {
Success int `json:"success" example:"200"` Success int `json:"success" example:"200"`
Message string `json:"message" example:"ok"` Message string `json:"message" example:"ok"`
Data interface{} `json:"data" example:"返回结果"` Data interface{} `json:"data" example:"Return result"`
} }
+2 -4
View File
@@ -5,8 +5,8 @@ import (
"log" "log"
"os" "os"
"github.com/IceWhaleTech/CasaOS-Common/utils/constants" "github.com/KaySar12/NextZen-Common/utils/constants"
"github.com/IceWhaleTech/CasaOS-UserService/model" "github.com/KaySar12/NextZen-UserService/model"
"gopkg.in/ini.v1" "gopkg.in/ini.v1"
) )
@@ -23,8 +23,6 @@ var (
LogPath: constants.DefaultLogPath, LogPath: constants.DefaultLogPath,
LogSaveName: "user", LogSaveName: "user",
LogFileExt: "log", LogFileExt: "log",
OMVServer: constants.DefaultOMVServer,
SecretKey: constants.DefaultSecretKey,
} }
Cfg *ini.File Cfg *ini.File
+4 -4
View File
@@ -12,10 +12,10 @@ package sqlite
import ( import (
"time" "time"
"github.com/IceWhaleTech/CasaOS-Common/utils/logger" "github.com/KaySar12/NextZen-Common/utils/logger"
"github.com/IceWhaleTech/CasaOS-UserService/model" "github.com/KaySar12/NextZen-UserService/model"
"github.com/IceWhaleTech/CasaOS-UserService/pkg/utils/file" "github.com/KaySar12/NextZen-UserService/pkg/utils/file"
model2 "github.com/IceWhaleTech/CasaOS-UserService/service/model" model2 "github.com/KaySar12/NextZen-UserService/service/model"
"github.com/glebarez/sqlite" "github.com/glebarez/sqlite"
"go.uber.org/zap" "go.uber.org/zap"
"gorm.io/gorm" "gorm.io/gorm"
+1 -1
View File
@@ -16,7 +16,7 @@ import (
"crypto/rand" "crypto/rand"
"encoding/hex" "encoding/hex"
"github.com/IceWhaleTech/CasaOS-UserService/pkg/config" "github.com/KaySar12/NextZen-UserService/pkg/config"
) )
var ( var (
+6 -6
View File
@@ -7,12 +7,12 @@ import (
"strings" "strings"
"time" "time"
"github.com/IceWhaleTech/CasaOS-Common/external" "github.com/KaySar12/NextZen-Common/external"
"github.com/IceWhaleTech/CasaOS-Common/utils/logger" "github.com/KaySar12/NextZen-Common/utils/logger"
message_bus "github.com/IceWhaleTech/CasaOS-UserService/codegen/message_bus" message_bus "github.com/KaySar12/NextZen-UserService/codegen/message_bus"
"github.com/IceWhaleTech/CasaOS-UserService/model" "github.com/KaySar12/NextZen-UserService/model"
"github.com/IceWhaleTech/CasaOS-UserService/pkg/config" "github.com/KaySar12/NextZen-UserService/pkg/config"
"github.com/IceWhaleTech/CasaOS-UserService/service" "github.com/KaySar12/NextZen-UserService/service"
"go.uber.org/zap" "go.uber.org/zap"
"golang.org/x/net/websocket" "golang.org/x/net/websocket"
) )
+29 -4
View File
@@ -4,11 +4,13 @@ import (
"crypto/ecdsa" "crypto/ecdsa"
"os" "os"
"github.com/IceWhaleTech/CasaOS-Common/middleware" "github.com/KaySar12/NextZen-Common/middleware"
"github.com/IceWhaleTech/CasaOS-Common/utils/jwt" "github.com/KaySar12/NextZen-Common/utils/jwt"
v1 "github.com/IceWhaleTech/CasaOS-UserService/route/v1" v1 "github.com/KaySar12/NextZen-UserService/route/v1"
"github.com/IceWhaleTech/CasaOS-UserService/service" "github.com/KaySar12/NextZen-UserService/service"
"github.com/gin-contrib/gzip" "github.com/gin-contrib/gzip"
"github.com/gin-contrib/sessions"
"github.com/gin-contrib/sessions/cookie"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
) )
@@ -18,12 +20,16 @@ func InitRouter() *gin.Engine {
r.Use(v1.CheckOIDCInit()) r.Use(v1.CheckOIDCInit())
r.Use(gzip.Gzip(gzip.DefaultCompression)) r.Use(gzip.Gzip(gzip.DefaultCompression))
store := cookie.NewStore([]byte("secret"))
sessionMiddleware := sessions.Sessions("1Panel", store)
r.Use(sessionMiddleware)
// check if environment variable is set // check if environment variable is set
if ginMode, success := os.LookupEnv("GIN_MODE"); success { if ginMode, success := os.LookupEnv("GIN_MODE"); success {
gin.SetMode(ginMode) gin.SetMode(ginMode)
} else { } else {
gin.SetMode(gin.ReleaseMode) gin.SetMode(gin.ReleaseMode)
} }
go v1.InitOIDC() go v1.InitOIDC()
r.POST("/v1/users/register", v1.PostUserRegister) r.POST("/v1/users/register", v1.PostUserRegister)
r.POST("/v1/users/login", v1.PostUserLogin) r.POST("/v1/users/login", v1.PostUserLogin)
@@ -40,6 +46,16 @@ func InitRouter() *gin.Engine {
r.GET("/v1/users/oidc/userinfo", v1.OIDCUserInfo) r.GET("/v1/users/oidc/userinfo", v1.OIDCUserInfo)
r.POST("/v1/users/oidc/validateToken", v1.OIDCValidateToken) r.POST("/v1/users/oidc/validateToken", v1.OIDCValidateToken)
r.POST("/v1/users/oidc/logout", v1.OIDCLogout) r.POST("/v1/users/oidc/logout", v1.OIDCLogout)
r.GET("/v1/users/oidc/health", v1.OIDCHealthCheck)
r.GET("/v1/users/oidc/settings", v1.GetOIDCSettings)
r.POST("/v1/users/oidc/saveSettings", v1.SaveOIDCSettings)
r.GET("/v1/1panel/health", v1.OnePanelHealthCheck)
// r.POST("/v1/1panel/login", v1.OnePanelLogin)
// r.POST("/v1/1panel/app/search", v1.ExternalAPIMiddleware, v1.OnePanelLogin)
// r.POST("/v1/1panel/website/search", v1.ExternalAPIMiddleware, v1.OnePanelLogin)
r.POST("/v1/1panel/website/create", v1.ExternalAPIMiddleware, v1.OnePanelCreateWebsite)
r.POST("/v1/1panel/website/delete", v1.ExternalAPIMiddleware, v1.OnePanelDeleteWebsite)
r.POST("/v1/1panel/website/update-proxy", v1.ExternalAPIMiddleware, v1.OnePanelUpdateProxyWebsite)
v1Group := r.Group("/v1") v1Group := r.Group("/v1")
v1Group.Use(jwt.JWT( v1Group.Use(jwt.JWT(
@@ -49,6 +65,15 @@ func InitRouter() *gin.Engine {
}, },
)) ))
{ {
// v1OnePanel := v1Group.Group("/1panel")
// v1OnePanel.Use()
// {
// r.GET("/health", v1.OnePanelHealthCheck)
// r.POST("/login", v1.OnePanelLogin)
// r.POST("/app/search", v1.ExternalAPIMiddleware, v1.OnePanelLogin)
// r.POST("/website/search", v1.ExternalAPIMiddleware, v1.OnePanelLogin)
// r.POST("/website/create", v1.ExternalAPIMiddleware, v1.OnePanelCreateWebsite)
// }
v1UsersGroup := v1Group.Group("/users") v1UsersGroup := v1Group.Group("/users")
v1UsersGroup.Use() v1UsersGroup.Use()
{ {
+394 -42
View File
@@ -23,19 +23,20 @@ import (
"strings" "strings"
"time" "time"
"github.com/IceWhaleTech/CasaOS-Common/external" "github.com/KaySar12/NextZen-Common/external"
"github.com/IceWhaleTech/CasaOS-Common/utils/common_err" "github.com/KaySar12/NextZen-Common/utils/common_err"
"github.com/IceWhaleTech/CasaOS-Common/utils/jwt" "github.com/KaySar12/NextZen-Common/utils/jwt"
"github.com/IceWhaleTech/CasaOS-Common/utils/logger" "github.com/KaySar12/NextZen-Common/utils/logger"
"github.com/IceWhaleTech/CasaOS-UserService/common" "github.com/KaySar12/NextZen-UserService/common"
"github.com/IceWhaleTech/CasaOS-UserService/model" "github.com/KaySar12/NextZen-UserService/model"
"github.com/IceWhaleTech/CasaOS-UserService/model/system_model" "github.com/KaySar12/NextZen-UserService/model/system_model"
"github.com/IceWhaleTech/CasaOS-UserService/pkg/config" "github.com/KaySar12/NextZen-UserService/pkg/config"
"github.com/IceWhaleTech/CasaOS-UserService/pkg/utils/encryption" "github.com/KaySar12/NextZen-UserService/pkg/utils/encryption"
"github.com/IceWhaleTech/CasaOS-UserService/pkg/utils/file" "github.com/KaySar12/NextZen-UserService/pkg/utils/file"
"github.com/IceWhaleTech/CasaOS-UserService/service" "github.com/KaySar12/NextZen-UserService/service"
model2 "github.com/IceWhaleTech/CasaOS-UserService/service/model" model2 "github.com/KaySar12/NextZen-UserService/service/model"
"github.com/coreos/go-oidc/v3/oidc" "github.com/coreos/go-oidc/v3/oidc"
"github.com/gin-contrib/sessions"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
uuid "github.com/satori/go.uuid" uuid "github.com/satori/go.uuid"
"github.com/tidwall/gjson" "github.com/tidwall/gjson"
@@ -45,16 +46,27 @@ import (
) )
var ( var (
//authServer = "http://10.0.0.26:9000"
authServer = "http://accessmanager.local" authServer = "http://accessmanager.local"
clientID = "6KwKSxLCtaQ4r6HoAn3gdNMbNOAf75j3SejLIAx7" clientID = "6KwKSxLCtaQ4r6HoAn3gdNMbNOAf75j3SejLIAx7"
clientSecret = "PE05fcDP4qESUmyZ1TNYpZNBxRPq70VpFI81vehsoJ6WhGz5yPXMljrFrOdMRdRhrYmF03fHWTZHgO9ZdNENrLN13BzL8CAgtEkTsyjXfgx9GvISheIjYfpSfvo219fL" clientSecret = "PE05fcDP4qESUmyZ1TNYpZNBxRPq70VpFI81vehsoJ6WhGz5yPXMljrFrOdMRdRhrYmF03fHWTZHgO9ZdNENrLN13BzL8CAgtEkTsyjXfgx9GvISheIjYfpSfvo219fL"
authURL = "http://accessmanager.local/application/o/nextzenos-oidc/" authURL = "http://accessmanager.local/application/o/nextzenos-oidc/"
//authURL = "http://10.0.0.26:9000/application/o/nextzenos-oidc/"
callbackURL = "http://nextzenos.local/v1/users/oidc/callback" callbackURL = "http://nextzenos.local/v1/users/oidc/callback"
//callbackURL = "http://172.20.60.244:8080/v1/users/oidc/callback" onePanelServer = "http://nextweb.local"
onePanelName = "nextzen"
onePanelPassword = "Smartyourlife123@*"
authentik_api_token = "jidFioAIXpgl8awyk2O17K8W7vZzlXhOO0QXGxEhMDJdn9g747EQjmaI0i3e"
) )
type OIDCSetting struct {
Settings struct {
ClientID string `json:"clientId"`
ClientSecret string `json:"clientSecret"`
Issuer string `json:"issuer"`
AuthURL string `json:"authUrl"`
CallbackURL string `json:"callbackUrl"`
} `json:"settings"`
}
// @Summary register user // @Summary register user
// @Router /user/register/ [post] // @Router /user/register/ [post]
func PostUserRegister(c *gin.Context) { func PostUserRegister(c *gin.Context) {
@@ -104,14 +116,279 @@ func PostUserRegister(c *gin.Context) {
var limiter = rate.NewLimiter(rate.Every(time.Minute), 5) var limiter = rate.NewLimiter(rate.Every(time.Minute), 5)
// @Summary login // TODO Cant call login every request(using for testing only)
// @Produce application/json func ExternalAPIMiddleware(c *gin.Context) {
// @Accept application/json session := sessions.Default(c)
// @Tags user if err := OnePanelLogin(c); err != nil {
// @Param user_name query string true "User name" c.JSON(http.StatusUnauthorized, model.Result{
// @Param pwd query string true "password" Success: common_err.SERVICE_ERROR,
// @Success 200 {string} string "ok" Message: common_err.GetMsg(common_err.SERVICE_ERROR),
// @Router /user/login [post] })
c.Abort()
return
}
sessionId := session.Get("psession")
if sessionId == nil {
c.JSON(http.StatusInternalServerError, model.Result{
Success: common_err.SERVICE_ERROR,
Message: common_err.GetMsg(common_err.SERVICE_ERROR),
})
c.Abort()
return
}
// Add sessionId to the request's Cookie header
c.Request.Header.Set("Cookie", "psession="+sessionId.(string))
c.Next()
}
func OnePanelLogin(c *gin.Context) error {
cred := model2.OnePanelCredentials{
Name: onePanelName,
Password: onePanelPassword,
IgnoreCaptcha: true,
Captcha: "",
CaptchaID: "",
AuthMethod: "session",
Language: "en",
}
response, cookies, err := service.MyService.OnePanel().Login(cred, onePanelServer)
fmt.Println(response)
if err != nil {
logger.Error("OnePanel login failed", zap.Error(err))
return err
}
session := sessions.Default(c)
for _, cookie := range cookies {
session.Set(cookie.Name, cookie.Value)
session.Options(sessions.Options{
MaxAge: 3600, // 12hrs
})
}
if err := session.Save(); err != nil {
logger.Error("Failed to save session", zap.Error(err))
return err
}
return nil
}
// func OnePanelLogin(c *gin.Context) {
// var cred = model2.OnePanelCredentials{
// Name: onePanelName,
// Password: onePanelPassword,
// IgnoreCaptcha: true,
// Captcha: "",
// CaptchaID: "",
// AuthMethod: "session",
// Language: "en",
// }
// response, cookies, err := service.MyService.OnePanel().Login(cred, onePanelServer)
// if err != nil {
// c.JSON(common_err.SERVICE_ERROR,
// model.Result{
// Success: common_err.SERVICE_ERROR,
// Message: common_err.GetMsg(common_err.SERVICE_ERROR),
// })
// }
// session := sessions.Default(c)
// for _, cookie := range cookies {
// session.Set(cookie.Name, cookie.Value)
// c.SetCookie(cookie.Name, cookie.Value, 3600, "/", "", false, true)
// }
// session.Save()
// c.JSON(common_err.SUCCESS,
// model.Result{
// Success: common_err.SUCCESS,
// Message: common_err.GetMsg(common_err.SUCCESS),
// Data: response,
// })
// }
func OnePanelUpdateProxyWebsite(c *gin.Context) {
json := make(map[string]string)
c.ShouldBind(&json)
domain := json["domain"]
port := json["port"]
hostname := json["hostname"]
protocol := json["protocol"]
var searchParam model2.SearchWebsiteRequest
searchParam.Name = domain
searchParam.Page = 1
searchParam.PageSize = 1
searchParam.OrderBy = "created_at"
searchParam.Order = "null"
searchParam.WebsiteGroupID = 0
headers := make(map[string]string)
for key, value := range c.Request.Header {
headers[key] = value[0]
}
var search model2.SearchWebsiteResponse
search, err := service.MyService.OnePanel().SearchWebsite(searchParam, onePanelServer, headers)
if err != nil {
c.JSON(common_err.SERVICE_ERROR,
model.Result{
Success: common_err.SERVICE_ERROR,
Message: common_err.GetMsg(common_err.SERVICE_ERROR),
})
}
if search.Data.Total > 0 {
var proxy model2.ProxyWebsiteRequest
proxy.ID = search.Data.Items[0].ID
var proxyResult model2.ProxyWebsiteResponse
proxyResult, err := service.MyService.OnePanel().GetProxyWebsite(proxy, onePanelServer, headers)
if err != nil {
c.JSON(common_err.SERVICE_ERROR,
model.Result{
Success: common_err.SERVICE_ERROR,
Message: common_err.GetMsg(common_err.SERVICE_ERROR),
})
}
var updateProxy model2.ProxyDetail
updateProxy = proxyResult.Data[0]
updateProxy.Operate = "edit"
updateProxy.ProxyPass = protocol + "://" + hostname + ":" + port
updateProxyResult, err := service.MyService.OnePanel().UpdateProxyWebsite(updateProxy, onePanelServer, headers)
if err != nil {
c.JSON(common_err.SERVICE_ERROR,
model.Result{
Success: common_err.SERVICE_ERROR,
Message: common_err.GetMsg(common_err.SERVICE_ERROR),
})
}
c.JSON(common_err.SUCCESS,
model.Result{
Success: common_err.SUCCESS,
Message: common_err.GetMsg(common_err.SUCCESS),
Data: updateProxyResult,
})
return
}
c.JSON(common_err.SUCCESS,
model.Result{
Success: common_err.SUCCESS,
Message: common_err.GetMsg(common_err.SUCCESS),
})
}
func OnePanelCreateWebsite(c *gin.Context) {
json := make(map[string]string)
c.ShouldBind(&json)
domain := json["domain"]
port := json["port"]
protocol := json["protocol"]
hostname := json["hostname"]
var website model2.CreateWebsiteRequest
website.PrimaryDomain = domain
website.Type = "proxy"
website.Alias = domain
website.AppType = "installed"
website.WebSiteGroupID = 2
website.Proxy = protocol + "://" + hostname + ":" + port
portInt, err := strconv.ParseInt(port, 10, 64)
if err != nil {
log.Printf("Error converting port to integer: %v", err)
}
website.Port = portInt
website.ProxyProtocol = protocol
website.ProxyAddress = hostname + ":" + port
website.RuntimeType = "php"
headers := make(map[string]string)
for key, value := range c.Request.Header {
headers[key] = value[0]
}
var searchParam model2.SearchWebsiteRequest
searchParam.Name = website.PrimaryDomain
searchParam.Page = 1
searchParam.PageSize = 1
searchParam.OrderBy = "created_at"
searchParam.Order = "null"
searchParam.WebsiteGroupID = 0
search, err := service.MyService.OnePanel().SearchWebsite(searchParam, onePanelServer, headers)
if err != nil {
c.JSON(common_err.SERVICE_ERROR,
model.Result{
Success: common_err.SERVICE_ERROR,
Message: common_err.GetMsg(common_err.SERVICE_ERROR),
})
}
if search.Data.Total == 0 {
response, err := service.MyService.OnePanel().CreateWebsite(website, onePanelServer, headers)
if err != nil {
c.JSON(common_err.SERVICE_ERROR,
model.Result{
Success: common_err.SERVICE_ERROR,
Message: common_err.GetMsg(common_err.SERVICE_ERROR),
})
}
c.JSON(common_err.SUCCESS,
model.Result{
Success: common_err.SUCCESS,
Message: common_err.GetMsg(common_err.SUCCESS),
Data: response,
})
return
}
c.JSON(common_err.SUCCESS,
model.Result{
Success: common_err.SUCCESS,
Message: common_err.GetMsg(common_err.SUCCESS),
})
}
func OnePanelDeleteWebsite(c *gin.Context) {
json := make(map[string]string)
c.ShouldBind(&json)
domain := json["domain"]
var searchParam model2.SearchWebsiteRequest
searchParam.Name = domain
searchParam.Page = 1
searchParam.PageSize = 1
searchParam.OrderBy = "created_at"
searchParam.Order = "null"
searchParam.WebsiteGroupID = 0
headers := make(map[string]string)
for key, value := range c.Request.Header {
headers[key] = value[0]
}
search, err := service.MyService.OnePanel().SearchWebsite(searchParam, onePanelServer, headers)
if err != nil {
c.JSON(common_err.SERVICE_ERROR,
model.Result{
Success: common_err.SERVICE_ERROR,
Message: common_err.GetMsg(common_err.SERVICE_ERROR),
})
}
if search.Data.Total > 0 {
var delete model2.DeleteWebsiteRequest
delete.ID = search.Data.Items[0].ID
delete.DeleteApp = false
delete.DeleteBackup = false
delete.ForceDelete = false
response, err := service.MyService.OnePanel().DeleteWebsite(delete, onePanelServer, headers)
if err != nil {
c.JSON(common_err.SERVICE_ERROR,
model.Result{
Success: common_err.SERVICE_ERROR,
Message: common_err.GetMsg(common_err.SERVICE_ERROR),
})
}
c.JSON(common_err.SUCCESS,
model.Result{
Success: common_err.SUCCESS,
Message: common_err.GetMsg(common_err.SUCCESS),
Data: response,
})
return
}
c.JSON(common_err.SUCCESS,
model.Result{
Success: common_err.SUCCESS,
Message: common_err.GetMsg(common_err.SUCCESS),
})
}
func PostUserLogin(c *gin.Context) { func PostUserLogin(c *gin.Context) {
if !limiter.Allow() { if !limiter.Allow() {
c.JSON(common_err.TOO_MANY_REQUEST, c.JSON(common_err.TOO_MANY_REQUEST,
@@ -219,10 +496,12 @@ func InitOIDC() {
oidcInit = true oidcInit = true
failCount = 0 failCount = 0
successCount++ successCount++
// TODO will enable in production
// Exponential backoff with a cap // Exponential backoff with a cap
sleepTime = minSleep * time.Duration(successCount) // sleepTime = minSleep * time.Duration(successCount)
if sleepTime > maxSleep { if sleepTime > maxSleep {
sleepTime = maxSleep // TODO will enable in production
// sleepTime = maxSleep
} }
} else { } else {
@@ -232,7 +511,8 @@ func InitOIDC() {
// Exponential backoff with a cap // Exponential backoff with a cap
sleepTime = minSleep * time.Duration(failCount) sleepTime = minSleep * time.Duration(failCount)
if failCount > maxRetryBackoff { if failCount > maxRetryBackoff {
sleepTime = minSleep * time.Duration(maxRetryBackoff) // TODO will enable in production
// sleepTime = minSleep * time.Duration(maxRetryBackoff)
} }
log.Printf("OIDC initialization failed: %v. Retrying in %v", err, sleepTime) log.Printf("OIDC initialization failed: %v. Retrying in %v", err, sleepTime)
} }
@@ -246,7 +526,7 @@ func CheckOIDCInit() gin.HandlerFunc {
return func(c *gin.Context) { return func(c *gin.Context) {
if !oidcInit { if !oidcInit {
log.Println("Provider is Offline") log.Println("Provider is Offline")
c.JSON(http.StatusServiceUnavailable, model.Result{Success: http.StatusServiceUnavailable, Message: "Authentik Server is Offline"}) c.JSON(http.StatusServiceUnavailable, model.Result{Success: common_err.OIDC_OFFLINE, Message: "Authentik Server is Offline"})
return return
} }
c.Next() c.Next()
@@ -255,6 +535,14 @@ func CheckOIDCInit() gin.HandlerFunc {
// Use an init function to initialize the oauth2Config variable. // Use an init function to initialize the oauth2Config variable.
func OIDC() error { func OIDC() error {
authentik, err := service.MyService.Authentik().GetSettings()
if (authentik != model2.AuthentikCredentialsDBModel{} && err == nil) {
clientID = authentik.ClientID
clientSecret = authentik.ClientSecret
authServer = authentik.Issuer
authURL = authentik.AuthUrl
callbackURL = authentik.CallbackUrl
}
ctx := context.Background() ctx := context.Background()
provider, err := oidc.NewProvider(ctx, authURL) provider, err := oidc.NewProvider(ctx, authURL)
if err != nil { if err != nil {
@@ -265,19 +553,36 @@ func OIDC() error {
ClientSecret: clientSecret, ClientSecret: clientSecret,
RedirectURL: callbackURL, RedirectURL: callbackURL,
Endpoint: provider.Endpoint(), Endpoint: provider.Endpoint(),
Scopes: []string{oidc.ScopeOpenID, "profile", "email", "goauthentik.io/api"}, Scopes: []string{oidc.ScopeOpenID, "profile", "email", "offline_access", "goauthentik.io/api"},
//add offline access for refresh token //add offline access for refresh token
} }
return nil return nil
} }
func GetOIDCSettings(c *gin.Context) {
authentik, err := service.MyService.Authentik().GetSettings()
if err != nil {
c.JSON(common_err.SERVICE_ERROR,
model.Result{
Success: common_err.SERVICE_ERROR,
Message: common_err.GetMsg(common_err.SERVICE_ERROR),
})
return
}
c.JSON(common_err.SUCCESS,
model.Result{
Success: common_err.SUCCESS,
Message: common_err.GetMsg(common_err.SUCCESS),
Data: authentik,
})
return
}
func OIDCLogin(c *gin.Context) { func OIDCLogin(c *gin.Context) {
json := make(map[string]string) json := make(map[string]string)
c.ShouldBind(&json) c.ShouldBind(&json)
state := json["state"] state := json["state"]
// w := c.Writer callBackUrl := fmt.Sprintf("%s/%s", json["baseUrl"], "v1/users/oidc/callback")
// r := c.Request
// setCallbackCookie(w, r, "state", state) oauth2Config.RedirectURL = callBackUrl
// c.Redirect(http.StatusFound, oauth2Config.AuthCodeURL(state))
c.JSON(common_err.SUCCESS, c.JSON(common_err.SUCCESS,
model.Result{ model.Result{
Success: common_err.SUCCESS, Success: common_err.SUCCESS,
@@ -285,6 +590,30 @@ func OIDCLogin(c *gin.Context) {
Data: oauth2Config.AuthCodeURL(state), Data: oauth2Config.AuthCodeURL(state),
}) })
} }
func SaveOIDCSettings(c *gin.Context) {
var oidcSetting OIDCSetting
var authentik model2.AuthentikCredentialsDBModel
c.ShouldBind(&oidcSetting)
authentik.ClientID = oidcSetting.Settings.ClientID
authentik.ClientSecret = oidcSetting.Settings.ClientSecret
authentik.Issuer = oidcSetting.Settings.Issuer
authentik.AuthUrl = oidcSetting.Settings.AuthURL
authentik.CallbackUrl = oidcSetting.Settings.CallbackURL
var result, err = service.MyService.Authentik().UpdateSettings(authentik)
if err != nil {
c.JSON(common_err.SERVICE_ERROR,
model.Result{
Success: common_err.SERVICE_ERROR,
Message: common_err.GetMsg(common_err.SERVICE_ERROR),
})
}
c.JSON(common_err.SUCCESS,
model.Result{
Success: common_err.SUCCESS,
Message: common_err.GetMsg(common_err.SUCCESS),
Data: result,
})
}
func OIDCCallback(c *gin.Context) { func OIDCCallback(c *gin.Context) {
w := c.Writer w := c.Writer
r := c.Request r := c.Request
@@ -304,14 +633,15 @@ func OIDCCallback(c *gin.Context) {
return return
} }
expiryDuration := time.Until(oauth2Token.Expiry) expiryDuration := time.Until(oauth2Token.Expiry)
c.SetCookie("accessToken", oauth2Token.AccessToken, int(expiryDuration.Seconds()), "/", "", false, true) c.SetCookie("authentik_accessToken", oauth2Token.AccessToken, int(expiryDuration.Seconds()), "/", "", false, true)
// c.SetCookie("refreshToken", oauth2Token.RefreshToken, int(expiryDuration.Seconds()), "/", "", false, true) // c.SetCookie("authentik_refreshToken", oauth2Token.RefreshToken, int(expiryDuration.Seconds()), "/", "", false, true)
c.Redirect(http.StatusFound, state) c.Redirect(http.StatusFound, state)
} }
func OIDCUserInfo(c *gin.Context) { func OIDCUserInfo(c *gin.Context) {
json := make(map[string]string) json := make(map[string]string)
c.ShouldBind(&json) c.ShouldBind(&json)
accessToken, err := c.Cookie("accessToken") accessToken, err := c.Cookie("authentik_accessToken")
if err != nil { if err != nil {
c.Redirect(http.StatusFound, "/#/oidc") c.Redirect(http.StatusFound, "/#/oidc")
} }
@@ -327,13 +657,29 @@ func OIDCUserInfo(c *gin.Context) {
Data: authentikUser, Data: authentikUser,
}) })
} }
func OIDCHealthCheck(c *gin.Context) {
var status string
status, err := service.MyService.Authentik().HealthCheck(authServer)
if err != nil {
c.JSON(http.StatusOK, model.Result{Success: common_err.OIDC_OFFLINE, Message: common_err.GetMsg(common_err.OIDC_OFFLINE), Data: "Offline"})
return
}
if status == "Starting" {
c.JSON(http.StatusOK, model.Result{Success: common_err.OIDC_STARTING, Message: common_err.GetMsg(common_err.OIDC_OFFLINE), Data: "Starting"})
return
}
c.JSON(http.StatusOK, model.Result{Success: common_err.OIDC_LIVE, Message: common_err.GetMsg(common_err.OIDC_LIVE), Data: "Live"})
}
func OIDCValidateToken(c *gin.Context) { func OIDCValidateToken(c *gin.Context) {
json := make(map[string]string) json := make(map[string]string)
c.ShouldBind(&json) c.ShouldBind(&json)
accessToken := json["authentikToken"] accessToken, err := c.Cookie("authentik_accessToken")
if err != nil {
c.Redirect(http.StatusFound, "/#/oidc")
}
var validateToken model2.AuthentikToken var validateToken model2.AuthentikToken
validateToken, err := service.MyService.Authentik().ValidateToken(clientID, clientSecret, accessToken, authServer) validateToken, err = service.MyService.Authentik().ValidateToken(clientID, clientSecret, accessToken, authServer)
if err != nil { if err != nil {
c.JSON(http.StatusUnauthorized, model.Result{Success: common_err.ERROR_AUTH_TOKEN, Message: common_err.GetMsg(common_err.ERROR_AUTH_TOKEN)}) c.JSON(http.StatusUnauthorized, model.Result{Success: common_err.ERROR_AUTH_TOKEN, Message: common_err.GetMsg(common_err.ERROR_AUTH_TOKEN)})
return return
@@ -345,11 +691,8 @@ func OIDCValidateToken(c *gin.Context) {
c.JSON(http.StatusOK, model.Result{Success: common_err.ERROR_AUTH_TOKEN, Message: common_err.GetMsg(common_err.ERROR_AUTH_TOKEN)}) c.JSON(http.StatusOK, model.Result{Success: common_err.ERROR_AUTH_TOKEN, Message: common_err.GetMsg(common_err.ERROR_AUTH_TOKEN)})
} }
func OIDCLogout(c *gin.Context) { func OIDCLogout(c *gin.Context) {
json := make(map[string]string) json := make(map[string]string)
c.ShouldBind(&json) c.ShouldBind(&json)
accessToken := json["authentikToken"]
fmt.Println(accessToken)
flow := "/if/flow/default-authentication-flow/" flow := "/if/flow/default-authentication-flow/"
next := "/application/o/authorize/" next := "/application/o/authorize/"
@@ -364,11 +707,11 @@ func OIDCLogout(c *gin.Context) {
} }
func OIDCProfile(c *gin.Context) { func OIDCProfile(c *gin.Context) {
if !oidcInit { if !oidcInit {
c.Redirect(http.StatusFound, "/#/authentik-offline")
} }
json := make(map[string]string) json := make(map[string]string)
c.ShouldBind(&json) c.ShouldBind(&json)
accessToken, err := c.Cookie("accessToken") accessToken, err := c.Cookie("authentik_accessToken")
if err != nil { if err != nil {
c.Redirect(http.StatusFound, "/#/oidc") c.Redirect(http.StatusFound, "/#/oidc")
} }
@@ -394,6 +737,7 @@ func OIDCProfile(c *gin.Context) {
user = model2.UserDBModel{ user = model2.UserDBModel{
Username: authentikUser.User.Username, Username: authentikUser.User.Username,
Password: hashPassword(), Password: hashPassword(),
Email: authentikUser.User.Email,
Role: determineUserRole(authentikUser.User.IsSuperuser), Role: determineUserRole(authentikUser.User.IsSuperuser),
Avatar: authentikUser.User.Avatar, Avatar: authentikUser.User.Avatar,
} }
@@ -428,6 +772,14 @@ func determineUserRole(isSuperuser bool) string {
} }
return "user" return "user"
} }
func OnePanelHealthCheck(c *gin.Context) {
status, err := service.MyService.OnePanel().HealthCheck(onePanelServer)
if err != nil || status == "Offline" {
c.JSON(http.StatusOK, model.Result{Success: common_err.OIDC_OFFLINE, Message: common_err.GetMsg(common_err.OIDC_OFFLINE), Data: "Offline"})
return
}
c.JSON(http.StatusOK, model.Result{Success: common_err.OIDC_LIVE, Message: common_err.GetMsg(common_err.OIDC_LIVE), Data: "Live"})
}
func hashPassword() string { func hashPassword() string {
generatePassword, err := randString(16) generatePassword, err := randString(16)
+4 -4
View File
@@ -7,10 +7,10 @@ import (
"strconv" "strconv"
"strings" "strings"
"github.com/IceWhaleTech/CasaOS-Common/utils/jwt" "github.com/KaySar12/NextZen-Common/utils/jwt"
codegen "github.com/IceWhaleTech/CasaOS-UserService/codegen/user_service" codegen "github.com/KaySar12/NextZen-UserService/codegen/user_service"
v2 "github.com/IceWhaleTech/CasaOS-UserService/route/v2" v2 "github.com/KaySar12/NextZen-UserService/route/v2"
"github.com/IceWhaleTech/CasaOS-UserService/service" "github.com/KaySar12/NextZen-UserService/service"
"github.com/deepmap/oapi-codegen/pkg/middleware" "github.com/deepmap/oapi-codegen/pkg/middleware"
"github.com/getkin/kin-openapi/openapi3" "github.com/getkin/kin-openapi/openapi3"
"github.com/getkin/kin-openapi/openapi3filter" "github.com/getkin/kin-openapi/openapi3filter"
+2 -2
View File
@@ -3,8 +3,8 @@ package v2
import ( import (
"net/http" "net/http"
codegen "github.com/IceWhaleTech/CasaOS-UserService/codegen/user_service" codegen "github.com/KaySar12/NextZen-UserService/codegen/user_service"
"github.com/IceWhaleTech/CasaOS-UserService/service" "github.com/KaySar12/NextZen-UserService/service"
"github.com/labstack/echo/v4" "github.com/labstack/echo/v4"
) )
+1 -1
View File
@@ -1,6 +1,6 @@
package v2 package v2
import codegen "github.com/IceWhaleTech/CasaOS-UserService/codegen/user_service" import codegen "github.com/KaySar12/NextZen-UserService/codegen/user_service"
type UserService struct{} type UserService struct{}
+368
View File
@@ -0,0 +1,368 @@
package service
import (
"bytes"
"encoding/json"
"fmt"
"log"
"net/http"
model2 "github.com/KaySar12/NextZen-UserService/service/model"
)
type OnePanelService interface {
Login(m model2.OnePanelCredentials, baseURL string) (model2.LoginResponse, []*http.Cookie, error)
Logout(m model2.OnePanelCredentials, baseURL string) (model2.LogoutResponse, error)
HealthCheck(baseURL string) (string, error)
SearchInstalledApp(p model2.InstalledAppRequest, baseURL string) (model2.InstalledAppResponse, error)
// InstallApp()
SearchWebsite(m model2.SearchWebsiteRequest, baseUrl string, headers map[string]string) (model2.SearchWebsiteResponse, error)
CreateWebsite(m model2.CreateWebsiteRequest, baseUrl string, headers map[string]string) (model2.GenericResponse, error)
DeleteWebsite(m model2.DeleteWebsiteRequest, baseUrl string, headers map[string]string) (model2.GenericResponse, error)
GetProxyWebsite(m model2.ProxyWebsiteRequest, baseUrl string, headers map[string]string) (model2.ProxyWebsiteResponse, error)
UpdateProxyWebsite(m model2.ProxyDetail, baseUrl string, headers map[string]string) (model2.GenericResponse, error)
AcmeAccountSearch(m model2.AcmeSearchRequest, baseUrl string, headers map[string]string) (model2.AcmeSearchResponse, error)
ApplyWebsiteSSl(m model2.CreateSSLRequest, baseUrl string, headers map[string]string) (model2.CreateSSLResponse, error)
SearchWebsiteSSl(m model2.SearchSSLRequest, baseUrl string, headers map[string]string) (model2.SearchSSLResponse, error)
//UpdateWebsiteProtocol
}
var (
prefixV1 = "/api/v1"
)
type onePanelService struct {
}
// TODO A lot of redundant code need refactor
func (o *onePanelService) SearchWebsiteSSl(m model2.SearchSSLRequest, baseUrl string, headers map[string]string) (model2.SearchSSLResponse, error) {
path := baseUrl + "/api/v1/websites/ssl/search"
reqBody, err := json.Marshal(m)
if err != nil {
return model2.SearchSSLResponse{}, fmt.Errorf("error marshaling request body: %v", err)
}
req, err := http.NewRequest("POST", path, bytes.NewReader(reqBody))
if err != nil {
return model2.SearchSSLResponse{}, fmt.Errorf("error creating request: %v", err)
}
// Add headers to the request
for key, value := range headers {
req.Header.Set(key, value)
}
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
return model2.SearchSSLResponse{}, fmt.Errorf("error making request: %v", err)
}
defer resp.Body.Close()
if resp.StatusCode < 200 || resp.StatusCode >= 300 {
return model2.SearchSSLResponse{}, fmt.Errorf("HTTP error: %s", resp.Status)
}
var result model2.SearchSSLResponse
if err := json.NewDecoder(resp.Body).Decode(&result); err != nil {
return model2.SearchSSLResponse{}, fmt.Errorf("error decoding response: %v", err)
}
return result, nil
}
func (o *onePanelService) ApplyWebsiteSSl(m model2.CreateSSLRequest, baseUrl string, headers map[string]string) (model2.CreateSSLResponse, error) {
path := baseUrl + "/api/v1/websites/ssl"
reqBody, err := json.Marshal(m)
if err != nil {
return model2.CreateSSLResponse{}, fmt.Errorf("error marshaling request body: %v", err)
}
req, err := http.NewRequest("POST", path, bytes.NewReader(reqBody))
if err != nil {
return model2.CreateSSLResponse{}, fmt.Errorf("error creating request: %v", err)
}
// Add headers to the request
for key, value := range headers {
req.Header.Set(key, value)
}
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
return model2.CreateSSLResponse{}, fmt.Errorf("error making request: %v", err)
}
defer resp.Body.Close()
if resp.StatusCode < 200 || resp.StatusCode >= 300 {
return model2.CreateSSLResponse{}, fmt.Errorf("HTTP error: %s", resp.Status)
}
var result model2.CreateSSLResponse
if err := json.NewDecoder(resp.Body).Decode(&result); err != nil {
return model2.CreateSSLResponse{}, fmt.Errorf("error decoding response: %v", err)
}
return result, nil
}
func (o *onePanelService) AcmeAccountSearch(m model2.AcmeSearchRequest, baseUrl string, headers map[string]string) (model2.AcmeSearchResponse, error) {
path := baseUrl + "/api/v1/websites/acme/search"
reqBody, err := json.Marshal(m)
if err != nil {
return model2.AcmeSearchResponse{}, fmt.Errorf("error marshaling request body: %v", err)
}
req, err := http.NewRequest("POST", path, bytes.NewReader(reqBody))
if err != nil {
return model2.AcmeSearchResponse{}, fmt.Errorf("error creating request: %v", err)
}
// Add headers to the request
for key, value := range headers {
req.Header.Set(key, value)
}
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
return model2.AcmeSearchResponse{}, fmt.Errorf("error making request: %v", err)
}
defer resp.Body.Close()
if resp.StatusCode < 200 || resp.StatusCode >= 300 {
return model2.AcmeSearchResponse{}, fmt.Errorf("HTTP error: %s", resp.Status)
}
var result model2.AcmeSearchResponse
if err := json.NewDecoder(resp.Body).Decode(&result); err != nil {
return model2.AcmeSearchResponse{}, fmt.Errorf("error decoding response: %v", err)
}
return result, nil
}
func (o *onePanelService) UpdateProxyWebsite(m model2.ProxyDetail, baseUrl string, headers map[string]string) (model2.GenericResponse, error) {
path := baseUrl + "/api/v1/websites/proxies/update"
reqBody, err := json.Marshal(m)
if err != nil {
return model2.GenericResponse{}, fmt.Errorf("error marshaling request body: %v", err)
}
req, err := http.NewRequest("POST", path, bytes.NewReader(reqBody))
if err != nil {
return model2.GenericResponse{}, fmt.Errorf("error creating request: %v", err)
}
// Add headers to the request
for key, value := range headers {
req.Header.Set(key, value)
}
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
return model2.GenericResponse{}, fmt.Errorf("error making request: %v", err)
}
defer resp.Body.Close()
if resp.StatusCode < 200 || resp.StatusCode >= 300 {
return model2.GenericResponse{}, fmt.Errorf("HTTP error: %s", resp.Status)
}
var result model2.GenericResponse
if err := json.NewDecoder(resp.Body).Decode(&result); err != nil {
return model2.GenericResponse{}, fmt.Errorf("error decoding response: %v", err)
}
return result, nil
}
func (o *onePanelService) GetProxyWebsite(m model2.ProxyWebsiteRequest, baseUrl string, headers map[string]string) (model2.ProxyWebsiteResponse, error) {
path := baseUrl + "/api/v1/websites/proxies"
reqBody, err := json.Marshal(m)
if err != nil {
return model2.ProxyWebsiteResponse{}, fmt.Errorf("error marshaling request body: %v", err)
}
req, err := http.NewRequest("POST", path, bytes.NewReader(reqBody))
if err != nil {
return model2.ProxyWebsiteResponse{}, fmt.Errorf("error creating request: %v", err)
}
// Add headers to the request
for key, value := range headers {
req.Header.Set(key, value)
}
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
return model2.ProxyWebsiteResponse{}, fmt.Errorf("error making request: %v", err)
}
defer resp.Body.Close()
if resp.StatusCode < 200 || resp.StatusCode >= 300 {
return model2.ProxyWebsiteResponse{}, fmt.Errorf("HTTP error: %s", resp.Status)
}
var result model2.ProxyWebsiteResponse
if err := json.NewDecoder(resp.Body).Decode(&result); err != nil {
return model2.ProxyWebsiteResponse{}, fmt.Errorf("error decoding response: %v", err)
}
return result, nil
}
func (o *onePanelService) SearchWebsite(m model2.SearchWebsiteRequest, baseUrl string, headers map[string]string) (model2.SearchWebsiteResponse, error) {
path := baseUrl + "/api/v1/websites/search"
reqBody, err := json.Marshal(m)
if err != nil {
return model2.SearchWebsiteResponse{}, fmt.Errorf("error marshaling request body: %v", err)
}
req, err := http.NewRequest("POST", path, bytes.NewReader(reqBody))
if err != nil {
return model2.SearchWebsiteResponse{}, fmt.Errorf("error creating request: %v", err)
}
// Add headers to the request
for key, value := range headers {
req.Header.Set(key, value)
}
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
return model2.SearchWebsiteResponse{}, fmt.Errorf("error making request: %v", err)
}
defer resp.Body.Close()
if resp.StatusCode < 200 || resp.StatusCode >= 300 {
return model2.SearchWebsiteResponse{}, fmt.Errorf("HTTP error: %s", resp.Status)
}
var result model2.SearchWebsiteResponse
if err := json.NewDecoder(resp.Body).Decode(&result); err != nil {
return model2.SearchWebsiteResponse{}, fmt.Errorf("error decoding response: %v", err)
}
return result, nil
}
func (o *onePanelService) CreateWebsite(m model2.CreateWebsiteRequest, baseUrl string, headers map[string]string) (model2.GenericResponse, error) {
path := baseUrl + "/api/v1/websites"
reqBody, err := json.Marshal(m)
if err != nil {
return model2.GenericResponse{}, fmt.Errorf("error marshaling request body: %v", err)
}
req, err := http.NewRequest("POST", path, bytes.NewReader(reqBody))
if err != nil {
return model2.GenericResponse{}, fmt.Errorf("error creating request: %v", err)
}
// Add headers to the request
for key, value := range headers {
req.Header.Set(key, value)
}
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
return model2.GenericResponse{}, fmt.Errorf("error making request: %v", err)
}
defer resp.Body.Close()
if resp.StatusCode < 200 || resp.StatusCode >= 300 {
return model2.GenericResponse{}, fmt.Errorf("HTTP error: %s", resp.Status)
}
var result model2.GenericResponse
if err := json.NewDecoder(resp.Body).Decode(&result); err != nil {
return model2.GenericResponse{}, fmt.Errorf("error decoding response: %v", err)
}
return result, nil
}
func (o *onePanelService) DeleteWebsite(m model2.DeleteWebsiteRequest, baseUrl string, headers map[string]string) (model2.GenericResponse, error) {
path := baseUrl + "/api/v1/websites/del"
reqBody, err := json.Marshal(m)
if err != nil {
return model2.GenericResponse{}, fmt.Errorf("error marshaling request body: %v", err)
}
req, err := http.NewRequest("POST", path, bytes.NewReader(reqBody))
if err != nil {
return model2.GenericResponse{}, fmt.Errorf("error creating request: %v", err)
}
// Add headers to the request
for key, value := range headers {
req.Header.Set(key, value)
}
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
return model2.GenericResponse{}, fmt.Errorf("error making request: %v", err)
}
defer resp.Body.Close()
if resp.StatusCode < 200 || resp.StatusCode >= 300 {
return model2.GenericResponse{}, fmt.Errorf("HTTP error: %s", resp.Status)
}
var result model2.GenericResponse
if err := json.NewDecoder(resp.Body).Decode(&result); err != nil {
return model2.GenericResponse{}, fmt.Errorf("error decoding response: %v", err)
}
return result, nil
}
func (o *onePanelService) SearchInstalledApp(m model2.InstalledAppRequest, baseUrl string) (model2.InstalledAppResponse, error) {
path := baseUrl + "/api/v1/websites/search"
reqBody, err := json.Marshal(m)
if err != nil {
return model2.InstalledAppResponse{}, fmt.Errorf("error marshaling request body: %v", err)
}
req, err := http.NewRequest("POST", path, bytes.NewReader(reqBody))
// req.AddCookie()
if err != nil {
return model2.InstalledAppResponse{}, fmt.Errorf("error creating request: %v", err)
}
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
return model2.InstalledAppResponse{}, fmt.Errorf("error making request: %v", err)
}
defer resp.Body.Close()
if resp.StatusCode < 200 || resp.StatusCode >= 300 {
return model2.InstalledAppResponse{}, fmt.Errorf("HTTP error: %s", resp.Status)
}
var result model2.InstalledAppResponse
if err := json.NewDecoder(resp.Body).Decode(&result); err != nil {
return model2.InstalledAppResponse{}, fmt.Errorf("error decoding response: %v", err)
}
return result, nil
}
func (o *onePanelService) Login(m model2.OnePanelCredentials, baseURL string) (model2.LoginResponse, []*http.Cookie, error) {
path := baseURL + prefixV1 + "/auth/login"
// Create the request body by marshaling the credentials into JSON
reqBody, err := json.Marshal(m)
if err != nil {
return model2.LoginResponse{}, []*http.Cookie{}, fmt.Errorf("error marshaling request body: %v", err)
}
req, err := http.NewRequest("POST", path, bytes.NewReader(reqBody))
if err != nil {
return model2.LoginResponse{}, []*http.Cookie{}, fmt.Errorf("error creating request: %v", err)
}
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Accept", "application/json")
// Reuse the HTTP client (consider making it a field in onePanelService)
client := &http.Client{}
resp, err := client.Do(req)
cookies := resp.Cookies()
if err != nil {
return model2.LoginResponse{}, []*http.Cookie{}, fmt.Errorf("error making request: %v", err)
}
defer resp.Body.Close()
if resp.StatusCode < 200 || resp.StatusCode >= 300 {
return model2.LoginResponse{}, []*http.Cookie{}, fmt.Errorf("HTTP error: %s", resp.Status)
}
var result model2.LoginResponse
if err := json.NewDecoder(resp.Body).Decode(&result); err != nil {
return model2.LoginResponse{}, []*http.Cookie{}, fmt.Errorf("error decoding response: %v", err)
}
return result, cookies, nil
}
func (o *onePanelService) Logout(m model2.OnePanelCredentials, baseURL string) (model2.LogoutResponse, error) {
return model2.LogoutResponse{}, nil
}
func (o *onePanelService) HealthCheck(baseURL string) (string, error) {
path := baseURL + "/health"
req, err := http.NewRequest("GET", path, nil)
if err != nil {
log.Println("Error creating health/live request:", err)
return "Offline", err
}
client := &http.Client{
CheckRedirect: func(req *http.Request, via []*http.Request) error {
return nil // Always follow redirects
},
}
respLive, err := client.Do(req)
if err != nil {
log.Println("Error on health/live request:", err)
return "Offline", err // Exit if the request fails
}
defer respLive.Body.Close()
if respLive.StatusCode == http.StatusOK {
return "Live", nil
}
return "Offline", err
}
func NewOnePanelService() OnePanelService {
return &onePanelService{}
}
+89 -13
View File
@@ -9,17 +9,18 @@ import (
"net/url" "net/url"
"strings" "strings"
model2 "github.com/IceWhaleTech/CasaOS-UserService/service/model" model2 "github.com/KaySar12/NextZen-UserService/service/model"
"gorm.io/gorm" "gorm.io/gorm"
) )
type AuthentikService interface { type AuthentikService interface {
GetUserInfo(accessToken string, baseURL string) (model2.AuthentikUser, error) GetUserInfo(accessToken string, baseURL string) (model2.AuthentikUser, error)
GetUserApp(accessToken string, baseURL string) (model2.AuthentikApplication, error) GetUserApp(accessToken string, baseURL string) (model2.AuthentikApplication, error)
CreateCredential(m model2.AuthentikCredentialsDBModel) model2.AuthentikCredentialsDBModel CreateSettings(m model2.AuthentikCredentialsDBModel) model2.AuthentikCredentialsDBModel
UpdateCredential(m model2.AuthentikCredentialsDBModel) model2.AuthentikCredentialsDBModel UpdateSettings(m model2.AuthentikCredentialsDBModel) (model2.AuthentikCredentialsDBModel, error)
GetCredential(id int) model2.AuthentikCredentialsDBModel GetSettings() (model2.AuthentikCredentialsDBModel, error)
ValidateToken(clientId string, clientSecret string, accessToken string, baseURL string) (model2.AuthentikToken, error) ValidateToken(clientId string, clientSecret string, accessToken string, baseURL string) (model2.AuthentikToken, error)
HealthCheck(baseURL string) (string, error)
} }
type authentikService struct { type authentikService struct {
@@ -30,18 +31,93 @@ var (
APICorePrefix = "/api/v3/core" APICorePrefix = "/api/v3/core"
) )
func (a *authentikService) CreateCredential(m model2.AuthentikCredentialsDBModel) model2.AuthentikCredentialsDBModel { func (a *authentikService) CreateSettings(m model2.AuthentikCredentialsDBModel) model2.AuthentikCredentialsDBModel {
a.db.Create(&m) a.db.Create(&m)
return m return m
} }
func (a *authentikService) UpdateCredential(m model2.AuthentikCredentialsDBModel) model2.AuthentikCredentialsDBModel { func (a *authentikService) UpdateSettings(m model2.AuthentikCredentialsDBModel) (model2.AuthentikCredentialsDBModel, error) {
a.db.Model(&m).Where("id = ?", m.Id).Updates(m) // Find the first matching record
return m var existing model2.AuthentikCredentialsDBModel
result := a.db.First(&existing)
if result.Error != nil {
return existing, result.Error
}
// Update the existing record
existing.ClientID = m.ClientID
existing.ClientSecret = m.ClientSecret
existing.Issuer = m.Issuer
existing.AuthUrl = m.AuthUrl
existing.CallbackUrl = m.CallbackUrl
// Save the updated record
result = a.db.Save(&existing)
if result.Error != nil {
return existing, result.Error
}
return existing, nil
} }
func (a *authentikService) GetCredential(id int) model2.AuthentikCredentialsDBModel { func (a *authentikService) GetSettings() (model2.AuthentikCredentialsDBModel, error) {
var m model2.AuthentikCredentialsDBModel var m model2.AuthentikCredentialsDBModel
a.db.Limit(1).Where("id = ?", id).First(&m) result := a.db.First(&m)
return m if result.Error != nil {
return model2.AuthentikCredentialsDBModel{}, result.Error
}
return m, nil
}
func (a *authentikService) HealthCheck(baseURL string) (string, error) {
// Check health/live first
pathLive := baseURL + "/-/health/live/"
reqLive, err := http.NewRequest("GET", pathLive, nil)
if err != nil {
log.Println("Error creating health/live request:", err)
return "Offline", err
}
client := &http.Client{
CheckRedirect: func(req *http.Request, via []*http.Request) error {
return nil // Always follow redirects
},
}
respLive, err := client.Do(reqLive)
if err != nil {
log.Println("Error on health/live request:", err)
return "Offline", err // Exit if the request fails
}
defer respLive.Body.Close()
// Check if health/live is 204 before proceeding
if respLive.StatusCode == http.StatusNoContent {
// Now check health/ready
pathReady := baseURL + "/-/health/ready/"
reqReady, err := http.NewRequest("GET", pathReady, nil)
if err != nil {
log.Println("Error creating health/ready request:", err)
return "Offline", err
}
respReady, err := client.Do(reqReady)
if err != nil {
log.Println("Error on health/ready request:", err)
return "Offline", err
}
defer respReady.Body.Close()
if respReady.StatusCode != http.StatusNoContent {
log.Println("HTTP error on health/ready:", respReady.Status)
return "Starting", nil
} else {
log.Println("Authentik is fully healthy!")
return "Live", nil
}
} else {
log.Println("HTTP error on health/live:", respLive.Status)
return "Offline", err
}
} }
func (a *authentikService) ValidateToken(clientId string, clientSecret string, accessToken string, baseURL string) (model2.AuthentikToken, error) { func (a *authentikService) ValidateToken(clientId string, clientSecret string, accessToken string, baseURL string) (model2.AuthentikToken, error) {
auth := clientId + ":" + clientSecret auth := clientId + ":" + clientSecret
@@ -49,8 +125,8 @@ func (a *authentikService) ValidateToken(clientId string, clientSecret string, a
path := baseURL + "/application/o/introspect/" path := baseURL + "/application/o/introspect/"
formData := url.Values{} formData := url.Values{}
formData.Set("token", accessToken) formData.Set("token", accessToken)
responseBody := strings.NewReader(formData.Encode()) reqBody := strings.NewReader(formData.Encode())
req, err := http.NewRequest("POST", path, responseBody) req, err := http.NewRequest("POST", path, reqBody)
if err != nil { if err != nil {
return model2.AuthentikToken{}, fmt.Errorf("error creating request: %v", err) return model2.AuthentikToken{}, fmt.Errorf("error creating request: %v", err)
} }
+1 -1
View File
@@ -3,7 +3,7 @@ package service
import ( import (
"encoding/json" "encoding/json"
"github.com/IceWhaleTech/CasaOS-UserService/model" "github.com/KaySar12/NextZen-UserService/model"
"gorm.io/gorm" "gorm.io/gorm"
) )
+47
View File
@@ -0,0 +1,47 @@
package model
import "time"
type InstalledAppRequest struct {
Page int `json:"page"`
PageSize int `json:"pageSize"`
Name string `json:"name"`
Tags []interface{} `json:"tags"`
Update bool `json:"update"`
Sync bool `json:"sync"`
}
type InstalledAppResponse struct {
Code int `json:"code"`
Message string `json:"message"`
Data struct {
Total int `json:"total"`
Items []struct {
ID int `json:"id"`
Name string `json:"name"`
AppID int `json:"appID"`
AppDetailID int `json:"appDetailID"`
Version string `json:"version"`
Status string `json:"status"`
Message string `json:"message"`
HTTPPort int `json:"httpPort"`
HTTPSPort int `json:"httpsPort"`
Path string `json:"path"`
CanUpdate bool `json:"canUpdate"`
Icon string `json:"icon"`
AppName string `json:"appName"`
Ready int `json:"ready"`
Total int `json:"total"`
AppKey string `json:"appKey"`
AppType string `json:"appType"`
AppStatus string `json:"appStatus"`
DockerCompose string `json:"dockerCompose"`
CreatedAt time.Time `json:"createdAt"`
App struct {
Website string `json:"website"`
Document string `json:"document"`
Github string `json:"github"`
} `json:"app"`
} `json:"items"`
} `json:"data"`
}
+127
View File
@@ -0,0 +1,127 @@
package model
import "time"
type CreateSSLRequest struct {
ID int `json:"id"`
PrimaryDomain string `json:"primaryDomain"`
OtherDomains string `json:"otherDomains"`
Provider string `json:"provider"`
WebsiteID int `json:"websiteId"`
AcmeAccountID int `json:"acmeAccountId"`
AutoRenew bool `json:"autoRenew"`
KeyType string `json:"keyType"`
PushDir bool `json:"pushDir"`
Dir string `json:"dir"`
Description string `json:"description"`
DisableCNAME bool `json:"disableCNAME"`
SkipDNS bool `json:"skipDNS"`
Nameserver1 string `json:"nameserver1"`
Nameserver2 string `json:"nameserver2"`
ExecShell bool `json:"execShell"`
Shell string `json:"shell"`
}
type CreateSSLResponse struct {
Code int `json:"code"`
Message string `json:"message"`
Data struct {
PrimaryDomain string `json:"primaryDomain"`
OtherDomains string `json:"otherDomains"`
Provider string `json:"provider"`
AcmeAccountID int `json:"acmeAccountId"`
DNSAccountID int `json:"dnsAccountId"`
AutoRenew bool `json:"autoRenew"`
KeyType string `json:"keyType"`
Apply bool `json:"apply"`
PushDir bool `json:"pushDir"`
Dir string `json:"dir"`
ID int `json:"id"`
Description string `json:"description"`
DisableCNAME bool `json:"disableCNAME"`
SkipDNS bool `json:"skipDNS"`
Nameserver1 string `json:"nameserver1"`
Nameserver2 string `json:"nameserver2"`
ExecShell bool `json:"execShell"`
Shell string `json:"shell"`
} `json:"data"`
}
type AcmeSearchRequest struct {
Page int `json:"page"`
PageSize int `json:"pageSize"`
}
type SearchSSLRequest struct {
Page int `json:"page"`
PageSize int `json:"pageSize"`
}
type SearchSSLResponse struct {
Code int `json:"code"`
Message string `json:"message"`
Data struct {
Total int `json:"total"`
Items []struct {
ID int `json:"id"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
PrimaryDomain string `json:"primaryDomain"`
PrivateKey string `json:"privateKey"`
Pem string `json:"pem"`
Domains string `json:"domains"`
CertURL string `json:"certURL"`
Type string `json:"type"`
Provider string `json:"provider"`
Organization string `json:"organization"`
DNSAccountID int `json:"dnsAccountId"`
AcmeAccountID int `json:"acmeAccountId"`
CaID int `json:"caId"`
AutoRenew bool `json:"autoRenew"`
ExpireDate time.Time `json:"expireDate"`
StartDate time.Time `json:"startDate"`
Status string `json:"status"`
Message string `json:"message"`
KeyType string `json:"keyType"`
PushDir bool `json:"pushDir"`
Dir string `json:"dir"`
Description string `json:"description"`
SkipDNS bool `json:"skipDNS"`
Nameserver1 string `json:"nameserver1"`
Nameserver2 string `json:"nameserver2"`
DisableCNAME bool `json:"disableCNAME"`
ExecShell bool `json:"execShell"`
Shell string `json:"shell"`
AcmeAccount AcmeAccount `json:"acmeAccount"`
DNSAccount DNSAccount `json:"dnsAccount"`
Websites []interface{} `json:"websites"`
LogPath string `json:"logPath"`
} `json:"items"`
} `json:"data"`
}
type AcmeSearchResponse struct {
Code int `json:"code"`
Message string `json:"message"`
Data struct {
Total int `json:"total"`
Items []AcmeAccount `json:"items"`
} `json:"data"`
}
type AcmeAccount struct {
ID int `json:"id"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
Email string `json:"email"`
URL string `json:"url"`
Type string `json:"type"`
EabKid string `json:"eabKid"`
EabHmacKey string `json:"eabHmacKey"`
KeyType string `json:"keyType"`
}
type DNSAccount struct {
ID int `json:"id"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
Name string `json:"name"`
Type string `json:"type"`
}
+195
View File
@@ -0,0 +1,195 @@
package model
import "time"
type SearchWebsiteRequest struct {
Name string `json:"name"`
Page int `json:"page"`
PageSize int `json:"pageSize"`
OrderBy string `json:"orderBy"`
Order string `json:"order"`
WebsiteGroupID int `json:"websiteGroupId"`
}
type SearchWebsiteResponse struct {
Code int `json:"code"`
Message string `json:"message"`
Data struct {
Total int `json:"total"`
Items []struct {
ID int `json:"id"`
CreatedAt time.Time `json:"createdAt"`
Protocol string `json:"protocol"`
PrimaryDomain string `json:"primaryDomain"`
Type string `json:"type"`
Alias string `json:"alias"`
Remark string `json:"remark"`
Status string `json:"status"`
ExpireDate time.Time `json:"expireDate"`
SitePath string `json:"sitePath"`
AppName string `json:"appName"`
RuntimeName string `json:"runtimeName"`
SslExpireDate time.Time `json:"sslExpireDate"`
SslStatus string `json:"sslStatus"`
AppInstallID int `json:"appInstallId"`
RuntimeType string `json:"runtimeType"`
} `json:"items"`
} `json:"data"`
}
type CreateWebsiteRequest struct {
PrimaryDomain string `json:"primaryDomain"`
Type string `json:"type,omitempty"`
Alias string `json:"alias,omitempty"`
Remark string `json:"remark,omitempty"`
AppType string `json:"appType,omitempty"`
WebSiteGroupID int64 `json:"webSiteGroupId,omitempty"`
OtherDomains string `json:"otherDomains,omitempty"`
Proxy string `json:"proxy,omitempty"`
Appinstall struct {
AppID int64 `json:"appId,omitempty"`
Name string `json:"name,omitempty"`
AppDetailID int64 `json:"appDetailId,omitempty"`
Params struct{} `json:"params,omitempty"`
Version string `json:"version,omitempty"`
Appkey string `json:"appkey,omitempty"`
Advanced bool `json:"advanced,omitempty"`
CPUQuota int64 `json:"cpuQuota,omitempty"`
MemoryLimit int64 `json:"memoryLimit,omitempty"`
MemoryUnit string `json:"memoryUnit,omitempty"`
ContainerName string `json:"containerName,omitempty"`
AllowPort bool `json:"allowPort,omitempty"`
} `json:"appinstall,omitempty"`
IPV6 bool `json:"IPV6,omitempty"`
EnableFtp bool `json:"enableFtp,omitempty"`
FtpUser string `json:"ftpUser,omitempty"`
FtpPassword string `json:"ftpPassword,omitempty"`
ProxyType string `json:"proxyType,omitempty"`
Port int64 `json:"port,omitempty"`
ProxyProtocol string `json:"proxyProtocol,omitempty"`
ProxyAddress string `json:"proxyAddress,omitempty"`
RuntimeType string `json:"runtimeType,omitempty"`
}
type DeleteWebsiteRequest struct {
ID int `json:"id"`
DeleteApp bool `json:"deleteApp"`
DeleteBackup bool `json:"deleteBackup"`
ForceDelete bool `json:"forceDelete"`
}
type GenericResponse struct {
Code int `json:"code"`
Message string `json:"message"`
Data struct {
} `json:"data"`
}
type ProxyWebsiteRequest struct {
ID int `json:"id"`
}
type ProxyWebsiteResponse struct {
Code int `json:"code"`
Message string `json:"message"`
Data []ProxyDetail `json:"data"`
}
type ProxyDetail struct {
ID int `json:"id"`
Operate string `json:"operate"`
Enable bool `json:"enable"`
Cache bool `json:"cache"`
CacheTime int `json:"cacheTime"`
CacheUnit string `json:"cacheUnit"`
Name string `json:"name"`
Modifier string `json:"modifier"`
Match string `json:"match"`
ProxyPass string `json:"proxyPass"`
ProxyHost string `json:"proxyHost"`
Content string `json:"content"`
FilePath string `json:"filePath"`
Replaces struct {
} `json:"replaces"`
Sni bool `json:"sni"`
ProxyProtocol string `json:"proxyProtocol"`
ProxyAddress string `json:"proxyAddress"`
}
type WebsiteHttpsRequest struct {
AcmeAccountID int `json:"acmeAccountID"`
Enable bool `json:"enable"`
WebsiteID int `json:"websiteId"`
WebsiteSSLID int `json:"websiteSSLId"`
Type string `json:"type"`
ImportType string `json:"importType"`
PrivateKey string `json:"privateKey"`
Certificate string `json:"certificate"`
PrivateKeyPath string `json:"privateKeyPath"`
CertificatePath string `json:"certificatePath"`
HTTPConfig string `json:"httpConfig"`
Hsts bool `json:"hsts"`
Algorithm string `json:"algorithm"`
SSLProtocol []string `json:"SSLProtocol"`
}
type WebsiteHttpsResponse struct {
Code int `json:"code"`
Message string `json:"message"`
Data struct {
Enable bool `json:"enable"`
HTTPConfig string `json:"httpConfig"`
SSL struct {
ID int `json:"id"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
PrimaryDomain string `json:"primaryDomain"`
PrivateKey string `json:"privateKey"`
Pem string `json:"pem"`
Domains string `json:"domains"`
CertURL string `json:"certURL"`
Type string `json:"type"`
Provider string `json:"provider"`
Organization string `json:"organization"`
DNSAccountID int `json:"dnsAccountId"`
AcmeAccountID int `json:"acmeAccountId"`
CaID int `json:"caId"`
AutoRenew bool `json:"autoRenew"`
ExpireDate time.Time `json:"expireDate"`
StartDate time.Time `json:"startDate"`
Status string `json:"status"`
Message string `json:"message"`
KeyType string `json:"keyType"`
PushDir bool `json:"pushDir"`
Dir string `json:"dir"`
Description string `json:"description"`
SkipDNS bool `json:"skipDNS"`
Nameserver1 string `json:"nameserver1"`
Nameserver2 string `json:"nameserver2"`
DisableCNAME bool `json:"disableCNAME"`
ExecShell bool `json:"execShell"`
Shell string `json:"shell"`
AcmeAccount struct {
ID int `json:"id"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
Email string `json:"email"`
URL string `json:"url"`
Type string `json:"type"`
EabKid string `json:"eabKid"`
EabHmacKey string `json:"eabHmacKey"`
KeyType string `json:"keyType"`
} `json:"acmeAccount"`
DNSAccount struct {
ID int `json:"id"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
Name string `json:"name"`
Type string `json:"type"`
} `json:"dnsAccount"`
Websites interface{} `json:"websites"`
} `json:"SSL"`
SSLProtocol []string `json:"SSLProtocol"`
Algorithm string `json:"algorithm"`
Hsts bool `json:"hsts"`
} `json:"data"`
}
+4 -2
View File
@@ -2,12 +2,14 @@ package model
import "time" import "time"
// Soon to be removed // TODO Refreshtoken
type AuthentikCredentialsDBModel struct { type AuthentikCredentialsDBModel struct {
Id int `gorm:"column:id;primary_key" json:"id"` Id int `gorm:"column:id;primary_key" json:"id"`
ClientID string `json:"clientId"` ClientID string `json:"clientId"`
ClientSecret string `json:"clientSecret"` ClientSecret string `json:"clientSecret"`
Server string `json:"server"` Issuer string `json:"issuer"`
AuthUrl string `json:"authUrl"`
CallbackUrl string `json:"callbackUrl"`
CreatedAt time.Time `gorm:"<-:create;autoCreateTime" json:"created_at,omitempty"` CreatedAt time.Time `gorm:"<-:create;autoCreateTime" json:"created_at,omitempty"`
UpdatedAt time.Time `gorm:"<-:create;<-:update;autoUpdateTime" json:"updated_at,omitempty"` UpdatedAt time.Time `gorm:"<-:create;<-:update;autoUpdateTime" json:"updated_at,omitempty"`
} }
+28
View File
@@ -0,0 +1,28 @@
package model
type OnePanelCredentials struct {
Name string `json:"name"`
Password string `json:"password"`
IgnoreCaptcha bool `json:"ignoreCaptcha"`
Captcha string `json:"captcha"`
CaptchaID string `json:"captchaID"`
AuthMethod string `json:"authMethod"`
Language string `json:"language"`
}
type LoginResponse struct {
Code int `json:"code"`
Message string `json:"message"`
Data struct {
Name string `json:"name"`
Token string `json:"token"`
MfaStatus string `json:"mfaStatus"`
} `json:"data"`
}
type LogoutResponse struct {
Code int `json:"code"`
Message string `json:"message"`
Data struct {
} `json:"data"`
}
+2 -2
View File
@@ -9,8 +9,8 @@ import (
"net/http" "net/http"
"os" "os"
"github.com/IceWhaleTech/CasaOS-UserService/pkg/config" "github.com/KaySar12/NextZen-UserService/pkg/config"
"github.com/IceWhaleTech/CasaOS-UserService/service/model" "github.com/KaySar12/NextZen-UserService/service/model"
) )
type OMVService interface { type OMVService interface {
+9 -3
View File
@@ -1,9 +1,9 @@
package service package service
import ( import (
"github.com/IceWhaleTech/CasaOS-Common/external" "github.com/KaySar12/NextZen-Common/external"
"github.com/IceWhaleTech/CasaOS-UserService/codegen/message_bus" "github.com/KaySar12/NextZen-UserService/codegen/message_bus"
"github.com/IceWhaleTech/CasaOS-UserService/pkg/config" "github.com/KaySar12/NextZen-UserService/pkg/config"
"gorm.io/gorm" "gorm.io/gorm"
) )
@@ -16,6 +16,7 @@ type Repository interface {
Event() EventService Event() EventService
OMV() OMVService OMV() OMVService
Authentik() AuthentikService Authentik() AuthentikService
OnePanel() OnePanelService
} }
func NewService(db *gorm.DB, RuntimePath string) Repository { func NewService(db *gorm.DB, RuntimePath string) Repository {
@@ -31,6 +32,7 @@ func NewService(db *gorm.DB, RuntimePath string) Repository {
event: NewEventService(db), event: NewEventService(db),
omv: NewOMVService(), omv: NewOMVService(),
authentik: NewAuthentikService(db), authentik: NewAuthentikService(db),
onePanel: NewOnePanelService(),
} }
} }
@@ -40,8 +42,12 @@ type store struct {
event EventService event EventService
omv OMVService omv OMVService
authentik AuthentikService authentik AuthentikService
onePanel OnePanelService
} }
func (c *store) OnePanel() OnePanelService {
return c.onePanel
}
func (c *store) Event() EventService { func (c *store) Event() EventService {
return c.event return c.event
} }
+3 -4
View File
@@ -15,9 +15,9 @@ import (
"mime/multipart" "mime/multipart"
"os" "os"
"github.com/IceWhaleTech/CasaOS-Common/utils/jwt" "github.com/KaySar12/NextZen-Common/utils/jwt"
"github.com/IceWhaleTech/CasaOS-Common/utils/logger" "github.com/KaySar12/NextZen-Common/utils/logger"
"github.com/IceWhaleTech/CasaOS-UserService/service/model" "github.com/KaySar12/NextZen-UserService/service/model"
"go.uber.org/zap" "go.uber.org/zap"
"gorm.io/gorm" "gorm.io/gorm"
) )
@@ -35,7 +35,6 @@ type UserService interface {
DeleteAllUser() DeleteAllUser()
GetUserInfoByUserName(userName string) (m model.UserDBModel) GetUserInfoByUserName(userName string) (m model.UserDBModel)
GetAllUserName() (list []model.UserDBModel) GetAllUserName() (list []model.UserDBModel)
GetKeyPair() (*ecdsa.PrivateKey, *ecdsa.PublicKey) GetKeyPair() (*ecdsa.PrivateKey, *ecdsa.PublicKey)
} }