- main.go
- Removed static favicon serving from `ServeMux`.
- Removed import for `net/http`.
- pkg/version/version
- Updated version from v0.6.0 to v0.6.1.
- cmd/lerproxy/main.go
- Added embedded support for default favicon using `//go:embed`.
- Modified logic to serve favicon as an embedded resource or from file in the same directory as the nostr.json
- static/favicon.ico
- Deleted static favicon file.
- cmd/lerproxy/favicon.ico
- Added new file for embedded favicon resource.
- pkg/database/save-event.go
- Added `noVerify` parameter to `SaveEvent` function
- Added check for existing event using `GetSerialById` when `noVerify` is false
- Modified logic to handle event verification based on `noVerify` flag
- pkg/app/relay/server-publish.go
- Added `false` as third argument to `SaveEvent` calls
- pkg/database/export_test.go
- Added `false` as third argument to `SaveEvent` call
- pkg/database/query-for-tags_test.go
- Added `false` as third argument to `SaveEvent` call
- pkg/database/query-for-kinds-authors_test.go
- Added `false` as third argument to `SaveEvent` call
- pkg/database/query-for-kinds-tags_test.go
- Added `false` as third argument to `SaveEvent` call
- pkg/database/query-for-serials_test.go
- Added `false` as third argument to `SaveEvent` call
- main.go
- Modified pprof handling to support different profiling types (cpu, memory, allocation)
- Changed `Pprof` configuration from boolean to string with enum values
- pkg/app/config/config.go
- Changed `Pprof` field type from `bool` to `string` with enum values
- pkg/database/query-for-kinds-authors-tags_test.go
- Added `false` as third argument to `SaveEvent` call
- pkg/version/version
- Bumped version from v0.2.12 to v0.2.13
- pkg/database/fetch-event-by-serial_test.go
- Added `false` as third argument to `SaveEvent` call
- pkg/database/query-for-kinds_test.go
- Added `false` as third argument to `SaveEvent` call
- pkg/database/get-serials-by-range_test.go
- Added `false` as third argument to `SaveEvent` call
- pkg/database/query-events-multiple-param-replaceable_test.go
- Added `false` as third argument to `SaveEvent` calls
- pkg/database/query-events_test.go
- Added `false` as third argument to `SaveEvent` calls
- pkg/interfaces/store/store_interface.go
- Updated `Saver` interface to include `noVerify` parameter in `SaveEvent` method
- Added `SerialByIder` interface with `GetSerialById` method
- pkg/database/save-event_test.go
- Added `false` as third argument to `SaveEvent` calls
- Added new test case for saving existing event
- pkg/database/query-for-ids_test.go
- Added `false` as third argument to `SaveEvent` call
- pkg/protocol/ws/client.go
- Changed comment about context cancellation from "context is canceled" to "context is cancelled"
- pkg/app/relay/spider-fetch.go
- Added signature checker for WebSocket connections
- Modified logic to check for existing events before saving
- Added logging and memory optimization improvements
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.
- **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.
- now rejects events without auth if ORLY_AUTH_REQUIRED=true
- now rejects requests without auth if ORLY_PUBLIC_READABLE=false and ORLY_AUTH_REQUIRED=true
- renamed /app/realy to app/relay to be more descriptive
- cleaned up some noisy logging
- fixed a bug in teh new atomic.Bytes that didn't check for nil (untyped) as the Value
- **app/realy/handleWebsocket.go**:
- Modified `Server` struct initialization to use `server.I` instead of `server.S`.
- **protocol/socketapi/handleEvent.go**:
- Updated `HandleEvent` method to accept `server.I` for improved interface consistency.
- **app/realy/server-impl.go**:
- Added the `PublicReadable` method to the `Server` struct.
- Replaced `server.S` references with `server.I` to align with updated interface.
- **protocol/relayinfo/types.go**:
- Fixed typo in error message from "realy" to "relay".
- **protocol/socketapi/handleMessage.go**:
- Replaced `server.S` references with `server.I` in event handling methods.
- **protocol/socketapi/handleClose.go**:
- Updated `HandleClose` method to use `server.I`.
- **protocol/socketapi/handleReq.go**:
- Updated `HandleReq` method signature to accept `server.I`.
- **app/realy/server.go**:
- Introduced `publicReadable` field in the `Server` struct.
- Updated `NewServer` to handle `PublicReadable` parameter from `ServerParams`.
- **protocol/socketapi/socketapi.go**:
- Changed `server.S` to `server.I` across the WebSocket logic for consistency.
- **version/version**:
- Downgraded version file from `v1.14.3` to `v0.1.1`.
- **version/version.go**:
- Corrected `URL` constant from `https://orly` to `https://orly.dev`.
- **interfaces/server/server.go**:
- Renamed interface `S` to `I`.
- Added `PublicReadable` to the renamed `I` interface.
- **main.go**:
- Introduced logging of `PublicReadable` support when starting the server.
- Updated imports and initialization to align with added features.
- **app/config/config.go**:
- Added `PublicReadable` flag in configuration struct and environment settings.
- **protocol/socketapi/pinger.go**:
- Modified `Pinger` method to use `server.I`.
- **protocol/socketapi/handleAuth.go**:
- Adjusted `HandleAuth` logic to utilize `server.I`.
- **app/resources.go**:
- Introduced a new initialization flow reflecting updated server settings.
- **protocol/socketapi/challenge.go**:
- Removed unused `GetListener` function and its associated logic.
- **protocol/socketapi/handleEvent.go**:
- Refactored `env.Id` references to `env.E.Id` to standardize access to event identifiers.
- **app/realy/server-impl.go**:
- Added `AuthRequired` method to expose server-level authentication configuration.
- **app/realy/handleRelayinfo.go**:
- Included `Authentication` in supported protocols.
- Updated relay information to expose `AuthRequired` status in `Limitation`.
- **encoders/envelopes/authenvelope/authenvelope.go**:
- Introduced `Id` method for `Response` type.
- **app/realy/server-publish.go**:
- Refined event saving logic by replacing `chk.E` with a direct `err` check.
- **app/realy/server.go**:
- Added `authRequired` field in `Server` struct and integrated it into relevant methods.
- **protocol/socketapi/socketapi.go**:
- Introduced authentication handling in WebSocket listeners if `AuthRequired` is enabled.
- **protocol/socketapi/handleAuth.go**:
- Implemented authentication response validation against challenges and server URLs.
- Supported logging of successes and failures.
- **app/config/config.go**:
- Added `AuthRequired` flag to configuration structure and environment variables.
- **encoders/envelopes/eventenvelope/eventenvelope.go**:
- Added `Id` method for `Submission` and `Result` types.
- **interfaces/server/server.go**:
- Added `AuthRequired` and `ServiceURL` methods to the interface.
- **protocol/ws/listener.go**:
- Added `authRequested` field and methods to track authentication requests.
- **protocol/socketapi/ok.go**:
- Introduced `Ok` utility functions for standard responses indicating reasons and types of errors.
- **app/realy/auth.go**:
- Added `ServiceURL` method to determine the relay's URL for authentication responses.
- **encoders/reason/reason.go**:
- Defined reusable reason templates for responses such as `auth-required` and `error`.
- **protocol/socketapi/ws.go**:
- Adjusted `NewListener` to handle `authRequired` flag and conditionally generate challenges.
- **main.go**: Replace `ratel` storage backend with `database.New` for enhanced reliability and error handling.
- **database/query-events.go**: Rewrite event querying to handle replaceable and parameterized replaceable events; introduce deletion-based filtering, and improve sorting logic.
- **realy/addEvent.go**: Remove unnecessary logging for ephemeral events to optimize processing.
- **database/query-events_test.go**: Add comprehensive tests for replaceable events, parameterized replaceable events, and deletion handling to validate new logic.