1
0
Fork 0
mirror of https://github.com/gorhill/uMatrix.git synced 2024-06-02 02:14:52 +12:00

"matrix:" instead of too generic "switch:"

This commit is contained in:
gorhill 2014-11-04 08:40:20 -05:00
parent 69608e5a80
commit 92c48c0d49

View file

@ -573,7 +573,7 @@ Matrix.prototype.toString = function() {
continue;
}
val = this.switchedOn[srcHostname] ? 'on' : 'off';
out.push('switch: ' + srcHostname + ' ' + val);
out.push('matrix: ' + srcHostname + ' ' + val);
}
return out.sort().join('\n');
};
@ -640,6 +640,9 @@ Matrix.prototype.fromString = function(text, append) {
// state = [`on`, `off`]
pos = fieldVal.indexOf('switch:');
if ( pos === -1 ) {
pos = fieldVal.indexOf('matrix:');
}
if ( pos !== -1 ) {
srcHostname = punycode.toASCII(fields[1]);
@ -743,7 +746,7 @@ Matrix.prototype.diff = function(other, srcHostname, desHostnames) {
otherVal = other.evaluateSwitch(srcHostname);
if ( thisVal !== otherVal ) {
out.push({
'what': 'switch',
'what': 'matrix',
'src': srcHostname
});
}
@ -783,7 +786,7 @@ Matrix.prototype.applyDiff = function(diff, from) {
var action, val;
while ( i-- ) {
action = diff[i];
if ( action.what === 'switch' ) {
if ( action.what === 'matrix' ) {
val = from.evaluateSwitch(action.src);
changed = this.setSwitch(action.src, val) || changed;
continue;