v0.8.6
This commit is contained in:
@@ -30,7 +30,7 @@ var enableModule;
|
|||||||
|
|
||||||
//Websocket variables
|
//Websocket variables
|
||||||
let ip = "localhost"; //Ip address of the websocket server
|
let ip = "localhost"; //Ip address of the websocket server
|
||||||
let port = "3003"; //Port of the websocket server
|
let port = "3001"; //Port of the websocket server
|
||||||
var ws; //Websocket variable
|
var ws; //Websocket variable
|
||||||
let wsOpen = false; //Bool for checking if websocket has ever been opened => changes the warning message if there's no connection
|
let wsOpen = false; //Bool for checking if websocket has ever been opened => changes the warning message if there's no connection
|
||||||
let wsInterval; //Interval timer to detect disconnections
|
let wsInterval; //Interval timer to detect disconnections
|
||||||
@@ -41,11 +41,20 @@ let WSconnected = false;
|
|||||||
*
|
*
|
||||||
* @param {*} msg Message received
|
* @param {*} msg Message received
|
||||||
*/
|
*/
|
||||||
async function analyzeWSmessage(msg,passthrough = false){
|
async function analyzeWSmessage(msg){
|
||||||
if (enableModule == false) return;
|
if (enableModule == false) return;
|
||||||
const data = JSON.parse(msg);
|
const data = JSON.parse(msg);
|
||||||
|
//console.log("Received",data);
|
||||||
|
|
||||||
|
if (data.type == "connected" && data.data == "SD"){
|
||||||
|
console.log("streamdeck connected to server");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (data == undefined || data.payload == undefined) return;
|
if (data == undefined || data.payload == undefined) return;
|
||||||
//console.log("Received",data);
|
|
||||||
const action = data.action;
|
const action = data.action;
|
||||||
const event = data.event;
|
const event = data.event;
|
||||||
const context = data.context;
|
const context = data.context;
|
||||||
@@ -114,11 +123,10 @@ async function analyzeWSmessage(msg,passthrough = false){
|
|||||||
*/
|
*/
|
||||||
function startWebsocket() {
|
function startWebsocket() {
|
||||||
//ip = localhost;
|
//ip = localhost;
|
||||||
ws = new WebSocket('ws://'+ip+':'+port+'/1');
|
ws = new WebSocket('ws://'+ip+':'+port);
|
||||||
|
|
||||||
ws.onmessage = function(msg){
|
ws.onmessage = function(msg){
|
||||||
//console.log(msg);
|
//console.log(msg);
|
||||||
|
|
||||||
analyzeWSmessage(msg.data);
|
analyzeWSmessage(msg.data);
|
||||||
clearInterval(wsInterval);
|
clearInterval(wsInterval);
|
||||||
wsInterval = setInterval(resetWS, 5000);
|
wsInterval = setInterval(resetWS, 5000);
|
||||||
@@ -128,10 +136,16 @@ function startWebsocket() {
|
|||||||
WSconnected = true;
|
WSconnected = true;
|
||||||
ui.notifications.info("Material Deck "+game.i18n.localize("MaterialDeck.Notifications.Connected") +": "+ip+':'+port);
|
ui.notifications.info("Material Deck "+game.i18n.localize("MaterialDeck.Notifications.Connected") +": "+ip+':'+port);
|
||||||
wsOpen = true;
|
wsOpen = true;
|
||||||
let msg = {
|
const msg = {
|
||||||
type: "Foundry"
|
target: "server",
|
||||||
|
module: "MD"
|
||||||
}
|
}
|
||||||
ws.send(JSON.stringify(msg));
|
ws.send(JSON.stringify(msg));
|
||||||
|
const msg2 = {
|
||||||
|
target: "SD",
|
||||||
|
type: "init"
|
||||||
|
}
|
||||||
|
ws.send(JSON.stringify(msg2));
|
||||||
clearInterval(wsInterval);
|
clearInterval(wsInterval);
|
||||||
wsInterval = setInterval(resetWS, 5000);
|
wsInterval = setInterval(resetWS, 5000);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,13 @@
|
|||||||
# Changelog Material Deck Module
|
# Changelog Material Deck Module
|
||||||
|
### v0.8.6 - 18-11-2020
|
||||||
|
<ul>
|
||||||
|
<li>Added support for the new Material Server app</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<b>Compatible server app and SD plugin:</b><br>
|
||||||
|
Material Server v1.0.0: https://github.com/CDeenen/MaterialServer/releases <br>
|
||||||
|
SD plugin v0.7.3: https://github.com/CDeenen/MaterialDeck_SD/releases<br>
|
||||||
|
|
||||||
### v0.8.5 - 17-11-2020
|
### v0.8.5 - 17-11-2020
|
||||||
<ul>
|
<ul>
|
||||||
<li>Added 'Display Icon' to Macro action</li>
|
<li>Added 'Display Icon' to Macro action</li>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"MaterialDeck.Notifications.Disconnected": "Disconnected from mdServer, attempting to reconnect",
|
"MaterialDeck.Notifications.Disconnected": "Disconnected from Material Server, attempting to reconnect",
|
||||||
"MaterialDeck.Notifications.ConnectFail": "Can't connect to mdServer, retrying",
|
"MaterialDeck.Notifications.ConnectFail": "Can't connect to Material Server, retrying",
|
||||||
"MaterialDeck.Notifications.Connected": "Connected",
|
"MaterialDeck.Notifications.Connected": "Connected",
|
||||||
|
|
||||||
"MaterialDeck.Sett.Enable": "Enable module",
|
"MaterialDeck.Sett.Enable": "Enable module",
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
"name": "MaterialDeck",
|
"name": "MaterialDeck",
|
||||||
"title": "Material Deck",
|
"title": "Material Deck",
|
||||||
"description": "",
|
"description": "",
|
||||||
"version": "0.8.5",
|
"version": "0.8.6",
|
||||||
"author": "CDeenen",
|
"author": "CDeenen",
|
||||||
"esmodules": [
|
"esmodules": [
|
||||||
"./MaterialDeck.js"
|
"./MaterialDeck.js"
|
||||||
|
|||||||
@@ -144,6 +144,7 @@ export class StreamDeck{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
let msg = {
|
let msg = {
|
||||||
|
target: "SD",
|
||||||
event: 'setTitle',
|
event: 'setTitle',
|
||||||
context: context,
|
context: context,
|
||||||
payload: {
|
payload: {
|
||||||
@@ -156,6 +157,7 @@ export class StreamDeck{
|
|||||||
|
|
||||||
setColor(context,color = '#000000'){
|
setColor(context,color = '#000000'){
|
||||||
let msg = {
|
let msg = {
|
||||||
|
target: "SD",
|
||||||
event: 'setIcon',
|
event: 'setIcon',
|
||||||
context: context,
|
context: context,
|
||||||
url: '',
|
url: '',
|
||||||
@@ -169,6 +171,7 @@ export class StreamDeck{
|
|||||||
//var image = "data:image/svg+xml;charset=utf8,<?xml version=\"1.0\" encoding=\"iso-8859-1\"?><!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --><svg version=\"1.1\" id=\"Capa_1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" x=\"0px\" y=\"0px\" viewBox=\"0 0 288 288\" style=\"enable-background:new 0 0 288 288;\" xml:space=\"preserve\"> <style> .text { font-family: sans-serif; fill: red; font-size: 10em; } </style><g> <text x=\"0px\" y=\"100px\" class=\"text\">GPUUTILIZATION</text></g></svg>";
|
//var image = "data:image/svg+xml;charset=utf8,<?xml version=\"1.0\" encoding=\"iso-8859-1\"?><!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --><svg version=\"1.1\" id=\"Capa_1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" x=\"0px\" y=\"0px\" viewBox=\"0 0 288 288\" style=\"enable-background:new 0 0 288 288;\" xml:space=\"preserve\"> <style> .text { font-family: sans-serif; fill: red; font-size: 10em; } </style><g> <text x=\"0px\" y=\"100px\" class=\"text\">GPUUTILIZATION</text></g></svg>";
|
||||||
|
|
||||||
var json = {
|
var json = {
|
||||||
|
target: "SD",
|
||||||
event: "setImage",
|
event: "setImage",
|
||||||
context: context,
|
context: context,
|
||||||
payload: {
|
payload: {
|
||||||
@@ -199,6 +202,7 @@ export class StreamDeck{
|
|||||||
split = split[0].split(' ');
|
split = split[0].split(' ');
|
||||||
if (split[0] == 'fas' || split[0] == 'far' || split[0] == 'fal' || split[0] == 'fad') format = 'icon';
|
if (split[0] == 'fas' || split[0] == 'far' || split[0] == 'fal' || split[0] == 'fad') format = 'icon';
|
||||||
let msg = {
|
let msg = {
|
||||||
|
target: "SD",
|
||||||
event: 'setIcon',
|
event: 'setIcon',
|
||||||
context: context,
|
context: context,
|
||||||
url: src,
|
url: src,
|
||||||
@@ -217,6 +221,7 @@ export class StreamDeck{
|
|||||||
|
|
||||||
setState(state,context,action){
|
setState(state,context,action){
|
||||||
let msg = {
|
let msg = {
|
||||||
|
target: "SD",
|
||||||
event: 'setStateCustom',
|
event: 'setStateCustom',
|
||||||
context: context,
|
context: context,
|
||||||
action: action,
|
action: action,
|
||||||
@@ -230,12 +235,13 @@ export class StreamDeck{
|
|||||||
if (action == 'playlistcontrol')
|
if (action == 'playlistcontrol')
|
||||||
profile = 'MaterialDeck-Playlist'
|
profile = 'MaterialDeck-Playlist'
|
||||||
var json = {
|
var json = {
|
||||||
"source": 1,
|
target: "SD",
|
||||||
"event": "switchToProfile",
|
source: 1,
|
||||||
"context": this.pluginId,
|
event: "switchToProfile",
|
||||||
"device": device,
|
context: this.pluginId,
|
||||||
"payload": {
|
device: device,
|
||||||
"profile": profile
|
payload: {
|
||||||
|
profile: profile
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
MODULE.sendWS(JSON.stringify(json));
|
MODULE.sendWS(JSON.stringify(json));
|
||||||
|
|||||||
Reference in New Issue
Block a user