You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openmeetings.apache.org by so...@apache.org on 2018/03/21 09:01:45 UTC

[openmeetings] branch master updated: [OPENMEETINGS-1854] code clean-up

This is an automated email from the ASF dual-hosted git repository.

solomax pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/openmeetings.git


The following commit(s) were added to refs/heads/master by this push:
     new b43954f  [OPENMEETINGS-1854] code clean-up
b43954f is described below

commit b43954fd03dbef49cd7ff743dd5234b8dca9e122
Author: Maxim Solodovnik <so...@gmail.com>
AuthorDate: Wed Mar 21 16:01:36 2018 +0700

    [OPENMEETINGS-1854] code clean-up
---
 openmeetings-web/pom.xml                             |  1 -
 .../apache/openmeetings/web/room/kurento-utils.js    |  4 ++--
 .../org/apache/openmeetings/web/room/wb/tool-base.js |  2 +-
 .../java/org/apache/openmeetings/web/room/wb/uuid.js | 20 --------------------
 .../org/apache/openmeetings/web/room/wb/wb-board.js  |  4 ++--
 pom.xml                                              |  2 +-
 6 files changed, 6 insertions(+), 27 deletions(-)

diff --git a/openmeetings-web/pom.xml b/openmeetings-web/pom.xml
index 38b9d62..36bd4c2 100644
--- a/openmeetings-web/pom.xml
+++ b/openmeetings-web/pom.xml
@@ -155,7 +155,6 @@
 								<jsSourceFile>MathJax-config.js</jsSourceFile>
 								<jsSourceFile>MathJax.js</jsSourceFile>
 								<jsSourceFile>wb-all.js</jsSourceFile>
-								<jsSourceFile>uuid.js</jsSourceFile>
 								<jsSourceFile>tool-util.js</jsSourceFile>
 								<jsSourceFile>player.js</jsSourceFile>
 								<jsSourceFile>tool-base.js</jsSourceFile>
diff --git a/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/kurento-utils.js b/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/kurento-utils.js
index 3a3979b..ed808d8 100644
--- a/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/kurento-utils.js
+++ b/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/kurento-utils.js
@@ -2,7 +2,7 @@
 var freeice = require('freeice');
 var inherits = require('inherits');
 var UAParser = require('ua-parser-js');
-var uuid = require('uuid');
+window.UUID = require('uuid');
 var hark = require('hark');
 var EventEmitter = require('events').EventEmitter;
 var recursive = require('merge').recursive.bind(undefined, true);
@@ -134,7 +134,7 @@ function WebRtcPeer(mode, options, callback) {
     var dataChannelConfig = options.dataChannelConfig;
     var useDataChannels = options.dataChannels || false;
     var dataChannel;
-    var guid = uuid.v4();
+    var guid = UUID.v4();
     var configuration = recursive({ iceServers: freeice() }, options.configuration);
     var onicecandidate = options.onicecandidate;
     if (onicecandidate)
diff --git a/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/tool-base.js b/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/tool-base.js
index e50aef6..256155a 100644
--- a/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/tool-base.js
+++ b/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/tool-base.js
@@ -2,7 +2,7 @@
 var Base = function() {
 	const base = {};
 	base.objectCreated = function(o, canvas) {
-		o.uid = UUID.generate();
+		o.uid = UUID.v4();
 		o.slide = canvas.slide;
 		canvas.trigger("wb:object:created", o);
 		return o.uid;
diff --git a/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/uuid.js b/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/uuid.js
deleted file mode 100644
index 17eae1f..0000000
--- a/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/uuid.js
+++ /dev/null
@@ -1,20 +0,0 @@
-/* Licensed under the Apache License, Version 2.0 (the "License") http://www.apache.org/licenses/LICENSE-2.0 */
-// https://stackoverflow.com/questions/105034/create-guid-uuid-in-javascript
-// author Jeff Ward
-var UUID = (function() {
-	const self = {}, lut = [];
-	for (let i = 0; i < 256; i++) {
-		lut[i] = (i < 16 ? '0' : '') + (i).toString(16);
-	}
-	self.generate = function() {
-		const d0 = Math.random() * 0xffffffff | 0
-			, d1 = Math.random() * 0xffffffff | 0
-			, d2 = Math.random() * 0xffffffff | 0
-			, d3 = Math.random() * 0xffffffff | 0;
-		return lut[d0 & 0xff] + lut[d0 >> 8 & 0xff] + lut[d0 >> 16 & 0xff] + lut[d0 >> 24 & 0xff] + '-' +
-			lut[d1 & 0xff] + lut[d1 >> 8 & 0xff] + '-' + lut[d1 >> 16 & 0x0f | 0x40] + lut[d1 >> 24 & 0xff] + '-' +
-			lut[d2 & 0x3f | 0x80] + lut[d2 >> 8 & 0xff] + '-' + lut[d2 >> 16 & 0xff] + lut[d2 >> 24 & 0xff] +
-			lut[d3 & 0xff] + lut[d3 >> 8 & 0xff] + lut[d3 >> 16 & 0xff] + lut[d3 >> 24 & 0xff];
-	}
-	return self;
-})();
diff --git a/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/wb-board.js b/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/wb-board.js
index a853e59..fa5a0c0 100644
--- a/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/wb-board.js
+++ b/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/wb-board.js
@@ -440,7 +440,7 @@ var Wb = function() {
 		if (!!o.loaded) return;
 		switch(o.type) {
 			case 'i-text':
-				o.uid = UUID.generate();
+				o.uid = UUID.v4();
 				o.slide = this.slide;
 				objCreatedHandler(o);
 				break;
@@ -479,7 +479,7 @@ var Wb = function() {
 		s.find('.wb-dim-h').val(o.height);
 	}
 	function pathCreatedHandler(o) {
-		o.path.uid = UUID.generate();
+		o.path.uid = UUID.v4();
 		o.path.slide = this.slide;
 		objCreatedHandler(o.path);
 	};
diff --git a/pom.xml b/pom.xml
index 3759e21..76a4c93 100644
--- a/pom.xml
+++ b/pom.xml
@@ -81,7 +81,7 @@
 		<!--  URL of the ASF SonarQube server  -->
 		<sonar.host.url>https://builds.apache.org/analysis</sonar.host.url>
 		<!--  Exclude all generated code  -->
-		<sonar.exclusions>file:**/generated-sources/**, file:**/fabric.js, file:**/cssemoticons.js, file:**/uuid.js, file:**/fileinput*.js, file:**/MathJax.js</sonar.exclusions>
+		<sonar.exclusions>file:**/generated-sources/**, file:**/fabric.js, file:**/cssemoticons.js, file:**/kurento-utils.js, file:**/fileinput*.js, file:**/MathJax.js</sonar.exclusions>
 		<sonar.java.coveragePlugin>jacoco</sonar.java.coveragePlugin>
 		<sonar.dynamicAnalysis>reuseReports</sonar.dynamicAnalysis>
 		<sonar.jacoco.reportPath>${project.basedir}/../target/jacoco.exec</sonar.jacoco.reportPath>

-- 
To stop receiving notification emails like this one, please contact
solomax@apache.org.