-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0a7b203
commit b5225c2
Showing
25 changed files
with
3,665 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+17.9 KB
Sources/com.streamtools.webhooks.sdPlugin/action/images/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+521 Bytes
Sources/com.streamtools.webhooks.sdPlugin/action/images/actionimage.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+988 Bytes
Sources/com.streamtools.webhooks.sdPlugin/action/images/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
/* global $CC, Utils, $SD */ | ||
|
||
/** | ||
* Here are a couple of wrappers we created to help ypu quickly setup | ||
* your plugin and subscribe to events sent by Stream Deck to your plugin. | ||
*/ | ||
|
||
/** | ||
* The 'connected' event is sent to your plugin, after the plugin's instance | ||
* is registered with Stream Deck software. It carries the current websocket | ||
* and other information about the current environmet in a JSON object | ||
* You can use it to subscribe to events you want to use in your plugin. | ||
*/ | ||
|
||
$SD.on('connected', (jsonObj) => connected(jsonObj)); | ||
|
||
function connected(jsn) { | ||
/** subscribe to the willAppear and other events */ | ||
$SD.on('com.streamtools.webhooks.action.willAppear', (jsonObj) => action.onWillAppear(jsonObj)); | ||
$SD.on('com.streamtools.webhooks.action.keyUp', (jsonObj) => action.onKeyUp(jsonObj)); | ||
$SD.on('com.streamtools.webhooks.action.sendToPlugin', (jsonObj) => action.onSendToPlugin(jsonObj)); | ||
$SD.on('com.streamtools.webhooks.action.didReceiveSettings', (jsonObj) => action.onDidReceiveSettings(jsonObj)); | ||
$SD.on('com.streamtools.webhooks.action.propertyInspectorDidAppear', (jsonObj) => { | ||
console.log('%c%s', 'color: white; background: black; font-size: 13px;', '[app.js]propertyInspectorDidAppear:'); | ||
}); | ||
$SD.on('com.streamtools.webhooks.action.propertyInspectorDidDisappear', (jsonObj) => { | ||
console.log('%c%s', 'color: white; background: red; font-size: 13px;', '[app.js]propertyInspectorDidDisappear:'); | ||
}); | ||
}; | ||
|
||
/** ACTIONS */ | ||
|
||
const action = { | ||
settings:{}, | ||
onDidReceiveSettings: function(jsonObj) { | ||
console.log(`[onDidReceiveMessage] ${JSON.stringify(jsonObj)}`); | ||
}, | ||
|
||
/** | ||
* The 'willAppear' event is the first event a key will receive, right before it gets | ||
* showed on your Stream Deck and/or in Stream Deck software. | ||
* This event is a good place to setup your plugin and look at current settings (if any), | ||
* which are embedded in the events payload. | ||
*/ | ||
|
||
onWillAppear: function (jsonObj) { | ||
$SD.api.sendToPropertyInspector(jsonObj.context, Utils.getProp(jsonObj, "payload.settings", {}), jsonObj.action); | ||
}, | ||
|
||
onKeyUp: function (jsonObj) { | ||
if (!jsonObj.payload.settings || !jsonObj.payload.settings.streamtoolsapikey || !jsonObj.payload.settings.widgetid) { | ||
$SD.api.showAlert(jsonObj.context); | ||
return; | ||
} | ||
let url = 'http://streamtools.local.com/webhook/'+jsonObj.payload.settings.widgettype+'/'+jsonObj.payload.settings.widgetid; | ||
fetch(url, { | ||
"method": 'POST', | ||
"headers": { | ||
"content-type": "application/json", | ||
'X-API-KEY': jsonObj.payload.settings.streamtoolsapikey | ||
}, | ||
"body": {'action': jsonObj.payload.settings.webhookpayload} | ||
}).then(result => $SD.api.showOk(jsonObj.context), error => $SD.api.showAlert(jsonObj.context)); | ||
}, | ||
|
||
onSendToPlugin: function (jsonObj) { | ||
/** | ||
* this is a message sent directly from the Property Inspector | ||
* (e.g. some value, which is not saved to settings) | ||
* You can send this event from Property Inspector (see there for an example) | ||
*/ | ||
|
||
if(jsonObj.payload) { | ||
$SD.api.setSettings(jsonObj.context, jsonObj.payload); | ||
} | ||
}, | ||
|
||
/** | ||
* This snippet shows, how you could save settings persistantly to Stream Deck software | ||
* It is not used in this example plugin. | ||
*/ | ||
|
||
saveSettings: function (jsn, sdpi_collection) { | ||
console.log('saveSettings:', jsn); | ||
if (sdpi_collection.hasOwnProperty('key') && sdpi_collection.key != '') { | ||
if (sdpi_collection.value && sdpi_collection.value !== undefined) { | ||
this.settings[sdpi_collection.key] = sdpi_collection.value; | ||
console.log('setSettings....', this.settings); | ||
$SD.api.setSettings(jsn.context, this.settings); | ||
} | ||
} | ||
}, | ||
}; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"Description": "Send an action request to a Streamtools widget with remote webhook API", | ||
"Name": "Streamtools Webhook", | ||
"Category": "Templates", | ||
"com.streamtools.webhooks.action": { | ||
"Name": "Send action", | ||
"Tooltip": "Send an action request to a Streamtools widget with remote webhook API" | ||
}, | ||
"Localization": { | ||
"More info": "More info", | ||
"Message": "Message", | ||
"Click Me": "Click Me", | ||
"Button": "Button" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"Description": "Envia una solicitud de acción a un widget de Streamtools con la API", | ||
"Name": "Streamtools Webhook", | ||
"Category": "Templates", | ||
"com.streamtools.webhooks.action": { | ||
"Name": "Enviar acción", | ||
"Tooltip": "Envia una solicitud de acción a un widget de Streamtools con la API" | ||
}, | ||
"Localization": { | ||
"More info": "Más info", | ||
"Message": "Mensaje", | ||
"Click Me": "Haz click", | ||
"Button": "Botón" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<!DOCTYPE HTML> | ||
<html> | ||
|
||
<head> | ||
<title>Streamtools Webhook</title> | ||
<meta charset="utf-8" /> | ||
<style> | ||
canvas { | ||
background-color:transparent; | ||
} | ||
</style> | ||
</head> | ||
|
||
<body> | ||
<script src="propertyinspector/js/common.js"></script> | ||
<script src="app.js"></script> | ||
</body> | ||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
{ | ||
"Actions": [ | ||
{ | ||
"Icon": "action/images/actionimage", | ||
"Name": "Webhooks", | ||
"States": [ | ||
{ | ||
"Image": "action/images/action", | ||
"TitleAlignment": "bottom", | ||
"FontSize": "10" | ||
} | ||
], | ||
"SupportedInMultiActions": true, | ||
"Tooltip": "Send an action request to a Streamtools widget with remote webhook API", | ||
"UUID": "com.streamtools.webhooks.action" | ||
} | ||
], | ||
"SDKVersion": 2, | ||
"Author": "Alberto González Catalán", | ||
"CodePath": "index.html", | ||
"PropertyInspectorPath": "propertyinspector/index.html", | ||
"Description": "Send an action request to a Streamtools widget with remote webhook API", | ||
"Name": "Streamtools Webhook", | ||
"Icon": "action/images/action", | ||
"URL": "https://streamtools.com", | ||
"Version": "1.0.0", | ||
"OS": [ | ||
{ | ||
"Platform": "mac", | ||
"MinimumVersion" : "10.11" | ||
}, | ||
{ | ||
"Platform": "windows", | ||
"MinimumVersion" : "10" | ||
} | ||
], | ||
"Software": | ||
{ | ||
"MinimumVersion" : "4.1" | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
Sources/com.streamtools.webhooks.sdPlugin/propertyinspector/css/caret.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+234 Bytes
Sources/com.streamtools.webhooks.sdPlugin/propertyinspector/css/check.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions
3
Sources/com.streamtools.webhooks.sdPlugin/propertyinspector/css/check.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 24 additions & 0 deletions
24
Sources/com.streamtools.webhooks.sdPlugin/propertyinspector/css/elg_calendar.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions
7
...es/com.streamtools.webhooks.sdPlugin/propertyinspector/css/elg_calendar_inv.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions
10
Sources/com.streamtools.webhooks.sdPlugin/propertyinspector/css/g_d8d8d8.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions
3
Sources/com.streamtools.webhooks.sdPlugin/propertyinspector/css/rcheck.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.