Commit Graph

12 Commits

Author SHA1 Message Date
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