Browse Source

13.0.9 release

David Benson [draw.io] 5 years ago
parent
commit
5876e39065

+ 4 - 0
ChangeLog

@@ -1,3 +1,7 @@
+07-MAY-2020: 13.0.9
+
+- Adds patch chain validation for real time
+
 05-MAY-2020: 13.0.8
 
 - Adds ctrl+enter for table cells

+ 1 - 1
VERSION

@@ -1 +1 @@
-13.0.8
+13.0.9

+ 20 - 2
etc/license-worker/license.js

@@ -21,12 +21,23 @@ async function handleRequest(request)
 	let params = new URL('http://dummy.com?' + reqBodyTxt).searchParams;
 	let domain = params.get('domain');
 	let confLicense = params.get('confLicense');
+	let licenseDump = params.get('licenseDump');
+	let sParams = new URL(request.url).searchParams;
 	
 	//Try Query string parameters
 	if (domain == null)
 	{
-		let params = new URL(request.url).searchParams;
-		domain = params.get('domain');
+		domain = sParams.get('domain');
+	}
+	
+	if (confLicense == null)
+	{
+		confLicense = sParams.get('confLicense');
+	}
+	
+	if (SEN == null)
+	{
+		SEN = sParams.get('SEN');
 	}
 	
 	let email = params.get('email');
@@ -52,6 +63,13 @@ async function handleRequest(request)
 		fetch(url);
 	}
 	
