🚚 Rename package

This commit is contained in:
LittleSheep 2024-04-13 13:48:19 +08:00
parent d1f54099c4
commit e5d53ab77b
43 changed files with 94 additions and 94 deletions

View File

@ -25,4 +25,4 @@ jobs:
context: .
file: ./Dockerfile
push: true
tags: xsheep2010/identity:nightly
tags: xsheep2010/passport:nightly

View File

@ -1,5 +1,5 @@
# Building Backend
FROM golang:alpine as identity-server
FROM golang:alpine as passport-server
RUN apk add nodejs npm
@ -14,8 +14,8 @@ RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -buildvcs -o /dist ./pkg/cmd/
# Runtime
FROM golang:alpine
COPY --from=identity-server /dist /identity/server
COPY --from=passport-server /dist /passport/server
EXPOSE 8444
CMD ["/identity/server"]
CMD ["/passport/server"]

2
go.mod
View File

@ -1,4 +1,4 @@
module git.solsynth.dev/hydrogen/identity
module git.solsynth.dev/hydrogen/passport
go 1.21.5

View File

@ -5,14 +5,14 @@ import (
"os/signal"
"syscall"
"git.solsynth.dev/hydrogen/identity/pkg/external"
"git.solsynth.dev/hydrogen/identity/pkg/grpc"
"git.solsynth.dev/hydrogen/identity/pkg/server"
"git.solsynth.dev/hydrogen/identity/pkg/services"
"git.solsynth.dev/hydrogen/passport/pkg/external"
"git.solsynth.dev/hydrogen/passport/pkg/grpc"
"git.solsynth.dev/hydrogen/passport/pkg/server"
"git.solsynth.dev/hydrogen/passport/pkg/services"
"github.com/robfig/cron/v3"
identity "git.solsynth.dev/hydrogen/identity/pkg"
"git.solsynth.dev/hydrogen/identity/pkg/database"
passport "git.solsynth.dev/hydrogen/passport/pkg"
"git.solsynth.dev/hydrogen/passport/pkg/database"
"github.com/rs/zerolog"
"github.com/rs/zerolog/log"
"github.com/spf13/viper"
@ -72,13 +72,13 @@ func main() {
quartz.Start()
// Messages
log.Info().Msgf("Identity v%s is started...", identity.AppVersion)
log.Info().Msgf("Identity v%s is started...", passport.AppVersion)
quit := make(chan os.Signal, 1)
signal.Notify(quit, syscall.SIGINT, syscall.SIGTERM)
<-quit
log.Info().Msgf("Identity v%s is quitting...", identity.AppVersion)
log.Info().Msgf("Identity v%s is quitting...", passport.AppVersion)
quartz.Stop()

View File

@ -1,7 +1,7 @@
package database
import (
"git.solsynth.dev/hydrogen/identity/pkg/models"
"git.solsynth.dev/hydrogen/passport/pkg/models"
"gorm.io/gorm"
)

View File

@ -4,8 +4,8 @@ import (
"context"
"fmt"
"git.solsynth.dev/hydrogen/identity/pkg/grpc/proto"
"git.solsynth.dev/hydrogen/identity/pkg/services"
"git.solsynth.dev/hydrogen/passport/pkg/grpc/proto"
"git.solsynth.dev/hydrogen/passport/pkg/services"
"github.com/spf13/viper"
)

View File

@ -3,9 +3,9 @@ package grpc
import (
"context"
"fmt"
"git.solsynth.dev/hydrogen/identity/pkg/grpc/proto"
"git.solsynth.dev/hydrogen/identity/pkg/models"
"git.solsynth.dev/hydrogen/identity/pkg/services"
"git.solsynth.dev/hydrogen/passport/pkg/grpc/proto"
"git.solsynth.dev/hydrogen/passport/pkg/models"
"git.solsynth.dev/hydrogen/passport/pkg/services"
"github.com/samber/lo"
)

View File

@ -3,9 +3,9 @@ package grpc
import (
"context"
"git.solsynth.dev/hydrogen/identity/pkg/grpc/proto"
"git.solsynth.dev/hydrogen/identity/pkg/models"
"git.solsynth.dev/hydrogen/identity/pkg/services"
"git.solsynth.dev/hydrogen/passport/pkg/grpc/proto"
"git.solsynth.dev/hydrogen/passport/pkg/models"
"git.solsynth.dev/hydrogen/passport/pkg/services"
"github.com/samber/lo"
)

View File

@ -3,7 +3,7 @@ package grpc
import (
"net"
"git.solsynth.dev/hydrogen/identity/pkg/grpc/proto"
"git.solsynth.dev/hydrogen/passport/pkg/grpc/proto"
"github.com/spf13/viper"
"google.golang.org/grpc"
"google.golang.org/grpc/reflection"

View File

@ -1,4 +1,4 @@
package identity
package passport
const (
AppVersion = "1.0.0"

View File

@ -7,8 +7,8 @@ import (
"github.com/google/uuid"
"git.solsynth.dev/hydrogen/identity/pkg/database"
"git.solsynth.dev/hydrogen/identity/pkg/models"
"git.solsynth.dev/hydrogen/passport/pkg/database"
"git.solsynth.dev/hydrogen/passport/pkg/models"
"github.com/samber/lo"
"gorm.io/datatypes"
)

View File

@ -3,7 +3,7 @@ package security
import (
"fmt"
"git.solsynth.dev/hydrogen/identity/pkg/models"
"git.solsynth.dev/hydrogen/passport/pkg/models"
"github.com/samber/lo"
)

View File

@ -9,8 +9,8 @@ import (
"github.com/spf13/viper"
)
var CookieAccessKey = "identity_auth_key"
var CookieRefreshKey = "identity_refresh_key"
var CookieAccessKey = "passport_auth_key"
var CookieRefreshKey = "passport_refresh_key"
type PayloadClaims struct {
jwt.RegisteredClaims

View File

@ -7,8 +7,8 @@ import (
"github.com/spf13/viper"
"git.solsynth.dev/hydrogen/identity/pkg/database"
"git.solsynth.dev/hydrogen/identity/pkg/models"
"git.solsynth.dev/hydrogen/passport/pkg/database"
"git.solsynth.dev/hydrogen/passport/pkg/models"
"github.com/google/uuid"
"github.com/samber/lo"
)

View File

@ -5,9 +5,9 @@ import (
"strconv"
"time"
"git.solsynth.dev/hydrogen/identity/pkg/database"
"git.solsynth.dev/hydrogen/identity/pkg/models"
"git.solsynth.dev/hydrogen/identity/pkg/services"
"git.solsynth.dev/hydrogen/passport/pkg/database"
"git.solsynth.dev/hydrogen/passport/pkg/models"
"git.solsynth.dev/hydrogen/passport/pkg/services"
"github.com/gofiber/fiber/v2"
jsoniter "github.com/json-iterator/go"
"github.com/spf13/viper"

View File

@ -3,8 +3,8 @@ package server
import (
"strings"
"git.solsynth.dev/hydrogen/identity/pkg/security"
"git.solsynth.dev/hydrogen/identity/pkg/services"
"git.solsynth.dev/hydrogen/passport/pkg/security"
"git.solsynth.dev/hydrogen/passport/pkg/services"
"github.com/gofiber/fiber/v2"
)

View File

@ -4,8 +4,8 @@ import (
"os"
"path/filepath"
"git.solsynth.dev/hydrogen/identity/pkg/database"
"git.solsynth.dev/hydrogen/identity/pkg/models"
"git.solsynth.dev/hydrogen/passport/pkg/database"
"git.solsynth.dev/hydrogen/passport/pkg/models"
"github.com/gofiber/fiber/v2"
"github.com/google/uuid"
"github.com/spf13/viper"

View File

@ -5,8 +5,8 @@ import (
"github.com/gofiber/fiber/v2"
"git.solsynth.dev/hydrogen/identity/pkg/security"
"git.solsynth.dev/hydrogen/identity/pkg/services"
"git.solsynth.dev/hydrogen/passport/pkg/security"
"git.solsynth.dev/hydrogen/passport/pkg/services"
"github.com/samber/lo"
)
@ -70,7 +70,7 @@ func doChallenge(c *fiber.Ctx) error {
if err != nil {
return fiber.NewError(fiber.StatusBadRequest, err.Error())
} else if challenge.Progress >= challenge.Requirements {
session, err := security.GrantSession(challenge, []string{"*"}, []string{"identity"}, nil, lo.ToPtr(time.Now()))
session, err := security.GrantSession(challenge, []string{"*"}, []string{"passport"}, nil, lo.ToPtr(time.Now()))
if err != nil {
return fiber.NewError(fiber.StatusBadRequest, err.Error())
}

View File

@ -1,7 +1,7 @@
package server
import (
"git.solsynth.dev/hydrogen/identity/pkg/services"
"git.solsynth.dev/hydrogen/passport/pkg/services"
"github.com/gofiber/fiber/v2"
)

View File

@ -1,8 +1,8 @@
package server
import (
"git.solsynth.dev/hydrogen/identity/pkg/models"
"git.solsynth.dev/hydrogen/identity/pkg/services"
"git.solsynth.dev/hydrogen/passport/pkg/models"
"git.solsynth.dev/hydrogen/passport/pkg/services"
"github.com/gofiber/fiber/v2"
)

View File

@ -3,9 +3,9 @@ package server
import (
"time"
"git.solsynth.dev/hydrogen/identity/pkg/database"
"git.solsynth.dev/hydrogen/identity/pkg/models"
"git.solsynth.dev/hydrogen/identity/pkg/services"
"git.solsynth.dev/hydrogen/passport/pkg/database"
"git.solsynth.dev/hydrogen/passport/pkg/models"
"git.solsynth.dev/hydrogen/passport/pkg/services"
"github.com/gofiber/fiber/v2"
"github.com/samber/lo"
)

View File

@ -1,8 +1,8 @@
package server
import (
"git.solsynth.dev/hydrogen/identity/pkg/models"
"git.solsynth.dev/hydrogen/identity/pkg/services"
"git.solsynth.dev/hydrogen/passport/pkg/models"
"git.solsynth.dev/hydrogen/passport/pkg/services"
"github.com/gofiber/fiber/v2"
)

View File

@ -1,8 +1,8 @@
package server
import (
"git.solsynth.dev/hydrogen/identity/pkg/models"
"git.solsynth.dev/hydrogen/identity/pkg/services"
"git.solsynth.dev/hydrogen/passport/pkg/models"
"git.solsynth.dev/hydrogen/passport/pkg/services"
"github.com/gofiber/contrib/websocket"
"github.com/samber/lo"
)

View File

@ -4,10 +4,10 @@ import (
"strings"
"time"
"git.solsynth.dev/hydrogen/identity/pkg/database"
"git.solsynth.dev/hydrogen/identity/pkg/models"
"git.solsynth.dev/hydrogen/identity/pkg/security"
"git.solsynth.dev/hydrogen/identity/pkg/services"
"git.solsynth.dev/hydrogen/passport/pkg/database"
"git.solsynth.dev/hydrogen/passport/pkg/models"
"git.solsynth.dev/hydrogen/passport/pkg/security"
"git.solsynth.dev/hydrogen/passport/pkg/services"
"github.com/gofiber/fiber/v2"
"github.com/samber/lo"
)
@ -77,7 +77,7 @@ func doConnect(c *fiber.Ctx) error {
user,
client,
strings.Split(scope, " "),
[]string{"identity", client.Alias},
[]string{"passport", client.Alias},
nil,
lo.ToPtr(time.Now()),
c.IP(),
@ -99,7 +99,7 @@ func doConnect(c *fiber.Ctx) error {
user,
client,
strings.Split(scope, " "),
[]string{"identity", client.Alias},
[]string{"passport", client.Alias},
nil,
lo.ToPtr(time.Now()),
c.IP(),

View File

@ -1,8 +1,8 @@
package server
import (
"git.solsynth.dev/hydrogen/identity/pkg/database"
"git.solsynth.dev/hydrogen/identity/pkg/models"
"git.solsynth.dev/hydrogen/passport/pkg/database"
"git.solsynth.dev/hydrogen/passport/pkg/models"
"github.com/gofiber/fiber/v2"
)

View File

@ -1,8 +1,8 @@
package server
import (
"git.solsynth.dev/hydrogen/identity/pkg/database"
"git.solsynth.dev/hydrogen/identity/pkg/models"
"git.solsynth.dev/hydrogen/passport/pkg/database"
"git.solsynth.dev/hydrogen/passport/pkg/models"
"github.com/gofiber/fiber/v2"
)

View File

@ -6,7 +6,7 @@ import (
"strings"
"time"
"git.solsynth.dev/hydrogen/identity/pkg/views"
"git.solsynth.dev/hydrogen/passport/pkg/views"
"github.com/gofiber/fiber/v2"
"github.com/gofiber/fiber/v2/middleware/cache"
"github.com/gofiber/fiber/v2/middleware/cors"

View File

@ -1,8 +1,8 @@
package server
import (
"git.solsynth.dev/hydrogen/identity/pkg/database"
"git.solsynth.dev/hydrogen/identity/pkg/models"
"git.solsynth.dev/hydrogen/passport/pkg/database"
"git.solsynth.dev/hydrogen/passport/pkg/models"
"github.com/gofiber/fiber/v2"
)

View File

@ -4,9 +4,9 @@ import (
"fmt"
"time"
"git.solsynth.dev/hydrogen/identity/pkg/database"
"git.solsynth.dev/hydrogen/identity/pkg/models"
"git.solsynth.dev/hydrogen/identity/pkg/security"
"git.solsynth.dev/hydrogen/passport/pkg/database"
"git.solsynth.dev/hydrogen/passport/pkg/models"
"git.solsynth.dev/hydrogen/passport/pkg/security"
"github.com/google/uuid"
"github.com/samber/lo"
"gorm.io/gorm"

View File

@ -4,9 +4,9 @@ import (
"fmt"
"time"
"git.solsynth.dev/hydrogen/identity/pkg/database"
"git.solsynth.dev/hydrogen/identity/pkg/models"
"git.solsynth.dev/hydrogen/identity/pkg/security"
"git.solsynth.dev/hydrogen/passport/pkg/database"
"git.solsynth.dev/hydrogen/passport/pkg/models"
"git.solsynth.dev/hydrogen/passport/pkg/security"
"github.com/gofiber/fiber/v2"
jsoniter "github.com/json-iterator/go"
"github.com/rs/zerolog/log"

View File

@ -1,8 +1,8 @@
package services
import (
"git.solsynth.dev/hydrogen/identity/pkg/database"
"git.solsynth.dev/hydrogen/identity/pkg/models"
"git.solsynth.dev/hydrogen/passport/pkg/database"
"git.solsynth.dev/hydrogen/passport/pkg/models"
)
func LookupChallenge(id uint) (models.AuthChallenge, error) {

View File

@ -1,7 +1,7 @@
package services
import (
"git.solsynth.dev/hydrogen/identity/pkg/database"
"git.solsynth.dev/hydrogen/passport/pkg/database"
"github.com/rs/zerolog/log"
"time"
)

View File

@ -3,8 +3,8 @@ package services
import (
"fmt"
"git.solsynth.dev/hydrogen/identity/pkg/database"
"git.solsynth.dev/hydrogen/identity/pkg/models"
"git.solsynth.dev/hydrogen/passport/pkg/database"
"git.solsynth.dev/hydrogen/passport/pkg/models"
)
func GetThirdClient(id string) (models.ThirdClient, error) {

View File

@ -1,7 +1,7 @@
package services
import (
"git.solsynth.dev/hydrogen/identity/pkg/models"
"git.solsynth.dev/hydrogen/passport/pkg/models"
"github.com/gofiber/contrib/websocket"
)

View File

@ -1,8 +1,8 @@
package services
import (
"git.solsynth.dev/hydrogen/identity/pkg/database"
"git.solsynth.dev/hydrogen/identity/pkg/models"
"git.solsynth.dev/hydrogen/passport/pkg/database"
"git.solsynth.dev/hydrogen/passport/pkg/models"
)
func AddEvent(user models.Account, event, target, ip, ua string) models.ActionEvent {

View File

@ -3,8 +3,8 @@ package services
import (
"fmt"
"git.solsynth.dev/hydrogen/identity/pkg/database"
"git.solsynth.dev/hydrogen/identity/pkg/models"
"git.solsynth.dev/hydrogen/passport/pkg/database"
"git.solsynth.dev/hydrogen/passport/pkg/models"
"github.com/google/uuid"
"github.com/spf13/viper"
)

View File

@ -3,8 +3,8 @@ package services
import (
"errors"
"fmt"
"git.solsynth.dev/hydrogen/identity/pkg/database"
"git.solsynth.dev/hydrogen/identity/pkg/models"
"git.solsynth.dev/hydrogen/passport/pkg/database"
"git.solsynth.dev/hydrogen/passport/pkg/models"
"gorm.io/gorm"
)

View File

@ -5,9 +5,9 @@ import (
jsoniter "github.com/json-iterator/go"
"firebase.google.com/go/messaging"
"git.solsynth.dev/hydrogen/identity/pkg/database"
"git.solsynth.dev/hydrogen/identity/pkg/external"
"git.solsynth.dev/hydrogen/identity/pkg/models"
"git.solsynth.dev/hydrogen/passport/pkg/database"
"git.solsynth.dev/hydrogen/passport/pkg/external"
"git.solsynth.dev/hydrogen/passport/pkg/models"
"github.com/rs/zerolog/log"
)

View File

@ -3,8 +3,8 @@ package services
import (
"time"
"git.solsynth.dev/hydrogen/identity/pkg/database"
"git.solsynth.dev/hydrogen/identity/pkg/models"
"git.solsynth.dev/hydrogen/passport/pkg/database"
"git.solsynth.dev/hydrogen/passport/pkg/models"
jsoniter "github.com/json-iterator/go"
"github.com/rs/zerolog/log"
"github.com/spf13/viper"

View File

@ -5,8 +5,8 @@ import (
"strings"
"time"
"git.solsynth.dev/hydrogen/identity/pkg/database"
"git.solsynth.dev/hydrogen/identity/pkg/models"
"git.solsynth.dev/hydrogen/passport/pkg/database"
"git.solsynth.dev/hydrogen/passport/pkg/models"
"github.com/google/uuid"
"github.com/spf13/viper"
)

View File

@ -1,5 +1,5 @@
{
"name": "@hydrogen/identity",
"name": "@hydrogen/passport",
"version": "1.0.0",
"type": "module",
"scripts": {

View File

@ -16,11 +16,11 @@ const defaultUserinfo: Userinfo = {
}
export function getAtk(): string {
return new Cookie().get("identity_auth_key")
return new Cookie().get("passport_auth_key")
}
export function checkLoggedIn(): boolean {
return new Cookie().get("identity_auth_key")
return new Cookie().get("passport_auth_key")
}
export const useUserinfo = defineStore("userinfo", () => {

View File

@ -32,6 +32,6 @@ access_token_duration = 300
refresh_token_duration = 2592000
[database]
dsn = "host=localhost dbname=hy_identity port=5432 sslmode=disable"
prefix = "identity_"
dsn = "host=localhost dbname=hy_passport port=5432 sslmode=disable"
prefix = "passport_"
bolt = "uploads/bolt.db"