Skip to content

Commit a8645d1

Browse files
authored
Merge pull request #2598 from traPtitech/feat/qall-v2-with-roomstate
feat: livekitでのqallの実装の取り込み
2 parents 3750a22 + 0203e3a commit a8645d1

33 files changed

+3002
-28
lines changed

cmd/config.go

+26
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"time"
77

88
"cloud.google.com/go/profiler"
9+
"github.com/leandro-lugaresi/hub"
910
"github.com/spf13/viper"
1011
"go.uber.org/zap"
1112
"google.golang.org/api/option"
@@ -23,6 +24,7 @@ import (
2324
"github.com/traPtitech/traQ/service/imaging"
2425
"github.com/traPtitech/traQ/service/message"
2526
"github.com/traPtitech/traQ/service/oidc"
27+
"github.com/traPtitech/traQ/service/qall"
2628
"github.com/traPtitech/traQ/service/rbac"
2729
"github.com/traPtitech/traQ/service/search"
2830
"github.com/traPtitech/traQ/service/variable"
@@ -209,6 +211,16 @@ type Config struct {
209211
SecretKey string `mapstructure:"secretKey" yaml:"secretKey"`
210212
} `mapstructure:"skyway" yaml:"skyway"`
211213

214+
// LiveKit LiveKit設定
215+
LiveKit struct {
216+
// Host ホスト名
217+
Host string `mapstructure:"host" yaml:"host"`
218+
// APIKey APIキー
219+
APIKey string `mapstructure:"apiKey" yaml:"apiKey"`
220+
// APISecret APIシークレット
221+
APISecret string `mapstructure:"apiSecret" yaml:"apiSecret"`
222+
} `mapstructure:"livekit" yaml:"livekit"`
223+
212224
// JWT JsonWebToken設定
213225
JWT struct {
214226
// Keys 鍵設定
@@ -326,6 +338,9 @@ func init() {
326338
viper.SetDefault("externalAuth.slack.allowSignUp", false)
327339
viper.SetDefault("externalAuth.slack.allowedTeamId", "")
328340
viper.SetDefault("skyway.secretKey", "")
341+
viper.SetDefault("livekit.host", "")
342+
viper.SetDefault("livekit.apiKey", "")
343+
viper.SetDefault("livekit.apiSecret", "")
329344
viper.SetDefault("jwt.keys.private", "")
330345
}
331346

@@ -549,6 +564,17 @@ func provideRouterConfig(c *Config) *router.Config {
549564
AccessTokenExp: c.OAuth2.AccessTokenExpire,
550565
IsRefreshEnabled: c.OAuth2.IsRefreshEnabled,
551566
SkyWaySecretKey: c.SkyWay.SecretKey,
567+
LiveKitHost: c.LiveKit.Host,
568+
LiveKitAPIKey: c.LiveKit.APIKey,
569+
LiveKitAPISecret: c.LiveKit.APISecret,
552570
ExternalAuth: provideRouterExternalAuthConfig(c),
553571
}
554572
}
573+
574+
func provideQallRoomStateManager(c *Config, h *hub.Hub) qall.RoomStateManager {
575+
return qall.NewRoomStateManager(c.LiveKit.Host, c.LiveKit.APIKey, c.LiveKit.APISecret, h)
576+
}
577+
578+
func provideQallSoundboard(repo repository.Repository, fs storage.FileStorage, logger *zap.Logger, h *hub.Hub) (qall.Soundboard, error) {
579+
return qall.NewSoundboardManager(repo, fs, logger, h)
580+
}

cmd/serve_wire.go

+2
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ func newServer(hub *hub.Hub, db *gorm.DB, repo repository.Repository, fs storage
5757
provideOIDCService,
5858
provideRouterConfig,
5959
provideESEngineConfig,
60+
provideQallRoomStateManager,
61+
provideQallSoundboard,
6062
wire.Struct(new(service.Services), "*"),
6163
wire.Struct(new(Server), "*"),
6264
wire.Bind(new(repository.ChannelRepository), new(repository.Repository)),

cmd/wire_gen.go

+8-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/deployment.md

+20-4
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Here are some tips for configuring traQ:
2424
- If you want a private instance, set `allowSignUp` to `false`.
2525
- You can use `externalAuth.github.allowedOrganizations` to only allow signup of your GitHub organization members.
2626
- Otherwise, an admin or external app has to manually set accounts up via `POST /api/v3/users`.
27-
- For the maximum user experience, try to configure Elasticsearch, FCM, and Skyway to enable message search, notification, and Qall features, respectively.
27+
- For the maximum user experience, try to configure Elasticsearch, FCM, and livekit to enable message search, notification, and Qall features, respectively.
2828

2929
The following are example configurations.
3030

@@ -153,12 +153,22 @@ oauth2:
153153
# Access token expiration time in seconds. Default: 31536000 (1 year)
154154
accessTokenExp: 31536000 # 1 year
155155

156-
# Skyway settings.
156+
# (deprecated) Skyway settings.
157157
# You must set this to enable the call ('Qall') feature.
158158
skyway:
159159
# Skyway secret key.
160160
secretKey: secretKey
161161

162+
# LiveKit settings.
163+
# You must set these to enable the call ('Qall') feature.
164+
livekit:
165+
# LiveKit host url
166+
livekitHost: livekitHost
167+
# LiveKit api key
168+
livekitAPIKey: livekitAPIKey
169+
# LiveKit api secret
170+
livekitAPISecret: livekitAPISecret
171+
162172
# (optional) JWT settings.
163173
# Used to issue QR codes to authenticate user.
164174
jwt:
@@ -203,7 +213,7 @@ externalAuth:
203213
204214
</details>
205215
206-
Minimal configuration (with ES, no FCM, and no Skyway)
216+
Minimal configuration (with ES, no FCM, and no Livekit)
207217
208218
```yaml
209219
origin: https://example.com
@@ -251,10 +261,16 @@ traQ uses `config.js` for configuring the frontend application.
251261
projectId: 'projectId',
252262
messagingSenderId: 'messagingSenderId'
253263
},
254-
// (optional) Skyway settings.
264+
// (deprecated) Skyway settings.
255265
skyway: {
256266
apiKey: 'apiKey'
257267
},
268+
// (optional) Livekit settings.
269+
livekit: {
270+
livekitHost: 'livekitHost',
271+
livekitApiKey: 'livekitApiKey',
272+
livekitAPISecret: 'livekitAPISecret'
273+
},
258274
// (optional) Enable search feature.
259275
enableSearch: true,
260276
// (optional) Application links.

0 commit comments

Comments
 (0)