solid-ui 2.4.28-7b1c0b2d → 2.4.28-7d93d5d2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/solid-ui.js CHANGED
@@ -4416,7 +4416,7 @@ Object.defineProperty(exports, "__esModule", ({
4416
4416
  value: true
4417
4417
  }));
4418
4418
  exports.createAndSaveKeyPairs = createAndSaveKeyPairs;
4419
- exports.generateAndStorePublicKey = generateAndStorePublicKey;
4419
+ exports.generateAndStoreNewPublicKey = generateAndStoreNewPublicKey;
4420
4420
  exports.generatePrivateKey = generatePrivateKey;
4421
4421
  exports.generatePublicKey = generatePublicKey;
4422
4422
  exports.getPrivateKey = getPrivateKey;
@@ -4499,11 +4499,11 @@ function validPublicKey(webId, publicKey, privateKey) {
4499
4499
  }
4500
4500
  return true;
4501
4501
  }
4502
- function generateAndStorePublicKey(_x2, _x3, _x4, _x5) {
4503
- return _generateAndStorePublicKey.apply(this, arguments);
4502
+ function generateAndStoreNewPublicKey(_x2, _x3, _x4, _x5) {
4503
+ return _generateAndStoreNewPublicKey.apply(this, arguments);
4504
4504
  }
4505
- function _generateAndStorePublicKey() {
4506
- _generateAndStorePublicKey = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(webId, privateKey, publicKey, publicKeyDoc) {
4505
+ function _generateAndStoreNewPublicKey() {
4506
+ _generateAndStoreNewPublicKey = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(webId, privateKey, publicKey, publicKeyDoc) {
4507
4507
  var del, newPublicKey, add;
4508
4508
  return _regenerator["default"].wrap(function _callee3$(_context3) {
4509
4509
  while (1) switch (_context3.prev = _context3.next) {
@@ -4519,7 +4519,7 @@ function _generateAndStorePublicKey() {
4519
4519
  }
4520
4520
  }, _callee3);
4521
4521
  }));
4522
- return _generateAndStorePublicKey.apply(this, arguments);
4522
+ return _generateAndStoreNewPublicKey.apply(this, arguments);
4523
4523
  }
4524
4524
  function createAndSaveKeyPairs(_x6, _x7, _x8, _x9) {
4525
4525
  return _createAndSaveKeyPairs.apply(this, arguments);
@@ -4536,7 +4536,7 @@ function _createAndSaveKeyPairs() {
4536
4536
  return saveKeyAndHandleAcl(privateKeyDoc, [], add, webId.uri);
4537
4537
  case 4:
4538
4538
  _context4.next = 6;
4539
- return generateAndStorePublicKey(webId, privateKey, publicKey, publicKeyDoc);
4539
+ return generateAndStoreNewPublicKey(webId, privateKey, publicKey, publicKeyDoc);
4540
4540
  case 6:
4541
4541
  return _context4.abrupt("return", privateKey);
4542
4542
  case 7:
@@ -4589,7 +4589,7 @@ function _getPrivateKey() {
4589
4589
  break;
4590
4590
  }
4591
4591
  _context5.next = 21;
4592
- return generateAndStorePublicKey(webId, privateKey, publicKey, publicKeyDoc);
4592
+ return generateAndStoreNewPublicKey(webId, privateKey, publicKey, publicKeyDoc);
4593
4593
  case 21:
4594
4594
  keyContainer = privateKeyDoc.substring(0, privateKeyDoc.lastIndexOf('/') + 1);
4595
4595
  _context5.next = 24;
@@ -4841,23 +4841,20 @@ function renderMessageRow(_x, _x2, _x3, _x4, _x5) {
4841
4841
  } // END OF RENDERMESSAGE
4842
4842
  function _renderMessageRow() {
4843
4843
  _renderMessageRow = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee9(channelObject, message, fresh, options, userContext) {
4844
- var unsignedMessage, colorizeByAuthor, creator, date, latestVersion, latestVersionCreator, msgId, content, versions, replies, thread, straightReplies, _iterator2, _step2, reply, signature, msg, originalMessage, edited, sortDate, messageRow, td1, img, bothDates, td2, text, isURI, para, isImage, _img, anc, bgcolor, getBgColor, strip, td3, toolsButton;
4844
+ var colorizeByAuthor, creator, date, latestVersion, latestVersionCreator, msgId, content, versions, replies, thread, straightReplies, _iterator2, _step2, reply, signature, msg, messageRow, publicKey, regex, validSignature, validPublicKeyHexString, originalMessage, edited, sortDate, td1, img, bothDates, td2, text, isURI, para, isImage, _img, anc, bgcolor, getBgColor, strip, td3, toolsButton;
4845
4845
  return _regenerator["default"].wrap(function _callee9$(_context10) {
4846
4846
  while (1) switch (_context10.prev = _context10.next) {
4847
4847
  case 0:
4848
4848
  getBgColor = function _getBgColor(fresh) {
4849
4849
  return fresh ? '#e8ffe8' : 'white';
4850
4850
  };
4851
- unsignedMessage = false;
4852
- colorizeByAuthor = options.colorizeByAuthor === '1' || options.colorizeByAuthor === true; // const id = store.any(latestVersion, ns.sioc('id'))
4853
- // const replies = store.each(latestVersion, ns.sioc('has_reply'))
4851
+ colorizeByAuthor = options.colorizeByAuthor === '1' || options.colorizeByAuthor === true;
4854
4852
  creator = _solidLogic.store.any(message, ns.foaf('maker'));
4855
4853
  date = _solidLogic.store.any(message, ns.dct('created'));
4856
- _context10.next = 7;
4854
+ _context10.next = 6;
4857
4855
  return (0, _chatLogic.mostRecentVersion)(message);
4858
- case 7:
4856
+ case 6:
4859
4857
  latestVersion = _context10.sent;
4860
- debug.log('@@@@ alain mostRecentVersion');
4861
4858
  debug.log(message);
4862
4859
  debug.log(latestVersion);
4863
4860
  latestVersionCreator = _solidLogic.store.any(latestVersion, ns.foaf('maker')); // use latest content if same owner, else use original
@@ -4867,9 +4864,9 @@ function _renderMessageRow() {
4867
4864
  debug.log(latestVersionCreator);
4868
4865
  msgId = creator.uri === (latestVersionCreator === null || latestVersionCreator === void 0 ? void 0 : latestVersionCreator.uri) ? latestVersion : message;
4869
4866
  content = _solidLogic.store.any(msgId, ns.sioc('content'));
4870
- _context10.next = 19;
4867
+ _context10.next = 17;
4871
4868
  return (0, _chatLogic.allVersions)(msgId);
4872
- case 19:
4869
+ case 17:
4873
4870
  versions = _context10.sent;
4874
4871
  if (versions.length > 1) {
4875
4872
  debug.log('renderMessageRow versions: ', versions.join(', '));
@@ -4911,35 +4908,38 @@ function _renderMessageRow() {
4911
4908
  msg.created = _solidLogic.store.any(msgId, ns.dct('created')).value;
4912
4909
  msg.content = content.value;
4913
4910
  msg.maker = creator.uri;
4914
-
4915
- // verify signature
4916
- if (!(signature !== null && signature !== void 0 && signature.value)) {
4917
- // unsigned message
4918
- unsignedMessage = true;
4919
- debug.warn(msgId.uri + ' is unsigned'); // TODO replace with UI (colored message ?)
4920
- } else {
4921
- // signed message, get public key and check signature
4922
- (0, _keys.getPublicKey)(creator).then(function (publicKey) {
4923
- debug.log(creator.uri + '\n' + msg.created + '\n' + msg.id + '\n' + publicKey);
4924
- if (!publicKey) {
4925
- debug.warn('message is signed but ' + creator.uri + ' is missing publicKey');
4926
- }
4927
- // check that publicKey is a valid hex string
4928
- var regex = /[0-9A-Fa-f]{6}/g;
4929
- if (!(publicKey !== null && publicKey !== void 0 && publicKey.match(regex))) debug.warn('invalid publicKey hex string\n' + creator.uri + '\n' + publicKey);
4930
- // verify signature
4931
- else if (signature !== null && signature !== void 0 && signature.value && !(0, _signature.verifySignature)(signature === null || signature === void 0 ? void 0 : signature.value, msg, publicKey)) debug.warn('invalid signature\n' + msg.id);
4932
- });
4911
+ messageRow = dom.createElement('tr'); // verify signature
4912
+ if (signature !== null && signature !== void 0 && signature.value) {
4913
+ _context10.next = 38;
4914
+ break;
4933
4915
  }
4934
- _context10.next = 38;
4935
- return (0, _chatLogic.originalVersion)(message);
4916
+ // unsigned message
4917
+ messageRow.setAttribute('style', style.textInputBackgroundColorHighlight);
4918
+ _context10.next = 48;
4919
+ break;
4936
4920
  case 38:
4921
+ _context10.next = 40;
4922
+ return (0, _keys.getPublicKey)(creator);
4923
+ case 40:
4924
+ publicKey = _context10.sent;
4925
+ debug.log(creator.uri + '\n' + msg.created + '\n' + msg.id + '\n' + publicKey);
4926
+ if (!publicKey) {
4927
+ debug.warn('message is signed but ' + creator.uri + ' is missing publicKey');
4928
+ }
4929
+ // check that publicKey is a valid hex string
4930
+ regex = /[0-9A-Fa-f]{6}/g;
4931
+ validSignature = (0, _signature.verifySignature)(signature === null || signature === void 0 ? void 0 : signature.value, msg, publicKey);
4932
+ validPublicKeyHexString = publicKey === null || publicKey === void 0 ? void 0 : publicKey.match(regex);
4933
+ if (!validPublicKeyHexString) debug.warn('invalid publicKey hex string\n' + creator.uri + '\n' + publicKey);else if (signature !== null && signature !== void 0 && signature.value && !validSignature) debug.warn('invalid signature\n' + msg.id);
4934
+ if (!validSignature || !validPublicKeyHexString) messageRow.setAttribute('style', style.textInputBackgroundColorError);
4935
+ case 48:
4936
+ _context10.next = 50;
4937
+ return (0, _chatLogic.originalVersion)(message);
4938
+ case 50:
4937
4939
  originalMessage = _context10.sent;
4938
4940
  edited = !message.sameTerm(originalMessage); // @@ load it first @@ Or display the new data at the old date.
4939
4941
  // @@@ kludge!
4940
4942
  sortDate = _solidLogic.store.the(originalMessage, ns.dct('created'), null, originalMessage.doc()) || _solidLogic.store.the(message, ns.dct('created'), null, message.doc()); // In message
4941
- messageRow = dom.createElement('tr');
4942
- if (unsignedMessage) messageRow.setAttribute('style', 'background-color: red');
4943
4943
  messageRow.AJAR_date = sortDate.value;
4944
4944
  messageRow.AJAR_subject = message;
4945
4945
  td1 = dom.createElement('td');
@@ -4990,9 +4990,9 @@ function _renderMessageRow() {
4990
4990
  bgcolor = colorizeByAuthor ? pad.lightColorHash(creator) : getBgColor(fresh);
4991
4991
  para.setAttribute('style', messageBodyStyle + 'background-color: ' + bgcolor + ';');
4992
4992
  }
4993
- _context10.next = 59;
4993
+ _context10.next = 69;
4994
4994
  return (0, _messageTools.sentimentStripLinked)(message, message.doc());
4995
- case 59:
4995
+ case 69:
4996
4996
  strip = _context10.sent;
4997
4997
  if (strip.children.length) {
4998
4998
  td2.appendChild(dom.createElement('br'));
@@ -5057,7 +5057,7 @@ function _renderMessageRow() {
5057
5057
  }));
5058
5058
  }
5059
5059
  return _context10.abrupt("return", messageRow);
5060
- case 68:
5060
+ case 78:
5061
5061
  case "end":
5062
5062
  return _context10.stop();
5063
5063
  }
@@ -11069,6 +11069,8 @@ var style = {
11069
11069
  formFieldNameBoxStyle: "padding: 0.3em; vertical-align: middle; width:".concat(formFieldNameBoxWidth, ";"),
11070
11070
  textInputBackgroundColor: '#eef',
11071
11071
  textInputBackgroundColorUneditable: '#fff',
11072
+ textInputBackgroundColorError: 'background-color: #fee;',
11073
+ textInputBackgroundColorHighlight: 'background-color: #fdeadc;',
11072
11074
  textInputColor: '#000',
11073
11075
  textInputColorPending: '#888',
11074
11076
  multilineTextInputStyle: 'font-size:100%; white-space: pre-wrap; background-color: #eef;' + ' border: 0.07em solid gray; padding: 1em 0.5em; margin: 1em 1em;',
@@ -14368,8 +14370,8 @@ Object.defineProperty(exports, "__esModule", ({
14368
14370
  }));
14369
14371
  exports.versionInfo = void 0;
14370
14372
  var versionInfo = {
14371
- buildTime: '2023-06-06T08:34:10Z',
14372
- commit: '7b1c0b2d7ab8de07add05b789f87dfdbeb68b960',
14373
+ buildTime: '2023-06-06T09:58:09Z',
14374
+ commit: '7d93d5d2c946c99747446d9189b9117e05440d88',
14373
14375
  npmInfo: {
14374
14376
  'solid-ui': '2.4.28',
14375
14377
  npm: '8.19.4',