Skip to content

Conversation

chilledtonic
Copy link
Contributor

Our server needed a basic, read-only web view for users unfamiliar with terminal-land. So I've implemented a basic Read-Only Web API. I understand that activity-pub support is incoming, but it will likely be too heavy for our uses. Would this be a welcome PR, or should I fork Enigma?

PR: Document Message Area Web API

Added complete docs for the Message Area Web API in core/message_area_web.js. This covers the RESTful JSON API that gives read-only access to public message areas.

What's covered

Four main endpoints:

  • List conferences: GET /api/v1/message-areas/conferences
  • List areas in conference: GET /api/v1/message-areas/conferences/:confTag/areas
  • List messages in area: GET /api/v1/message-areas/areas/:areaTag/messages
  • Get message details: GET /api/v1/message-areas/messages/:messageUuid

Key features:

  • Read-only, no auth required
  • Auto-filters private areas
  • CORS enabled for browser use
  • Pagination (max 200 messages/page)
  • Optional reply inclusion
  • Configurable area exposure via exposedConfAreas
  • Proper error handling and HTTP status codes

Config options:

contentServers: {
    web: {
        messageAreaApi: true
        exposedConfAreas: {
            local: {
                include: [ "*" ]
                exclude: [ "private*" ]
            }
        }
    }
}

Includes JSON response formats, usage examples with curl/JavaScript, and implementation details. This enables web/mobile app integration and external system access while keeping things secure.

This commit introduces a new Message Area Web API that provides read-only access to public message areas and their messages in JSON format. The API includes endpoints for listing conferences, areas within conferences, messages in specific areas, and retrieving details of individual messages. Additionally, a test script is added to validate the API functionality. Documentation for the API is also included to guide users on its usage and configuration.
This commit updates the Message Area Web API to include a log message when the API is disabled by configuration. It also refines the configuration template to document the Message Area JSON API, clarifying its purpose and default settings. Additionally, minor formatting adjustments were made in the bbs.js file for improved readability.
This commit adds log messages to the test script, guiding users on how to test the Message Area API with the API disabled. It enhances error handling by providing clearer instructions for ensuring the web server is running during tests.
…i.js

This commit enhances the error handling in the test script by providing clearer error messages and instructions for users to ensure the web server is running. Additionally, it adds a call to execute the tests automatically, improving the usability of the testing process.
This commit introduces the ability to include message replies in the Message Area Web API responses when requested. It adds validation for path parameters in the list areas and messages handlers, ensuring proper error responses for invalid requests. Additionally, the timestamp formatting is centralized using a new helper method, improving consistency across the API. Updates to the API documentation reflect these changes, including new query parameters for including replies.
…Web API

This commit introduces methods to determine if conferences and areas are exposed based on configuration settings. It adds functionality to filter exposed conferences and areas in API responses, enhancing access control. The API documentation is updated to reflect the new configuration options for controlling exposure, including include/exclude patterns for areas. Additionally, the test script is updated with instructions for testing the new configuration features.
This commit enhances the documentation for the Message Area Web API by providing comprehensive details on endpoints, responses, error handling, and configuration options. It includes examples for usage with curl and JavaScript, ensuring clarity for users. Additionally, the legacy documentation file for the Message Area Web API is removed as its content has been integrated into the web server documentation.
@NuSkooler
Copy link
Owner

@chilledtonic Apologies as I haven't had much time with this stuff lately. Give me a bit to look over, and think about how to best tackle merging your work with the changes in the ActivityPub branch. Problem is, that branch isn't complete and I don't have time right now, but it changes a lot of web related work.

Without yet having looked at the code, I think the main change might have to be in the pathing, so something like /webapi/v1/... or something.

@robbiew
Copy link

robbiew commented Sep 6, 2025

Could this be utilized in building a web front end (login, read, post)?

@NuSkooler
Copy link
Owner

@robbiew looks like it. Before I can merge this, I really do need it to be synced up with the "Activity Pub" branch, however, as there are a LOT of web related changes there and I intend to make that the new master (with AP turned off by default, though)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants