.webserver/
├── src/main/
│ ├── kotlin/tara/tb1/pw/
│ │ ├── Playwright/ # Playwright integration
│ │ │ ├── Playwright.kt # Playwright core functionality
│ │ │ └── PlaywrightController.kt # REST endpoints
│ │ └── JasperWebserverApplication.kt # Main application
│ └── resources/
│ ├── templates/ # HTML templates
│ │ └── skullboard.html # Skullboard message template
│ └── application.properties # Application configuration
├── build.gradle.kts # Gradle build configuration
└── settings.gradle.kts # Gradle settings
-
Playwright Integration: Handles browser automation for generating images from HTML templates.
Playwright.kt: Core functionality for browser control and image generationPlaywrightController.kt: REST endpoints for image generation services
-
HTML Templates: Located in
src/main/resources/templates/, these files define the visual structure of generated content.skullboard.html: Template for Discord message screenshots
-
Application Configuration: Spring Boot configuration in
application.properties
-
Install dependencies:
./gradlew build
-
Run the server:
./gradlew bootRun
-
GET /playwright/test- Tests if the Playwright service is working
- Returns: String confirmation message
-
POST /playwright/execute- Executes a Playwright script
- Body: Script content
- Returns: Execution result
-
POST /playwright/render- Renders HTML content to an image
- Body: RenderData object
- Returns: PNG image
The application requires:
- Java 17 or higher
- Gradle
- Playwright dependencies
./gradlew build- Builds the project./gradlew test- Runs tests./gradlew bootRun- Starts the development server./gradlew bootJar- Creates an executable JAR
The project is written in Kotlin and leverages:
- Strong type system
- Null safety features
- Spring Boot type-safe configuration
- Kotlin data classes for request/response models
