Quellcode durchsuchen

10.0.20 release

Former-commit-id: decb0e48dfa8ae2a2b67d25f00002ca5644e3118
Gaudenz Alder vor 6 Jahren
Ursprung
Commit
448d987d56

+ 8 - 0
ChangeLog

@@ -1,3 +1,11 @@
+04-JAN-2019: 10.0.20
+
+- Adds debug output for checksum errors
+
+04-JAN-2019: 10.0.19
+
+- Adds debug output for checksum errors
+
 04-JAN-2019: 10.0.18
 
 - Fixes checksum errors in lightbox mode

+ 1 - 1
VERSION

@@ -1 +1 @@
-10.0.18
+10.0.20

+ 1 - 1
src/main/webapp/cache.manifest

@@ -1,7 +1,7 @@
 CACHE MANIFEST
 
 # THIS FILE WAS GENERATED. DO NOT MODIFY!
-# 01/04/2019 11:34 AM
+# 01/04/2019 04:55 PM
 
 app.html
 index.html?offline=1

Datei-Diff unterdrückt, da er zu groß ist
+ 726 - 725
src/main/webapp/js/app.min.js


Datei-Diff unterdrückt, da er zu groß ist
+ 46 - 45
src/main/webapp/js/atlas-viewer.min.js


Datei-Diff unterdrückt, da er zu groß ist
+ 574 - 573
src/main/webapp/js/atlas.min.js


+ 2 - 2
src/main/webapp/js/diagramly/DrawioFile.js

@@ -415,8 +415,8 @@ DrawioFile.prototype.checksumError = function(error, patches, details)
 		
 		this.sendErrorReport(
 			'Checksum Error',
-			'Patches:\n' + json +
-			((details != null) ? ('\n\n' + details) : '') +
+			((details != null) ? (details) : '') +
+			'\n\nPatches:\n' + json +
 			'\n\nData:\n' + data);
 	}
 	catch (e)

+ 22 - 7
src/main/webapp/js/diagramly/DrawioFileSync.js

