3 Commits

Author SHA1 Message Date
CDeenen
5c2357edd6 readme update 2020-11-18 02:58:33 +01:00
CDeenen
47ca57b9da v0.8.6 2020-11-18 02:57:47 +01:00
CDeenen
f7e98cbd50 v0.8.5 2020-11-17 06:51:14 +01:00
6 changed files with 48 additions and 18 deletions

View File

@@ -30,7 +30,7 @@ var enableModule;
//Websocket variables
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
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
@@ -41,11 +41,20 @@ let WSconnected = false;
*
* @param {*} msg Message received
*/
async function analyzeWSmessage(msg,passthrough = false){
async function analyzeWSmessage(msg){
if (enableModule == false) return;
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;
//console.log("Received",data);
const action = data.action;
const event = data.event;
const context = data.context;
@@ -114,11 +123,10 @@ async function analyzeWSmessage(msg,passthrough = false){
*/
function startWebsocket() {
//ip = localhost;
ws = new WebSocket('ws://'+ip+':'+port+'/1');
ws = new WebSocket('ws://'+ip+':'+port);
ws.onmessage = function(msg){
//console.log(msg);
analyzeWSmessage(msg.data);
clearInterval(wsInterval);
wsInterval = setInterval(resetWS, 5000);
@@ -128,10 +136,16 @@ function startWebsocket() {
WSconnected = true;
ui.notifications.info("Material Deck "+game.i18n.localize("MaterialDeck.Notifications.Connected") +": "+ip+':'+port);
wsOpen = true;
let msg = {
type: "Foundry"
const msg = {
target: "server",
module: "MD"
}
ws.send(JSON.stringify(msg));
const msg2 = {
target: "SD",
type: "init"
}
ws.send(JSON.stringify(msg2));
clearInterval(wsInterval);
wsInterval = setInterval(resetWS, 5000);
}

View File

@@ -7,6 +7,6 @@ Instructions are on the <a href="https://github.com/CDeenen/MaterialDeck/wiki">w
## Latest releases
<a href="https://github.com/CDeenen/MaterialDeck/releases">Module</a><br>
<a href="https://github.com/CDeenen/MaterialDeck_SD/releases">Stream Deck</a><br>
<a href="https://github.com/CDeenen/MaterialDeck_Server/releases">Server</a><br>
<a href="https://github.com/CDeenen/MaterialServer/releases">Server</a><br>
<br>
Module manifest: https://raw.githubusercontent.com/CDeenen/MaterialDeck/Master/module.json

View File

@@ -1,4 +1,13 @@
# 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
<ul>
<li>Added 'Display Icon' to Macro action</li>
@@ -12,6 +21,7 @@
<li>Added support for localization (module only)</li>
<li>Fixed issue where SD buttons would not load properly if Foundry was initialized before the SD, or if Foundry was refreshed</li>
<li>Long words now split up onto multiple lines</li>
<li>Confirmed compatibility with Foundry v0.7.7</li>
</ul>
<b>Compatible server app and SD plugin:</b><br>
Server v0.2.4 (no change)<br>

View File

@@ -1,6 +1,6 @@
{
"MaterialDeck.Notifications.Disconnected": "Disconnected from mdServer, attempting to reconnect",
"MaterialDeck.Notifications.ConnectFail": "Can't connect to mdServer, retrying",
"MaterialDeck.Notifications.Disconnected": "Disconnected from Material Server, attempting to reconnect",
"MaterialDeck.Notifications.ConnectFail": "Can't connect to Material Server, retrying",
"MaterialDeck.Notifications.Connected": "Connected",
"MaterialDeck.Sett.Enable": "Enable module",

View File

@@ -2,14 +2,14 @@
"name": "MaterialDeck",
"title": "Material Deck",
"description": "",
"version": "0.8.5",
"version": "0.8.6",
"author": "CDeenen",
"esmodules": [
"./MaterialDeck.js"
],
"socket": true,
"minimumCoreVersion": "0.7.5",
"compatibleCoreVersion": "0.7.6",
"compatibleCoreVersion": "0.7.7",
"languages": [
{
"lang": "en",

View File

@@ -144,6 +144,7 @@ export class StreamDeck{
}
}
let msg = {
target: "SD",
event: 'setTitle',
context: context,
payload: {
@@ -156,6 +157,7 @@ export class StreamDeck{
setColor(context,color = '#000000'){
let msg = {
target: "SD",
event: 'setIcon',
context: context,
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 json = {
target: "SD",
event: "setImage",
context: context,
payload: {
@@ -199,6 +202,7 @@ export class StreamDeck{
split = split[0].split(' ');
if (split[0] == 'fas' || split[0] == 'far' || split[0] == 'fal' || split[0] == 'fad') format = 'icon';
let msg = {
target: "SD",
event: 'setIcon',
context: context,
url: src,
@@ -217,6 +221,7 @@ export class StreamDeck{
setState(state,context,action){
let msg = {
target: "SD",
event: 'setStateCustom',
context: context,
action: action,
@@ -230,12 +235,13 @@ export class StreamDeck{
if (action == 'playlistcontrol')
profile = 'MaterialDeck-Playlist'
var json = {
"source": 1,
"event": "switchToProfile",
"context": this.pluginId,
"device": device,
"payload": {
"profile": profile
target: "SD",
source: 1,
event: "switchToProfile",
context: this.pluginId,
device: device,
payload: {
profile: profile
}
};
MODULE.sendWS(JSON.stringify(json));