Commit Graph

28 Commits

Author SHA1 Message Date
af04f89df8 Introduce ServeMux and OpenAPI export endpoint 2025-07-23 04:10:50 +01:00
fab2f104ff Refactor SpiderFetch to use IdPkTs with Kind and optimize memory usage 2025-07-23 01:49:46 +01:00
06940efcec make spider single threaded 2025-07-23 01:11:13 +01:00
0ba36a3f67 Add memory optimization by freeing OS memory after event processing 2025-07-23 00:59:25 +01:00
d4bee83992 Add check for value log GC and sync storage after event processing 2025-07-23 00:56:58 +01:00
aabb536d13 Refactor event handling to use IdPkTs for memory optimization and improve query efficiency. 2025-07-23 00:48:32 +01:00
4f1d48c247 Refactor privilege check logs, enhance export functionality, and add new test coverage
- Updated privilege check log messages in `publisher.go` and `handleReq.go` for better clarity and consistency
- Improved event serialization by replacing `WriteTo` with `Serialize` in `export.go`
- Added unit tests for `Export` functionality in `export_test.go`
- Introduced tests for JSON tag handling in `json_tags_test.go`
- Simplified condition in `spider-fetch.go` by removing redundant checks
2025-07-22 12:47:03 +01:00
651791aec1 Add export functionality and fix privilege checks
- Added `Export` method in `database/database.go` to export events to an io.Writer
- Implemented detailed logic for exporting all or specific pubkeys' events
- Removed placeholder `Export` function with TODO comment from `database/database.go`
- Updated error handling in `handleReq.go` and `publisher.go` by using `err != nil` instead of `chk.E(err)`
- Added more detailed logging in privilege check conditions in both `publisher.go` and `handleReq.go`
- Introduced new imports such as `"fmt"` in `connection.go` for improved error message formatting
- Created a new file `export.go` under the `database` package with complete implementation of export functionality
2025-07-22 11:34:57 +01:00
b5448f4153 Add remote address to log and fix NIP20 prefix handling
- Updated `handleMessage.go` to include the real remote address in the log message when a message is received
- Removed `regexp` import and `NIP20prefixmatcher` variable from `publisher.go`
- Modified `server.go` to remove an unused parameter from the `AddEvent` method
- Added `NIP20prefixmatcher` variable and used it for checking error messages in `addEvent.go`
2025-07-21 13:35:10 +01:00
53e8e160dd Fix check-privilege logic and remove redundant condition
- Removed unused `authedIsAuthor` variable and simplified privilege check logic in `check-privilege.go`
- Replaced conditional return based on `authedIsAuthor` with direct use of `privileged` flag
- Simplified the logic for checking if authed pubkey is mentioned in event tags
2025-07-21 11:36:57 +01:00
90c9198ebe Fix pluralization and add background fetch of metadata and relay lists
- Updated log message to use correct plurals for `owners`, `pubkey`, and related variables
- Added background fetching of profile metadata, relay list metadata, and DM relays list using `SpiderFetch` in the goroutine
- Modified `server.go` to import `"orly.dev/pkg/protocol/socketapi"` correctly and initialize `listeners` with the updated constructor
2025-07-20 23:57:41 +01:00
4bbbbb1bb6 Add DMRelaysList.K to kind.go and improve error messages with remote address in connection.go
- Added `DMRelaysList.K` constant to `pkg/encoders/kind/kind.go`
- Removed unused `"errors"` import from `pkg/protocol/ws/connection.go`
- Updated error messages in `WriteMessage`, `ReadMessage`, and related functions in `pkg/protocol/ws/connection.go` to include the remote address for better debugging
- Changed error handling from `chk.E(err)` to `chk.T(err)` in `pkg/encoders/envelopes/eventenvelope/eventenvelope.go`
- Updated ticker interval from 30 minutes to 1 hour in `pkg/app/relay/server.go`
2025-07-20 22:03:30 +01:00
56ab6eaa81 Remove redundant logging statements
- Removed log statement in `pkg/app/relay/spider-fetch.go` for batch processing
- Removed log level output in `main.go`
- Removed configuration logging in `pkg/app/config/config.go`
- Removed unused log import in `pkg/protocol/ws/subscription.go`
- Removed connection success log in `pkg/protocol/ws/client.go`
- Added early return condition for non-follow-list kind in `spider-fetch.go`
2025-07-20 21:52:04 +01:00
e3c931fcf9 Make spider fetch concurrent with mutex and waitgroup
- Added goroutines and sync primitives to handle concurrent relay connections in spider-fetch.go
- Added connection logging to client.go
2025-07-20 21:42:35 +01:00
0544159d4b added fetch of metadata and relay lists, and private flag to stop spider fetching 2025-07-20 11:42:39 +01:00
65e1dd6183 fully implemented spider to fetch follows of owners, their follows, and the owner mute list 2025-07-20 09:42:06 +01:00
0e83a56025 completed first level of owners followed pubkeys 2025-07-19 19:37:30 +01:00
681cdb3a64 Standardize parameter/return value comments in protocol/socketapi package
- Updated `pkg/protocol/socketapi/handleClose.go` to use "# Parameters" and "# Return Values" for consistent comment formatting
- Updated `pkg/protocol/socketapi/handleReq.go` with standardized parameter and return value documentation
- Modified `pkg/interfaces/relay/interface.go` to align comment style with parameter/return value sections
- Standardized comments in `pkg/protocol/socketapi/pinger.go` using "# Parameters" format
- Improved comment structure in `pkg/protocol/socketapi/socketapi.go` for parameter documentation
- Updated `pkg/protocol/socketapi/handleEvent.go` with consistent return value comment formatting
2025-07-19 14:19:54 +01:00
901b4ff16a Enhance function and configuration documentation with detailed comments
- Updated `pkg/app/main.go` with comprehensive parameter descriptions, return value explanations, and "Expected behaviour" sections for `AcceptFilter` and `AcceptReq` functions
- Improved `pkg/app/config/config.go` comments using consistent terminology (British spelling) and added detailed implementation notes for configuration methods
- Standardized function documentation format across both files with aligned parameter/return value descriptions
2025-07-19 13:32:37 +01:00
5959d5dc7e Enhance documentation for configuration functions
- **pkg/app/config/config.go**
  - Added detailed comments explaining configuration struct purpose, environment loading behavior, and error handling in `New`
  - Expanded function documentation with parameter descriptions, return value explanations, and expected behavior details for all exported methods
  - Improved docstring formatting consistency across the file
  - Clarified .env file handling logic in multiple functions
  - Added implementation notes for key-value operations and sorting behavior
