diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 91ff3f8..bf556ef 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -10,11 +10,6 @@ repos: rev: v2.4.1 hooks: - id: prettier - - repo: https://github.com/dudefellah/pre-commit-openapi - rev: "v0.0.1" - hooks: - - id: check-openapi - - repo: local hooks: - id: tsc diff --git a/Makefile b/Makefile index 9861398..ed465a0 100644 --- a/Makefile +++ b/Makefile @@ -4,6 +4,7 @@ UI_DIR=./ui VERSION=$(shell git tag --sort=-version:refname | head -n 1) setup: + go get -t ./src/... cd ${UI_DIR} && pnpm install test: @@ -16,7 +17,3 @@ build-server: go build -tags prod -ldflags "-s -w -X code.thetadev.de/TSGRain/SEBRAUC/src/util.version=${VERSION}" -o build/sebrauc ./src/. build: build-ui build-server - -clean: - rm -f build/* - rm -rf ${UI_DIR}/dist/** diff --git a/openapi.yml b/openapi.yml index f55550d..a9332ce 100644 --- a/openapi.yml +++ b/openapi.yml @@ -1,48 +1,27 @@ -openapi: 3.0.3 +openapi: "3.0.3" info: title: SEBRAUC - version: 0.1.0 - description: REST API for the SEBRAUC firmware updater + version: "0.0.1" servers: - url: http://localhost:8080/api paths: /status: get: - operationId: getStatus responses: - 200: + "200": description: OK content: - application/json: + "application/json": schema: $ref: "#/components/schemas/RaucStatus" default: - description: Server error + description: "Server error" content: - application/json: + "application/json": schema: $ref: "#/components/schemas/StatusMessage" - - /info: - get: - operationId: getInfo - responses: - 200: - description: OK - content: - application/json: - schema: - $ref: "#/components/schemas/SystemInfo" - default: - description: Server error - content: - application/json: - schema: - $ref: "#/components/schemas/StatusMessage" - /update: post: - operationId: startUpdate requestBody: content: multipart/form-data: @@ -53,33 +32,32 @@ paths: type: string format: binary responses: - 200: - description: OK + "200": + description: "OK" content: - application/json: + "application/json": schema: $ref: "#/components/schemas/StatusMessage" default: - description: Server error + description: "Server error" content: - application/json: + "application/json": schema: $ref: "#/components/schemas/StatusMessage" /reboot: post: - operationId: startReboot responses: - 200: - description: OK + "200": + description: "OK" content: - application/json: + "application/json": schema: $ref: "#/components/schemas/StatusMessage" default: - description: Server error + description: "Server error" content: - application/json: + "application/json": schema: $ref: "#/components/schemas/StatusMessage" @@ -89,23 +67,23 @@ components: type: object properties: installing: - description: True if the installer is running + description: "True if the installer is running" type: boolean percent: - description: Installation progress + description: "Installation progress" type: integer minimum: 0 maximum: 100 message: - description: Current installation step + description: "Current installation step" type: string - example: Copying image to rootfs.0 + example: "Copying image to rootfs.0" last_error: - description: Installation error message + description: "Installation error message" type: string example: "Failed to check bundle identifier: Invalid identifier. Did you pass a valid RAUC bundle?" log: - description: Full command line output of the current installation + description: "Full command line output of the current installation" type: string example: "0% Installing\n0% Determining slot states\n20% Determining slot states done.\n" required: @@ -115,77 +93,15 @@ components: - last_error - log - SystemInfo: - type: object - properties: - os_name: - description: Name of the os distribution - type: string - example: "Poky" - os_version: - description: Operating system version - type: string - example: "1.0.2" - uptime: - description: System uptime in seconds - type: integer - example: 5832 - rauc_compatible: - description: Compatible firmware name - type: string - example: "Poky" - rauc_variant: - description: Compatible firmware variant - type: string - example: "rpi-prod" - rauc_booted: - description: Currently booted rootfs - type: string - example: "rootfs.0" - rauc_boot_primary: - description: Primary rootfs to boot from - type: string - example: "rootfs.1" - rauc_rootfs: - description: List of RAUC root filesystems - type: object - additionalProperties: - $ref: "#/components/schemas/RaucFS" - - RaucFS: - type: object - properties: - device: - description: Block device - type: string - example: "/dev/mmcblk0p2" - type: - description: Filesystem - type: string - example: ext4 - state: - description: Current state of filesystem - type: string - enum: [active, inactive, booted] - example: booted - mountpoint: - description: Mount path (null when not mounted) - type: string - nullable: true - example: "/" - bootable: - description: "Is the filesystem bootable" - type: boolean - StatusMessage: type: object properties: success: - description: Is operation successful + description: "Is operation successful" type: boolean msg: - description: Success message + description: "Success message" type: string - example: Update started + example: "Update started" required: - msg diff --git a/ui/src/components/Updater/Alert.tsx b/ui/src/components/Upload/Alert.tsx similarity index 100% rename from ui/src/components/Updater/Alert.tsx rename to ui/src/components/Upload/Alert.tsx diff --git a/ui/src/components/Updater/Reboot.tsx b/ui/src/components/Upload/Reboot.tsx similarity index 100% rename from ui/src/components/Updater/Reboot.tsx rename to ui/src/components/Upload/Reboot.tsx diff --git a/ui/src/components/Updater/Updater.scss b/ui/src/components/Upload/Updater.scss similarity index 100% rename from ui/src/components/Updater/Updater.scss rename to ui/src/components/Upload/Updater.scss diff --git a/ui/src/components/Updater/Updater.tsx b/ui/src/components/Upload/Updater.tsx similarity index 100% rename from ui/src/components/Updater/Updater.tsx rename to ui/src/components/Upload/Updater.tsx diff --git a/ui/src/components/app.tsx b/ui/src/components/app.tsx index 4d0f547..ad564b9 100644 --- a/ui/src/components/app.tsx +++ b/ui/src/components/app.tsx @@ -1,5 +1,5 @@ import {Component} from "preact" -import Updater from "./Updater/Updater" +import Updater from "./Upload/Updater" import logo from "../assets/logo.svg" import {version} from "../util/version"