Compare commits
158 Commits
79a61cc732
...
master
Author | SHA1 | Date | |
---|---|---|---|
25459cf429 | |||
c96e5bffa1 | |||
7dbb858d69 | |||
ac30cb5e4d | |||
d189c5a8d8 | |||
69e9a108ef | |||
2c8fd4e89a | |||
349d768d22 | |||
3c3cbd9c29 | |||
0034de71b5 | |||
068fffc1fd | |||
6f7a2de41e | |||
ce9d663bc3 | |||
37dc92dc43 | |||
79b12624d8 | |||
4901557217 | |||
c51721505f | |||
515412d663 | |||
d6f0daca61 | |||
f91b8dadb8 | |||
3c2a14800e | |||
fbe8e9b270 | |||
e588f2c87a | |||
bef5aa5c61 | |||
9fe0962c4a | |||
b2466bdee1 | |||
3cd102046a | |||
7a7d57c0d7 | |||
c8abf6647a | |||
60d8c0b766 | |||
8e33b99bca | |||
1b4d7822ed | |||
1c927122c2 | |||
ce257f83b8 | |||
b4c78cd10c | |||
0fa75406ed | |||
43447a1286 | |||
6e75f69263 | |||
c4720934fc | |||
93435b9ace | |||
78d9bb5fc2 | |||
5126855b1d | |||
d39e34b256 | |||
f769c5c5b5 | |||
7a12d375c1 | |||
14335084a1 | |||
32f2e3f1ed | |||
5f58a85892 | |||
3dd6b7b6f7 | |||
02da524aaa | |||
95d12a0a2d | |||
d6fa3bb15d | |||
26dfd25763 | |||
74de589513 | |||
d28669f527 | |||
7e5d75998d | |||
11322370b1 | |||
8a062bf07a | |||
359cb59bfe | |||
f0216bf770 | |||
951713b37f | |||
4b1953c8e7 | |||
673e7a69f5 | |||
b151acd6ac | |||
2f5d2a9938 | |||
15e38a9baf | |||
abb0295858 | |||
e127a72850 | |||
8f1605e1e9 | |||
da38e224bb | |||
67a0219cf7 | |||
0126361b8d | |||
76c78e0c01 | |||
f06bc2d382 | |||
10bf4fdf77 | |||
cc47ff4583 | |||
ba6e827cf8 | |||
63c42befb4 | |||
5630988ac2 | |||
390ac7e883 | |||
973ebe6d6d | |||
5f5f2bd1a5 | |||
dd5ce8074b | |||
4a7e41d4a9 | |||
625e86a7fd | |||
94decc6bad | |||
fd31120312 | |||
6228c186d7 | |||
14f4da6c91 | |||
ed77a443b8 | |||
87b6bee1f3 | |||
e35171ab81 | |||
a3cb407d89 | |||
be1beb713c | |||
a15a0d1c11 | |||
4b89474534 | |||
ed8afe8324 | |||
ecc2bff9a0 | |||
e1f1cd5130 | |||
5ce0e33359 | |||
b5f91b17e0 | |||
350cab0ff0 | |||
c738cff381 | |||
c1567f713a | |||
12ffcb7c5b | |||
3a4948d590 | |||
269e79ca58 | |||
14c17eded8 | |||
db59826253 | |||
60fa7a5bff | |||
a16c4c0764 | |||
0e3b1b6a37 | |||
9e8480640b | |||
a48553fff9 | |||
46d4082e38 | |||
c454bd0d5c | |||
79c34c1225 | |||
d7ed6ee33b | |||
ffb05154f9 | |||
a2633e6494 | |||
e16201a3ad | |||
429ca64f9d | |||
39218d19f3 | |||
9e2f2eedf9 | |||
0904f91b01 | |||
1d92b8945e | |||
59f0288c27 | |||
b756a9f19c | |||
748f442cbc | |||
d8dabd002b | |||
b888cf5acb | |||
57b908e5a0 | |||
9d9b2ac866 | |||
39ef6f9e0a | |||
644c0e6afb | |||
2ca6c615ff | |||
e90458c049 | |||
7a6dfeb9e6 | |||
2bb979668c | |||
2558b89b63 | |||
f609ac878a | |||
86db065117 | |||
ef8759e51d | |||
62d09717bb | |||
19e1b5f7c6 | |||
1a3e43a12f | |||
8cd7dca8aa | |||
0e4c0e5017 | |||
3c7ae284ac | |||
e37238436f | |||
6de2ef00a2 | |||
0ceee18524 | |||
c31d390a0b | |||
34d166bec8 | |||
710e2dc040 | |||
ade3dbdeee | |||
3213a3969e | |||
76e7dd7a07 |
1
.gitignore
vendored
1
.gitignore
vendored
@ -3,3 +3,4 @@
|
||||
/keys
|
||||
|
||||
.DS_Store
|
||||
.idea
|
8
.idea/.gitignore
generated
vendored
8
.idea/.gitignore
generated
vendored
@ -1,8 +0,0 @@
|
||||
# 默认忽略的文件
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# 基于编辑器的 HTTP 客户端请求
|
||||
/httpRequests/
|
||||
# Datasource local storage ignored files
|
||||
/dataSources/
|
||||
/dataSources.local.xml
|
9
.idea/Interactive.iml
generated
9
.idea/Interactive.iml
generated
@ -1,9 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="WEB_MODULE" version="4">
|
||||
<component name="Go" enabled="true" />
|
||||
<component name="NewModuleRootManager">
|
||||
<content url="file://$MODULE_DIR$" />
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
12
.idea/dataSources.xml
generated
12
.idea/dataSources.xml
generated
@ -1,12 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="DataSourceManagerImpl" format="xml" multifile-model="true">
|
||||
<data-source source="LOCAL" name="hy_interactive@localhost" uuid="a2f70c83-03f8-4240-bb8b-ac697502cfe2">
|
||||
<driver-ref>postgresql</driver-ref>
|
||||
<synchronize>true</synchronize>
|
||||
<jdbc-driver>org.postgresql.Driver</jdbc-driver>
|
||||
<jdbc-url>jdbc:postgresql://localhost:5432/hy_interactive</jdbc-url>
|
||||
<working-dir>$ProjectFileDir$</working-dir>
|
||||
</data-source>
|
||||
</component>
|
||||
</project>
|
6
.idea/inspectionProfiles/Project_Default.xml
generated
6
.idea/inspectionProfiles/Project_Default.xml
generated
@ -1,6 +0,0 @@
|
||||
<component name="InspectionProjectProfileManager">
|
||||
<profile version="1.0">
|
||||
<option name="myName" value="Project Default" />
|
||||
<inspection_tool class="Eslint" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
</profile>
|
||||
</component>
|
8
.idea/modules.xml
generated
8
.idea/modules.xml
generated
@ -1,8 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/Interactive.iml" filepath="$PROJECT_DIR$/.idea/Interactive.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
6
.idea/vcs.xml
generated
6
.idea/vcs.xml
generated
@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
68
go.mod
68
go.mod
@ -3,22 +3,25 @@ module git.solsynth.dev/hypernet/interactive
|
||||
go 1.23.2
|
||||
|
||||
require (
|
||||
git.solsynth.dev/hypernet/nexus v0.0.0-20241123050605-25ab1371739b
|
||||
git.solsynth.dev/hypernet/passport v0.0.0-20241209153421-573ccc04787f
|
||||
git.solsynth.dev/hypernet/pusher v0.0.0-20241026153052-cd2c326efa4e
|
||||
github.com/dgraph-io/ristretto v0.2.0
|
||||
github.com/eko/gocache/lib/v4 v4.1.6
|
||||
github.com/eko/gocache/store/ristretto/v4 v4.2.2
|
||||
git.solsynth.dev/hypernet/insight v0.0.0-20250129172551-974266b2c1d2
|
||||
git.solsynth.dev/hypernet/nexus v0.0.0-20250329075932-d5422ab5b04c
|
||||
git.solsynth.dev/hypernet/paperclip v0.0.0-20250330164539-11d54c7c7874
|
||||
git.solsynth.dev/hypernet/passport v0.0.0-20250329100405-b327e0806279
|
||||
git.solsynth.dev/hypernet/pusher v0.0.0-20250216145944-5fb769823a88
|
||||
git.solsynth.dev/hypernet/wallet v0.0.0-20250323095812-468cd655f886
|
||||
github.com/fatih/color v1.18.0
|
||||
github.com/go-ap/activitypub v0.0.0-20250212090640-aeb6499ba581
|
||||
github.com/go-playground/validator/v10 v10.22.1
|
||||
github.com/gofiber/fiber/v2 v2.52.5
|
||||
github.com/goccy/go-json v0.10.3
|
||||
github.com/gofiber/fiber/v2 v2.52.6
|
||||
github.com/json-iterator/go v1.1.12
|
||||
github.com/pemistahl/lingua-go v1.4.0
|
||||
github.com/robfig/cron/v3 v3.0.1
|
||||
github.com/rs/zerolog v1.33.0
|
||||
github.com/samber/lo v1.47.0
|
||||
github.com/spf13/viper v1.19.0
|
||||
google.golang.org/grpc v1.67.1
|
||||
google.golang.org/grpc v1.70.0
|
||||
google.golang.org/protobuf v1.36.4
|
||||
gorm.io/datatypes v1.2.4
|
||||
gorm.io/driver/postgres v1.5.9
|
||||
gorm.io/gorm v1.25.12
|
||||
@ -26,19 +29,23 @@ require (
|
||||
|
||||
require (
|
||||
filippo.io/edwards25519 v1.1.0 // indirect
|
||||
git.sr.ht/~mariusor/go-xsd-duration v0.0.0-20220703122237-02e73435a078 // indirect
|
||||
github.com/andybalholm/brotli v1.1.1 // indirect
|
||||
github.com/beorn7/perks v1.0.1 // indirect
|
||||
github.com/cespare/xxhash/v2 v2.3.0 // indirect
|
||||
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
|
||||
github.com/dustin/go-humanize v1.0.1 // indirect
|
||||
github.com/eko/gocache/lib/v4 v4.2.0 // indirect
|
||||
github.com/eko/gocache/store/redis/v4 v4.2.2 // indirect
|
||||
github.com/fsnotify/fsnotify v1.8.0 // indirect
|
||||
github.com/gabriel-vasile/mimetype v1.4.3 // indirect
|
||||
github.com/go-ap/errors v0.0.0-20250124135319-3da8adefd4a9 // indirect
|
||||
github.com/go-ap/jsonld v0.0.0-20221030091449-f2a191312c73 // indirect
|
||||
github.com/go-playground/locales v0.14.1 // indirect
|
||||
github.com/go-playground/universal-translator v0.18.1 // indirect
|
||||
github.com/go-sql-driver/mysql v1.8.1 // indirect
|
||||
github.com/goccy/go-json v0.10.3 // indirect
|
||||
github.com/golang-jwt/jwt/v5 v5.2.1 // indirect
|
||||
github.com/golang/mock v1.6.0 // indirect
|
||||
github.com/golang/protobuf v1.5.4 // indirect
|
||||
github.com/google/uuid v1.6.0 // indirect
|
||||
github.com/hashicorp/hcl v1.0.0 // indirect
|
||||
github.com/jackc/pgpassfile v1.0.0 // indirect
|
||||
@ -47,13 +54,15 @@ require (
|
||||
github.com/jackc/puddle/v2 v2.2.2 // indirect
|
||||
github.com/jinzhu/inflection v1.0.0 // indirect
|
||||
github.com/jinzhu/now v1.1.5 // indirect
|
||||
github.com/klauspost/compress v1.17.11 // indirect
|
||||
github.com/klauspost/compress v1.18.0 // indirect
|
||||
github.com/klauspost/cpuid/v2 v2.2.7 // indirect
|
||||
github.com/leodido/go-urn v1.4.0 // indirect
|
||||
github.com/magiconair/properties v1.8.7 // indirect
|
||||
github.com/mattn/go-colorable v0.1.13 // indirect
|
||||
github.com/mattn/go-colorable v0.1.14 // indirect
|
||||
github.com/mattn/go-isatty v0.0.20 // indirect
|
||||
github.com/mattn/go-runewidth v0.0.16 // indirect
|
||||
github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect
|
||||
github.com/minio/md5-simd v1.1.2 // indirect
|
||||
github.com/minio/minio-go/v7 v7.0.70 // indirect
|
||||
github.com/mitchellh/mapstructure v1.5.0 // indirect
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
|
||||
github.com/modern-go/reflect2 v1.0.2 // indirect
|
||||
@ -62,12 +71,13 @@ require (
|
||||
github.com/nats-io/nuid v1.0.1 // indirect
|
||||
github.com/pelletier/go-toml/v2 v2.2.3 // indirect
|
||||
github.com/philhofer/fwd v1.1.3-0.20240916144458-20a13a1f6b7c // indirect
|
||||
github.com/pkg/errors v0.9.1 // indirect
|
||||
github.com/prometheus/client_golang v1.14.0 // indirect
|
||||
github.com/prometheus/client_model v0.3.0 // indirect
|
||||
github.com/prometheus/common v0.37.0 // indirect
|
||||
github.com/prometheus/procfs v0.8.0 // indirect
|
||||
github.com/prometheus/client_golang v1.19.0 // indirect
|
||||
github.com/prometheus/client_model v0.6.1 // indirect
|
||||
github.com/prometheus/common v0.52.3 // indirect
|
||||
github.com/prometheus/procfs v0.13.0 // indirect
|
||||
github.com/redis/go-redis/v9 v9.7.3 // indirect
|
||||
github.com/rivo/uniseg v0.4.7 // indirect
|
||||
github.com/rs/xid v1.5.0 // indirect
|
||||
github.com/sagikazarmark/locafero v0.6.0 // indirect
|
||||
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
|
||||
github.com/shopspring/decimal v1.4.0 // indirect
|
||||
@ -76,21 +86,19 @@ require (
|
||||
github.com/spf13/cast v1.7.0 // indirect
|
||||
github.com/spf13/pflag v1.0.5 // indirect
|
||||
github.com/subosito/gotenv v1.6.0 // indirect
|
||||
github.com/tinylib/msgp v1.2.4 // indirect
|
||||
github.com/tinylib/msgp v1.2.5 // indirect
|
||||
github.com/valyala/bytebufferpool v1.0.0 // indirect
|
||||
github.com/valyala/fasthttp v1.57.0 // indirect
|
||||
github.com/valyala/tcplisten v1.0.0 // indirect
|
||||
github.com/vmihailenco/msgpack/v5 v5.3.5 // indirect
|
||||
github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect
|
||||
github.com/valyala/fasthttp v1.59.0 // indirect
|
||||
github.com/valyala/fastjson v1.6.4 // indirect
|
||||
go.uber.org/mock v0.4.0 // indirect
|
||||
go.uber.org/multierr v1.11.0 // indirect
|
||||
golang.org/x/crypto v0.28.0 // indirect
|
||||
golang.org/x/crypto v0.33.0 // indirect
|
||||
golang.org/x/exp v0.0.0-20241009180824-f66d83c29e7c // indirect
|
||||
golang.org/x/net v0.30.0 // indirect
|
||||
golang.org/x/sync v0.8.0 // indirect
|
||||
golang.org/x/sys v0.26.0 // indirect
|
||||
golang.org/x/text v0.19.0 // indirect
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20241021214115-324edc3d5d38 // indirect
|
||||
google.golang.org/protobuf v1.35.1 // indirect
|
||||
golang.org/x/net v0.35.0 // indirect
|
||||
golang.org/x/sync v0.11.0 // indirect
|
||||
golang.org/x/sys v0.30.0 // indirect
|
||||
golang.org/x/text v0.22.0 // indirect
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20250127172529-29210b9bc287 // indirect
|
||||
gopkg.in/ini.v1 v1.67.0 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
gorm.io/driver/mysql v1.5.7 // indirect
|
||||
|
586
go.sum
586
go.sum
@ -1,86 +1,44 @@
|
||||
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
||||
cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
||||
cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU=
|
||||
cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU=
|
||||
cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY=
|
||||
cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc=
|
||||
cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0=
|
||||
cloud.google.com/go v0.50.0/go.mod h1:r9sluTvynVuxRIOHXQEHMFffphuXHOMZMycpNR5e6To=
|
||||
cloud.google.com/go v0.52.0/go.mod h1:pXajvRH/6o3+F9jDHZWQ5PbGhn+o8w9qiu/CffaVdO4=
|
||||
cloud.google.com/go v0.53.0/go.mod h1:fp/UouUEsRkN6ryDKNW/Upv/JBKnv6WDthjR6+vze6M=
|
||||
cloud.google.com/go v0.54.0/go.mod h1:1rq2OEkV3YMf6n/9ZvGWI3GWw0VoqH/1x2nd8Is/bPc=
|
||||
cloud.google.com/go v0.56.0/go.mod h1:jr7tqZxxKOVYizybht9+26Z/gUq7tiRzu+ACVAMbKVk=
|
||||
cloud.google.com/go v0.57.0/go.mod h1:oXiQ6Rzq3RAkkY7N6t3TcE6jE+CIBBbA36lwQ1JyzZs=
|
||||
cloud.google.com/go v0.62.0/go.mod h1:jmCYTdRCQuc1PHIIJ/maLInMho30T/Y0M4hTdTShOYc=
|
||||
cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHObY=
|
||||
cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o=
|
||||
cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE=
|
||||
cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc=
|
||||
cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg=
|
||||
cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc=
|
||||
cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ=
|
||||
cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE=
|
||||
cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk=
|
||||
cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I=
|
||||
cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw=
|
||||
cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA=
|
||||
cloud.google.com/go/pubsub v1.3.1/go.mod h1:i+ucay31+CNRpDW4Lu78I4xXG+O1r/MAHgjpRVR+TSU=
|
||||
cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw=
|
||||
cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos=
|
||||
cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk=
|
||||
cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs=
|
||||
cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0=
|
||||
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
|
||||
filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA=
|
||||
filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4=
|
||||
git.solsynth.dev/hypernet/nexus v0.0.0-20241123050605-25ab1371739b h1:8yB9kMwEMY/nIbmDDxrhH5sTypgmK5PIIiIfP5QXx4s=
|
||||
git.solsynth.dev/hypernet/nexus v0.0.0-20241123050605-25ab1371739b/go.mod h1:PhLCv2lsNoscPVJbkWnxwQnJ141lc4RIEkVffrHwl4s=
|
||||
git.solsynth.dev/hypernet/passport v0.0.0-20241209153421-573ccc04787f h1:8JNaI1BcdTYPX+w421eM9nJ1WbAXIoy5flDUsLNmsRo=
|
||||
git.solsynth.dev/hypernet/passport v0.0.0-20241209153421-573ccc04787f/go.mod h1:w0wVU43nnOvt8i0+UuGvbzSkvongbSm8EV8HZVbohOQ=
|
||||
git.solsynth.dev/hypernet/pusher v0.0.0-20241026153052-cd2c326efa4e h1:DtHhMjgxS/spUt/KEdbRFtaVnepI6Vx8pbHdJaNH1hs=
|
||||
git.solsynth.dev/hypernet/pusher v0.0.0-20241026153052-cd2c326efa4e/go.mod h1:XHTqFU/vBe4JiuAjl87GUcL8+w/IizSNoqH6n3WkQFc=
|
||||
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
||||
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
|
||||
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
|
||||
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
|
||||
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
|
||||
github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
|
||||
github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho=
|
||||
git.solsynth.dev/hypernet/insight v0.0.0-20250129172551-974266b2c1d2 h1:dPBdssDIb+SqkAYlZgv80iftkfiijpMBCKe/6o4jwuA=
|
||||
git.solsynth.dev/hypernet/insight v0.0.0-20250129172551-974266b2c1d2/go.mod h1:NKSTeRc1mgg726iaCLEBoYEcVroIrGU5w2rnGf92LWE=
|
||||
git.solsynth.dev/hypernet/nexus v0.0.0-20250329075932-d5422ab5b04c h1:XgdTgJxSAQuCbiG15hN5pY6chzcz8sX3Onm2itS+Ufs=
|
||||
git.solsynth.dev/hypernet/nexus v0.0.0-20250329075932-d5422ab5b04c/go.mod h1:5tk62VQ1DcbR0EAN2jAOqYxHiegUPEC805JlfQ/G19I=
|
||||
git.solsynth.dev/hypernet/paperclip v0.0.0-20250329141722-820d7a9f42e6 h1:n7MgY8/TRJZXO4EJKmRqmzJQmE0E0X02Vf/pNJjRfms=
|
||||
git.solsynth.dev/hypernet/paperclip v0.0.0-20250329141722-820d7a9f42e6/go.mod h1:TdFsd/W3e04GAFVOWXBP9acSYF+YpmSeSdocnvt/4IY=
|
||||
git.solsynth.dev/hypernet/paperclip v0.0.0-20250330164539-11d54c7c7874 h1:Bdgn9y/0qxX9+zgCtZ8UwdGe7nyy4Bifem3Qf6dK/kY=
|
||||
git.solsynth.dev/hypernet/paperclip v0.0.0-20250330164539-11d54c7c7874/go.mod h1:TdFsd/W3e04GAFVOWXBP9acSYF+YpmSeSdocnvt/4IY=
|
||||
git.solsynth.dev/hypernet/passport v0.0.0-20250329100405-b327e0806279 h1:7eL9za4zGsoKImiCXkpGFdXcSYhdegSRVsXfBJq7Q5I=
|
||||
git.solsynth.dev/hypernet/passport v0.0.0-20250329100405-b327e0806279/go.mod h1:lbE/HrtMsnplOGvkg1JNjJL6DiXAnYczayxqN72UAJc=
|
||||
git.solsynth.dev/hypernet/pusher v0.0.0-20250216145944-5fb769823a88 h1:2HEENe9KUrdaJeNBzx9lsuXQGyzWqCgnLTKQnr8xFr8=
|
||||
git.solsynth.dev/hypernet/pusher v0.0.0-20250216145944-5fb769823a88/go.mod h1:ildzMtLagNsLK0Rkw4Hgk2TrrwqZnjwJIUx0MNZwcDY=
|
||||
git.solsynth.dev/hypernet/wallet v0.0.0-20250323095812-468cd655f886 h1:rVssXF8jZ64ctAfzlCgIgF22NCT9VAPAVxrwlcItx3s=
|
||||
git.solsynth.dev/hypernet/wallet v0.0.0-20250323095812-468cd655f886/go.mod h1:rmomNGQ6RBSp8TpZGA8tFr5M54AL2NADJ/1n0MfrIRM=
|
||||
git.sr.ht/~mariusor/go-xsd-duration v0.0.0-20220703122237-02e73435a078 h1:cliQ4HHsCo6xi2oWZYKWW4bly/Ory9FuTpFPRxj/mAg=
|
||||
git.sr.ht/~mariusor/go-xsd-duration v0.0.0-20220703122237-02e73435a078/go.mod h1:g/V2Hjas6Z1UHUp4yIx6bATpNzJ7DYtD0FG3+xARWxs=
|
||||
github.com/andybalholm/brotli v1.1.1 h1:PR2pgnyFznKEugtsUo0xLdDop5SKXd5Qf5ysW+7XdTA=
|
||||
github.com/andybalholm/brotli v1.1.1/go.mod h1:05ib4cKhjx3OQYUY22hTVd34Bc8upXjOLL2rKwwZBoA=
|
||||
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
|
||||
github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
|
||||
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
|
||||
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
|
||||
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
|
||||
github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
|
||||
github.com/cespare/xxhash/v2 v2.1.2/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
|
||||
github.com/bsm/ginkgo/v2 v2.12.0 h1:Ny8MWAHyOepLGlLKYmXG4IEkioBysk6GpaRTLC8zwWs=
|
||||
github.com/bsm/ginkgo/v2 v2.12.0/go.mod h1:SwYbGRRDovPVboqFv0tPTcG1sN61LM1Z4ARdbAV9g4c=
|
||||
github.com/bsm/gomega v1.27.10 h1:yeMWxP2pV2fG3FgAODIY8EiRE3dy0aeFYt4l7wh6yKA=
|
||||
github.com/bsm/gomega v1.27.10/go.mod h1:JyEr/xRbxbtgWNi8tIEVPUYZ5Dzef52k01W3YH0H+O0=
|
||||
github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs=
|
||||
github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
|
||||
github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI=
|
||||
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI=
|
||||
github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU=
|
||||
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
|
||||
github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
|
||||
github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
|
||||
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/dgraph-io/ristretto v0.2.0 h1:XAfl+7cmoUDWW/2Lx8TGZQjjxIQ2Ley9DSf52dru4WE=
|
||||
github.com/dgraph-io/ristretto v0.2.0/go.mod h1:8uBHCU/PBV4Ag0CJrP47b9Ofby5dqWNh4FicAdoqFNU=
|
||||
github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 h1:fAjc9m62+UWV/WAFKLNi6ZS0675eEUC9y3AlwSbQu1Y=
|
||||
github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw=
|
||||
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78=
|
||||
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc=
|
||||
github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY=
|
||||
github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto=
|
||||
github.com/eko/gocache/lib/v4 v4.1.6 h1:5WWIGISKhE7mfkyF+SJyWwqa4Dp2mkdX8QsZpnENqJI=
|
||||
github.com/eko/gocache/lib/v4 v4.1.6/go.mod h1:HFxC8IiG2WeRotg09xEnPD72sCheJiTSr4Li5Ameg7g=
|
||||
github.com/eko/gocache/store/ristretto/v4 v4.2.2 h1:lXFzoZ5ck6Gy6ON7f5DHSkNt122qN7KoroCVgVwF7oo=
|
||||
github.com/eko/gocache/store/ristretto/v4 v4.2.2/go.mod h1:uIvBVJzqRepr5L0RsbkfQ2iYfbyos2fuji/s4yM+aUM=
|
||||
github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
|
||||
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
|
||||
github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98=
|
||||
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
|
||||
github.com/eko/gocache/lib/v4 v4.2.0 h1:MNykyi5Xw+5Wu3+PUrvtOCaKSZM1nUSVftbzmeC7Yuw=
|
||||
github.com/eko/gocache/lib/v4 v4.2.0/go.mod h1:7ViVmbU+CzDHzRpmB4SXKyyzyuJ8A3UW3/cszpcqB4M=
|
||||
github.com/eko/gocache/store/redis/v4 v4.2.2 h1:Thw31fzGuH3WzJywsdbMivOmP550D6JS7GDHhvCJPA0=
|
||||
github.com/eko/gocache/store/redis/v4 v4.2.2/go.mod h1:LaTxLKx9TG/YUEybQvPMij++D7PBTIJ4+pzvk0ykz0w=
|
||||
github.com/fatih/color v1.18.0 h1:S8gINlzdQ840/4pfAwic/ZE0djQEH3wM94VfqLTZcOM=
|
||||
github.com/fatih/color v1.18.0/go.mod h1:4FelSpRwEGDpQ12mAdzqdOukCy4u8WUtOY6lkT/6HfU=
|
||||
github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8=
|
||||
@ -89,17 +47,16 @@ github.com/fsnotify/fsnotify v1.8.0 h1:dAwr6QBTBZIkG8roQaJjGof0pp0EeF+tNV7YBP3F/
|
||||
github.com/fsnotify/fsnotify v1.8.0/go.mod h1:8jBTzvmWwFyi3Pb8djgCCO5IBqzKJ/Jwo8TRcHyHii0=
|
||||
github.com/gabriel-vasile/mimetype v1.4.3 h1:in2uUcidCuFcDKtdcBxlR0rJ1+fsokWf+uqxgUFjbI0=
|
||||
github.com/gabriel-vasile/mimetype v1.4.3/go.mod h1:d8uq/6HKRL6CGdk+aubisF/M5GcPfT7nKyLpA0lbSSk=
|
||||
github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU=
|
||||
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
|
||||
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
|
||||
github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
|
||||
github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
|
||||
github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY=
|
||||
github.com/go-kit/log v0.2.0/go.mod h1:NwTd00d/i8cPZ3xOwwiv2PO5MOcx78fFErGNcVmBjv0=
|
||||
github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE=
|
||||
github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk=
|
||||
github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A=
|
||||
github.com/go-logfmt/logfmt v0.5.1/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs=
|
||||
github.com/go-ap/activitypub v0.0.0-20250212090640-aeb6499ba581 h1:73sFEdBsWBTBut0aDMPgt8HRuMO+ML0fd8AA/zjO8BQ=
|
||||
github.com/go-ap/activitypub v0.0.0-20250212090640-aeb6499ba581/go.mod h1:IO2PtAsxfGXN5IHrPuOslENFbq7MprYLNOyiiOELoRQ=
|
||||
github.com/go-ap/errors v0.0.0-20250124135319-3da8adefd4a9 h1:AJBGzuJVgfkKF3LoXCNQfH9yWmsVDV/oPDJE/zeXOjE=
|
||||
github.com/go-ap/errors v0.0.0-20250124135319-3da8adefd4a9/go.mod h1:Vkh+Z3f24K8nMsJKXo1FHn5ebPsXvB/WDH5JRtYqdNo=
|
||||
github.com/go-ap/jsonld v0.0.0-20221030091449-f2a191312c73 h1:GMKIYXyXPGIp+hYiWOhfqK4A023HdgisDT4YGgf99mw=
|
||||
github.com/go-ap/jsonld v0.0.0-20221030091449-f2a191312c73/go.mod h1:jyveZeGw5LaADntW+UEsMjl3IlIwk+DxlYNsbofQkGA=
|
||||
github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY=
|
||||
github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
|
||||
github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag=
|
||||
github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE=
|
||||
github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s=
|
||||
github.com/go-playground/assert/v2 v2.2.0/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4=
|
||||
github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA=
|
||||
@ -111,83 +68,28 @@ github.com/go-playground/validator/v10 v10.22.1/go.mod h1:dbuPbCMFw/DrkbEynArYaC
|
||||
github.com/go-sql-driver/mysql v1.7.0/go.mod h1:OXbVy3sEdcQ2Doequ6Z5BW6fXNQTmx+9S1MCJN5yJMI=
|
||||
github.com/go-sql-driver/mysql v1.8.1 h1:LedoTUt/eveggdHS9qUFC1EFSa8bU2+1pZjSRpvNJ1Y=
|
||||
github.com/go-sql-driver/mysql v1.8.1/go.mod h1:wEBSXgmK//2ZFJyE+qWnIsVGmvmEKlqwuVSjsCm7DZg=
|
||||
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
|
||||
github.com/goccy/go-json v0.10.3 h1:KZ5WoDbxAIgm2HNbYckL0se1fHD6rz5j4ywS6ebzDqA=
|
||||
github.com/goccy/go-json v0.10.3/go.mod h1:oq7eo15ShAhp70Anwd5lgX2pLfOS3QCiwU/PULtXL6M=
|
||||
github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
|
||||
github.com/gofiber/fiber/v2 v2.52.5 h1:tWoP1MJQjGEe4GB5TUGOi7P2E0ZMMRx5ZTG4rT+yGMo=
|
||||
github.com/gofiber/fiber/v2 v2.52.5/go.mod h1:KEOE+cXMhXG0zHc9d8+E38hoX+ZN7bhOtgeF2oT6jrQ=
|
||||
github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
|
||||
github.com/gofiber/fiber/v2 v2.52.6 h1:Rfp+ILPiYSvvVuIPvxrBns+HJp8qGLDnLJawAu27XVI=
|
||||
github.com/gofiber/fiber/v2 v2.52.6/go.mod h1:YEcBbO/FB+5M1IZNBP9FO3J9281zgPAreiI1oqg8nDw=
|
||||
github.com/golang-jwt/jwt/v5 v5.2.1 h1:OuVbFODueb089Lh128TAcimifWaLhJwVflnrgM17wHk=
|
||||
github.com/golang-jwt/jwt/v5 v5.2.1/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk=
|
||||
github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9 h1:au07oEsX2xN0ktxqI+Sida1w446QrXBRJ0nee3SNZlA=
|
||||
github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9/go.mod h1:8vg3r2VgvsThLBIFL93Qb5yWzgyZWhEmBwUJWevAkK0=
|
||||
github.com/golang-sql/sqlexp v0.1.0 h1:ZCD6MBpcuOVfGVqsEmY5/4FtYiKz6tSyUv9LPEDei6A=
|
||||
github.com/golang-sql/sqlexp v0.1.0/go.mod h1:J4ad9Vo8ZCWQ2GMrC4UCQy1JpCbwU9m3EOqtpKwwwHI=
|
||||
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
|
||||
github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
|
||||
github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
|
||||
github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
|
||||
github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
|
||||
github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
|
||||
github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y=
|
||||
github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw=
|
||||
github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw=
|
||||
github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw=
|
||||
github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4=
|
||||
github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc=
|
||||
github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs=
|
||||
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||
github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||
github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw=
|
||||
github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw=
|
||||
github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk=
|
||||
github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8=
|
||||
github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA=
|
||||
github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs=
|
||||
github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w=
|
||||
github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0=
|
||||
github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8=
|
||||
github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
|
||||
github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
|
||||
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
|
||||
github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
|
||||
github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek=
|
||||
github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps=
|
||||
github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
|
||||
github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
|
||||
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
|
||||
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
||||
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
||||
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
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/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
||||
github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs=
|
||||
github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0=
|
||||
github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc=
|
||||
github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc=
|
||||
github.com/google/pprof v0.0.0-20191218002539-d4f498aebedc/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
|
||||
github.com/google/pprof v0.0.0-20200212024743-f11f1df84d12/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
|
||||
github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
|
||||
github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
|
||||
github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
|
||||
github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
|
||||
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
|
||||
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg=
|
||||
github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk=
|
||||
github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
|
||||
github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
|
||||
github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4=
|
||||
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
|
||||
github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
|
||||
github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM=
|
||||
github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg=
|
||||
github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 h1:iCEnooe7UlwOQYpKFhBabPMi4aNAfoODPEFNiAnClxo=
|
||||
@ -200,35 +102,24 @@ github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD
|
||||
github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc=
|
||||
github.com/jinzhu/now v1.1.5 h1:/o9tlHleP7gOFmsnYNz3RGnqzefHA47wQpKrrdTIwXQ=
|
||||
github.com/jinzhu/now v1.1.5/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8=
|
||||
github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4=
|
||||
github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
|
||||
github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
|
||||
github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
|
||||
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
|
||||
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
|
||||
github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU=
|
||||
github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk=
|
||||
github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
|
||||
github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM=
|
||||
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
|
||||
github.com/klauspost/compress v1.17.11 h1:In6xLpyWOi1+C7tXUUWv2ot1QvBjxevKAaI6IXrJmUc=
|
||||
github.com/klauspost/compress v1.17.11/go.mod h1:pMDklpSncoRMuLFrf1W9Ss9KT+0rH90U12bZKk7uwG0=
|
||||
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
|
||||
github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
|
||||
github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
|
||||
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
||||
github.com/klauspost/compress v1.18.0 h1:c/Cqfb0r+Yi+JtIEq73FWXVkRonBlf0CRNYc8Zttxdo=
|
||||
github.com/klauspost/compress v1.18.0/go.mod h1:2Pp+KzxcywXVXMr50+X0Q/Lsb43OQHYWRCY2AiWywWQ=
|
||||
github.com/klauspost/cpuid/v2 v2.0.1/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg=
|
||||
github.com/klauspost/cpuid/v2 v2.2.7 h1:ZWSB3igEs+d0qvnxR/ZBzXVmxkgt8DdzP6m9pfuVLDM=
|
||||
github.com/klauspost/cpuid/v2 v2.2.7/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws=
|
||||
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
|
||||
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
|
||||
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.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
||||
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
|
||||
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/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY=
|
||||
github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0=
|
||||
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.14 h1:9A9LHSqF/7dyVVX6g0U9cwm9pG3kP9gSzcuIPHPsaIE=
|
||||
github.com/mattn/go-colorable v0.1.14/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8=
|
||||
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
|
||||
github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
|
||||
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
|
||||
@ -237,21 +128,19 @@ github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6T
|
||||
github.com/mattn/go-runewidth v0.0.16/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
|
||||
github.com/mattn/go-sqlite3 v1.14.15 h1:vfoHhTN1af61xCRSWzFIWzx2YskyMTwHLrExkBOjvxI=
|
||||
github.com/mattn/go-sqlite3 v1.14.15/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S2DGjv9HUNg=
|
||||
github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU=
|
||||
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
|
||||
github.com/microsoft/go-mssqldb v0.17.0 h1:Fto83dMZPnYv1Zwx5vHHxpNraeEaUlQ/hhHLgZiaenE=
|
||||
github.com/microsoft/go-mssqldb v0.17.0/go.mod h1:OkoNGhGEs8EZqchVTtochlXruEhEOaO4S0d2sB5aeGQ=
|
||||
github.com/minio/md5-simd v1.1.2 h1:Gdi1DZK69+ZVMoNHRXJyNcxrMA4dSxoYHZSQbirFg34=
|
||||
github.com/minio/md5-simd v1.1.2/go.mod h1:MzdKDxYpY2BT9XQFocsiZf/NKVtR7nkE4RoEpN+20RM=
|
||||
github.com/minio/minio-go/v7 v7.0.70 h1:1u9NtMgfK1U42kUxcsl5v0yj6TEOPR497OAQxpJnn2g=
|
||||
github.com/minio/minio-go/v7 v7.0.70/go.mod h1:4yBA8v80xGA30cfM3fz0DKYMXunWl/AV/6tWEs9ryzo=
|
||||
github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY=
|
||||
github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
|
||||
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
|
||||
github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
|
||||
github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M=
|
||||
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
|
||||
github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
|
||||
github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
|
||||
github.com/nats-io/nats.go v1.37.0 h1:07rauXbVnnJvv1gfIyghFEo6lUcYRY0WXc3x7x0vUxE=
|
||||
github.com/nats-io/nats.go v1.37.0/go.mod h1:Ubdu4Nh9exXdSz0RVWRFBbRfrbSxOYd26oF0wkWclB8=
|
||||
github.com/nats-io/nkeys v0.4.7 h1:RwNJbbIdYCoClSDNY7QVKZlyb/wfT6ugvFCiKy6vDvI=
|
||||
@ -264,47 +153,28 @@ github.com/pemistahl/lingua-go v1.4.0 h1:ifYhthrlW7iO4icdubwlduYnmwU37V1sbNrwhKB
|
||||
github.com/pemistahl/lingua-go v1.4.0/go.mod h1:ECuM1Hp/3hvyh7k8aWSqNCPlTxLemFZsRjocUf3KgME=
|
||||
github.com/philhofer/fwd v1.1.3-0.20240916144458-20a13a1f6b7c h1:dAMKvw0MlJT1GshSTtih8C2gDs04w8dReiOGXrGLNoY=
|
||||
github.com/philhofer/fwd v1.1.3-0.20240916144458-20a13a1f6b7c/go.mod h1:RqIHx9QI14HlwKwm98g9Re5prTQ6LdeRQn+gXJFxsJM=
|
||||
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
|
||||
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U=
|
||||
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
|
||||
github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo=
|
||||
github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M=
|
||||
github.com/prometheus/client_golang v1.11.0/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0=
|
||||
github.com/prometheus/client_golang v1.12.1/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrbd179Rt297l4aS6nDY=
|
||||
github.com/prometheus/client_golang v1.14.0 h1:nJdhIvne2eSX/XRAFV9PcvFFRbrjbcTUj0VP62TMhnw=
|
||||
github.com/prometheus/client_golang v1.14.0/go.mod h1:8vpkKitgIVNcqrRBWh1C4TIUQgYNtG/XQE4E/Zae36Y=
|
||||
github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
|
||||
github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
|
||||
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
|
||||
github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
|
||||
github.com/prometheus/client_model v0.3.0 h1:UBgGFHqYdG/TPFD1B1ogZywDqEkwp3fBMvqdiQ7Xew4=
|
||||
github.com/prometheus/client_model v0.3.0/go.mod h1:LDGWKZIo7rky3hgvBe+caln+Dr3dPggB5dvjtD7w9+w=
|
||||
github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4=
|
||||
github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo=
|
||||
github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc=
|
||||
github.com/prometheus/common v0.32.1/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls=
|
||||
github.com/prometheus/common v0.37.0 h1:ccBbHCgIiT9uSoFY0vX8H3zsNR5eLt17/RQLUvn8pXE=
|
||||
github.com/prometheus/common v0.37.0/go.mod h1:phzohg0JFMnBEFGxTDbfu3QyL5GI8gTQJFhYO5B3mfA=
|
||||
github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
|
||||
github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
|
||||
github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU=
|
||||
github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA=
|
||||
github.com/prometheus/procfs v0.7.3/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA=
|
||||
github.com/prometheus/procfs v0.8.0 h1:ODq8ZFEaYeCaZOJlZZdJA2AbQR98dSHSM1KW/You5mo=
|
||||
github.com/prometheus/procfs v0.8.0/go.mod h1:z7EfXMXOkbkqb9IINtpCn86r/to3BnA0uaxHdg830/4=
|
||||
github.com/prometheus/client_golang v1.19.0 h1:ygXvpU1AoN1MhdzckN+PyD9QJOSD4x7kmXYlnfbA6JU=
|
||||
github.com/prometheus/client_golang v1.19.0/go.mod h1:ZRM9uEAypZakd+q/x7+gmsvXdURP+DABIEIjnmDdp+k=
|
||||
github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p8ais2e9E=
|
||||
github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY=
|
||||
github.com/prometheus/common v0.52.3 h1:5f8uj6ZwHSscOGNdIQg6OiZv/ybiK2CO2q2drVZAQSA=
|
||||
github.com/prometheus/common v0.52.3/go.mod h1:BrxBKv3FWBIGXw89Mg1AeBq7FSyRzXWI3l3e7W3RN5U=
|
||||
github.com/prometheus/procfs v0.13.0 h1:GqzLlQyfsPbaEHaQkO7tbDlriv/4o5Hudv6OXHGKX7o=
|
||||
github.com/prometheus/procfs v0.13.0/go.mod h1:cd4PFCR54QLnGKPaKGA6l+cfuNXtht43ZKY6tow0Y1g=
|
||||
github.com/redis/go-redis/v9 v9.7.3 h1:YpPyAayJV+XErNsatSElgRZZVCwXX9QzkKYNvO7x0wM=
|
||||
github.com/redis/go-redis/v9 v9.7.3/go.mod h1:bGUrSggJ9X9GUmZpZNEOQKaANxSGgOEBRltRTZHSvrA=
|
||||
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
|
||||
github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ=
|
||||
github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
|
||||
github.com/robfig/cron/v3 v3.0.1 h1:WdRxkvbJztn8LMz/QEvLN5sBU+xKpSqwwUO1Pjr4qDs=
|
||||
github.com/robfig/cron/v3 v3.0.1/go.mod h1:eQICP3HwyT7UooqI/z+Ov+PtYAWygg1TEWWzGIFLtro=
|
||||
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
|
||||
github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8=
|
||||
github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs=
|
||||
github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M=
|
||||
github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA=
|
||||
github.com/rs/xid v1.5.0 h1:mKX4bl4iPYJtEIxp6CYiUuLQ/8DYMoz0PUdtGgMFRVc=
|
||||
github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg=
|
||||
github.com/rs/zerolog v1.33.0 h1:1cU2KZkvPxNyfgEmhHAz/1A9Bz+llsdYzklWFzgp0r8=
|
||||
github.com/rs/zerolog v1.33.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss=
|
||||
@ -316,9 +186,6 @@ github.com/samber/lo v1.47.0 h1:z7RynLwP5nbyRscyvcD043DWYoOcYRv3mV8lBeqOCLc=
|
||||
github.com/samber/lo v1.47.0/go.mod h1:RmDH9Ct32Qy3gduHQuKJ3gW1fMHAnE/fAzQuf6He5cU=
|
||||
github.com/shopspring/decimal v1.4.0 h1:bxl37RwXBklmTi0C79JfXCEBD1cqqHt0bbgBAGFp81k=
|
||||
github.com/shopspring/decimal v1.4.0/go.mod h1:gawqmDU56v4yIKSwfBSFip1HdCCXN8/+DMd9qYNcwME=
|
||||
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
|
||||
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
|
||||
github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88=
|
||||
github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9ySo=
|
||||
github.com/sourcegraph/conc v0.3.0/go.mod h1:Sdozi7LEKbFPqYX2/J+iBAM6HpqSLTASQIKqDmF7Mt0=
|
||||
github.com/spf13/afero v1.11.0 h1:WJQKhtpdm3v2IzqG8VMqrr6Rf3UYpEF239Jy9wNepM8=
|
||||
@ -330,335 +197,86 @@ github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An
|
||||
github.com/spf13/viper v1.19.0 h1:RWq5SEjt8o25SROyN3z2OrDB9l7RPd3lwTWU8EcEdcI=
|
||||
github.com/spf13/viper v1.19.0/go.mod h1:GQUN9bilAbhU/jgc1bKs99f/suXKeUMct8Adx5+Ntkg=
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
|
||||
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
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/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8=
|
||||
github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU=
|
||||
github.com/tinylib/msgp v1.2.4 h1:yLFeUGostXXSGW5vxfT5dXG/qzkn4schv2I7at5+hVU=
|
||||
github.com/tinylib/msgp v1.2.4/go.mod h1:ykjzy2wzgrlvpDCRc4LA8UXy6D8bzMSuAF3WD57Gok0=
|
||||
github.com/tinylib/msgp v1.2.5 h1:WeQg1whrXRFiZusidTQqzETkRpGjFjcIhW6uqWH09po=
|
||||
github.com/tinylib/msgp v1.2.5/go.mod h1:ykjzy2wzgrlvpDCRc4LA8UXy6D8bzMSuAF3WD57Gok0=
|
||||
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/fasthttp v1.57.0 h1:Xw8SjWGEP/+wAAgyy5XTvgrWlOD1+TxbbvNADYCm1Tg=
|
||||
github.com/valyala/fasthttp v1.57.0/go.mod h1:h6ZBaPRlzpZ6O3H5t2gEk1Qi33+TmLvfwgLLp0t9CpE=
|
||||
github.com/valyala/tcplisten v1.0.0 h1:rBHj/Xf+E1tRGZyWIWwJDiRY0zc1Js+CV5DqwacVSA8=
|
||||
github.com/valyala/tcplisten v1.0.0/go.mod h1:T0xQ8SeCZGxckz9qRXTfG43PvQ/mcWh7FwZEA7Ioqkc=
|
||||
github.com/vmihailenco/msgpack/v5 v5.3.5 h1:5gO0H1iULLWGhs2H5tbAHIZTV8/cYafcFOr9znI5mJU=
|
||||
github.com/vmihailenco/msgpack/v5 v5.3.5/go.mod h1:7xyJ9e+0+9SaZT0Wt1RGleJXzli6Q/V5KbhBonMG9jc=
|
||||
github.com/vmihailenco/tagparser/v2 v2.0.0 h1:y09buUbR+b5aycVFQs/g70pqKVZNBmxwAhO7/IwNM9g=
|
||||
github.com/vmihailenco/tagparser/v2 v2.0.0/go.mod h1:Wri+At7QHww0WTrCBeu4J6bNtoV6mEfg5OIWRZA9qds=
|
||||
github.com/valyala/fasthttp v1.59.0 h1:Qu0qYHfXvPk1mSLNqcFtEk6DpxgA26hy6bmydotDpRI=
|
||||
github.com/valyala/fasthttp v1.59.0/go.mod h1:GTxNb9Bc6r2a9D0TWNSPwDz78UxnTGBViY3xZNEqyYU=
|
||||
github.com/valyala/fastjson v1.6.4 h1:uAUNq9Z6ymTgGhcm0UynUAB6tlbakBrz6CQFax3BXVQ=
|
||||
github.com/valyala/fastjson v1.6.4/go.mod h1:CLCAqky6SMuOcxStkYQvblddUtoRxhYMGLrsQns1aXY=
|
||||
github.com/xyproto/randomstring v1.0.5 h1:YtlWPoRdgMu3NZtP45drfy1GKoojuR7hmRcnhZqKjWU=
|
||||
github.com/xyproto/randomstring v1.0.5/go.mod h1:rgmS5DeNXLivK7YprL0pY+lTuhNQW3iGxZ18UQApw/E=
|
||||
github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||
github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||
github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
|
||||
go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU=
|
||||
go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8=
|
||||
go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
|
||||
go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
|
||||
go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
|
||||
go.opentelemetry.io/otel v1.32.0 h1:WnBN+Xjcteh0zdk01SVqV55d/m62NJLJdIyb4y/WO5U=
|
||||
go.opentelemetry.io/otel v1.32.0/go.mod h1:00DCVSB0RQcnzlwyTfqtxSm+DRr9hpYrHjNGiBHVQIg=
|
||||
go.opentelemetry.io/otel/metric v1.32.0 h1:xV2umtmNcThh2/a/aCP+h64Xx5wsj8qqnkYZktzNa0M=
|
||||
go.opentelemetry.io/otel/metric v1.32.0/go.mod h1:jH7CIbbK6SH2V2wE16W05BHCtIDzauciCRLoc/SyMv8=
|
||||
go.opentelemetry.io/otel/sdk v1.32.0 h1:RNxepc9vK59A8XsgZQouW8ue8Gkb4jpWtJm9ge5lEG4=
|
||||
go.opentelemetry.io/otel/sdk v1.32.0/go.mod h1:LqgegDBjKMmb2GC6/PrTnteJG39I8/vJCAP9LlJXEjU=
|
||||
go.opentelemetry.io/otel/sdk/metric v1.32.0 h1:rZvFnvmvawYb0alrYkjraqJq0Z4ZUJAiyYCU9snn1CU=
|
||||
go.opentelemetry.io/otel/sdk/metric v1.32.0/go.mod h1:PWeZlq0zt9YkYAp3gjKZ0eicRYvOh1Gd+X99x6GHpCQ=
|
||||
go.opentelemetry.io/otel/trace v1.32.0 h1:WIC9mYrXf8TmY/EXuULKc8hR17vE+Hjv2cssQDe03fM=
|
||||
go.opentelemetry.io/otel/trace v1.32.0/go.mod h1:+i4rkvCraA+tG6AzwloGaCtkx53Fa+L+V8e9a7YvhT8=
|
||||
go.uber.org/mock v0.4.0 h1:VcM4ZOtdbR4f6VXfiOpwpVJDL6lCReaZ6mw31wqh7KU=
|
||||
go.uber.org/mock v0.4.0/go.mod h1:a6FSlNadKUHUa9IP5Vyt1zh4fC7uAwxMutEAscFbkZc=
|
||||
go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0=
|
||||
go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y=
|
||||
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||
golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||
golang.org/x/crypto v0.28.0 h1:GBDwsMXVQi34v5CCYUm2jkJvu4cbtru2U4TN2PSyQnw=
|
||||
golang.org/x/crypto v0.28.0/go.mod h1:rmgy+3RHxRZMyY0jjAJShp2zgEdOqj2AO7U0pYmeQ7U=
|
||||
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||
golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=
|
||||
golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek=
|
||||
golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY=
|
||||
golang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4=
|
||||
golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4=
|
||||
golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4=
|
||||
golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM=
|
||||
golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU=
|
||||
golang.org/x/crypto v0.33.0 h1:IOBPskki6Lysi0lo9qQvbxiQ+FvsCC/YWOecCHAixus=
|
||||
golang.org/x/crypto v0.33.0/go.mod h1:bVdXmD7IV/4GdElGPozy6U7lWdRXA4qyRVGJV57uQ5M=
|
||||
golang.org/x/exp v0.0.0-20241009180824-f66d83c29e7c h1:7dEasQXItcW1xKJ2+gg5VOiBnqWrJc+rq0DPKyvvdbY=
|
||||
golang.org/x/exp v0.0.0-20241009180824-f66d83c29e7c/go.mod h1:NQtJDoLvd6faHhE7m4T/1IY708gDefGGjR/iUW8yQQ8=
|
||||
golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js=
|
||||
golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
|
||||
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
|
||||
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
|
||||
golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
|
||||
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
|
||||
golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
|
||||
golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
|
||||
golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
|
||||
golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs=
|
||||
golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY=
|
||||
golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY=
|
||||
golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE=
|
||||
golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o=
|
||||
golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc=
|
||||
golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY=
|
||||
golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
|
||||
golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
|
||||
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||
golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks=
|
||||
golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20200222125558-5a598a2470a0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
|
||||
golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
|
||||
golang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
|
||||
golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
|
||||
golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
|
||||
golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
|
||||
golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
|
||||
golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
|
||||
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM=
|
||||
golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||
golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
|
||||
golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
|
||||
golang.org/x/net v0.30.0 h1:AcW1SDZMkb8IpzCdQUaIq2sP4sZ4zw+55h6ynffypl4=
|
||||
golang.org/x/net v0.30.0/go.mod h1:2wGyMJ5iFasEhkwi13ChkO/t1ECNC4X4eBKkVFyYFlU=
|
||||
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
||||
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
||||
golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
||||
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
||||
golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
|
||||
golang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc=
|
||||
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/net v0.35.0 h1:T5GQRQb2y08kTAByq9L4/bz8cipCdA8FbRTXewonqY8=
|
||||
golang.org/x/net v0.35.0/go.mod h1:EglIi67kWsHKlRzzVMUD93VMSWGFOMSZgxFjparz1Qk=
|
||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ=
|
||||
golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
|
||||
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sync v0.11.0 h1:GGz8+XQP4FvTTrjZPzNKTMFtSXH80RAzG+5ghFPgK9w=
|
||||
golang.org/x/sync v0.11.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
|
||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/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-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/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.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo=
|
||||
golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/sys v0.30.0 h1:QjkSwP/36a20jFYWkSue1YwXzLmsV5Gfq7Eiy72C1uc=
|
||||
golang.org/x/sys v0.30.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
||||
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
|
||||
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.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
|
||||
golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM=
|
||||
golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY=
|
||||
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||
golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||
golang.org/x/text v0.22.0 h1:bofq7m3/HAFvbF51jz3Q9wLg3jkvSPuiZu/pD1XwgtM=
|
||||
golang.org/x/text v0.22.0/go.mod h1:YRoo4H8PVmsu+E3Ou7cqLVH8oXWIHVoX0jqUWALQhfY=
|
||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
|
||||
golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
||||
golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
||||
golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
||||
golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
|
||||
golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
|
||||
golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
|
||||
golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
|
||||
golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
|
||||
golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
|
||||
golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
|
||||
golang.org/x/tools v0.0.0-20191227053925-7b8e75db28f4/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
|
||||
golang.org/x/tools v0.0.0-20200117161641-43d50277825c/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
|
||||
golang.org/x/tools v0.0.0-20200122220014-bf1340f18c4a/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
|
||||
golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
|
||||
golang.org/x/tools v0.0.0-20200204074204-1cc6d1ef6c74/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
|
||||
golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
|
||||
golang.org/x/tools v0.0.0-20200212150539-ea181f53ac56/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
|
||||
golang.org/x/tools v0.0.0-20200224181240-023911ca70b2/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
|
||||
golang.org/x/tools v0.0.0-20200227222343-706bc42d1f0d/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
|
||||
golang.org/x/tools v0.0.0-20200304193943-95d2e580d8eb/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw=
|
||||
golang.org/x/tools v0.0.0-20200312045724-11d5b4c81c7d/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw=
|
||||
golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8=
|
||||
golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
|
||||
golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
|
||||
golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
|
||||
golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
|
||||
golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
|
||||
golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
|
||||
golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
|
||||
golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
|
||||
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE=
|
||||
google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M=
|
||||
google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg=
|
||||
google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg=
|
||||
google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI=
|
||||
google.golang.org/api v0.14.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI=
|
||||
google.golang.org/api v0.15.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI=
|
||||
google.golang.org/api v0.17.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE=
|
||||
google.golang.org/api v0.18.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE=
|
||||
google.golang.org/api v0.19.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE=
|
||||
google.golang.org/api v0.20.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE=
|
||||
google.golang.org/api v0.22.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE=
|
||||
google.golang.org/api v0.24.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE=
|
||||
google.golang.org/api v0.28.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE=
|
||||
google.golang.org/api v0.29.0/go.mod h1:Lcubydp8VUV7KeIHD9z2Bys/sm/vGKnG1UHuDBSrHWM=
|
||||
google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz5138Fc=
|
||||
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
|
||||
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
|
||||
google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
|
||||
google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0=
|
||||
google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=
|
||||
google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=
|
||||
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
|
||||
google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
|
||||
google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
|
||||
google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
|
||||
google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
|
||||
google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
|
||||
google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
|
||||
google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8=
|
||||
google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
|
||||
google.golang.org/genproto v0.0.0-20191115194625-c23dd37a84c9/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
|
||||
google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
|
||||
google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
|
||||
google.golang.org/genproto v0.0.0-20200115191322-ca5a22157cba/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
|
||||
google.golang.org/genproto v0.0.0-20200122232147-0452cf42e150/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
|
||||
google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA=
|
||||
google.golang.org/genproto v0.0.0-20200212174721-66ed5ce911ce/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
|
||||
google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
|
||||
google.golang.org/genproto v0.0.0-20200228133532-8c2c7df3a383/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
|
||||
google.golang.org/genproto v0.0.0-20200305110556-506484158171/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
|
||||
google.golang.org/genproto v0.0.0-20200312145019-da6875a35672/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
|
||||
google.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
|
||||
google.golang.org/genproto v0.0.0-20200430143042-b979b6f78d84/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
|
||||
google.golang.org/genproto v0.0.0-20200511104702-f5ebc3bea380/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
|
||||
google.golang.org/genproto v0.0.0-20200515170657-fc4c6c6a6587/go.mod h1:YsZOwe1myG/8QRHRsmBRE1LrgQY60beZKjly0O1fX9U=
|
||||
google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo=
|
||||
google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA=
|
||||
google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
||||
google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
||||
google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20241021214115-324edc3d5d38 h1:zciRKQ4kBpFgpfC5QQCVtnnNAcLIqweL7plyZRQHVpI=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20241021214115-324edc3d5d38/go.mod h1:GX3210XPVPUjJbTUbvwI8f2IpZDMZuPJWDzDuebbviI=
|
||||
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
|
||||
google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38=
|
||||
google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM=
|
||||
google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
|
||||
google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY=
|
||||
google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
|
||||
google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
|
||||
google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
|
||||
google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60=
|
||||
google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk=
|
||||
google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak=
|
||||
google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak=
|
||||
google.golang.org/grpc v1.67.1 h1:zWnc1Vrcno+lHZCOofnIMvycFcc0QRGIzm9dhnDX68E=
|
||||
google.golang.org/grpc v1.67.1/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA=
|
||||
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
|
||||
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
|
||||
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
|
||||
google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE=
|
||||
google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo=
|
||||
google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
|
||||
google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
|
||||
google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
|
||||
google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4=
|
||||
google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
|
||||
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
|
||||
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
|
||||
google.golang.org/protobuf v1.35.1 h1:m3LfL6/Ca+fqnjnlqQXNpFPABW1UD7mjh8KO2mKFytA=
|
||||
google.golang.org/protobuf v1.35.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=
|
||||
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20250127172529-29210b9bc287 h1:J1H9f+LEdWAfHcez/4cvaVBox7cOYT+IU6rgqj5x++8=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20250127172529-29210b9bc287/go.mod h1:8BS3B93F/U1juMFq9+EDk+qOT5CO1R9IzXxG3PTqiRk=
|
||||
google.golang.org/grpc v1.70.0 h1:pWFv03aZoHzlRKHWicjsZytKAiYCtNS0dHbXnIdq7jQ=
|
||||
google.golang.org/grpc v1.70.0/go.mod h1:ofIJqVKDXx/JiXrwr2IG4/zwdH9txy3IlF40RmcJSQw=
|
||||
google.golang.org/protobuf v1.36.4 h1:6A3ZDJHn/eNqc1i+IdefRzy/9PokBTPvcqMySR7NNIM=
|
||||
google.golang.org/protobuf v1.36.4/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=
|
||||
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-20190902080502-41f04d3bba15/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/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
|
||||
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
|
||||
gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA=
|
||||
gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
|
||||
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
@ -675,13 +293,3 @@ gorm.io/driver/sqlserver v1.4.1/go.mod h1:DJ4P+MeZbc5rvY58PnmN1Lnyvb5gw5NPzGshHD
|
||||
gorm.io/gorm v1.25.7/go.mod h1:hbnx/Oo0ChWMn1BIhpy1oYozzpM15i4YPuHDmfYtwg8=
|
||||
gorm.io/gorm v1.25.12 h1:I0u8i2hWQItBq1WfE0o2+WuL9+8L21K9e2HHSTE/0f8=
|
||||
gorm.io/gorm v1.25.12/go.mod h1:xh7N7RHfYlNc5EmcI/El95gXusucDrQnHXe0+CgWcLQ=
|
||||
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||
honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||
honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||
honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
|
||||
honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
|
||||
honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
|
||||
rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8=
|
||||
rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0=
|
||||
rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA=
|
||||
|
24
pkg/internal/cache/store.go
vendored
24
pkg/internal/cache/store.go
vendored
@ -1,24 +0,0 @@
|
||||
package cache
|
||||
|
||||
import (
|
||||
"github.com/dgraph-io/ristretto"
|
||||
"github.com/eko/gocache/lib/v4/store"
|
||||
ristrettoCache "github.com/eko/gocache/store/ristretto/v4"
|
||||
)
|
||||
|
||||
var S store.StoreInterface
|
||||
|
||||
func NewStore() error {
|
||||
ris, err := ristretto.NewCache(&ristretto.Config{
|
||||
NumCounters: 1e7,
|
||||
MaxCost: 1 << 27,
|
||||
BufferItems: 64,
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
S = ristrettoCache.NewRistretto(ris)
|
||||
|
||||
return nil
|
||||
}
|
@ -10,13 +10,20 @@ var AutoMaintainRange = []any{
|
||||
&models.Category{},
|
||||
&models.Tag{},
|
||||
&models.Post{},
|
||||
&models.Reaction{},
|
||||
&models.PostInsight{},
|
||||
&models.Subscription{},
|
||||
&models.Poll{},
|
||||
&models.PollAnswer{},
|
||||
&models.PostFlag{},
|
||||
&models.PostView{},
|
||||
}
|
||||
|
||||
func RunMigration(source *gorm.DB) error {
|
||||
if err := source.AutoMigrate(
|
||||
AutoMaintainRange...,
|
||||
append(
|
||||
AutoMaintainRange,
|
||||
&models.Reaction{},
|
||||
)...,
|
||||
); err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -2,10 +2,13 @@ package gap
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"git.solsynth.dev/hypernet/nexus/pkg/nex"
|
||||
"git.solsynth.dev/hypernet/nexus/pkg/nex/cachekit"
|
||||
"git.solsynth.dev/hypernet/pusher/pkg/pushkit/pushcon"
|
||||
"github.com/samber/lo"
|
||||
"strings"
|
||||
|
||||
"git.solsynth.dev/hypernet/nexus/pkg/proto"
|
||||
"github.com/rs/zerolog/log"
|
||||
@ -13,8 +16,11 @@ import (
|
||||
"github.com/spf13/viper"
|
||||
)
|
||||
|
||||
var Nx *nex.Conn
|
||||
var Px *pushcon.Conn
|
||||
var (
|
||||
Nx *nex.Conn
|
||||
Px *pushcon.Conn
|
||||
Ca *cachekit.Conn
|
||||
)
|
||||
|
||||
func InitializeToNexus() error {
|
||||
grpcBind := strings.SplitN(viper.GetString("grpc_bind"), ":", 2)
|
||||
@ -47,6 +53,10 @@ func InitializeToNexus() error {
|
||||
return fmt.Errorf("error during initialize pushcon: %v", err)
|
||||
}
|
||||
|
||||
return err
|
||||
Ca, err = cachekit.NewConn(Nx, 3*time.Second)
|
||||
if err != nil {
|
||||
return fmt.Errorf("error during initialize cachekit: %v", err)
|
||||
}
|
||||
|
||||
return err
|
||||
}
|
||||
|
@ -2,10 +2,14 @@ package grpc
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"git.solsynth.dev/hypernet/interactive/pkg/internal/database"
|
||||
"git.solsynth.dev/hypernet/interactive/pkg/internal/models"
|
||||
"git.solsynth.dev/hypernet/interactive/pkg/internal/services"
|
||||
"git.solsynth.dev/hypernet/nexus/pkg/nex"
|
||||
"git.solsynth.dev/hypernet/nexus/pkg/proto"
|
||||
"strconv"
|
||||
jsoniter "github.com/json-iterator/go"
|
||||
"github.com/rs/zerolog/log"
|
||||
)
|
||||
|
||||
func (v *App) BroadcastEvent(ctx context.Context, in *proto.EventInfo) (*proto.EventResponse, error) {
|
||||
@ -18,22 +22,36 @@ func (v *App) BroadcastEvent(ctx context.Context, in *proto.EventInfo) (*proto.E
|
||||
}
|
||||
switch resType {
|
||||
case "account":
|
||||
id, ok := data["id"].(string)
|
||||
if !ok {
|
||||
break
|
||||
var data struct {
|
||||
ID int `json:"id"`
|
||||
}
|
||||
numericId, err := strconv.Atoi(id)
|
||||
if err != nil {
|
||||
if err := jsoniter.Unmarshal(in.GetData(), &data); err != nil {
|
||||
break
|
||||
}
|
||||
tx := database.C.Begin()
|
||||
for _, model := range database.AutoMaintainRange {
|
||||
switch model.(type) {
|
||||
default:
|
||||
tx.Delete(model, "account_id = ?", numericId)
|
||||
tx.Delete(model, "account_id = ?", data.ID)
|
||||
}
|
||||
}
|
||||
tx.Commit()
|
||||
case "realm":
|
||||
var data struct {
|
||||
ID int `json:"id"`
|
||||
}
|
||||
if err := jsoniter.Unmarshal(in.GetData(), &data); err != nil {
|
||||
break
|
||||
}
|
||||
var posts []models.Post
|
||||
if err := database.C.Where("realm_id = ?", data.ID).
|
||||
Select("Body").Select("ID").
|
||||
Find(&posts).Error; err != nil {
|
||||
break
|
||||
}
|
||||
if err := services.DeletePostInBatch(posts); err != nil {
|
||||
log.Error().Err(err).Msg("An error occurred when deleting post...")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
6
pkg/internal/http/admin/index.go
Normal file
6
pkg/internal/http/admin/index.go
Normal file
@ -0,0 +1,6 @@
|
||||
package admin
|
||||
|
||||
import "github.com/gofiber/fiber/v2"
|
||||
|
||||
func MapControllers(app *fiber.App, baseURL string) {
|
||||
}
|
146
pkg/internal/http/api/activitypub_api.go
Normal file
146
pkg/internal/http/api/activitypub_api.go
Normal file
@ -0,0 +1,146 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"math"
|
||||
"net/http"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"git.solsynth.dev/hypernet/interactive/pkg/internal/database"
|
||||
"git.solsynth.dev/hypernet/interactive/pkg/internal/models"
|
||||
"git.solsynth.dev/hypernet/interactive/pkg/internal/services"
|
||||
"github.com/go-ap/activitypub"
|
||||
"github.com/gofiber/fiber/v2"
|
||||
"github.com/samber/lo"
|
||||
)
|
||||
|
||||
func apUserInbox(c *fiber.Ctx) error {
|
||||
name := c.Params("name")
|
||||
|
||||
var activity activitypub.Activity
|
||||
if err := c.BodyParser(&activity); err != nil {
|
||||
return fiber.NewError(fiber.StatusBadRequest, "invalid activitypub event")
|
||||
}
|
||||
|
||||
// TODO Handle all these
|
||||
switch activity.Type {
|
||||
case activitypub.LikeType:
|
||||
log.Printf("User %s received a Like on: %s", name, activity.Object.GetID())
|
||||
case activitypub.FollowType:
|
||||
log.Printf("User %s received a Follow request from: %s", name, activity.Actor.GetID())
|
||||
case activitypub.CreateType:
|
||||
log.Printf("New post received for %s: %s", name, activity.Object.GetID())
|
||||
default:
|
||||
log.Printf("Unhandled activity type received: %+v", activity)
|
||||
}
|
||||
|
||||
return c.Status(http.StatusAccepted).SendString("Activity received")
|
||||
}
|
||||
|
||||
func apUserOutbox(c *fiber.Ctx) error {
|
||||
name := c.Params("name")
|
||||
page := c.QueryInt("page", 1)
|
||||
limit := c.QueryInt("limit", 10)
|
||||
|
||||
if limit > 100 {
|
||||
limit = 100
|
||||
}
|
||||
|
||||
var publisher models.Publisher
|
||||
if err := database.C.Where("name = ?", name).First(&publisher).Error; err != nil {
|
||||
return fiber.NewError(fiber.StatusNotFound, err.Error())
|
||||
}
|
||||
|
||||
tx, err := services.UniversalPostFilter(c, database.C)
|
||||
tx.Where("publisher_id = ? AND reply_id IS NULL", publisher.ID)
|
||||
if err != nil {
|
||||
return fiber.NewError(fiber.StatusBadRequest, err.Error())
|
||||
}
|
||||
|
||||
count, err := services.CountPost(tx)
|
||||
if err != nil {
|
||||
return fiber.NewError(fiber.StatusInternalServerError, err.Error())
|
||||
}
|
||||
|
||||
var activities []activitypub.Item
|
||||
if posts, err := services.ListPost(tx, limit, (page-1)*limit, "published_at DESC", nil); err != nil {
|
||||
return fiber.NewError(fiber.StatusInternalServerError, err.Error())
|
||||
} else {
|
||||
for _, post := range posts {
|
||||
var content string
|
||||
if val, ok := post.Body["content"].(string); ok {
|
||||
content = val
|
||||
} else {
|
||||
content = "Posted a post"
|
||||
}
|
||||
note := activitypub.Note{
|
||||
ID: services.GetActivityID("/posts/" + strconv.Itoa(int(post.ID))),
|
||||
Type: activitypub.NoteType,
|
||||
Attachment: nil,
|
||||
AttributedTo: services.GetActivityIRI("/users/" + publisher.Name),
|
||||
Published: lo.TernaryF(post.PublishedAt == nil, func() time.Time {
|
||||
return post.CreatedAt
|
||||
}, func() time.Time {
|
||||
return *post.PublishedAt
|
||||
}),
|
||||
Updated: lo.TernaryF(post.EditedAt == nil, func() time.Time {
|
||||
return post.UpdatedAt
|
||||
}, func() time.Time {
|
||||
return *post.EditedAt
|
||||
}),
|
||||
To: activitypub.ItemCollection{activitypub.PublicNS},
|
||||
Content: activitypub.DefaultNaturalLanguageValue(content),
|
||||
}
|
||||
activity := activitypub.Create{
|
||||
ID: services.GetActivityID("/activities/posts/" + strconv.Itoa(int(post.ID))),
|
||||
Type: activitypub.CreateType,
|
||||
Actor: services.GetActivityIRI("/users/" + publisher.Name),
|
||||
Object: note,
|
||||
}
|
||||
activities = append(activities, activity)
|
||||
}
|
||||
}
|
||||
|
||||
totalPages := int(math.Ceil(float64(count) / float64(limit)))
|
||||
|
||||
outbox := activitypub.OrderedCollectionPage{
|
||||
ID: services.GetActivityID("/users/" + publisher.Name + "/outbox"),
|
||||
Type: activitypub.OrderedCollectionType,
|
||||
TotalItems: uint(count),
|
||||
OrderedItems: activitypub.ItemCollection(activities),
|
||||
First: services.GetActivityIRI(fmt.Sprintf("/users/%s/outbox?page=%d", publisher.Name, 1)),
|
||||
Last: services.GetActivityIRI(fmt.Sprintf("/users/%s/outbox?page=%d", publisher.Name, totalPages)),
|
||||
}
|
||||
|
||||
if page > 1 {
|
||||
outbox.Prev = services.GetActivityIRI(fmt.Sprintf("/users/%s/outbox?page=%d&limit=%d", publisher.Name, page-1, limit))
|
||||
}
|
||||
if page < totalPages {
|
||||
outbox.Next = services.GetActivityIRI(fmt.Sprintf("/users/%s/outbox?page=%d&limit=%d", publisher.Name, page+1, limit))
|
||||
}
|
||||
|
||||
return c.JSON(outbox)
|
||||
}
|
||||
|
||||
func apUserActor(c *fiber.Ctx) error {
|
||||
name := c.Params("name")
|
||||
|
||||
var publisher models.Publisher
|
||||
if err := database.C.Where("name = ?", name).First(&publisher).Error; err != nil {
|
||||
return c.Status(404).JSON(fiber.Map{"error": "User not found"})
|
||||
}
|
||||
|
||||
id := services.GetActivityID("/users/" + publisher.Name)
|
||||
actor := activitypub.Actor{
|
||||
ID: id,
|
||||
Inbox: id + "/inbox",
|
||||
Outbox: id + "/outbox",
|
||||
Type: activitypub.PersonType,
|
||||
Name: activitypub.DefaultNaturalLanguageValue(publisher.Name),
|
||||
PreferredUsername: activitypub.DefaultNaturalLanguageValue(publisher.Nick),
|
||||
}
|
||||
|
||||
return c.JSON(actor)
|
||||
}
|
@ -1,12 +1,13 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"git.solsynth.dev/hypernet/nexus/pkg/nex/cruda"
|
||||
"git.solsynth.dev/hypernet/nexus/pkg/nex/sec"
|
||||
"git.solsynth.dev/hypernet/passport/pkg/authkit"
|
||||
authm "git.solsynth.dev/hypernet/passport/pkg/authkit/models"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"git.solsynth.dev/hypernet/interactive/pkg/internal/database"
|
||||
"git.solsynth.dev/hypernet/interactive/pkg/internal/gap"
|
||||
@ -40,6 +41,7 @@ func createArticle(c *fiber.Ctx) error {
|
||||
InvisibleUsers []uint `json:"invisible_users_list"`
|
||||
Visibility *int8 `json:"visibility"`
|
||||
IsDraft bool `json:"is_draft"`
|
||||
Realm *uint `json:"realm"`
|
||||
}
|
||||
|
||||
if err := exts.BindAndValidate(c, &data); err != nil {
|
||||
@ -82,6 +84,13 @@ func createArticle(c *fiber.Ctx) error {
|
||||
item.PublishedAt = lo.ToPtr(time.Now())
|
||||
}
|
||||
|
||||
if data.Realm != nil {
|
||||
if _, err := authkit.GetRealmMember(gap.Nx, *data.Realm, user.ID); err != nil {
|
||||
return fiber.NewError(fiber.StatusBadRequest, fmt.Sprintf("you are not a member of realm #%d", *data.Realm))
|
||||
}
|
||||
item.RealmID = data.Realm
|
||||
}
|
||||
|
||||
if data.Visibility != nil {
|
||||
item.Visibility = *data.Visibility
|
||||
} else {
|
||||
@ -95,7 +104,7 @@ func createArticle(c *fiber.Ctx) error {
|
||||
_ = authkit.AddEventExt(
|
||||
gap.Nx,
|
||||
"posts.new",
|
||||
strconv.Itoa(int(item.ID)),
|
||||
map[string]interface{}{"post": item},
|
||||
c,
|
||||
)
|
||||
}
|
||||
@ -141,7 +150,8 @@ func editArticle(c *fiber.Ctx) error {
|
||||
if err := database.C.Where(models.Post{
|
||||
BaseModel: cruda.BaseModel{ID: uint(id)},
|
||||
PublisherID: publisher.ID,
|
||||
}).First(&item).Error; err != nil {
|
||||
Type: models.PostTypeArticle,
|
||||
}).Preload("Publisher").First(&item).Error; err != nil {
|
||||
return fiber.NewError(fiber.StatusNotFound, err.Error())
|
||||
}
|
||||
|
||||
@ -171,6 +181,7 @@ func editArticle(c *fiber.Ctx) error {
|
||||
rawBody, _ := jsoniter.Marshal(body)
|
||||
_ = jsoniter.Unmarshal(rawBody, &bodyMapping)
|
||||
|
||||
og := item
|
||||
item.Alias = data.Alias
|
||||
item.Body = bodyMapping
|
||||
item.Language = services.DetectLanguage(data.Content)
|
||||
@ -184,17 +195,20 @@ func editArticle(c *fiber.Ctx) error {
|
||||
// Preload publisher data
|
||||
item.Publisher = publisher
|
||||
|
||||
if item.PublishedAt == nil {
|
||||
item.PublishedAt = data.PublishedAt
|
||||
}
|
||||
if data.Visibility != nil {
|
||||
item.Visibility = *data.Visibility
|
||||
}
|
||||
|
||||
if item, err = services.EditPost(item); err != nil {
|
||||
if item, err = services.EditPost(item, og); err != nil {
|
||||
return fiber.NewError(fiber.StatusBadRequest, err.Error())
|
||||
} else {
|
||||
_ = authkit.AddEventExt(
|
||||
gap.Nx,
|
||||
"posts.edit",
|
||||
strconv.Itoa(int(item.ID)),
|
||||
map[string]interface{}{"post": item},
|
||||
c,
|
||||
)
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package api
|
||||
|
||||
import (
|
||||
"git.solsynth.dev/hypernet/interactive/pkg/internal/http/exts"
|
||||
"git.solsynth.dev/hypernet/interactive/pkg/internal/models"
|
||||
"git.solsynth.dev/hypernet/interactive/pkg/internal/services"
|
||||
"git.solsynth.dev/hypernet/nexus/pkg/nex/sec"
|
||||
"github.com/gofiber/fiber/v2"
|
||||
@ -19,9 +20,23 @@ func getCategory(c *fiber.Ctx) error {
|
||||
}
|
||||
|
||||
func listCategories(c *fiber.Ctx) error {
|
||||
categories, err := services.ListCategory()
|
||||
take := c.QueryInt("take", 10)
|
||||
offset := c.QueryInt("offset", 0)
|
||||
probe := c.Query("probe")
|
||||
|
||||
if take > 100 {
|
||||
take = 100
|
||||
}
|
||||
|
||||
var categories []models.Category
|
||||
var err error
|
||||
if len(probe) > 0 {
|
||||
categories, err = services.SearchCategories(take, offset, probe)
|
||||
} else {
|
||||
categories, err = services.ListCategory(take, offset)
|
||||
}
|
||||
if err != nil {
|
||||
return fiber.NewError(fiber.StatusNotFound, err.Error())
|
||||
return fiber.NewError(fiber.StatusInternalServerError, err.Error())
|
||||
}
|
||||
|
||||
return c.JSON(categories)
|
||||
|
50
pkg/internal/http/api/flags_api.go
Normal file
50
pkg/internal/http/api/flags_api.go
Normal file
@ -0,0 +1,50 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"git.solsynth.dev/hypernet/interactive/pkg/internal/database"
|
||||
"git.solsynth.dev/hypernet/interactive/pkg/internal/models"
|
||||
"git.solsynth.dev/hypernet/interactive/pkg/internal/services"
|
||||
"git.solsynth.dev/hypernet/nexus/pkg/nex/sec"
|
||||
authm "git.solsynth.dev/hypernet/passport/pkg/authkit/models"
|
||||
"github.com/gofiber/fiber/v2"
|
||||
)
|
||||
|
||||
func createFlag(c *fiber.Ctx) error {
|
||||
if err := sec.EnsureGrantedPerm(c, "FlagPost", true); err != nil {
|
||||
return err
|
||||
}
|
||||
user := c.Locals("user").(authm.Account)
|
||||
|
||||
id := c.Params("postId")
|
||||
|
||||
var item models.Post
|
||||
var err error
|
||||
|
||||
tx := services.FilterPostDraft(database.C)
|
||||
|
||||
if numericId, paramErr := strconv.Atoi(id); paramErr == nil {
|
||||
item, err = services.GetPost(tx, uint(numericId))
|
||||
} else {
|
||||
segments := strings.Split(id, ":")
|
||||
if len(segments) != 2 {
|
||||
return fiber.NewError(fiber.StatusBadRequest, "invalid post id, must be a number or a string with two segment divided by a colon")
|
||||
}
|
||||
area := segments[0]
|
||||
alias := segments[1]
|
||||
item, err = services.GetPostByAlias(tx, alias, area)
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
return fiber.NewError(fiber.StatusNotFound, err.Error())
|
||||
}
|
||||
|
||||
flag, err := services.NewFlag(item, user.ID)
|
||||
if err != nil {
|
||||
return fiber.NewError(fiber.StatusBadRequest, err.Error())
|
||||
}
|
||||
|
||||
return c.JSON(flag)
|
||||
}
|
@ -4,9 +4,17 @@ import (
|
||||
"github.com/gofiber/fiber/v2"
|
||||
)
|
||||
|
||||
func MapAPIs(app *fiber.App, baseURL string) {
|
||||
func MapControllers(app *fiber.App, baseURL string) {
|
||||
api := app.Group(baseURL).Name("API")
|
||||
{
|
||||
api.Get("/webfinger", getWebfinger)
|
||||
activitypub := api.Group("/activitypub").Name("ActivityPub API")
|
||||
{
|
||||
activitypub.Post("/users/:name/inbox", apUserInbox)
|
||||
activitypub.Get("/users/:name/outbox", apUserOutbox)
|
||||
activitypub.Get("/users/:name", apUserActor)
|
||||
}
|
||||
|
||||
publishers := api.Group("/publishers").Name("Publisher API")
|
||||
{
|
||||
publishers.Get("/", listRelatedPublisher)
|
||||
@ -22,8 +30,8 @@ func MapAPIs(app *fiber.App, baseURL string) {
|
||||
recommendations := api.Group("/recommendations").Name("Recommendations API")
|
||||
{
|
||||
recommendations.Get("/", listRecommendation)
|
||||
recommendations.Get("/friends", listRecommendationFriends)
|
||||
recommendations.Get("/shuffle", listRecommendationShuffle)
|
||||
recommendations.Get("/feed", getRecommendationFeed)
|
||||
}
|
||||
|
||||
stories := api.Group("/stories").Name("Story API")
|
||||
@ -36,6 +44,17 @@ func MapAPIs(app *fiber.App, baseURL string) {
|
||||
articles.Post("/", createArticle)
|
||||
articles.Put("/:postId", editArticle)
|
||||
}
|
||||
questions := api.Group("/questions").Name("Question API")
|
||||
{
|
||||
questions.Post("/", createQuestion)
|
||||
questions.Put("/:postId", editQuestion)
|
||||
questions.Put("/:postId/answer", selectQuestionAnswer)
|
||||
}
|
||||
videos := api.Group("/videos").Name("Video API")
|
||||
{
|
||||
videos.Post("/", createVideo)
|
||||
videos.Put("/:postId", editVideo)
|
||||
}
|
||||
|
||||
posts := api.Group("/posts").Name("Posts API")
|
||||
{
|
||||
@ -44,14 +63,27 @@ func MapAPIs(app *fiber.App, baseURL string) {
|
||||
posts.Get("/minimal", listPostMinimal)
|
||||
posts.Get("/drafts", listDraftPost)
|
||||
posts.Get("/:postId", getPost)
|
||||
posts.Get("/:postId/insight", getPostInsight)
|
||||
posts.Post("/:postId/flag", createFlag)
|
||||
posts.Post("/:postId/react", reactPost)
|
||||
posts.Post("/:postId/pin", pinPost)
|
||||
posts.Post("/:postId/uncollapse", uncollapsePost)
|
||||
posts.Delete("/:postId", deletePost)
|
||||
|
||||
posts.Get("/:postId/replies", listPostReplies)
|
||||
posts.Get("/:postId/replies/featured", listPostFeaturedReply)
|
||||
}
|
||||
|
||||
polls := api.Group("/polls").Name("Polls API")
|
||||
{
|
||||
polls.Get("/:pollId", getPoll)
|
||||
polls.Post("/", createPoll)
|
||||
polls.Put("/:pollId", updatePoll)
|
||||
polls.Delete("/:pollId", deletePoll)
|
||||
polls.Post("/:pollId/answer", answerPoll)
|
||||
polls.Get("/:pollId/answer", getMyPollAnswer)
|
||||
}
|
||||
|
||||
subscriptions := api.Group("/subscriptions").Name("Subscriptions API")
|
||||
{
|
||||
subscriptions.Get("/users/:userId", getSubscriptionOnUser)
|
||||
|
58
pkg/internal/http/api/insight_api.go
Normal file
58
pkg/internal/http/api/insight_api.go
Normal file
@ -0,0 +1,58 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"git.solsynth.dev/hypernet/interactive/pkg/internal/database"
|
||||
"git.solsynth.dev/hypernet/interactive/pkg/internal/models"
|
||||
"git.solsynth.dev/hypernet/interactive/pkg/internal/services"
|
||||
"git.solsynth.dev/hypernet/nexus/pkg/nex/sec"
|
||||
authm "git.solsynth.dev/hypernet/passport/pkg/authkit/models"
|
||||
"github.com/gofiber/fiber/v2"
|
||||
)
|
||||
|
||||
func getPostInsight(c *fiber.Ctx) error {
|
||||
if err := sec.EnsureAuthenticated(c); err != nil {
|
||||
return err
|
||||
}
|
||||
user := c.Locals("user").(authm.Account)
|
||||
|
||||
id := c.Params("postId")
|
||||
|
||||
var item models.Post
|
||||
var err error
|
||||
|
||||
tx := services.FilterPostDraft(database.C)
|
||||
|
||||
if user, authenticated := c.Locals("user").(authm.Account); authenticated {
|
||||
tx = services.FilterPostWithUserContext(c, tx, &user)
|
||||
} else {
|
||||
tx = services.FilterPostWithUserContext(c, tx, nil)
|
||||
}
|
||||
|
||||
if numericId, paramErr := strconv.Atoi(id); paramErr == nil {
|
||||
item, err = services.GetPost(tx, uint(numericId))
|
||||
} else {
|
||||
segments := strings.Split(id, ":")
|
||||
if len(segments) != 2 {
|
||||
return fiber.NewError(fiber.StatusBadRequest, "invalid post id, must be a number or a string with two segment divided by a colon")
|
||||
}
|
||||
area := segments[0]
|
||||
alias := segments[1]
|
||||
item, err = services.GetPostByAlias(tx, alias, area)
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
return fiber.NewError(fiber.StatusNotFound, err.Error())
|
||||
}
|
||||
|
||||
response, err := services.GeneratePostInsights(item, user.ID)
|
||||
if err != nil {
|
||||
return fiber.NewError(fiber.StatusBadRequest, err.Error())
|
||||
}
|
||||
|
||||
return c.JSON(fiber.Map{
|
||||
"response": response,
|
||||
})
|
||||
}
|
78
pkg/internal/http/api/poll_answers_api.go
Normal file
78
pkg/internal/http/api/poll_answers_api.go
Normal file
@ -0,0 +1,78 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"git.solsynth.dev/hypernet/interactive/pkg/internal/database"
|
||||
"git.solsynth.dev/hypernet/interactive/pkg/internal/http/exts"
|
||||
"git.solsynth.dev/hypernet/interactive/pkg/internal/models"
|
||||
"git.solsynth.dev/hypernet/interactive/pkg/internal/services"
|
||||
"git.solsynth.dev/hypernet/nexus/pkg/nex/sec"
|
||||
authm "git.solsynth.dev/hypernet/passport/pkg/authkit/models"
|
||||
"github.com/gofiber/fiber/v2"
|
||||
)
|
||||
|
||||
func getMyPollAnswer(c *fiber.Ctx) error {
|
||||
if err := sec.EnsureAuthenticated(c); err != nil {
|
||||
return err
|
||||
}
|
||||
user := c.Locals("user").(authm.Account)
|
||||
|
||||
pollId, _ := c.ParamsInt("pollId")
|
||||
|
||||
var answer models.PollAnswer
|
||||
if err := database.C.Where("poll_id = ? AND account_id = ?", pollId, user.ID).First(&answer).Error; err != nil {
|
||||
return fiber.NewError(fiber.StatusNotFound, err.Error())
|
||||
}
|
||||
|
||||
return c.JSON(answer)
|
||||
}
|
||||
|
||||
func answerPoll(c *fiber.Ctx) error {
|
||||
pollId, _ := c.ParamsInt("pollId")
|
||||
|
||||
if err := sec.EnsureAuthenticated(c); err != nil {
|
||||
return err
|
||||
}
|
||||
user := c.Locals("user").(authm.Account)
|
||||
|
||||
var data struct {
|
||||
Answer string `json:"answer" validate:"required"`
|
||||
}
|
||||
|
||||
if err := exts.BindAndValidate(c, &data); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
var poll models.Poll
|
||||
if err := database.C.Where("id = ?", pollId).First(&poll).Error; err != nil {
|
||||
return fiber.NewError(fiber.StatusBadRequest, err.Error())
|
||||
}
|
||||
|
||||
if poll.ExpiredAt != nil && time.Now().Unix() >= poll.ExpiredAt.Unix() {
|
||||
return fiber.NewError(fiber.StatusBadRequest, "poll has been ended")
|
||||
}
|
||||
|
||||
doesContains := false
|
||||
for _, option := range poll.Options {
|
||||
if option.ID == data.Answer {
|
||||
doesContains = true
|
||||
break
|
||||
}
|
||||
}
|
||||
if !doesContains {
|
||||
return fiber.NewError(fiber.StatusBadRequest, "poll does not have a option like that")
|
||||
}
|
||||
|
||||
answer := models.PollAnswer{
|
||||
Answer: data.Answer,
|
||||
PollID: poll.ID,
|
||||
AccountID: user.ID,
|
||||
}
|
||||
|
||||
if answer, err := services.AddPollAnswer(poll, answer); err != nil {
|
||||
return fiber.NewError(fiber.StatusBadRequest, err.Error())
|
||||
} else {
|
||||
return c.JSON(answer)
|
||||
}
|
||||
}
|
108
pkg/internal/http/api/polls_api.go
Normal file
108
pkg/internal/http/api/polls_api.go
Normal file
@ -0,0 +1,108 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"git.solsynth.dev/hypernet/interactive/pkg/internal/database"
|
||||
"git.solsynth.dev/hypernet/interactive/pkg/internal/http/exts"
|
||||
"git.solsynth.dev/hypernet/interactive/pkg/internal/models"
|
||||
"git.solsynth.dev/hypernet/interactive/pkg/internal/services"
|
||||
"git.solsynth.dev/hypernet/nexus/pkg/nex/sec"
|
||||
authm "git.solsynth.dev/hypernet/passport/pkg/authkit/models"
|
||||
"github.com/gofiber/fiber/v2"
|
||||
)
|
||||
|
||||
func getPoll(c *fiber.Ctx) error {
|
||||
pollId, _ := c.ParamsInt("pollId")
|
||||
|
||||
var poll models.Poll
|
||||
if err := database.C.Where("id = ?", pollId).First(&poll).Error; err != nil {
|
||||
return fiber.NewError(fiber.StatusNotFound, err.Error())
|
||||
}
|
||||
|
||||
poll.Metric = services.GetPollMetric(poll)
|
||||
|
||||
return c.JSON(poll)
|
||||
}
|
||||
|
||||
func createPoll(c *fiber.Ctx) error {
|
||||
if err := sec.EnsureAuthenticated(c); err != nil {
|
||||
return err
|
||||
}
|
||||
user := c.Locals("user").(authm.Account)
|
||||
|
||||
var data struct {
|
||||
Options []models.PollOption `json:"options" validate:"required"`
|
||||
ExpiredAt *time.Time `json:"expired_at"`
|
||||
}
|
||||
|
||||
if err := exts.BindAndValidate(c, &data); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
poll := models.Poll{
|
||||
ExpiredAt: data.ExpiredAt,
|
||||
Options: data.Options,
|
||||
AccountID: user.ID,
|
||||
}
|
||||
|
||||
var err error
|
||||
if poll, err = services.NewPoll(poll); err != nil {
|
||||
return fiber.NewError(fiber.StatusBadRequest, err.Error())
|
||||
}
|
||||
|
||||
return c.JSON(poll)
|
||||
}
|
||||
|
||||
func updatePoll(c *fiber.Ctx) error {
|
||||
pollId, _ := c.ParamsInt("pollId")
|
||||
|
||||
if err := sec.EnsureAuthenticated(c); err != nil {
|
||||
return err
|
||||
}
|
||||
user := c.Locals("user").(authm.Account)
|
||||
|
||||
var data struct {
|
||||
Options []models.PollOption `json:"options" validate:"required"`
|
||||
ExpiredAt *time.Time `json:"expired_at"`
|
||||
}
|
||||
|
||||
if err := exts.BindAndValidate(c, &data); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
var poll models.Poll
|
||||
if err := database.C.Where("id = ? AND account_id = ?", pollId, user.ID).First(&poll).Error; err != nil {
|
||||
return fiber.NewError(fiber.StatusNotFound, err.Error())
|
||||
}
|
||||
|
||||
poll.Options = data.Options
|
||||
poll.ExpiredAt = data.ExpiredAt
|
||||
|
||||
var err error
|
||||
if poll, err = services.UpdatePoll(poll); err != nil {
|
||||
return fiber.NewError(fiber.StatusBadRequest, err.Error())
|
||||
}
|
||||
|
||||
return c.JSON(poll)
|
||||
}
|
||||
|
||||
func deletePoll(c *fiber.Ctx) error {
|
||||
pollId, _ := c.ParamsInt("pollId")
|
||||
|
||||
if err := sec.EnsureAuthenticated(c); err != nil {
|
||||
return err
|
||||
}
|
||||
user := c.Locals("user").(authm.Account)
|
||||
|
||||
var poll models.Poll
|
||||
if err := database.C.Where("id = ? AND account_id = ?", pollId, user.ID).First(&poll).Error; err != nil {
|
||||
return fiber.NewError(fiber.StatusNotFound, err.Error())
|
||||
}
|
||||
|
||||
if err := database.C.Delete(&poll).Error; err != nil {
|
||||
return fiber.NewError(fiber.StatusBadRequest, err.Error())
|
||||
}
|
||||
|
||||
return c.JSON(poll)
|
||||
}
|
@ -2,74 +2,50 @@ package api
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"git.solsynth.dev/hypernet/nexus/pkg/nex/cruda"
|
||||
"git.solsynth.dev/hypernet/nexus/pkg/nex/sec"
|
||||
"git.solsynth.dev/hypernet/passport/pkg/authkit"
|
||||
authm "git.solsynth.dev/hypernet/passport/pkg/authkit/models"
|
||||
"gorm.io/gorm"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"git.solsynth.dev/hypernet/interactive/pkg/internal/database"
|
||||
"git.solsynth.dev/hypernet/interactive/pkg/internal/gap"
|
||||
"git.solsynth.dev/hypernet/interactive/pkg/internal/http/exts"
|
||||
"git.solsynth.dev/hypernet/interactive/pkg/internal/models"
|
||||
"git.solsynth.dev/hypernet/interactive/pkg/internal/services"
|
||||
"git.solsynth.dev/hypernet/interactive/pkg/internal/services/queries"
|
||||
"github.com/gofiber/fiber/v2"
|
||||
"github.com/samber/lo"
|
||||
)
|
||||
|
||||
func universalPostFilter(c *fiber.Ctx, tx *gorm.DB) (*gorm.DB, error) {
|
||||
tx = services.FilterPostDraft(tx)
|
||||
|
||||
if user, authenticated := c.Locals("user").(authm.Account); authenticated {
|
||||
tx = services.FilterPostWithUserContext(tx, &user)
|
||||
} else {
|
||||
tx = services.FilterPostWithUserContext(tx, nil)
|
||||
}
|
||||
|
||||
if c.QueryBool("noReply", true) {
|
||||
tx = services.FilterPostReply(tx)
|
||||
}
|
||||
|
||||
if len(c.Query("author")) > 0 {
|
||||
var author models.Publisher
|
||||
if err := database.C.Where("name = ?", c.Query("author")).First(&author).Error; err != nil {
|
||||
return tx, fiber.NewError(fiber.StatusNotFound, err.Error())
|
||||
}
|
||||
tx = tx.Where("publisher_id = ?", author.ID)
|
||||
}
|
||||
|
||||
if len(c.Query("categories")) > 0 {
|
||||
tx = services.FilterPostWithCategory(tx, c.Query("categories"))
|
||||
}
|
||||
if len(c.Query("tags")) > 0 {
|
||||
tx = services.FilterPostWithTag(tx, c.Query("tags"))
|
||||
}
|
||||
|
||||
if len(c.Query("type")) > 0 {
|
||||
tx = services.FilterPostWithType(tx, c.Query("type"))
|
||||
}
|
||||
|
||||
return tx, nil
|
||||
}
|
||||
|
||||
func getPost(c *fiber.Ctx) error {
|
||||
id := c.Params("postId")
|
||||
|
||||
var item models.Post
|
||||
var err error
|
||||
|
||||
tx := services.FilterPostDraft(database.C)
|
||||
|
||||
var userId *uint
|
||||
if user, authenticated := c.Locals("user").(authm.Account); authenticated {
|
||||
tx = services.FilterPostWithUserContext(tx, &user)
|
||||
} else {
|
||||
tx = services.FilterPostWithUserContext(tx, nil)
|
||||
userId = &user.ID
|
||||
}
|
||||
|
||||
tx := database.C
|
||||
if tx, err = services.UniversalPostFilter(c, tx, services.UniversalPostFilterConfig{
|
||||
ShowReply: true,
|
||||
ShowDraft: true,
|
||||
ShowCollapsed: true,
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if numericId, paramErr := strconv.Atoi(id); paramErr == nil {
|
||||
item, err = services.GetPost(tx, uint(numericId))
|
||||
if c.Get("X-API-Version", "1") == "2" {
|
||||
item, err = queries.GetPost(tx, uint(numericId), userId)
|
||||
} else {
|
||||
item, err = services.GetPost(tx, uint(numericId))
|
||||
}
|
||||
} else {
|
||||
segments := strings.Split(id, ":")
|
||||
if len(segments) != 2 {
|
||||
@ -77,7 +53,11 @@ func getPost(c *fiber.Ctx) error {
|
||||
}
|
||||
area := segments[0]
|
||||
alias := segments[1]
|
||||
item, err = services.GetPostByAlias(tx, alias, area)
|
||||
if c.Get("X-API-Version", "1") == "2" {
|
||||
item, err = queries.GetPostByAlias(tx, alias, area, userId)
|
||||
} else {
|
||||
item, err = services.GetPostByAlias(tx, alias, area)
|
||||
}
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
@ -97,7 +77,7 @@ func getPost(c *fiber.Ctx) error {
|
||||
}
|
||||
|
||||
func searchPost(c *fiber.Ctx) error {
|
||||
take := c.QueryInt("take", 0)
|
||||
take := c.QueryInt("take", 10)
|
||||
offset := c.QueryInt("offset", 0)
|
||||
|
||||
tx := database.C
|
||||
@ -110,26 +90,38 @@ func searchPost(c *fiber.Ctx) error {
|
||||
tx = services.FilterPostWithFuzzySearch(tx, probe)
|
||||
|
||||
var err error
|
||||
if tx, err = universalPostFilter(c, tx); err != nil {
|
||||
if tx, err = services.UniversalPostFilter(c, tx, services.UniversalPostFilterConfig{
|
||||
ShowReply: true,
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
var userId *uint
|
||||
if user, authenticated := c.Locals("user").(authm.Account); authenticated {
|
||||
userId = &user.ID
|
||||
}
|
||||
|
||||
var count int64
|
||||
countTx := tx
|
||||
count, err := services.CountPost(countTx)
|
||||
count, err = services.CountPost(countTx)
|
||||
if err != nil {
|
||||
return fiber.NewError(fiber.StatusInternalServerError, err.Error())
|
||||
}
|
||||
|
||||
items, err := services.ListPost(tx, take, offset, "published_at DESC")
|
||||
var items []models.Post
|
||||
|
||||
if c.Get("X-API-Version", "1") == "2" {
|
||||
items, err = queries.ListPost(tx, take, offset, "published_at DESC", userId)
|
||||
} else {
|
||||
items, err = services.ListPost(tx, take, offset, "published_at DESC", userId)
|
||||
}
|
||||
if err != nil {
|
||||
return fiber.NewError(fiber.StatusBadRequest, err.Error())
|
||||
}
|
||||
|
||||
if c.QueryBool("truncate", true) {
|
||||
for _, item := range items {
|
||||
if item != nil {
|
||||
item = lo.ToPtr(services.TruncatePostContent(*item))
|
||||
}
|
||||
item = services.TruncatePostContent(item)
|
||||
}
|
||||
}
|
||||
|
||||
@ -140,32 +132,42 @@ func searchPost(c *fiber.Ctx) error {
|
||||
}
|
||||
|
||||
func listPost(c *fiber.Ctx) error {
|
||||
take := c.QueryInt("take", 0)
|
||||
take := c.QueryInt("take", 10)
|
||||
offset := c.QueryInt("offset", 0)
|
||||
|
||||
tx := database.C
|
||||
|
||||
var err error
|
||||
if tx, err = universalPostFilter(c, tx); err != nil {
|
||||
if tx, err = services.UniversalPostFilter(c, tx); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
var userId *uint
|
||||
if user, authenticated := c.Locals("user").(authm.Account); authenticated {
|
||||
userId = &user.ID
|
||||
}
|
||||
|
||||
var count int64
|
||||
countTx := tx
|
||||
count, err := services.CountPost(countTx)
|
||||
count, err = services.CountPost(countTx)
|
||||
if err != nil {
|
||||
return fiber.NewError(fiber.StatusInternalServerError, err.Error())
|
||||
}
|
||||
|
||||
items, err := services.ListPost(tx, take, offset, "published_at DESC")
|
||||
var items []models.Post
|
||||
|
||||
if c.Get("X-API-Version", "1") == "2" {
|
||||
items, err = queries.ListPost(tx, take, offset, "published_at DESC", userId)
|
||||
} else {
|
||||
items, err = services.ListPost(tx, take, offset, "published_at DESC", userId)
|
||||
}
|
||||
if err != nil {
|
||||
return fiber.NewError(fiber.StatusBadRequest, err.Error())
|
||||
}
|
||||
|
||||
if c.QueryBool("truncate", true) {
|
||||
for _, item := range items {
|
||||
if item != nil {
|
||||
item = lo.ToPtr(services.TruncatePostContent(*item))
|
||||
}
|
||||
item = services.TruncatePostContent(item)
|
||||
}
|
||||
}
|
||||
|
||||
@ -176,13 +178,13 @@ func listPost(c *fiber.Ctx) error {
|
||||
}
|
||||
|
||||
func listPostMinimal(c *fiber.Ctx) error {
|
||||
take := c.QueryInt("take", 0)
|
||||
take := c.QueryInt("take", 10)
|
||||
offset := c.QueryInt("offset", 0)
|
||||
|
||||
tx := database.C
|
||||
|
||||
var err error
|
||||
if tx, err = universalPostFilter(c, tx); err != nil {
|
||||
if tx, err = services.UniversalPostFilter(c, tx); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@ -212,7 +214,7 @@ func listPostMinimal(c *fiber.Ctx) error {
|
||||
}
|
||||
|
||||
func listDraftPost(c *fiber.Ctx) error {
|
||||
take := c.QueryInt("take", 0)
|
||||
take := c.QueryInt("take", 10)
|
||||
offset := c.QueryInt("offset", 0)
|
||||
|
||||
if err := sec.EnsureAuthenticated(c); err != nil {
|
||||
@ -220,23 +222,35 @@ func listDraftPost(c *fiber.Ctx) error {
|
||||
}
|
||||
user := c.Locals("user").(authm.Account)
|
||||
|
||||
var err error
|
||||
tx := services.FilterPostWithAuthorDraft(database.C, user.ID)
|
||||
|
||||
count, err := services.CountPost(tx)
|
||||
var userId *uint
|
||||
if user, authenticated := c.Locals("user").(authm.Account); authenticated {
|
||||
userId = &user.ID
|
||||
}
|
||||
|
||||
var count int64
|
||||
countTx := tx
|
||||
count, err = services.CountPost(countTx)
|
||||
if err != nil {
|
||||
return fiber.NewError(fiber.StatusInternalServerError, err.Error())
|
||||
}
|
||||
|
||||
items, err := services.ListPost(tx, take, offset, "created_at DESC", true)
|
||||
var items []models.Post
|
||||
|
||||
if c.Get("X-API-Version", "1") == "2" {
|
||||
items, err = queries.ListPost(tx, take, offset, "published_at DESC", userId)
|
||||
} else {
|
||||
items, err = services.ListPost(tx, take, offset, "published_at DESC", userId)
|
||||
}
|
||||
if err != nil {
|
||||
return fiber.NewError(fiber.StatusBadRequest, err.Error())
|
||||
}
|
||||
|
||||
if c.QueryBool("truncate", true) {
|
||||
for _, item := range items {
|
||||
if item != nil {
|
||||
item = lo.ToPtr(services.TruncatePostContent(*item))
|
||||
}
|
||||
item = services.TruncatePostContent(item)
|
||||
}
|
||||
}
|
||||
|
||||
@ -267,7 +281,7 @@ func deletePost(c *fiber.Ctx) error {
|
||||
if err := database.C.Where(models.Post{
|
||||
BaseModel: cruda.BaseModel{ID: uint(id)},
|
||||
PublisherID: publisher.ID,
|
||||
}).First(&item).Error; err != nil {
|
||||
}).Preload("Publisher").First(&item).Error; err != nil {
|
||||
return fiber.NewError(fiber.StatusNotFound, err.Error())
|
||||
}
|
||||
|
||||
@ -277,7 +291,7 @@ func deletePost(c *fiber.Ctx) error {
|
||||
_ = authkit.AddEventExt(
|
||||
gap.Nx,
|
||||
"posts.delete",
|
||||
strconv.Itoa(int(item.ID)),
|
||||
map[string]any{"post": item},
|
||||
c,
|
||||
)
|
||||
}
|
||||
@ -319,7 +333,7 @@ func reactPost(c *fiber.Ctx) error {
|
||||
_ = authkit.AddEventExt(
|
||||
gap.Nx,
|
||||
"posts.react",
|
||||
strconv.Itoa(int(res.ID)),
|
||||
map[string]any{"post_id": res.ID, "reaction": reaction},
|
||||
c,
|
||||
)
|
||||
|
||||
@ -344,7 +358,7 @@ func pinPost(c *fiber.Ctx) error {
|
||||
_ = authkit.AddEventExt(
|
||||
gap.Nx,
|
||||
"posts.pin",
|
||||
strconv.Itoa(int(res.ID)),
|
||||
map[string]any{"post": res},
|
||||
c,
|
||||
)
|
||||
return c.SendStatus(fiber.StatusOK)
|
||||
@ -352,9 +366,23 @@ func pinPost(c *fiber.Ctx) error {
|
||||
_ = authkit.AddEventExt(
|
||||
gap.Nx,
|
||||
"posts.unpin",
|
||||
strconv.Itoa(int(res.ID)),
|
||||
map[string]any{"post": res},
|
||||
c,
|
||||
)
|
||||
return c.SendStatus(fiber.StatusNoContent)
|
||||
}
|
||||
}
|
||||
|
||||
func uncollapsePost(c *fiber.Ctx) error {
|
||||
id, _ := c.ParamsInt("postId", 0)
|
||||
|
||||
if err := sec.EnsureGrantedPerm(c, "UncollapsePosts", true); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := database.C.Model(&models.Post{}).Where("id = ?", id).Update("is_collapsed", false).Error; err != nil {
|
||||
return fiber.NewError(fiber.StatusBadRequest, err.Error())
|
||||
}
|
||||
|
||||
return c.SendStatus(fiber.StatusOK)
|
||||
}
|
||||
|
@ -28,7 +28,12 @@ func listPinnedPost(c *fiber.Ctx) error {
|
||||
tx = tx.Where("publisher_id = ?", user.ID)
|
||||
tx = tx.Where("pinned_at IS NOT NULL")
|
||||
|
||||
items, err := services.ListPost(tx, 100, 0, "published_at DESC")
|
||||
var userId *uint
|
||||
if user, authenticated := c.Locals("user").(authm.Account); authenticated {
|
||||
userId = &user.ID
|
||||
}
|
||||
|
||||
items, err := services.ListPost(tx, 100, 0, "published_at DESC", userId)
|
||||
if err != nil {
|
||||
return fiber.NewError(fiber.StatusBadRequest, err.Error())
|
||||
}
|
||||
@ -186,6 +191,7 @@ func editPublisher(c *fiber.Ctx) error {
|
||||
return err
|
||||
}
|
||||
|
||||
og := publisher
|
||||
publisher.Name = data.Name
|
||||
publisher.Nick = data.Nick
|
||||
publisher.Description = data.Description
|
||||
@ -195,7 +201,7 @@ func editPublisher(c *fiber.Ctx) error {
|
||||
publisher.AccountID = data.AccountID
|
||||
}
|
||||
|
||||
if publisher, err = services.EditPublisher(user, publisher); err != nil {
|
||||
if publisher, err = services.EditPublisher(user, publisher, og); err != nil {
|
||||
return fiber.NewError(fiber.StatusBadRequest, err.Error())
|
||||
}
|
||||
|
||||
|
355
pkg/internal/http/api/questions_api.go
Normal file
355
pkg/internal/http/api/questions_api.go
Normal file
@ -0,0 +1,355 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"git.solsynth.dev/hypernet/interactive/pkg/internal/database"
|
||||
"git.solsynth.dev/hypernet/interactive/pkg/internal/gap"
|
||||
"git.solsynth.dev/hypernet/interactive/pkg/internal/http/exts"
|
||||
"git.solsynth.dev/hypernet/interactive/pkg/internal/models"
|
||||
"git.solsynth.dev/hypernet/interactive/pkg/internal/services"
|
||||
"git.solsynth.dev/hypernet/nexus/pkg/nex/cruda"
|
||||
"git.solsynth.dev/hypernet/nexus/pkg/nex/sec"
|
||||
"git.solsynth.dev/hypernet/passport/pkg/authkit"
|
||||
authm "git.solsynth.dev/hypernet/passport/pkg/authkit/models"
|
||||
wproto "git.solsynth.dev/hypernet/wallet/pkg/proto"
|
||||
"github.com/gofiber/fiber/v2"
|
||||
jsoniter "github.com/json-iterator/go"
|
||||
"github.com/samber/lo"
|
||||
)
|
||||
|
||||
func createQuestion(c *fiber.Ctx) error {
|
||||
if err := sec.EnsureGrantedPerm(c, "CreatePosts", true); err != nil {
|
||||
return err
|
||||
}
|
||||
user := c.Locals("user").(authm.Account)
|
||||
|
||||
var data struct {
|
||||
Publisher uint `json:"publisher"`
|
||||
Alias *string `json:"alias"`
|
||||
Title *string `json:"title"`
|
||||
Content string `json:"content" validate:"max=4096"`
|
||||
Location *string `json:"location"`
|
||||
Thumbnail *string `json:"thumbnail"`
|
||||
Attachments []string `json:"attachments"`
|
||||
Tags []models.Tag `json:"tags"`
|
||||
Categories []models.Category `json:"categories"`
|
||||
PublishedAt *time.Time `json:"published_at"`
|
||||
PublishedUntil *time.Time `json:"published_until"`
|
||||
VisibleUsers []uint `json:"visible_users_list"`
|
||||
InvisibleUsers []uint `json:"invisible_users_list"`
|
||||
Visibility *int8 `json:"visibility"`
|
||||
IsDraft bool `json:"is_draft"`
|
||||
Realm *uint `json:"realm"`
|
||||
Reward float64 `json:"reward"`
|
||||
}
|
||||
|
||||
if err := exts.BindAndValidate(c, &data); err != nil {
|
||||
return err
|
||||
} else if len(data.Content) == 0 && len(data.Attachments) == 0 {
|
||||
return fiber.NewError(fiber.StatusBadRequest, "content or attachments are required")
|
||||
}
|
||||
|
||||
publisher, err := services.GetPublisher(data.Publisher, user.ID)
|
||||
if err != nil {
|
||||
return fiber.NewError(fiber.StatusBadRequest, err.Error())
|
||||
}
|
||||
|
||||
// Take charge
|
||||
if data.Reward > 0 {
|
||||
conn, err := gap.Nx.GetClientGrpcConn("wa")
|
||||
if err != nil {
|
||||
return fiber.NewError(fiber.StatusInternalServerError, fmt.Sprintf("unable to connect Wallet: %v", err))
|
||||
}
|
||||
wc := wproto.NewPaymentServiceClient(conn)
|
||||
ctx, cancel := context.WithTimeout(context.Background(), time.Second*3)
|
||||
defer cancel()
|
||||
if _, err := wc.MakeTransactionWithAccount(ctx, &wproto.MakeTransactionWithAccountRequest{
|
||||
Amount: data.Reward,
|
||||
Remark: "As reward for posting a question",
|
||||
PayerAccountId: lo.ToPtr(uint64(user.ID)),
|
||||
}); err != nil {
|
||||
return fiber.NewError(fiber.StatusPaymentRequired, fmt.Sprintf("failed to handle payment: %v", err))
|
||||
}
|
||||
}
|
||||
|
||||
body := models.PostQuestionBody{
|
||||
PostStoryBody: models.PostStoryBody{
|
||||
Thumbnail: data.Thumbnail,
|
||||
Title: data.Title,
|
||||
Content: data.Content,
|
||||
Location: data.Location,
|
||||
Attachments: data.Attachments,
|
||||
},
|
||||
Reward: data.Reward,
|
||||
}
|
||||
|
||||
var bodyMapping map[string]any
|
||||
rawBody, _ := jsoniter.Marshal(body)
|
||||
_ = jsoniter.Unmarshal(rawBody, &bodyMapping)
|
||||
|
||||
item := models.Post{
|
||||
Alias: data.Alias,
|
||||
Type: models.PostTypeQuestion,
|
||||
Body: bodyMapping,
|
||||
Language: services.DetectLanguage(data.Content),
|
||||
Tags: data.Tags,
|
||||
Categories: data.Categories,
|
||||
PublishedAt: data.PublishedAt,
|
||||
PublishedUntil: data.PublishedUntil,
|
||||
IsDraft: data.IsDraft,
|
||||
VisibleUsers: data.VisibleUsers,
|
||||
InvisibleUsers: data.InvisibleUsers,
|
||||
PublisherID: publisher.ID,
|
||||
}
|
||||
|
||||
if item.PublishedAt == nil {
|
||||
item.PublishedAt = lo.ToPtr(time.Now())
|
||||
}
|
||||
|
||||
if data.Realm != nil {
|
||||
if _, err := authkit.GetRealmMember(gap.Nx, *data.Realm, user.ID); err != nil {
|
||||
return fiber.NewError(fiber.StatusBadRequest, fmt.Sprintf("you are not a member of realm #%d", *data.Realm))
|
||||
}
|
||||
item.RealmID = data.Realm
|
||||
}
|
||||
|
||||
if data.Visibility != nil {
|
||||
item.Visibility = *data.Visibility
|
||||
} else {
|
||||
item.Visibility = models.PostVisibilityAll
|
||||
}
|
||||
|
||||
item, err = services.NewPost(publisher, item)
|
||||
if err != nil {
|
||||
// Failed to create post, refund the charge
|
||||
if data.Reward > 0 {
|
||||
conn, err := gap.Nx.GetClientGrpcConn("wa")
|
||||
if err != nil {
|
||||
return fiber.NewError(fiber.StatusInternalServerError, fmt.Sprintf("unable to connect Wallet: %v", err))
|
||||
}
|
||||
wc := wproto.NewPaymentServiceClient(conn)
|
||||
ctx, cancel := context.WithTimeout(context.Background(), time.Second*3)
|
||||
defer cancel()
|
||||
if _, err := wc.MakeTransactionWithAccount(ctx, &wproto.MakeTransactionWithAccountRequest{
|
||||
Amount: data.Reward,
|
||||
Remark: "As reward for posting a question - Refund",
|
||||
PayeeAccountId: lo.ToPtr(uint64(user.ID)),
|
||||
}); err != nil {
|
||||
return fiber.NewError(fiber.StatusPaymentRequired, fmt.Sprintf("failed to handle payment: %v", err))
|
||||
}
|
||||
}
|
||||
|
||||
return fiber.NewError(fiber.StatusBadRequest, err.Error())
|
||||
} else {
|
||||
_ = authkit.AddEventExt(
|
||||
gap.Nx,
|
||||
"posts.new",
|
||||
map[string]any{"post": item},
|
||||
c,
|
||||
)
|
||||
}
|
||||
|
||||
return c.JSON(item)
|
||||
}
|
||||
|
||||
func editQuestion(c *fiber.Ctx) error {
|
||||
id, _ := c.ParamsInt("postId", 0)
|
||||
if err := sec.EnsureAuthenticated(c); err != nil {
|
||||
return err
|
||||
}
|
||||
user := c.Locals("user").(authm.Account)
|
||||
|
||||
var data struct {
|
||||
Publisher uint `json:"publisher"`
|
||||
Alias *string `json:"alias"`
|
||||
Title *string `json:"title"`
|
||||
Content string `json:"content" validate:"max=4096"`
|
||||
Thumbnail *string `json:"thumbnail"`
|
||||
Location *string `json:"location"`
|
||||
Attachments []string `json:"attachments"`
|
||||
Tags []models.Tag `json:"tags"`
|
||||
Categories []models.Category `json:"categories"`
|
||||
PublishedAt *time.Time `json:"published_at"`
|
||||
PublishedUntil *time.Time `json:"published_until"`
|
||||
VisibleUsers []uint `json:"visible_users_list"`
|
||||
InvisibleUsers []uint `json:"invisible_users_list"`
|
||||
Visibility *int8 `json:"visibility"`
|
||||
IsDraft bool `json:"is_draft"`
|
||||
}
|
||||
|
||||
if err := exts.BindAndValidate(c, &data); err != nil {
|
||||
return err
|
||||
} else if len(data.Content) == 0 && len(data.Attachments) == 0 {
|
||||
return fiber.NewError(fiber.StatusBadRequest, "content or attachments are required")
|
||||
}
|
||||
|
||||
publisher, err := services.GetPublisher(data.Publisher, user.ID)
|
||||
if err != nil {
|
||||
return fiber.NewError(fiber.StatusBadRequest, err.Error())
|
||||
}
|
||||
|
||||
var item models.Post
|
||||
if err := database.C.Where(models.Post{
|
||||
BaseModel: cruda.BaseModel{ID: uint(id)},
|
||||
PublisherID: publisher.ID,
|
||||
Type: models.PostTypeQuestion,
|
||||
}).Preload("Publisher").First(&item).Error; err != nil {
|
||||
return fiber.NewError(fiber.StatusNotFound, err.Error())
|
||||
}
|
||||
|
||||
if item.LockedAt != nil {
|
||||
return fiber.NewError(fiber.StatusForbidden, "post was locked")
|
||||
}
|
||||
|
||||
if !item.IsDraft && !data.IsDraft {
|
||||
item.EditedAt = lo.ToPtr(time.Now())
|
||||
}
|
||||
|
||||
if item.IsDraft && !data.IsDraft && data.PublishedAt == nil {
|
||||
item.PublishedAt = lo.ToPtr(time.Now())
|
||||
} else {
|
||||
item.PublishedAt = data.PublishedAt
|
||||
}
|
||||
|
||||
var body models.PostQuestionBody
|
||||
raw, _ := jsoniter.Marshal(item.Body)
|
||||
_ = jsoniter.Unmarshal(raw, &body)
|
||||
|
||||
newBody := models.PostQuestionBody{
|
||||
PostStoryBody: models.PostStoryBody{
|
||||
Thumbnail: data.Thumbnail,
|
||||
Title: data.Title,
|
||||
Content: data.Content,
|
||||
Location: data.Location,
|
||||
Attachments: data.Attachments,
|
||||
},
|
||||
Reward: body.Reward,
|
||||
Answer: body.Answer,
|
||||
}
|
||||
|
||||
var newBodyMapping map[string]any
|
||||
rawBody, _ := jsoniter.Marshal(newBody)
|
||||
_ = jsoniter.Unmarshal(rawBody, &newBodyMapping)
|
||||
|
||||
og := item
|
||||
item.Alias = data.Alias
|
||||
item.Body = newBodyMapping
|
||||
item.Language = services.DetectLanguage(data.Content)
|
||||
item.Tags = data.Tags
|
||||
item.Categories = data.Categories
|
||||
item.IsDraft = data.IsDraft
|
||||
item.PublishedUntil = data.PublishedUntil
|
||||
item.VisibleUsers = data.VisibleUsers
|
||||
item.InvisibleUsers = data.InvisibleUsers
|
||||
|
||||
// Preload publisher data
|
||||
item.Publisher = publisher
|
||||
|
||||
if item.PublishedAt == nil {
|
||||
item.PublishedAt = data.PublishedAt
|
||||
}
|
||||
if data.Visibility != nil {
|
||||
item.Visibility = *data.Visibility
|
||||
}
|
||||
|
||||
if item, err = services.EditPost(item, og); err != nil {
|
||||
return fiber.NewError(fiber.StatusBadRequest, err.Error())
|
||||
} else {
|
||||
_ = authkit.AddEventExt(
|
||||
gap.Nx,
|
||||
"posts.edit",
|
||||
map[string]any{"post": item},
|
||||
c,
|
||||
)
|
||||
}
|
||||
|
||||
return c.JSON(item)
|
||||
}
|
||||
|
||||
func selectQuestionAnswer(c *fiber.Ctx) error {
|
||||
id, _ := c.ParamsInt("postId", 0)
|
||||
if err := sec.EnsureAuthenticated(c); err != nil {
|
||||
return err
|
||||
}
|
||||
user := c.Locals("user").(authm.Account)
|
||||
|
||||
var data struct {
|
||||
Publisher uint `json:"publisher"`
|
||||
AnswerID uint `json:"answer_id" validate:"required"`
|
||||
}
|
||||
|
||||
if err := exts.BindAndValidate(c, &data); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
publisher, err := services.GetPublisher(data.Publisher, user.ID)
|
||||
if err != nil {
|
||||
return fiber.NewError(fiber.StatusBadRequest, err.Error())
|
||||
}
|
||||
|
||||
var item models.Post
|
||||
if err := database.C.Where(models.Post{
|
||||
BaseModel: cruda.BaseModel{ID: uint(id)},
|
||||
PublisherID: publisher.ID,
|
||||
Type: models.PostTypeQuestion,
|
||||
}).Preload("Publisher").First(&item).Error; err != nil {
|
||||
return fiber.NewError(fiber.StatusNotFound, err.Error())
|
||||
}
|
||||
|
||||
var body models.PostQuestionBody
|
||||
raw, _ := jsoniter.Marshal(item.Body)
|
||||
_ = jsoniter.Unmarshal(raw, &body)
|
||||
|
||||
if item.LockedAt != nil {
|
||||
return fiber.NewError(fiber.StatusForbidden, "post was locked")
|
||||
}
|
||||
if body.Answer != nil && *body.Answer > 0 {
|
||||
return fiber.NewError(fiber.StatusBadRequest, "question already has an answer")
|
||||
}
|
||||
|
||||
var answer models.Post
|
||||
if err := database.C.Where("id = ? AND reply_id = ?", data.AnswerID, item.ID).Preload("Publisher").First(&answer).Error; err != nil {
|
||||
return fiber.NewError(fiber.StatusNotFound, fmt.Sprintf("related answer was not found: %v", err))
|
||||
}
|
||||
|
||||
item.Body["answer"] = answer.ID
|
||||
|
||||
// Preload publisher data
|
||||
item.Publisher = publisher
|
||||
if item, err = services.EditPost(item, item); err != nil {
|
||||
return fiber.NewError(fiber.StatusBadRequest, err.Error())
|
||||
} else {
|
||||
// Give the reward
|
||||
if body.Reward > 0 && answer.Publisher.AccountID != nil {
|
||||
conn, err := gap.Nx.GetClientGrpcConn("wa")
|
||||
if err != nil {
|
||||
return fiber.NewError(fiber.StatusInternalServerError, fmt.Sprintf("unable to connect Wallet: %v", err))
|
||||
}
|
||||
wc := wproto.NewPaymentServiceClient(conn)
|
||||
ctx, cancel := context.WithTimeout(context.Background(), time.Second*3)
|
||||
defer cancel()
|
||||
if _, err := wc.MakeTransactionWithAccount(ctx, &wproto.MakeTransactionWithAccountRequest{
|
||||
Amount: body.Reward,
|
||||
Remark: fmt.Sprintf("Answer of question %d got selected reward", item.ID),
|
||||
PayeeAccountId: lo.ToPtr(uint64(*answer.Publisher.AccountID)),
|
||||
}); err != nil {
|
||||
return fiber.NewError(fiber.StatusPaymentRequired, fmt.Sprintf("failed to handle payment: %v", err))
|
||||
}
|
||||
}
|
||||
|
||||
_ = authkit.AddEventExt(
|
||||
gap.Nx,
|
||||
"posts.edit.answer",
|
||||
map[string]any{
|
||||
"post": item,
|
||||
"answer": answer,
|
||||
},
|
||||
c,
|
||||
)
|
||||
}
|
||||
|
||||
return c.JSON(item)
|
||||
}
|
@ -1,22 +1,23 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"git.solsynth.dev/hypernet/interactive/pkg/internal/database"
|
||||
"git.solsynth.dev/hypernet/interactive/pkg/internal/gap"
|
||||
"git.solsynth.dev/hypernet/interactive/pkg/internal/models"
|
||||
"git.solsynth.dev/hypernet/interactive/pkg/internal/services"
|
||||
"git.solsynth.dev/hypernet/nexus/pkg/nex/sec"
|
||||
"git.solsynth.dev/hypernet/nexus/pkg/proto"
|
||||
"git.solsynth.dev/hypernet/passport/pkg/authkit"
|
||||
"git.solsynth.dev/hypernet/interactive/pkg/internal/services/queries"
|
||||
authm "git.solsynth.dev/hypernet/passport/pkg/authkit/models"
|
||||
"github.com/gofiber/fiber/v2"
|
||||
"github.com/samber/lo"
|
||||
)
|
||||
|
||||
func listRecommendation(c *fiber.Ctx) error {
|
||||
const featuredMax = 3
|
||||
const featuredMax = 5
|
||||
|
||||
posts, err := services.GetFeaturedPosts(featuredMax)
|
||||
var err error
|
||||
var posts []models.Post
|
||||
posts, err = services.GetFeaturedPosts(featuredMax)
|
||||
if err != nil {
|
||||
return fiber.NewError(fiber.StatusInternalServerError, err.Error())
|
||||
}
|
||||
@ -25,103 +26,68 @@ func listRecommendation(c *fiber.Ctx) error {
|
||||
return item.ID
|
||||
})
|
||||
|
||||
var userId *uint
|
||||
if user, authenticated := c.Locals("user").(authm.Account); authenticated {
|
||||
userId = &user.ID
|
||||
}
|
||||
|
||||
tx := database.C.Where("id IN ?", postIdx)
|
||||
newPosts, err := services.ListPost(tx, featuredMax, 0, "id ASC")
|
||||
var newPosts []models.Post
|
||||
if c.Get("X-API-Version", "1") == "2" {
|
||||
newPosts, err = queries.ListPost(tx, featuredMax, 0, "id ASC", userId)
|
||||
} else {
|
||||
newPosts, err = services.ListPost(tx, featuredMax, 0, "id ASC", userId)
|
||||
}
|
||||
if err != nil {
|
||||
return fiber.NewError(fiber.StatusInternalServerError, err.Error())
|
||||
}
|
||||
newPostMap := lo.SliceToMap(newPosts, func(item *models.Post) (uint, models.Post) {
|
||||
return item.ID, *item
|
||||
newPostMap := lo.SliceToMap(newPosts, func(item models.Post) (uint, models.Post) {
|
||||
return item.ID, item
|
||||
})
|
||||
|
||||
// Revert the position
|
||||
// Revert the position & truncate
|
||||
for idx, item := range posts {
|
||||
posts[idx] = newPostMap[item.ID]
|
||||
posts[idx] = services.TruncatePostContent(newPostMap[item.ID])
|
||||
}
|
||||
|
||||
return c.JSON(posts)
|
||||
}
|
||||
|
||||
func listRecommendationFriends(c *fiber.Ctx) error {
|
||||
if err := sec.EnsureAuthenticated(c); err != nil {
|
||||
return err
|
||||
}
|
||||
user := c.Locals("user").(authm.Account)
|
||||
|
||||
take := c.QueryInt("take", 0)
|
||||
offset := c.QueryInt("offset", 0)
|
||||
|
||||
tx := database.C
|
||||
|
||||
var err error
|
||||
if tx, err = universalPostFilter(c, tx); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
friends, _ := authkit.ListRelative(gap.Nx, user.ID, int32(authm.RelationshipFriend), true)
|
||||
friendList := lo.Map(friends, func(item *proto.UserInfo, index int) uint {
|
||||
return uint(item.GetId())
|
||||
})
|
||||
|
||||
tx = tx.Where("publisher_id IN ?", friendList)
|
||||
|
||||
countTx := tx
|
||||
count, err := services.CountPost(countTx)
|
||||
if err != nil {
|
||||
return fiber.NewError(fiber.StatusInternalServerError, err.Error())
|
||||
}
|
||||
|
||||
order := "published_at DESC"
|
||||
if c.QueryBool("featured", false) {
|
||||
order = "published_at DESC, (COALESCE(total_upvote, 0) - COALESCE(total_downvote, 0)) DESC"
|
||||
}
|
||||
|
||||
items, err := services.ListPost(tx, take, offset, order)
|
||||
if err != nil {
|
||||
return fiber.NewError(fiber.StatusBadRequest, err.Error())
|
||||
}
|
||||
|
||||
if c.QueryBool("truncate", true) {
|
||||
for _, item := range items {
|
||||
if item != nil {
|
||||
item = lo.ToPtr(services.TruncatePostContent(*item))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return c.JSON(fiber.Map{
|
||||
"count": count,
|
||||
"data": items,
|
||||
})
|
||||
}
|
||||
|
||||
func listRecommendationShuffle(c *fiber.Ctx) error {
|
||||
take := c.QueryInt("take", 0)
|
||||
take := c.QueryInt("take", 10)
|
||||
offset := c.QueryInt("offset", 0)
|
||||
|
||||
tx := database.C
|
||||
|
||||
var err error
|
||||
if tx, err = universalPostFilter(c, tx); err != nil {
|
||||
tx := database.C
|
||||
if tx, err = services.UniversalPostFilter(c, tx); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
var userId *uint
|
||||
if user, authenticated := c.Locals("user").(authm.Account); authenticated {
|
||||
userId = &user.ID
|
||||
}
|
||||
|
||||
var count int64
|
||||
countTx := tx
|
||||
count, err := services.CountPost(countTx)
|
||||
count, err = services.CountPost(countTx)
|
||||
if err != nil {
|
||||
return fiber.NewError(fiber.StatusInternalServerError, err.Error())
|
||||
}
|
||||
|
||||
items, err := services.ListPost(tx, take, offset, "RANDOM()")
|
||||
var items []models.Post
|
||||
if c.Get("X-API-Version", "1") == "2" {
|
||||
items, err = queries.ListPost(tx, take, offset, "RANDOM()", userId)
|
||||
} else {
|
||||
items, err = services.ListPost(tx, take, offset, "RANDOM()", userId)
|
||||
}
|
||||
if err != nil {
|
||||
return fiber.NewError(fiber.StatusBadRequest, err.Error())
|
||||
}
|
||||
|
||||
if c.QueryBool("truncate", true) {
|
||||
for _, item := range items {
|
||||
if item != nil {
|
||||
item = lo.ToPtr(services.TruncatePostContent(*item))
|
||||
}
|
||||
item = services.TruncatePostContent(item)
|
||||
}
|
||||
}
|
||||
|
||||
@ -130,3 +96,25 @@ func listRecommendationShuffle(c *fiber.Ctx) error {
|
||||
"data": items,
|
||||
})
|
||||
}
|
||||
|
||||
func getRecommendationFeed(c *fiber.Ctx) error {
|
||||
limit := c.QueryInt("limit", 20)
|
||||
cursor := c.QueryInt("cursor", 0)
|
||||
|
||||
var cursorTime *time.Time
|
||||
if cursor > 0 {
|
||||
cursorTime = lo.ToPtr(time.UnixMilli(int64(cursor - 1)))
|
||||
}
|
||||
|
||||
var userId *uint
|
||||
if user, authenticated := c.Locals("user").(authm.Account); authenticated {
|
||||
userId = &user.ID
|
||||
}
|
||||
|
||||
entries, err := queries.GetFeed(c, limit, userId, cursorTime)
|
||||
if err != nil {
|
||||
return fiber.NewError(fiber.StatusInternalServerError, err.Error())
|
||||
}
|
||||
|
||||
return c.JSON(entries)
|
||||
}
|
||||
|
@ -2,14 +2,16 @@ package api
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"git.solsynth.dev/hypernet/interactive/pkg/internal/database"
|
||||
"git.solsynth.dev/hypernet/interactive/pkg/internal/models"
|
||||
"git.solsynth.dev/hypernet/interactive/pkg/internal/services"
|
||||
authm "git.solsynth.dev/hypernet/passport/pkg/authkit/models"
|
||||
"github.com/gofiber/fiber/v2"
|
||||
)
|
||||
|
||||
func listPostReplies(c *fiber.Ctx) error {
|
||||
take := c.QueryInt("take", 0)
|
||||
take := c.QueryInt("take", 10)
|
||||
offset := c.QueryInt("offset", 0)
|
||||
|
||||
tx := database.C
|
||||
@ -35,12 +37,17 @@ func listPostReplies(c *fiber.Ctx) error {
|
||||
tx = services.FilterPostWithTag(tx, c.Query("tag"))
|
||||
}
|
||||
|
||||
var userId *uint
|
||||
if user, authenticated := c.Locals("user").(authm.Account); authenticated {
|
||||
userId = &user.ID
|
||||
}
|
||||
|
||||
count, err := services.CountPost(tx)
|
||||
if err != nil {
|
||||
return fiber.NewError(fiber.StatusInternalServerError, err.Error())
|
||||
}
|
||||
|
||||
items, err := services.ListPost(tx, take, offset, "published_at DESC")
|
||||
items, err := services.ListPost(tx, take, offset, "published_at DESC", userId)
|
||||
if err != nil {
|
||||
return fiber.NewError(fiber.StatusBadRequest, err.Error())
|
||||
}
|
||||
@ -52,9 +59,14 @@ func listPostReplies(c *fiber.Ctx) error {
|
||||
}
|
||||
|
||||
func listPostFeaturedReply(c *fiber.Ctx) error {
|
||||
take := c.QueryInt("take", 0)
|
||||
take := c.QueryInt("take", 10)
|
||||
take = max(1, min(take, 3))
|
||||
|
||||
var userId *uint
|
||||
if user, authenticated := c.Locals("user").(authm.Account); authenticated {
|
||||
userId = &user.ID
|
||||
}
|
||||
|
||||
tx := database.C
|
||||
var post models.Post
|
||||
if err := database.C.Where("id = ?", c.Params("postId")).First(&post).Error; err != nil {
|
||||
@ -78,7 +90,7 @@ func listPostFeaturedReply(c *fiber.Ctx) error {
|
||||
tx = services.FilterPostWithTag(tx, c.Query("tag"))
|
||||
}
|
||||
|
||||
items, err := services.ListPost(tx, take, 0, "(COALESCE(total_upvote, 0) - COALESCE(total_downvote, 0)) DESC, published_at DESC")
|
||||
items, err := services.ListPost(tx, take, 0, "(COALESCE(total_upvote, 0) - COALESCE(total_downvote, 0)) DESC, published_at DESC", userId)
|
||||
if err != nil {
|
||||
return fiber.NewError(fiber.StatusBadRequest, err.Error())
|
||||
}
|
||||
|
@ -2,12 +2,12 @@ package api
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"git.solsynth.dev/hypernet/nexus/pkg/nex/cruda"
|
||||
"git.solsynth.dev/hypernet/nexus/pkg/nex/sec"
|
||||
"git.solsynth.dev/hypernet/passport/pkg/authkit"
|
||||
authm "git.solsynth.dev/hypernet/passport/pkg/authkit/models"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"git.solsynth.dev/hypernet/interactive/pkg/internal/database"
|
||||
"git.solsynth.dev/hypernet/interactive/pkg/internal/gap"
|
||||
@ -43,6 +43,8 @@ func createStory(c *fiber.Ctx) error {
|
||||
IsDraft bool `json:"is_draft"`
|
||||
ReplyTo *uint `json:"reply_to"`
|
||||
RepostTo *uint `json:"repost_to"`
|
||||
Poll *uint `json:"poll"`
|
||||
Realm *uint `json:"realm"`
|
||||
}
|
||||
|
||||
if err := exts.BindAndValidate(c, &data); err != nil {
|
||||
@ -81,6 +83,7 @@ func createStory(c *fiber.Ctx) error {
|
||||
VisibleUsers: data.VisibleUsers,
|
||||
InvisibleUsers: data.InvisibleUsers,
|
||||
PublisherID: publisher.ID,
|
||||
PollID: data.Poll,
|
||||
}
|
||||
|
||||
if item.PublishedAt == nil {
|
||||
@ -93,6 +96,13 @@ func createStory(c *fiber.Ctx) error {
|
||||
item.Visibility = models.PostVisibilityAll
|
||||
}
|
||||
|
||||
if data.Realm != nil {
|
||||
if _, err := authkit.GetRealmMember(gap.Nx, *data.Realm, user.ID); err != nil {
|
||||
return fiber.NewError(fiber.StatusBadRequest, fmt.Sprintf("you are not a member of realm #%d", *data.Realm))
|
||||
}
|
||||
item.RealmID = data.Realm
|
||||
}
|
||||
|
||||
if data.ReplyTo != nil {
|
||||
var replyTo models.Post
|
||||
if err := database.C.Where("id = ?", data.ReplyTo).First(&replyTo).Error; err != nil {
|
||||
@ -116,8 +126,8 @@ func createStory(c *fiber.Ctx) error {
|
||||
} else {
|
||||
_ = authkit.AddEventExt(
|
||||
gap.Nx,
|
||||
"posts.new",
|
||||
strconv.Itoa(int(item.ID)),
|
||||
"posts.edit",
|
||||
map[string]interface{}{"post": item},
|
||||
c,
|
||||
)
|
||||
}
|
||||
@ -148,6 +158,7 @@ func editStory(c *fiber.Ctx) error {
|
||||
InvisibleUsers []uint `json:"invisible_users_list"`
|
||||
Visibility *int8 `json:"visibility"`
|
||||
IsDraft bool `json:"is_draft"`
|
||||
Poll *uint `json:"poll"`
|
||||
}
|
||||
|
||||
if err := exts.BindAndValidate(c, &data); err != nil {
|
||||
@ -165,7 +176,8 @@ func editStory(c *fiber.Ctx) error {
|
||||
if err := database.C.Where(models.Post{
|
||||
BaseModel: cruda.BaseModel{ID: uint(id)},
|
||||
PublisherID: publisher.ID,
|
||||
}).First(&item).Error; err != nil {
|
||||
Type: models.PostTypeStory,
|
||||
}).Preload("Publisher").First(&item).Error; err != nil {
|
||||
return fiber.NewError(fiber.StatusNotFound, err.Error())
|
||||
}
|
||||
|
||||
@ -195,30 +207,35 @@ func editStory(c *fiber.Ctx) error {
|
||||
rawBody, _ := jsoniter.Marshal(body)
|
||||
_ = jsoniter.Unmarshal(rawBody, &bodyMapping)
|
||||
|
||||
og := item
|
||||
item.Alias = data.Alias
|
||||
item.Body = bodyMapping
|
||||
item.Language = services.DetectLanguage(data.Content)
|
||||
item.Tags = data.Tags
|
||||
item.Categories = data.Categories
|
||||
item.PublishedUntil = data.PublishedUntil
|
||||
item.IsDraft = data.IsDraft
|
||||
item.PublishedUntil = data.PublishedUntil
|
||||
item.VisibleUsers = data.VisibleUsers
|
||||
item.InvisibleUsers = data.InvisibleUsers
|
||||
item.PollID = data.Poll
|
||||
|
||||
// Preload publisher data
|
||||
item.Publisher = publisher
|
||||
|
||||
if item.PublishedAt == nil {
|
||||
item.PublishedAt = data.PublishedAt
|
||||
}
|
||||
if data.Visibility != nil {
|
||||
item.Visibility = *data.Visibility
|
||||
}
|
||||
|
||||
if item, err = services.EditPost(item); err != nil {
|
||||
if item, err = services.EditPost(item, og); err != nil {
|
||||
return fiber.NewError(fiber.StatusBadRequest, err.Error())
|
||||
} else {
|
||||
_ = authkit.AddEventExt(
|
||||
gap.Nx,
|
||||
"posts.edit",
|
||||
strconv.Itoa(int(item.ID)),
|
||||
map[string]interface{}{"post": item},
|
||||
c,
|
||||
)
|
||||
}
|
||||
|
@ -2,10 +2,10 @@ package api
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"git.solsynth.dev/hypernet/nexus/pkg/nex/sec"
|
||||
"git.solsynth.dev/hypernet/passport/pkg/authkit"
|
||||
authm "git.solsynth.dev/hypernet/passport/pkg/authkit/models"
|
||||
"strconv"
|
||||
|
||||
"git.solsynth.dev/hypernet/interactive/pkg/internal/gap"
|
||||
"git.solsynth.dev/hypernet/interactive/pkg/internal/services"
|
||||
@ -98,7 +98,7 @@ func subscribeToUser(c *fiber.Ctx) error {
|
||||
_ = authkit.AddEventExt(
|
||||
gap.Nx,
|
||||
"posts.subscribe.users",
|
||||
strconv.Itoa(int(otherUser.ID)),
|
||||
map[string]any{"user": otherUser},
|
||||
c,
|
||||
)
|
||||
|
||||
@ -125,7 +125,7 @@ func subscribeToTag(c *fiber.Ctx) error {
|
||||
_ = authkit.AddEventExt(
|
||||
gap.Nx,
|
||||
"posts.subscribe.tags",
|
||||
strconv.Itoa(int(tag.ID)),
|
||||
map[string]any{"tag": tag},
|
||||
c,
|
||||
)
|
||||
|
||||
@ -152,7 +152,7 @@ func subscribeToCategory(c *fiber.Ctx) error {
|
||||
_ = authkit.AddEventExt(
|
||||
gap.Nx,
|
||||
"posts.subscribe.categories",
|
||||
strconv.Itoa(int(category.ID)),
|
||||
map[string]any{"category": category},
|
||||
c,
|
||||
)
|
||||
|
||||
@ -179,7 +179,7 @@ func unsubscribeFromUser(c *fiber.Ctx) error {
|
||||
_ = authkit.AddEventExt(
|
||||
gap.Nx,
|
||||
"posts.unsubscribe.users",
|
||||
strconv.Itoa(int(otherUser.ID)),
|
||||
map[string]any{"user": otherUser},
|
||||
c,
|
||||
)
|
||||
|
||||
@ -206,7 +206,7 @@ func unsubscribeFromTag(c *fiber.Ctx) error {
|
||||
_ = authkit.AddEventExt(
|
||||
gap.Nx,
|
||||
"posts.unsubscribe.tags",
|
||||
strconv.Itoa(int(tag.ID)),
|
||||
map[string]any{"tag": tag},
|
||||
c,
|
||||
)
|
||||
|
||||
@ -233,7 +233,7 @@ func unsubscribeFromCategory(c *fiber.Ctx) error {
|
||||
_ = authkit.AddEventExt(
|
||||
gap.Nx,
|
||||
"posts.unsubscribe.categories",
|
||||
strconv.Itoa(int(category.ID)),
|
||||
map[string]any{"category": category},
|
||||
c,
|
||||
)
|
||||
|
||||
|
@ -18,7 +18,7 @@ func getTag(c *fiber.Ctx) error {
|
||||
}
|
||||
|
||||
func listTags(c *fiber.Ctx) error {
|
||||
take := c.QueryInt("take", 0)
|
||||
take := c.QueryInt("take", 10)
|
||||
offset := c.QueryInt("offset", 0)
|
||||
probe := c.Query("probe")
|
||||
|
||||
|
228
pkg/internal/http/api/videos_api.go
Normal file
228
pkg/internal/http/api/videos_api.go
Normal file
@ -0,0 +1,228 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"git.solsynth.dev/hypernet/interactive/pkg/internal/database"
|
||||
"git.solsynth.dev/hypernet/interactive/pkg/internal/gap"
|
||||
"git.solsynth.dev/hypernet/interactive/pkg/internal/http/exts"
|
||||
"git.solsynth.dev/hypernet/interactive/pkg/internal/models"
|
||||
"git.solsynth.dev/hypernet/interactive/pkg/internal/services"
|
||||
"git.solsynth.dev/hypernet/nexus/pkg/nex/cruda"
|
||||
"git.solsynth.dev/hypernet/nexus/pkg/nex/sec"
|
||||
"git.solsynth.dev/hypernet/passport/pkg/authkit"
|
||||
authm "git.solsynth.dev/hypernet/passport/pkg/authkit/models"
|
||||
"github.com/gofiber/fiber/v2"
|
||||
jsoniter "github.com/json-iterator/go"
|
||||
"github.com/samber/lo"
|
||||
)
|
||||
|
||||
func createVideo(c *fiber.Ctx) error {
|
||||
if err := sec.EnsureGrantedPerm(c, "CreatePosts", true); err != nil {
|
||||
return err
|
||||
}
|
||||
user := c.Locals("user").(authm.Account)
|
||||
|
||||
var data struct {
|
||||
Publisher uint `json:"publisher"`
|
||||
Video string `json:"video" validate:"required"`
|
||||
Alias *string `json:"alias"`
|
||||
Title string `json:"title" validate:"required"`
|
||||
Description *string `json:"description"`
|
||||
Location *string `json:"location"`
|
||||
Thumbnail *string `json:"thumbnail"`
|
||||
Subtitles map[string]string `json:"subtitles"`
|
||||
Tags []models.Tag `json:"tags"`
|
||||
Categories []models.Category `json:"categories"`
|
||||
PublishedAt *time.Time `json:"published_at"`
|
||||
PublishedUntil *time.Time `json:"published_until"`
|
||||
VisibleUsers []uint `json:"visible_users_list"`
|
||||
InvisibleUsers []uint `json:"invisible_users_list"`
|
||||
Visibility *int8 `json:"visibility"`
|
||||
Renderer *string `json:"renderer"`
|
||||
IsLive bool `json:"is_live"`
|
||||
IsDraft bool `json:"is_draft"`
|
||||
Realm *uint `json:"realm"`
|
||||
}
|
||||
|
||||
if err := exts.BindAndValidate(c, &data); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
publisher, err := services.GetPublisher(data.Publisher, user.ID)
|
||||
if err != nil {
|
||||
return fiber.NewError(fiber.StatusBadRequest, err.Error())
|
||||
}
|
||||
|
||||
body := models.PostVideoBody{
|
||||
Thumbnail: data.Thumbnail,
|
||||
Video: data.Video,
|
||||
Title: data.Title,
|
||||
Renderer: data.Renderer,
|
||||
Description: data.Description,
|
||||
Location: data.Location,
|
||||
Subtitles: data.Subtitles,
|
||||
IsLive: data.IsLive,
|
||||
}
|
||||
|
||||
var bodyMapping map[string]any
|
||||
rawBody, _ := jsoniter.Marshal(body)
|
||||
_ = jsoniter.Unmarshal(rawBody, &bodyMapping)
|
||||
|
||||
item := models.Post{
|
||||
Alias: data.Alias,
|
||||
Type: models.PostTypeVideo,
|
||||
Body: bodyMapping,
|
||||
Language: services.DetectLanguage(data.Title),
|
||||
Tags: data.Tags,
|
||||
Categories: data.Categories,
|
||||
PublishedAt: data.PublishedAt,
|
||||
PublishedUntil: data.PublishedUntil,
|
||||
IsDraft: data.IsDraft,
|
||||
VisibleUsers: data.VisibleUsers,
|
||||
InvisibleUsers: data.InvisibleUsers,
|
||||
PublisherID: publisher.ID,
|
||||
}
|
||||
|
||||
if item.PublishedAt == nil {
|
||||
item.PublishedAt = lo.ToPtr(time.Now())
|
||||
}
|
||||
|
||||
if data.Realm != nil {
|
||||
if _, err := authkit.GetRealmMember(gap.Nx, *data.Realm, user.ID); err != nil {
|
||||
return fiber.NewError(fiber.StatusBadRequest, fmt.Sprintf("you are not a member of realm #%d", *data.Realm))
|
||||
}
|
||||
item.RealmID = data.Realm
|
||||
}
|
||||
|
||||
if data.Visibility != nil {
|
||||
item.Visibility = *data.Visibility
|
||||
} else {
|
||||
item.Visibility = models.PostVisibilityAll
|
||||
}
|
||||
|
||||
item, err = services.NewPost(publisher, item)
|
||||
if err != nil {
|
||||
return fiber.NewError(fiber.StatusBadRequest, err.Error())
|
||||
} else {
|
||||
_ = authkit.AddEventExt(
|
||||
gap.Nx,
|
||||
"posts.new",
|
||||
map[string]any{"post": item},
|
||||
c,
|
||||
)
|
||||
}
|
||||
|
||||
return c.JSON(item)
|
||||
}
|
||||
|
||||
func editVideo(c *fiber.Ctx) error {
|
||||
id, _ := c.ParamsInt("postId", 0)
|
||||
if err := sec.EnsureAuthenticated(c); err != nil {
|
||||
return err
|
||||
}
|
||||
user := c.Locals("user").(authm.Account)
|
||||
|
||||
var data struct {
|
||||
Publisher uint `json:"publisher"`
|
||||
Video string `json:"video" validate:"required"`
|
||||
Alias *string `json:"alias"`
|
||||
Title string `json:"title" validate:"required"`
|
||||
Description *string `json:"description"`
|
||||
Location *string `json:"location"`
|
||||
Thumbnail *string `json:"thumbnail"`
|
||||
Subtitles map[string]string `json:"subtitles"`
|
||||
Tags []models.Tag `json:"tags"`
|
||||
Categories []models.Category `json:"categories"`
|
||||
PublishedAt *time.Time `json:"published_at"`
|
||||
PublishedUntil *time.Time `json:"published_until"`
|
||||
VisibleUsers []uint `json:"visible_users_list"`
|
||||
InvisibleUsers []uint `json:"invisible_users_list"`
|
||||
Visibility *int8 `json:"visibility"`
|
||||
Renderer *string `json:"renderer"`
|
||||
IsLive bool `json:"is_live"`
|
||||
IsDraft bool `json:"is_draft"`
|
||||
}
|
||||
|
||||
if err := exts.BindAndValidate(c, &data); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
publisher, err := services.GetPublisher(data.Publisher, user.ID)
|
||||
if err != nil {
|
||||
return fiber.NewError(fiber.StatusBadRequest, err.Error())
|
||||
}
|
||||
|
||||
var item models.Post
|
||||
if err := database.C.Where(models.Post{
|
||||
BaseModel: cruda.BaseModel{ID: uint(id)},
|
||||
PublisherID: publisher.ID,
|
||||
Type: models.PostTypeVideo,
|
||||
}).Preload("Publisher").First(&item).Error; err != nil {
|
||||
return fiber.NewError(fiber.StatusNotFound, err.Error())
|
||||
}
|
||||
|
||||
if item.LockedAt != nil {
|
||||
return fiber.NewError(fiber.StatusForbidden, "post was locked")
|
||||
}
|
||||
|
||||
if !item.IsDraft && !data.IsDraft {
|
||||
item.EditedAt = lo.ToPtr(time.Now())
|
||||
}
|
||||
|
||||
if item.IsDraft && !data.IsDraft && data.PublishedAt == nil {
|
||||
item.PublishedAt = lo.ToPtr(time.Now())
|
||||
} else {
|
||||
item.PublishedAt = data.PublishedAt
|
||||
}
|
||||
|
||||
body := models.PostVideoBody{
|
||||
Thumbnail: data.Thumbnail,
|
||||
Video: data.Video,
|
||||
Title: data.Title,
|
||||
Description: data.Description,
|
||||
Location: data.Location,
|
||||
Subtitles: data.Subtitles,
|
||||
Renderer: data.Renderer,
|
||||
IsLive: data.IsLive,
|
||||
}
|
||||
|
||||
var bodyMapping map[string]any
|
||||
rawBody, _ := jsoniter.Marshal(body)
|
||||
_ = jsoniter.Unmarshal(rawBody, &bodyMapping)
|
||||
|
||||
og := item
|
||||
item.Alias = data.Alias
|
||||
item.Body = bodyMapping
|
||||
item.Language = services.DetectLanguage(data.Title)
|
||||
item.Tags = data.Tags
|
||||
item.Categories = data.Categories
|
||||
item.IsDraft = data.IsDraft
|
||||
item.PublishedUntil = data.PublishedUntil
|
||||
item.VisibleUsers = data.VisibleUsers
|
||||
item.InvisibleUsers = data.InvisibleUsers
|
||||
|
||||
// Preload publisher data
|
||||
item.Publisher = publisher
|
||||
|
||||
if item.PublishedAt == nil {
|
||||
item.PublishedAt = data.PublishedAt
|
||||
}
|
||||
if data.Visibility != nil {
|
||||
item.Visibility = *data.Visibility
|
||||
}
|
||||
|
||||
if item, err = services.EditPost(item, og); err != nil {
|
||||
return fiber.NewError(fiber.StatusBadRequest, err.Error())
|
||||
} else {
|
||||
_ = authkit.AddEventExt(
|
||||
gap.Nx,
|
||||
"posts.edit",
|
||||
map[string]any{"post": item},
|
||||
c,
|
||||
)
|
||||
}
|
||||
|
||||
return c.JSON(item)
|
||||
}
|
65
pkg/internal/http/api/webfinger_api.go
Normal file
65
pkg/internal/http/api/webfinger_api.go
Normal file
@ -0,0 +1,65 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"git.solsynth.dev/hypernet/interactive/pkg/internal/database"
|
||||
"git.solsynth.dev/hypernet/interactive/pkg/internal/models"
|
||||
"git.solsynth.dev/hypernet/interactive/pkg/internal/services"
|
||||
"github.com/gofiber/fiber/v2"
|
||||
)
|
||||
|
||||
type WebFingerResponse struct {
|
||||
Subject string `json:"subject"`
|
||||
Aliases []string `json:"aliases"`
|
||||
Links []struct {
|
||||
Rel string `json:"rel"`
|
||||
Type string `json:"type,omitempty"`
|
||||
Href string `json:"href"`
|
||||
} `json:"links"`
|
||||
}
|
||||
|
||||
// Although this webfinger is desgined for users
|
||||
// But in this case we will provide publisher for them
|
||||
func getWebfinger(c *fiber.Ctx) error {
|
||||
resource := c.Query("resource")
|
||||
|
||||
if len(resource) < 6 || resource[:5] != "acct:" {
|
||||
return c.Status(400).JSON(fiber.Map{"error": "Invalid resource format"})
|
||||
}
|
||||
|
||||
username := resource[5:]
|
||||
if username == "" {
|
||||
return c.Status(400).JSON(fiber.Map{"error": "Invalid username"})
|
||||
}
|
||||
parts := strings.SplitN(username, "@", 2)
|
||||
if len(parts) != 2 {
|
||||
return c.Status(400).JSON(fiber.Map{"error": "Invalid username"})
|
||||
}
|
||||
|
||||
var publisher models.Publisher
|
||||
if err := database.C.Where("name = ?", parts[0]).First(&publisher).Error; err != nil {
|
||||
return fiber.NewError(fiber.StatusNotFound, err.Error())
|
||||
}
|
||||
|
||||
response := WebFingerResponse{
|
||||
Subject: "acct:" + username,
|
||||
Aliases: []string{
|
||||
services.GetActivityID("/users/" + publisher.Name).String(),
|
||||
},
|
||||
Links: []struct {
|
||||
Rel string `json:"rel"`
|
||||
Type string `json:"type,omitempty"`
|
||||
Href string `json:"href"`
|
||||
}{
|
||||
{
|
||||
Rel: "self",
|
||||
Type: "application/activity+json",
|
||||
Href: services.GetActivityID("/users/" + publisher.Name).String(),
|
||||
},
|
||||
// TODO Add avatar here
|
||||
},
|
||||
}
|
||||
|
||||
return c.JSON(response)
|
||||
}
|
@ -20,10 +20,15 @@ func getWhatsNew(c *fiber.Ctx) error {
|
||||
}
|
||||
|
||||
tx := services.FilterPostDraft(database.C)
|
||||
tx = services.FilterPostWithUserContext(tx, &user)
|
||||
tx = services.FilterPostWithUserContext(c, tx, &user)
|
||||
|
||||
tx = tx.Where("id > ?", pivot)
|
||||
|
||||
var userId *uint
|
||||
if user, authenticated := c.Locals("user").(authm.Account); authenticated {
|
||||
userId = &user.ID
|
||||
}
|
||||
|
||||
countTx := tx
|
||||
count, err := services.CountPost(countTx)
|
||||
if err != nil {
|
||||
@ -35,7 +40,7 @@ func getWhatsNew(c *fiber.Ctx) error {
|
||||
order = "published_at DESC, (COALESCE(total_upvote, 0) - COALESCE(total_downvote, 0)) DESC"
|
||||
}
|
||||
|
||||
items, err := services.ListPost(tx, 10, 0, order)
|
||||
items, err := services.ListPost(tx, 10, 0, order, userId)
|
||||
if err != nil {
|
||||
return fiber.NewError(fiber.StatusBadRequest, err.Error())
|
||||
}
|
||||
|
@ -1,10 +1,12 @@
|
||||
package http
|
||||
|
||||
import (
|
||||
"git.solsynth.dev/hypernet/nexus/pkg/nex/sec"
|
||||
"git.solsynth.dev/hypernet/passport/pkg/authkit"
|
||||
"strings"
|
||||
|
||||
"git.solsynth.dev/hypernet/nexus/pkg/nex/sec"
|
||||
"git.solsynth.dev/hypernet/passport/pkg/authkit"
|
||||
|
||||
"git.solsynth.dev/hypernet/interactive/pkg/internal/http/admin"
|
||||
"git.solsynth.dev/hypernet/interactive/pkg/internal/http/api"
|
||||
"github.com/gofiber/fiber/v2"
|
||||
"github.com/gofiber/fiber/v2/middleware/cors"
|
||||
@ -31,6 +33,7 @@ func NewServer() *App {
|
||||
JSONEncoder: jsoniter.ConfigCompatibleWithStandardLibrary.Marshal,
|
||||
JSONDecoder: jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal,
|
||||
BodyLimit: 50 * 1024 * 1024,
|
||||
ReadBufferSize: 5 * 1024 * 1024, // 5MB for large JWT
|
||||
EnablePrintRoutes: viper.GetBool("debug.print_routes"),
|
||||
})
|
||||
|
||||
@ -59,7 +62,8 @@ func NewServer() *App {
|
||||
app.Use(sec.ContextMiddleware(IReader))
|
||||
app.Use(authkit.ParseAccountMiddleware)
|
||||
|
||||
api.MapAPIs(app, "/api")
|
||||
api.MapControllers(app, "/api")
|
||||
admin.MapControllers(app, "/api/admin")
|
||||
|
||||
return &App{
|
||||
app: app,
|
||||
|
10
pkg/internal/models/flags.go
Normal file
10
pkg/internal/models/flags.go
Normal file
@ -0,0 +1,10 @@
|
||||
package models
|
||||
|
||||
import "git.solsynth.dev/hypernet/nexus/pkg/nex/cruda"
|
||||
|
||||
type PostFlag struct {
|
||||
cruda.BaseModel
|
||||
|
||||
PostID uint `json:"post_id"`
|
||||
AccountID uint `json:"account_id"`
|
||||
}
|
39
pkg/internal/models/polls.go
Normal file
39
pkg/internal/models/polls.go
Normal file
@ -0,0 +1,39 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"git.solsynth.dev/hypernet/nexus/pkg/nex/cruda"
|
||||
"gorm.io/datatypes"
|
||||
)
|
||||
|
||||
type Poll struct {
|
||||
cruda.BaseModel
|
||||
|
||||
ExpiredAt *time.Time `json:"expired_at"`
|
||||
Options datatypes.JSONSlice[PollOption] `json:"options"`
|
||||
AccountID uint `json:"account_id"`
|
||||
|
||||
Metric PollMetric `json:"metric" gorm:"-"`
|
||||
}
|
||||
|
||||
type PollMetric struct {
|
||||
TotalAnswer int64 `json:"total_answer"`
|
||||
ByOptions map[string]int64 `json:"by_options"`
|
||||
ByOptionsPercentage map[string]float64 `json:"by_options_percentage"`
|
||||
}
|
||||
|
||||
type PollOption struct {
|
||||
ID string `json:"id"`
|
||||
Icon string `json:"icon"`
|
||||
Name string `json:"name"`
|
||||
Description string `json:"description"`
|
||||
}
|
||||
|
||||
type PollAnswer struct {
|
||||
cruda.BaseModel
|
||||
|
||||
Answer string `json:"answer"`
|
||||
PollID uint `json:"poll_id"`
|
||||
AccountID uint `json:"account_id"`
|
||||
}
|
@ -1,16 +1,19 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"git.solsynth.dev/hypernet/nexus/pkg/nex/cruda"
|
||||
authm "git.solsynth.dev/hypernet/passport/pkg/authkit/models"
|
||||
"time"
|
||||
|
||||
"gorm.io/datatypes"
|
||||
)
|
||||
|
||||
const (
|
||||
PostTypeStory = "story"
|
||||
PostTypeArticle = "article"
|
||||
PostTypeStory = "story"
|
||||
PostTypeArticle = "article"
|
||||
PostTypeQuestion = "question"
|
||||
PostTypeVideo = "video"
|
||||
)
|
||||
|
||||
type PostVisibilityLevel = int8
|
||||
@ -29,12 +32,13 @@ type Post struct {
|
||||
Type string `json:"type"`
|
||||
Body datatypes.JSONMap `json:"body" gorm:"index:,type:gin"`
|
||||
Language string `json:"language"`
|
||||
Alias *string `json:"alias"`
|
||||
AliasPrefix *string `json:"alias_prefix"`
|
||||
Alias *string `json:"alias" gorm:"index"`
|
||||
AliasPrefix *string `json:"alias_prefix" gorm:"index"`
|
||||
Tags []Tag `json:"tags" gorm:"many2many:post_tags"`
|
||||
Categories []Category `json:"categories" gorm:"many2many:post_categories"`
|
||||
Reactions []Reaction `json:"reactions"`
|
||||
Replies []Post `json:"replies" gorm:"foreignKey:ReplyID"`
|
||||
Flags []PostFlag `json:"flags" gorm:"foreignKey:PostID"`
|
||||
ReplyID *uint `json:"reply_id"`
|
||||
RepostID *uint `json:"repost_id"`
|
||||
ReplyTo *Post `json:"reply_to" gorm:"foreignKey:ReplyID"`
|
||||
@ -48,12 +52,18 @@ type Post struct {
|
||||
PinnedAt *time.Time `json:"pinned_at"`
|
||||
LockedAt *time.Time `json:"locked_at"`
|
||||
|
||||
IsCollapsed bool `json:"is_collapsed"`
|
||||
IsDraft bool `json:"is_draft"`
|
||||
PublishedAt *time.Time `json:"published_at"`
|
||||
PublishedUntil *time.Time `json:"published_until"`
|
||||
|
||||
TotalUpvote int `json:"total_upvote"`
|
||||
TotalDownvote int `json:"total_downvote"`
|
||||
TotalUpvote int `json:"total_upvote"`
|
||||
TotalDownvote int `json:"total_downvote"`
|
||||
TotalViews int64 `json:"total_views"`
|
||||
TotalAggressiveViews int64 `json:"total_aggressive_views"`
|
||||
|
||||
PollID *uint `json:"poll_id"`
|
||||
Poll *Poll `json:"poll"`
|
||||
|
||||
RealmID *uint `json:"realm_id"`
|
||||
Realm *authm.Realm `json:"realm" gorm:"-"`
|
||||
@ -79,3 +89,36 @@ type PostArticleBody struct {
|
||||
Content string `json:"content"`
|
||||
Attachments []string `json:"attachments"`
|
||||
}
|
||||
|
||||
type PostQuestionBody struct {
|
||||
PostStoryBody
|
||||
Answer *uint `json:"answer"`
|
||||
Reward float64 `json:"reward"`
|
||||
}
|
||||
|
||||
type PostVideoBody struct {
|
||||
Thumbnail *string `json:"thumbnail"`
|
||||
Title string `json:"title"`
|
||||
Description *string `json:"description"`
|
||||
Location *string `json:"location"`
|
||||
Video string `json:"video"`
|
||||
Renderer *string `json:"renderer"`
|
||||
IsLive bool `json:"is_live"`
|
||||
IsLiveEnded bool `json:"is_live_ended"`
|
||||
Subtitles map[string]string `json:"subtitles"`
|
||||
}
|
||||
|
||||
type PostInsight struct {
|
||||
cruda.BaseModel
|
||||
|
||||
Response string `json:"response"`
|
||||
Post Post `json:"post"`
|
||||
PostID uint `json:"post_id"`
|
||||
}
|
||||
|
||||
type PostView struct {
|
||||
AccountID uint `json:"account_id" gorm:"primaryKey"`
|
||||
PostID uint `json:"post_id" gorm:"primaryKey"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
}
|
||||
|
@ -1,6 +1,9 @@
|
||||
package models
|
||||
|
||||
import "git.solsynth.dev/hypernet/nexus/pkg/nex/cruda"
|
||||
import (
|
||||
"git.solsynth.dev/hypernet/nexus/pkg/nex/cruda"
|
||||
"git.solsynth.dev/hypernet/passport/pkg/authkit/models"
|
||||
)
|
||||
|
||||
const (
|
||||
PublisherTypePersonal = iota
|
||||
@ -26,4 +29,7 @@ type Publisher struct {
|
||||
|
||||
RealmID *uint `json:"realm_id"`
|
||||
AccountID *uint `json:"account_id"`
|
||||
|
||||
Account models.Account `gorm:"-" json:"account"`
|
||||
Realm models.Realm `gorm:"-" json:"realm"`
|
||||
}
|
||||
|
@ -5,12 +5,8 @@ import "git.solsynth.dev/hypernet/nexus/pkg/nex/cruda"
|
||||
type Subscription struct {
|
||||
cruda.BaseModel
|
||||
|
||||
FollowerID uint `json:"follower_id"`
|
||||
Follower Publisher `json:"follower"`
|
||||
AccountID *uint `json:"account_id,omitempty"`
|
||||
Account *Publisher `json:"account,omitempty"`
|
||||
TagID *uint `json:"tag_id,omitempty"`
|
||||
Tag Tag `json:"tag,omitempty"`
|
||||
CategoryID *uint `json:"category_id,omitempty"`
|
||||
Category Category `json:"category,omitempty"`
|
||||
FollowerID uint `json:"follower_id"`
|
||||
AccountID *uint `json:"account_id,omitempty"`
|
||||
TagID *uint `json:"tag_id,omitempty"`
|
||||
CategoryID *uint `json:"category_id,omitempty"`
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package services
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"git.solsynth.dev/hypernet/interactive/pkg/internal/database"
|
||||
"git.solsynth.dev/hypernet/interactive/pkg/internal/gap"
|
||||
"git.solsynth.dev/hypernet/interactive/pkg/internal/models"
|
||||
@ -21,11 +22,11 @@ func GetAccountWithID(id uint) (models.Publisher, error) {
|
||||
func ModifyPosterVoteCount(user models.Publisher, isUpvote bool, delta int) error {
|
||||
if isUpvote {
|
||||
user.TotalUpvote += delta
|
||||
return database.C.Model(&user).Update("total_upvote", user.TotalUpvote).Error
|
||||
} else {
|
||||
user.TotalDownvote += delta
|
||||
return database.C.Model(&user).Update("total_downvote", user.TotalDownvote).Error
|
||||
}
|
||||
|
||||
return database.C.Save(&user).Error
|
||||
}
|
||||
|
||||
func NotifyPosterAccount(pub models.Publisher, post models.Post, title, body, topic string, subtitle ...string) error {
|
||||
|
16
pkg/internal/services/activitypub.go
Normal file
16
pkg/internal/services/activitypub.go
Normal file
@ -0,0 +1,16 @@
|
||||
package services
|
||||
|
||||
import (
|
||||
"github.com/go-ap/activitypub"
|
||||
"github.com/spf13/viper"
|
||||
)
|
||||
|
||||
func GetActivityID(uri string) activitypub.ID {
|
||||
baseUrl := viper.GetString("activitypub_base_url")
|
||||
return activitypub.ID(baseUrl + uri)
|
||||
}
|
||||
|
||||
func GetActivityIRI(uri string) activitypub.IRI {
|
||||
baseUrl := viper.GetString("activitypub_base_url")
|
||||
return activitypub.IRI(baseUrl + uri)
|
||||
}
|
@ -2,17 +2,27 @@ package services
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"git.solsynth.dev/hypernet/nexus/pkg/nex/cruda"
|
||||
"strings"
|
||||
|
||||
"git.solsynth.dev/hypernet/nexus/pkg/nex/cruda"
|
||||
|
||||
"git.solsynth.dev/hypernet/interactive/pkg/internal/database"
|
||||
"git.solsynth.dev/hypernet/interactive/pkg/internal/models"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
func ListCategory() ([]models.Category, error) {
|
||||
func SearchCategories(take int, offset int, probe string) ([]models.Category, error) {
|
||||
probe = "%" + probe + "%"
|
||||
|
||||
var categories []models.Category
|
||||
err := database.C.Find(&categories).Error
|
||||
err := database.C.Where("alias LIKE ?", probe).Offset(offset).Limit(take).Find(&categories).Error
|
||||
|
||||
return categories, err
|
||||
}
|
||||
|
||||
func ListCategory(take int, offset int) ([]models.Category, error) {
|
||||
var categories []models.Category
|
||||
err := database.C.Offset(offset).Limit(take).Find(&categories).Error
|
||||
|
||||
return categories, err
|
||||
}
|
||||
|
@ -1,23 +0,0 @@
|
||||
package services
|
||||
|
||||
import (
|
||||
"git.solsynth.dev/hypernet/interactive/pkg/internal/database"
|
||||
"github.com/rs/zerolog/log"
|
||||
"time"
|
||||
)
|
||||
|
||||
func DoAutoDatabaseCleanup() {
|
||||
deadline := time.Now().Add(60 * time.Minute)
|
||||
log.Debug().Time("deadline", deadline).Msg("Now cleaning up entire database...")
|
||||
|
||||
var count int64
|
||||
for _, model := range database.AutoMaintainRange {
|
||||
tx := database.C.Unscoped().Delete(model, "deleted_at >= ?", deadline)
|
||||
if tx.Error != nil {
|
||||
log.Error().Err(tx.Error).Msg("An error occurred when running auth context cleanup...")
|
||||
}
|
||||
count += tx.RowsAffected
|
||||
}
|
||||
|
||||
log.Debug().Int64("affected", count).Msg("Clean up entire database accomplished.")
|
||||
}
|
43
pkg/internal/services/flags.go
Normal file
43
pkg/internal/services/flags.go
Normal file
@ -0,0 +1,43 @@
|
||||
package services
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"git.solsynth.dev/hypernet/interactive/pkg/internal/database"
|
||||
"git.solsynth.dev/hypernet/interactive/pkg/internal/models"
|
||||
)
|
||||
|
||||
func NewFlag(post models.Post, account uint) (models.PostFlag, error) {
|
||||
var flag models.PostFlag
|
||||
if err := database.C.Where("post_id = ? AND account_id = ?", post.ID, account).First(&flag).Error; err == nil {
|
||||
return flag, fmt.Errorf("flag already exists")
|
||||
}
|
||||
flag = models.PostFlag{
|
||||
PostID: post.ID,
|
||||
AccountID: account,
|
||||
}
|
||||
if err := database.C.Save(&flag).Error; err != nil {
|
||||
return flag, err
|
||||
}
|
||||
if err := FlagCalculateCollapseStatus(post); err != nil {
|
||||
return flag, err
|
||||
}
|
||||
return flag, nil
|
||||
}
|
||||
|
||||
func FlagCalculateCollapseStatus(post models.Post) error {
|
||||
if post.TotalViews <= 2 {
|
||||
return nil
|
||||
}
|
||||
|
||||
collapseLimit := 0.5
|
||||
|
||||
var flagCount int64
|
||||
if err := database.C.Model(&models.PostFlag{}).Where("post_id = ?", post.ID).Count(&flagCount).Error; err != nil {
|
||||
return err
|
||||
}
|
||||
if float64(flagCount)/float64(post.TotalViews) >= collapseLimit {
|
||||
return database.C.Model(&post).Update("is_collapsed", true).Error
|
||||
}
|
||||
return nil
|
||||
}
|
60
pkg/internal/services/insight.go
Normal file
60
pkg/internal/services/insight.go
Normal file
@ -0,0 +1,60 @@
|
||||
package services
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
iproto "git.solsynth.dev/hypernet/insight/pkg/proto"
|
||||
"git.solsynth.dev/hypernet/interactive/pkg/internal/database"
|
||||
"git.solsynth.dev/hypernet/interactive/pkg/internal/gap"
|
||||
"git.solsynth.dev/hypernet/interactive/pkg/internal/models"
|
||||
"github.com/rs/zerolog/log"
|
||||
)
|
||||
|
||||
func GeneratePostInsights(post models.Post, user uint) (string, error) {
|
||||
var insight models.PostInsight
|
||||
if err := database.C.Where("post_id = ?", post.ID).First(&insight).Error; err == nil {
|
||||
return insight.Response, nil
|
||||
}
|
||||
|
||||
var compactBuilder []string
|
||||
if val, ok := post.Body["title"].(string); ok && len(val) > 0 {
|
||||
compactBuilder = append(compactBuilder, "Title: "+val)
|
||||
}
|
||||
if val, ok := post.Body["description"].(string); ok && len(val) > 0 {
|
||||
compactBuilder = append(compactBuilder, "Description: "+val)
|
||||
}
|
||||
if val, ok := post.Body["content"].(string); ok && len(val) > 0 {
|
||||
compactBuilder = append(compactBuilder, val)
|
||||
}
|
||||
|
||||
compact := strings.Join(compactBuilder, "\n")
|
||||
|
||||
conn, err := gap.Nx.GetClientGrpcConn("ai")
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("failed to connect Insight: %v", err)
|
||||
}
|
||||
ic := iproto.NewInsightServiceClient(conn)
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 3*time.Minute)
|
||||
defer cancel()
|
||||
resp, err := ic.GenerateInsight(ctx, &iproto.InsightRequest{
|
||||
Source: compact,
|
||||
UserId: uint64(user),
|
||||
})
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
insight = models.PostInsight{
|
||||
Response: resp.Response,
|
||||
Post: post,
|
||||
PostID: post.ID,
|
||||
}
|
||||
if err := database.C.Create(&insight).Error; err != nil {
|
||||
log.Error().Err(err).Msg("Failed to create post insight result in database...")
|
||||
}
|
||||
|
||||
return resp.Response, nil
|
||||
}
|
77
pkg/internal/services/polls.go
Normal file
77
pkg/internal/services/polls.go
Normal file
@ -0,0 +1,77 @@
|
||||
package services
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
"git.solsynth.dev/hypernet/interactive/pkg/internal/database"
|
||||
"git.solsynth.dev/hypernet/interactive/pkg/internal/models"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
func NewPoll(poll models.Poll) (models.Poll, error) {
|
||||
if err := database.C.Create(&poll).Error; err != nil {
|
||||
return poll, err
|
||||
}
|
||||
return poll, nil
|
||||
}
|
||||
|
||||
func UpdatePoll(poll models.Poll) (models.Poll, error) {
|
||||
if err := database.C.Save(&poll).Error; err != nil {
|
||||
return poll, err
|
||||
}
|
||||
return poll, nil
|
||||
}
|
||||
|
||||
func AddPollAnswer(poll models.Poll, answer models.PollAnswer) (models.PollAnswer, error) {
|
||||
answer.PollID = poll.ID
|
||||
|
||||
var currentAnswer models.PollAnswer
|
||||
if err := database.C.Model(&models.PollAnswer{}).
|
||||
Where("poll_id = ? AND account_id = ?", poll.ID, answer.AccountID).
|
||||
First(¤tAnswer).Error; err == nil {
|
||||
if err := database.C.Model(¤tAnswer).
|
||||
Where("id = ?", currentAnswer.ID).
|
||||
Updates(&models.PollAnswer{Answer: answer.Answer}).Error; err != nil {
|
||||
return answer, fmt.Errorf("failed to update your answer")
|
||||
}
|
||||
|
||||
return answer, nil
|
||||
} else if !errors.Is(err, gorm.ErrRecordNotFound) {
|
||||
return answer, err
|
||||
}
|
||||
|
||||
if err := database.C.Create(&answer).Error; err != nil {
|
||||
return answer, err
|
||||
}
|
||||
|
||||
return answer, nil
|
||||
}
|
||||
|
||||
func GetPollMetric(poll models.Poll) models.PollMetric {
|
||||
var answers []models.PollAnswer
|
||||
if err := database.C.Where("poll_id = ?", poll.ID).Find(&answers).Error; err != nil {
|
||||
return models.PollMetric{}
|
||||
}
|
||||
|
||||
byOptions := make(map[string]int64)
|
||||
for _, answer := range answers {
|
||||
if _, ok := byOptions[answer.Answer]; !ok {
|
||||
byOptions[answer.Answer] = 0
|
||||
}
|
||||
byOptions[answer.Answer]++
|
||||
}
|
||||
|
||||
byOptionsPercentage := make(map[string]float64)
|
||||
for _, option := range poll.Options {
|
||||
if val, ok := byOptions[option.ID]; ok {
|
||||
byOptionsPercentage[option.ID] = float64(val) / float64(len(answers))
|
||||
}
|
||||
}
|
||||
|
||||
return models.PollMetric{
|
||||
TotalAnswer: int64(len(answers)),
|
||||
ByOptions: byOptions,
|
||||
ByOptionsPercentage: byOptionsPercentage,
|
||||
}
|
||||
}
|
56
pkg/internal/services/post_views.go
Normal file
56
pkg/internal/services/post_views.go
Normal file
@ -0,0 +1,56 @@
|
||||
package services
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"git.solsynth.dev/hypernet/interactive/pkg/internal/database"
|
||||
"git.solsynth.dev/hypernet/interactive/pkg/internal/models"
|
||||
"github.com/samber/lo"
|
||||
"gorm.io/gorm"
|
||||
"gorm.io/gorm/clause"
|
||||
)
|
||||
|
||||
var postViewQueue []models.PostView
|
||||
|
||||
func AddPostView(post models.Post, account uint) {
|
||||
postViewQueue = append(postViewQueue, models.PostView{
|
||||
AccountID: account,
|
||||
PostID: post.ID,
|
||||
})
|
||||
}
|
||||
|
||||
func AddPostViews(posts []models.Post, account uint) {
|
||||
for _, post := range posts {
|
||||
postViewQueue = append(postViewQueue, models.PostView{
|
||||
AccountID: account,
|
||||
PostID: post.ID,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func FlushPostViews() {
|
||||
if len(postViewQueue) == 0 {
|
||||
return
|
||||
}
|
||||
workingQueue := make([]models.PostView, len(postViewQueue))
|
||||
copy(workingQueue, postViewQueue)
|
||||
clear(postViewQueue)
|
||||
updateRequiredPost := make(map[uint]int)
|
||||
for _, item := range workingQueue {
|
||||
updateRequiredPost[item.PostID]++
|
||||
}
|
||||
workingQueue = lo.UniqBy(workingQueue, func(item models.PostView) string {
|
||||
return fmt.Sprintf("%d:%d", item.PostID, item.AccountID)
|
||||
})
|
||||
_ = database.C.Clauses(clause.OnConflict{DoNothing: true}).CreateInBatches(workingQueue, 1000).Error
|
||||
for k, v := range updateRequiredPost {
|
||||
var count int64
|
||||
if err := database.C.Model(&models.PostView{}).Where("post_id = ?", k).Count(&count).Error; err != nil {
|
||||
continue
|
||||
}
|
||||
database.C.Model(&models.Post{}).Where("id = ?", k).Updates(map[string]any{
|
||||
"total_views": count,
|
||||
"total_aggressive_views": gorm.Expr("total_aggressive_views + ?", v),
|
||||
})
|
||||
}
|
||||
}
|
@ -4,20 +4,26 @@ import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
localCache "git.solsynth.dev/hypernet/interactive/pkg/internal/cache"
|
||||
"git.solsynth.dev/hypernet/interactive/pkg/internal/gap"
|
||||
"git.solsynth.dev/hypernet/nexus/pkg/proto"
|
||||
"git.solsynth.dev/hypernet/passport/pkg/authkit"
|
||||
authm "git.solsynth.dev/hypernet/passport/pkg/authkit/models"
|
||||
"github.com/eko/gocache/lib/v4/cache"
|
||||
"github.com/eko/gocache/lib/v4/marshaler"
|
||||
"github.com/eko/gocache/lib/v4/store"
|
||||
"gorm.io/datatypes"
|
||||
"reflect"
|
||||
"regexp"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"git.solsynth.dev/hypernet/nexus/pkg/nex"
|
||||
"git.solsynth.dev/hypernet/nexus/pkg/nex/cachekit"
|
||||
"github.com/goccy/go-json"
|
||||
"github.com/gofiber/fiber/v2"
|
||||
|
||||
"git.solsynth.dev/hypernet/interactive/pkg/internal/gap"
|
||||
"git.solsynth.dev/hypernet/nexus/pkg/proto"
|
||||
"git.solsynth.dev/hypernet/paperclip/pkg/filekit"
|
||||
pproto "git.solsynth.dev/hypernet/paperclip/pkg/proto"
|
||||
"git.solsynth.dev/hypernet/passport/pkg/authkit"
|
||||
authm "git.solsynth.dev/hypernet/passport/pkg/authkit/models"
|
||||
aproto "git.solsynth.dev/hypernet/passport/pkg/proto"
|
||||
"gorm.io/datatypes"
|
||||
|
||||
"git.solsynth.dev/hypernet/interactive/pkg/internal/database"
|
||||
"git.solsynth.dev/hypernet/interactive/pkg/internal/models"
|
||||
"github.com/rs/zerolog/log"
|
||||
@ -25,41 +31,77 @@ import (
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
func FilterPostWithUserContext(tx *gorm.DB, user *authm.Account) *gorm.DB {
|
||||
func FilterPostWithUserContext(c *fiber.Ctx, tx *gorm.DB, user *authm.Account) *gorm.DB {
|
||||
if user == nil {
|
||||
return tx.Where("visibility = ?", models.PostVisibilityAll)
|
||||
return tx.Where("visibility = ? AND realm_id IS NULL", models.PostVisibilityAll)
|
||||
}
|
||||
|
||||
const (
|
||||
AllVisibility = models.PostVisibilityAll
|
||||
FriendsVisibility = models.PostVisibilityFriends
|
||||
SelectedVisibility = models.PostVisibilitySelected
|
||||
FilteredVisibility = models.PostVisibilityFiltered
|
||||
NoneVisibility = models.PostVisibilityNone
|
||||
)
|
||||
|
||||
type userContextState struct {
|
||||
Allowlist []uint
|
||||
Blocklist []uint
|
||||
InvisibleList []uint
|
||||
Self []uint `json:"self"`
|
||||
Allowlist []uint `json:"allow"`
|
||||
InvisibleList []uint `json:"invisible"`
|
||||
FollowList []uint `json:"follow"`
|
||||
RealmList []uint `json:"realm"`
|
||||
}
|
||||
|
||||
cacheManager := cache.New[any](localCache.S)
|
||||
marshal := marshaler.New(cacheManager)
|
||||
ctx := context.Background()
|
||||
var self, allowlist, invisibleList, followList, realmList []uint
|
||||
|
||||
var allowlist, blocklist, invisibleList []uint
|
||||
|
||||
statusCacheKey := fmt.Sprintf("post-user-context-query#%d", user.ID)
|
||||
statusCache, err := marshal.Get(ctx, statusCacheKey, new(userContextState))
|
||||
statusCacheKey := fmt.Sprintf("post-user-filter#%d", user.ID)
|
||||
state, err := cachekit.Get[userContextState](gap.Ca, statusCacheKey)
|
||||
if err == nil {
|
||||
state := statusCache.(*userContextState)
|
||||
allowlist = state.Allowlist
|
||||
blocklist = state.Blocklist
|
||||
invisibleList = state.InvisibleList
|
||||
followList = state.FollowList
|
||||
realmList = state.RealmList
|
||||
self = state.Self
|
||||
} else {
|
||||
// Get itself
|
||||
{
|
||||
var publishers []models.Publisher
|
||||
if err := database.C.Where("account_id = ?", user.ID).Find(&publishers).Error; err != nil {
|
||||
return tx
|
||||
}
|
||||
self = lo.Map(publishers, func(item models.Publisher, index int) uint {
|
||||
return item.ID
|
||||
})
|
||||
allowlist = append(allowlist, self...)
|
||||
}
|
||||
|
||||
// Getting the relationships
|
||||
userFriends, _ := authkit.ListRelative(gap.Nx, user.ID, int32(authm.RelationshipFriend), true)
|
||||
userGotBlocked, _ := authkit.ListRelative(gap.Nx, user.ID, int32(authm.RelationshipBlocked), true)
|
||||
userBlocked, _ := authkit.ListRelative(gap.Nx, user.ID, int32(authm.RelationshipBlocked), false)
|
||||
|
||||
// Getting the realm list
|
||||
{
|
||||
conn, err := gap.Nx.GetClientGrpcConn(nex.ServiceTypeAuth)
|
||||
if err == nil {
|
||||
ac := aproto.NewRealmServiceClient(conn)
|
||||
ctx, cancel := context.WithTimeout(context.Background(), time.Second*5)
|
||||
defer cancel()
|
||||
resp, err := ac.ListAvailableRealm(ctx, &aproto.LookupUserRealmRequest{
|
||||
UserId: uint64(user.ID),
|
||||
IncludePublic: lo.ToPtr(true),
|
||||
})
|
||||
if err == nil {
|
||||
realmList = lo.Map(resp.GetData(), func(item *aproto.RealmInfo, index int) uint {
|
||||
return uint(item.GetId())
|
||||
})
|
||||
} else {
|
||||
log.Warn().Err(err).Uint("user", user.ID).Msg("An error occurred when getting realm list from grpc...")
|
||||
}
|
||||
} else {
|
||||
log.Warn().Err(err).Uint("user", user.ID).Msg("An error occurred when getting grpc connection to Auth...")
|
||||
}
|
||||
}
|
||||
|
||||
userFriendList := lo.Map(userFriends, func(item *proto.UserInfo, index int) uint {
|
||||
return uint(item.GetId())
|
||||
})
|
||||
@ -73,26 +115,31 @@ func FilterPostWithUserContext(tx *gorm.DB, user *authm.Account) *gorm.DB {
|
||||
// Query the publishers according to the user's relationship
|
||||
var publishers []models.Publisher
|
||||
database.C.Where(
|
||||
"id IN ? AND type = ?",
|
||||
"account_id IN ? AND type = ?",
|
||||
lo.Uniq(append(append(userFriendList, userGotBlockList...), userBlocklist...)),
|
||||
models.PublisherTypePersonal,
|
||||
).Find(&publishers)
|
||||
|
||||
// Getting the follow list
|
||||
{
|
||||
var subs []models.Subscription
|
||||
if err := database.C.Where("follower_id = ? AND account_id IS NOT NULL", user.ID).Find(&subs).Error; err != nil {
|
||||
log.Error().Err(err).Msg("An error occurred when getting subscriptions...")
|
||||
}
|
||||
followList = lo.Map(lo.Filter(subs, func(item models.Subscription, index int) bool {
|
||||
return item.AccountID != nil
|
||||
}), func(item models.Subscription, index int) uint {
|
||||
return *item.AccountID
|
||||
})
|
||||
}
|
||||
|
||||
allowlist = lo.Map(lo.Filter(publishers, func(item models.Publisher, index int) bool {
|
||||
if item.AccountID == nil {
|
||||
return false
|
||||
}
|
||||
return lo.Contains(userFriendList, *item.AccountID)
|
||||
}), func(item models.Publisher, index int) uint {
|
||||
return uint(item.ID)
|
||||
})
|
||||
blocklist = lo.Map(lo.Filter(publishers, func(item models.Publisher, index int) bool {
|
||||
if item.AccountID == nil {
|
||||
return false
|
||||
}
|
||||
return lo.Contains(userGotBlockList, *item.AccountID)
|
||||
}), func(item models.Publisher, index int) uint {
|
||||
return uint(item.ID)
|
||||
return item.ID
|
||||
})
|
||||
invisibleList = lo.Map(lo.Filter(publishers, func(item models.Publisher, index int) bool {
|
||||
if item.AccountID == nil {
|
||||
@ -100,50 +147,108 @@ func FilterPostWithUserContext(tx *gorm.DB, user *authm.Account) *gorm.DB {
|
||||
}
|
||||
return lo.Contains(userBlocklist, *item.AccountID)
|
||||
}), func(item models.Publisher, index int) uint {
|
||||
return uint(item.ID)
|
||||
return item.ID
|
||||
})
|
||||
|
||||
_ = marshal.Set(
|
||||
ctx,
|
||||
cachekit.Set(
|
||||
gap.Ca,
|
||||
statusCacheKey,
|
||||
userContextState{
|
||||
Allowlist: allowlist,
|
||||
Blocklist: blocklist,
|
||||
InvisibleList: invisibleList,
|
||||
RealmList: realmList,
|
||||
FollowList: followList,
|
||||
Self: self,
|
||||
},
|
||||
store.WithExpiration(5*time.Minute),
|
||||
store.WithTags([]string{"post-user-context-query", fmt.Sprintf("user#%d", user.ID)}),
|
||||
5*time.Minute,
|
||||
fmt.Sprintf("user#%d", user.ID),
|
||||
)
|
||||
}
|
||||
|
||||
tx = tx.Where(
|
||||
"publisher_id = ? OR visibility != ? OR "+
|
||||
"(visibility = ? AND publisher_id IN ? AND publisher_id NOT IN ?) OR "+
|
||||
"(visibility = ? AND ?) OR "+
|
||||
"(visibility = ? AND NOT ?)",
|
||||
user.ID,
|
||||
NoneVisibility,
|
||||
FriendsVisibility,
|
||||
allowlist,
|
||||
blocklist,
|
||||
SelectedVisibility,
|
||||
datatypes.JSONQuery("visible_users").HasKey(strconv.Itoa(int(user.ID))),
|
||||
FilteredVisibility,
|
||||
datatypes.JSONQuery("invisible_users").HasKey(strconv.Itoa(int(user.ID))),
|
||||
)
|
||||
if len(self) == 0 && len(allowlist) == 0 {
|
||||
tx = tx.Where(
|
||||
"(visibility = ? OR"+
|
||||
"(visibility = ? AND ?) OR "+
|
||||
"(visibility = ? AND NOT ?))",
|
||||
AllVisibility,
|
||||
SelectedVisibility,
|
||||
datatypes.JSONQuery("visible_users").HasKey(strconv.Itoa(int(user.ID))),
|
||||
FilteredVisibility,
|
||||
datatypes.JSONQuery("invisible_users").HasKey(strconv.Itoa(int(user.ID))),
|
||||
)
|
||||
} else if len(self) == 0 {
|
||||
tx = tx.Where(
|
||||
"(visibility = ? OR"+
|
||||
"(visibility = ? AND publisher_id IN ?) OR "+
|
||||
"(visibility = ? AND ?) OR "+
|
||||
"(visibility = ? AND NOT ?))",
|
||||
AllVisibility,
|
||||
FriendsVisibility,
|
||||
allowlist,
|
||||
SelectedVisibility,
|
||||
datatypes.JSONQuery("visible_users").HasKey(strconv.Itoa(int(user.ID))),
|
||||
FilteredVisibility,
|
||||
datatypes.JSONQuery("invisible_users").HasKey(strconv.Itoa(int(user.ID))),
|
||||
)
|
||||
} else {
|
||||
tx = tx.Where(
|
||||
"(publisher_id IN ? OR visibility = ? OR"+
|
||||
"(visibility = ? AND publisher_id IN ?) OR "+
|
||||
"(visibility = ? AND ?) OR "+
|
||||
"(visibility = ? AND NOT ?))",
|
||||
self,
|
||||
AllVisibility,
|
||||
FriendsVisibility,
|
||||
allowlist,
|
||||
SelectedVisibility,
|
||||
datatypes.JSONQuery("visible_users").HasKey(strconv.Itoa(int(user.ID))),
|
||||
FilteredVisibility,
|
||||
datatypes.JSONQuery("invisible_users").HasKey(strconv.Itoa(int(user.ID))),
|
||||
)
|
||||
}
|
||||
|
||||
if len(invisibleList) > 0 {
|
||||
tx = tx.Where("publisher_id NOT IN ?", invisibleList)
|
||||
}
|
||||
if len(c.Query("realm")) == 0 {
|
||||
if len(realmList) > 0 {
|
||||
tx = tx.Where("realm_id IN ? OR realm_id IS NULL", realmList)
|
||||
} else {
|
||||
tx = tx.Where("realm_id IS NULL")
|
||||
}
|
||||
}
|
||||
|
||||
switch c.Query("channel") {
|
||||
case "friends":
|
||||
tx = tx.Where("publisher_id IN ?", allowlist)
|
||||
case "following":
|
||||
tx = tx.Where("publisher_id IN ?", followList)
|
||||
}
|
||||
|
||||
return tx
|
||||
}
|
||||
|
||||
func FilterPostWithRealm(tx *gorm.DB, probe string) *gorm.DB {
|
||||
if numericId, err := strconv.Atoi(probe); err == nil {
|
||||
return tx.Where("realm_id = ?", uint(numericId))
|
||||
}
|
||||
|
||||
realm, err := authkit.GetRealmByAlias(gap.Nx, probe)
|
||||
if err != nil {
|
||||
log.Warn().Msgf("Failed to find realm with alias %s: %s", probe, err)
|
||||
return tx
|
||||
}
|
||||
|
||||
return tx.Where("realm_id = ?", realm.ID)
|
||||
}
|
||||
|
||||
func FilterPostWithCategory(tx *gorm.DB, alias string) *gorm.DB {
|
||||
aliases := strings.Split(alias, ",")
|
||||
return tx.Joins("JOIN post_categories ON posts.id = post_categories.post_id").
|
||||
Joins("JOIN categories ON categories.id = post_categories.category_id").
|
||||
Where("categories.alias IN ?", strings.Split(alias, ",")).
|
||||
Distinct("posts.id")
|
||||
Where("categories.alias IN ?", aliases).
|
||||
Group("posts.id").
|
||||
Having("COUNT(DISTINCT categories.id) = ?", len(aliases))
|
||||
}
|
||||
|
||||
func FilterPostWithTag(tx *gorm.DB, alias string) *gorm.DB {
|
||||
@ -167,20 +272,50 @@ func FilterPostReply(tx *gorm.DB, replyTo ...uint) *gorm.DB {
|
||||
}
|
||||
}
|
||||
|
||||
func FilterPostWithPublishedAt(tx *gorm.DB, date time.Time) *gorm.DB {
|
||||
func FilterPostWithPublishedAt(tx *gorm.DB, date time.Time, uid ...uint) *gorm.DB {
|
||||
var publishers []models.Publisher
|
||||
if len(uid) > 0 {
|
||||
if err := database.C.Where("account_id = ?", uid[0]).Find(&publishers).Error; err == nil {
|
||||
}
|
||||
}
|
||||
|
||||
return tx.
|
||||
Where("published_at <= ? OR published_at IS NULL", date).
|
||||
Where("published_until > ? OR published_until IS NULL", date)
|
||||
Where("(published_at < ? OR published_at IS NULL)", date).
|
||||
Where("(published_until >= ? OR published_until IS NULL)", date)
|
||||
}
|
||||
|
||||
func FilterPostWithAuthorDraft(tx *gorm.DB, uid uint) *gorm.DB {
|
||||
return tx.Where("publisher_id = ? AND is_draft = ?", uid, true)
|
||||
var publishers []models.Publisher
|
||||
if err := database.C.Where("account_id = ?", uid).Find(&publishers).Error; err != nil {
|
||||
return FilterPostDraft(tx)
|
||||
}
|
||||
if len(publishers) == 0 {
|
||||
return FilterPostDraft(tx)
|
||||
}
|
||||
idSet := lo.Map(publishers, func(item models.Publisher, index int) uint {
|
||||
return item.ID
|
||||
})
|
||||
return tx.Where("publisher_id IN ? AND is_draft = ?", idSet, true)
|
||||
}
|
||||
|
||||
func FilterPostDraft(tx *gorm.DB) *gorm.DB {
|
||||
return tx.Where("is_draft = ? OR is_draft IS NULL", false)
|
||||
}
|
||||
|
||||
func FilterPostDraftWithAuthor(tx *gorm.DB, uid uint) *gorm.DB {
|
||||
var publishers []models.Publisher
|
||||
if err := database.C.Where("account_id = ?", uid).Find(&publishers).Error; err != nil {
|
||||
return FilterPostDraft(tx)
|
||||
}
|
||||
if len(publishers) == 0 {
|
||||
return FilterPostDraft(tx)
|
||||
}
|
||||
idSet := lo.Map(publishers, func(item models.Publisher, index int) uint {
|
||||
return item.ID
|
||||
})
|
||||
return tx.Where("(is_draft = ? OR is_draft IS NULL) OR publisher_id IN ?", false, idSet)
|
||||
}
|
||||
|
||||
func FilterPostWithFuzzySearch(tx *gorm.DB, probe string) *gorm.DB {
|
||||
if len(probe) == 0 {
|
||||
return tx
|
||||
@ -188,9 +323,15 @@ func FilterPostWithFuzzySearch(tx *gorm.DB, probe string) *gorm.DB {
|
||||
|
||||
probe = "%" + probe + "%"
|
||||
return tx.
|
||||
Where("? AND body->>'content' ILIKE ?", gorm.Expr("body ? 'content'"), probe).
|
||||
Or("? AND body->>'title' ILIKE ?", gorm.Expr("body ? 'title'"), probe).
|
||||
Or("? AND body->>'description' ILIKE ?", gorm.Expr("body ? 'description'"), probe)
|
||||
Where(
|
||||
"(? AND body->>'content' ILIKE ? OR ? AND body->>'title' ILIKE ? OR ? AND body->>'description' ILIKE ?)",
|
||||
gorm.Expr("body ? 'content'"),
|
||||
probe,
|
||||
gorm.Expr("body ? 'title'"),
|
||||
probe,
|
||||
gorm.Expr("body ? 'description'"),
|
||||
probe,
|
||||
)
|
||||
}
|
||||
|
||||
func PreloadGeneral(tx *gorm.DB) *gorm.DB {
|
||||
@ -198,21 +339,10 @@ func PreloadGeneral(tx *gorm.DB) *gorm.DB {
|
||||
Preload("Tags").
|
||||
Preload("Categories").
|
||||
Preload("Publisher").
|
||||
Preload("ReplyTo").
|
||||
Preload("ReplyTo.Publisher").
|
||||
Preload("ReplyTo.Tags").
|
||||
Preload("ReplyTo.Categories").
|
||||
Preload("RepostTo").
|
||||
Preload("RepostTo.Publisher").
|
||||
Preload("RepostTo.Tags").
|
||||
Preload("RepostTo.Categories")
|
||||
Preload("Poll")
|
||||
}
|
||||
|
||||
func GetPost(tx *gorm.DB, id uint, ignoreLimitation ...bool) (models.Post, error) {
|
||||
if len(ignoreLimitation) == 0 || !ignoreLimitation[0] {
|
||||
tx = FilterPostWithPublishedAt(tx, time.Now())
|
||||
}
|
||||
|
||||
func GetPost(tx *gorm.DB, id uint) (models.Post, error) {
|
||||
var item models.Post
|
||||
if err := PreloadGeneral(tx).
|
||||
Where("id = ?", id).
|
||||
@ -223,15 +353,11 @@ func GetPost(tx *gorm.DB, id uint, ignoreLimitation ...bool) (models.Post, error
|
||||
return item, nil
|
||||
}
|
||||
|
||||
func GetPostByAlias(tx *gorm.DB, alias, area string, ignoreLimitation ...bool) (models.Post, error) {
|
||||
if len(ignoreLimitation) == 0 || !ignoreLimitation[0] {
|
||||
tx = FilterPostWithPublishedAt(tx, time.Now())
|
||||
}
|
||||
|
||||
func GetPostByAlias(tx *gorm.DB, alias, area string) (models.Post, error) {
|
||||
var item models.Post
|
||||
if err := PreloadGeneral(tx).
|
||||
Where("alias = ?", alias).
|
||||
Where("area_alias = ?", area).
|
||||
Where("alias_prefix = ?", area).
|
||||
First(&item).Error; err != nil {
|
||||
return item, err
|
||||
}
|
||||
@ -270,77 +396,76 @@ func CountPostReactions(id uint) int64 {
|
||||
return count
|
||||
}
|
||||
|
||||
func ListPost(tx *gorm.DB, take int, offset int, order any, noReact ...bool) ([]*models.Post, error) {
|
||||
func ListPost(tx *gorm.DB, take int, offset int, order any, user *uint, noReact ...bool) ([]models.Post, error) {
|
||||
if take > 100 {
|
||||
take = 100
|
||||
}
|
||||
|
||||
var items []*models.Post
|
||||
if err := PreloadGeneral(tx).
|
||||
Limit(take).Offset(offset).
|
||||
Order(order).
|
||||
Find(&items).Error; err != nil {
|
||||
return items, err
|
||||
if take >= 0 {
|
||||
tx = tx.Limit(take)
|
||||
}
|
||||
if offset >= 0 {
|
||||
tx = tx.Offset(offset)
|
||||
}
|
||||
|
||||
idx := lo.Map(items, func(item *models.Post, index int) uint {
|
||||
return item.ID
|
||||
})
|
||||
tx = tx.Preload("Tags").
|
||||
Preload("Categories").
|
||||
Preload("Publisher")
|
||||
|
||||
// Load reactions
|
||||
if len(noReact) <= 0 || !noReact[0] {
|
||||
if mapping, err := BatchListPostReactions(database.C.Where("post_id IN ?", idx), "post_id"); err != nil {
|
||||
return items, err
|
||||
} else {
|
||||
itemMap := lo.SliceToMap(items, func(item *models.Post) (uint, *models.Post) {
|
||||
return item.ID, item
|
||||
})
|
||||
// Fetch posts
|
||||
var posts []models.Post
|
||||
if err := tx.Order(order).Find(&posts).Error; err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
for k, v := range mapping {
|
||||
if post, ok := itemMap[k]; ok {
|
||||
post.Metric = models.PostMetric{
|
||||
ReactionList: v,
|
||||
}
|
||||
}
|
||||
// If no posts found, return early
|
||||
if len(posts) == 0 {
|
||||
return posts, nil
|
||||
}
|
||||
|
||||
// Collect post IDs
|
||||
idx := make([]uint, len(posts))
|
||||
itemMap := make(map[uint]*models.Post, len(posts))
|
||||
for i, item := range posts {
|
||||
idx[i] = item.ID
|
||||
itemMap[item.ID] = &posts[i]
|
||||
}
|
||||
|
||||
// Batch load reactions
|
||||
if mapping, err := BatchListPostReactions(database.C.Where("post_id IN ?", idx), "post_id"); err != nil {
|
||||
return posts, err
|
||||
} else {
|
||||
for postID, reactions := range mapping {
|
||||
if post, exists := itemMap[postID]; exists {
|
||||
post.Metric.ReactionList = reactions
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Load replies
|
||||
if len(noReact) <= 0 || !noReact[0] {
|
||||
var replies []struct {
|
||||
PostID uint
|
||||
Count int64
|
||||
}
|
||||
|
||||
if err := database.C.Model(&models.Post{}).
|
||||
Select("reply_id as post_id, COUNT(id) as count").
|
||||
Where("reply_id IN (?)", idx).
|
||||
Group("post_id").
|
||||
Scan(&replies).Error; err != nil {
|
||||
return items, err
|
||||
}
|
||||
|
||||
itemMap := lo.SliceToMap(items, func(item *models.Post) (uint, *models.Post) {
|
||||
return item.ID, item
|
||||
})
|
||||
|
||||
list := map[uint]int64{}
|
||||
for _, info := range replies {
|
||||
list[info.PostID] = info.Count
|
||||
}
|
||||
|
||||
for k, v := range list {
|
||||
if post, ok := itemMap[k]; ok {
|
||||
post.Metric = models.PostMetric{
|
||||
ReactionList: post.Metric.ReactionList,
|
||||
ReplyCount: v,
|
||||
}
|
||||
}
|
||||
// Batch load reply counts efficiently
|
||||
var replies []struct {
|
||||
PostID uint
|
||||
Count int64
|
||||
}
|
||||
if err := database.C.Model(&models.Post{}).
|
||||
Select("reply_id as post_id, COUNT(id) as count").
|
||||
Where("reply_id IN (?)", idx).
|
||||
Group("post_id").
|
||||
Find(&replies).Error; err != nil {
|
||||
return posts, err
|
||||
}
|
||||
for _, info := range replies {
|
||||
if post, exists := itemMap[info.PostID]; exists {
|
||||
post.Metric.ReplyCount = info.Count
|
||||
}
|
||||
}
|
||||
|
||||
return items, nil
|
||||
// Add post views for the user
|
||||
if user != nil {
|
||||
AddPostViews(posts, *user)
|
||||
}
|
||||
|
||||
return posts, nil
|
||||
}
|
||||
|
||||
func ListPostMinimal(tx *gorm.DB, take int, offset int, order any) ([]*models.Post, error) {
|
||||
@ -376,11 +501,66 @@ func EnsurePostCategoriesAndTags(item models.Post) (models.Post, error) {
|
||||
return item, nil
|
||||
}
|
||||
|
||||
func NotifyReplying(item models.Post, user models.Publisher) error {
|
||||
content, ok := item.Body["content"].(string)
|
||||
if !ok {
|
||||
content = "Posted a post"
|
||||
} else {
|
||||
content = TruncatePostContentShort(content)
|
||||
}
|
||||
|
||||
var op models.Post
|
||||
if err := database.C.
|
||||
Where("id = ?", item.ReplyID).
|
||||
Preload("Publisher").
|
||||
First(&op).Error; err == nil {
|
||||
if op.Publisher.AccountID != nil && op.Publisher.ID != user.ID {
|
||||
log.Debug().Uint("user", *op.Publisher.AccountID).Msg("Notifying the original poster their post got replied...")
|
||||
err = NotifyPosterAccount(
|
||||
op.Publisher,
|
||||
op,
|
||||
"Post got replied",
|
||||
fmt.Sprintf("%s (%s) replied you: %s", user.Nick, user.Name, content),
|
||||
"interactive.reply",
|
||||
fmt.Sprintf("%s replied your post #%d", user.Nick, *item.ReplyID),
|
||||
)
|
||||
if err != nil {
|
||||
log.Error().Err(err).Msg("An error occurred when notifying user...")
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func NotifySubscribers(item models.Post, user models.Publisher) error {
|
||||
content, ok := item.Body["content"].(string)
|
||||
if !ok {
|
||||
content = "Posted a post"
|
||||
}
|
||||
var title *string
|
||||
title, _ = item.Body["title"].(*string)
|
||||
item.Publisher = user
|
||||
if err := NotifyUserSubscription(user, item, content, title); err != nil {
|
||||
log.Error().Err(err).Msg("An error occurred when notifying subscriptions user by user...")
|
||||
}
|
||||
for _, tag := range item.Tags {
|
||||
if err := NotifyTagSubscription(tag, user, item, content, title); err != nil {
|
||||
log.Error().Err(err).Msg("An error occurred when notifying subscriptions user by tag...")
|
||||
}
|
||||
}
|
||||
for _, category := range item.Categories {
|
||||
if err := NotifyCategorySubscription(category, user, item, content, title); err != nil {
|
||||
log.Error().Err(err).Msg("An error occurred when notifying subscriptions user by category...")
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func NewPost(user models.Publisher, item models.Post) (models.Post, error) {
|
||||
if item.Alias != nil && len(*item.Alias) == 0 {
|
||||
item.Alias = nil
|
||||
}
|
||||
if item.PublishedAt != nil && item.PublishedAt.Unix() < time.Now().Unix() {
|
||||
if item.PublishedAt != nil && item.PublishedAt.UTC().Unix() < time.Now().UTC().Unix() {
|
||||
return item, fmt.Errorf("post cannot be published before now")
|
||||
}
|
||||
|
||||
@ -411,62 +591,36 @@ func NewPost(user models.Publisher, item models.Post) (models.Post, error) {
|
||||
return item, err
|
||||
}
|
||||
|
||||
// Notify the original poster its post has been replied
|
||||
if item.ReplyID != nil {
|
||||
var op models.Post
|
||||
if err := database.C.
|
||||
Where("id = ?", item.ReplyID).
|
||||
Preload("Publisher").
|
||||
First(&op).Error; err == nil {
|
||||
if op.Publisher.AccountID != nil && op.Publisher.ID != user.ID {
|
||||
log.Debug().Uint("user", *op.Publisher.AccountID).Msg("Notifying the original poster their post got replied...")
|
||||
err = NotifyPosterAccount(
|
||||
op.Publisher,
|
||||
op,
|
||||
"Post got replied",
|
||||
fmt.Sprintf("%s (%s) replied your post (#%d).", user.Nick, user.Name, op.ID),
|
||||
"interactive.reply",
|
||||
fmt.Sprintf("%s replied you", user.Nick),
|
||||
)
|
||||
if err != nil {
|
||||
log.Error().Err(err).Msg("An error occurred when notifying user...")
|
||||
}
|
||||
}
|
||||
}
|
||||
item.Publisher = user
|
||||
err = UpdatePostAttachmentMeta(item)
|
||||
if err != nil {
|
||||
log.Error().Err(err).Msg("An error occurred when updating post attachment meta...")
|
||||
}
|
||||
|
||||
// Notify the original poster its post has been replied
|
||||
if item.ReplyID != nil && !item.IsDraft {
|
||||
go NotifyReplying(item, user)
|
||||
}
|
||||
// Notify the subscriptions
|
||||
if content, ok := item.Body["content"].(string); ok {
|
||||
var title *string
|
||||
title, _ = item.Body["title"].(*string)
|
||||
go func() {
|
||||
if err := NotifyUserSubscription(user, content, title); err != nil {
|
||||
log.Error().Err(err).Msg("An error occurred when notifying subscriptions user by user...")
|
||||
}
|
||||
for _, tag := range item.Tags {
|
||||
if err := NotifyTagSubscription(tag, user, content, title); err != nil {
|
||||
log.Error().Err(err).Msg("An error occurred when notifying subscriptions user by tag...")
|
||||
}
|
||||
}
|
||||
for _, category := range item.Categories {
|
||||
if err := NotifyCategorySubscription(category, user, content, title); err != nil {
|
||||
log.Error().Err(err).Msg("An error occurred when notifying subscriptions user by category...")
|
||||
}
|
||||
}
|
||||
}()
|
||||
if item.ReplyID == nil && !item.IsDraft {
|
||||
go NotifySubscribers(item, user)
|
||||
}
|
||||
|
||||
log.Debug().Dur("elapsed", time.Since(start)).Msg("The post is posted.")
|
||||
return item, nil
|
||||
}
|
||||
|
||||
func EditPost(item models.Post) (models.Post, error) {
|
||||
func EditPost(item models.Post, og models.Post) (models.Post, error) {
|
||||
if _, ok := item.Body["content_truncated"]; ok {
|
||||
return item, fmt.Errorf("prevented from editing post with truncated content")
|
||||
}
|
||||
|
||||
if !item.IsDraft && item.PublishedAt == nil {
|
||||
item.PublishedAt = lo.ToPtr(time.Now())
|
||||
}
|
||||
if item.Alias != nil && len(*item.Alias) == 0 {
|
||||
item.Alias = nil
|
||||
}
|
||||
if item.PublishedAt != nil && item.PublishedAt.Unix() < item.CreatedAt.Unix() {
|
||||
return item, fmt.Errorf("post cannot be published before it is created")
|
||||
}
|
||||
|
||||
if item.Alias != nil {
|
||||
re := regexp.MustCompile(`^[a-z0-9.-]+$`)
|
||||
@ -486,13 +640,168 @@ func EditPost(item models.Post) (models.Post, error) {
|
||||
return item, err
|
||||
}
|
||||
|
||||
_ = database.C.Model(&item).Association("Categories").Replace(item.Categories)
|
||||
_ = database.C.Model(&item).Association("Tags").Replace(item.Tags)
|
||||
|
||||
pub := item.Publisher
|
||||
err = database.C.Save(&item).Error
|
||||
|
||||
if err == nil {
|
||||
item.Publisher = pub
|
||||
err = UpdatePostAttachmentMeta(item)
|
||||
if err != nil {
|
||||
log.Error().Err(err).Msg("An error occurred when updating post attachment meta...")
|
||||
}
|
||||
|
||||
if og.IsDraft && !item.IsDraft {
|
||||
// Notify the original poster its post has been replied
|
||||
if item.ReplyID != nil {
|
||||
go NotifyReplying(item, item.Publisher)
|
||||
}
|
||||
// Notify the subscriptions
|
||||
if item.ReplyID == nil {
|
||||
go NotifySubscribers(item, item.Publisher)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return item, err
|
||||
}
|
||||
|
||||
func UpdatePostAttachmentMeta(item models.Post, old ...models.Post) error {
|
||||
log.Debug().Any("attachments", item.Body["attachments"]).Msg("Updating post attachments meta...")
|
||||
|
||||
// Marking usage
|
||||
sameAsOld := false
|
||||
if len(old) > 0 {
|
||||
sameAsOld = reflect.DeepEqual(old[0].Body, item.Body)
|
||||
}
|
||||
|
||||
var oldBody, newBody models.PostStoryBody
|
||||
if len(old) > 0 {
|
||||
raw, _ := json.Marshal(old[0].Body)
|
||||
json.Unmarshal(raw, &oldBody)
|
||||
}
|
||||
{
|
||||
raw, _ := json.Marshal(item.Body)
|
||||
json.Unmarshal(raw, &newBody)
|
||||
}
|
||||
var minusAttachments, plusAttachments []string
|
||||
if len(old) > 0 && !sameAsOld {
|
||||
minusAttachments = append(minusAttachments, oldBody.Attachments...)
|
||||
}
|
||||
if len(old) == 0 || !sameAsOld {
|
||||
plusAttachments = append(plusAttachments, newBody.Attachments...)
|
||||
}
|
||||
if dat, ok := item.Body["thumbnail"].(string); ok {
|
||||
plusAttachments = append(plusAttachments, dat)
|
||||
}
|
||||
if dat, ok := item.Body["video"].(string); ok {
|
||||
plusAttachments = append(plusAttachments, dat)
|
||||
}
|
||||
if len(minusAttachments) > 0 {
|
||||
filekit.CountAttachmentUsage(gap.Nx, &pproto.UpdateUsageRequest{
|
||||
Rid: minusAttachments,
|
||||
Delta: -1,
|
||||
})
|
||||
}
|
||||
if len(plusAttachments) > 0 {
|
||||
filekit.CountAttachmentUsage(gap.Nx, &pproto.UpdateUsageRequest{
|
||||
Rid: plusAttachments,
|
||||
Delta: 1,
|
||||
})
|
||||
}
|
||||
|
||||
// Updating visibility
|
||||
if item.Publisher.AccountID == nil {
|
||||
log.Warn().Msg("Post publisher did not have account id, skip updating attachments meta...")
|
||||
return nil
|
||||
}
|
||||
|
||||
if val, ok := item.Body["attachments"].([]any); ok && len(val) > 0 {
|
||||
conn, err := gap.Nx.GetClientGrpcConn("uc")
|
||||
if err != nil {
|
||||
log.Error().Err(err).Msg("An error occurred when getting grpc connection to Paperclip...")
|
||||
return nil
|
||||
}
|
||||
|
||||
pc := pproto.NewAttachmentServiceClient(conn)
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 3*time.Second)
|
||||
defer cancel()
|
||||
resp, err := pc.UpdateVisibility(ctx, &pproto.UpdateVisibilityRequest{
|
||||
Rid: lo.Map(val, func(item any, _ int) string {
|
||||
return item.(string)
|
||||
}),
|
||||
UserId: lo.ToPtr(uint64(*item.Publisher.AccountID)),
|
||||
IsIndexable: item.Visibility == models.PostVisibilityAll,
|
||||
})
|
||||
if err != nil {
|
||||
log.Error().Any("attachments", val).Err(err).Msg("An error occurred when updating post attachment visibility...")
|
||||
return err
|
||||
}
|
||||
|
||||
log.Debug().Any("attachments", val).Int32("count", resp.Count).Msg("Post attachment visibility updated.")
|
||||
} else {
|
||||
log.Debug().Any("attachments", val).Msg("Post attachment visibility update skipped...")
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func DeletePost(item models.Post) error {
|
||||
return database.C.Delete(&item).Error
|
||||
copiedItem := item
|
||||
if err := database.C.Delete(&copiedItem).Error; err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Cleaning up related attachments
|
||||
var body models.PostStoryBody
|
||||
{
|
||||
raw, _ := json.Marshal(item.Body)
|
||||
json.Unmarshal(raw, &body)
|
||||
}
|
||||
if len(body.Attachments) > 0 {
|
||||
if item.Publisher.AccountID == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
err := filekit.CountAttachmentUsage(gap.Nx, &pproto.UpdateUsageRequest{
|
||||
Rid: lo.Uniq(body.Attachments),
|
||||
})
|
||||
if err != nil {
|
||||
log.Error().Err(err).Msg("An error occurred when deleting post attachment...")
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func DeletePostInBatch(items []models.Post) error {
|
||||
if err := database.C.Delete(&items).Error; err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
var bodies []models.PostStoryBody
|
||||
{
|
||||
raw, _ := json.Marshal(items)
|
||||
json.Unmarshal(raw, &bodies)
|
||||
}
|
||||
|
||||
var attachments []string
|
||||
for idx := range items {
|
||||
if len(bodies[idx].Attachments) > 0 {
|
||||
attachments = append(attachments, bodies[idx].Attachments...)
|
||||
}
|
||||
}
|
||||
|
||||
err := filekit.CountAttachmentUsage(gap.Nx, &pproto.UpdateUsageRequest{
|
||||
Rid: lo.Uniq(attachments),
|
||||
})
|
||||
if err != nil {
|
||||
log.Error().Err(err).Msg("An error occurred when deleting post attachment...")
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func ReactPost(user authm.Account, reaction models.Reaction) (bool, models.Reaction, error) {
|
||||
@ -526,10 +835,11 @@ func ReactPost(user authm.Account, reaction models.Reaction) (bool, models.React
|
||||
|
||||
if reaction.Attitude == models.AttitudePositive {
|
||||
op.TotalUpvote++
|
||||
database.C.Model(&op).Update("total_upvote", op.TotalUpvote)
|
||||
} else {
|
||||
op.TotalDownvote++
|
||||
database.C.Model(&op).Update("total_downvote", op.TotalDownvote)
|
||||
}
|
||||
database.C.Save(&op)
|
||||
}
|
||||
|
||||
return true, reaction, err
|
||||
@ -543,10 +853,11 @@ func ReactPost(user authm.Account, reaction models.Reaction) (bool, models.React
|
||||
|
||||
if reaction.Attitude == models.AttitudePositive {
|
||||
op.TotalUpvote--
|
||||
database.C.Model(&op).Update("total_upvote", op.TotalUpvote)
|
||||
} else {
|
||||
op.TotalDownvote--
|
||||
database.C.Model(&op).Update("total_downvote", op.TotalDownvote)
|
||||
}
|
||||
database.C.Save(&op)
|
||||
}
|
||||
|
||||
return false, reaction, err
|
||||
@ -560,7 +871,7 @@ func PinPost(post models.Post) (bool, error) {
|
||||
post.PinnedAt = lo.ToPtr(time.Now())
|
||||
}
|
||||
|
||||
if err := database.C.Save(&post).Error; err != nil {
|
||||
if err := database.C.Model(&post).Update("pinned_at", post.PinnedAt).Error; err != nil {
|
||||
return post.PinnedAt != nil, err
|
||||
}
|
||||
return post.PinnedAt != nil, nil
|
||||
@ -580,6 +891,13 @@ func TruncatePostContent(post models.Post) models.Post {
|
||||
}
|
||||
}
|
||||
|
||||
if post.RepostTo != nil {
|
||||
post.RepostTo = lo.ToPtr(TruncatePostContent(*post.RepostTo))
|
||||
}
|
||||
if post.ReplyTo != nil {
|
||||
post.ReplyTo = lo.ToPtr(TruncatePostContent(*post.ReplyTo))
|
||||
}
|
||||
|
||||
return post
|
||||
}
|
||||
|
||||
|
76
pkg/internal/services/posts_getter.go
Normal file
76
pkg/internal/services/posts_getter.go
Normal file
@ -0,0 +1,76 @@
|
||||
package services
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"git.solsynth.dev/hypernet/interactive/pkg/internal/database"
|
||||
"git.solsynth.dev/hypernet/interactive/pkg/internal/models"
|
||||
authm "git.solsynth.dev/hypernet/passport/pkg/authkit/models"
|
||||
"github.com/gofiber/fiber/v2"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
type UniversalPostFilterConfig struct {
|
||||
ShowDraft bool
|
||||
ShowReply bool
|
||||
ShowCollapsed bool
|
||||
TimeCursor *time.Time
|
||||
}
|
||||
|
||||
func UniversalPostFilter(c *fiber.Ctx, tx *gorm.DB, cfg ...UniversalPostFilterConfig) (*gorm.DB, error) {
|
||||
var config UniversalPostFilterConfig
|
||||
if len(cfg) > 0 {
|
||||
config = cfg[0]
|
||||
} else {
|
||||
config = UniversalPostFilterConfig{}
|
||||
}
|
||||
|
||||
timeCursor := time.Now()
|
||||
if config.TimeCursor != nil {
|
||||
timeCursor = *config.TimeCursor
|
||||
}
|
||||
|
||||
if user, authenticated := c.Locals("user").(authm.Account); authenticated {
|
||||
tx = FilterPostWithUserContext(c, tx, &user)
|
||||
if c.QueryBool("noDraft", true) && !config.ShowDraft {
|
||||
tx = FilterPostDraft(tx)
|
||||
tx = FilterPostWithPublishedAt(tx, timeCursor)
|
||||
} else {
|
||||
tx = FilterPostDraftWithAuthor(database.C, user.ID)
|
||||
tx = FilterPostWithPublishedAt(tx, timeCursor, user.ID)
|
||||
}
|
||||
} else {
|
||||
tx = FilterPostWithUserContext(c, tx, nil)
|
||||
tx = FilterPostDraft(tx)
|
||||
tx = FilterPostWithPublishedAt(tx, timeCursor)
|
||||
}
|
||||
|
||||
if c.QueryBool("noReply", true) && !config.ShowReply {
|
||||
tx = FilterPostReply(tx)
|
||||
}
|
||||
|
||||
if len(c.Query("author")) > 0 {
|
||||
var author models.Publisher
|
||||
if err := database.C.Where("name = ?", c.Query("author")).First(&author).Error; err != nil {
|
||||
return tx, fiber.NewError(fiber.StatusNotFound, err.Error())
|
||||
}
|
||||
tx = tx.Where("publisher_id = ?", author.ID)
|
||||
}
|
||||
|
||||
if len(c.Query("categories")) > 0 {
|
||||
tx = FilterPostWithCategory(tx, c.Query("categories"))
|
||||
}
|
||||
if len(c.Query("tags")) > 0 {
|
||||
tx = FilterPostWithTag(tx, c.Query("tags"))
|
||||
}
|
||||
|
||||
if len(c.Query("type")) > 0 {
|
||||
tx = FilterPostWithType(tx, c.Query("type"))
|
||||
}
|
||||
|
||||
if len(c.Query("realm")) > 0 {
|
||||
tx = FilterPostWithRealm(tx, c.Query("realm"))
|
||||
}
|
||||
|
||||
return tx, nil
|
||||
}
|
@ -2,8 +2,12 @@ package services
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"git.solsynth.dev/hypernet/interactive/pkg/internal/database"
|
||||
"git.solsynth.dev/hypernet/interactive/pkg/internal/gap"
|
||||
"git.solsynth.dev/hypernet/interactive/pkg/internal/models"
|
||||
"git.solsynth.dev/hypernet/paperclip/pkg/filekit"
|
||||
"git.solsynth.dev/hypernet/paperclip/pkg/proto"
|
||||
authm "git.solsynth.dev/hypernet/passport/pkg/authkit/models"
|
||||
)
|
||||
|
||||
@ -33,13 +37,23 @@ func CreatePersonalPublisher(user authm.Account, name, nick, desc, avatar, banne
|
||||
Banner: banner,
|
||||
AccountID: &user.ID,
|
||||
}
|
||||
var attachments []string
|
||||
if user.Avatar != nil && len(publisher.Avatar) == 0 {
|
||||
attachments = append(attachments, *user.Avatar)
|
||||
publisher.Avatar = *user.Avatar
|
||||
}
|
||||
if user.Banner != nil && len(publisher.Banner) == 0 {
|
||||
attachments = append(attachments, *user.Banner)
|
||||
publisher.Banner = *user.Banner
|
||||
}
|
||||
|
||||
if len(attachments) > 0 {
|
||||
filekit.CountAttachmentUsage(gap.Nx, &proto.UpdateUsageRequest{
|
||||
Rid: attachments,
|
||||
Delta: 1,
|
||||
})
|
||||
}
|
||||
|
||||
if err := database.C.Create(&publisher).Error; err != nil {
|
||||
return publisher, err
|
||||
}
|
||||
@ -57,30 +71,90 @@ func CreateOrganizationPublisher(user authm.Account, realm authm.Realm, name, ni
|
||||
RealmID: &realm.ID,
|
||||
AccountID: &user.ID,
|
||||
}
|
||||
var attachments []string
|
||||
if realm.Avatar != nil && len(publisher.Avatar) == 0 {
|
||||
attachments = append(attachments, *realm.Avatar)
|
||||
publisher.Avatar = *realm.Avatar
|
||||
}
|
||||
if realm.Banner != nil && len(publisher.Banner) == 0 {
|
||||
attachments = append(attachments, *realm.Banner)
|
||||
publisher.Banner = *realm.Banner
|
||||
}
|
||||
|
||||
if len(attachments) > 0 {
|
||||
filekit.CountAttachmentUsage(gap.Nx, &proto.UpdateUsageRequest{
|
||||
Rid: attachments,
|
||||
Delta: 1,
|
||||
})
|
||||
}
|
||||
|
||||
if err := database.C.Create(&publisher).Error; err != nil {
|
||||
return publisher, err
|
||||
}
|
||||
return publisher, nil
|
||||
}
|
||||
|
||||
func EditPublisher(user authm.Account, publisher models.Publisher) (models.Publisher, error) {
|
||||
func EditPublisher(user authm.Account, publisher, og models.Publisher) (models.Publisher, error) {
|
||||
if publisher.Type == models.PublisherTypePersonal {
|
||||
if *publisher.AccountID != user.ID {
|
||||
return publisher, fmt.Errorf("you cannot transfer personal publisher")
|
||||
}
|
||||
}
|
||||
|
||||
var minusAttachments, plusAttachments []string
|
||||
if publisher.Avatar != og.Avatar {
|
||||
minusAttachments = append(minusAttachments, og.Avatar)
|
||||
plusAttachments = append(plusAttachments, publisher.Avatar)
|
||||
}
|
||||
if publisher.Banner != og.Banner {
|
||||
minusAttachments = append(minusAttachments, og.Banner)
|
||||
plusAttachments = append(plusAttachments, publisher.Banner)
|
||||
}
|
||||
if len(minusAttachments) > 0 {
|
||||
filekit.CountAttachmentUsage(gap.Nx, &proto.UpdateUsageRequest{
|
||||
Rid: minusAttachments,
|
||||
Delta: -1,
|
||||
})
|
||||
}
|
||||
if len(plusAttachments) > 0 {
|
||||
filekit.CountAttachmentUsage(gap.Nx, &proto.UpdateUsageRequest{
|
||||
Rid: plusAttachments,
|
||||
Delta: 1,
|
||||
})
|
||||
}
|
||||
|
||||
err := database.C.Save(&publisher).Error
|
||||
return publisher, err
|
||||
}
|
||||
|
||||
func DeletePublisher(publisher models.Publisher) error {
|
||||
return database.C.Delete(&publisher).Error
|
||||
tx := database.C.Begin()
|
||||
|
||||
if err := tx.Where("publisher_id = ?", publisher.ID).Delete(&models.Post{}).Error; err != nil {
|
||||
tx.Rollback()
|
||||
return err
|
||||
}
|
||||
if err := tx.Delete(&publisher).Error; err != nil {
|
||||
tx.Rollback()
|
||||
return err
|
||||
}
|
||||
|
||||
err := tx.Commit().Error
|
||||
if err == nil {
|
||||
var attachments []string
|
||||
if len(publisher.Avatar) > 0 {
|
||||
attachments = append(attachments, publisher.Avatar)
|
||||
}
|
||||
if len(publisher.Banner) > 0 {
|
||||
attachments = append(attachments, publisher.Banner)
|
||||
}
|
||||
if len(attachments) > 0 {
|
||||
filekit.CountAttachmentUsage(gap.Nx, &proto.UpdateUsageRequest{
|
||||
Rid: attachments,
|
||||
Delta: -1,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
return err
|
||||
}
|
||||
|
120
pkg/internal/services/queries/feed.go
Normal file
120
pkg/internal/services/queries/feed.go
Normal file
@ -0,0 +1,120 @@
|
||||
package queries
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"math"
|
||||
"sort"
|
||||
"time"
|
||||
|
||||
"git.solsynth.dev/hypernet/interactive/pkg/internal/database"
|
||||
"git.solsynth.dev/hypernet/interactive/pkg/internal/gap"
|
||||
"git.solsynth.dev/hypernet/interactive/pkg/internal/models"
|
||||
"git.solsynth.dev/hypernet/interactive/pkg/internal/services"
|
||||
"git.solsynth.dev/hypernet/interactive/pkg/proto"
|
||||
"git.solsynth.dev/hypernet/nexus/pkg/nex"
|
||||
"github.com/gofiber/fiber/v2"
|
||||
"github.com/rs/zerolog/log"
|
||||
"github.com/samber/lo"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
type FeedEntry struct {
|
||||
Type string `json:"type"`
|
||||
Data any `json:"data"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
}
|
||||
|
||||
func GetFeed(c *fiber.Ctx, limit int, user *uint, cursor *time.Time) ([]FeedEntry, error) {
|
||||
// We got two types of data for now
|
||||
// Plan to let each of them take 50% of the output
|
||||
|
||||
var feed []FeedEntry
|
||||
|
||||
// Planing the feed
|
||||
limitF := float64(limit)
|
||||
interCount := int(math.Ceil(limitF * 0.7))
|
||||
readerCount := int(math.Ceil(limitF * 0.3))
|
||||
|
||||
// Internal posts
|
||||
interTx, err := services.UniversalPostFilter(c, database.C)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to prepare load interactive posts: %v", err)
|
||||
}
|
||||
if cursor != nil {
|
||||
interTx = interTx.Where("published_at < ?", *cursor)
|
||||
}
|
||||
posts, err := ListPostForFeed(interTx, interCount, user, c.Get("X-API-Version", "1"))
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to load interactive posts: %v", err)
|
||||
}
|
||||
feed = append(feed, posts...)
|
||||
|
||||
sort.Slice(feed, func(i, j int) bool {
|
||||
return feed[i].CreatedAt.After(feed[j].CreatedAt)
|
||||
})
|
||||
|
||||
// News today - from Reader
|
||||
if news, err := ListReaderPagesForFeed(readerCount, cursor); err != nil {
|
||||
log.Error().Err(err).Msg("Failed to load news in getting feed...")
|
||||
} else {
|
||||
feed = append(feed, news...)
|
||||
}
|
||||
|
||||
return feed, nil
|
||||
}
|
||||
|
||||
// We assume the database context already handled the filtering and pagination
|
||||
// Only manage to pulling the content only
|
||||
|
||||
func ListPostForFeed(tx *gorm.DB, limit int, user *uint, api string) ([]FeedEntry, error) {
|
||||
var posts []models.Post
|
||||
var err error
|
||||
rankOrder := `(COALESCE(total_upvote, 0) - COALESCE(total_downvote, 0) +
|
||||
LOG(1 + COALESCE(total_aggressive_views, 0))) /
|
||||
POWER(EXTRACT(EPOCH FROM NOW() - published_at) / 3600 + 2, 1.5) DESC`
|
||||
if api == "2" {
|
||||
posts, err = ListPost(tx, limit, -1, rankOrder, user)
|
||||
} else {
|
||||
posts, err = services.ListPost(tx, limit, -1, rankOrder, user)
|
||||
}
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
entries := lo.Map(posts, func(post models.Post, _ int) FeedEntry {
|
||||
return FeedEntry{
|
||||
Type: "interactive.post",
|
||||
Data: services.TruncatePostContent(post),
|
||||
CreatedAt: post.CreatedAt,
|
||||
}
|
||||
})
|
||||
return entries, nil
|
||||
}
|
||||
|
||||
func ListReaderPagesForFeed(limit int, cursor *time.Time) ([]FeedEntry, error) {
|
||||
conn, err := gap.Nx.GetClientGrpcConn("re")
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to get grpc connection with reader: %v", err)
|
||||
}
|
||||
client := proto.NewFeedServiceClient(conn)
|
||||
request := &proto.GetFeedRequest{
|
||||
Limit: int64(limit),
|
||||
}
|
||||
if cursor != nil {
|
||||
request.Cursor = lo.ToPtr(uint64(cursor.UnixMilli()))
|
||||
}
|
||||
resp, err := client.GetFeed(context.Background(), request)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to get feed from reader: %v", err)
|
||||
}
|
||||
var createdAt time.Time
|
||||
return lo.Map(resp.Items, func(item *proto.FeedItem, _ int) FeedEntry {
|
||||
cta := time.UnixMilli(int64(item.CreatedAt))
|
||||
createdAt = lo.Ternary(createdAt.Before(cta), cta, createdAt)
|
||||
return FeedEntry{
|
||||
Type: item.Type,
|
||||
Data: nex.DecodeMap(item.Content),
|
||||
CreatedAt: cta,
|
||||
}
|
||||
}), nil
|
||||
}
|
248
pkg/internal/services/queries/posts.go
Normal file
248
pkg/internal/services/queries/posts.go
Normal file
@ -0,0 +1,248 @@
|
||||
package queries
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/goccy/go-json"
|
||||
|
||||
"git.solsynth.dev/hypernet/interactive/pkg/internal/database"
|
||||
"git.solsynth.dev/hypernet/interactive/pkg/internal/gap"
|
||||
"git.solsynth.dev/hypernet/interactive/pkg/internal/models"
|
||||
"git.solsynth.dev/hypernet/interactive/pkg/internal/services"
|
||||
"git.solsynth.dev/hypernet/paperclip/pkg/filekit"
|
||||
fmodels "git.solsynth.dev/hypernet/paperclip/pkg/filekit/models"
|
||||
"git.solsynth.dev/hypernet/passport/pkg/authkit"
|
||||
amodels "git.solsynth.dev/hypernet/passport/pkg/authkit/models"
|
||||
"github.com/rs/zerolog/log"
|
||||
"github.com/samber/lo"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
var singularAttachmentFields = []string{"video", "thumbnail"}
|
||||
|
||||
func CompletePostMeta(in ...models.Post) ([]models.Post, error) {
|
||||
// Collect post IDs
|
||||
idx := make([]uint, len(in))
|
||||
itemMap := make(map[uint]*models.Post, len(in))
|
||||
for i, item := range in {
|
||||
idx[i] = item.ID
|
||||
itemMap[item.ID] = &in[i]
|
||||
}
|
||||
|
||||
// Batch load reactions
|
||||
if mapping, err := services.BatchListPostReactions(database.C.Where("post_id IN ?", idx), "post_id"); err != nil {
|
||||
return in, err
|
||||
} else {
|
||||
for postID, reactions := range mapping {
|
||||
if post, exists := itemMap[postID]; exists {
|
||||
post.Metric.ReactionList = reactions
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Batch load reply counts efficiently
|
||||
var replies []struct {
|
||||
PostID uint
|
||||
Count int64
|
||||
}
|
||||
if err := database.C.Model(&models.Post{}).
|
||||
Select("reply_id as post_id, COUNT(id) as count").
|
||||
Where("reply_id IN (?)", idx).
|
||||
Group("post_id").
|
||||
Find(&replies).Error; err != nil {
|
||||
return in, err
|
||||
}
|
||||
for _, info := range replies {
|
||||
if post, exists := itemMap[info.PostID]; exists {
|
||||
post.Metric.ReplyCount = info.Count
|
||||
}
|
||||
}
|
||||
|
||||
// Batch load some metadata
|
||||
var err error
|
||||
var attachmentsRid []string
|
||||
var usersId []uint
|
||||
var realmsId []uint
|
||||
|
||||
// Scan records that can be load eagerly
|
||||
var bodies []models.PostStoryBody
|
||||
{
|
||||
raw, _ := json.Marshal(lo.Map(in, func(item models.Post, _ int) map[string]any {
|
||||
return item.Body
|
||||
}))
|
||||
json.Unmarshal(raw, &bodies)
|
||||
}
|
||||
for idx, info := range in {
|
||||
if info.Publisher.AccountID != nil {
|
||||
usersId = append(usersId, *info.Publisher.AccountID)
|
||||
}
|
||||
if info.RealmID != nil {
|
||||
realmsId = append(realmsId, *info.RealmID)
|
||||
}
|
||||
attachmentsRid = append(attachmentsRid, bodies[idx].Attachments...)
|
||||
for _, field := range singularAttachmentFields {
|
||||
if raw, ok := info.Body[field]; ok {
|
||||
if str, ok := raw.(string); ok && !strings.HasPrefix(str, "http") {
|
||||
attachmentsRid = append(attachmentsRid, str)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
log.Debug().Int("attachments", len(attachmentsRid)).Int("users", len(usersId)).Msg("Scanned metadata to load for listing post...")
|
||||
|
||||
// Batch load attachments
|
||||
attachmentsRid = lo.Uniq(attachmentsRid)
|
||||
var attachments []fmodels.Attachment
|
||||
if len(attachmentsRid) > 0 {
|
||||
attachments, err = filekit.ListAttachment(gap.Nx, attachmentsRid)
|
||||
if err != nil {
|
||||
return in, fmt.Errorf("failed to load attachments: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
// Batch load publisher users
|
||||
usersId = lo.Uniq(usersId)
|
||||
var users []amodels.Account
|
||||
if len(users) > 0 {
|
||||
users, err = authkit.ListUser(gap.Nx, usersId)
|
||||
if err != nil {
|
||||
return in, fmt.Errorf("failed to load users: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
// Batch load posts realm
|
||||
realmsId = lo.Uniq(realmsId)
|
||||
var realms []amodels.Realm
|
||||
if len(realmsId) > 0 {
|
||||
realms, err = authkit.ListRealm(gap.Nx, realmsId)
|
||||
if err != nil {
|
||||
return in, fmt.Errorf("failed to load realms: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
// Putting information back to data
|
||||
log.Info().Int("attachments", len(attachments)).Int("users", len(users)).Msg("Batch loaded metadata for listing post...")
|
||||
for idx, item := range in {
|
||||
var this []fmodels.Attachment
|
||||
if len(bodies[idx].Attachments) > 0 {
|
||||
this = lo.Filter(attachments, func(item fmodels.Attachment, _ int) bool {
|
||||
return lo.Contains(bodies[idx].Attachments, item.Rid)
|
||||
})
|
||||
}
|
||||
for _, field := range singularAttachmentFields {
|
||||
if raw, ok := item.Body[field]; ok {
|
||||
if str, ok := raw.(string); ok {
|
||||
result := lo.FindOrElse(this, fmodels.Attachment{}, func(item fmodels.Attachment) bool {
|
||||
return item.Rid == str
|
||||
})
|
||||
if result.ID != 0 {
|
||||
item.Body[field] = result
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
item.Body["attachments"] = this
|
||||
if item.Publisher.AccountID != nil {
|
||||
item.Publisher.Account = lo.FindOrElse(users, amodels.Account{}, func(acc amodels.Account) bool {
|
||||
return acc.ID == *item.Publisher.AccountID
|
||||
})
|
||||
}
|
||||
if item.RealmID != nil {
|
||||
item.Realm = lo.ToPtr(lo.FindOrElse(realms, amodels.Realm{}, func(realm amodels.Realm) bool {
|
||||
return realm.ID == *item.RealmID
|
||||
}))
|
||||
}
|
||||
in[idx] = item
|
||||
}
|
||||
|
||||
return in, nil
|
||||
}
|
||||
|
||||
func GetPost(tx *gorm.DB, id uint, user *uint) (models.Post, error) {
|
||||
var post models.Post
|
||||
if err := tx.Preload("Tags").
|
||||
Preload("Categories").
|
||||
Preload("Publisher").
|
||||
Preload("Poll").
|
||||
First(&post, id).Error; err != nil {
|
||||
return post, err
|
||||
}
|
||||
|
||||
out, err := CompletePostMeta(post)
|
||||
if err != nil {
|
||||
return post, err
|
||||
}
|
||||
|
||||
if user != nil {
|
||||
services.AddPostView(post, *user)
|
||||
}
|
||||
|
||||
return out[0], nil
|
||||
}
|
||||
|
||||
func GetPostByAlias(tx *gorm.DB, alias, area string, user *uint) (models.Post, error) {
|
||||
var post models.Post
|
||||
if err := tx.Preload("Tags").
|
||||
Preload("Categories").
|
||||
Preload("Publisher").
|
||||
Preload("Poll").
|
||||
Where("alias = ?", alias).
|
||||
Where("alias_prefix = ?", area).
|
||||
First(&post).Error; err != nil {
|
||||
return post, err
|
||||
}
|
||||
|
||||
out, err := CompletePostMeta(post)
|
||||
if err != nil {
|
||||
return post, err
|
||||
}
|
||||
|
||||
if user != nil {
|
||||
services.AddPostView(post, *user)
|
||||
}
|
||||
|
||||
return out[0], nil
|
||||
}
|
||||
|
||||
func ListPost(tx *gorm.DB, take int, offset int, order any, user *uint) ([]models.Post, error) {
|
||||
if take > 100 {
|
||||
take = 100
|
||||
}
|
||||
|
||||
if take >= 0 {
|
||||
tx = tx.Limit(take)
|
||||
}
|
||||
if offset >= 0 {
|
||||
tx = tx.Offset(offset)
|
||||
}
|
||||
|
||||
tx = tx.Preload("Tags").
|
||||
Preload("Categories").
|
||||
Preload("Publisher").
|
||||
Preload("Poll")
|
||||
|
||||
// Fetch posts
|
||||
var posts []models.Post
|
||||
if err := tx.Order(order).Find(&posts).Error; err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// If no posts found, return early
|
||||
if len(posts) == 0 {
|
||||
return posts, nil
|
||||
}
|
||||
|
||||
// Load data eagerly
|
||||
posts, err := CompletePostMeta(posts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// Add post views for the user
|
||||
if user != nil {
|
||||
services.AddPostViews(posts, *user)
|
||||
}
|
||||
|
||||
return posts, nil
|
||||
}
|
@ -3,12 +3,15 @@ package services
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
"git.solsynth.dev/hypernet/interactive/pkg/internal/database"
|
||||
"git.solsynth.dev/hypernet/interactive/pkg/internal/gap"
|
||||
"git.solsynth.dev/hypernet/interactive/pkg/internal/models"
|
||||
"git.solsynth.dev/hypernet/nexus/pkg/proto"
|
||||
"git.solsynth.dev/hypernet/passport/pkg/authkit"
|
||||
authm "git.solsynth.dev/hypernet/passport/pkg/authkit/models"
|
||||
"git.solsynth.dev/hypernet/pusher/pkg/pushkit"
|
||||
"github.com/samber/lo"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
@ -135,9 +138,13 @@ func UnsubscribeFromCategory(user authm.Account, target models.Category) error {
|
||||
return err
|
||||
}
|
||||
|
||||
func NotifyUserSubscription(poster models.Publisher, content string, title *string) error {
|
||||
func NotifyUserSubscription(poster models.Publisher, item models.Post, content string, title *string) error {
|
||||
if item.Visibility == models.PostVisibilityNone {
|
||||
return nil
|
||||
}
|
||||
|
||||
var subscriptions []models.Subscription
|
||||
if err := database.C.Where("account_id = ?", poster.ID).Preload("Follower").Find(&subscriptions).Error; err != nil {
|
||||
if err := database.C.Where("account_id = ?", poster.ID).Find(&subscriptions).Error; err != nil {
|
||||
return fmt.Errorf("unable to get subscriptions: %v", err)
|
||||
}
|
||||
|
||||
@ -151,7 +158,25 @@ func NotifyUserSubscription(poster models.Publisher, content string, title *stri
|
||||
|
||||
userIDs := make([]uint64, 0, len(subscriptions))
|
||||
for _, subscription := range subscriptions {
|
||||
userIDs = append(userIDs, uint64(subscription.Follower.ID))
|
||||
userIDs = append(userIDs, uint64(subscription.FollowerID))
|
||||
}
|
||||
|
||||
if item.Visibility == models.PostVisibilitySelected {
|
||||
userIDs = lo.Filter(userIDs, func(entry uint64, index int) bool {
|
||||
return lo.Contains(item.VisibleUsers, uint(entry))
|
||||
})
|
||||
} else if item.Visibility == models.PostVisibilityFiltered {
|
||||
userIDs = lo.Filter(userIDs, func(entry uint64, index int) bool {
|
||||
return !lo.Contains(item.InvisibleUsers, uint(entry))
|
||||
})
|
||||
} else if invisibleList := ListPostInvisibleUser(poster, item.Visibility); len(invisibleList) > 0 {
|
||||
userIDs = lo.Filter(userIDs, func(entry uint64, index int) bool {
|
||||
return !lo.Contains(invisibleList, uint(entry))
|
||||
})
|
||||
}
|
||||
|
||||
metadata := map[string]any{
|
||||
"related_post": TruncatePostContent(item),
|
||||
}
|
||||
|
||||
err := authkit.NotifyUserBatch(gap.Nx, userIDs, pushkit.Notification{
|
||||
@ -159,15 +184,20 @@ func NotifyUserSubscription(poster models.Publisher, content string, title *stri
|
||||
Title: nTitle,
|
||||
Subtitle: nSubtitle,
|
||||
Body: body,
|
||||
Metadata: metadata,
|
||||
Priority: 3,
|
||||
})
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
func NotifyTagSubscription(poster models.Tag, og models.Publisher, content string, title *string) error {
|
||||
func NotifyTagSubscription(poster models.Tag, og models.Publisher, item models.Post, content string, title *string) error {
|
||||
if item.Visibility == models.PostVisibilityNone {
|
||||
return nil
|
||||
}
|
||||
|
||||
var subscriptions []models.Subscription
|
||||
if err := database.C.Where("tag_id = ?", poster.ID).Preload("Follower").Find(&subscriptions).Error; err != nil {
|
||||
if err := database.C.Where("tag_id = ?", poster.ID).Find(&subscriptions).Error; err != nil {
|
||||
return fmt.Errorf("unable to get subscriptions: %v", err)
|
||||
}
|
||||
|
||||
@ -181,7 +211,21 @@ func NotifyTagSubscription(poster models.Tag, og models.Publisher, content strin
|
||||
|
||||
userIDs := make([]uint64, 0, len(subscriptions))
|
||||
for _, subscription := range subscriptions {
|
||||
userIDs = append(userIDs, uint64(subscription.Follower.ID))
|
||||
userIDs = append(userIDs, uint64(subscription.FollowerID))
|
||||
}
|
||||
|
||||
if item.Visibility == models.PostVisibilitySelected {
|
||||
userIDs = lo.Filter(userIDs, func(entry uint64, index int) bool {
|
||||
return lo.Contains(item.VisibleUsers, uint(entry))
|
||||
})
|
||||
} else if item.Visibility == models.PostVisibilityFiltered {
|
||||
userIDs = lo.Filter(userIDs, func(entry uint64, index int) bool {
|
||||
return !lo.Contains(item.InvisibleUsers, uint(entry))
|
||||
})
|
||||
} else if invisibleList := ListPostInvisibleUser(item.Publisher, item.Visibility); len(invisibleList) > 0 {
|
||||
userIDs = lo.Filter(userIDs, func(entry uint64, index int) bool {
|
||||
return !lo.Contains(invisibleList, uint(entry))
|
||||
})
|
||||
}
|
||||
|
||||
err := authkit.NotifyUserBatch(gap.Nx, userIDs, pushkit.Notification{
|
||||
@ -195,9 +239,13 @@ func NotifyTagSubscription(poster models.Tag, og models.Publisher, content strin
|
||||
return err
|
||||
}
|
||||
|
||||
func NotifyCategorySubscription(poster models.Category, og models.Publisher, content string, title *string) error {
|
||||
func NotifyCategorySubscription(poster models.Category, og models.Publisher, item models.Post, content string, title *string) error {
|
||||
if item.Visibility == models.PostVisibilityNone {
|
||||
return nil
|
||||
}
|
||||
|
||||
var subscriptions []models.Subscription
|
||||
if err := database.C.Where("category_id = ?", poster.ID).Preload("Follower").Find(&subscriptions).Error; err != nil {
|
||||
if err := database.C.Where("category_id = ?", poster.ID).Find(&subscriptions).Error; err != nil {
|
||||
return fmt.Errorf("unable to get subscriptions: %v", err)
|
||||
}
|
||||
|
||||
@ -211,7 +259,21 @@ func NotifyCategorySubscription(poster models.Category, og models.Publisher, con
|
||||
|
||||
userIDs := make([]uint64, 0, len(subscriptions))
|
||||
for _, subscription := range subscriptions {
|
||||
userIDs = append(userIDs, uint64(subscription.Follower.ID))
|
||||
userIDs = append(userIDs, uint64(subscription.FollowerID))
|
||||
}
|
||||
|
||||
if item.Visibility == models.PostVisibilitySelected {
|
||||
userIDs = lo.Filter(userIDs, func(entry uint64, index int) bool {
|
||||
return lo.Contains(item.VisibleUsers, uint(entry))
|
||||
})
|
||||
} else if item.Visibility == models.PostVisibilityFiltered {
|
||||
userIDs = lo.Filter(userIDs, func(entry uint64, index int) bool {
|
||||
return !lo.Contains(item.InvisibleUsers, uint(entry))
|
||||
})
|
||||
} else if invisibleList := ListPostInvisibleUser(item.Publisher, item.Visibility); len(invisibleList) > 0 {
|
||||
userIDs = lo.Filter(userIDs, func(entry uint64, index int) bool {
|
||||
return !lo.Contains(invisibleList, uint(entry))
|
||||
})
|
||||
}
|
||||
|
||||
err := authkit.NotifyUserBatch(gap.Nx, userIDs, pushkit.Notification{
|
||||
@ -224,3 +286,23 @@ func NotifyCategorySubscription(poster models.Category, og models.Publisher, con
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
// ListPostInvisibleUser will return a list of users which should not be notified the post.
|
||||
// NOTICE If the visibility is PostVisibilitySelected, PostVisibilityFiltered or PostVisibilityNone, you need do extra steps to filter users
|
||||
// WARNING This function won't use cache, be careful of the queries
|
||||
func ListPostInvisibleUser(og models.Publisher, visibility models.PostVisibilityLevel) []uint {
|
||||
switch visibility {
|
||||
case models.PostVisibilityAll:
|
||||
return []uint{}
|
||||
case models.PostVisibilityFriends:
|
||||
if og.AccountID == nil {
|
||||
return []uint{}
|
||||
}
|
||||
userFriends, _ := authkit.ListRelative(gap.Nx, *og.AccountID, int32(authm.RelationshipFriend), true)
|
||||
return lo.Map(userFriends, func(item *proto.UserInfo, index int) uint {
|
||||
return uint(item.GetId())
|
||||
})
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
17
pkg/main.go
17
pkg/main.go
@ -2,15 +2,15 @@ package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
pkg "git.solsynth.dev/hypernet/interactive/pkg/internal"
|
||||
"git.solsynth.dev/hypernet/interactive/pkg/internal/cache"
|
||||
"git.solsynth.dev/hypernet/interactive/pkg/internal/gap"
|
||||
"git.solsynth.dev/hypernet/nexus/pkg/nex/sec"
|
||||
"github.com/fatih/color"
|
||||
"os"
|
||||
"os/signal"
|
||||
"syscall"
|
||||
|
||||
pkg "git.solsynth.dev/hypernet/interactive/pkg/internal"
|
||||
"git.solsynth.dev/hypernet/interactive/pkg/internal/gap"
|
||||
"git.solsynth.dev/hypernet/nexus/pkg/nex/sec"
|
||||
"github.com/fatih/color"
|
||||
|
||||
"git.solsynth.dev/hypernet/interactive/pkg/internal/database"
|
||||
"git.solsynth.dev/hypernet/interactive/pkg/internal/grpc"
|
||||
"git.solsynth.dev/hypernet/interactive/pkg/internal/http"
|
||||
@ -66,14 +66,9 @@ func main() {
|
||||
|
||||
// Configure timed tasks
|
||||
quartz := cron.New(cron.WithLogger(cron.VerbosePrintfLogger(&log.Logger)))
|
||||
quartz.AddFunc("@every 60m", services.DoAutoDatabaseCleanup)
|
||||
quartz.AddFunc("@every 5m", services.FlushPostViews)
|
||||
quartz.Start()
|
||||
|
||||
// Initialize cache
|
||||
if err := cache.NewStore(); err != nil {
|
||||
log.Fatal().Err(err).Msg("An error occurred when initializing cache.")
|
||||
}
|
||||
|
||||
// App
|
||||
go http.NewServer().Listen()
|
||||
|
||||
|
271
pkg/proto/feed.pb.go
Normal file
271
pkg/proto/feed.pb.go
Normal file
@ -0,0 +1,271 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.35.1
|
||||
// protoc v5.28.3
|
||||
// source: feed.proto
|
||||
|
||||
package proto
|
||||
|
||||
import (
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
)
|
||||
|
||||
const (
|
||||
// Verify that this generated code is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
||||
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||
)
|
||||
|
||||
type FeedItem struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"`
|
||||
CreatedAt uint64 `protobuf:"varint,2,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"`
|
||||
Content []byte `protobuf:"bytes,3,opt,name=content,proto3" json:"content,omitempty"`
|
||||
}
|
||||
|
||||
func (x *FeedItem) Reset() {
|
||||
*x = FeedItem{}
|
||||
mi := &file_feed_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *FeedItem) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*FeedItem) ProtoMessage() {}
|
||||
|
||||
func (x *FeedItem) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_feed_proto_msgTypes[0]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use FeedItem.ProtoReflect.Descriptor instead.
|
||||
func (*FeedItem) Descriptor() ([]byte, []int) {
|
||||
return file_feed_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *FeedItem) GetType() string {
|
||||
if x != nil {
|
||||
return x.Type
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *FeedItem) GetCreatedAt() uint64 {
|
||||
if x != nil {
|
||||
return x.CreatedAt
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *FeedItem) GetContent() []byte {
|
||||
if x != nil {
|
||||
return x.Content
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type GetFeedRequest struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Limit int64 `protobuf:"varint,1,opt,name=limit,proto3" json:"limit,omitempty"`
|
||||
UserId uint64 `protobuf:"varint,2,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"`
|
||||
Cursor *uint64 `protobuf:"varint,3,opt,name=cursor,proto3,oneof" json:"cursor,omitempty"`
|
||||
}
|
||||
|
||||
func (x *GetFeedRequest) Reset() {
|
||||
*x = GetFeedRequest{}
|
||||
mi := &file_feed_proto_msgTypes[1]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *GetFeedRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*GetFeedRequest) ProtoMessage() {}
|
||||
|
||||
func (x *GetFeedRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_feed_proto_msgTypes[1]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use GetFeedRequest.ProtoReflect.Descriptor instead.
|
||||
func (*GetFeedRequest) Descriptor() ([]byte, []int) {
|
||||
return file_feed_proto_rawDescGZIP(), []int{1}
|
||||
}
|
||||
|
||||
func (x *GetFeedRequest) GetLimit() int64 {
|
||||
if x != nil {
|
||||
return x.Limit
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *GetFeedRequest) GetUserId() uint64 {
|
||||
if x != nil {
|
||||
return x.UserId
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *GetFeedRequest) GetCursor() uint64 {
|
||||
if x != nil && x.Cursor != nil {
|
||||
return *x.Cursor
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type GetFeedResponse struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Items []*FeedItem `protobuf:"bytes,1,rep,name=items,proto3" json:"items,omitempty"`
|
||||
}
|
||||
|
||||
func (x *GetFeedResponse) Reset() {
|
||||
*x = GetFeedResponse{}
|
||||
mi := &file_feed_proto_msgTypes[2]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *GetFeedResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*GetFeedResponse) ProtoMessage() {}
|
||||
|
||||
func (x *GetFeedResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_feed_proto_msgTypes[2]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use GetFeedResponse.ProtoReflect.Descriptor instead.
|
||||
func (*GetFeedResponse) Descriptor() ([]byte, []int) {
|
||||
return file_feed_proto_rawDescGZIP(), []int{2}
|
||||
}
|
||||
|
||||
func (x *GetFeedResponse) GetItems() []*FeedItem {
|
||||
if x != nil {
|
||||
return x.Items
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
var File_feed_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_feed_proto_rawDesc = []byte{
|
||||
0x0a, 0x0a, 0x66, 0x65, 0x65, 0x64, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x05, 0x70, 0x72,
|
||||
0x6f, 0x74, 0x6f, 0x22, 0x57, 0x0a, 0x08, 0x46, 0x65, 0x65, 0x64, 0x49, 0x74, 0x65, 0x6d, 0x12,
|
||||
0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74,
|
||||
0x79, 0x70, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61,
|
||||
0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64,
|
||||
0x41, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x03, 0x20,
|
||||
0x01, 0x28, 0x0c, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x22, 0x67, 0x0a, 0x0e,
|
||||
0x47, 0x65, 0x74, 0x46, 0x65, 0x65, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14,
|
||||
0x0a, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x6c,
|
||||
0x69, 0x6d, 0x69, 0x74, 0x12, 0x17, 0x0a, 0x07, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18,
|
||||
0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x1b, 0x0a,
|
||||
0x06, 0x63, 0x75, 0x72, 0x73, 0x6f, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x48, 0x00, 0x52,
|
||||
0x06, 0x63, 0x75, 0x72, 0x73, 0x6f, 0x72, 0x88, 0x01, 0x01, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63,
|
||||
0x75, 0x72, 0x73, 0x6f, 0x72, 0x22, 0x38, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x46, 0x65, 0x65, 0x64,
|
||||
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x25, 0x0a, 0x05, 0x69, 0x74, 0x65, 0x6d,
|
||||
0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e,
|
||||
0x46, 0x65, 0x65, 0x64, 0x49, 0x74, 0x65, 0x6d, 0x52, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x32,
|
||||
0x47, 0x0a, 0x0b, 0x46, 0x65, 0x65, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x38,
|
||||
0x0a, 0x07, 0x47, 0x65, 0x74, 0x46, 0x65, 0x65, 0x64, 0x12, 0x15, 0x2e, 0x70, 0x72, 0x6f, 0x74,
|
||||
0x6f, 0x2e, 0x47, 0x65, 0x74, 0x46, 0x65, 0x65, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
|
||||
0x1a, 0x16, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x47, 0x65, 0x74, 0x46, 0x65, 0x65, 0x64,
|
||||
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x09, 0x5a, 0x07, 0x2e, 0x3b, 0x70, 0x72,
|
||||
0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
file_feed_proto_rawDescOnce sync.Once
|
||||
file_feed_proto_rawDescData = file_feed_proto_rawDesc
|
||||
)
|
||||
|
||||
func file_feed_proto_rawDescGZIP() []byte {
|
||||
file_feed_proto_rawDescOnce.Do(func() {
|
||||
file_feed_proto_rawDescData = protoimpl.X.CompressGZIP(file_feed_proto_rawDescData)
|
||||
})
|
||||
return file_feed_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_feed_proto_msgTypes = make([]protoimpl.MessageInfo, 3)
|
||||
var file_feed_proto_goTypes = []any{
|
||||
(*FeedItem)(nil), // 0: proto.FeedItem
|
||||
(*GetFeedRequest)(nil), // 1: proto.GetFeedRequest
|
||||
(*GetFeedResponse)(nil), // 2: proto.GetFeedResponse
|
||||
}
|
||||
var file_feed_proto_depIdxs = []int32{
|
||||
0, // 0: proto.GetFeedResponse.items:type_name -> proto.FeedItem
|
||||
1, // 1: proto.FeedService.GetFeed:input_type -> proto.GetFeedRequest
|
||||
2, // 2: proto.FeedService.GetFeed:output_type -> proto.GetFeedResponse
|
||||
2, // [2:3] is the sub-list for method output_type
|
||||
1, // [1:2] is the sub-list for method input_type
|
||||
1, // [1:1] is the sub-list for extension type_name
|
||||
1, // [1:1] is the sub-list for extension extendee
|
||||
0, // [0:1] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_feed_proto_init() }
|
||||
func file_feed_proto_init() {
|
||||
if File_feed_proto != nil {
|
||||
return
|
||||
}
|
||||
file_feed_proto_msgTypes[1].OneofWrappers = []any{}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_feed_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 3,
|
||||
NumExtensions: 0,
|
||||
NumServices: 1,
|
||||
},
|
||||
GoTypes: file_feed_proto_goTypes,
|
||||
DependencyIndexes: file_feed_proto_depIdxs,
|
||||
MessageInfos: file_feed_proto_msgTypes,
|
||||
}.Build()
|
||||
File_feed_proto = out.File
|
||||
file_feed_proto_rawDesc = nil
|
||||
file_feed_proto_goTypes = nil
|
||||
file_feed_proto_depIdxs = nil
|
||||
}
|
25
pkg/proto/feed.proto
Normal file
25
pkg/proto/feed.proto
Normal file
@ -0,0 +1,25 @@
|
||||
syntax = "proto3";
|
||||
|
||||
option go_package = ".;proto";
|
||||
|
||||
package proto;
|
||||
|
||||
service FeedService {
|
||||
rpc GetFeed(GetFeedRequest) returns (GetFeedResponse);
|
||||
}
|
||||
|
||||
message FeedItem {
|
||||
string type = 1;
|
||||
uint64 created_at = 2;
|
||||
bytes content = 3;
|
||||
}
|
||||
|
||||
message GetFeedRequest {
|
||||
int64 limit = 1;
|
||||
uint64 user_id = 2;
|
||||
optional uint64 cursor = 3;
|
||||
}
|
||||
|
||||
message GetFeedResponse {
|
||||
repeated FeedItem items = 1;
|
||||
}
|
121
pkg/proto/feed_grpc.pb.go
Normal file
121
pkg/proto/feed_grpc.pb.go
Normal file
@ -0,0 +1,121 @@
|
||||
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
||||
// versions:
|
||||
// - protoc-gen-go-grpc v1.5.1
|
||||
// - protoc v5.28.3
|
||||
// source: feed.proto
|
||||
|
||||
package proto
|
||||
|
||||
import (
|
||||
context "context"
|
||||
grpc "google.golang.org/grpc"
|
||||
codes "google.golang.org/grpc/codes"
|
||||
status "google.golang.org/grpc/status"
|
||||
)
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the grpc package it is being compiled against.
|
||||
// Requires gRPC-Go v1.64.0 or later.
|
||||
const _ = grpc.SupportPackageIsVersion9
|
||||
|
||||
const (
|
||||
FeedService_GetFeed_FullMethodName = "/proto.FeedService/GetFeed"
|
||||
)
|
||||
|
||||
// FeedServiceClient is the client API for FeedService service.
|
||||
//
|
||||
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
|
||||
type FeedServiceClient interface {
|
||||
GetFeed(ctx context.Context, in *GetFeedRequest, opts ...grpc.CallOption) (*GetFeedResponse, error)
|
||||
}
|
||||
|
||||
type feedServiceClient struct {
|
||||
cc grpc.ClientConnInterface
|
||||
}
|
||||
|
||||
func NewFeedServiceClient(cc grpc.ClientConnInterface) FeedServiceClient {
|
||||
return &feedServiceClient{cc}
|
||||
}
|
||||
|
||||
func (c *feedServiceClient) GetFeed(ctx context.Context, in *GetFeedRequest, opts ...grpc.CallOption) (*GetFeedResponse, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(GetFeedResponse)
|
||||
err := c.cc.Invoke(ctx, FeedService_GetFeed_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// FeedServiceServer is the server API for FeedService service.
|
||||
// All implementations must embed UnimplementedFeedServiceServer
|
||||
// for forward compatibility.
|
||||
type FeedServiceServer interface {
|
||||
GetFeed(context.Context, *GetFeedRequest) (*GetFeedResponse, error)
|
||||
mustEmbedUnimplementedFeedServiceServer()
|
||||
}
|
||||
|
||||
// UnimplementedFeedServiceServer must be embedded to have
|
||||
// forward compatible implementations.
|
||||
//
|
||||
// NOTE: this should be embedded by value instead of pointer to avoid a nil
|
||||
// pointer dereference when methods are called.
|
||||
type UnimplementedFeedServiceServer struct{}
|
||||
|
||||
func (UnimplementedFeedServiceServer) GetFeed(context.Context, *GetFeedRequest) (*GetFeedResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetFeed not implemented")
|
||||
}
|
||||
func (UnimplementedFeedServiceServer) mustEmbedUnimplementedFeedServiceServer() {}
|
||||
func (UnimplementedFeedServiceServer) testEmbeddedByValue() {}
|
||||
|
||||
// UnsafeFeedServiceServer may be embedded to opt out of forward compatibility for this service.
|
||||
// Use of this interface is not recommended, as added methods to FeedServiceServer will
|
||||
// result in compilation errors.
|
||||
type UnsafeFeedServiceServer interface {
|
||||
mustEmbedUnimplementedFeedServiceServer()
|
||||
}
|
||||
|
||||
func RegisterFeedServiceServer(s grpc.ServiceRegistrar, srv FeedServiceServer) {
|
||||
// If the following call pancis, it indicates UnimplementedFeedServiceServer was
|
||||
// embedded by pointer and is nil. This will cause panics if an
|
||||
// unimplemented method is ever invoked, so we test this at initialization
|
||||
// time to prevent it from happening at runtime later due to I/O.
|
||||
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
|
||||
t.testEmbeddedByValue()
|
||||
}
|
||||
s.RegisterService(&FeedService_ServiceDesc, srv)
|
||||
}
|
||||
|
||||
func _FeedService_GetFeed_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(GetFeedRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(FeedServiceServer).GetFeed(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: FeedService_GetFeed_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(FeedServiceServer).GetFeed(ctx, req.(*GetFeedRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
// FeedService_ServiceDesc is the grpc.ServiceDesc for FeedService service.
|
||||
// It's only intended for direct use with grpc.RegisterService,
|
||||
// and not to be introspected or modified (even as a copy)
|
||||
var FeedService_ServiceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "proto.FeedService",
|
||||
HandlerType: (*FeedServiceServer)(nil),
|
||||
Methods: []grpc.MethodDesc{
|
||||
{
|
||||
MethodName: "GetFeed",
|
||||
Handler: _FeedService_GetFeed_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "feed.proto",
|
||||
}
|
@ -5,9 +5,17 @@ grpc_bind = "0.0.0.0:7005"
|
||||
|
||||
nexus_addr = "localhost:7001"
|
||||
|
||||
activitypub_base_url = "https://api.sn.solsynth.dev/cgi/co/activitypub"
|
||||
|
||||
[debug]
|
||||
database = true
|
||||
print_routes = false
|
||||
|
||||
[security]
|
||||
internal_public_key = "keys/internal_public_key.pem"
|
||||
|
||||
#[[fediverse.friends]]
|
||||
#id = "mastodon-social"
|
||||
#url = "https://mastodon.social"
|
||||
#type = "mastodon"
|
||||
#batch_size = 50
|
||||
|
Reference in New Issue
Block a user