2025-07-19 12:30:38 +01:00
525df97679 Refactor and document Publish method in server-publish.go
### Modified Files
- **pkg/app/relay/server-publish.go**
  - Added comprehensive function documentation for `Publish`.
  - Clarified parameters, return values, and expected behavior.
  - Updated comments to improve readability and understanding of the method's functionality.
2025-07-17 23:55:02 +01:00
e2ad580c65 Refactor and document ServiceURL in auth.go
### Modified Files
- **pkg/app/relay/auth.go**
  - Updated comments to clarify function purpose, parameters, return values, and expected behavior.
  - Enhanced documentation to include details on protocol determination and URL construction.
2025-07-17 23:31:59 +01:00
ba287ee644 Refactor and document ServiceURL in auth.go
- **pkg/app/relay/auth.go**
  - Updated comments to clarify function purpose, parameters, return values, and expected behavior.
  - Enhanced documentation to include details on protocol determination and URL construction.
2025-07-17 23:17:10 +01:00
c391b9db46 Add detailed documentation for ServiceURL function in auth.go
pkg/app/relay/auth.go
  - Added comprehensive function documentation for ServiceURL
  - Clarified parameters, return values, and expected behavior
  - Included implementation details for protocol determination
  - Specified construction logic for WebSocket URL
2025-07-17 23:12:17 +01:00
59f246d304 Refactor accept-req.go and accept-event.go with detailed documentation
### Modified Files
- **pkg/app/relay/accept-req.go**
  - Added comprehensive function documentation for `AcceptReq`.
  - Clarified parameters, return values, and expected behavior.

- **pkg/app/relay/accept-event.go**
  - Added comprehensive function documentation for `AcceptEvent`.
  - Clarified parameters, return values, and expected behavior.
2025-07-17 22:44:44 +01:00
eaed2294bc Refactor addEvent.go with detailed documentation
### Modified Files
- **pkg/app/relay/addEvent.go**
  - Added comprehensive function documentation for `AddEvent`.
  - Clarified parameters, return values, and expected behavior.
2025-07-17 22:39:33 +01:00
ae0d4f5b68 ### Commit Message
Update .gitignore and refactor main.go, pkg/app/main.go

### Modified Files
- **.gitignore**
  - Added `.idea/material_theme_project_new.xml` and `.idea/orly.iml` to be ignored.

- **main.go**
  - Moved `os` import to the top.
  - Adjusted the order of imports for better readability.
  - Commented out the unused `profile` import.

- **pkg/app/main.go**
  - Added detailed comments for types and methods in the `Relay` struct.
  - Reorganized method descriptions for clarity.
  - Ensured consistent documentation style throughout the file.
2025-07-17 22:26:08 +01:00
fc68bcf3cb moved everything into pkg/ 2025-07-17 13:18:55 +01:00