16 Commits

Author SHA1 Message Date
eac5e05e77 Add noVerify flag to SaveEvent to prevent duplicate events and enhance test reliability
- 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
2025-07-23 13:51:02 +01:00
af04f89df8 Introduce ServeMux and OpenAPI export endpoint 2025-07-23 04:10:50 +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
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
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
a2449e24ae add acceptreq/acceptevent and minimal implementation
- 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
2025-07-16 15:10:22 +01:00
5c129e078e Refactor server interface, add public-readable support, and update versioning
- **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.
2025-07-16 14:15:06 +01:00
b28acc0c29 Add authentication support and enhance protocol handling
- **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.
2025-07-16 12:53:52 +01:00
bc947f188c restructured repository layout to group together related types of things into folders 2025-07-13 23:09:19 +01:00
96b852d6f1 Refactor and enhance event handling, database logic, and replaceable event processing
- **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.
2025-07-13 09:41:11 +01:00
9b868cea17 migrate to mostly working old realy codebase, preparing to integrate new database and event codec 2025-07-12 22:14:40 +01:00
3729370690 move to new orly.dev; implement indexes properly 2025-07-05 17:37:24 +01:00
972cc7dbee starting with database stuff 2025-07-04 13:11:57 +01:00
0adaf224a0 implement relayinfo 2025-07-04 06:52:55 +01:00
045e4de8db tidying things up and getting started 2025-07-03 22:31:51 +01:00