+	if (licenseDump != null)
+	{
+		let msg = encodeURIComponent(('license:licenseDump=' + licenseDump));
+		let url = "https://log.diagrams.net/" + msg;
+		fetch(url);
+	}
+	
 	if (domain != null)
 	{
 		try

+ 25 - 18
etc/redirect-worker/redirect.js

@@ -5,9 +5,16 @@
 async function handleRequest(request) {
   let requestURL = new URL(request.url)
   let host = requestURL.host
+  let sub = host;
   let path = requestURL.pathname
   
-  let hostRedirectMap = redirectMap.get(host)
+  if (host != null)
+  {
+	  let parts = host.split('.')
+	  sub = parts[0]
+  }
+
+  let hostRedirectMap = redirectMap.get(sub)
   
   if (hostRedirectMap)
   {
@@ -54,7 +61,7 @@ addEventListener('fetch', async event => {
 })
 
 const redirectMap = new Map([
-	['about.draw.io', new Map([
+	['about', new Map([
 		['/drawio-desktop-10-7-5-release', 'https://github.com/jgraph/drawio-desktop/releases/tag/v10.7.5'],
 		['/insert-from-text-now-supports-plantuml', '/use-plantuml-in-draw-io'],
 		['/integrate-draw-io/', '/integrations-ecosystem/'],
@@ -128,40 +135,40 @@ const redirectMap = new Map([
 		['/features/training-material/', 'https://drawio-app.com/tutorials/'],
 		['/terms-conditions/', 'https://seibert-media.com/general-terms/'],
 		['/support/', 'https://github.com/jgraph/drawio/wiki/Getting-Support'],
-		['/', 'https://drawio-app.com/']
+		['/', 'https://www.diagrams.net']
 	])],
-	['blog.draw.io', new Map([
-		['/', 'https://drawio-app.com/blog']
+	['blog', new Map([
+		['/', 'https://www.diagrams.net/blog']
 	])],
-	['download.draw.io', new Map([
+	['download', new Map([
 		['/', 'https://github.com/jgraph/drawio-desktop/releases/latest']
 	])],
-	['get.draw.io', new Map([
+	['get', new Map([
 		['/', 'https://github.com/jgraph/drawio-desktop/releases/latest']
 	])],
-	['docsaddon.draw.io', new Map([
+	['docsaddon', new Map([
 		['/', 'https://gsuite.google.com/marketplace/app/drawio_viewer_for_docs/224440279306']
 	])],
-	['gsuite.draw.io', new Map([
+	['gsuite', new Map([
 		['/', 'https://gsuite.google.com/marketplace/app/drawio_diagrams/671128082532']
 	])],
-	['office.draw.io', new Map([
+	['office', new Map([
 		['/', 'https://appsource.microsoft.com/product/office/wa200000113']
 	])],
-	['slidesaddon.draw.io', new Map([
+	['slidesaddon', new Map([
 		['/', 'https://gsuite.google.com/marketplace/app/drawio_diagrams_for_slides/588283048931']
 	])],
-	['sheetsaddon.draw.io', new Map([
+	['sheetsaddon', new Map([
 		['/', 'https://gsuite.google.com/marketplace/app/drawio_diagrams_for_sheets/948903782998']
 	])],
-	['doc.draw.io', new Map([
+	['doc', new Map([
 		['/i18n', 'https://docs.google.com/spreadsheets/d/1FoYdyEraEQuWofzbYCDPKN7EdKgS_2ZrsDrOA8scgwQ'],
-		['/', 'https://support.draw.io']
+		['/', 'https://www.diagrams.net/doc/']
 	])],
-	['app.draw.io', new Map([
-		['/', 'https://www.draw.io/app']
+	['app', new Map([
+		['/', 'https://app.diagrams.net']
 	])],
-	['new.draw.io', new Map([
-		['/', 'https://www.draw.io/?splash=0']
+	['new', new Map([
+		['/', 'https://app.diagrams.net/?splash=0']
 	])]
 ])

+ 1 - 1
src/main/webapp/connect/confluence/connect.json

@@ -2,7 +2,7 @@
     "name": "draw.io",
     "description": "draw.io add-on for Confluence",
     "key": "com.mxgraph.confluence.plugins.diagramly",
-    "baseUrl": "https://confluence.draw.io",
+    "baseUrl": "https://ca14f165.ngrok.io",
     "enableLicensing": true,
     "apiMigrations": {
         "gdpr": true

+ 207 - 185
src/main/webapp/connect/confluence/macroEditor-1-4-8.html

@@ -1,185 +1,207 @@
-<!DOCTYPE html>
-<html>
-<head>
-<meta charset="UTF-8">
-<title>draw.io Editor</title>
-<script type="text/javascript">
-	// To Avoid NPE in connectUtils
-	urlParams = {};
-</script>
-<script src="connectUtils-1-4-8.js" type="text/javascript"></script>
-<style type="text/css">
-	html, body {
-	  height:100%;
-	  overflow:hidden;
-	}
-	body {
-		background-color:#ffffff;
-		background-image:url(/images/drawlogo-text-bottom.svg);
-		background-repeat:no-repeat;
-		background-position:center;
-		background-size:128px;
-		font-family:Arial,Sans-Serif;
-		overflow:hidden;
-		width:100%;
-		margin:0;
-	}
-</style>
-</head>
-<body>
-<script type="text/javascript">
-	//Logs uncaught errors
-	window.onerror = function(message, url, linenumber, colno, err)
-	{
-		message = 'Confluence Cloud Editor: ' + ((message != null) ? message : '');
-		
-		AC.logError(message, url, linenumber, colno, err);
-	};
-	
-	var baseUrl = AC.getBaseUrl();
-	var connectUrl = baseUrl + '/atlassian-connect';
-	var head = document.getElementsByTagName('head')[0];
-	
-	
-	var script = document.createElement('script');
-	script.setAttribute('data-options', 'resize:false;margin:false');
-
-	// Main
-	script.onload = function()
-	{
-		var xdm_e = AC.getSiteUrl();
-		var license = AC.getUrlParam('lic', false);
-		
-		if (license != null && xdm_e != null)
-		{
-			if (license == 'none')
-			{
-				var hostParse = document.createElement('a');
-				hostParse.href = xdm_e;
-				var hostname = hostParse.hostname;
-				
-				if (hostname != null)
-				{
-	 				if (hostname.indexOf('.ngrok.io') > -1)
-					{
-						console.log("License status = ", license);
-					}
-					else
-					{
-			        	AP.request({
-			                type: 'GET',
-			                url: '/rest/atlassian-connect/1/addons/com.mxgraph.confluence.plugins.diagramly',
-			                contentType: 'application/json;charset=UTF-8',
-			                success: function (resp) 
-			                {
-			                    resp = JSON.parse(resp);
- 			
-								var xhr = new XMLHttpRequest();
-								
-								xhr.onreadystatechange = function()
-								{
-								    if (xhr.readyState == XMLHttpRequest.DONE && xhr.status >= 200 && xhr.status <= 299)
-								    {
-								        var resp = xhr.responseText;
-					
-										if (resp != null && resp.length > 0)
-										{
-											var lic = JSON.parse(resp);
-											
-											if (lic != null && lic.atlasCloudLic != null)
-											{
-												// decide whether valid and close if not
-												// AP.dialog.close();
-											}
-										}
-								    }
-								};
-					
-								xhr.open('POST', '/license?domain=' + hostname + '&confLicense=' + license + '&SEN=' + resp.license? resp.license.supportEntitlementNumber : 'Unlicensed', true);
-								xhr.send(null);
-			                }
-			        	});
-					}
-				}
-			}
-		}
-
-		AP.resize('100%', '100%');
-
-		var config = null;
-		var lang = null;
-		var allDone = 0;
-		
-		var startEditor = function () 
-		{
-			allDone++;
-			
-			if (allDone == 2)
-			{
-				var isCustom = AC.getUrlParam('custom');
-				
-				if (isCustom == "1") 
-				{
-					var contentId = AC.getUrlParam('contentId') || AC.getUrlParam('custContentId');
-					AP.dialog.getCustomData(function (customData) 
-					{
-						AC.initAsync(baseUrl, customData.contentId || customData.custContentId || contentId, customData.macroData, config, lang);
-					});
-				}
-				else
-				{
-					AC.initAsync(baseUrl, null, null, config, lang);
-				}
-			}
-		}
-		
-		AP.user.getLocale(function(locale)
-		{
-			lang = locale;
-			startEditor();
-		});	
-		
-		AP.request({
-            type: 'GET',
-            url: '/rest/api/content/search?cql=type%3Dpage%20and%20space%3DDRAWIOCONFIG%20and%20title%3DConfiguration', //type=page and space=DRAWIOCONFIG and title=Configuration. Search doesn't return 404 if not found
-            contentType: 'application/json;charset=UTF-8',
-            success: function (resp) 
-            {
-                resp = JSON.parse(resp);
-                
-                if (resp.size == 1)
-               	{
-                	var configPageId = resp.results[0].id;
-                	//load the configuration file
-            		AP.request({
-                        type: 'GET',
-            			url: '/download/attachments/' + configPageId + '/configuration.json',
-                        contentType: 'application/json;charset=UTF-8',
-                        success: function (fileContent) 
-                        {
-                        	config = fileContent; 
-                           	startEditor();
-            			},
-            			error: startEditor //if there is an error loading the configuration, just load the editor normally. E.g., 404 when the space doesn't exist
-            		});
-                	
-               	}
-                else 
-               	{
-                	startEditor();
-               	}
-			},
-			error: startEditor //if there is an error loading the configuration, just load the editor normally. E.g., 404 when the space doesn't exist
-		});
-	};
-	script.src = 'https://connect-cdn.atl-paas.net/all.js';
-	head.appendChild(script);
-	
-	var link = document.createElement('link');
-	link.type = 'text/css';
-	link.rel = 'stylesheet';
-	link.href = connectUrl + '/all.css';
-	head.appendChild(link);
-</script>
-</body>
-</html>
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="UTF-8">
+<title>draw.io Editor</title>
+<script type="text/javascript">
+	// To Avoid NPE in connectUtils
+	urlParams = {};
+</script>
+<script src="connectUtils-1-4-8.js" type="text/javascript"></script>
+<style type="text/css">
+	html, body {
+	  height:100%;
+	  overflow:hidden;
+	}
+	body {
+		background-color:#ffffff;
+		background-image:url(/images/drawlogo-text-bottom.svg);
+		background-repeat:no-repeat;
+		background-position:center;
+		background-size:128px;
+		font-family:Arial,Sans-Serif;
+		overflow:hidden;
+		width:100%;
+		margin:0;
+	}
+</style>
+</head>
+<body>
+<script type="text/javascript">
+	//Logs uncaught errors
+	window.onerror = function(message, url, linenumber, colno, err)
+	{
+		message = 'Confluence Cloud Editor: ' + ((message != null) ? message : '');
+		
+		AC.logError(message, url, linenumber, colno, err);
+	};
+	
+	var xdm_e = AC.getSiteUrl();
+	var baseUrl = AC.getBaseUrl();
+	var license = AC.getUrlParam('lic', false);
+	var connectUrl = baseUrl + '/atlassian-connect';
+	var head = document.getElementsByTagName('head')[0];
+	var licenseValid = true;
+	
+	var script = document.createElement('script');
+	script.setAttribute('data-options', 'resize:false;margin:false');
+	
+	if (license != null && xdm_e != null)
+	{
+		if (license == 'none')
+		{
+			licenseValid = false;
+		}
+		
+		var hostParse = document.createElement('a');
+		hostParse.href = xdm_e;
+		var hostname = hostParse.hostname;
+		
+		if (hostname != null)
+		{
+			var xhr = new XMLHttpRequest();
+
+			xhr.onreadystatechange = function()
+			{
+			    if (xhr.readyState == XMLHttpRequest.DONE && xhr.status >= 200 && xhr.status <= 299)
+			    {
+			        var resp = xhr.responseText;
+
+					if (resp != null && resp.length > 0)
+					{
+						var lic = JSON.parse(resp);
+						
+						if (lic != null && lic.atlasCloudLic != null)
+						{
+							licenseValid = true;
+						}
+					}
+			    }
+			};
+
+			xhr.open('POST', '/license?domain=' + hostname + '&confLicense=' + license, true);
+			xhr.send(null);
+		}
+	}
+
+	// Main
+	script.onload = function()
+	{
+		if (!licenseValid)
+		{
+			setTimeout(function() // XHR call doesn't work inside AP.Request
+			{
+				if (!licenseValid)
+				{
+					alert("Please install a license for the draw.io app");
+					AP.dialog.close();
+				}
+			}, 8000);
+		}
+
+		AP.resize('100%', '100%');
+
+		var config = null;
+		var lang = null;
+		var SEN = null;
+		var installedDate = null;
+		var lastUpdated = null;
+		var allDone = 0;
+		
+		var startEditor = function () 
+		{
+			allDone++;
+			
+			if (allDone == 2)
+			{
+				var isCustom = AC.getUrlParam('custom');
+				
+				if (isCustom == "1") 
+				{
+					var contentId = AC.getUrlParam('contentId') || AC.getUrlParam('custContentId');
+					AP.dialog.getCustomData(function (customData) 
+					{
+						AC.initAsync(baseUrl, customData.contentId || customData.custContentId || contentId, customData.macroData, config, lang);
+					});
+				}
+				else
+				{
+					AC.initAsync(baseUrl, null, null, config, lang);
+				}
+			}
+		}
+		
+		AP.user.getLocale(function(locale)
+		{
+			lang = locale;
+			startEditor();
+		});	
+		
+		AP.request({
+            type: 'GET',
+            url: '/rest/api/content/search?cql=type%3Dpage%20and%20space%3DDRAWIOCONFIG%20and%20title%3DConfiguration', //type=page and space=DRAWIOCONFIG and title=Configuration. Search doesn't return 404 if not found
+            contentType: 'application/json;charset=UTF-8',
+            success: function (resp) 
+            {
+                resp = JSON.parse(resp);
+                
+                if (resp != null && resp.size == 1)
+               	{
+                	var configPageId = resp.results[0].id;
+                	//load the configuration file
+            		AP.request({
+                        type: 'GET',
+            			url: '/download/attachments/' + configPageId + '/configuration.json',
+                        contentType: 'application/json;charset=UTF-8',
+                        success: function (fileContent) 
+                        {
+                        	config = fileContent; 
+                           	startEditor();
+            			},
+            			error: startEditor //if there is an error loading the configuration, just load the editor normally. E.g., 404 when the space doesn't exist
+            		});
+                	
+               	}
+                else 
+               	{
+                	startEditor();
+               	}
+			},
+			error: startEditor //if there is an error loading the configuration, just load the editor normally. E.g., 404 when the space doesn't exist
+		});
+		
+    	AP.request({
+            type: 'GET',
+            url: '/rest/atlassian-connect/1/addons/com.mxgraph.confluence.plugins.diagramly',
+            contentType: 'application/json;charset=UTF-8',
+            success: function (resp) 
+            {
+            	try
+            	{
+	                resp = JSON.parse(resp);
+	                
+	                if (resp != null && resp.license != null)
+	                {
+	                	var xhr = new XMLHttpRequest();
+	                	xhr.open('POST', '/license?licenseDump=' + JSON.stringify(resp), true);
+	        			xhr.send(null);
+	                }
+            	}
+            	catch (e)
+            	{
+            		// just throw away if it breaks, not important
+            	}
+            }
+    	});
+	};
+	script.src = 'https://connect-cdn.atl-paas.net/all.js';
+	head.appendChild(script);
+	
+	var link = document.createElement('link');
+	link.type = 'text/css';
+	link.rel = 'stylesheet';
+	link.href = connectUrl + '/all.css';
+	head.appendChild(link);
+</script>
+</body>
+</html>

File diff suppressed because it is too large
+ 448 - 446
src/main/webapp/js/app.min.js


+ 2 - 0
src/main/webapp/js/diagramly/DrawioFileSync.js

@@ -1172,6 +1172,7 @@ DrawioFileSync.prototype.fileSaved = function(pages, lastDesc, success, error, t
 				var shadow = (this.file.shadowPages != null) ?
 					this.file.shadowPages : this.ui.getPagesForNode(
 					mxUtils.parseXml(this.file.shadowData).documentElement)
+				var lastSecret = this.file.getDescriptorSecret(lastDesc);
 				var checksum = this.ui.getHashValueForPages(pages);
 				var diff = this.ui.diffPages(shadow, pages);
 				
@@ -1191,6 +1192,7 @@ DrawioFileSync.prototype.fileSaved = function(pages, lastDesc, success, error, t
 				mxUtils.post(EditorUi.cacheUrl, this.getIdParameters() +
 					'&from=' + encodeURIComponent(etag) + '&to=' + encodeURIComponent(current) +
 					'&msg=' + encodeURIComponent(msg) + ((secret != null) ? '&secret=' + encodeURIComponent(secret) : '') +
+					((lastSecret != null) ? '&last-secret=' + encodeURIComponent(lastSecret) : '') +
 					((data.length < this.maxCacheEntrySize) ? '&data=' + encodeURIComponent(data) : '') +
 					((token != null) ? '&token=' + encodeURIComponent(token) : ''),
 					mxUtils.bind(this, function(req)

File diff suppressed because it is too large
+ 1 - 1
src/main/webapp/js/mxgraph/Editor.js


File diff suppressed because it is too large
+ 5 - 3
src/main/webapp/js/viewer.min.js


+ 1 - 1
src/main/webapp/service-worker.js

@@ -6,7 +6,7 @@ if (workbox)
 	workbox.precaching.precacheAndRoute([
   {
     "url": "js/app.min.js",
-    "revision": "8f905199962cb01eba11ac54b40cd630"
+    "revision": "a32ef17f69e1f38d2c7f3235cd2e2dbc"
   },
   {
     "url": "js/extensions.min.js",