This project provides a web application for managing and displaying events. The server exposes several APIs for setting and retrieving calendar configurations, as well as an endpoint to display the next events. It uses Actix-web and Tokio to handle HTTP requests and is designed to have an easy to use headless setup.
-
Clone the Repository
First, clone the repository to your local machine:
git clone <repository-url> cd <project-directory>
-
Install Dependencies
Ensure you have Rust installed on your system. If not, follow the instructions at Rust's official website.
After that, install the required dependencies:
cargo build --release
-
Run the Server
To start the server, use the following command:
cargo run --release
The server will be available at
http://localhost:8080
. -
Access the Setup Page
To configure the
config.json
, open the setup page in your browser:http://localhost:8080/setup
This page allows you to input and set up the required configuration file. Click here to upload the file to the server.
-
GET /next_events.json
Get the next events, sorted by date.- Response: A JSON template for OpenEPaperLink with event details.
-
GET /setup
Provides an HTML page to configure theconfig.json
.- Response: A simple form for configuring the settings.
-
POST /api/set_config
Set the calendar configuration.- Request body:
ServerConfigFile
in JSON format. - Example:
{ "urls":[ "https://example.com/calendar.ics", "https://localhost:8080/calendar.ics" ], "ammount_of_next_events": 2, "nothing_todo_message": "Done for Today!"
}
- Response: `"set confg successul"`
- Request body:
-
GET /api/get_config
Retrieve the current calendar configuration.- Response:
ServerConfigFile
in JSON format.
- Response:
The config.json
file contains the settings for the server. Here's the structure of the configuration:
{
"urls":[
"https://example.com/calendar.ics",
"https://localhost:8080/calendar.ics"
],
"ammount_of_next_events": 2,
"nothing_todo_message": "Done for Today!"
}
urls
: A list of URLs (strings) where the server will fetch events from.ammount_of_next_events
: The number of upcoming events to retrieve and display.nothing_todo_message
: A message to display when there are no upcoming events.
- Open the setup page:
http://localhost:8080/setup
- Configure your calendar URLs, the number of events to display, and the "no events" message.
- The configuration will be saved to
config.json
. - Access the events via
http://localhost:8080/next_events.json
.
- The server is currently set to run on
0.0.0.0:8080
. - Make sure the
config.json
file exists and is properly configured before using the API endpoints. You can either manually create it or use the setup page to do so.
This project is licensed under the MIT License - see the LICENSE file for details.