From b1c3049fc154b08f934ab58251844b32678a6f60 Mon Sep 17 00:00:00 2001 From: Alexander Lohnau Date: Thu, 30 May 2024 22:12:13 +0200 Subject: [PATCH] Add custom JSON schema, extending KPluginMetaData and enforcing KDE-Connect specific keys --- plugins/battery/kdeconnect_battery.json | 1 + plugins/bigscreen/kdeconnect_bigscreen.json | 1 + plugins/clipboard/kdeconnect_clipboard.json | 1 + .../kdeconnect_connectivity_report.json | 1 + plugins/contacts/kdeconnect_contacts.json | 2 +- .../findmyphone/kdeconnect_findmyphone.json | 4 +- .../kdeconnect_findthisdevice.json | 4 +- plugins/kdeconnect.schema.json | 47 +++++++++++++++++++ plugins/lockdevice/kdeconnect_lockdevice.json | 1 + .../mmtelephony/kdeconnect_mmtelephony.json | 1 + plugins/mousepad/kdeconnect_mousepad.json | 1 + .../mpriscontrol/kdeconnect_mpriscontrol.json | 1 + .../mprisremote/kdeconnect_mprisremote.json | 1 + .../kdeconnect_notifications.json | 1 + plugins/pausemusic/kdeconnect_pausemusic.json | 4 +- plugins/ping/kdeconnect_ping.json | 1 + plugins/presenter/kdeconnect_presenter.json | 1 + .../kdeconnect_remotecommands.json | 1 + .../kdeconnect_remotecontrol.json | 1 + .../kdeconnect_remotekeyboard.json | 1 + .../kdeconnect_remotesystemvolume.json | 1 + plugins/runcommand/kdeconnect_runcommand.json | 1 + .../kdeconnect_screensaver_inhibit.json | 5 +- .../kdeconnect_sendnotifications.json | 1 + plugins/sftp/kdeconnect_sftp.json | 1 + plugins/share/kdeconnect_share.json | 1 + plugins/sms/kdeconnect_sms.json | 1 + .../systemvolume/kdeconnect_systemvolume.json | 2 +- plugins/telephony/kdeconnect_telephony.json | 1 + .../kdeconnect_virtualmonitor.json | 1 + 30 files changed, 85 insertions(+), 6 deletions(-) create mode 100644 plugins/kdeconnect.schema.json diff --git a/plugins/battery/kdeconnect_battery.json b/plugins/battery/kdeconnect_battery.json index b45ed5278..6fd46dafa 100644 --- a/plugins/battery/kdeconnect_battery.json +++ b/plugins/battery/kdeconnect_battery.json @@ -1,4 +1,5 @@ { + "$schema": "../kdeconnect.schema.json", "KPlugin": { "Authors": [ { diff --git a/plugins/bigscreen/kdeconnect_bigscreen.json b/plugins/bigscreen/kdeconnect_bigscreen.json index 68aa798dc..6de7052f2 100644 --- a/plugins/bigscreen/kdeconnect_bigscreen.json +++ b/plugins/bigscreen/kdeconnect_bigscreen.json @@ -1,4 +1,5 @@ { + "$schema": "../kdeconnect.schema.json", "KPlugin": { "Authors": [ { diff --git a/plugins/clipboard/kdeconnect_clipboard.json b/plugins/clipboard/kdeconnect_clipboard.json index c9e763427..6b4a7d5fc 100644 --- a/plugins/clipboard/kdeconnect_clipboard.json +++ b/plugins/clipboard/kdeconnect_clipboard.json @@ -1,4 +1,5 @@ { + "$schema": "../kdeconnect.schema.json", "KPlugin": { "Authors": [ { diff --git a/plugins/connectivity-report/kdeconnect_connectivity_report.json b/plugins/connectivity-report/kdeconnect_connectivity_report.json index a06f2a77e..80649106f 100644 --- a/plugins/connectivity-report/kdeconnect_connectivity_report.json +++ b/plugins/connectivity-report/kdeconnect_connectivity_report.json @@ -1,4 +1,5 @@ { + "$schema": "../kdeconnect.schema.json", "KPlugin": { "Authors": [ { diff --git a/plugins/contacts/kdeconnect_contacts.json b/plugins/contacts/kdeconnect_contacts.json index 65cd43ffe..8908ccd33 100644 --- a/plugins/contacts/kdeconnect_contacts.json +++ b/plugins/contacts/kdeconnect_contacts.json @@ -1,5 +1,5 @@ { - "Encoding": "UTF-8", + "$schema": "../kdeconnect.schema.json", "KPlugin": { "Authors": [ { diff --git a/plugins/findmyphone/kdeconnect_findmyphone.json b/plugins/findmyphone/kdeconnect_findmyphone.json index 03236a527..e0be7c9ab 100644 --- a/plugins/findmyphone/kdeconnect_findmyphone.json +++ b/plugins/findmyphone/kdeconnect_findmyphone.json @@ -1,4 +1,5 @@ { + "$schema": "../kdeconnect.schema.json", "KPlugin": { "Authors": [ { @@ -132,5 +133,6 @@ }, "X-KdeConnect-OutgoingPacketType": [ "kdeconnect.findmyphone.request" - ] + ], + "X-KdeConnect-SupportedPacketType": [] } diff --git a/plugins/findthisdevice/kdeconnect_findthisdevice.json b/plugins/findthisdevice/kdeconnect_findthisdevice.json index 2430e7833..aa6656db8 100644 --- a/plugins/findthisdevice/kdeconnect_findthisdevice.json +++ b/plugins/findthisdevice/kdeconnect_findthisdevice.json @@ -1,4 +1,5 @@ { + "$schema": "../kdeconnect.schema.json", "KPlugin": { "Authors": [ { @@ -111,5 +112,6 @@ "X-KDE-ConfigModule": "kdeconnect/kcms/kdeconnect_findthisdevice_config", "X-KdeConnect-SupportedPacketType": [ "kdeconnect.findmyphone.request" - ] + ], + "X-KdeConnect-OutgoingPacketType": [] } diff --git a/plugins/kdeconnect.schema.json b/plugins/kdeconnect.schema.json new file mode 100644 index 000000000..9a084f893 --- /dev/null +++ b/plugins/kdeconnect.schema.json @@ -0,0 +1,47 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "allOf": [ + { + "$ref": "https://autoconfig.kde.org/jsonschemas/kpluginmetadata.schema.json" + }, + { + "type": "object", + "additionalProperties": false, + "required": [ + "KPlugin", + "X-KdeConnect-SupportedPacketType", + "X-KdeConnect-OutgoingPacketType" + ], + "properties": { + "$schema": { + "type": "string" + }, + "KPlugin": { + "type": "object" + }, + "X-KdeConnect-SupportedPacketType": { + "type": "array", + "items": { + "type": "string" + } + }, + "X-KdeConnect-OutgoingPacketType": { + "type": "array", + "items": { + "type": "string" + } + }, + "X-KdeConnect-SupportedDeviceTypes": { + "type": "array", + "items": { + "type": "string" + } + }, + "X-KDE-ConfigModule": { + "type": "string", + "pattern": "^kdeconnect/kcms/[^/]+$" + } + } + } + ] +} diff --git a/plugins/lockdevice/kdeconnect_lockdevice.json b/plugins/lockdevice/kdeconnect_lockdevice.json index 64343d996..39aa3866a 100644 --- a/plugins/lockdevice/kdeconnect_lockdevice.json +++ b/plugins/lockdevice/kdeconnect_lockdevice.json @@ -1,4 +1,5 @@ { + "$schema": "../kdeconnect.schema.json", "KPlugin": { "Authors": [ { diff --git a/plugins/mmtelephony/kdeconnect_mmtelephony.json b/plugins/mmtelephony/kdeconnect_mmtelephony.json index ff674e26f..75360c1a4 100644 --- a/plugins/mmtelephony/kdeconnect_mmtelephony.json +++ b/plugins/mmtelephony/kdeconnect_mmtelephony.json @@ -1,4 +1,5 @@ { + "$schema": "../kdeconnect.schema.json", "KPlugin": { "Authors": [ { diff --git a/plugins/mousepad/kdeconnect_mousepad.json b/plugins/mousepad/kdeconnect_mousepad.json index a29767a78..dadd3b0c6 100644 --- a/plugins/mousepad/kdeconnect_mousepad.json +++ b/plugins/mousepad/kdeconnect_mousepad.json @@ -1,4 +1,5 @@ { + "$schema": "../kdeconnect.schema.json", "KPlugin": { "Authors": [ { diff --git a/plugins/mpriscontrol/kdeconnect_mpriscontrol.json b/plugins/mpriscontrol/kdeconnect_mpriscontrol.json index 3c438033d..a571cddb5 100644 --- a/plugins/mpriscontrol/kdeconnect_mpriscontrol.json +++ b/plugins/mpriscontrol/kdeconnect_mpriscontrol.json @@ -1,4 +1,5 @@ { + "$schema": "../kdeconnect.schema.json", "KPlugin": { "Authors": [ { diff --git a/plugins/mprisremote/kdeconnect_mprisremote.json b/plugins/mprisremote/kdeconnect_mprisremote.json index e928883a7..de1b03ae7 100644 --- a/plugins/mprisremote/kdeconnect_mprisremote.json +++ b/plugins/mprisremote/kdeconnect_mprisremote.json @@ -1,4 +1,5 @@ { + "$schema": "../kdeconnect.schema.json", "KPlugin": { "Authors": [ { diff --git a/plugins/notifications/kdeconnect_notifications.json b/plugins/notifications/kdeconnect_notifications.json index 96bbfcfbe..6e1af25bb 100644 --- a/plugins/notifications/kdeconnect_notifications.json +++ b/plugins/notifications/kdeconnect_notifications.json @@ -1,4 +1,5 @@ { + "$schema": "../kdeconnect.schema.json", "KPlugin": { "Authors": [ { diff --git a/plugins/pausemusic/kdeconnect_pausemusic.json b/plugins/pausemusic/kdeconnect_pausemusic.json index 3d4230e82..008792b5f 100644 --- a/plugins/pausemusic/kdeconnect_pausemusic.json +++ b/plugins/pausemusic/kdeconnect_pausemusic.json @@ -1,4 +1,5 @@ { + "$schema": "../kdeconnect.schema.json", "KPlugin": { "Authors": [ { @@ -116,5 +117,6 @@ "X-KDE-ConfigModule": "kdeconnect/kcms/kdeconnect_pausemusic_config", "X-KdeConnect-SupportedPacketType": [ "kdeconnect.telephony" - ] + ], + "X-KdeConnect-OutgoingPacketType": [] } diff --git a/plugins/ping/kdeconnect_ping.json b/plugins/ping/kdeconnect_ping.json index 2e4ba1d31..0641f66fc 100644 --- a/plugins/ping/kdeconnect_ping.json +++ b/plugins/ping/kdeconnect_ping.json @@ -1,4 +1,5 @@ { + "$schema": "../kdeconnect.schema.json", "KPlugin": { "Authors": [ { diff --git a/plugins/presenter/kdeconnect_presenter.json b/plugins/presenter/kdeconnect_presenter.json index 367c08d15..414adb9d1 100644 --- a/plugins/presenter/kdeconnect_presenter.json +++ b/plugins/presenter/kdeconnect_presenter.json @@ -1,4 +1,5 @@ { + "$schema": "../kdeconnect.schema.json", "KPlugin": { "Authors": [ { diff --git a/plugins/remotecommands/kdeconnect_remotecommands.json b/plugins/remotecommands/kdeconnect_remotecommands.json index 79bd274d7..5cebfc892 100644 --- a/plugins/remotecommands/kdeconnect_remotecommands.json +++ b/plugins/remotecommands/kdeconnect_remotecommands.json @@ -1,4 +1,5 @@ { + "$schema": "../kdeconnect.schema.json", "KPlugin": { "Authors": [ { diff --git a/plugins/remotecontrol/kdeconnect_remotecontrol.json b/plugins/remotecontrol/kdeconnect_remotecontrol.json index a2a86e9e7..de2283ee4 100644 --- a/plugins/remotecontrol/kdeconnect_remotecontrol.json +++ b/plugins/remotecontrol/kdeconnect_remotecontrol.json @@ -1,4 +1,5 @@ { + "$schema": "../kdeconnect.schema.json", "KPlugin": { "Authors": [ { diff --git a/plugins/remotekeyboard/kdeconnect_remotekeyboard.json b/plugins/remotekeyboard/kdeconnect_remotekeyboard.json index 631a03cfa..8e340afe3 100644 --- a/plugins/remotekeyboard/kdeconnect_remotekeyboard.json +++ b/plugins/remotekeyboard/kdeconnect_remotekeyboard.json @@ -1,4 +1,5 @@ { + "$schema": "../kdeconnect.schema.json", "KPlugin": { "Authors": [ { diff --git a/plugins/remotesystemvolume/kdeconnect_remotesystemvolume.json b/plugins/remotesystemvolume/kdeconnect_remotesystemvolume.json index 17e8c7972..f7a719c32 100644 --- a/plugins/remotesystemvolume/kdeconnect_remotesystemvolume.json +++ b/plugins/remotesystemvolume/kdeconnect_remotesystemvolume.json @@ -1,4 +1,5 @@ { + "$schema": "../kdeconnect.schema.json", "KPlugin": { "Authors": [ { diff --git a/plugins/runcommand/kdeconnect_runcommand.json b/plugins/runcommand/kdeconnect_runcommand.json index 412316bf5..080f2af26 100644 --- a/plugins/runcommand/kdeconnect_runcommand.json +++ b/plugins/runcommand/kdeconnect_runcommand.json @@ -1,4 +1,5 @@ { + "$schema": "../kdeconnect.schema.json", "KPlugin": { "Authors": [ { diff --git a/plugins/screensaver-inhibit/kdeconnect_screensaver_inhibit.json b/plugins/screensaver-inhibit/kdeconnect_screensaver_inhibit.json index b450f4737..b8b4a0f91 100644 --- a/plugins/screensaver-inhibit/kdeconnect_screensaver_inhibit.json +++ b/plugins/screensaver-inhibit/kdeconnect_screensaver_inhibit.json @@ -1,4 +1,5 @@ { + "$schema": "../kdeconnect.schema.json", "KPlugin": { "Authors": [ { @@ -111,5 +112,7 @@ "Name[x-test]": "xxInhibit screensaverxx", "Name[zh_CN]": "禁止屏保", "Name[zh_TW]": "停止螢幕保護" - } + }, + "X-KdeConnect-SupportedPacketType": [], + "X-KdeConnect-OutgoingPacketType": [] } diff --git a/plugins/sendnotifications/kdeconnect_sendnotifications.json b/plugins/sendnotifications/kdeconnect_sendnotifications.json index 79dcb11f3..0c36f02a5 100644 --- a/plugins/sendnotifications/kdeconnect_sendnotifications.json +++ b/plugins/sendnotifications/kdeconnect_sendnotifications.json @@ -1,4 +1,5 @@ { + "$schema": "../kdeconnect.schema.json", "KPlugin": { "Authors": [ { diff --git a/plugins/sftp/kdeconnect_sftp.json b/plugins/sftp/kdeconnect_sftp.json index 9f885b5e7..9cefc1a25 100644 --- a/plugins/sftp/kdeconnect_sftp.json +++ b/plugins/sftp/kdeconnect_sftp.json @@ -1,4 +1,5 @@ { + "$schema": "../kdeconnect.schema.json", "KPlugin": { "Authors": [ { diff --git a/plugins/share/kdeconnect_share.json b/plugins/share/kdeconnect_share.json index d2f754467..c441952f0 100644 --- a/plugins/share/kdeconnect_share.json +++ b/plugins/share/kdeconnect_share.json @@ -1,4 +1,5 @@ { + "$schema": "../kdeconnect.schema.json", "KPlugin": { "Authors": [ { diff --git a/plugins/sms/kdeconnect_sms.json b/plugins/sms/kdeconnect_sms.json index 3e3a168fe..9316cecae 100644 --- a/plugins/sms/kdeconnect_sms.json +++ b/plugins/sms/kdeconnect_sms.json @@ -1,4 +1,5 @@ { + "$schema": "../kdeconnect.schema.json", "KPlugin": { "Authors": [ { diff --git a/plugins/systemvolume/kdeconnect_systemvolume.json b/plugins/systemvolume/kdeconnect_systemvolume.json index 00c88b235..ea09399f0 100644 --- a/plugins/systemvolume/kdeconnect_systemvolume.json +++ b/plugins/systemvolume/kdeconnect_systemvolume.json @@ -1,5 +1,5 @@ { - "Encoding": "UTF-8", + "$schema": "../kdeconnect.schema.json", "KPlugin": { "Authors": [ { diff --git a/plugins/telephony/kdeconnect_telephony.json b/plugins/telephony/kdeconnect_telephony.json index 9392c8e80..6012e4497 100644 --- a/plugins/telephony/kdeconnect_telephony.json +++ b/plugins/telephony/kdeconnect_telephony.json @@ -1,4 +1,5 @@ { + "$schema": "../kdeconnect.schema.json", "KPlugin": { "Authors": [ { diff --git a/plugins/virtualmonitor/kdeconnect_virtualmonitor.json b/plugins/virtualmonitor/kdeconnect_virtualmonitor.json index 5949e2da1..f5a02203d 100644 --- a/plugins/virtualmonitor/kdeconnect_virtualmonitor.json +++ b/plugins/virtualmonitor/kdeconnect_virtualmonitor.json @@ -1,4 +1,5 @@ { + "$schema": "../kdeconnect.schema.json", "KPlugin": { "Authors": [ {