From b87dd2d1f56d57764200bbe2af4681214088757c Mon Sep 17 00:00:00 2001 From: Nicolas Meienberger Date: Wed, 24 Aug 2022 11:18:00 +0200 Subject: [PATCH] refactor: add JSON schema validation on configs --- apps/adguard/config.json | 1 + apps/booksonic/config.json | 2 + apps/calibre-web/config.json | 1 + apps/code-server/config.json | 1 + apps/filebrowser/config.json | 1 + apps/firefly-iii/config.json | 1 + apps/freshrss/config.json | 1 + apps/ghost/config.json | 1 + apps/gitea/config.json | 1 + apps/homarr/config.json | 1 + apps/homeassistant/config.json | 2 + apps/invidious/config.json | 2 + apps/jackett/config.json | 1 + apps/jellyfin/config.json | 1 + apps/joplin/config.json | 1 + apps/libreddit/config.json | 2 + apps/mealie/config.json | 1 + apps/n8n/config.json | 1 + apps/nextcloud/config.json | 1 + apps/nitter/config.json | 1 + apps/nodered/config.json | 1 + apps/overseerr/config.json | 1 + apps/photoprism/config.json | 1 + apps/pihole/config.json | 1 + apps/plex/config.json | 1 + apps/portainer/config.json | 1 + apps/prowlarr/config.json | 1 + apps/proxitok/config.json | 1 + apps/radarr/config.json | 1 + apps/readarr/config.json | 1 + apps/resilio-sync/config.json | 1 + apps/schema.json | 119 +++++++++++++++++++++++++++++++++ apps/sonarr/config.json | 1 + apps/syncthing/config.json | 1 + apps/tailscale/config.json | 1 + apps/tautulli/config.json | 1 + apps/transmission/config.json | 1 + apps/vaultwarden/config.json | 1 + apps/wg-easy/config.json | 1 + apps/your-spotify/config.json | 1 + 40 files changed, 162 insertions(+) create mode 100644 apps/schema.json diff --git a/apps/adguard/config.json b/apps/adguard/config.json index f87bc809..943a9eb9 100644 --- a/apps/adguard/config.json +++ b/apps/adguard/config.json @@ -1,4 +1,5 @@ { + "$schema": "../schema.json", "name": "Adguard", "available": true, "tipi_version": 1, diff --git a/apps/booksonic/config.json b/apps/booksonic/config.json index 85b1ad1c..3805b1b4 100644 --- a/apps/booksonic/config.json +++ b/apps/booksonic/config.json @@ -1,8 +1,10 @@ { + "$schema": "../schema.json", "name": "Booksonic", "available": true, "port": 8040, "tipi_version": 1, + "version": "latest", "id": "booksonic", "categories": ["books", "media"], "description": "", diff --git a/apps/calibre-web/config.json b/apps/calibre-web/config.json index cc7be615..6f5e4c93 100644 --- a/apps/calibre-web/config.json +++ b/apps/calibre-web/config.json @@ -1,4 +1,5 @@ { + "$schema": "../schema.json", "name": "Calibre-Web - EBook Reader", "available": true, "port": 8100, diff --git a/apps/code-server/config.json b/apps/code-server/config.json index 5b8b57cb..e750fa24 100644 --- a/apps/code-server/config.json +++ b/apps/code-server/config.json @@ -1,4 +1,5 @@ { + "$schema": "../schema.json", "name": "Code-Server - Web VS Code", "available": true, "port": 8101, diff --git a/apps/filebrowser/config.json b/apps/filebrowser/config.json index 8e0f2af5..d357c030 100644 --- a/apps/filebrowser/config.json +++ b/apps/filebrowser/config.json @@ -1,4 +1,5 @@ { + "$schema": "../schema.json", "name": "File Browser", "available": true, "port": 8096, diff --git a/apps/firefly-iii/config.json b/apps/firefly-iii/config.json index 8b416a28..4ed7846e 100644 --- a/apps/firefly-iii/config.json +++ b/apps/firefly-iii/config.json @@ -1,4 +1,5 @@ { + "$schema": "../schema.json", "name": "Firefly III", "available": true, "port": 8115, diff --git a/apps/freshrss/config.json b/apps/freshrss/config.json index 94938ecc..0b34be92 100644 --- a/apps/freshrss/config.json +++ b/apps/freshrss/config.json @@ -1,4 +1,5 @@ { + "$schema": "../schema.json", "name": "FreshRSS", "available": true, "port": 8086, diff --git a/apps/ghost/config.json b/apps/ghost/config.json index 0c852a1a..f94c14fc 100644 --- a/apps/ghost/config.json +++ b/apps/ghost/config.json @@ -1,4 +1,5 @@ { + "$schema": "../schema.json", "name": "Ghost", "port": 8117, "available": true, diff --git a/apps/gitea/config.json b/apps/gitea/config.json index 716a2324..ebe24b16 100644 --- a/apps/gitea/config.json +++ b/apps/gitea/config.json @@ -1,4 +1,5 @@ { + "$schema": "../schema.json", "name": "Gitea", "port": 8108, "available": true, diff --git a/apps/homarr/config.json b/apps/homarr/config.json index b38fbf61..0c41f249 100644 --- a/apps/homarr/config.json +++ b/apps/homarr/config.json @@ -1,4 +1,5 @@ { + "$schema": "../schema.json", "name": "Homarr", "available": true, "port": 8102, diff --git a/apps/homeassistant/config.json b/apps/homeassistant/config.json index 81ea4b83..1155a49d 100644 --- a/apps/homeassistant/config.json +++ b/apps/homeassistant/config.json @@ -1,8 +1,10 @@ { + "$schema": "../schema.json", "name": "Home Assistant", "available": true, "port": 8123, "tipi_version": 2, + "version": "stable", "id": "homeassistant", "categories": ["automation"], "description": "Open source home automation that puts local control and privacy first. Powered by a worldwide community of tinkerers and DIY enthusiasts. Perfect to run on a Raspberry Pi or a local server.", diff --git a/apps/invidious/config.json b/apps/invidious/config.json index 1a923d93..4ecd85ec 100644 --- a/apps/invidious/config.json +++ b/apps/invidious/config.json @@ -1,8 +1,10 @@ { + "$schema": "../schema.json", "name": "Invidious", "available": true, "port": 8095, "id": "invidious", + "version": "latest", "tipi_version": 1, "categories": ["media", "social"], "description": "Invidious is an open source alternative front-end to YouTube.", diff --git a/apps/jackett/config.json b/apps/jackett/config.json index c3620d95..ccfb990c 100644 --- a/apps/jackett/config.json +++ b/apps/jackett/config.json @@ -1,4 +1,5 @@ { + "$schema": "../schema.json", "name": "Jackett", "available": true, "port": 8097, diff --git a/apps/jellyfin/config.json b/apps/jellyfin/config.json index bfa9be7b..31069f74 100644 --- a/apps/jellyfin/config.json +++ b/apps/jellyfin/config.json @@ -1,4 +1,5 @@ { + "$schema": "../schema.json", "name": "Jellyfin", "available": true, "port": 8091, diff --git a/apps/joplin/config.json b/apps/joplin/config.json index 4903ddec..84089428 100644 --- a/apps/joplin/config.json +++ b/apps/joplin/config.json @@ -1,4 +1,5 @@ { + "$schema": "../schema.json", "name": "Joplin Server", "available": true, "port": 8099, diff --git a/apps/libreddit/config.json b/apps/libreddit/config.json index 8fe6b36a..9ee7372e 100644 --- a/apps/libreddit/config.json +++ b/apps/libreddit/config.json @@ -1,9 +1,11 @@ { + "$schema": "../schema.json", "name": "LibReddit", "available": true, "port": 8105, "id": "libreddit", "tipi_version": 1, + "version": "latest", "categories": ["social"], "description": "LibReddit is a bloat free reddit frontend written in Rust, no ads, no tracking and strong Content Security Policy prevents any request from going to reddit, everything is proxied.", "short_desc": "Browse reddit without problems!", diff --git a/apps/mealie/config.json b/apps/mealie/config.json index f3a243cb..b76f5c3a 100644 --- a/apps/mealie/config.json +++ b/apps/mealie/config.json @@ -1,4 +1,5 @@ { + "$schema": "../schema.json", "name": "Mealie", "port": 8114, "available": true, diff --git a/apps/n8n/config.json b/apps/n8n/config.json index 0d2d57dc..5fa04fe7 100644 --- a/apps/n8n/config.json +++ b/apps/n8n/config.json @@ -1,4 +1,5 @@ { + "$schema": "../schema.json", "name": "n8n", "available": true, "port": 8094, diff --git a/apps/nextcloud/config.json b/apps/nextcloud/config.json index c1557744..a2fa9e96 100644 --- a/apps/nextcloud/config.json +++ b/apps/nextcloud/config.json @@ -1,4 +1,5 @@ { + "$schema": "../schema.json", "name": "Nextcloud", "available": true, "port": 8083, diff --git a/apps/nitter/config.json b/apps/nitter/config.json index a6e7bddb..e0f3f530 100644 --- a/apps/nitter/config.json +++ b/apps/nitter/config.json @@ -1,4 +1,5 @@ { + "$schema": "../schema.json", "name": "Nitter", "available": true, "port": 8106, diff --git a/apps/nodered/config.json b/apps/nodered/config.json index 5d9acfca..40ebe7e3 100644 --- a/apps/nodered/config.json +++ b/apps/nodered/config.json @@ -1,4 +1,5 @@ { + "$schema": "../schema.json", "name": "Node-RED", "port": 8111, "available": true, diff --git a/apps/overseerr/config.json b/apps/overseerr/config.json index 43275ea1..3882a766 100644 --- a/apps/overseerr/config.json +++ b/apps/overseerr/config.json @@ -1,4 +1,5 @@ { + "$schema": "../schema.json", "name": "Overseerr", "available": true, "port": 8116, diff --git a/apps/photoprism/config.json b/apps/photoprism/config.json index af5c4d55..617c9a1d 100644 --- a/apps/photoprism/config.json +++ b/apps/photoprism/config.json @@ -1,4 +1,5 @@ { + "$schema": "../schema.json", "name": "PhotoPrism", "port": 8110, "available": true, diff --git a/apps/pihole/config.json b/apps/pihole/config.json index 4fb73415..1441e402 100644 --- a/apps/pihole/config.json +++ b/apps/pihole/config.json @@ -1,4 +1,5 @@ { + "$schema": "../schema.json", "name": "Pi-hole", "available": true, "port": 8081, diff --git a/apps/plex/config.json b/apps/plex/config.json index ca550a3d..75509024 100644 --- a/apps/plex/config.json +++ b/apps/plex/config.json @@ -1,4 +1,5 @@ { + "$schema": "../schema.json", "name": "Plex", "available": true, "port": 32400, diff --git a/apps/portainer/config.json b/apps/portainer/config.json index a03ebece..dbc0c686 100644 --- a/apps/portainer/config.json +++ b/apps/portainer/config.json @@ -1,4 +1,5 @@ { + "$schema": "../schema.json", "name": "Portainer", "port": 9443, "available": true, diff --git a/apps/prowlarr/config.json b/apps/prowlarr/config.json index 9a29cb82..9de9134c 100644 --- a/apps/prowlarr/config.json +++ b/apps/prowlarr/config.json @@ -1,4 +1,5 @@ { + "$schema": "../schema.json", "name": "Prowlarr", "available": true, "port": 8109, diff --git a/apps/proxitok/config.json b/apps/proxitok/config.json index d9eb07b2..df7e57ff 100644 --- a/apps/proxitok/config.json +++ b/apps/proxitok/config.json @@ -1,4 +1,5 @@ { + "$schema": "../schema.json", "name": "ProxiTok", "available": true, "port": 8118, diff --git a/apps/radarr/config.json b/apps/radarr/config.json index 7aefa8e2..dbec6420 100644 --- a/apps/radarr/config.json +++ b/apps/radarr/config.json @@ -1,4 +1,5 @@ { + "$schema": "../schema.json", "name": "Radarr", "available": true, "port": 8088, diff --git a/apps/readarr/config.json b/apps/readarr/config.json index edb60073..925a5a87 100644 --- a/apps/readarr/config.json +++ b/apps/readarr/config.json @@ -1,4 +1,5 @@ { + "$schema": "../schema.json", "name": "Readarr", "available": true, "port": 8112, diff --git a/apps/resilio-sync/config.json b/apps/resilio-sync/config.json index d3d0f2da..5146e296 100644 --- a/apps/resilio-sync/config.json +++ b/apps/resilio-sync/config.json @@ -1,4 +1,5 @@ { + "$schema": "../schema.json", "name": "Resilio", "port": 8113, "available": true, diff --git a/apps/schema.json b/apps/schema.json new file mode 100644 index 00000000..2fca809b --- /dev/null +++ b/apps/schema.json @@ -0,0 +1,119 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "type": "object", + "additionalProperties": false, + "properties": { + "$schema": { + "type": "string" + }, + "name": { + "type": "string" + }, + "available": { + "type": "boolean" + }, + "port": { + "type": "integer", + "minimum": 0, + "maximum": 65535 + }, + "requirements": { + "type": "object", + "properties": { + "ports": { + "type": "array", + "items": [ + { + "type": "integer" + } + ] + } + } + }, + "id": { + "type": "string", + "pattern": "^[a-z0-9-_]+$" + }, + "tipi_version": { + "type": "integer" + }, + "version": { + "type": "string" + }, + "categories": { + "type": "array", + "items": [ + { + "type": "string" + }, + { + "type": "string" + } + ] + }, + "description": { + "type": "string" + }, + "short_desc": { + "type": "string" + }, + "author": { + "type": "string" + }, + "source": { + "type": "string", + "format": "uri" + }, + "website": { + "type": "string", + "format": "uri" + }, + "url_suffix": { + "type": "string", + "pattern": "^/[a-z0-9-_]+$" + }, + "form_fields": { + "type": "array", + "items": [ + { + "type": "object", + "properties": { + "type": { + "type": "string" + }, + "label": { + "type": "string" + }, + "max": { + "type": "integer" + }, + "min": { + "type": "integer" + }, + "required": { + "type": "boolean" + }, + "env_variable": { + "type": "string" + } + }, + "required": ["type", "label", "env_variable"] + } + ] + } + }, + "required": [ + "name", + "available", + "port", + "id", + "tipi_version", + "version", + "categories", + "description", + "short_desc", + "author", + "source", + "form_fields" + ] +} diff --git a/apps/sonarr/config.json b/apps/sonarr/config.json index ffc8ca2b..2076b498 100644 --- a/apps/sonarr/config.json +++ b/apps/sonarr/config.json @@ -1,4 +1,5 @@ { + "$schema": "../schema.json", "name": "Sonarr", "available": true, "port": 8098, diff --git a/apps/syncthing/config.json b/apps/syncthing/config.json index 6330a800..b475652d 100644 --- a/apps/syncthing/config.json +++ b/apps/syncthing/config.json @@ -1,4 +1,5 @@ { + "$schema": "../schema.json", "name": "Syncthing", "available": true, "port": 8090, diff --git a/apps/tailscale/config.json b/apps/tailscale/config.json index c0180065..d53f98cc 100644 --- a/apps/tailscale/config.json +++ b/apps/tailscale/config.json @@ -1,4 +1,5 @@ { + "$schema": "../schema.json", "name": "Tailscale", "available": true, "port": 8093, diff --git a/apps/tautulli/config.json b/apps/tautulli/config.json index be260164..54d783e7 100644 --- a/apps/tautulli/config.json +++ b/apps/tautulli/config.json @@ -1,4 +1,5 @@ { + "$schema": "../schema.json", "name": "Tautulli", "available": true, "port": 8181, diff --git a/apps/transmission/config.json b/apps/transmission/config.json index f8aadf7f..448d9ffd 100644 --- a/apps/transmission/config.json +++ b/apps/transmission/config.json @@ -1,4 +1,5 @@ { + "$schema": "../schema.json", "name": "Transmission", "available": true, "port": 8089, diff --git a/apps/vaultwarden/config.json b/apps/vaultwarden/config.json index 751ff525..496dadc6 100644 --- a/apps/vaultwarden/config.json +++ b/apps/vaultwarden/config.json @@ -1,4 +1,5 @@ { + "$schema": "../schema.json", "name": "VaultWarden", "available": true, "port": 8107, diff --git a/apps/wg-easy/config.json b/apps/wg-easy/config.json index 53373f21..4ebb4be3 100644 --- a/apps/wg-easy/config.json +++ b/apps/wg-easy/config.json @@ -1,4 +1,5 @@ { + "$schema": "../schema.json", "name": "Wireguard", "available": true, "port": 8082, diff --git a/apps/your-spotify/config.json b/apps/your-spotify/config.json index 65e87d39..5fea2439 100644 --- a/apps/your-spotify/config.json +++ b/apps/your-spotify/config.json @@ -1,4 +1,5 @@ { + "$schema": "../schema.json", "name": "Your Spotify", "available": true, "port": 8103,