Skip to content

Commit ef8bcfb

Browse files
Merge branch 'main' into global_config
2 parents 363b32f + d6c5ba5 commit ef8bcfb

File tree

21 files changed

+827
-153
lines changed

21 files changed

+827
-153
lines changed

.github/workflows/linting.yml

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,20 @@ on:
1010
- main
1111

1212
jobs:
13-
golangci:
14-
name: lint
13+
linting:
1514
runs-on: ubuntu-latest
15+
1616
steps:
17-
- uses: actions/checkout@v4
18-
- uses: actions/setup-go@v5
19-
with:
20-
go-version: '1.22.5'
21-
cache: false
22-
- name: golangci-lint
23-
uses: golangci/golangci-lint-action@v6
17+
- name: Install Go
18+
uses: actions/setup-go@v5
2419
with:
25-
version: v1.63.4
20+
go-version: "1.23.3"
21+
22+
- name: Checkout code
23+
uses: actions/checkout@v4
24+
25+
- name: Installing golangci-lint
26+
run: go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.63.4
27+
28+
- name: Formatting and linting the project
29+
run: make check

.github/workflows/unit-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
- name: Install Go
2121
uses: actions/setup-go@v5
2222
with:
23-
go-version: '1.22.5'
23+
go-version: '1.23.3'
2424

2525
- name: Unit tests
2626
run: make unit-test

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
build
2-
.vscode
2+
.vscode
3+
.idea/
File renamed without changes.

SECURITY.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Security Policy
2+
3+
This is a full guide for reporting and behaving with security vulnerabilities in this project.
4+
5+
## Reporting a Vulnerability
6+
7+
If you find any security vulnerability in this project, you can send a full report to [security@dezh.tech](mailto:security@dezh.tech). We will review your report in around 1 week or more and respond to you.
8+
We MAY consider paying a bounty reward to you using only Bitcoin (On-chain, Lightning, Cashu) depending on the vulnerability security level. By publishing any public writeup or report before a response from us you will not receive any bounty reward.
9+
After our response to the vulnerability report, you/we can publish a public writeup or report about the vulnerability.

cmd/relay/relay.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111
"github.com/dezh-tech/immortal/delivery/websocket"
1212
"github.com/dezh-tech/immortal/infrastructure/database"
1313
grpcclient "github.com/dezh-tech/immortal/infrastructure/grpc_client"
14+
"github.com/dezh-tech/immortal/infrastructure/meilisearch"
1415
"github.com/dezh-tech/immortal/infrastructure/metrics"
1516
"github.com/dezh-tech/immortal/infrastructure/redis"
1617
"github.com/dezh-tech/immortal/pkg/logger"
@@ -32,10 +33,11 @@ func New(cfg *config.Config) (*Relay, error) {
3233
if err != nil {
3334
return nil, err
3435
}
35-
3636
m := metrics.New()
3737

38-
r, err := redis.New(cfg.RedisConf)
38+
meili := meilisearch.New(cfg.Meili)
39+
40+
r, err := redis.New(cfg.Redis)
3941
if err != nil {
4042
return nil, err
4143
}

config/config.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"github.com/dezh-tech/immortal/delivery/websocket/configs"
66
"github.com/dezh-tech/immortal/infrastructure/database"
77
grpcclient "github.com/dezh-tech/immortal/infrastructure/grpc_client"
8+
"github.com/dezh-tech/immortal/infrastructure/meilisearch"
89
"github.com/dezh-tech/immortal/infrastructure/redis"
910
"github.com/dezh-tech/immortal/pkg/logger"
1011
"github.com/dezh-tech/immortal/repository/query_limit"
@@ -23,6 +24,7 @@ type Config struct {
2324
GRPCServer grpc.Config `yaml:"grpc_server"`
2425
Logger logger.Config `yaml:"logger"`
2526
Handler query_limit.Config
27+
2628
}
2729

2830
// Load loads config from file and env.
@@ -54,7 +56,8 @@ func Load(path string) (*Config, error) {
5456
}
5557

5658
config.Database.URI = os.Getenv("IMMO_MONGO_URI")
57-
config.RedisConf.URI = os.Getenv("IMMO_REDIS_URI")
59+
config.Redis.URI = os.Getenv("IMMO_REDIS_URI")
60+
config.Meili.APIKey = os.Getenv("MEILI_API_KEY")
5861

5962
if err = config.basicCheck(); err != nil {
6063
return nil, Error{

config/config.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,20 @@ redis:
7878
# default is IMMO_WHITE_LIST.
7979
white_list_filter_name: IMMO_WHITE_LIST
8080

81+
# meili contains MeiliSearch client specification
82+
meili:
83+
84+
# host specifies the MeiliSearch server host
85+
host: "localhost"
86+
87+
# port specifies the port on which the MeiliSearch server listens for requests
88+
port: 7700
89+
90+
# timeout_in_ms specifies the maximum duration (in milliseconds) that is used for creating connections to the MeiliSearch server.
91+
timeout_in_ms: 5000
92+
93+
# default_collection specifies the default collection name for documents
94+
default_collection: "events"
8195

8296
# log contains configs for logs output in console and file.
8397
logger:

delivery/websocket/event_handler.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ func (s *Server) handleEvent(conn *websocket.Conn, m message.Message) { //nolint
200200
for conn, client := range s.conns {
201201
client.Lock()
202202
for id, filter := range client.subs {
203-
if !filter.Match(msg.Event) {
203+
if !filter.Match(msg.Event, *client.pubkey) {
204204
continue
205205
}
206206
_ = conn.WriteMessage(1, message.MakeEvent(id, msg.Event))

documents/NIPs.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
- [X] **NIP-40**: Expiration Timestamp
88
- [X] **NIP-42**: Authentication of Clients to Relays
99
- [ ] **NIP-45**: Event Counts
10-
- [ ] **NIP-50**: Search Capability
10+
- [X] **NIP-50**: Search Capability
1111
- [X] **NIP-56**: Reporting
1212
- [X] **NIP-59**: Gift Wrap
1313
- [X] **NIP-62**: Right to Vanish

0 commit comments

Comments
 (0)