HTTPE can render a simple responsive website for you with some buttons to trigger actions.

Currently, buttons can only trigger actions with a GET request.

Example

---
rules:
  - name: Play Music
    on:
      path: /music/play
    run.script: |
      nohup afplay /Users/thorsten/Swound-2023-03-4.mp3 >/dev/null 2>&1 &
      echo "Music now playing"      

  - name: Stop
    on:
      path: /music/stop
    run.script: killall afplay

  - name: Ping
    on:
      path: /ping
    run.script: ping -c 4 {{ .Input.Params.Tgt }}
    args:
      timeout: 10

  - name: Some buttons
    on:
      path: /
    render.buttons:
      - name: Send ping to Google
        url: /ping?Tgt=8.8.8.8
      - name: Send ping to Quad9
        url: /ping?Tgt=9.9.9.9
      - name: ▶️ Play Music
        url: /music/play
        classes: btn-lg btn-outline-warning
      - name: ⏹️ Stop Music
        url: /music/stop
        classes: btn-lg btn-dark
Some buttons created from the rules.

Some buttons created from the rules.

The first three rules define actions. The fourth rule defines buttons to trigger these actions.

You can change the style of the buttons by adding button classes from Bootstrap5.