version check hotfix
This commit is contained in:
@@ -8,7 +8,7 @@ import {SoundboardControl} from "./src/soundboard.js";
|
|||||||
import {OtherControls} from "./src/othercontrols.js";
|
import {OtherControls} from "./src/othercontrols.js";
|
||||||
import {ExternalModules} from "./src/external.js";
|
import {ExternalModules} from "./src/external.js";
|
||||||
import {SceneControl} from "./src/scene.js";
|
import {SceneControl} from "./src/scene.js";
|
||||||
import {downloadUtility, compatibleCore} from "./src/misc.js";
|
import {downloadUtility, compatibleCore, compareVersions} from "./src/misc.js";
|
||||||
import {TokenHelper} from "./src/systems/tokenHelper.js";
|
import {TokenHelper} from "./src/systems/tokenHelper.js";
|
||||||
export var streamDeck;
|
export var streamDeck;
|
||||||
export var tokenControl;
|
export var tokenControl;
|
||||||
@@ -90,10 +90,10 @@ async function analyzeWSmessage(msg){
|
|||||||
|
|
||||||
sdVersion = data.version;
|
sdVersion = data.version;
|
||||||
|
|
||||||
if (data.version < minimumSDversion && updateDialog == undefined) {
|
if (!compareVersions(minimumSDversion,data.version) && updateDialog == undefined) {
|
||||||
updateDialog = new Dialog({
|
updateDialog = new Dialog({
|
||||||
title: "Material Deck: Update Needed",
|
title: "Material Deck: Update Needed",
|
||||||
content: "<p>The Stream Deck plugin version you're using is v" + data.version + ", which is incompatible with this verion of the module.<br>Update to v" + minimumSDversion + " or newer.</p>",
|
content: "<p>The Stream Deck plugin version you're using is v" + data.version + ", which is incompatible with this version of the module.<br>Update to v" + minimumSDversion + " or newer.</p>",
|
||||||
buttons: {
|
buttons: {
|
||||||
download: {
|
download: {
|
||||||
icon: '<i class="fas fa-download"></i>',
|
icon: '<i class="fas fa-download"></i>',
|
||||||
|
|||||||
23
src/misc.js
23
src/misc.js
@@ -1,8 +1,26 @@
|
|||||||
import {sdVersion, msVersion, moduleName, getPermission, enableModule, streamDeck} from "../MaterialDeck.js";
|
import {sdVersion, msVersion, moduleName, getPermission, enableModule, streamDeck} from "../MaterialDeck.js";
|
||||||
import {macroControl,soundboard,playlistControl} from "../MaterialDeck.js";
|
import {macroControl,soundboard,playlistControl} from "../MaterialDeck.js";
|
||||||
|
|
||||||
|
export function compareVersions(checkedVersion, requiredVersion) {
|
||||||
|
requiredVersion = requiredVersion.split(".");
|
||||||
|
checkedVersion = checkedVersion.split(".");
|
||||||
|
for (let i=0; i<3; i++) {
|
||||||
|
requiredVersion[i] = isNaN(parseInt(requiredVersion[i])) ? 0 : parseInt(requiredVersion[i]);
|
||||||
|
checkedVersion[i] = isNaN(parseInt(checkedVersion[i])) ? 0 : parseInt(checkedVersion[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (checkedVersion[0] > requiredVersion[0]) return false;
|
||||||
|
if (checkedVersion[0] < requiredVersion[0]) return true;
|
||||||
|
if (checkedVersion[1] > requiredVersion[1]) return false;
|
||||||
|
if (checkedVersion[1] < requiredVersion[1]) return true;
|
||||||
|
if (checkedVersion[2] > requiredVersion[2]) return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
export function compatibleCore(compatibleVersion){
|
export function compatibleCore(compatibleVersion){
|
||||||
let coreVersion = game.version == undefined ? game.data.version : `0.${game.version}`;
|
let coreVersion = game.version == undefined ? game.data.version : `0.${game.version}`;
|
||||||
|
return compareVersions(compatibleVersion, coreVersion);
|
||||||
|
/*
|
||||||
coreVersion = coreVersion.split(".");
|
coreVersion = coreVersion.split(".");
|
||||||
compatibleVersion = compatibleVersion.split(".");
|
compatibleVersion = compatibleVersion.split(".");
|
||||||
if (compatibleVersion[0] > coreVersion[0]) return false;
|
if (compatibleVersion[0] > coreVersion[0]) return false;
|
||||||
@@ -11,6 +29,7 @@ export function compatibleCore(compatibleVersion){
|
|||||||
if (compatibleVersion[1] < coreVersion[1]) return true;
|
if (compatibleVersion[1] < coreVersion[1]) return true;
|
||||||
if (compatibleVersion[2] > coreVersion[2]) return false;
|
if (compatibleVersion[2] > coreVersion[2]) return false;
|
||||||
return true;
|
return true;
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
export class playlistConfigForm extends FormApplication {
|
export class playlistConfigForm extends FormApplication {
|
||||||
@@ -1219,8 +1238,9 @@ export class deviceConfig extends FormApplication {
|
|||||||
dConfig = {};
|
dConfig = {};
|
||||||
game.settings.set(moduleName, 'devices', dConfig);
|
game.settings.set(moduleName, 'devices', dConfig);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (let d of streamDeck.buttonContext) {
|
for (let d of streamDeck.buttonContext) {
|
||||||
|
if (d == undefined) continue;
|
||||||
let type;
|
let type;
|
||||||
if (d.type == 0) type = 'Stream Deck';
|
if (d.type == 0) type = 'Stream Deck';
|
||||||
else if (d.type == 1) type = 'Stream Deck Mini';
|
else if (d.type == 1) type = 'Stream Deck Mini';
|
||||||
@@ -1243,6 +1263,7 @@ export class deviceConfig extends FormApplication {
|
|||||||
this.devices.push(device);
|
this.devices.push(device);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
devices: this.devices
|
devices: this.devices
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user