@@ -733,6 +733,7 @@ DrawioFileSync.prototype.catchup = function(etag, secret, success, error, abort)
 					else if (abort == null || !abort())
 					{
 						var checksum = null;
+						var details = [];
 						var temp = [];
 				
 						if (req.getStatus() >= 200 && req.getStatus() <= 299 &&
@@ -759,6 +760,12 @@ DrawioFileSync.prototype.catchup = function(etag, secret, success, error, abort)
 										{
 											checksum = value.d.checksum;
 											temp.push(value.d.patch);
+											
+											if (value.d.details != null)
+											{
+												value.d.details.checksum = checksum;
+												details.push(JSON.stringify(value.d.details));
+											}
 										}
 										else
 										{
@@ -784,7 +791,7 @@ DrawioFileSync.prototype.catchup = function(etag, secret, success, error, abort)
 							if (temp.length > 0)
 							{
 								this.file.stats.cacheHits++;
-								this.merge(temp, checksum, etag, success, error);
+								this.merge(temp, checksum, etag, success, error, details);
 							}
 							// Retries if cache entry was not yet there
 							else if (cacheReadyRetryCount <= this.maxCacheReadyRetries &&
@@ -847,7 +854,7 @@ DrawioFileSync.prototype.reload = function(success, error, abort)
 /**
  * Adds the listener for automatically saving the diagram for local changes.
  */
-DrawioFileSync.prototype.merge = function(patches, checksum, etag, success, error)
+DrawioFileSync.prototype.merge = function(patches, checksum, etag, success, error, details)
 {
 	try
 	{
@@ -872,15 +879,18 @@ DrawioFileSync.prototype.merge = function(patches, checksum, etag, success, erro
 				this.file.shadowPages = this.ui.patchPages(this.file.shadowPages, patches[i]);
 			}
 			
-			var current = (checksum != null) ? this.ui.getHashValueForPages(this.file.shadowPages) : null;
+			var currentDetails = {};
+			var current = (checksum != null) ? this.ui.getHashValueForPages(
+				this.file.shadowPages, currentDetails) : null;
 			
 			if (urlParams['test'] == '1')
 			{
 				EditorUi.debug('Sync.merge', [this],
 					'from', this.file.getCurrentEtag(), 'to', etag,
 					'backup', this.file.backupPatch,
-					'patches', patches,
 					'attempt', this.catchupRetryCount,
+					'details', details,
+					'patches', patches,
 					'checksum', checksum == current, checksum);
 			}
 			
@@ -889,7 +899,11 @@ DrawioFileSync.prototype.merge = function(patches, checksum, etag, success, erro
 			{
 				this.file.checksumError(error, patches,
 					'Checksum: ' + checksum +
-					'\nCurrent: ' + current);
+					((details != null && details.length > 0) ? ('\nDetails: ' +
+						details.join(', ')) : '') +
+					'\nCurrent: ' + current +
+					((currentDetails != null) ? ('\nCurrent Details: ' +
+						JSON.stringify(currentDetails)) : ''));
 				
 				// Abnormal termination
 				return;
@@ -1006,11 +1020,12 @@ DrawioFileSync.prototype.fileSaved = function(pages, lastDesc, success, error)
 		var shadow = (this.file.shadowPages != null) ?
 			this.file.shadowPages : this.ui.getPagesForNode(
 			mxUtils.parseXml(this.file.shadowData).documentElement)
-		var checksum = this.ui.getHashValueForPages(pages);
+		var details = {v: EditorUi.VERSION, t: new Date().toISOString(), ua: navigator.userAgent};
+		var checksum = this.ui.getHashValueForPages(pages, details);
 		var diff = this.ui.diffPages(shadow, pages);
 		
 		// Data is stored in cache and message is sent to all listeners
-		var data = this.objectToString(this.createMessage({patch: diff, checksum: checksum}));
+		var data = this.objectToString(this.createMessage({patch: diff, checksum: checksum, details: details}));
 		var msg = this.objectToString(this.createMessage({m: this.lastModified.getTime()}));
 		var secret = this.file.getDescriptorSecret(this.file.getDescriptor());
 		var etag = this.file.getDescriptorEtag(lastDesc);

+ 47 - 9
src/main/webapp/js/diagramly/EditorUi.js

@@ -1022,14 +1022,14 @@
 							{
 								if (cellDiffs[cellId].value != null)
 								{
-									cellDiffs[cellId].value = this.anonymizeString(
-										cellDiffs[cellId].value);
+									cellDiffs[cellId].value =  '[' +
+										cellDiffs[cellId].value.length + ']';
 								}
 								
 								if (cellDiffs[cellId].style != null)
 								{
-									cellDiffs[cellId].style = this.anonymizeString(
-										cellDiffs[cellId].style);
+									cellDiffs[cellId].style = '[' +
+										cellDiffs[cellId].style.length + ']';
 								}
 								
 								if (cellDiffs[cellId].geometry != null)
@@ -1075,6 +1075,32 @@
 		return patch;
 	};
 
+	/**
+	 * Removes any values, styles and geometries from the given XML node.
+	 */
+	EditorUi.prototype.anonymizeAttributes = function(node)
+	{
+		if (node.attributes != null)
+		{
+			for (var i = 0; i < node.attributes.length; i++)
+			{
+				if (node.attributes[i].name != 'as')
+				{
+					node.setAttribute(node.attributes[i].name,
+						this.anonymizeString(node.attributes[i].value));
+				}
+			}
+		}
+		
+		if (node.childNodes != null)
+		{
+			for (var i = 0; i < node.childNodes.length; i++)
+			{
+				this.anonymizeAttributes(node.childNodes[i]);
+			}
+		}
+	};
+	
 	/**
 	 * Removes any values, styles and geometries from the given XML node.
 	 */
@@ -1086,12 +1112,12 @@
 		{
 			if (nodes[i].getAttribute('value') != null)
 			{
-				nodes[i].setAttribute('value', this.anonymizeString(nodes[i].getAttribute('value')));
+				nodes[i].setAttribute('value', '[' + nodes[i].getAttribute('value').length + ']');
 			}
 			
 			if (nodes[i].getAttribute('style') != null)
 			{
-				nodes[i].setAttribute('style', this.anonymizeString(nodes[i].getAttribute('style')));
+				nodes[i].setAttribute('style', '[' + nodes[i].getAttribute('style').length + ']');
 			}
 			
 			if (nodes[i].parentNode != null && nodes[i].parentNode.nodeName != 'root' &&
@@ -1104,9 +1130,9 @@
 		
 		var geos = node.getElementsByTagName('mxGeometry');
 		
-		while (geos.length > 0)
+		for (var i = 0; i < geos.length; i++)
 		{
-			geos[0].parentNode.removeChild(geos[0]);
+			this.anonymizeAttributes(geos[i]);
 		}
 		
 		return node;
@@ -2344,12 +2370,18 @@
 	/**
 	 * Creates a hash value for the current file.
 	 */
-	EditorUi.prototype.getHashValueForPages = function(pages)
+	EditorUi.prototype.getHashValueForPages = function(pages, details)
 	{
 		// TODO: Avoid encoding to XML to make it faster
 		var hash = 0;
 		var model = new mxGraphModel();
 		var codec = new mxCodec();
+
+		if (details != null)
+		{
+			details.cellCount = 0;
+			details.nodeCount = 0;
+		}
 		
 		for (var i = 0; i < pages.length; i++)
 		{
@@ -2366,6 +2398,12 @@
 			this.editor.graph.saveViewState(pages[i].viewState, xmlNode, true);
 			diagram.appendChild(xmlNode);
 			
+			if (details != null)
+			{
+				details.nodeCount += diagram.getElementsByTagName('mxCell').length;
+				details.cellCount += model.getDescendants(model.root).length;
+			}
+			
 			hash = ((hash << 5) - hash + this.hashValue(diagram)) << 0;
 		}
 		

Datei-Diff unterdrückt, da er zu groß ist
+ 1 - 1
src/main/webapp/js/embed-static.min.js


Datei-Diff unterdrückt, da er zu groß ist
+ 1 - 1
src/main/webapp/js/reader.min.js


Datei-Diff unterdrückt, da er zu groß ist
+ 46 - 45
src/main/webapp/js/viewer.min.js