diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 21152d5..974d114 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -4,9 +4,12 @@
-
+
-
+
+
+
+
@@ -153,7 +156,6 @@
-
@@ -178,7 +180,8 @@
-
+
+
true
diff --git a/go.mod b/go.mod
index 27d686b..768314d 100644
--- a/go.mod
+++ b/go.mod
@@ -5,7 +5,7 @@ go 1.21.6
toolchain go1.22.1
require (
- git.solsynth.dev/hydrogen/dealer v0.0.0-20240801060523-8cf0feb09a27
+ git.solsynth.dev/hydrogen/dealer v0.0.0-20240802073919-63ea5e848f6e
github.com/go-playground/validator/v10 v10.17.0
github.com/gofiber/fiber/v2 v2.52.4
github.com/golang-jwt/jwt/v5 v5.2.0
diff --git a/go.sum b/go.sum
index 483be55..e8a7ed8 100644
--- a/go.sum
+++ b/go.sum
@@ -2,6 +2,8 @@ git.solsynth.dev/hydrogen/dealer v0.0.0-20240721055146-d74cdddbaf49 h1:DMmCBcnCO
git.solsynth.dev/hydrogen/dealer v0.0.0-20240721055146-d74cdddbaf49/go.mod h1:IZd94qZZIj+MO9EqjGDqnAD9nWurlNPyhVPKemAY5lw=
git.solsynth.dev/hydrogen/dealer v0.0.0-20240801060523-8cf0feb09a27 h1:KQzeOI2ou240SXiL1hxMYDvZpYKtCFblCGDusFyGyBY=
git.solsynth.dev/hydrogen/dealer v0.0.0-20240801060523-8cf0feb09a27/go.mod h1:IZd94qZZIj+MO9EqjGDqnAD9nWurlNPyhVPKemAY5lw=
+git.solsynth.dev/hydrogen/dealer v0.0.0-20240802073919-63ea5e848f6e h1:xsyulF3EVhyQ+/+mbg1xso7PeVt1cX+d92LsTwF59JQ=
+git.solsynth.dev/hydrogen/dealer v0.0.0-20240802073919-63ea5e848f6e/go.mod h1:IZd94qZZIj+MO9EqjGDqnAD9nWurlNPyhVPKemAY5lw=
github.com/BurntSushi/toml v1.3.2 h1:o7IhLm0Msx3BaB+n3Ag7L8EVlByGnpq14C4YWiu/gL8=
github.com/BurntSushi/toml v1.3.2/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ=
github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ=
diff --git a/pkg/internal/grpc/auth.go b/pkg/internal/grpc/auth.go
index 3474f15..cb70b16 100644
--- a/pkg/internal/grpc/auth.go
+++ b/pkg/internal/grpc/auth.go
@@ -2,7 +2,9 @@ package grpc
import (
"context"
+ "git.solsynth.dev/hydrogen/passport/pkg/internal/database"
"git.solsynth.dev/hydrogen/passport/pkg/internal/models"
+ "github.com/samber/lo"
"git.solsynth.dev/hydrogen/dealer/pkg/proto"
"git.solsynth.dev/hydrogen/passport/pkg/internal/services"
@@ -89,3 +91,53 @@ func (v *Server) EnsureUserPermGranted(_ context.Context, in *proto.CheckUserPer
IsValid: valid,
}, nil
}
+
+func (v *Server) ListUserFriends(_ context.Context, in *proto.ListUserRelativeRequest) (*proto.ListUserRelativeResponse, error) {
+ tx := database.C.Preload("Account").Where("status = ?", models.RelationshipFriend)
+
+ if in.GetIsRelated() {
+ tx = tx.Where("related_id = ?", in.GetUserId())
+ } else {
+ tx = tx.Where("account_id = ?", in.GetUserId())
+ }
+
+ var data []models.AccountRelationship
+ if err := tx.Find(&data).Error; err != nil {
+ return nil, err
+ }
+
+ return &proto.ListUserRelativeResponse{
+ Data: lo.Map(data, func(item models.AccountRelationship, index int) *proto.SimpleUserInfo {
+ return &proto.SimpleUserInfo{
+ Id: uint64(item.AccountID),
+ Name: item.Account.Name,
+ Nick: item.Account.Nick,
+ }
+ }),
+ }, nil
+}
+
+func (v *Server) ListUserBlocklist(_ context.Context, in *proto.ListUserRelativeRequest) (*proto.ListUserRelativeResponse, error) {
+ tx := database.C.Preload("Account").Where("status = ?", models.RelationshipBlocked)
+
+ if in.GetIsRelated() {
+ tx = tx.Where("related_id = ?", in.GetUserId())
+ } else {
+ tx = tx.Where("account_id = ?", in.GetUserId())
+ }
+
+ var data []models.AccountRelationship
+ if err := tx.Find(&data).Error; err != nil {
+ return nil, err
+ }
+
+ return &proto.ListUserRelativeResponse{
+ Data: lo.Map(data, func(item models.AccountRelationship, index int) *proto.SimpleUserInfo {
+ return &proto.SimpleUserInfo{
+ Id: uint64(item.AccountID),
+ Name: item.Account.Name,
+ Nick: item.Account.Nick,
+ }
+ }),
+ }, nil
+}
diff --git a/settings.toml b/settings.toml
index 83d3574..c5ef4be 100644
--- a/settings.toml
+++ b/settings.toml
@@ -3,12 +3,10 @@ name = "Solarpass"
bind = "0.0.0.0:8444"
grpc_bind = "0.0.0.0:7444"
-domain = "localhost"
+domain = "id.solsynth.dev"
frontend_app = "https://solsynth.dev"
-domain = "id.solsynth.dev"
-
content_endpoint = "https://usercontent.solsynth.dev"
default_user_group = 1