Commit Graph

129 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
498073460c skip nil FullIdPubkeyBySerial results v0.2.10 2025-07-22 15:15:03 +01:00
11d378bfc3 revert changes that cause malfunction v0.2.9 2025-07-22 15:08:50 +01:00
9b7e8d28de remove redundant return v0.2.8 2025-07-22 15:02:46 +01:00
c16ee76638 add error message for failed fetch v0.2.7 2025-07-22 14:55:09 +01:00
132fdc9f36 Add test for NostrEscape and NostrUnescape handling in JSON tags
- Introduced a new test case `ExplicitlyEscapedJSON` in `json_tags_test.go`
- Validates the behavior of `NostrEscape` and `NostrUnescape` with explicitly escaped JSON
- Ensures proper marshaling, unmarshaling, and verification of nested and special characters in JSON tags
2025-07-22 13:16:09 +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
v0.2.6
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
v0.2.5
2025-07-22 11:34:57 +01:00
53d649c64e Merge remote-tracking branch 'origin/main' v0.2.4 2025-07-21 15:05:19 +01:00
4dafab3fd6 Fix privilege check logic by inverting conditionals
- Inverted conditional in `publisher.go` to correctly skip unprivileged events
- Inverted conditional in `handleReq.go` to filter out unprivileged events properly
- Added fallback logic in `check-privilege.go` to mark as privileged if no conditions match
2025-07-21 15:05:07 +01:00
f2475c48b7 Fix privilege check logic in publisher and handleReq files
- Changed `auth.CheckPrivilege` condition from allowing to denying access if not privileged in `publisher.go`
- Updated `handleReq.go` to deny access if `auth.CheckPrivilege` returns false, improving consistency and security checks
v0.2.3
2025-07-21 14:29:46 +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`
v0.2.2
2025-07-21 13:35:10 +01:00
11d318d4e3 Update Challenge methods with detailed comments and improved functionality
- Added comprehensive documentation for Write, Marshal, Unmarshal, and ParseChallenge methods
- Improved method descriptions with parameters, return values, and expected behavior sections
- Enhanced clarity of implementation details in comments
- Standardized comment formatting across the file
2025-07-21 13:14:59 +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
v0.2.1
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 v0.2.0 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
93d6871488 Standardize comment format for parameters and return values in socketapi package
- Updated `pkg/protocol/socketapi/socketapi.go` with "# Expected Behaviour" section using British spelling
- Enhanced `pkg/protocol/socketapi/handleEvent.go` parameter documentation with context type annotations
- Standardized return value formatting with consistent bracket placement
- Improved error message phrasing to use "can't" instead of "cannot" for consistency
- Added detailed implementation notes for event deletion validation logic
2025-07-19 14:45:55 +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
6d34664cf8 Update README bullet point wording for clarity
- **readme.adoc**:
  - Adjusted phrasing in feature description from "other bits" to "bits" for precision
  - Maintained consistent line wrapping in technical documentation sections
2025-07-19 12:56:44 +01:00
dac6a30625 Improve readability by splitting long lines in README
- **readme.adoc**:
  - Split long bullet points into shorter lines for improved formatting and readability
  - Adjusted line breaks in technical descriptions (e.g., CGO configuration, database storage location)
  - Ensured consistent line wrapping across documentation sections
2025-07-19 12:55:55 +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
1d07875652 Merge remote-tracking branch 'origin/main' 2025-07-19 11:27:17 +01:00
8ec0c49ecd Add version control infrastructure
- **.gitignore**:
  - Added `!version` to include version files in git tracking.
- **pkg/version/version**:
  - Created new file with initial version `v0.1.1`.
2025-07-19 11:27:06 +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
4ee09ada17 Relocate tests/generate.go under pkg/tests/
- **tests/generate.go**:
  - Moved file to `pkg/tests/` directory for better organization.
2025-07-17 14:02:48 +01:00
e91c591a6f Update readme with note on forthcoming HTTP API details
- **readme.adoc**:
  - Added a note indicating that the HTTP API is not included yet but is planned for future release.
2025-07-17 14:00:38 +01:00
2323545d4b Update readme with clarification on features and repository policy
- **readme.adoc**:
  - Added "(todo: this is mostly built and designed but not currently available)" to a listed feature for better transparency on availability.
  - Clarified that the branch name is `main` instead of `dev` under repository policy.
  - Noted that "Simplified Nostr" is not currently implemented and marked it as "coming soon".
2025-07-17 13:59:45 +01:00
1d18425677 fixed missing bits
- **readme.adoc**:
  - Updated contact information with nostr profile for better user engagement.
2025-07-17 13:30:34 +01:00
fc68bcf3cb moved everything into pkg/ 2025-07-17 13:18:55 +01:00
affd6c1ebc Update readme to replace placeholder image link and remove duplicate image
- **readme.adoc**:
  - Replaced `= orly.lol` with `image:./orly.png[orly.dev]` for better branding.
  - Removed duplicate `image:./orly.png[orly.png]` line to clean up content.
2025-07-17 13:11:28 +01:00
6e103c454d Remove unused fields from Server struct and update readme contact info
- **app/relay/server.go**:
  - Removed unused `Admins` and `Owners` fields from the `Server` struct.
  - Removed unused `signer` package import.

- **readme.adoc**:
  - Updated contact information for the "zap me" section.
2025-07-17 13:10:27 +01:00
db3f98b8cb Refactor ServeHTTP logic and minor documentation updates
- **app/relay/server.go**:
  - Reorganized `ServeHTTP` method to prioritize WebSocket upgrade checks.
  - Streamlined logic for handling relay info requests.

- **readme.adoc**:
  - Fixed punctuation inconsistencies in feature descriptions.
  - Clarified Go version requirements, specifying 1.24 as the minimum.
2025-07-17 13:07:17 +01:00
43404d6a07 Remove unused disconnect method and integrate configuration into server
- **app/relay/disconnect.go**:
  - Deleted unused `disconnect` method that was no longer referenced in code.

- **app/relay/server.go**:
  - Integrated server configuration (`config.C`) directly into the `Server` struct.
  - Refactored `authRequired` and `publicReadable` fields to derive from the configuration.

- **app/relay/server-impl.go**:
  - Removed references to the obsolete `disconnect` method.
  - Updated methods to retrieve authentication and readability settings from configuration.

- **app/relay/handleRelayinfo.go**:
  - Adjusted `handleRelayinfo` to use `config.C.AuthRequired` for showing relay limitations.

- **app/config/config.go**:
  - Added default values for the `SpiderSeeds` field for consistent initialization.
  - Logged configuration details upon loading for better debugging visibility.

- **interfaces/server/server.go**:
  - Removed `Disconnect` method from `server.I`, as it was no longer needed.

- **main.go**:
  - Modified `relay.ServerParams` to pass the configuration as a pointer (`config.C`).
  - Simplified initialization by removing redundant fields replaced by configuration integration.

- **protocol/socketapi/handleEvent.go**:
  - Standardized and clarified comments for parameter descriptions.
2025-07-17 11:22:53 +01:00